Test Set Leakage in LLM Evaluation: Why Benchmark Scores Can Be Misleading
Test-set leakage can make large language model benchmark results look better than they are. Drawing on a verbatim-continuation experiment, this article explains how evaluation data can enter both pretraining and post-training data, describes a reproducible contamination check, and shows why leaked items can distort aggregate scores and model rankings. It also offers practical recommendations for more trustworthy evaluation, including reporting contamination rates and decontaminated scores, using private or dynamically rewritten test sets, evaluating across multiple benchmarks and runs, distinguishing base models from chat models, and favoring tasks that test generalization rather than memorization.
Test Set Leakage in LLM Evaluation: Why Benchmark Scores Can Be Misleading
1. An Anomalous Experimental Result
While evaluating a large language model’s code-generation ability, we ran what appeared to be a routine test. We took one problem from a widely used code evaluation set and presented it to the model. The model answered correctly. Then something concerning happened: without any prompt, the model continued to produce the problem statements, examples, and even the official reference answers for subsequent problems in the set. The output matched the original material almost verbatim, including a legacy typo that appeared in one of the original problems.
This meant the model was not solving the problem. It was reciting it. Those test problems had already entered the model’s training data, and the evaluation was measuring memorization far more than reasoning.
Following this clue, we systematically reproduced the experiment across several mainstream benchmarks, including code generation, science commonsense question answering, and math word problems. The results were troubling. A publicly available base model could reproduce more than 90% of code test problems almost completely, and more than 80% of science questions and math problems showed similar memorization patterns. These are precisely the kinds of benchmarks that are repeatedly cited in model launch presentations as sources of high scores.
2. How LLMs May Have “Seen the Exam”
To understand data contamination, it helps to review the training pipeline of large language models.
1. Pretraining. The model performs self-supervised learning on massive amounts of internet text. Most mainstream evaluation sets are publicly available online, including problem statements, reference answers, and a large volume of discussion posts, solutions, and reposts around those problems. If this text enters the corpus, the model can memorize the mapping from question to answer as a plain-text pattern.
2. Post-training. If the data used for instruction tuning and preference alignment is constructed from a model’s question-answer results on a benchmark, test content can be injected into the model again. To achieve better leaderboard results, some teams even deliberately train on data drawn from the same sources as public benchmarks. This is often called benchmark-oriented training in the industry.
3. Indirect leakage. Even when no one acts with malicious intent, evaluation sets are widely forked, translated, and rewritten across the community. Pretraining crawlers may capture these variants indirectly, creating de facto contamination.
3. How to Quantify Contamination: A Reproducible Detection Method
A direct and practical way to determine whether a model has memorized test problems is the verbatim continuation test:
Input: the first several lines of problem N in a test setObserve: can the model continue, without being asked, by producingthe full problem statement and reference answer?Decision: if the output overlaps heavily with the original problemat the verbatim level, mark the problem as "contaminated"
By running this process across an entire test set, we can calculate the contamination rate for each benchmark. In our experiments:
- Code benchmarks had the highest contamination rate, approaching 96%, with answers reproduced together with the problem statements.
- Science commonsense benchmarks showed a rate of about 85%, and math benchmarks about 80%, with memorizable characteristics.
- Some models could hardly reproduce any test problem at all, suggesting that their high scores were more likely to come from genuine ability.
The more important step is to rescore after removing contaminated samples. After excluding every problem that the model could recite and counting only performance on problems it had not seen, the results changed dramatically. One model’s score on a code benchmark dropped from full marks to single digits. Rankings based on average scores across multiple models reversed: a model that had risen to the top through memorization fell to last place after decontamination, while a model with a near-zero recitation rate moved to the front.
4. Why Contamination Distorts Evaluation
1. Scores no longer correspond to capability. The statistical premise of evaluation is that the model has not seen the test distribution. Once that premise is broken, the score measures memory retrieval, and generalization ability is completely obscured.
2. Rankings lose comparability. Different models are trained on different corpora and at different times, so the number of test problems they have seen can vary enormously. Models with high contamination rates gain an unfair advantage, while models with low contamination rates are penalized. As a result, leaderboard ordering becomes unreliable.
3. Downstream model selection is misled. When enterprises choose models based on leaderboards, a high-scoring model may perform only average on real business problems, because those problems are new rather than original items in the training data.
5. Recommendations for More Credible Evaluation
For developers and evaluation teams, we recommend the following practices:
- Measure contamination before measuring capability. Make verbatim continuation detection a prerequisite for evaluation, and report both the contamination rate and the decontaminated score.
- Use private or dynamic test sets. Regularly create undisclosed new problems, or produce semantically equivalent rewrites of public problems by changing function names, numbers, and variable order. Keep the evaluation target the same while changing the surface form.
- Report multiple benchmarks and multiple runs. A high score on a single leaderboard is not evidence of capability. Combine benchmark results with evaluations on real tasks, such as end-to-end tests of internal business scenarios.
- Distinguish base models from chat models. Conclusions should clearly correspond to a specific model version and configuration. Avoid mixing results from different versions or setups.
- Pay attention to performance on creative tasks. Tasks that require the model to generate new solutions or handle new constraints expose the true boundaries of capability more effectively than memorization-oriented tasks.
6. Conclusion
Benchmark scores are an important reference for assessing large language model capability, but they rest on the premise of a fair exam. When evaluation sets leak into training data at scale, a high score on a leaderboard may simply be an echo of memorization. Whether you are building models or using them, incorporating contamination rates into evaluation reports and cross-validating with unseen new problems is a necessary step toward restoring the original purpose of evaluation. Only then can benchmark scores become a trustworthy signal of capability again.
