An IT helpdesk bot answers "How do I get VPN access as a contractor?" with the steps for employees. The team switches to a stronger model and adds "Answer only from the context" to the prompt. Now the bot either says it can't find the answer or gives the employee steps again. Two weeks later, someone finally logs the retrieved chunks. The contractor page had been split in two: the heading "VPN access for contractors" landed in one chunk, and the actual steps, "Submit form IT-7 and wait for approval", in the next. The second chunk never mentions contractors or the VPN, so it never ranked. The model was never shown the answer.
The common misconception
"When a RAG app gives a wrong answer, the fix is a stronger model or a better prompt." It's a natural conclusion:
The wrong sentence comes out of the model, so the model looks guilty.
Changing the model or the prompt is a one-line edit; rebuilding an index isn't.
End-to-end evals score the final answer only, so every failure looks like a model failure.
Models really do fail with the right passage in front of them, so sometimes the instinct is correct.
The half-truth: generation failures exist. But generation is the last link in a chain, and from the final answer alone you can't tell which link broke.
What actually happens
A RAG answer passes through a chain
A request goes through four stages, and each one can lose the answer:
Content and chunking. The documents are split into chunks and indexed. If the answer isn't there, or is split badly, nothing later can recover it.
Retrieval. The question is matched against the index and the top k chunks come back.
Context assembly. Your code deduplicates, trims to a token budget and orders the chunks into a prompt.
Generation. The model reads the prompt and writes an answer.
Barnett and colleagues documented this in 2024 from three RAG systems in research, education and biomedicine, including one built on 1,000 BioASQ questions. They list seven failure points. The first three happen before the model reads anything: missing content, where the documents don't hold the answer; missed the top-ranked documents, where the answer exists but ranks below the cutoff; and not in context, where it was retrieved but lost during consolidation. Only the last four belong to the model: not extracted, wrong format, incorrect specificity and incomplete.
Why a stronger model can't fix a retrieval miss
The model can only use what's in its context. When the right passage is missing, the best possible behavior is "I don't know", and that's the most a better model or prompt can give you. A less careful setup fills the gap from the model's training data or from a near-miss passage. Barnett and colleagues note that a question related to the content but not answered by it can fool the system into responding anyway. Anthropic's guide to reducing hallucinations recommends explicitly allowing "I don't know" and restricting answers to the provided documents. Both help, but they change how the model handles the gap, not the gap.
Chunks lose their context
Anthropic's Contextual Retrieval post shows a common cause of misses. A chunk that says "The company's revenue grew by 3% over the previous quarter" doesn't say which company or which quarter, so a question naming them may not retrieve it. That's the contractor chunk above. Their fix prepends a short, chunk-specific context, usually 50 to 100 tokens that Claude writes from the whole document, before embedding and indexing. In their 2024 tests, contextual embeddings alone cut the top-20 retrieval failure rate by 35%, from 5.7% to 3.7%. Barnett's team also found that adding the file name and chunk number to the retrieved context helped the model extract the answer.
Measure retrieval on its own
Anthropic scored retrieval with 1 minus : the share of relevant chunks that didn't make the top 20. That requires a labeled set, questions paired with the chunk that answers each, but no model call at all.
Answer-level metrics need care. Ragas, from Es and colleagues in 2023, separates three dimensions: faithfulness, whether the answer's claims are supported by the retrieved context; answer relevance; and context relevance, whether the context is focused on the question. Faithfulness is measured against the retrieved context, so an answer can be perfectly faithful to the wrong passage. Barnett's team adds a sobering lesson: validation is only feasible during operation, because real users ask questions you didn't anticipate.
Triage the failure before fixing it
The first version reacts to a wrong answer by upgrading the model and tightening the prompt. The second walks each logged failure through the chain and reports the first stage where the right chunk disappeared.
Python · fix_vpn_answer.py
import anthropicclient = anthropic.Anthropic()# Wrong VPN steps again, so: a stronger model and a stricter promptreply = client.messages.create( model="claude-opus-5-5", max_tokens=16000, system="Answer only from the context. Think carefully.", messages=[{"role": "user", "content": build_prompt(QUESTION)}],)# The contractor chunk was never retrieved, so no model can use itprint(next(b.text for b in reply.content if b.type == "text"))
Python · triage.py
from collections import Counterdef triage(case, k=20): """Return the first stage where the right passage was lost.""" gold = case["gold_id"] if gold not in corpus_ids: return "missing content" # nothing for retrieval to find ranked = [hit.id for hit in retrieve(case["question"], k=k)] if gold not in ranked: return f"not in top {k}" context = build_context(case["question"], ranked) # dedupe, trim if gold not in context.ids: return "dropped before the prompt" return "generation" # the model had the passage and still missedprint(Counter(triage(case) for case in wrong_answers))
Run the triage over every wrong answer you've labeled. The counts tell you where to work. Only the "generation" bucket is a case for a new prompt or a stronger model.
Where it broke
Failure point
What fixes it
Content
Missing content
Write or add the document; let the app say it isn't covered
Retrieval
Missed the top-ranked documents
Better chunking, chunk context, hybrid search, reranking, a larger k
Context assembly
Not in context
Budget, deduplication and ordering of the chunks you send
Generation
Not extracted, incomplete
Quotes first, clearer instructions, then a stronger model
Generation
Wrong format, wrong specificity
A precise output spec or structured output
How to apply it in your project
Log the retrieval traceFor every request, store the question, the retrieved chunk IDs with ranks and scores, the IDs that reached the prompt, the model and the prompt version.
Label a retrieval setCollect real questions and mark the chunk that answers each one. Include questions your documents don't cover, with no gold chunk.
Track recall@k next to answer qualityReport the share of questions whose gold chunk is in the top k, by query type, alongside your answer-level eval.
Triage before you change anythingWalk each wrong answer through content, retrieval, context assembly and generation, and fix the first stage that lost the passage.
Change the model lastUpgrade the model or rewrite the prompt only for failures where the right passage was in the prompt.
Key takeaways
A RAG answer can be lost at four stages; only the last one is the model's.
Three of Barnett and colleagues' seven failure points happen before generation: missing content, not retrieved, and dropped from the context.
No model or prompt can recover a passage it never received; at best it says "I don't know".
Measure retrieval with a labeled recall@k set; answer metrics like faithfulness can't see what wasn't retrieved.
Triage each failure to its stage, and change the model only when the passage was there.
التعليقات (0)