Retrieval Augmented Generation

Layer 1 · Intuition

Retrieval Augmented Generation

Why a model that has read the whole internet still can't answer questions about your company, and how retrieval fixes it.

6 min read40 XP

  1. Question

    "what's our refund window?"

  2. Retrieve

    search your documents

  3. Augment

    paste passages into the prompt

  4. Generate

    model answers from them

Retrieval Augmented Generation, in four moves.

A language model knows only what was in its training data, frozen at the moment training stopped. Ask it about your internal handbook, last week's incident report, or a customer's order history and it has two options: admit ignorance, or invent something plausible. Retrieval Augmented Generation (RAG) removes the dilemma by fetching the relevant text first and handing it to the model as part of the prompt.

What the acronym actually names

  • Retrieval — a search step that finds passages likely to contain the answer. Usually semantic search over embeddings, often blended with old-fashioned keyword search.
  • Augmented — those passages are inserted into the prompt, typically above the user's question, with an instruction to answer from them.
  • Generation — the model writes the answer. Its job shifts from *recall* to *reading comprehension*, which it is far better at.

Nothing about the model changes. No training, no weights touched, no GPUs rented. RAG is a system built *around* a model, which is exactly why it became the default way to ship LLM features on private data: you can add a document at 10am and the assistant knows about it at 10:01.

Fine-tuning

  • Teaches style, format, and behaviour
  • Knowledge is baked in and stale
  • Needs a training run to update
  • Can't cite where an answer came from

RAG

  • Teaches facts, freshly, at query time
  • Knowledge is whatever's in the index
  • Update = add a document
  • Every answer can carry sources
They solve different problems, and serious systems use both.

Where it goes wrong

RAG is not a hallucination cure — it is a hallucination *reducer* whose ceiling is set by the retrieval step. If search returns the wrong three paragraphs, the model will confidently answer from the wrong three paragraphs. In practice, the overwhelming majority of bad RAG answers are retrieval failures wearing a generation costume, which is why the rest of this star spends most of its time on the search half.

  • The answer exists in your corpus but search never surfaced it (a recall failure).
  • Search surfaced it, but buried it beneath nine irrelevant passages the model trusted more.
  • The answer is spread across five documents and no single passage contains it.
  • The corpus contains two contradictory documents and nothing marks which is current.

Check your understanding

3 questions · answer all to submit

  1. 1.What fundamentally changes about the language model itself when you deploy a RAG system?

  2. 2.A team reports that their RAG assistant confidently gives an outdated answer that does appear, correctly, in a newer document in their corpus. Where does the fault most likely lie?

  3. 3.Which complaint about an LLM feature is best addressed by fine-tuning rather than by retrieval?