Benchmark Contamination: Why High LLM Scores May Just Be Memorized Test Sets

    This article examines benchmark contamination in large language model evaluation, where models reproduce entire public test sets verbatim instead of solving unseen problems. It explains how pretraining, post-training, and evaluation interact, distinguishes light contamination (familiarity with problem types) from heavy contamination (verbatim memorization), and shows how contamination can distort both absolute scores and rankings. It then outlines a practical, layered evaluation approach—private held-out sets, dynamic generation, equivalent perturbations, and contamination probes—along with engineering controls for trustworthy, reproducible scoring.

    1. An Anomaly: One Question In, an Entire Exam Out

    In a standard code evaluation workflow, the harness typically feeds the model a single problem—say, problem 66 from a public code benchmark. The model returns the correct answer, which should be an ordinary successful sample. But it does not stop. It keeps generating the statement, examples, and reference answer for problem 67, then 68, 69, and 70, in exactly the same order as the public set—even reproducing a typo the original author made years ago.

    None of that content existed in the input. When the evaluators tried the full set one by one, they found that 158 of 164 problems could be “written out from nothing” this way, statements and answers alike. Yet in a standard run, the model scored a perfect result on this benchmark.

    This is not solving problems; it is reciting the test set. When a model can reconstruct unseen problems and their reference answers word for word, its score on that benchmark no longer reflects programming ability—only how thoroughly the training corpus covered the benchmark.

    This is not an isolated issue with a single vendor. Over the past period, the same trend has been observable in both pretraining and post-training: more and more high scores come from “having seen the exam” rather than “being able to solve the problem.” That is the core technical issue this article addresses—how benchmark contamination systematically distorts scores, and how engineering teams should respond.

    2. First, Understand How Models “Go to School”

    To determine where contamination occurs, you first need to see the chain that forms model capability, which roughly has three stages.

    • Pretraining: like reading through a giant library. The model does self-supervised learning over massive web pages, books, and code repositories to produce a base model. It has broad knowledge but is not yet good at following instructions.
    • Post-training: like on-the-job training. Techniques such as instruction tuning and preference alignment teach the model to understand requirements, write runnable code, and call tools, ultimately becoming the assistant or agent people use daily.
    • Evaluation: like taking an exam. The industry scores models with a series of public benchmarks, and the results shown at launches basically come from this stage.

    The problem lies between the third stage and the first: the exam is public. Once the problems and answers end up mixed into the books the model has read or the training material it has seen, the exam is no longer an exam. And “mixed in” comes in degrees—distinguishing these two levels is the prerequisite for all the governance measures that follow.

    3. Two Levels of Contamination: Drilling Problem Types vs. Obtaining the Original Paper

    Light contamination: familiarity with problem types and distributions. The model has seen large numbers of similar problems, similar solutions, and similar discussions, so it is extremely fluent at the standard approaches to such questions. This is not necessarily bad—it is closer to “having reviewed the syllabus,” and the capability may still be real. It just systematically inflates the score, and the amount of inflation differs across models.

    Heavy contamination: verbatim memorization of the original paper. The model has memorized the wording of the statements, the example values, the reference answers, and even the original typos. At this point evaluation degrades into memory retrieval: score variance is minimal, runtime is extremely short, and performance drops off a cliff once the problems are rewritten.

    The distinction between the two can be made quite engineering-oriented. One practical signal is a “continuation test”: provide only one problem and observe whether the model spontaneously continues with subsequent problems and answers. Another is a “perturbation test”: rewrite variable names, values, boundary conditions, and narrative order while keeping the semantics unchanged, then compare the score gap. If the same model is near perfect on the original paper but drops sharply on an equivalent perturbed version, the judgment of heavy contamination basically holds.

    1. # Illustration: quantify the gap between "memory" and "capability" using equivalent perturbations
    2. def contamination_gap(model, items, rewrite):
    3. original, perturbed = [], []
    4. for it in items:
    5. original.append(run_one(model, it.prompt))
    6. perturbed.append(run_one(model, rewrite(it).prompt))
    7. return score(original) - score(perturbed) # larger gap means more memory component

    4. How Contamination Rewrites the Rankings

    The controlled experiment in the original is highly persuasive: after removing all the problems that could be recited, a base model’s coding score fell from a perfect result to single digits, and the average ranking of four models went from first to last, while originally lower-ranked models rose to first. Meanwhile, another model could barely recite any problems, showing that high scores are achievable without relying on memorization.

    These results reveal three easily overlooked facts.

    1. Absolute scores are untrustworthy. A perfect score often means complete data coverage, not a ceiling on capability.
    2. Relative rankings are even more untrustworthy. Each model’s training corpus differs, the amount of inflation differs, and the ranking is therefore a function of contamination level, not of capability.
    3. High scores and real capability can be decoupled. There are low-memory, high-capability models and high-memory, low-capability models, and a single leaderboard cannot tell them apart.

    So any cross-model comparison must first answer one question: to what extent is this exam already in the training corpus?

    5. A Practical, Trustworthy Evaluation Plan

    For engineering teams, it is advisable to split evaluation into four lines of defense.

    • Private held-out set: core metrics depend only on problems that are never made public, sampled in a stratified way by capability dimension, rotated regularly, and kept under strict access auditing.
    • Dynamic generation: use parameterized templates to generate problems and answers on the spot at evaluation time, so the “original paper” does not exist along the time dimension.
    • Equivalent perturbations: batch-rewrite wording, values, and boundary conditions while preserving semantics, using the score gap as a memory index.
    • Contamination probes: periodically run continuation and verbatim-reproduction checks, and make the reproduction rate a routine metric on the data governance dashboard.

    Supporting engineering constraints matter just as much: deduplicate and compare against benchmarks before training corpus ingestion, removing or isolating any hits; physically separate the evaluation and training environments; and attach version, date, problem hash, and contamination-check conclusions to every score, avoiding non-reproducible “one-off results.”

    1. Evaluation pipeline (illustration)
    2. Corpus ingestion → dedup / benchmark comparison → isolate hits
    3. ↓
    4. Private held-out set + dynamic generation + equivalent perturbations → metric aggregation
    5. ↓
    6. Report: raw score / score after removing memory / reproduction rate / perturbation gap

    On the platform side, this kind of workflow is usually carried by a few general-purpose capabilities: object storage holds problems and version snapshots, message queues smooth out and schedule batch evaluation tasks, container platforms provide isolated and consistent runtime environments, and logging services with monitoring and alerting handle traceability and anomaly detection. Cloud providers such as Baidu AI Cloud offer exactly these general-purpose capability categories, and the specific implementation can be chosen according to a team’s existing technology stack.

    6. Conclusion: Make “Deducting the Recited Problems” the Default

    The value of public benchmarks lies in comparability, and the premise of comparability is that the problems have not been memorized. When the reproduction rate is above ninety percent, what the score actually measures is corpus coverage. The advice for users is straightforward: before looking at a score, ask three things—is the exam public, has it been perturbed, and how much remains after removing the memory problems. The advice for builders is equally straightforward—write private held-out sets, dynamic generation, and contamination probes into the release process, and make “the score after deducting the recited problems” a default disclosure item. Only then can scores once again become a measure of capability rather than a footnote to memory.