AppliedAIPrep logoAppliedAI/Prep
Courses/Applied AI Engineering/Retrieval13 min read

Why retrieval exists, and what it actually buys you

Retrieval is the standard answer to making a model useful on knowledge it never saw. This lesson covers the three problems it solves at once, the one thing it does not fix, and the shape every system in this module is built from.

TL;DR: A model knows what it absorbed in training and nothing about your documents. Retrieval fixes that by finding the relevant passages at question time and putting them in the prompt. It solves knowledge, freshness and checkability in one move, and it does not make the model correct. It shifts the failure from "the model invented this" to "we retrieved the wrong thing", which is a far better problem to have because you can see it.

Where you are. Everything so far has been about a single model call: what it does, what to send it, and how to tell whether it worked. Here is the first real architecture, and the one you are most likely to build first at work. Modules 2 and 3 have been pointing here.

Three problems, one mechanism

A model was trained once on a large amount of public text. That gives you a system with three specific gaps, and they are usually described separately even though one thing fixes all three.

It does not know your documents. Your handbook, your contracts, your tickets, your codebase. None of it was in training, and no amount of prompting changes that.

It does not know what happened recently. Training has an end date. Anything after it does not exist as far as the model is concerned, and it will answer questions about it anyway, from whatever it learned before.

You cannot check its answers. When a model answers from what it absorbed, there is no source to point at. You get an assertion. For anything a business depends on, an unverifiable assertion is close to useless.

Retrieval addresses all three by changing where the knowledge comes from. Instead of hoping it is in the model, you find the relevant material at question time and put it in the prompt.

rendering diagram…

The model stops being the source of knowledge and becomes the thing that reads and phrases it. That reframing is the whole idea, and it is worth holding onto: you are not teaching the model anything. You are handing it the page.

What you actually get

Three things, and the third is the one people undervalue.

Knowledge it never had, without training anything.

Freshness for free. Update a document and the next question sees the new version. There is no retraining step, which is the single biggest practical advantage over the alternatives and the reason this pattern won.

Checkability. Because the answer came from specific passages, you can show them. The user can verify. You can programmatically confirm that a claim appears in what you supplied. This is what makes a system trustworthy enough to deploy in a place where being wrong matters, and module 6 leans on it heavily.

What it does not fix

Now the honest part, because retrieval is sold as a hallucination cure and is not one.

Retrieval moves the failure rather than removing it. If you retrieve the right passage, the model will usually answer well from it. If you retrieve a wrong, stale, or irrelevant passage, the model will answer confidently from that instead. It has no way to know the passage was the wrong one.

So the question changes from "why did the model make that up" to "why did we hand it that page". That is a substantially better position, for one specific reason: the new failure is visible. You can log what was retrieved, inspect it, and measure whether the right passage was in the set. You cannot inspect what a model absorbed in training.

The other thing retrieval does not fix is reasoning across many documents. Finding the three passages that mention a customer is easy; noticing that they contradict each other and working out which is current is not, and it is where most real systems disappoint. The failure-modes lesson later in this module is about that.

The shape you will build

Every retrieval system, including the most sophisticated, is this:

  1. Ahead of time: split documents into passages, embed each one, store them.
  2. At question time: embed the question, find the nearest passages, put them in the prompt with the question.

That is it. The remaining lessons in this module are about the fact that each of those five verbs has a decision inside it, and that the decisions matter more than which model you use. Step 1 alone, splitting documents into passages, decides more about final quality than almost anything else you will choose, which is why it gets its own lesson next.

Do this before moving on

Take twenty documents you have: notes, a handbook, past emails, anything. Write down three questions a colleague might genuinely ask about them.

Now, by hand, find the passage that answers each one. Note two things while you do it: how long a passage you needed for the answer to make sense on its own, and whether the answering passage used the same words as your question.

Those two observations are the subject of the next two lessons. Doing this by hand for ten minutes will make both of them concrete rather than abstract.

Go deeper

  • RAG pipeline is the reference for the shape above, with the pieces named as you will meet them in code.
  • Retrieval versus long context is the alternative this lesson assumes you have rejected, argued properly. Worth reading before you commit to building any of this.
  • Citations and grounding is the checkability point taken seriously, and it is what turns retrieval from a quality trick into a trust mechanism.
  • Practice question: Design a production RAG system is the whole module as one interview question, and among the most frequently asked in applied AI loops.
  • Practice question: Your retrieval recall is low. How do you debug it? is the "why did we hand it that page" question in its practical form, and it is where this module ends up.

Key takeaways

  • Retrieval solves three problems at once: knowledge the model never had, freshness with no retraining, and answers you can check against a named source.
  • The model stops being the source of knowledge and becomes the thing that reads it.
  • It does not remove hallucination, it relocates the failure to retrieval, where you can see and measure it.
  • Every system is the same five verbs: split, embed, store, then embed the question and find the nearest passages.
LEARNING LAB1 of 4

Check yourself before an interviewer does. Answer from memory first.

A grounded system confidently gives a wrong answer. Where should you look first?

Sign in to track where you are in this course.