RAG Explained: Why Your Chatbot Still Makes Things Up

Retrieval-augmented generation is sold as the cure for hallucination. Stanford measured three RAG-based legal tools and found they fabricated answers 17% to 33% of the time. Here is the actual pipeline, the four places it breaks, and why almost all RAG debugging is search debugging.

Tech Talk News Editorial9 min read
ShareXLinkedInRedditEmail
RAG Explained: Why Your Chatbot Still Makes Things Up

Key takeaways

  • Retrieval-augmented generation reduces hallucination but does not eliminate it: a preregistered Stanford study of Lexis+ AI, Westlaw AI-Assisted Research and Ask Practical Law AI, all RAG-based, found they hallucinated between 17% and 33% of the time despite vendor claims of hallucination-free citations.
  • Four of the seven RAG failure points cataloged by Barnett and co-authors in January 2024 are decided by what reaches the context window rather than by how the model is prompted: missing content, the right document never ranking in the top k, the right passage being dropped during consolidation, and the model failing to extract an answer buried in noisy retrieved text.
  • Single-vector embedding search has a proven capacity limit tied to embedding dimension: on Google DeepMind’s LIMIT benchmark, built from short one-sentence documents, state-of-the-art embedding models struggle to reach 20% recall@100 while plain BM25 keyword search comes close to a perfect score.
  • Anthropic measured a 5.7% top-20 retrieval failure rate as its baseline and cut it to 1.9%, a 67% reduction, purely by adding chunk context, keyword search and a reranker, with no change to the generating model.
  • Language models do not defend correct knowledge against wrong retrieved text: the ClashEval benchmark, run over more than 1,200 questions in six domains, found models override their own correct prior more than 60% of the time when a retrieved passage contradicts it.

Two of the largest legal research vendors on earth told their customers that retrieval-augmented generation had solved hallucination. Thomson Reuters said its tool avoids them. Casetext said RAG eliminates them. In 2024 a team at Stanford ran the first preregistered empirical test of those claims and found the tools invented things between 17% and 33% of the time.[2]

I keep coming back to that study, because the gap it measures is not a gap between a good product and a bad one. It is a gap between what people think RAG does and what RAG actually does. Almost every team I talk to has the same mental model: bolt a search index onto a language model and the model stops lying. That is not the deal. The deal is much narrower, and understanding exactly how narrow it is turns out to be the difference between a retrieval system you can trust and a demo that embarrasses you in front of a customer.

17-33%
Hallucination rate of leading RAG-based legal research tools
65%
Share of queries Lexis+ AI answered accurately
42%
Share of queries Westlaw AI-Assisted Research answered accurately

What the original RAG paper actually promised

Retrieval-augmented generation is not a product category. It is a technique from a paper published on May 22, 2020 by Patrick Lewis and eleven co-authors at Facebook AI Research, University College London and NYU.[1] The idea: give a language model two kinds of memory instead of one. Parametric memory is what the model learned during training and carries in its weights. Non-parametric memory is an external index it can look things up in, in their case a dense vector index of Wikipedia queried by a neural retriever.

Read what they claimed. RAG models “generate more specific, diverse and factual language than a state-of-the-art parametric-only seq2seq baseline.”[1] More factual. Not factual. That is a comparative, and the comparison is against a 2020 model answering from memory alone, which is a low bar. The paper also names two problems it is trying to fix that had nothing to do with lying: providing provenance for a decision, and updating a model's world knowledge without retraining it.

So the honest description of RAG is that it makes a model's answers more current, more auditable and more grounded. Everything after that is marketing that got ahead of the citation.

The pipeline, and how much of it happens before the model wakes up

Here is what actually runs when someone types a question into a RAG-backed chatbot. It matters that you can see the whole thing at once, because the interesting failures are not where people look for them.

The pipeline

Five of the six stages finish before the model writes a token

Offline, before any question is asked

  • ChunkingDocuments are split into passages, commonly a few hundred tokens each, because a whole PDF will not fit in a prompt.
  • EmbeddingEach chunk is converted into a single vector, a list of numbers positioning that text in a space where nearby means similar in meaning.
  • IndexingThe vectors go into an index built for fast approximate nearest-neighbor lookup.

Retrieval, then reranking

The question is embedded the same way, the index returns the closest candidates, and an optional cross-encoder reorders them by reading each query and passage together.

What the model actually receives

  • Prompt assemblyThe surviving top k chunks are pasted above the question, usually with an instruction to answer only from the provided text.
  • GenerationThe model writes an answer from that pasted text plus everything already sitting in its weights.
Silently dropped, every single queryEvery chunk that ranked k+1 or lowerThe index returns a ranking, not a verdict. Nothing in the pipeline tells the model that the passage it needed finished eleventh.

