THIS EXPLANATION
THE ROOM
CDA·85 Computing, Data & AI 7 MIN · 8 STATIONS

Evaluating retrieval separately

A Socratic walk-through of evaluating retrieval separately — reasoned out one step at a time, not lectured.

abcdefgh
a

The question we started with

THE QUESTION #

When an answer built from sources is wrong, how do you tell whether the finding or the writing failed?

A system that searches a corpus and then writes an answer from what it found has exactly one output a user sees: the answer. So the natural way to measure it is to score that answer — against a reference, or by a human, or by another model acting as judge. One number, end to end, honest about what the user experiences.

The trouble appears the moment the number goes down. The answer was wrong. Which half broke? And notice that the end-to-end score, whatever it is, cannot tell you: it is a single scalar summarising a pipeline with two very different failure modes, and every fix you might attempt — change the chunking, change the model, change the prompt, change the index — is a fix to one half or the other. The measurement you have does not name a suspect.

b

Reasoning it through

REASONING #

Let us be precise about how many ways it can fail. The system does two things: it selects evidence, and it writes from that evidence. So there are four combinations, and it is worth asking whether all four are distinguishable from the outside.

Right evidence and right writing gives a good answer; wrong and wrong gives a bad one. Both easy. Now the interesting pair. The evidence was wrong but the writing faithfully used it — a fluent, well-grounded answer based on the wrong passage. From the outside that looks exactly like a hallucination, and teams respond by blaming the model, tightening the prompt, lowering the temperature. None of it helps, because the model did its job correctly on the input it was given.

And the mirror case: the evidence was right and the writing ignored it, contradicted it, or leant on the model's own prior knowledge. That looks like a retrieval failure to anyone who assumes a grounded system uses what it is given.

So two of the four cases are systematically misattributed by an end-to-end score, and the two are misattributed in opposite directions. Which means the end-to-end number does not merely lack detail — it actively points at the wrong component roughly half the time you are debugging.

What would separate them? For the retrieval half, you need to know whether the passage containing the answer was in the retrieved set at all — answerable without running the writer. Mark which passages actually contain the answer for a set of questions, then measure how often they appear in the top k. Recall at k is the ceiling on everything downstream, and ordering measures like nDCG tell you additionally whether the right passage arrived near the top, which matters when the writer reads only the first few.

For the writing half the key move is different: judge the answer against the retrieved passages, not against the truth. Is every claim supported by the text supplied? That is faithfulness, and notice its useful property — being defined relative to the input the writer actually received, it stays valid even when retrieval was garbage. A faithful answer to bad evidence scores well here and badly end to end, which is exactly the discrimination we were missing.

Does that fully separate the two? Not quite. A third component hides between them: a retriever can score well on recall at ten while burying the answer among nine distractors, and a writer that then goes astray is failing on a genuinely harder input. So careful setups also measure context relevance — what fraction of the supplied context was useful — which attributes the "too much noise" case to retrieval, where it belongs, rather than to the writer who drowned in it.

One more consequence, and it is the practical payoff. Retrieval evaluation needs no generation at all: it is a fast, deterministic sweep over an index that can run on every commit. Generation evaluation is slow, costs model calls, and carries its own error rate. Merging them into one score does not just confuse attribution; it drags the cheap loop down to the speed of the expensive one.

c

The analogy

THE ANALOGY #
THE FIGURE

It is the difference between a research assistant and a writer sharing one byline. The report is wrong; you have one document and two people, and reading the report tells you it is wrong but not whose fault it is — an impeccably written argument from the wrong file reads as confident and correct. So you do what any editor does: check the pulled sources against the question, and separately check the report's claims against the sources on the desk. The second check deliberately does not ask whether the sources were the right ones, because that is the first check's job.

WHERE IT BREAKS DOWN

a real assistant will say "I could not find anything on this," whereas a retriever always returns its top k however irrelevant, so the pipeline has no equivalent of an honest empty-handed report — which is why context relevance has to be measured rather than reported.

d

Clarifying the model

THE MODEL #

Three refinements.

