Public LLM benchmarks are partly memorized, unevenly across model families. Here is how test items leak into training data, what GSM1k and LiveCodeBench found, and which detection method works with the access you actually have.
A benchmark score only means something if the model has never seen the test, and for public LLM benchmarks that assumption is now usually false to some degree. Benchmark contamination (test items, their answers, or close paraphrases leaking into training data) does not show up as an error anywhere; it shows up as a number that is a few points too high, and the fix is not a better leaderboard but a better habit: treat any public static benchmark as partly memorized until shown otherwise, and measure on data the model could not have trained on.
This post covers how leakage actually happens, what the research on it found, how each detection method works and what access it needs, and how to build an internal eval set that stays clean.
A benchmark is a sample from a distribution of problems. The score is supposed to estimate how the model does on the whole distribution, including problems it has never seen. Once some of the test items are in the training data, the score becomes a blend of two things: generalization on the unseen items and recall on the seen ones. Recall is cheap for a large model, so the blend drifts upward.
The damage is rarely "the model memorized the whole test." It is usually partial and uneven:
None of this requires bad intent. Web-scale pretraining corpora are too large to inspect by hand, and a benchmark that is popular enough to matter is, by definition, discussed all over the web.
The clearest controlled experiment is GSM1k from Scale AI, described in A Careful Examination of Large Language Model Performance on Grade School Arithmetic. The authors commissioned a new set of grade-school math problems matched to GSM8K on difficulty, solution length, and human solve rate, then compared each model's score on both. The headline results are worth stating precisely because they cut both ways:
So the honest summary is not "benchmarks are fake." It is that contamination is real, uneven across model families, and large enough to reorder a leaderboard where the top entries sit within a few points of each other.
Coding benchmarks show the same pattern along a time axis. LiveCodeBench collects contest problems from LeetCode, AtCoder, and Codeforces with their release dates, so you can score a model only on problems published after its training cutoff. The authors report models whose accuracy falls noticeably on problems released after their cutoff, which is exactly the signature you would expect if the earlier problems were in training.
This is also why a score on an older public coding benchmark deserves extra suspicion: the issues and their fixes live in public repositories that are prime crawl material. The breakdown of what SWE-bench actually measures covers that benchmark's own construction caveats in more depth.
There is no single test for contamination. Each method answers a slightly different question and needs a different level of access.
| Method | Question it answers | Access needed | Main blind spot |
|---|---|---|---|
| n-gram overlap | Does test text appear in the training corpus? | The corpus | Paraphrases, translations, synthetic rewrites |
| Canary strings | Did this specific file get trained on? | Model sampling | Only works if the file carried a canary and nobody stripped it |
| Min-K% Prob | Does the model find this text unusually familiar? | Token log-probs | Needs a calibrated threshold; noisy on short items |
| Ordering test | Does the model prefer the dataset's canonical order? | Token log-probs | Only detects verbatim, in-order memorization |
| Fresh matched set | Does performance hold on new items of equal difficulty? | Black box | Expensive to build; difficulty matching is hard |
| Time-split eval | Does performance drop after the training cutoff? | Black box | Needs dated items; new items can be harder or easier |
If you own the training data, the cheapest check is direct: normalize each test item and each training document, break them into n-grams, and flag test items that share long n-grams with the corpus. The GPT-3 paper (Language Models are Few-Shot Learners) used 13-gram overlap for this, and it also documented the uncomfortable part: a bug meant some detected overlap was not removed before training, so the authors reported results on "clean" subsets alongside the full benchmarks.
A minimal version looks like this:
import hashlib
import re
def ngrams(text: str, n: int = 13) -> set[str]:
tokens = re.findall(r"[a-z0-9]+", text.lower())
grams = (" ".join(tokens[i:i + n]) for i in range(len(tokens) - n + 1))
# Hash so the corpus index stays small and comparable across shards
return {hashlib.sha1(g.encode()).hexdigest()[:16] for g in grams}
def build_index(corpus_docs) -> set[str]:
index: set[str] = set()
for doc in corpus_docs:
index |= ngrams(doc)
return index
def contamination_rate(test_items, index) -> float:
flagged = 0
for item in test_items:
grams = ngrams(item)
if grams and len(grams & index) / len(grams) > 0.1:
flagged += 1
return flagged / len(test_items)
The weaknesses are structural. Normalization choices change the answer. A paraphrased item shares no 13-grams with its source. And if you are evaluating someone else's model, you do not have their corpus at all.
BIG-bench ships a unique GUID canary string in its task files and asks that documents containing it be excluded from training. A model that can complete the canary when prompted with its prefix has very likely trained on files that carried it. It is a useful tripwire, but it only works for datasets that embed a canary, and it fails silently the moment someone copies the questions without the header.
Detecting Pretraining Data from Large Language Models proposed Min-K% Prob: score a passage by averaging the log-probabilities of its k% least likely tokens. Text the model has never seen usually contains a few surprising tokens with very low probability; text it trained on tends not to, because even the odd words were already learned. Focusing on the hardest tokens, instead of the average over all tokens, separates "memorized" from "merely fluent and predictable."
It needs token log-probabilities, which rules out many closed APIs, and it needs a threshold calibrated on text you know is in or out of training.
Proving Test Set Contamination in Black Box Language Models uses a neat property: in most benchmarks the order of examples is arbitrary, so an uncontaminated model should assign roughly the same likelihood to the canonical order as to any shuffle. If the model consistently prefers the published order, it has seen the file in that order. Because the null hypothesis is exact (exchangeability), the test gives a real false-positive bound rather than a heuristic score. Its limit is the flip side of that rigor: it only catches verbatim, ordered memorization, not paraphrases or synthetic rewrites.
When all you have is an API, the practical answer is to change the data rather than inspect the model. Build a matched set (the GSM1k approach) or split by date (the LiveCodeBench approach) and compare. A meaningful gap is your contamination estimate. Benchmarks designed for this from the start keep part of the set away from the public: ARC-AGI, for example, separates a public evaluation set from semi-private and private ones that are not released.
Most teams do not need to audit a frontier lab's corpus. They need an eval for their own product that still means something in six months. The same principles apply, scaled down:
Plug that set into the same pipeline you use for regression-testing prompts in CI, and contamination checks become routine instead of a one-off audit. If your eval uses an LLM grader, the contamination question extends to the grader too, alongside the biases that LLM-as-judge setups already carry.
A few habits make public numbers more useful:
Contamination is not a scandal to uncover once; it is a constant background bias on every public static benchmark. You cannot remove it from someone else's model, but you can stop being fooled by it: favor fresh, dated, or held-out evaluations, read gaps between old and new sets as the real signal, and keep your own gold set as private as your API keys. A score on data the model could not have seen is the only score that predicts what happens in production.
Free, in your browser, no sign-up.
One email when a new post goes up. No other mail; unsubscribe in one click.
We store your email only to send new posts. See the privacy policy.