liveBook · Manning

Vector database

As explained in Transformers in Action

A vector database is a database optimized for storing, indexing, and searching vector representations by their similarity.

A vector database stores document embeddings and supports similarity-based retrieval, giving retrieval-augmented generation access to current, custom, or domain-specific information without retraining the language model. section 3.4

A vector database participates in a retrieval pipeline:

  • Stores embeddings generated from chunked documents in a searchable collection. section 3.4 section 5.4.3
  • Receives a query embedding produced by the same embedding model used for stored documents. section 3.4
  • Performs similarity search, commonly through fast approximate nearest-neighbor search, to return relevant passages. section 5.4.3
  • Passes retrieved context to an optional reranker and then to a language model for answer generation. section 5.4.3

Retrieval with reranking

A RAG system can retrieve passages for “What was Amazon's net income in 2023?”, use Flashrank or JinaRerank to refine context selection, and provide the ranked context to a retrieval QA chain. section 5.4.3

Figure 5.2 Overview of a RAG system. In the preproduction phase, documents from a knowledge base are chunked and embedded into a vector database. During the production phase, a user query is embedded and used to retrieve top-matching documents based on similarity. An optional reranker refines these results to improve relevance. The final ranked context is then passed, together with the original query, to the language model for response generation.
figure

Trace the preproduction and production flow from document chunking and embedding through similarity retrieval, reranking, and language-model generation. section 5.4.3

How Transformers in Action covers it

How deep it goes
Explains storage, embeddings, similarity retrieval, approximate nearest-neighbor search, and tuning concerns, but stops short of database internals.
Examples
Uses chunked documents, query embeddings, top-matching passages, and Flashrank or JinaRerank refinement as concrete pipeline examples.
What it assumes
Assumes familiarity with language models while defining embedding models, vector representations, and their retrieval role.
What you can do after
Operate/configure RAG retrieval by selecting a vector store, embedding model, retrieval strategy, chunk size, and top-k value.
How it connects
Connects embedding models, RAG, similarity search, chunking, metadata, reranking, and language models into one retrieval workflow.

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 Transformers in Action. The section links point to the parts of the book it draws on.