Retrieval-augmented generation (RAG)
Last updated: July 26, 2026
Retrieval-augmented generation (RAG) is a technique where a model fetches relevant outside documents and uses them to write its answer, instead of relying only on training data. Introduced by Lewis et al. in 2020, RAG reduces hallucination by grounding answers in real text — but it doesn't eliminate it.
What is retrieval-augmented generation?
Retrieval-augmented generation (RAG) is a technique where a model first retrieves relevant documents from an external store, then writes its answer using that retrieved text as context. Instead of relying only on facts baked into its weights, the model has fresh, specific evidence in front of it.
The approach was introduced by Patrick Lewis and colleagues in the 2020 paper Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, published at NeurIPS 2020. See the original paper. RAG combines a retriever (which finds relevant passages) with a generator (which produces the answer), so the model's output is anchored to real documents.
RAG is now standard in production AI systems — it is how chatbots answer from your company's docs, and how many assistants stay current past their knowledge cutoff.
Why RAG reduces but doesn't eliminate hallucination
RAG helps because a model with the right document in context is far less likely to invent a fact. But it is not a cure, for several reasons:
- Retrieval can miss. If the retriever fetches the wrong or no documents, the model falls back on its weights and can confabulate anyway.
- The model can misread the source. Even with the right passage, it may overstate, misattribute, or blend it with invented detail.
- Retrieved sources can be wrong. RAG grounds the answer in whatever was retrieved — if that document is outdated or false, so is the answer.
This is the difference between RAG as a generation technique and verification as an audit. RAG gives the model evidence up front; verification checks the finished claims against independent sources afterward. They are complementary — Mephistopheles verifies the output regardless of whether RAG was used. See how it works.
A worked example
A support bot uses RAG over a product manual. Ask 'what's the warranty?' and it retrieves the warranty page and answers correctly. Now ask something the manual doesn't cover. Retrieval returns loosely related pages, and the model — still under pressure to answer — stitches together a plausible warranty term that isn't real. RAG lowered the odds of this, but the gap remained.
A verifier catches the invented term by grounding it against the actual manual and returning contradicted or unverifiable.
Frequently asked questions
Does RAG stop AI hallucinations?
No, it reduces them. RAG gives the model real documents to answer from, which lowers the chance of invention — but retrieval can miss, the model can misread a source, and a retrieved source can itself be wrong. RAG is a strong mitigation, not a cure, which is why verifying the output still matters. See AI hallucination.
Who invented RAG?
RAG was introduced by Patrick Lewis and colleagues in the 2020 paper 'Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks', presented at NeurIPS 2020. It combined a neural retriever with a sequence-to-sequence generator, using external sources like Wikipedia. See the original paper.
Is RAG the same as fact-checking?
No. RAG is a generation technique — it feeds documents to a model as it writes. Fact-checking is an audit of the finished answer against independent sources. RAG happens before the answer; verification happens after, and can catch errors RAG let through.
Verify what your AI just told you.
Paste any AI answer and Mephistopheles checks each claim against independent sources — no sign-up to try.