Correcting test set contamination by spiking the training data

Johnny Tian-Zheng Wei, Jerry Li, Ameya Godbole, Robin JiaarXiv 2026 · arXiv

TL;DR

Test set contamination artificially inflates LLM benchmark scores, but simply detecting leaks doesn't tell us a model's true capabilities. This paper introduces "spiking"—intentionally contaminating training data with test examples at known rates—to calibrate statistical estimators that can accurately correct inflated scores and recover true model performance.

What Problem Does This Paper Address?

Large Language Models (LLMs) are trained on massive web-scale datasets that frequently and accidentally include the very evaluation benchmarks used to test them. This "test set contamination" makes it incredibly difficult to discern whether a model is genuinely capable or just parroting memorized answers.

While existing literature focuses heavily on detecting contamination, this paper tackles correcting the contaminated scores. Crucially, the authors address a major flaw in standard mitigation strategies: if a model primarily leaks harder questions (correlated contamination), simply throwing out suspected leaked items introduces selection bias, making the remaining test set unrepresentative and skewing the final score.

Figure 1: Illustration of correcting contaminated test scores. Each point represents a test example and its P(correct) under the Hubble models. (a) When there is no contamination, the standard and perturbed model predict similarly. (b) The perturbed model memorizes contaminated items and the standard model serves as the ground truth. When test examples are randomly contaminated, removing contaminated items recovers the clean accuracy. (c) When contamination is correlated with difficulty (e.g. harder examples are more likely to be contaminated), removing contamination only partially recovers the clean accuracy. Fully recovering it additionally requires predicting the correctness of contaminated examples.

Methods

The core proposal is spiking: model developers intentionally insert a small fraction of test examples into their training data at known duplication rates. This provides a ground-truth control group used to calibrate two types of probabilistic predictors:

  1. Memorization Predictors: Estimate the probability that a test item was seen during training ($\hat{P}(\text{contam}|i)$). These are built on Membership Inference Attacks (MIAs) like Min-K%++ and calibrated using Platt scaling.
  2. Correctness Predictors: Estimate the counterfactual probability ($\hat{P}(\text{correct}|i)$)—how likely the model would be to answer correctly without contamination—by using a secondary LLM to evaluate question difficulty.

Borrowing frameworks from causal inference, the authors evaluate multiple estimators to reconstruct the clean score:

  • Naive: No correction (overestimates performance).
  • Inverse Propensity Weighting (IPW): Downweights or drops memorized items (fails when contamination is correlated with difficulty).
  • Imputation: Replaces all outcomes with the correctness predictor's estimates.
  • Combined: Dynamically routes between observed and imputed outcomes based on the memorization probability.

To validate these estimators against an absolute ground truth, the authors utilize the Hubble model suite, which features "minimal pairs" of LLMs trained identically, except one was deliberately contaminated with test sets.

Datasets

The framework was benchmarked across five prominent NLP datasets:

  • WinoGrande (Coreference resolution)
  • MMLU (Multi-task language understanding)
  • HellaSwag (Commonsense reasoning)
  • PIQA (Physical interaction QA)
  • PopQA (Factoid QA)

Additionally, general Wikipedia passages were used to evaluate cross-dataset calibration transfer.

Key Insights and Ideas

  • Randomization is Essential for Calibration: You cannot reliably calibrate a contamination detector without a known control population. Spiking introduces the exact randomization required for true statistical inference.
  • The Selection Bias Trap: When contamination is correlated with item difficulty (e.g., a model only memorizes the hardest questions), simply dropping contaminated items makes the test look artificially easy. Imputation or combined estimation is required to fill in what the model would have scored.
  • Extreme Sample Efficiency: Calibrating a memorization predictor via Platt scaling requires surprisingly little data. As few as 10 spiked examples are sufficient to achieve stable calibration.
  • Cross-Dataset Generalization: A memorization predictor calibrated on one dataset (or even general Wikipedia text) transfers effectively to entirely different benchmarks. Developers don't need to spike every single benchmark individually.

Key Results

  • Substantial Error Reduction: On the MMLU dataset under high random contamination, the Naive baseline overestimates accuracy by 13.1 points. The Combined estimator slashes this Root Mean Squared Error (RMSE) down to just 1.8 points.
  • Handling Correlated Contamination: When difficult items are selectively contaminated, standard item-dropping (IPW) fails severely (RMSE of 22.3). However, the Imputation and Combined estimators successfully mitigate the selection bias, yielding much lower errors (RMSE of 10.5 and 15.4, respectively).
Figure 2: Phase diagrams showing winning estimators by lowest RMSE, under varying memorization and correctness predictor quality. Estimators are described in §3.1 and this simulation uses MMLU data and synthetic predictors (details in §3.3). (Top row) Random contamination at increasing contamination strength (low = 1× duplicates, mid = 16×, high = 64/256×). As the strength increases, the combined estimator’s optimal region grows. (Bottom row) Correlated contamination at mid and high contamination, where contaminated examples are easy, medium, or hard. When the contaminated items are hard, IPW fails because removing contaminated items removes difficult examples and introduces selection bias. Only the combined or imputation estimator can recover the clean score.

Limitations and Future Work

  • Exact Duplicates Only: The simulation framework currently evaluates contamination based on exact text duplication. In the wild, contamination often takes the form of paraphrases or near-duplicates, which will require more sophisticated membership inference techniques.
  • Requires Training-Side Cooperation: Spiking is a training-side intervention. It requires model developers to actively participate by inserting canaries into their data pipelines, making it less applicable for purely external, black-box auditing unless mandated by technical governance standards.

Summary updated

Abstract

The literature on test set contamination largely focuses on detection, but the correction of contaminated test scores is underexplored. Our core proposal is to spike the training data by intentionally contaminating some test examples at known rates. The spiked examples can then be used to calibrate predictors of model memorization which enable principled statistical correction of inflated test scores. To evaluate different correction estimators, we first present a simulation framework based on the Hubble models. Hubble models come in minimal pairs, where the perturbed model was deliberately contaminated with several test sets, while the standard model was not, serving as the counterfactual and correction target. We consider estimators that use information from a memorization predictor, correctness predictor, or both. In simulation, we establish basic statistical intuitions and show that estimators leveraging memorization and correctness information are better than naive estimation which makes no correction at all. We then instantiate several memorization and correctness predictors, and find that simple predictors such as Platt-scaled membership inference metrics provide good signal for correction. Finally, we examine the practical considerations of spiking. Simple memorization predictors need no more than 10 examples for calibration and often transfer from one dataset to another. Taken together, spiking is a promising solution for test set contamination.
BibTeX
@misc{wei2026correcting,
  author = {Johnny Tian-Zheng Wei and Jerry Li and Ameya Godbole and Robin Jia},
  title = {{Correcting test set contamination by spiking the training data}},
  year = {2026},
  eprint = {2605.24818},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.24818},
}
Figure