Skip to content

Contamination and Leakage

Exposure is a chain of evidence

Publishing a benchmark makes later exposure possible. It does not establish that a particular model trained on it.

Public item
A question, answer, or solution appears in a repository or webpage.
Collected copy
A crawl or other collection may include it. A dated snapshot is evidence for this step.
Training inclusion
The collected text must survive filtering and actually enter a training stage.
Score effect
Even confirmed exposure does not tell us how much it changed the final benchmark score.

A held-out test is meant to ask how a model handles examples it was not trained to answer. That boundary becomes difficult to maintain when the questions, solutions, and discussions are public and training corpora draw from the web.

The problem is called test-set contamination. It can happen during pretraining, instruction tuning, or another training stage. Repeatedly choosing models and prompts against the same test set can also overfit the evaluation, even without placing those items directly in the training batches.

The evaluation procedure may be reproducible even when test material appeared in training. Establishing that exposure and measuring its effect on a score require different evidence.

Following the material into training

A benchmark might live in a repository, appear in a dataset mirror, and acquire worked solutions in tutorials. A collection pipeline could ingest any of those copies. Filtering might remove some and miss others. Public availability establishes an opportunity for exposure; it does not prove inclusion in a particular model’s training run.

Dates help establish what was possible

Benchmark release
Record the first public availability of the item and its answer, including earlier sources.
Collection snapshot
Record when each relevant document was obtained and which revision it contains.
Model training
Distinguish pretraining, instruction tuning, preference training, and later updates.
Evaluation
Record the model version and whether retrieval or tools could expose the answer during the test.

The relevant unit is not always the entire question. An answer key, distinctive solution, or paraphrase may reveal enough to make an item easier. On the other hand, encountering related subject matter is expected: a chemistry model should learn chemistry. Training on the same topic is not automatically leakage of the particular held-out example.

Synthetic data adds another route. A teacher can reproduce an existing test item or solution. Merely generating new problems of a similar kind does not demonstrate contamination. To make a specific claim, identify the shared content and the path by which it could have entered training.

Exact overlap is evidence with a scope

An n-gram detector looks for contiguous sequences of nn tokens or words shared between an evaluation item and a corpus. Long distinctive matches can be useful leads. Common phrases create false positives; punctuation changes, paraphrases, and translated copies can evade an exact matcher.

Check every contiguous four-word window

Authored text; exact whitespace-separated matching after lowercasing. This is not a tokenizer-level or semantic detector.

Test text: a red boat crossed the quiet lake before dawn

Corpus text: a red boat crossed the quiet lake yesterday

a red boat crossed

Exact match for this window.

4 matching windows in the full test text. Overlapping matches can come from one shared span; absence of a match does not exclude paraphrased exposure.

Move through every four-word window. Multiple overlapping matches may describe one shared span, so a count of matching windows is not a count of leaked questions.

The normalization rule belongs in the report. Lowercasing, Unicode normalization, punctuation removal, and tokenization all change which strings match. A search over only part of the training corpus can only support conclusions about that part.

Here is a deliberately small detector. It reports whether exact normalized word n-grams overlap; it does not label unmatched text “clean.” Inputs shorter than the window receive a separate status.

For a large corpus, building an in-memory Python set like this is expensive. Use an indexed or streaming implementation appropriate to the corpus, preserve document boundaries, and review flagged spans.

Canaries and likelihood tests

A canary is a marker deliberately inserted where its later appearance can be traced. Its value comes from controlled provenance. If a marker is printed in the evaluation prompt, retrieved by a tool, or widely discussed elsewhere, reproducing it does not isolate training exposure.

What a canary can establish

A canary is a deliberately introduced marker whose origin and access history must be recorded.

Before release
Choose a marker unlikely to arise independently. Record where it is inserted, when, and who can access it.
During collection
Search dated corpus snapshots for the marker. A match establishes presence in that snapshot.
When querying a model
Keep the marker out of the prompt and retrieval context. Use controls for chance completion and other exposure routes.
Interpretation
Recovery can support an exposure claim under those controls. It does not identify every leaked test item or quantify score inflation.

Likelihood-based membership inference asks whether a model assigns unusually high probability to a candidate training example. That can provide evidence under a validated method, but easy unseen text can also have high probability, and a training member need not have uniformly high token probabilities. There is no general perplexity cutoff that separates members from nonmembers across models and domains.

A likelihood threshold can make both kinds of error

Four constructed documents with assumed perplexities and known membership labels. These are not empirical detection rates.

  • Document A: perplexity 3; training member; flagged.
  • Document B: perplexity 8; nonmember; flagged.
  • Document C: perplexity 12; training member; not flagged.
  • Document D: perplexity 20; nonmember; not flagged.

True positives 1; false positives 1; false negatives 1; true negatives 1.

Try to include both training members without flagging either nonmember.

Oren et al.’s test uses a more specific signal. Under an exchangeability assumption, an uncontaminated model should not prefer a benchmark’s arbitrary canonical ordering over shuffled orderings. Their procedure compares the likelihood of the canonical sequence of examples with likelihoods after permutation.

This does not require the model weights or training corpus, but it does require likelihood access and the method’s statistical assumptions. It is not a conversational test asking which question appeared first. Natural ordering structure could invalidate exchangeability, and failure to detect the signal does not establish absence of all contamination.

A filtered score is not a causal estimate

Suppose a model answers seven of ten questions correctly. An overlap rule flags two questions, both answered correctly. Removing them leaves five correct out of eight, or 62.5%, down from 70%.

Filtering changes the test population

Constructed ten-question example. The score change alone is not a causal estimate of contamination.

All questions
7 correct out of 10 = 70%.
Flagged questions
2 correct out of 2; both removed by the overlap rule.
Retained questions
5 correct out of 8 = 62.5%.
What can we conclude?
The filtered score fell 7.5 percentage points. The removed items may have been easier; we have not measured how this model would answer them without exposure.

To attribute the 7.5-point difference to contamination, we would need to know how the same model performs on comparable questions without the exposure. The flagged subset might simply be easier, more conventional, or from a different subject. Filtering changes the test population at the same time it changes exposure risk.

Report the rule, how many items it removes, and the scores on both subsets. Inspect item difficulty and subject composition. If possible, use controlled training experiments or independently constructed matched items to investigate score inflation.

Keeping an evaluation useful

Private holdouts reduce public exposure, but access needs to remain controlled and the items need to represent the intended task. Fresh public problems can help when their publication dates are after a model’s relevant training stages. Dates alone are weaker evidence if the model uses retrieval, its training cutoff is unknown, or an earlier copy existed elsewhere.

LiveCodeBench uses continuously collected contest problems and time-based evaluation to address this issue for code. Record the exact release window and model version rather than treating a benchmark name as a permanent guarantee of independence.

Other benchmark revisions solve different problems. SWE-bench Verified is a human-filtered subset intended to improve task quality and evaluability; “Verified” does not mean that every issue is newer than a model’s training data. GPQA is a difficult science benchmark, but its published questions are not a private holdout just because they are hard.

A useful contamination report distinguishes corpus overlap, evidence of model exposure, and demonstrated effects on performance. New independent test items from the intended distribution remain useful; generalization does not require changing the entire task distribution each time a benchmark becomes public.

The next post looks at another boundary in what a score can establish: evaluating reasoning.

Additional reading