The method was described by Lewis et al. in 2020 and is now the standard way to make AI answer questions about a specific body of material.
The closest everyday comparison is an open-book exam: instead of relying on what it remembers from training, the model has the relevant pages open in front of it.
How does RAG work?
The retrieval step is a search. Your question is compared against an index of your documents, often using a method that matches by meaning rather than exact wording, and the best few passages are pulled out.
The generation step places those passages in the model's context window alongside your question, usually with an instruction to answer only from them and to say where each point came from.
What does RAG fix, and what doesn't it?
It targets the main weakness of language models, which is confident invention. With the source in front of it, the model has less room to make things up, and you can check its answer against the passage it used. It also keeps answers current: a model's training stops at a cutoff date, but your documents can be updated this morning.
It doesn't make the model infallible. The model can still misread a passage, and if the search pulls the wrong three paragraphs, the answer will be fluent and wrong, which is harder to spot than an obvious guess. The quality of the retrieval matters as much as the quality of the model, and the typical failure shifts from "made it up" to "didn't find it".
An example
An architecture practice keeps 400 pages of internal procedures. Someone asks: "What's our sign-off process for a client variation over £5,000?"
Without retrieval, the model produces a sensible-sounding generic process that doesn't match the practice's own. With retrieval, the two relevant paragraphs from the procedures manual are found and supplied, and the answer quotes the real process with a reference to the section, which anyone can check in under a minute.
RAG or fine-tuning?
RAG supplies knowledge at the moment of answering, while fine-tuning changes the model's behaviour through extra training. Use RAG for facts that change, documents you control and anything you need to cite. Fine-tuning suits a consistent style, a fixed output format or a narrow task the model keeps getting wrong in the same way. If the answer lives in a document, retrieval is usually the right first step.
Common questions
Is RAG the same as AI memory?
No. AI memory is what an agent keeps about you between conversations, such as your preferences and ongoing projects. RAG fetches source material to answer one particular question. Many systems use both side by side.
Does RAG stop hallucinations?
It reduces them and makes them easier to catch, because you can open the cited passage and compare. It doesn't eliminate them, particularly when the documents themselves are out of date or contradict each other. See AI hallucination for how to check output.
Do I need RAG for a personal agent?
Only if you regularly need answers drawn from a large set of documents, such as a procedures manual or a folder of contracts. For planning, drafting and thinking through decisions, memory and the conversation itself usually give the agent enough to work with.