A retrieval evaluation exists to answer one question: did this change make retrieval better. The one I was working with was answering a different one: which document had the most chunks retrieved. The two look identical until you plot them against the correct answer. That fault was in the scoring long before I arrived; what follows is how it surfaced, how it was fixed, and what the corrected number changed.
The fault made cross-document recall look roughly half as good as it was. Fixing it moved two datasets by more than thirty points and turned a comparison nobody could trust into a baseline the reranker work could be judged against.
What the metric was supposed to do
The task is cross-document: a question’s answer requires evidence from more than one document. Retrieval returns chunks. To score a document-level metric, something has to turn chunk results into a document ranking, and then you ask whether the correct document appears in the top k.
That “something” is where the fault lived. Before ranking, the implementation normalised each retrieved chunk’s score by the number of chunks its parent document had been split into. Dividing is the reasonable-looking way to compare documents of different sizes - it stops a long document from winning on volume alone - but it silently makes the score a function of segmentation rather than of relevance.
The effect was easy to state once it was visible. Documents that were a single chunk were never divided, so one-chunk documents sat at the top of the ranking permanently. Documents split into two, three, four or many chunks were divided down and landed in roughly one band, close enough together that their order inside it carried almost no information. Chunk ranking was therefore being ordered by chunk count, and once that happened, comparing scores across documents - and ranking by them - stopped meaning anything.
How it surfaced
Not from a failing test. From a result that was too good to be true in one place and too bad in another.
Two retrieval configurations that should have differed by a few points differed by almost nothing, and a rescoring stage that was supposed to re-rank documents produced a ranking identical to the raw order. Both are symptoms of the same thing: the normalisation was dominating. With the order already pinned by the divisor, anything downstream of it had no room to act.
The decisive comparison was per-stage, and the per-stage table is the evidence. On the 55-query set at NR = 15, recall measured with scores left at the document level was 0.1517; the same run measured at the chunk level was 0.7512; the combined result the evaluation reports was 0.8507. On the 43-query set the same three rows read 0.3815, 0.5497 and 0.8683. A stage that rescores documents produced output byte-identical to not rescoring them at all. At that point the fault is not a hypothesis, it is a measurement.
One more diagnostic made the mechanism obvious rather than merely suspicious: the discrepancy narrowed as the cut-off grew. Single-chunk documents held the top permanently, and the flattened multi-chunk band could only enter as more slots were allowed, so a wider cut-off closed some of the gap. A constant bias would not behave that way.
The fix
Score at the chunk level, and keep the document mapping for reporting rather than for ranking. Recall becomes “is a chunk of the correct document in the top NR” with NR fixed per experiment, and the per-stage table reports every stage separately so a stage that does nothing shows up as doing nothing.
The distinction that matters here is chunk ranking against document ranking. The fault was in the chunk ranking; document ranking only inherited it. But retrieval returns one combined result, so the reranking benchmark afterwards reported the baseline and the reranking delta separately for document-level retrieval and for chunk-level retrieval. The chunk-level difference was the significant one, and it would have been invisible in a document-level summary.
The change is small. What it costs is the previous baseline: every earlier comparison had been measured against a biased number, and all of them had to be re-run.
What it changed
| Query set | Recall@15 before | Recall@15 after |
|---|---|---|
| 55-query set, NR = 15 | 49.3% | 85.1% |
| 43-query set, NR = 15 | 47.9% | 86.8% |
Three consequences followed:
- The reranker work had a usable baseline. Every configuration in that benchmark was judged against a number that had been fixed first. If I had started the benchmark a month earlier I would have been optimising against noise.
- Configuration comparisons became decidable. Several pairs that had looked equivalent under the biased metric separated cleanly once the ranking stopped being ordered by the divisor.
- A wrong conclusion was retracted. There were configurations I had previously judged as no better than baseline. Under the corrected metric some of them were genuinely worse, and a couple were better. Both directions mattered.
What I would do differently
I would have plotted the score against a quantity I did not design the metric around - chunks per document, in this case - on the first day. That plot takes twenty minutes and would have ended the argument immediately. Instead I found the fault the slow way: by distrusting a result, then a second result, and then building the per-stage table that made the mechanism visible.
The general rule I took from it: a metric that silently divides or aggregates over a variable you did not intend to measure will be ordered by that variable. The durable part was not the number. A result that moves this far is a claim about the measurement before it is a claim about the system, and that is now the first thing I check - not the last. Before trusting a score, ask what it has already been divided by, and what else it sums over.
Related case study: the reranker was the easy part, the number in front of it was not →