What retrieval-augmented generation actually solves

Building RAG systems · Lesson 1 / 24

The model knows language, but it does not know your contracts folder

A language model is trained on text you do not have, and it is not trained on the text you do have. Ask it about the refund policy your company has been running since April and it will answer confidently and plausibly, because it generates a continuation instead of checking a source. Retrieval-augmented generation changes the input, not the model. Before generation the system finds the chunks of your collection that relate to the question, places them in the prompt and requires the answer to be built from them. The model stops being the source of facts and becomes the component that restates what was found.

What you actually get

  • Freshness without retraining. Someone edits a document, you reindex the chunk, and the next answer is already different. The distance between an edit in the source and a change in the answer is measured in minutes, not in training cycles.
  • Verifiability. An answer can carry a citation pointing at the chunk it came from. The user opens the document and checks it personally, and when a complaint arrives you can see exactly what the system read.
  • Access control. The permission filter applies to retrieval, so the same assistant answers different people from different sets of documents. In a fine-tuned model knowledge cannot be separated by owner: it is smeared across the weights.
  • Collection scale. An index over tens of millions of chunks is an ordinary engineering task. A context window of tens of millions of tokens is not.

Where the line of responsibility runs

From the first day it pays to treat the system as two different mechanisms rather than one. Retrieval answers the question of whether the needed text is present in the context. Generation answers the question of whether the wording is correct given what it was handed. These two mechanisms fail for different reasons, are repaired in different ways and must be measured with different metrics. Blurring them is the main reason teams spend months permuting prompts when the real defect sits in how documents were chunked.

question
  |
  +--> retrieval --> 5 chunks --+       failure here: the text is not there
  |                             |
  +-----------------------------+--> prompt --> model --> answer
                                                failure here: text was there, answer wrong

Why retrieval is the bottleneck

If the needed chunk is absent from the context, nothing further can save the answer. A stronger model will not restore a missing fact, a stricter prompt will not turn ignorance into knowledge, and temperature zero will not help. In post-mortems of failed systems, the share of errors whose root cause sits before generation is usually between two thirds and four fifths. From that follows a practical order of work: first measure whether the reference chunk reaches the retrieved set, and only then argue about the wording of the answer.

Insight. You need this architecture not because the model knows too little, but because you need the address of the source. Even if the model had memorised every document you own, you would still need a link the user can follow to verify the answer and you can follow to investigate a complaint.
Common mistake. Assuming that plugging in retrieval removes hallucination by itself. It changes its character instead: the model stops inventing facts out of thin air and starts filling in missing details around a chunk it really retrieved, plausibly and invisibly.
Pro tip. The first thing worth building is not an answering bot but a screen that shows the retrieval output for an arbitrary question: the chunk text, its source and its score. Half of your future bugs are diagnosed on that screen in seconds.

Cheat sheet

  • The architecture changes the input to the model, not the model itself.
  • Retrieval and generation are two mechanisms with different failures and different metrics.
  • If the chunk is not in the context, no prompt will help.
  • A citation is needed both by the user for checking and by you for investigation.
1. Why is access control easier to implement through retrieval than through fine-tuning?
2. What does the claim that retrieval is the bottleneck of the system mean?
3. How does the character of hallucination change once retrieval is added?

🔒 Answer the question correctly to move on to the next lesson.

What retrieval-augmented generation actually solves — Building RAG systems — Skilvy