A standard retrieval-augmented generation pipeline. Everything up to prompt assembly is information retrieval; only the final stage is a language model.

Takeaway

Generation is the last stage of six and the only one that is a language model. If you are tuning prompt wording to fix wrong answers, you are working on the one piece of this system that had the least chance to break.

In January 2024 Scott Barnett and four co-authors at Deakin University published a catalog of seven failure points from three production RAG systems, including a biomedical case study with 4,017 documents and 1,000 questions.[5] Their list: missing content, the answer never ranking in the top k, the passage getting dropped during consolidation, the model failing to extract an answer that is present, wrong format, wrong specificity, and incomplete answers. Count them. Three are pure retrieval failures. The fourth, the model not pulling out an answer that is sitting right there, the paper attributes to noise and contradictions in the passages retrieval handed over. Only the last three are about how the model was asked.

Failure one: the chunk boundary cuts the answer in half

Chunking is where most pipelines quietly break, and it breaks for a reason that sounds trivial until you see it in production. A chunk is embedded on its own, with no memory of the document it came from.

Anthropic's engineering team gave the cleanest example of this I have seen. Take a chunk from an SEC filing that reads “the company's revenue grew by 3% over the previous quarter.”[3] Which company? Which quarter? The chunk does not say, because the sentence three paragraphs up said it. Embed that chunk and you get a vector that is a decent match for every revenue sentence in every filing you own and a great match for none of them.

The fix is unglamorous: prepend a short generated summary of the surrounding document to each chunk before embedding it. Anthropic measured a baseline top-20 retrieval failure rate of 5.7%, meaning that in 5.7% of queries none of the twenty retrieved chunks contained the answer. Contextual embeddings alone cut that to 3.7%. Adding keyword search took it to 2.9%. Adding a reranker took it to 1.9%.[3]

Baseline top-20 retrieval failure rate

After the retrieval-side fix

  1. Contextual embeddings
    5.7%
    3.7%
  2. Contextual embeddings plus contextual BM25
    5.7%
    2.9%
  3. Both, plus a reranking pass
    5.7%
    1.9%
Lower is better. Failure rate is the share of queries where none of the top 20 retrieved chunks contained the answer.
Anthropic's measured retrieval failure rates across knowledge domains, September 2024.

Takeaway

A 67% reduction in retrieval failure, and not one line of it came from a better model, a longer prompt or a cleverer instruction. Three changes, all of them in the search layer.

Failure two: the search returns things that are similar, not things that are right

This is the one that took me longest to accept, because it feels like it should be a tuning problem and it is not. It is a capacity limit with a proof attached.

In August 2025, four researchers at Google DeepMind connected embedding retrieval to classic results in communication complexity and sign-rank, and showed that for any fixed embedding dimension there are combinations of documents that no single-vector model can ever return as a top-k result, no matter how well trained it is.[4] Then they built LIMIT, a benchmark of short one-sentence documents with a thousand queries, deliberately simple. State-of-the-art embedders including Gemini Embeddings, Qwen3 and E5-Mistral struggle to reach 20% recall@100 on it.[4]

BM25, a keyword ranking function first published in the 1990s and shipped in every serious search engine since, comes close to a perfect score on the same task.[4]

A keyword algorithm from the 1990s beat 2025 frontier embedding models on a corpus of one-sentence documents. That is not a bug in one vendor's model. That is the shape of the tool.

The practical version of this is the failure every RAG team has seen. A user asks about error code 4032 and the retriever hands back three passages about error handling. It asks about the 2024 amendment and gets the 2019 original, because the two documents are 95% identical text and the vector cannot see the year. Dense embeddings blur exactly the tokens that carry the fact: identifiers, dates, part numbers, negations. Hybrid search exists because of this, not because someone wanted a more complicated architecture.

Summary

An embedding answers “what is this passage about?” A user asking a question wants to know “which passage settles this?” Those are different questions, and the first one is a decent but lossy proxy for the second. Reranking helps because a cross-encoder reads the query and the passage together and scores relevance directly instead of comparing two precomputed summaries.[9]

Failure three: the model reads the context and ignores it anyway

Say the retrieval worked. The right passage is sitting in the prompt. You are still not safe, and the reason cuts both ways.

Kevin Wu, Eric Wu and James Zou at Stanford built ClashEval to measure what happens when retrieved content and a model's internal knowledge disagree. They ran over 1,200 questions across six domains through six frontier models, deliberately corrupting the retrieved passages. Models overrode their own correct prior more than 60% of the time.[6] Feed a model a wrong number in a retrieved chunk and the majority of the time it will repeat the wrong number, even when it knew better unprompted.

