Lesson 5.4: How RAG fails
Find out where RAG systems break, from bad extraction to lost context and misread passages, and learn a four-question method to trace each failure to its stage.
A RAG demo works on the ten questions the team tried. A RAG product meets thousands of questions that nobody tried, written by people in a hurry, about documents that are messy, old and sometimes contradictory. When it fails, the user sees only a wrong or empty answer, and the team is tempted to blame the model. Most of the time the model is not where the problem lies. A question has to pass through ingestion, chunking, embedding, search, ranking, prompt building, generation and display, and a flaw at any point can ruin the answer. This lesson is a field guide to those failures. It shows where each kind arises, what it looks like from outside, and how to find the stage responsible with a short sequence of questions, so that you fix the right thing first. By the end you will be able to list the common failure modes at each stage of a RAG pipeline, use a four-question method to trace a bad answer to its cause, triage a batch of failures into causes and decide what to fix first, explain why questions that need several chunks, counts or comparisons are hard for RAG, work out how the stage-by-stage success rates multiply into the overall rate, and set up simple monitoring that surfaces new failures. You should have read Lessons 5.1 to 5.3. No programming is needed, and the arithmetic is multiplication and percentages.
The map of failures
Think of a question travelling down a pipe. Each stage can let it through or lose it.
Stage · What can go wrong · What it looks likeCollecting and cleaning · Scanned pages with no text, tables that turn into jumbled lines, headers and footers mixed in, duplicates, missing documents · The answer is simply not in the index, or a number is wrong because a table was flattened
Chunking · Chunks that cut an answer in half, chunks with no title or context, chunks too big to be specific · The right text exists but never matches the question well
Embedding · A model that handles your language, terms or codes poorly · Similar-looking chunks outrank the right one, or exact codes are missed
Search and ranking · Right chunk outside the top k, old versions outranking new, filters too tight or too loose · Right chunk not in the prompt
Prompt building · Too many chunks, conflicting chunks, the key chunk buried in the middle, missing instructions · The model has the evidence but does not use it well
Generation · The model ignores the context, misreads a number or a negation, or answers beyond the text · Fluent answer that does not match the source
Post-processing · Wrong citations, broken links, formatting that hides the answer · The answer is right but the user cannot trust or use it
Operations · Stale index, permission leaks, slow responses, rising cost · Right answer for last month, or an answer the user should not see
The table is a checklist for diagnosis. Not every system has every problem, and the failures you meet most will depend on your documents and users.
The four-question method
When an answer is bad, do not start by changing the prompt. Ask four questions in order, and stop at the first "no".
1. Is the answer in the documents at all? Search your corpus by hand for the facts the answer needs. If the information is not there, the system cannot be blamed for failing to find it. The fix is a content fix: write the missing document, or make the system say it does not know.
2. Was the right chunk retrieved? Look at the list returned for this question. Is the passage that holds the answer in the top 20, say? If not, the failure is in ingestion, chunking, embedding or search. Look at how the chunk was cut and whether it carries its context.
3. Did the right chunk reach the prompt, and in a usable place? The chunk might be retrieved at rank 12 and then cut because only the top five are sent. Or it might be in the prompt but buried among eight others. The fix is in ranking, reranking or the number of chunks, as Lesson 5.2 explained.
4. Did the model use it correctly? If the right chunk was in the prompt and the answer is still wrong, the failure is in generation: the instruction, the model, the way the chunks are laid out or the question itself.
This ladder takes minutes per failure and turns a vague complaint, "the bot got it wrong", into a stage. It also protects you from an expensive mistake: switching to a larger model when the real problem was that the answer was never retrieved.
Predict first: a team collects 100 questions that the bot answered badly and runs them through the ladder. They find that for 18 the answer is not in the documents, for 31 the right chunk is not in the top 20, for 14 it is retrieved but ranked too low to reach the prompt, for 22 it was in the prompt and the model ignored or misread it, and for 15 something else was wrong. Where would you spend the first week?
The biggest single group is the 31 retrieval misses, and together with the 14 ranking misses it makes 45% of all failures, all of them retrieval problems. That would be the first target, using the methods of Lesson 5.2. Prompt changes would address at most the 22 generation failures. If the team had started with the prompt, it would have worked on the second-largest group at best and perhaps on none of the real causes.
Failures at ingestion and chunking
These are the quietest failures, since nothing signals them. The system runs, and the answer is simply not there.
Text that did not come out. A scanned PDF with no text layer yields nothing unless you run optical character recognition. A table in a PDF may come out as a stream of numbers with the column headings far away, so that "₹4,500" has no label. A slide deck loses the meaning of a diagram. Check by reading what the extractor produced for a sample of your hardest documents, not your easiest.
Noise mixed in. Page headers, footers, cookie banners and navigation menus repeat on every page and can swamp the real text. Duplicated pages create many near-identical chunks that fill the top of the list.
Chunks without context. A chunk that says "This does not apply to sale items" has lost what "this" refers to. Titles and section headings should travel with each chunk.
Answers cut in two. If a rule is in the last sentence of one chunk and its exception in the first sentence of the next, neither is a good match. Overlap between chunks, and chunking at natural boundaries such as headings, reduce this.
Missing documents. The most common failure of all is that the source of truth never made it into the collection, because it is in someone's email or a shared drive nobody connected.
Failures at retrieval and ranking
You met these in Lesson 5.2, and they usually dominate. A short reminder of what to look for: exact codes and names that vector search handles poorly, vague and follow-up questions, competing versions, and filters that are wrong. A new one to add is the permissions failure. If a user can ask a question and receive text from a document they should not see, the leak happened at retrieval. Filtering must be applied inside the search, using the user's rights, and not after the model has written an answer, since the model may already have used the forbidden text.
Failures in the prompt
Even when the right chunk is retrieved, the way it is presented matters.
Too much context. Every extra chunk is more to read and more chance of distraction. Studies of long prompts have shown that models can miss facts in a large context, and that is a reason to send fewer, better chunks.
Lost in the middle. Researchers have found that models often use information at the beginning and end of a long prompt better than information in the middle. If the key chunk sits fifth of nine, it may be underweighted. Putting the best chunks first, and sending fewer, is a simple defence.
Conflicting chunks. An old policy and a new one both appear, and the model blends them or picks the wrong one. Show the date with each chunk and tell the model which to prefer.
Missing instructions. No rule to answer only from the context, no way out when the answer is missing, no format. Lesson 5.3 covered these.
Failures in generation
The model has the evidence and still gets it wrong.
Ignoring the context and answering from memory, which looks right but may be out of date.
Misreading a number, a unit, a date or a negation. "Not eligible for refund" becomes "eligible for refund" more often than you would expect.
Over-answering. The passage covers part of the question, and the model fills in the rest.
Applying a rule to the wrong case, as with the e-book example in the last lesson.
Giving up too soon. A cautious instruction can make the model decline when the answer is in the text.
Test these by running the model on questions where you supply the right passage by hand. If it still fails, the problem is in generation, and the fix is a clearer instruction, a better model or a changed layout. If it succeeds, the problem was upstream.
Questions that RAG finds hard
Some questions do not fit the pattern of finding a few passages and reading them.
Questions that need several chunks. "Compare the premium and the standard plan" needs the passage for each. If each needed chunk has a chance of 80% of being retrieved, both appear with probability 0.8 × 0.8 = 64%. Three chunks gives 0.8 × 0.8 × 0.8 = 51.2%, and four gives 41%. The odds multiply, so a modest miss rate on single questions becomes a high one on questions that need several pieces. Remedies include breaking the question into parts and searching for each, retrieving more chunks for comparison questions, and building summary or comparison pages ahead of time.
Questions that need counting or summing. "How many of our policies mention data retention?" or "What was total spend across all vendors?" cannot be answered from the top five chunks, because the answer depends on everything in the collection. Retrieval gives a sample, not the whole. For questions like these, use structured data and a query, or precompute the figures, and let the model explain the result.
Questions that need reasoning across time. "How has the policy changed since 2023?" needs several versions, dated and ordered. Without version metadata, the system cannot tell them apart.
Questions outside the documents. A user asks about something the collection does not cover. The right behaviour is to say so, and to avoid answering from the model's general knowledge unless the product is designed to.
Failures in operation
A stale index. The documents changed but the index did not. If you rebuild weekly, then on average a change is 3.5 days old before it shows up, and in the worst case 7. For a policy that changes twice a year this is fine, but for prices or stock levels it is not. Match the refresh to how fast the facts move, and consider updating only the changed documents.
Drift. A new embedding model, a changed chunker or a new document type changes retrieval without anyone noticing. Rerun your test whenever any part changes.
Cost and delay creep. More documents, longer prompts and retries add up. Watch the cost per question and the time to first word, as Lesson 3.3 explained.
Injection and leaks. Documents can carry hidden instructions, and prompts can reveal data. Treat retrieved text as data, filter by permission and test with hostile documents. Lesson 8.3 comes back to this.
The product of the stages
Because a question must pass every stage, the overall success rate is the product of the rates at each stage, not the average.
Say four stages succeed at these rates: the answer is correctly ingested and in the index 98% of the time, the right chunk reaches the prompt 85% of the time, the model answers faithfully from it 92% of the time and the citations and format are right 96% of the time. The overall rate is 0.98 × 0.85 × 0.92 × 0.96 = 0.736, or 73.6%. Every stage looks respectable, yet roughly one answer in four fails. This is why a system with several good-looking parts can still feel unreliable.
It also shows where to work. The weakest stage, retrieval at 85%, has the most room. If you lift it to 95%, the overall rate becomes 0.98 × 0.95 × 0.92 × 0.96 = 0.822, or 82.2%, a gain of nearly nine points. Lifting the best stage, ingestion, from 98% to 100% gains only 1.5 points. Improvement follows the weakest link.
You can also try the odds for questions that need several chunks.
Monitoring and learning from failures
You will not catch every failure in testing, so build the means to see them in use.
Log every request: the question, the rewritten query, the retrieved chunks with scores, the prompt, the answer, the citations and the delays. Without logs you cannot run the ladder on a real failure.
Watch simple signals. The share of questions with no good retrieval result, the rate of "I don't know" replies, thumbs-down clicks, questions asked twice in a row with different wording, and escalations to a person.
Review a sample every week. Read 20 of the worst, run each through the four questions, and write the cause.
Turn failures into tests. Each failure that is understood becomes a test question, with its right chunk, so that the problem stays fixed. This is the habit that Module 6 develops.
Alert on drift. A sudden rise in no-result rates or in delay often means a data or index change.
Three worked examples
Example 1: a triage that changed the plan. A bank's help bot had a 70% rate of good answers. The team had planned to fine-tune the model. A triage of 100 failures showed that 40 were retrieval misses and 15 were from tables in rate sheets that had been flattened into rows without headings. They fixed the table extraction to keep headings with values and added keyword search for product names. The good-answer rate rose to 82% before anyone touched the model. The fine-tuning plan was dropped.
Example 2: a comparison question. An insurer's assistant failed on "What is the difference between the Silver and Gold plans?". The ladder showed that only the Gold chunk was retrieved, because the question's wording was closer to it. With a per-chunk retrieval rate of 80%, the chance of both for a two-chunk question is 64%. The team added a step that detects comparison questions, searches for each named plan separately and merges the results. The rate of complete answers on comparison questions went from about 60% to about 90%.
Example 3: stale and leaked. A company's internal assistant answered a question about travel limits using a policy that had been replaced three weeks earlier, since the index was rebuilt monthly. In the same week a test showed that an intern could read a passage from a restricted HR document, because the permission filter was applied after retrieval. The team moved to daily updates for changed documents and moved the permission filter into the search itself. Both fixes were operational, and neither involved the model.
A failure analysis worksheet
1. The question. What did the user ask, and what was the bad answer?
2. In the documents? Where is the true answer, if anywhere?
3. Retrieved? Was the chunk in the top 20, and at what rank?
4. In the prompt? Was it sent, and where did it sit?
5. Used correctly? Run the model with the right chunk supplied by hand.
6. The cause. One stage and one reason.
7. The fix. The smallest change that addresses it.
8. The test. The question added to the test set.
9. The pattern. After 20 failures, which cause is most common?
10. The plan. What to fix first and the number that should move.
Common mistakes
Blaming the model first. Most failures are upstream.
Changing the prompt without a diagnosis.
Testing only on easy documents.
Ignoring tables, scans and slides, where extraction quietly fails.
Sending many chunks to be safe, which dilutes the key one.
Applying permissions after retrieval.
Rebuilding the index on a schedule that does not match how fast facts change.
Expecting RAG to count, sum or compare across a whole collection without extra design.
Not logging, so failures cannot be traced.
Key takeaways
A RAG answer must pass many stages, and a flaw at any one can ruin it. Most failures are in data, chunking, retrieval and ranking, not in the model.
Use four questions in order: is the answer in the documents, was the right chunk retrieved, did it reach the prompt in a usable place and did the model use it correctly.
Triage a batch of failures by cause. In the example, 45 of 100 were retrieval problems, so retrieval was the first thing to fix.
Questions that need several chunks fail more often, because the odds multiply: 0.8 for one chunk becomes 0.64 for two and 0.512 for three. Counting and summing questions need structured data.
Prompt-level failures include too much context, a key chunk in the middle and conflicting versions. Generation failures include ignoring the context and misreading numbers and negations.
Overall success is the product of the stage rates. In the example 98%, 85%, 92% and 96% give 73.6%, and lifting the weakest stage to 95% gives 82.2%.
Log requests, watch simple signals, review a sample every week and turn each understood failure into a test.
Check yourself
1. A bad answer is traced to a retrieved chunk at rank 14, while only the top 5 reach the prompt. Which stage failed?
Ranking. The right chunk was found but ranked too low to be sent, so a reranker or a wider k would help.
2. A question needs three chunks, each retrieved with probability 0.9. What is the chance that all three are retrieved?
0.9 × 0.9 × 0.9 = 0.729, or 72.9%.
3. Four stages succeed at 95%, 90%, 90% and 98%. What is the overall rate?
0.95 × 0.90 × 0.90 × 0.98 = 0.754, or 75.4%.
4. Why is it a mistake to apply the permission filter after the model has answered?
The model may already have used text the user should not see, and may quote or summarise it in the answer.
5. Why can RAG not reliably answer "how many contracts mention a penalty clause"?
The answer depends on every document, and retrieval returns only a handful of the best matches, so the count would be a guess.
6. What should happen to a failure once its cause is understood?
It should be added to the test set with its right chunk, so that the fix is checked every time the system changes.
Try this
Trace some failures in a real or simulated system. Set aside 60 minutes.
1. Collect 15 questions that a document assistant answered badly. If you have none, write 15 questions about a document set and note the weak answers.
2. For each, run the four questions: is the answer in the documents, was the chunk retrieved, did it reach the prompt and was it used correctly.
3. Write one cause for each failure.
4. Count the causes, and write which stage has the most.
5. Use the first simulator with your best estimate of the four stage rates, and note which stage is weakest.
6. Pick one failure that needs several chunks and use the second simulator to estimate its odds.
7. Write the fix for the most common cause, the test question you would add and the number you expect to move.
A good result is a table of failures with causes, a count by stage, a stage-rate estimate with the weakest stage identified and a written fix with a test and a target.
Tags: AI Engineering RAG Debugging Failure modes Reliability