liveBook · Manning

Retrieval-augmented generation

As explained in LLM Evaluation and Alignment, The Foundational Ideas

Retrieval-augmented generation is a generation technique that retrieves external information and incorporates it into model responses.

Retrieval-augmented generation (RAG) combines information retrieval with language-model generation: retrieval supplies external knowledge, while the model synthesizes an answer from the user’s question and retrieved context. This separates knowledge from intelligence and supports narrow-domain or up-to-date applications. section 6.0 section 6.1

A RAG system can be understood through its components and operating modes:

  • Retrieval selects external documents or passages from sources such as search engines, vector databases, structured databases, APIs, or file systems. section 6.1 section 6.1.1
  • Generation receives the question and retrieved context, then produces a synthesized response. section 6.1
  • Single-turn RAG retrieves once before generation; agentic RAG lets the model choose queries, tools, and additional searches. section 6.1
  • Evaluate retrieval and generation separately because either component can fail, and their errors can interact. section 6.0 section 6.5

Financial research assistant

A system retrieves an earnings report stating that Q3 revenue was $2.3 billion, grew 15% year over year, and was driven by cloud services. An answer repeating those claims is supported; claims about European expansion, a new CEO, or 30% international growth are extrinsic hallucinations because the retrieved documents contain no such evidence. section 6.0

RAG evaluation separates retrieval quality from generation quality. Precision and recall test document coverage; rank-aware metrics test whether relevant results appear before the context cutoff. RAGAS measures faithfulness, answer relevance, context recall, and context precision, helping identify retrieval gaps or unsupported generation. section 6.5

Figure 6.1 The basic single-turn Retrieval-Augmented Generation architecture. A user question is routed to a retrieval system, which queries a knowledge base and returns relevant documents. The LLM synthesizes an answer to the question and retrieves context, producing responses supported by sources.

Trace the basic single-turn flow from user question to retrieval, context injection, and generated answer. section 6.1

How LLM Evaluation and Alignment, The Foundational Ideas covers it

How deep it goes
Explains retrieval, generation, agentic variants, failure modes, and evaluation metrics without detailing implementation algorithms.
Examples
Uses a financial research assistant, earnings reports, retrieved passages, unsupported claims, and a single-turn architecture diagram.
What it assumes
Assumes language-model generation and retrieval as components while defining their interaction from a basic architectural model.
What you can do after
Evaluate retrieval and generation independently, diagnose hallucination causes, and select metrics for RAG production monitoring.
How it connects
Connects information retrieval, hallucination detection, language-model generation, vector databases, agentic RAG, and RAGAS.

Also explained in

Compare how 46 books explain retrieval-augmented generation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLM Evaluation and Alignment, The Foundational Ideas. The section links point to the parts of the book it draws on.