So RAG does not just fail to stop hallucination. It creates a new channel for it: a bad passage now becomes a confident, cited, wrong answer. Which is also, incidentally, why retrieved content is an untrusted input and belongs in your threat model rather than your happy path, something I got into in the piece on the prompt injection attack surface.

The failure runs the other direction too. Nelson Liu and colleagues at Stanford, Berkeley and Samaya AI documented in 2023 that model accuracy follows a U-shaped curve across the context window: performance is highest when the relevant text sits at the very beginning or the very end, and degrades in the middle.[7] Retrieve twenty chunks, put the right one at position eleven, and you have hidden it in the one place the model reads worst. Ordering is not cosmetic.

Heads up

This is the argument for retrieving wide and passing narrow. Pull fifty candidates so recall is high, rerank them, then hand the model five. The instinct to stuff everything into a million-token window and let the model sort it out costs you accuracy and money at the same time.

Failure four: the citation is decoration

The footnote under a RAG answer looks like proof. It usually is not.

In most implementations the model is asked to produce citations as text, in the same generation pass as the answer, from the same probability distribution. Nothing checks afterwards that sentence four is actually supported by source two. Tianyu Gao and colleagues at Princeton built ALCE to measure precisely this, and found that on the ELI5 dataset even the best systems lacked complete citation support 50% of the time.[8]

Half. The citation is generated, not verified, and a generated citation has exactly the reliability of any other generated token. If you want grounding you have to build it: verify each claim against the span it points at with a separate check, and refuse to display an answer whose support fails. That is engineering work nobody puts in the demo.

The thing I wish someone had told me two years ago

Retrieval quality is a hard ceiling on answer quality. Not an influence on it. A ceiling.

If the passage containing the answer is not in the context window, there is no prompt on earth that recovers it. The model cannot reason its way to a fact it was never shown. Every hour you spend rewording the system prompt when your recall@10 is 60% is an hour spent polishing the bottom four-fifths of a system whose top is missing. And most RAG teams spend their time exactly there, because prompts are easy to edit and retrieval evaluation is a project.

Most RAG debugging is search debugging wearing a prompt engineering costume. The generation layer is the last place to look, not the first.

The operational consequence is that you need two metrics, not one. Track retrieval recall at your chosen k as its own number, on its own evaluation set, entirely separately from answer quality. When an answer is wrong, the first question is not “what should the prompt have said?” It is “was the answer in the context at all?” Those two branches lead to completely different work. Conflating them is how teams spend a quarter tuning a prompt to fix a chunking bug.

This is also why the retrieval layer is worth treating as real infrastructure rather than a library call, and why standardizing how models reach external data matters more than it sounds. It is the same reason context engineering has quietly replaced prompt engineering as the job title that describes the actual work.

Side note

There is a nice second-order effect here. Once retrieval is genuinely good, the generation step gets easier, and an easier generation step means a smaller model can often do it. Extraction and summarization from provided text is not the task that needs a frontier model, which is part of the case for running smaller models where they fit. Fixing your retriever can cut your inference bill as a side effect.

What to actually do on Monday

Four things, in order, and the order is the point.

  1. Build a retrieval evaluation set before anything else. Fifty real questions with the passage that answers each one labeled by hand. Measure recall@5, recall@10 and recall@20. You now have a number that moves.
  2. Turn on hybrid search. Run BM25 alongside your vector search and fuse the results. On the LIMIT benchmark keyword search beat every frontier embedding model outright, and in Anthropic's numbers it took failure from 3.7% to 2.9%.[3,4] It is the highest-value change per hour of work in this entire pipeline.
  3. Add context to your chunks, then rerank. Prepend document-level context before embedding, retrieve wide, rerank with a cross-encoder, and pass the model a small number of well-ordered passages rather than a pile.[3,9]
  4. Verify citations after generation, not during it. Check each claim against the span it cites in a separate pass. If it fails, say so in the interface. A visibly abstaining system beats a confidently wrong one, and half of generated citations do not fully hold up.[8]

RAG is a genuinely good technique. It made models current, auditable and cheaper to update, exactly as the 2020 paper said it would. What it never did was make them honest, and the industry sold the second thing while shipping the first. Fix your retriever. The model is fine.

