liveBook · Manning

Generator

As explained in Transformers in Action

A generator is a generative model component that produces an output from an input representation or retrieved context.

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.
figure

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

How Transformers in Action covers it

How deep it goes
Explains inputs, role, and model choices, but stops short of generator internals or parameter-training procedures.
Examples
Uses a RAG workflow and an Amazon net-income query to illustrate context selection followed by answer generation.
What you can do after
Operate a RAG pipeline that passes retrieved or reranked context to an LLM for response generation.
How it connects
Connects the generator to retrieval, vector databases, embedding models, rerankers, context engineering, and language models.

Also explained in

Compare how 12 books explain generator →

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.