Data & knowledge
RAG: watch the evidence that reaches the answer
Diagnose RAG failures with retrieved passages and claim-level evidence, separating missing evidence from generation that ignores it.

Retrieval failure versus answer failure
A RAG answer can fail because retrieval missed the evidence or because generation ignored evidence it received. Inspect retrieved passages and generated claims separately. Linking an entire file does not show that a particular passage supports a statement.
Measure which evidence arrived
If a question requires A and B but retrieval returns A, C and D, recall is 1/2 and precision is 1/3 against that reference evidence set. More passages may recover B while adding distraction. Compare retrieval sizes on fixed questions rather than assuming larger context solves the problem.
Complete diagnostic case: the question asks when a fictional company refunds an order. The source-of-truth answer is “within 14 days after cancellation is accepted,” in passage POLICY-7. If retrieval returns DOC-3 and DOC-9 without POLICY-7, retrieval failed regardless of the eloquence of the answer. If POLICY-7 is retrieved but the assistant says 30 days, retrieval succeeded while answer grounding failed. Treat these as separate defects.
| case | reference evidence | retrieved IDs | candidate answer | reference verdict |
|---|---|---|---|---|
| missing evidence | POLICY-7 | DOC-3|DOC-9 | 14 days | retrieval failure despite lucky answer |
| evidence reached, answer wrong | POLICY-7 | POLICY-7|DOC-3 | 30 days | answer grounding failure |
| evidence and answer aligned | POLICY-7 | POLICY-7 | 14 days | pass only with supporting citation |
| out of scope | none | DOC-9 | not specified | correct abstention |
required = {"A", "B"}
retrieved = {"A", "C", "D"}
hits = len(required & retrieved)
print("recall", hits / len(required))
print("precision", hits / len(retrieved))Recall is 0.5 and precision about 0.333, assuming the reference evidence set is correct.
Download example text ↓Include unanswerable questions
Include a question absent from the documents. A useful response identifies missing evidence instead of inventing a policy. Retain page, passage ID and document revision. Retrieval scores and grounded-generation checks measure different failure modes.
Use an oracle passage to isolate the failing stage
Prepare a question with a known supporting passage. Run normal retrieval, then make a second run supplying the correct passage directly. If only the second answer succeeds, investigate chunking, query formulation and ranking first. If generation still fails with the evidence present, inspect the prompt and context handling before increasing the number of retrieved passages.
Keep passage text, score and rank, not only identifiers. Retrieval may have found the right passage at rank twenty while the final context excluded it. Compare the candidate list with the actual passages sent to generation. Then check a specific answer sentence against its cited passage. Evidence appearing somewhere in a log does not establish that it supports that sentence; this distinction prevents repairing the wrong stage.
Run three synthetic questions whose authoritative passage IDs are defined before testing. Record retrieved_ids, cited_ids, answer, and verdict separately; a citation alone is not proof that its passage supports the claim. Include a question unanswered by the documents; its reference response is “not specified in the documents.” These are test fixtures, not benchmark results of a deployed RAG system.
Sources & further reading
Sources support concepts and features; proposed trials are educational examples.
Prepared with AI assistance. Educational examples are not product tests; actual measurements identify their method and scope. Editorial approach ↗