Sources and further reading

  1. 1.PrimaryPatrick Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks". Submitted May 22, 2020. The original RAG paper. Parametric plus non-parametric memory, a dense Wikipedia index and a neural retriever; claims more specific, diverse and factual output than a parametric-only baseline.
  2. 2.PrimaryVarun Magesh, Faiz Surani, Matthew Dahl, Mirac Suzgun, Christopher D. Manning, Daniel E. Ho, "Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools". Submitted May 30, 2024; published in the Journal of Empirical Legal Studies. First preregistered evaluation of RAG-based legal research tools. Hallucination rates of 17% to 33%; Lexis+ AI accurate on 65% of queries, Westlaw AI-Assisted Research on 42%.
  3. 3.PrimaryAnthropic, "Introducing Contextual Retrieval". September 2024. The SEC-filing chunk example, and measured top-20 retrieval failure rates: 5.7% baseline, 3.7% with contextual embeddings, 2.9% adding contextual BM25, 1.9% adding reranking.
  4. 4.PrimaryOrion Weller, Michael Boratko, Iftekhar Naim, Jinhyuk Lee, "On the Theoretical Limitations of Embedding-Based Retrieval". Google DeepMind, submitted August 28, 2025, accepted to ICLR 2026. Connects embedding capacity to sign-rank; introduces the LIMIT benchmark, where models struggle to reach 20% recall@100 while BM25 comes close to perfect scores.
  5. 5.PrimaryScott Barnett, Stefanus Kurniawan, Srikanth Thudumu, Zach Brannelly, Mohamed Abdelrazek, "Seven Failure Points When Engineering a Retrieval Augmented Generation System". Submitted January 11, 2024. Seven failure points drawn from three case studies across research, education and biomedical domains, the last covering 4,017 documents and 1,000 questions.
  6. 6.PrimaryKevin Wu, Eric Wu, James Zou, "ClashEval: Quantifying the tug-of-war between an LLM’s internal prior and external evidence". Submitted April 16, 2024. Over 1,200 questions across six domains with deliberately corrupted retrieved content; models override their own correct prior more than 60% of the time.
  7. 7.PrimaryNelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, Percy Liang, "Lost in the Middle: How Language Models Use Long Contexts". Submitted July 6, 2023. Documents the U-shaped accuracy curve: performance is highest when relevant information sits at the beginning or end of the context and degrades in the middle.
  8. 8.PrimaryTianyu Gao, Howard Yen, Jiatong Yu, Danqi Chen, "Enabling Large Language Models to Generate Text with Citations". Submitted May 24, 2023. Introduces the ALCE benchmark for citation quality; on ELI5 even the best systems lack complete citation support 50% of the time.
  9. 9.ReportingPinecone, "Rerankers and Two-Stage Retrieval". Why compressing a passage into a single precomputed vector loses information, how cross-encoders score a query and document together, and the latency tradeoff that forces a two-stage design.

Frequently asked questions

Does RAG stop an LLM from hallucinating?
No. RAG reduces hallucination but does not eliminate it, and vendors who claim otherwise have been measured and contradicted. A preregistered Stanford study of the leading AI legal research tools, all built on retrieval-augmented generation, found hallucination rates between 17% and 33%. Grounding an answer in retrieved text changes the odds; it does not change the fact that the model is still generating.
What are the main failure points in a RAG pipeline?
The seven documented failure points are missing content, the answer never ranking in the top k, the passage being dropped during consolidation, the model failing to extract an answer that is present, wrong output format, wrong level of specificity, and incomplete answers. That taxonomy comes from a 2024 paper by Barnett and co-authors covering three production case studies. The first four are decided by what reaches the context window; only the last three are about how the model was asked.
Why does vector search return passages that are related but wrong?
Because an embedding measures topical similarity, not factual relevance, and a single vector has a hard capacity limit. Google DeepMind showed in 2025 that for any fixed embedding dimension there exist sets of documents no single-vector model can return as a top-k result, and demonstrated it on a benchmark of one-sentence documents where state-of-the-art embedders fail to reach 20% recall@100 and BM25 keyword search nearly solves it.
Should I debug the prompt or the retriever when RAG answers are wrong?
Debug the retriever first, because retrieval quality is a hard ceiling on answer quality. If the passage containing the answer is not in the top k, no prompt wording recovers it. Measure recall at your chosen k as a separate metric before you touch the prompt, and only treat it as a generation problem once you have confirmed the answer was actually in the context window.
Is hybrid search better than pure vector search for RAG?
Usually yes, and the measurements are unusually one-sided. Anthropic reported that adding keyword-based BM25 alongside contextual embeddings cut the top-20 retrieval failure rate from 5.7% to 2.9%, and Google DeepMind found BM25 near-perfect on a benchmark where single-vector embedding models collapsed. Exact identifiers, error codes and product names are precisely what dense vectors blur and keyword search catches.

Written by

Tech Talk News Editorial

Computer engineering background. Writes about software, AI, markets, and real estate, and the places where the three meet.

More about the author
ShareXLinkedInRedditEmail