Score Calibration, Drift Detection, and Significance Testing for Retrieval
The prerequisites measured a metric as an estimator and left one question open: is an observed gap real? We close it with the right instrument — a paired significance test — and then generalize the same two-distribution comparison to two more production questions: is a retrieval score calibrated as a probability, and has the distribution drifted since we last looked? One idea runs through all three: difference two distributions of per-query quantities and ask whether the difference is zero.
The question the variance only opened
Set metrics and NDCG made the same move and stopped at the same place. A retrieval metric is not a property of a system; it is the sample mean of a per-query score over a finite, fixed query set, and a different set of queries would give a different number. Both topics drew the 95% interval around each leg’s mean and asked whether two legs could be told apart — and both ended on a cliffhanger. The closest pair of legs, lexical and dense, differs by only in mean NDCG, their intervals overlap across all forty queries, and the prerequisite estimated that gap would need roughly 185 queries to resolve.
That estimate is a crude read, and conservative in a specific way: it compares two intervals built independently, as if the two legs had been measured on different queries. They were not. Both legs ran on the same forty queries, and an easy query — one with an unambiguous answer near the top — is easy for every leg. The overlapping-intervals test throws that pairing away. The right instrument keeps it, and this topic is built around the single idea that keeping it unlocks.
A metric is an estimator; every question that remains is whether two distributions of per-query quantities differ. System versus system is the significance question. The score against the truth is the calibration question. Now against then is the drift question. Each is a paired comparison, and pairing — differencing query-by-query — is the geometric fact that runs through all three.
Pairing cancels the shared per-query difficulty (the legs correlate 0.45 across queries), so var(d) is only 0.59× the unpaired variance and the paired interval excludes 0 at n = 57 where the unpaired two-CI read needs 185. This closes the NDCG cliffhanger: 185 → 116 (rigorous 80%-power) versus 57 (a single interval clearing 0); at all 40 queries the gap is not yet significant (p = 0.107).
120 synthetic finance documents, 40 queries, top-10 relevant; the three legs and the MaxSim oracle are the prerequisites' shared corpus. Numbers mirror significance_testing_calibration.py; the lab recomputes the CI half-widths, ECE/MCE, histograms, CDFs, and the KS gap in closed form, and bakes the corpus-derived means, p-values, reliability bins, and PSI.
The lab above is the topic in four panels; we take each in turn. The arc: build the paired test and watch it resolve the cliffhanger, make it distribution-free and correct it for multiple comparisons, then turn the same comparison sideways to ask whether a score is calibrated and whether the distribution has drifted.
The paired test: pairing cancels difficulty
Fix two legs and and let be their per-query metric (AP or NDCG) on query . The prerequisite compared the two means. Instead, form the per-query difference and treat it as the sample.
Definition 1 (The paired difference and the paired t-statistic).
For the queries let . The paired estimator of the mean difference is with sample standard deviation , and the paired t-statistic is
testing the null (the systems tie). The effect size is Cohen’s , scale-free.
The whole advantage is in the variance of . Because and are evaluated on the same queries, their per-query scores are positively correlated — a hard query drags both down — and the variance of the difference subtracts that shared component.
Theorem 1 (Pairing reduces variance).
For paired samples,
Whenever — whenever the two systems find the same queries easy — the paired variance is strictly below the unpaired sum , so the paired standard error is smaller and the paired interval on is narrower than the gap between two independent intervals.
Proof. The identity is the bilinearity of variance: . Positivity of the covariance makes the third term a strict subtraction.
On this corpus the legs correlate (MAP) and (NDCG) across queries, so the paired variance is only and of the unpaired sum. Panel A shows the per-query difference strip — mostly negative, lexical below dense, with a few queries where lexical wins — and the two intervals on shrinking under the query-count slider. The payoff is the resolution of the cliffhanger.
Proposition 1 (Test–CI duality and the power-based query count).
The paired confidence interval excludes zero if and only if the paired test rejects at level — confidence intervals are inverted tests. Holding the observed fixed, the interval clears zero once . To detect the effect with power , rather than clear zero on a single realization, requires the larger
For the closest NDCG pair, , and the three query counts form a clean ladder. The prerequisite’s overlapping-intervals read asked for 185. The rigorous 80%-power count is 116 — fewer, because the paired test is the sharper instrument. The single-realization “interval clears zero” count is just 57, but that is a one-time event with about 50% power, which is why it sits below the power-based number rather than above it. The honest report is 185 → 116: the proper required query count is well under the crude one.
A second, equally honest fact: pairing tightens the test, it does not manufacture significance. On MAP the same lexical–dense gap is significant at the forty queries we have (, , separating by ). On NDCG it is not yet (, ): the gap is real-looking but inside sampling error at . The paired test answers “is the 0.05 NDCG gap real?” with not on this evidence — which is the correct answer, not a louder one.
Distribution-free tests and the cost of asking three questions
The paired t-test assumes the differences are approximately normal. They are not: per-query AP and NDCG are bounded in and skewed. Two instruments make no such assumption.
Definition 2 (The permutation and bootstrap tests).
The permutation (randomization) test uses that under the two systems are exchangeable on each query, so each difference is equally likely to be or . Enumerating (or sampling) the sign vectors gives the null distribution of , and the two-sided p-value is the tail mass beyond . The paired bootstrap test resamples the differences with replacement, recenters to impose , and reads the same tail. Neither assumes normality; the permutation test is exact under exchangeability.
On the worked MAP pair all three agree — -test , permutation , bootstrap — which is the cross-check the prerequisites’ rigor flag promised. The permutation test is the one the IR literature settled on (Smucker, Allan & Carterette, 2007); Panel B draws its sign-flip null with the observed statistic marked and the tail shaded.
Comparing three legs is not one test but , and running three tests at inflates the chance of a false “significant” somewhere. The multiple-comparisons corrections adjust for it: Bonferroni multiplies each p-value by the number of tests, Holm does so in a uniformly more powerful step-down, and Benjamini–Hochberg controls the false-discovery rate instead of the family-wise error. On the NDCG family the two genuine separations survive every correction, while the marginal lexical–dense pair is pushed from to under Bonferroni — cemented as not distinguishable. Correcting for the questions you asked is what keeps a three-way leaderboard honest.
Calibration: is a score a probability?
Turn the comparison sideways. So far the two distributions were two systems’ metrics; now they are a score and the truth it predicts. A retrieval score is calibrated as a relevance probability if, among all query–document pairs scoring near , a fraction near are actually relevant. The geometric object is the reliability diagram.
Definition 3 (Reliability diagram, ECE, and MCE).
Pool every pair, map the score into , and partition the axis into bins . For bin let be the mean score and the empirical relevance rate. Plotting against gives the reliability diagram; perfect calibration is the diagonal . The expected calibration error is the count-weighted area off the diagonal,
a Riemann sum over the score partition; the maximum calibration error is the worst single bin, .
Calibration is forced to be a pooled object — with ten relevant documents per query, a per-query diagram would have one document per bin — and that is the point: pooling exposes whether a score means the same thing across queries. It does not. The smooth cosine (dense) and MaxSim (late-interaction) scores are massively over-confident: across the pooled pairs, with a base relevance rate of , the raw ECE is and . A cosine of does not mean a chance of relevance; it means whatever the query’s own scale makes it mean, and the concentration of cosine similarities in high dimensions is why a fixed threshold is incomparable across queries. Lexical BM25 is the interesting exception: its huge mass of exact-zero scores sits at confidence near zero and is well-calibrated in bulk (ECE ), but its tail is badly off (MCE ).
This is precisely the property rank fusion routed around. Reciprocal-rank fusion combines — it uses only ranks, never scores — because raw scores are incommensurable across queries and legs; fusing them directly would weigh one query’s confidence against another’s on a scale that does not transfer. Rank fusion sidesteps calibration by construction; this section is the reason it had to.
The fix is to learn the map from score to probability. Platt scaling fits a logistic ; isotonic regression fits the monotone step function minimizing squared error. Both crush the ECE — dense from to under — and both do something that looks surprising until you see why.
Theorem 2 (Monotone recalibration preserves the ranking).
A strictly increasing recalibration map (Platt’s with ) leaves the order of documents within every query unchanged, so per-query AP, NDCG, and the pooled AUC are identical before and after recalibration.
Proof. A strictly increasing satisfies , so is unchanged on every query; every ranking metric is a function of that order alone, and the rank-based AUC is invariant under any strictly monotone transform of the scores.
The pooled AUC is identical to six decimals before and after Platt scaling on every leg — the badge in Panel C — while the ECE collapses. Calibration is orthogonal to ranking: you can fix what the scores mean as probabilities without moving a single document, because calibration reshapes the score axis and the metrics read only the order. The Brier score — the mean squared error of the probability against the label — decomposes (Murphy) into reliability, resolution, and uncertainty, and recalibration drains the reliability term ( for recalibrated dense) while sparing the resolution that the ranking depends on.
Drift: has the distribution moved?
The last turn of the comparison is over time. In production the data shifts: the corpus grows, the query mix changes, an embedding model is swapped, and retrieval quality decays silently. Drift detection is the two-sample test of a reference window against a current one.
Definition 4 (KS, PSI, and the symmetrized-KL identity).
Let be the empirical CDFs of a monitored quantity (here per-query NDCG). The two-sample Kolmogorov–Smirnov statistic is the supremum distance between the two staircases,
distribution-free under the null. Binning the support into proportions (reference) and (current), the population stability index is
the Jeffreys (symmetrized KL) divergence, with the credit-risk traffic light stable, – moderate, significant.
The middle equality is exact — — so PSI is a symmetrized KL divergence, and the continuous divergence it approximates is the integral of the log Radon–Nikodym derivative, ; the binned PSI is its Darboux sum, exactly as Average Precision was the area under a curve. Panel D drives an embedding-degradation knob: as the dense leg’s vectors are perturbed, the per-query NDCG distribution shifts left, the KS sup-gap grows from to , and PSI crosses into the red. Under the matched-n null (the same distribution resampled) the detector is silent — mean PSI , KS .
Two subtler facts are the real lessons. First, a drift the aggregate mean cannot see is still catchable — and the catcher is, once again, the paired test.
Proposition 2 (Drift monitoring, like system comparison, must be paired).
A small uniform degradation drops each query’s score slightly but consistently. Comparing the two windows by their independent mean intervals declares them indistinguishable — the intervals overlap. The paired test on the per-query (now then) differences rejects, because pairing cancels the shared per-query difficulty, exactly as in the system-comparison case.
At a degradation that moves the mean by under standard errors — overlapping intervals, a dashboard staying green, and even the marginal KS test missing it () — the paired test fires at . The same pairing that resolved the significance cliffhanger is the right drift monitor.
Second, input drift and quality decay are different things. A pure covariate shift — the query mix moves from easy to hard, the retriever unchanged — fires the input-distribution alarm (the top-1 score PSI is , observable without any labels) while the model’s quality on a fixed query set is exactly unchanged (the paired outcome difference is zero). A genuine model decay, by contrast, drops the paired outcome (, ). So an input-drift alarm cannot diagnose decay on its own; you also need a labeled, paired outcome test. Monitor both, and read them together: input moved with outcome flat is data drift; outcome moved is decay.
Connections
- the direct prerequisite and the question this topic answers: that topic measured each leg's NDCG as a sample mean with a standard error and found the closest pair's intervals overlapping across all forty queries, a gap it estimated would need roughly 185 queries to resolve — the paired significance test here resolves exactly that cliffhanger, and the per-query NDCG it computed are the differenced samples the test consumes ndcg-discount-geometry
- the root of the evaluation layer and the source of the corpus, the three legs, the MaxSim oracle, and the estimator machinery (standard error, the bootstrap, the projected interval) this topic imports; the per-query AP it defined are the MAP samples the paired test differences, and the metric-as-estimator framing is what generalizes here to comparing two distributions set-metrics-precision-recall-map-mrr
- that topic fused rankings by reciprocal RANK rather than by score, and never said why; the calibration pillar here gives the reason — raw cosine and MaxSim scores are miscalibrated and incomparable across queries, so fusing them directly would weight one query's confidence against another's incommensurably, and rank fusion sidesteps calibration by construction rank-fusion-rrf
- the concentration of cosine similarities in high dimensions explains why a fixed similarity threshold means different things for different queries — the cross-query score incomparability the calibration pillar measures as a large expected calibration error, and the reason a raw retrieval score cannot be read as a relevance probability without recalibration high-dimensional-geometry
References & Further Reading
- paper A Comparison of Statistical Significance Tests for Information Retrieval Evaluation — Smucker, Allan & Carterette (2007) The canonical IR study: the randomization (permutation) test is the most appropriate for retrieval comparisons, the paired t-test tracks it closely, and the Wilcoxon and sign tests are less reliable on bounded, skewed per-query scores; CIKM 2007
- book Permutation, Parametric, and Bootstrap Tests of Hypotheses — Good (2005) The computer-intensive treatment of the sign-flip randomization test and the paired bootstrap — the distribution-free instruments that make no normality assumption, only exchangeability under the null; Springer Series in Statistics
- book An Introduction to the Bootstrap — Efron & Tibshirani (1994) The resampling estimate of a statistic's distribution, used here for the paired bootstrap significance test on the per-query metric differences, the assumption-light cross-check of the paired t and permutation p-values
- paper Predicting Good Probabilities with Supervised Learning — Niculescu-Mizil & Caruana (2005) The empirical comparison of Platt scaling and isotonic regression across learners, with the reliability-diagram methodology this topic uses to recalibrate retrieval scores; ICML 2005
- paper Transforming Classifier Scores into Accurate Multiclass Probability Estimates — Zadrozny & Elkan (2002) Isotonic regression (pool-adjacent-violators) for calibration: the nonparametric monotone fit that lowers the expected calibration error without changing the ranking; KDD 2002
- paper On Calibration of Modern Neural Networks — Guo, Pleiss, Sun & Weinberger (2017) The modern formulation of the expected and maximum calibration error and the reliability diagram, and the observation that high-capacity scorers are systematically over-confident; ICML 2017 (PMLR v70)
- paper A Survey on Concept Drift Adaptation — Gama, Žliobaitė, Bifet, Pechenizkiy & Bouchachia (2014) The framing of drift as a change in the data distribution over time and the distinction between covariate (input) drift and real concept drift — the two-cause analysis the drift pillar makes operational; ACM Computing Surveys 46(4)
- paper The Kolmogorov–Smirnov Test for Goodness of Fit — Massey (1951) The two-sample KS statistic as the supremum distance between empirical CDFs, with its distribution-free null — the geometric drift detector this topic plots as the sup-gap between two staircases; JASA 46(253)