First, this is component testing, with component testing's classic weakness: both components can pass while the system fails, because the fault lives in the interface. Keep the end-to-end score. Its job is detection, not attribution.

Second, the labels are the expensive part and the part most often skipped. Recall at k requires knowing which passages truly answer each question, which means human judgement over a question set drawn from your own traffic — far more useful than a public benchmark on someone else's corpus.

Third, on model-as-judge scoring: it is the standard way to measure faithfulness at scale and it is genuinely useful, but its agreement with human raters varies by task and prompt, and it carries known biases toward longer answers and toward text from similar models. Calibrate against a human-labelled sample before trusting a movement of a few points.

e

A picture of it

THE PICTURE #
Evaluating retrieval separately
Evaluating retrieval separately This is the triage order, and the order matters: the first question is about retrieval alone, because if the answer-bearing passage was never fetched, nothing about the writer is worth investigating. Only then does the second apply, and note that it compares the answer to the retrieved passages rather than to the truth -- which is what makes it a clean test of the writer. The third diamond catches the case usually blamed on the writer that belongs to retrieval. The terminal at the bottom is the trap the whole exercise exists to avoid: an answer that is wrong, faithful, and not the model's fault. {"generator":"[email protected]","source":"../Socrates/.diagram-cache/_src/evaluating-retrieval-separately.md","sourceIndex":1,"sourceLine":4,"sourceHash":"6efa5824e12af3161d5f429d6ee659dbed5ffa5391e6319f773034b675c85362","diagramType":"flowchart-v2","layoutVariant":"source","repairedDuplicateIds":[],"motion":"entrance-with-reduced-motion-fallback","presentation":"editorial","attempt":1,"viewBox":{"x":0,"y":0,"width":1080,"height":878},"qa":{"passed":true,"findings":[]}} no yes no yes yes no A wrong answer arrives Was a passage containing theanswer in the retrieved set? Is every claim in the answersupported by those passages? Was the useful passage buriedamong distractors? Retrieval fault: fix chunking,index, or query rewriting Generation fault: the writerignored or contradicted itsevidence Retrieval precision fault: the rightpassage arrived, drowned innoise Faithful answer to bad evidence,misread as a hallucination
KINDSsourcedecisionriskoutcomeconnectornegative branch

How to readThis is the triage order, and the order matters: the first question is about retrieval alone, because if the answer-bearing passage was never fetched, nothing about the writer is worth investigating. Only then does the second apply, and note that it compares the answer to the retrieved passages rather than to the truth — which is what makes it a clean test of the writer. The third diamond catches the case usually blamed on the writer that belongs to retrieval. The terminal at the bottom is the trap the whole exercise exists to avoid: an answer that is wrong, faithful, and not the model's fault.

f

What became clearer

WHAT CLEARED #
WHAT CLEARED

A single end-to-end score can detect a failure but cannot attribute one, and in two of the four possible cases it attributes it backwards — a faithful answer to the wrong passage looks like a hallucination, and an unfaithful answer to the right passage looks like a search failure. Splitting the measurement fixes this by changing what each half is judged against: retrieval against labelled answer-bearing passages, generation against the passages it was actually handed. That second choice is the whole trick, because a measure defined relative to the writer's real input stays meaningful no matter how badly the retriever behaved.

g

Where to go next

ONWARD #
  • How to build a labelled question set from real traffic without it drifting away from what users now ask.
  • Whether context precision or context recall is the better early warning when a corpus grows.
h

Key terms

TERMS #
TermWhat it means
Recall at kthe share of questions for which an answer-bearing passage appears in the top k results; a hard ceiling on end-to-end quality.
nDCGnormalised discounted cumulative gain, a ranking measure that rewards putting relevant items nearer the top.
Faithfulness (groundedness)whether each claim in the answer is supported by the retrieved context, judged against that context rather than against ground truth.
Context relevancewhat proportion of the retrieved context was useful, which catches answers buried among distractors.
Model-as-judgeusing a language model to score another's output against a rubric; scalable, with biases needing calibration.

Every term the collection defines is gathered in the glossary.

Nearby on the shelf

4