Test Set Leakage: How to Rebuild Trust in LLM Evaluations

    As Large Language Models (LLMs) achieve near-perfect scores on public benchmarks, questions inevitably arise about the validity of these evaluations. This article explores the mechanisms of test set contamination, from pre-training data absorption to leaderboard overfitting. It distinguishes between memorization and true problem-solving ability, explains how to accurately interpret scores after removing leaked questions, and provides a practical framework for enterprises to build reliable, reproducible, and business-aligned evaluation systems.

    1. High Scores: Why Are They Still Suspect?

    Evaluating LLM capabilities typically requires a fixed set of questions, a scoring rubric, and a repeatable testing process. Coding tasks check if the code passes tests, math tasks verify results and derivations, and knowledge questions check factual accuracy. While this approach is sound, it relies on a critical premise: the test content must not enter the model’s training process in a way that influences its answers.

    Recent experiments targeting four public foundation models and twenty common evaluation sets highlight this issue. In one instance, a model reproduced 158 out of 164 questions (approximately 96%) from a specific coding test set. Similar high reproduction rates were reported in science QA and math tests.

    The most striking observation is not just that the model provided correct answers, but that when given one question as context, it proceeded to output the exact text, examples, and reference answers of subsequent questions—right down to the original spelling errors.

    If these phenomena can be consistently reproduced under strictly controlled conditions, they provide stronger evidence than simply “answering a public question correctly.” While a correct answer might stem from genuine reasoning, the simultaneous reproduction of rare typos, specific question sequencing, and unprovided reference implementations strongly suggests the model has encountered the original text.

    However, the boundaries of this evidence must be clear: these figures are drawn from specific materials and should not be treated as independently verified conclusions. Without complete prompts, model versions, runtime configurations, matching rules, and experimental logs, we cannot pinpoint the contamination source or equate it with intentional manipulation by developers.

    The real question we must ask is: how much of a high score reflects transferable capability, and how much relies on familiarity with public questions?

    2. How Does Test Set Contamination Occur?

    1. Public Datasets May Enter Training Corpora

    LLM pre-training typically utilizes massive text and code corpora. Once a public test set is released, it may be copied into educational materials, solution articles, code repositories, discussion forums, or data compilations.

    Even if a training pipeline explicitly excludes the original test set files, it may not exclude all derived versions. A single question might be rewritten, translated, reformatted, or split into prompts, solution steps, and answers, appearing across various sources.

    Thus, contamination isn’t limited to “directly using the original test file.” It can also manifest as:

    • Complete copying of the prompt and reference answer;
    • Slight rewording of the question while keeping the core structure intact;
    • Retention of identifiable conditions in solution explanations;
    • Code examples containing the reference implementation of the original question;
    • Multiple public versions collectively forming a recoverable trail of the question.

    Contamination mitigation must cover these overlapping granularities, rather than just checking file names or verbatim repetition.

    2. Post-Training Can Also Introduce Evaluation Content

    After pre-training, models often undergo instruction tuning and preference optimization to improve performance. If the data used in these stages includes public exam questions, standard answers, or training samples generated for specific question banks, it similarly compromises test independence.

    It is important to distinguish that learning general problem-solving methods does not inherently constitute contamination. Training a model to understand loops, recursion, algebraic derivations, or scientific concepts is standard capability building. The problem arises when specific questions and their answers—originally intended for independent verification—are prematurely used to optimize the model.

    3. Long-Term Optimization Around Fixed Leaderboards Causes Adaptation Bias

    Even without directly training on test questions, development teams repeatedly reviewing results from the same test set to adjust data, training strategies, or model selection will gradually adapt to that specific set.

    This is akin to constantly adjusting teaching materials based on a specific exam’s results, ultimately making the model better at a fixed test paper rather than at solving novel problems.

    Therefore, evaluation credibility depends not only on whether data has leaked, but also on whether the test set has been overused as a development feedback loop.

    3. Memorization vs. Problem-Solving: Don’t Confuse Them with a Single Score

    1. Answering Public Questions Correctly Does Not Prove Contamination

    A correct piece of code, a factual statement, or an accurate calculation might all stem from genuine capability.

    Especially for shorter questions, the solution space is naturally limited. Multiple models generating similar answers does not necessarily mean they have all seen the same reference answer.

    Contamination detection should look for more discriminating evidence, such as:

    • Long text reproduction of unprovided sections;
    • Reproduction of rare errors or unnecessary formatting details;
    • Multiple questions appearing consecutively in their original order;
    • Reproduction of specific variable names and comments from a reference implementation;
    • Consistent recovery behaviors across multiple independent runs.

    Combined, these pieces of evidence are far more persuasive than mere answer similarity.

    2. The Ability to Reproduce a Dataset Doesn’t Mean All Correct Answers Are Memorized

    A model might memorize certain questions while still possessing the ability to solve similar, novel questions. The two are not mutually exclusive.

    For instance, a model could memorize the reference implementation for a specific string manipulation problem while still fully understanding boundary conditions, character traversal, and return value constraints. Simply because it can reproduce the original question does not mean it lacks programming skills entirely.

    A more rigorous evaluation should measure two dimensions simultaneously:

    • Exposure Level: How familiar is the model with public test content?
    • Generalization Capability: How stable is the model’s performance on structurally similar, but unpublished, new problems?

    3. Failure to Reproduce Does Not Mean No Contamination

    A model might have encountered a question but be unable to reproduce it verbatim. It could also fail detection due to output strategies, prompt formats, or context length limitations.

    Therefore, reproduction tests typically only provide evidence of observable contamination; they cannot prove the absence of other forms of overlap in the training data.

    “Reproduction not found” and “contamination proven absent” must be strictly differentiated.

    4. How to Interpret Scores After Removing Leaked Questions?

    One material noted that after excluding reproducible questions, a model’s coding score dropped from a perfect score to 3.66. While striking, this can be easily misinterpreted without understanding the calculation method.

    Assume a test set has N total questions, with C originally answered correctly. L questions are flagged as suspected contamination, with Cl of those answered correctly. There are at least two different statistical approaches:

    Conservative Contribution Score:
    S₁ = (C − Cₗ) ÷ N
    This retains the original denominator, excluding correct answers from suspected contaminated questions. It answers: “How much did the unflagged portion contribute to the original total score?”

    Remaining Accuracy:
    S₂ = (C − Cₗ) ÷ (N − L)
    This calculates accuracy only on the remaining questions. It answers: “How did the model perform on the unflagged questions?”

    Using the material’s example of 164 total questions and 158 reproducible ones, 6 questions remain. If the original score was indeed perfect, using the first method (S₁) yields about 3.66%. However, using the second method (S₂), the remaining accuracy is still 100%.

    This conditional calculation reveals that a drastic score drop might primarily reflect the statistical approach rather than a directly measured drop in model capability.

    The first method isn’t without value; it can serve as a conservative score contribution metric. However, it should not be directly labeled as the “true capability score.” The second method also has limitations: with a remaining sample of only 6 questions, it lacks sufficient representativeness to support a stable conclusion.

    A more reasonable reporting method would simultaneously disclose the original score, the proportion of contamination flags, the remaining accuracy, the sample size, and the margin of uncertainty.

    5. How to Build a Reproducible Contamination Detection Process?

    1. Lock Down Experimental Conditions First

    Before detection begins, you must fix the model version, prompt template, generation settings, context content, and evaluation time. If the model can use retrieval or other external information sources, these capabilities must be disabled or treated as a separate, independent test condition.

    Otherwise, question reproduction might stem from external retrieval rather than memorization within the model’s parameters.

    2. Design Recovery Tasks of Varying Strengths

    Instead of relying on a single prompt, use multiple probes:

    • Provide a question prefix and check if it can complete the unprovided section;
    • Provide one question and check if it can recover the subsequent question;
    • Provide a snippet of a question and check if it can output the reference answer;
    • Alter the prompt wording and check if the phenomenon remains stable;
    • Use unpublished control questions to estimate the baseline accidental match rate.

    During detection, the complete answer being verified should not be placed in the context, otherwise it is impossible to distinguish between recovery and simple copying.

    3. Combine Text Matching with Manual Review

    Verbatim matching is suitable for identifying direct reproduction but will miss layout changes, translations, or slight rewording. Semantic similarity detection can expand coverage but might also misjudge generic answers as evidence of contamination.

    Therefore, a layered judgment should be applied:

    • Exact long-text reproduction as strong evidence;
    • Reproduction of unique detail combinations as a priority for manual review;
    • Samples with only semantic similarity retained as weak evidence;
    • Common knowledge and generic solutions should not be easily identified as contamination.

    4. Record Evidence, Not Just Percentages

    Each record should include the sample ID, input, output, matching snippet, judgment basis, and review result. It should also state whether multiple attempts were made and how many.

    If one model is tested dozens of times and another only once, their “reproducibility rates” cannot be directly compared. The test budget itself impacts the detection results.

    6. How Enterprises Should Build Reliable Capability Evaluations

    1. Use Unpublished, Business-Relevant Independent Test Sets

    Public leaderboards can serve as an initial screening, but enterprise selection should rely more heavily on its own task distribution.

    Coding scenarios should cover real API constraints, exception handling, boundary conditions, and maintenance costs. Knowledge scenarios should focus on material comprehension and evidence consistency. Workflow scenarios should check the completion rate and failure recovery capabilities of multi-step tasks.

    You don’t need the maximum number of questions; instead, prioritize source independence, business relevance, and explainable scoring.

    2. Test Transferability with Structural Variants

    Simply replacing variable names is usually insufficient to distinguish between memorization and comprehension. A more effective approach is to modify conditions that affect the solution, such as:

    • Adjusting input scale or boundary ranges;
    • Changing output formats and acceptance constraints;
    • Adding new exception scenarios;
    • Breaking a large task into multiple interdependent steps;
    • Altering condition combinations so the original reference answer no longer applies.

    Variants must be manually verified to ensure they still have clear, reasonable scoring criteria, avoiding mistaking a flawed question for a model failure.

    3. Measure Accuracy Alongside Engineering Costs

    Enterprises need stable delivery, not just one-off correct answers. It is recommended to simultaneously observe:

    • Success rate on independent tests;
    • Consistency across multiple runs;
    • Adherence to output formats and constraints;
    • Response latency and resource consumption;
    • Post-failure repair capability;
    • Manual review and rework costs.

    A model with less contamination isn’t always the best for business; a model with higher public scores shouldn’t automatically get procurement priority. The final conclusion should come from the same set of independent business tests.

    4. Establish Rotation and Access Control Mechanisms

    Internal test sets can also leak. You should restrict access to the complete question bank, separate development sets from final verification sets, and maintain version and source records for all questions.

    It is also important to note that logs, feedback samples, or run traces containing test questions might later enter the training or optimization pipeline, causing a new round of contamination.

    Test set maintenance is not a one-time cleanup, but a continuous data governance effort.

    7. What to Disclose for a Credible Benchmark?

    A report capable of supporting technical decisions should at least explain:

    1. Model version, test time, and runtime conditions;
    2. Test set source and its public status;
    3. Prompt templates, scoring rules, and retry strategies;
    4. Contamination detection methods, thresholds, and review processes;
    5. Original scores and different correction calculation methods;
    6. Remaining sample size and statistical uncertainty;
    7. Results on independent new questions or structural variants;
    8. Known limitations and unconfirmable items.

    This information is more important than a single leaderboard ranking. Only when readers can understand how the experiment was conducted, how the score was calculated, and where the conclusions apply, does the evaluation possess reproducibility and decision-making value.

    Conclusion: Let Scores Represent True Capability Again

    Test set contamination does not mean all public evaluations are meaningless. Rather, it reminds us that a fixed, public test paper repeatedly used over a long period cannot forever bear the responsibility of independent verification.

    Faced with results like a “96% reproduction rate,” the correct attitude is neither to ignore it nor to immediately declare the model incompetent. We should first verify the recovery evidence, clarify the scoring calculation method, and finally use unpublished new questions to verify generalization performance.

    For developers and enterprises, the most reliable basis for selection is not a beautiful total score, but a transparent, independent, and reproducible evaluation system closely tied to real-world business tasks.