AI Topics

What is an LLM Vector Database?

Generative AI and LLMs 3 min read Written by the Ailoitte engineering team
On this page
  1. Definition
  2. How it works
  3. Examples
  4. Related terms
  5. Common questions
Definition

An LLM vector database is a database that stores data as vector embeddings, which are lists of numbers that capture meaning, and finds the entries closest in meaning to a query. It gives a large language model (LLM) a searchable store of documents, so the model can answer from relevant content instead of from its training data alone.

The term covers a wide range of products, from dedicated vector databases to extensions that add vector search to an existing relational database such as PostgreSQL. What they share is similarity search, which matches content by meaning and not by exact keywords, which is why a vector database sits at the centre of most retrieval-augmented generation systems.

An LLM vector database matters because a language model knows only what was in its training data and can hold a limited amount of text at once. Storing a company’s documents as embeddings lets an application fetch the few most relevant passages for each question, which keeps answers current and reduces invented facts.

How does an LLM vector database work?

  1. Turn content into embeddingsAn embedding model converts each piece of content, such as a paragraph or an image, into a vector. Content with a similar meaning ends up with vectors that sit close together.
  2. Index the vectorsThe database stores each vector with its source text and metadata such as date or author, which can be used to filter results. It builds an index, such as an HNSW graph, so that it can search millions of vectors without comparing the query with every one.
  3. Search by similarityA user's question is converted into a vector in the same way, and the database returns the stored vectors nearest to it, measured for example by cosine similarity. Most systems use an approximate nearest neighbour search, which trades a little accuracy for a large gain in speed.
  4. Pass the results to the LLMThe application adds the retrieved passages to the prompt. The language model then writes its answer from that content and can point to the sources it used.

What are examples of an LLM vector database?

  • SUPPORTAnswers from a help centreA company stores its help articles in a vector database. When a customer asks a question in their own words, the assistant retrieves the three closest articles and answers from them.
  • RETAILSearch that understands intentA shopper types a description such as a warm jacket for hiking in rain. The store's search returns waterproof insulated jackets even when those exact words are not in the product titles.
  • LEGALFinding similar clausesA legal team stores every clause from its past contracts as embeddings. A lawyer pastes a new clause and gets the most similar earlier clauses, with the contracts they came from.

Common questions about an LLM vector database

How is a vector database different from a traditional database?

A vector database finds items by similarity of meaning, while a traditional relational database finds rows that match exact values. A relational query asks for records where a field equals a value. A vector query asks for the items closest to an example. Many systems now offer both, by adding vector search to a relational database.

Does an LLM need a vector database?

No. A large language model can answer without one, using only its training data and the prompt. A vector database becomes useful when answers must come from private, recent or very large sets of documents, because it lets the application retrieve the relevant passages first. This approach is called retrieval-augmented generation (RAG).

Clutch Image
GoodFirms Image
Designrush Image
Reviews Image
Glassdoor Image