Concept 05 · 8 min
It hasn’t read your documents. Unless someone hands it the right pages, right before it answers.
Scroll to start
Scene 1
Closed book, open book
Mr. Miller wants his overdraft raised to €18,000. Sarah asks the assistant whether she can approve it herself.
Add the right pages to its prompt, and compare the answers.
Prompt: the question alone
Sarah
Can I approve Mr. Miller’s overdraft increase to €18,000 myself?
Assistant
Without your pages, the LLM answers from what it learned in training: generic, and no use to your bank. Adding the right pages to its prompt, in its context window, right before it answers, is called RAG, retrieval-augmented generation. The hard part: finding the right pages.
Scene 2
The librarian
Your bank has thousands of pages, and its context window holds a few. Same question: scroll to follow the RAG search through the shelves.
| Rank | Document | Passage | Relevance | Cited as |
|---|---|---|---|---|
| 1 | Miller Joinery client file | Overdraft limit: €10,000. Mr. Miller has asked to raise it to €18,000. One invoice is 12 days overdue. | 1 | |
| 2 | Overdraft policy (2026) · §3 | Approval: relationship managers may approve business overdraft limits up to €20,000, provided no invoice is more than 30 days overdue. Above €20,000, the credit committee decides. | 2 | |
| 3 | Overdraft policy (2026) · §1 | Scope: this policy covers authorised overdrafts on business current accounts. | 3 | |
| 4 | Overdraft policy (2026) · §2 | Requests: the client applies in writing. The relationship manager checks the last three months of statements. | ||
| 5 | Complaints procedure | Refunds up to €200 are approved by the branch manager. Always mention the mediation service. | ||
| 6 | Fee schedule (2026) | Overdraft interest is charged monthly, at the rate shown on the statement. | ||
| 7 | Miller Joinery client file | Client since 2019. Accounts: business current account, savings account, equipment loan. | ||
| 8 | Fee schedule (2026) | Business card: €4 per month. | ||
| 9 | Complaints procedure | Reply within 48 hours: apologize, state the fix, give a follow-up date. | ||
| 10 | Cafeteria menu, week 40 | Monday: vegetable soup. Tuesday: roast chicken. Wednesday: fish of the day. | ||
| 11 | Cafeteria menu, week 40 | Thursday: lasagna. Friday: quiche. |
| Rank | Document | Passage | Relevance | Cited as |
|---|---|---|---|---|
| 1 | Miller Joinery client file | Overdraft limit: €10,000. Mr. Miller has asked to raise it to €18,000. One invoice is 12 days overdue. | 1 | |
| 2 | Overdraft policy (2026) · §3 | Approval: relationship managers may approve business overdraft limits up to €20,000, provided no invoice is more than 30 days overdue. Above €20,000, the credit committee decides. | 2 | |
| 3 | Overdraft policy (2026) · §1 | Scope: this policy covers authorised overdrafts on business current accounts. | 3 | |
| 4 | Overdraft policy (2026) · §2 | Requests: the client applies in writing. The relationship manager checks the last three months of statements. | ||
| 5 | Complaints procedure | Refunds up to €200 are approved by the branch manager. Always mention the mediation service. | ||
| 6 | Fee schedule (2026) | Overdraft interest is charged monthly, at the rate shown on the statement. | ||
| 7 | Miller Joinery client file | Client since 2019. Accounts: business current account, savings account, equipment loan. | ||
| 8 | Fee schedule (2026) | Business card: €4 per month. | ||
| 9 | Complaints procedure | Reply within 48 hours: apologize, state the fix, give a follow-up date. | ||
| 10 | Cafeteria menu, week 40 | Monday: vegetable soup. Tuesday: roast chicken. Wednesday: fish of the day. | ||
| 11 | Cafeteria menu, week 40 | Thursday: lasagna. Friday: quiche. |
The search kept the three closest passages and added them to the prompt, in the context window; the answer cites each one with a number: a citation you can open. That’s RAG: search first, then answer.
Scene 3
How many passages?
The search ranks every passage of the library, the archived 2023 policy included. How many should RAG hand over?
Slide to choose how many passages it gets, and watch the answer.
Handed over · 3/11
- 1Miller Joinery client file
- 2Overdraft policy (2026) · §3
- 3Overdraft policy (2026) · §1
- Overdraft policy (2026) · §2
- Complaints procedure
- Fee schedule (2026)
- Miller Joinery client file
- Fee schedule (2026)
- Complaints procedure
- Cafeteria menu, week 40
- Cafeteria menu, week 40
Assistant
RightHis file and the 2026 rule: the right answer, cited.
Scene 4
Curate the library
Now you run the RAG. Choose which documents are on the shelves, pick a question, and run the search.
Challenge
- Get the right answer to Mr. Miller’s request, with the right sources.
- Bonus: make it cite a source and still be wrong.
Choose the documents on the shelves and a question, then run the RAG search.
On the shelves
Always there: Fee schedule (2026) · Complaints procedure
Nothing searched yet.
RAG only finds what’s on the shelves, and can’t tell a current page from an archived one. Unlike a hallucination, this wrong answer comes from a real page: an outdated one. Keep the library clean.
Scene 5
The RAG pipeline, step by step
Here is what a RAG system does behind the scenes, in order. Scroll: the diagram moves forward, and the trace shows what each part passes to the next.
| Step | Part | What it passes on |
|---|---|---|
| 1 | Prompt | Sarah’s question |
| 2 | Retriever | the question’s meaning, compared with every passage |
| 3 | Best results | the 3 closest passages |
| 4 | Context window | instruction + numbered passages + question |
| 5 | LLM | an answer that cites its sources |
| 6 | Answer | the answer, with sources to open |
The prompt sent to the LLM:
Answer only from the sources below and cite them like [1]. If they don’t contain the answer, say so. [1] Miller Joinery client file: Overdraft limit: €10,000. Mr. Miller has asked to raise it to €18,000. One invoice is 12 days overdue. [2] Overdraft policy (2026) §3: Approval: relationship managers may approve business overdraft limits up to €20,000, provided no invoice is more than 30 days overdue. Above €20,000, the credit committee decides. [3] Overdraft policy (2026) §1: Scope: this policy covers authorised overdrafts on business current accounts. Can I approve Mr. Miller’s overdraft increase to €18,000 myself?
| Step | Part | What it passes on |
|---|---|---|
| 1 | Prompt | Sarah’s question |
| 2 | Retriever | the question’s meaning, compared with every passage |
| 3 | Best results | the 3 closest passages |
| 4 | Context window | instruction + numbered passages + question |
| 5 | LLM | an answer that cites its sources |
| 6 | Answer | the answer, with sources to open |
The prompt sent to the LLM:
Answer only from the sources below and cite them like [1]. If they don’t contain the answer, say so. [1] Miller Joinery client file: Overdraft limit: €10,000. Mr. Miller has asked to raise it to €18,000. One invoice is 12 days overdue. [2] Overdraft policy (2026) §3: Approval: relationship managers may approve business overdraft limits up to €20,000, provided no invoice is more than 30 days overdue. Above €20,000, the credit committee decides. [3] Overdraft policy (2026) §1: Scope: this policy covers authorised overdrafts on business current accounts. Can I approve Mr. Miller’s overdraft increase to €18,000 myself?
Prompt, search, best results, context, answer: every RAG system follows these steps. When an answer is wrong, one of them failed, most often the search.
Hype vs reality
- What the hype says
“We trained the AI on our documents.”
What actually happensUsually not: it searches them when you ask and reads a few passages. Remove a document and the knowledge is gone.
- What the hype says
“It has read all our documents.”
What actually happensIt reads the handful of passages the search returns. If the search misses the right page, the answer misses too.
- What the hype says
“With sources, no more hallucinations.”
What actually happensSources make hallucinations rarer and errors checkable. An outdated page, cited perfectly, is still wrong.
Under the hood
Search, then answer: the whole trick.
def answer(question): passages = search(library, question, top_k=3) # Retrieve: closest in meaning sources = "\n".join(f"[{i + 1}] {p}" for i, p in enumerate(passages)) prompt = instructions + sources + question # Augment: add them to the prompt return model(prompt) # Generate: write, with citationssearch compares embeddings: each passage becomes a list of numbers that captures its meaning, and the passages closest to the question come first. That’s how “approve it myself” finds “may approve”.
In 3 sentences
- RAG means search first, then answer: a few relevant passages go into the LLM’s context window, with your prompt.
- It answers from those passages and cites them, so you can check.
- The answer is only as good as the library and the search: outdated or missing pages mean wrong answers.
Did this make sense?
0/9 concepts unmagicked
Go to the challenge- 01LLMAvailable · How can it write so well without understanding? · Available
- 02ContextAvailable · Why does it forget what I said earlier? · Available
- 03PromptAvailable · Why are my results mediocre? · Available
- 04HallucinationsAvailable · Why does it make things up? When can I trust it? · Available
- 05RAGAvailable · How do I make it use our internal documents? · Available
- 06ToolsAvailable · How can it act, not just talk? · Available
- 07AgentAvailable · What is an agent, concretely? · Available
- 08SkillsAvailable · How do we specialize it without retraining? · Available
- 09Limits & safetyAvailable · What must I never trust it with? · Available
Solve the sandbox challenge to unmagic this concept.
Next step
How can it act, not just talk?
Giving hands to a brain
Use this journey with your teamsRecorded with Ministral 3 (8B), EmbeddingGemma (300M), Oct 9, 2026.