liveBook · Manning

Vector database

As explained in Introduction to Generative AI, Second Edition

A vector database is a data-management system optimized for storing and searching high-dimensional vector representations by similarity.

A vector database stores high-dimensional vector representations of text and searches them by semantic similarity. In retrieval-augmented generation (RAG), documents become embeddings, and a new query is converted into a vector so the system can retrieve related documents for a language model. section 8.13 section 10.20

A vector database supports grounded responses by:

  • Finding semantically similar documents or past examples rather than relying only on static model training data. section 8.13 section 10.20
  • Supplying retrieved text to the model context, which can improve factual accuracy and provide sources that users can inspect. section 8.13 section 10.20
  • Working alongside web search, memory, and planning as part of a broader system for selecting relevant information. section 10.20

Travel-policy question

An employee asks whether a five-hour sales-trip flight qualifies for premium-economy reimbursement. The query becomes a vector, similar policy documents are retrieved, and the language model answers using the relevant policy text. section 8.13

Restaurant recommendation

A RAG-enabled system can combine a user's earlier rejection of a steakhouse with Yelp retrieval when answering a question about vegan restaurants in Copenhagen. section 10.20

Figure 8.9 The architecture of retrieval-augmented generation (RAG)
A diagram of a data flow

AI-generated content may be incorrect.

Trace how embedded documents move through retrieval and into a language model's context. section 8.13

Figure 10.4 A schematic diagram for an LLM accessing data stored in a vector database and retrieving search results from the web
A white circle with black text

AI-generated content may be incorrect.

Compare vector-database retrieval with web search and other context sources in a language-model architecture. section 10.20

How Introduction to Generative AI, Second Edition covers it

How deep it goes
Explains embeddings, semantic similarity, nearest-neighbor retrieval, and context insertion, but does not detail database implementation.
Examples
Uses travel-policy retrieval and vegan-restaurant recommendations involving user memory, Yelp, and web search.
What it assumes
Assumes familiarity with text embeddings and semantic similarity while explaining their role in retrieval at a high level.
What you can do after
Apply it via retrieval-augmented generation to ground responses in related documents and make supporting sources inspectable.
How it connects
Connects embeddings, semantic similarity, retrieval-augmented generation, language models, web search, memory, and planning.

Also explained in

Compare how 26 books explain vector database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Introduction to Generative AI, Second Edition. The section links point to the parts of the book it draws on.