Lesson 9.1core2 h 30 min

Why RAG, and the canonical pipeline

Open-book answers from a closed-book model

A model's weights are frozen knowledge: stale, public and willing to guess. Retrieval-augmented generation fixes all three by fetching evidence at query time and letting the model answer from it with citations. Almost every serious LLM product built since 2023 — support assistants, enterprise search, coding tools, research agents (10.1 What is an agent? Loops, autonomy and workflows vs agents) — is a RAG system, and its failure modes are the failure modes of this pipeline. This lesson gives you the map that the rest of the phase fills in.

You'll be able to

  • Explain the three gaps of a frozen LLM and how retrieval addresses each
  • Decide between RAG, fine-tuning and long context for a given problem using cost and update frequency
  • Name the eleven stages of the canonical pipeline and what each one is responsible for
  • Diagnose a failing RAG system using the seven failure points and the retrieval-ceiling argument

Key ideas

  1. A frozen LLM has three gaps — stale, public-only and ungrounded knowledge; RAG fetches evidence at query time so the model answers from text it can cite.
  2. Lewis et al. (2020) wrote RAG as p(y|x) ≈ Σ_z p(z|x) p(y|x,z); modern RAG concatenates the top-k chunks and lets attention do the weighting.
  3. Knowledge problems → RAG; behaviour problems → fine-tuning; a small corpus queried rarely → long context with prompt caching. Real systems combine all three.
Show 4 more key ideas
  1. The pipeline has an offline half (ingest, parse, chunk, embed, index) and an online half (retrieve, rerank, assemble, generate, cite), with evaluation wrapped around everything.
  2. Retrieval quality is a ceiling: if the needed chunk is not in the top-k, no prompt can save the answer — measure recall@k before tuning prompts.
  3. The seven failure points (missing content, missed top rank, not in context, not extracted, wrong format, wrong specificity, incomplete) map each symptom to a pipeline stage.
  4. By 2026 RAG is a design pattern, not a model: hybrid retrieval, rerankers, contextual chunks, structured outputs and agentic, tool-driven retrieval.

Suggested path through this lesson