LA24AI

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.

RAG: watch the evidence that reaches the answer

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.

Synthetic practice cases with reference decisions; not measured product results
casereference evidenceretrieved IDscandidate answerreference verdict
missing evidencePOLICY-7DOC-3|DOC-914 daysretrieval failure despite lucky answer
evidence reached, answer wrongPOLICY-7POLICY-7|DOC-330 daysanswer grounding failure
evidence and answer alignedPOLICY-7POLICY-714 dayspass only with supporting citation
out of scopenoneDOC-9not specifiedcorrect abstention
Worked examplepython
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 ↗

NEXT

One idea leads to another

3 min read

Give evidence a document ID, revision and passage boundaries, then reject citations that do not support the adjacent claim even when their links work.

2 min read

Build cases that expose unsupported answers, separating missing evidence from retrieval failure with a local JSONL evaluation set.

2 min read

Test long AI context with evidence placed at the start, middle and end, checking the supporting passage rather than equating window size with reading.