RAG, explained simply, is a way of letting an AI assistant look things up in your documents before it answers, instead of relying on what it memorised in training. It finds the most relevant passages, puts them in front of the model and asks it to answer from them. That's why it suits facts that change, and why it still needs checking.
Ask a general chatbot about your company's parental leave policy and it will answer confidently, from a blend of every policy it saw in training. Ask a system built with RAG and it will look up your actual policy first, then answer from that. The difference is the difference between a well-read stranger and a colleague with the handbook open on the desk.
RAG explained simply
RAG, short for retrieval-augmented generation, explained simply: before the model answers, a search step finds the passages in your documents most likely to hold the answer, and those passages are handed to the model along with your question. The model then writes its answer from what it was given, ideally citing where each part came from.
A language model on its own only knows what was in its training data, up to its knowledge cutoff. It doesn't know your handbook, last month's price list or yesterday's board minutes. RAG fixes that without retraining the model.
Step one: your documents are cut into pieces
Before anyone asks a question, the system prepares the documents. Long files are split into smaller passages, called chunks: a few paragraphs each, or a section under one heading. Picture an HR team in Leicester loading their staff handbook, leave policies and expenses rules. Each document becomes dozens of chunks.
What you'd see: usually nothing. This happens when files are uploaded or the collection is set up. Chunking matters more than it looks. A chunk that splits a rule from its exception can produce an answer that's half right.
Step two: each piece is turned into a searchable fingerprint
Each chunk is converted into an embedding, a long list of numbers that captures what the passage is about. Passages about similar things get similar numbers, even when they use different words. "Maternity leave" and "time off after having a baby" end up close together.
The embeddings go into an index, often a vector database. What you'd see: still nothing, unless you're the one building it.
Step three: you ask a question
Now the visible part. Someone in the Leicester team types: "Can I carry over unused holiday into next year?" The question is turned into an embedding too.
Step four: the system finds the closest passages
The system compares the question's embedding with every chunk's and picks the closest few. This is semantic search: matching on meaning rather than exact words. Many systems combine it with ordinary keyword search, because a policy number or a product code is better found by exact match.
What you'd see: in a good tool, a list of sources or highlighted passages alongside the answer.
Step five: the passages go into the prompt
The retrieved chunks are placed into the model's context window, with an instruction along the lines of "answer using only the passages below". The model doesn't search anything itself; it reads what it's handed. Understanding context windows explains why there's a limit on how much can go in.
Step six: the model answers, with citations
The model writes an answer from the passages and, if the tool supports it, cites which passage supports which sentence. This is called grounding: tying an answer to a source.
Step seven: you check it
RAG makes checking possible, not unnecessary. Open the cited passage and read it. Did the answer reflect it, including any exception? If no passage was cited, assume the model answered from memory.
Answer only from the documents I've uploaded. For every statement, quote the sentence it comes from and give the document name and section. If the documents don't answer the question, say so plainly instead of answering from general knowledge.
Two tools that show the pattern
You've probably used RAG already. Gemini Notebook answers from documents you upload. Its strength: Answers and audio overviews built only from your own documents✓. Its catch: It only knows what you upload, and the free plan limits sources per notebook✓. Perplexity does something similar over the web rather than your files, retrieving pages and citing them. Its catch is worth remembering for every RAG tool: Cited answers can still be wrong: open the sources✓.
Why RAG beats fine-tuning when facts change
Fine-tuning is the other way to give a model your knowledge: further training on your own examples so the knowledge lives inside the model. It's good for teaching a style or a format. For facts that change, it's the harder route.
| RAG | Fine-tuning |
|---|
| Where your facts live | In documents, looked up at question time | Inside the model, from training |
| Updating a fact | Replace the document; re-index | Train again |
| Showing a source | Natural: it cites the passage | Hard: the fact has no address |
| Removing something | Delete the document | Very difficult to make a model forget |
| Best for | Policies, prices, procedures, anything that moves | Tone, format, a specialised task |
| Typical effort | Moderate, mostly in preparing documents | Higher, and needs training data |
If your expenses rate changes, a RAG system needs one updated document. A fine-tuned model would keep giving the old rate until someone retrained it, and might blend the two. Small versus large AI models shows how a smaller model plus retrieval can sometimes match a much bigger one.
Where RAG goes wrong
- Out-of-date documents. The system will quote last year's policy happily if it's still in the collection.
- Poor chunking. A rule split from its exception.
- Nothing relevant found. Some systems then answer from memory without saying so.
- Access mistakes. A collection that includes documents some users shouldn't see will cheerfully quote them.
Learning the ideas behind it
On Teach me AI, the released modules closest to this are How large language models work, on the machinery RAG builds on, and Checking AI's work, on the habit in step seven. The glossary has a plain page for each term used here. Teach me AI's own Ask box shows the pattern from a user's side: it answers only from the site's checked content, cites where each answer came from, and declines off-topic questions. AI answers with citations describes how that looks.
Who this won't help: if you're building a RAG system for your organisation, you need engineering guidance on security and access as well as the concepts.