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.
Trace the preproduction and production flow from document chunking and embedding through similarity retrieval, reranking, and language-model generation. section 5.4.3

























