A generator is the language-model component of a retrieval-augmented generation system. It conditions on retrieved context and produces a coherent, informed response without changing its underlying parameters. section 5.4 section 5.4.3
A generator’s behavior depends on how the surrounding retrieval pipeline supplies context:
- Receives the user query together with passages selected by a retriever. section 5.4
- Uses dynamically engineered context at inference time rather than relying only on static parameters or preference-training updates. section 5.4
- May be an open- or closed-source LLM capable of handling the available context window and constrained generation. section 5.4.3
- Produces better-grounded answers when retrieval, chunking, top-k selection, and optional reranking provide relevant context. section 5.4.3
Generating an answer from reranked context
For the query “What was Amazon's net income in 2023?”, a retriever selects documents, an optional reranker compresses or reorders them, and the generator uses the resulting context to produce the answer through a RetrievalQA 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 generator’s position in the RAG workflow: documents are chunked and embedded, matching passages are retrieved and optionally reranked, then the final context and query reach the language model. section 5.4.3











