Test Set Leakage in LLM Benchmarks: How Much Can Scores Be Trusted?

    Test set leakage can make large language model benchmark results look stronger than the capabilities they actually demonstrate. This article examines how contamination can enter through pretraining, post-training, and inference-time retrieval, how to distinguish strong leakage evidence from weak signals, how correction formulas change the meaning of a score, and how developers and enterprises can build more trustworthy evaluation pipelines using public benchmarks, held-out tests, and real-world business tasks.

    1. Why a Near-Perfect Score Still Needs Scrutiny

    Evaluating a large language model’s programming ability often relies on standardized tests: provide a problem description, let the model generate code, and check the result against predefined test cases. This process is easy to repeat and compare across models, but it rests on a critical assumption: the model has not received the test questions and answers in advance.

    The source material reports a phenomenon worth attention. After being given one programming problem, a model not only completed the current task but continued to output the statements, examples, and reference answers for subsequent problems. The order matched a public test set, and the output even preserved spelling errors from the original text.

    If this content did not appear in the input, conversation history, or external retrieval results, then such continuous and precise reproduction is more revealing than simply answering one question correctly. The model may have learned not only how to solve problems but also the specific contents of the test set.

    According to the source material, in a test set of 164 problems, 158 could be reproduced in this way, or about 96.3%. This figure requires a clear caveat: it reflects item reproduction in a specific experiment and should not be directly interpreted as the leakage rate for all models, all test sets, or all training data. Because the material does not provide full experimental configuration, raw outputs, and independent review records, it is better treated as an evaluation risk case than as a quantitative conclusion for the entire industry.

    The real question is not simply “are high scores always fake?” It is: how much of this score comes from transferable capability, and how much comes from memorization of existing test items?

    2. From Training to Testing: How Contamination Forms

    1. Pretraining: Public Content May Be Absorbed Wholesale

    Pretraining typically uses large amounts of text and code. By predicting subsequent content, a model learns language patterns, knowledge associations, and program structure.

    Public test questions may appear in documentation, code repositories, technical articles, and datasets. If training data collection lacks effective isolation, problem statements, answers, and even complete test files may enter the training corpus.

    This does not necessarily mean developers intentionally “trained on the exam.” Even without optimizing specifically for a test set, broad collection of public content can cause contamination. Test contamination is therefore a data risk that needs governance; the presence of contamination alone should not be used to infer intent.

    2. Post-Training: Answers and Solution Traces Can Also Leak In

    Post-training aims to improve a model’s ability to follow instructions, complete tasks, and adapt to application scenarios. At this stage, contamination does not necessarily appear as complete original questions. It may enter through:

    • Explanations and standard answers for public problems;
    • Instruction samples rewritten from original problems;
    • Preference comparison data containing problem content;
    • Synthetic training samples generated from public problems;
    • Solution traces that include problem statements, answers, or test feedback.

    Checking only the pretraining corpus is therefore insufficient. A base model that does not obviously memorize test questions may still have been exposed to that content after post-training.

    3. Inference: Retrieval and Context Contamination Must Also Be Ruled Out

    A correct answer may also come from external materials accessible during inference rather than from memory stored in model parameters.

    For example, a retrieval system may return a public solution, or the conversation history may already contain the relevant answer. If the evaluation goal is to measure the model’s independent problem-solving ability, these sources must be isolated. If the goal is to measure the capability of a complete application system, retrieval may be allowed, but the configuration must be disclosed.

    Model-only evaluation and application-system evaluation are both valid, provided they are not conflated.

    3. Identifying Leakage: More Than Accuracy or Similarity

    No single detection metric can cover every case of training contamination. A more reliable approach is to combine multiple forms of evidence and distinguish strong evidence from weak evidence.

    1. Full Reproduction Is More Persuasive Than Style Similarity

    For coding problems, common solutions often exist. Two independent solvers may write similar code, especially for short functions, fixed interfaces, and typical algorithms.

    By contrast, the following signs deserve more scrutiny:

    • Reproducing long problem statements that did not appear in the input;
    • Outputting subsequent problems in an order consistent with the test set;
    • Preserving spelling errors specific to the original material;
    • Reproducing the problem statement, examples, explanations, and reference answers together;
    • Producing these behaviors consistently across multiple independent experiments.

    Experiments should still record prompts, session state, sampling settings, and external access permissions to rule out other sources.

    2. Adjacent-Item Continuation Is a Probe, Not a Final Verdict

    Providing a segment of test text and observing whether the model can continue with the next problem can help detect whether the model has memorized a particular sequence.

    This method is valuable but limited. A model may have seen individual problems without seeing the complete file, making continuation impossible; it may also know an answer but be unwilling to output the problem statement.

    Therefore, “precise continuation” can be a strong contamination clue, while “failure to continue” cannot prove the absence of contamination, nor can it alone prove that a high score comes entirely from reasoning ability.

    3. Item Variants Test Whether Capability Transfers

    It is possible to construct variants at different levels while preserving the core knowledge point:

    • Paraphrase variants: Change wording, variable names, and examples;
    • Constraint variants: Adjust input size, allowed data ranges, or output requirements;
    • Structural variants: Change how the problem is organized so that the original answer cannot be directly applied;
    • Combination variants: Combine multiple knowledge points into a new task.

    If a model performs very well on original items but drops noticeably on reasonable variants, further investigation is needed to determine whether it relies too heavily on memorization.

    Variants must also be reviewed by humans. Changing constraints may change algorithmic complexity requirements; a “harder new problem” should not be treated simply as an equally difficult clean version of the original.

    4. How Should Scores Be Interpreted After Removing Reproducible Items?

    The source material mentions that a perfect score fell to 3.66 points after subtracting the contribution of reproducible items. The meaning of this number depends on the scoring convention; it should not be directly interpreted as “the model’s true ability is only 3.66 points.”

    Let N be the total number of items, M the number of suspected contaminated items, C the total number of passes, and Cₚ the number of passes among suspected contaminated items. There are at least two different calculation methods:

    Convention 1: Keep the original denominator and count only the pass contribution of unmarked items.

    Corrected score = (C − Cₚ) ÷ N

    This removes all score contribution from suspected contaminated items. It expresses a conservative evidence convention, not a directly measured true capability.

    Convention 2: Calculate the pass rate only among unmarked items.

    Remaining-item pass rate = (C − Cₚ) ÷ (N − M)

    This measures model performance on the remaining subset. When very few items remain, however, the result may be highly unstable and may not represent the full task distribution.

    Consider the example of 164 problems, with 158 marked, leaving only 6. If the model originally passed all items, then under the first convention the retained score contribution is about 3.66%; under the second convention, the pass rate on the remaining items is still 100%. These two numbers are not contradictory; they answer different questions.

    A rigorous evaluation report should therefore disclose at least:

    • The original pass rate;
    • The identification method and number of suspected contaminated items;
    • The scoring formula used after removal;
    • The number, difficulty, and task distribution of remaining items;
    • Uncertainty and possible detection error.

    Contamination detection results can weaken the explanatory power of an original score, but they do not automatically provide a precise value for the model’s true ability.

    5. Are Public Test Sets Still Useful?

    Public test sets are not without value. They are reproducible, support historical comparisons, and help researchers observe changes in model capability. The problem is that the longer a public test set has been available and the more widely it has spread, the harder it is to ensure that a model has never encountered it.

    A more reasonable approach is to divide evaluation into three layers.

    Public question sets are suitable for regression testing and long-term tracking. When using them, teams should disclose prompt templates, sampling settings, execution environments, and tool permissions, and avoid directly comparing scores obtained under different conditions.

    This layer mainly answers: “How does the model perform on this set of known standard tasks?”

    Layer 2: Held-Out Test Sets for Measuring Generalization

    Held-out test sets should be isolated from training, tuning, and development feedback. Items should ideally have traceable creation times and undergo independent review.

    If a development team repeatedly adjusts a model based on held-out set performance, that set will gradually become a development set. Teams should therefore distinguish development sets, held-out validation sets, and final test sets, restrict access, record usage counts, and refresh them periodically.

    This layer mainly answers: “How does the model perform on new tasks that were not used for optimization?”

    Layer 3: Business Evaluation for Verifying Practical Value

    Enterprises care more about whether a model can handle their own problems. In coding scenarios, examples include code modification, defect localization, test supplementation, and multi-file maintenance.

    These tasks require not only correct output but also environment understanding, constraint following, exception handling, and result verification. Public algorithm problem scores can provide reference, but they cannot replace real workflow evaluation.

    This layer mainly answers: “Can the model reliably create value under real constraints?”

    6. How Developers and Enterprises Can Build Trustworthy Evaluation Pipelines

    1. Define Capability Boundaries Before Selecting Items

    Clarify whether the evaluation target is a base model, a chat model, or a complete system that includes retrieval and execution tools.

    Define task goals first. For code generation, evaluation may cover functional correctness, boundary coverage, and runtime efficiency. For code maintenance, it should also cover interface compatibility, change scope, and regression risk. Do not replace all capability judgments with a single composite score.

    2. Establish Data Isolation and Provenance Records

    Each test item should record its source, creation time, version, access permissions, and public status. Test items, reference answers, and hidden cases should all be included in management.

    Isolation means more than “not placing data in training files.” It also means preventing test content from re-entering training through logs, feedback samples, retrieval materials, or later synthetic data. When external services are used, teams should confirm data processing boundaries and applicable terms.

    3. Add Contamination Checks to the Evaluation Pipeline

    A possible sequence is:

    Evaluation configuration confirmation → input and retrieval source checks → text reproduction probes → item variant tests → functional verification → result review.

    Reproduction probes should cover both problem statements and answers; checking only whether the same function names appear is insufficient. When suspected contamination is found, preserve evidence and flag it separately rather than deleting records directly or making unverified attributions.

    4. Use Multidimensional Metrics, Not Just a Leaderboard

    In addition to task pass rate, teams should track:

    • Performance across task categories;
    • Success rate and variance across multiple runs;
    • Rates of constraint violations and abnormal outputs;
    • Response latency and resource consumption;
    • Human correction cost;
    • Ability to recover after failure.

    For code-generation tasks, results should be verified in a restricted execution environment with resource limits and access boundaries, so that the evaluation itself does not introduce security risks.

    5. Fix the Budget and Report Uncertainty

    A single generation cannot be directly compared with the best result after multiple attempts. The number of candidates, execution feedback, and degree of human intervention all affect the final score.

    For results that are close, teams should increase samples or repeat experiments and report uncertainty. When samples are insufficient, the conclusion can be “the difference cannot yet be confirmed,” rather than forcing a ranking.

    7. Conclusion: Scores Can Inform, but They Must State What Was Measured

    The most important impact of test set leakage is that it breaks the default premise that “a test score represents capability on unknown tasks.” Precise reproduction of problem statements, preservation of original errors, and continuous output of subsequent items all deserve serious investigation. However, reproduction rate, contamination rate, and true capability cannot be simply equated.

    For developers, trustworthy evaluation requires traceable data sources, clear scoring conventions, reasonable variant tests, and reproducible execution results. For enterprises, model selection must also include held-out tasks and real business workflows, with comprehensive evaluation of correctness, stability, cost, and risk.

    What truly deserves trust is not a polished score table, but an evidence system that can explain where scores come from, disclose evaluation boundaries, and be repeatedly verified on new tasks.