The standard evaluation landscape. Extrinsic evaluation of LLMs is organized around a small number of benchmark families, each targeting a different capability with a different scoring mechanism. Multiple-choice knowledge and reasoning benchmarks present a question and a fixed set of answer options, scored by comparing the model’s assigned probability (or generated choice) against a ground-truth label; MMLU (Hendrycks et al., 2021) is the most widely reported example, covering 57 subjects from elementary mathematics to law, with related benchmarks such as HellaSwag, ARC, and Winogrande targeting commonsense inference and coreference resolution in the same format. Math benchmarks such as GSM8K (Cobbe et al., 2021), a set of grade-school word problems, and the harder MATH dataset, score a generated free-form solution by extracting a final numeric or symbolic answer and comparing it against the reference — exact-match on the final answer regardless of how the intermediate reasoning was produced. Coding benchmarks such as HumanEval (Chen et al., 2021) score generated code functionally rather than lexically: a docstring specifies a function, the model generates an implementation, and correctness is determined by executing it against held-out unit tests, with the closely related MBPP benchmark following the same execute-and-check paradigm. Finally, human-preference-based leaderboards such as Chatbot Arena and the accompanying MT-Bench evaluation (Zheng et al., 2023) depart from fixed ground-truth scoring entirely: human raters (or, in the LLM-as-a-judge variant Zheng et al. also study, a strong LLM standing in for one) compare pairs of model responses to open-ended prompts and record a preference, and models are ranked by an aggregate win rate — the same pairwise-preference signal that underlies the reward modeling of Chapter 16 (Alignment: RLHF, Reward Models, and DPO), applied here to evaluation rather than training.
The standard evaluation landscape. Extrinsic evaluation of LLMs is organized around a small number of benchmark families, each targeting a different capability with a different scoring mechanism. Multiple-choice knowledge and reasoning benchmarks present a question and a fixed set of answer options, scored by comparing the model’s assigned probability (or generated choice) against a ground-truth label; MMLU (Hendrycks et al., 2021) is the most widely reported example, covering 57 subjects from elementary mathematics to law, with related benchmarks such as HellaSwag, ARC, and Winogrande targeting commonsense inference and coreference resolution in the same format. Math benchmarks such as GSM8K (Cobbe et al., 2021), a set of grade-school word problems, and the harder MATH dataset, score a generated free-form solution by extracting a final numeric or symbolic answer and comparing it against the reference — exact-match on the final answer regardless of how the intermediate reasoning was produced. Coding benchmarks such as HumanEval (Chen et al., 2021) score generated code functionally rather than lexically: a docstring specifies a function, the model generates an implementation, and correctness is determined by executing it against held-out unit tests, with the closely related MBPP benchmark following the same execute-and-check paradigm. Finally, human-preference-based leaderboards such as Chatbot Arena and the accompanying MT-Bench evaluation (Zheng et al., 2023) depart from fixed ground-truth scoring entirely: human raters (or, in the LLM-as-a-judge variant Zheng et al. also study, a strong LLM standing in for one) compare pairs of model responses to open-ended prompts and record a preference, and models are ranked by an aggregate win rate — the same pairwise-preference signal that underlies the reward modeling of the companion book (Alignment: RLHF, Reward Models, and DPO), applied here to evaluation rather than training.
Contamination, defined precisely. Train-test contamination occurs when examples from a benchmark’s test (or, more subtly, few-shot/validation) split — or near-duplicates of them, differing only in superficial rewording, reformatting, or translation — are present in the corpus a model is pretrained or fine-tuned on. This is a distinct phenomenon from ordinary generalization: a model that has seen a benchmark question, or a close paraphrase of it together with its answer, during training can score well on that question at inference time by (partial or full) memorization rather than by exercising the capability the benchmark was designed to measure. Given the argument of the previous section, this can be framed precisely: contamination is the special case in which the extrinsic evaluation distribution is not merely related to the pretraining distribution by a bounded density ratio, but is literally a subset of the support of — the benchmark’s test examples were, whether by accident of large-scale web crawling or by explicit inclusion, part of the corpus cross-entropy was minimized against. In that case, a model’s low loss (and correspondingly high extrinsic accuracy) on those specific examples reflects the same optimization pressure that produces low perplexity on any other memorized string, not evidence about performance on the broader, non-memorized task distribution the benchmark was built to sample from. This is precisely why contaminated benchmark scores inflate measured performance without correspondingly inflating true, generalizing capability: the benchmark has stopped functioning as a sample from and has become, for the contaminated examples, a sample the model was directly trained to fit.
Sainz, Campos, García-Ferrero, et al. (2023) argue that this problem is worse than commonly acknowledged precisely because it is easy to overlook: web-scale pretraining corpora are curated with data-quality and deduplication pipelines (the companion book, Pretraining: Objectives, Data, and Practice, covers this pipeline, including the MinHash-based deduplication used to remove near-exact duplicate documents) but are not, in general, filtered against every benchmark a model will later be evaluated on, and popular benchmarks are themselves frequently redistributed and discussed across the web — in blog posts, paper repositories, course materials, and forums that are exactly the kind of content large-scale crawls ingest. A benchmark score, absent an explicit contamination audit, is therefore reported and compared across papers with an unknown, unquantified degree of this inflation baked in, which Sainz et al. argue undermines the validity of cross-model comparisons unless contamination is measured for each benchmark individually rather than assumed away.
Detecting contamination in practice. Two complementary techniques are used to search a pretraining corpus for benchmark leakage. The first, -gram overlap search, treats both the benchmark examples and the training corpus as sequences of overlapping -grams (contiguous spans of tokens or words, typically with in the range of 8–13 for this purpose) and flags a benchmark example as contaminated if a sufficiently long exact -gram match to it appears anywhere in the training corpus; this is computationally cheap — it can reuse the same hashing infrastructure used for corpus-level deduplication in the companion book — and reliably catches verbatim or near-verbatim copies, but it misses paraphrased or reformatted duplicates that share no long exact substring with the original. The second technique, embedding similarity search, instead encodes both the benchmark examples and (a sample or index of) the training corpus into a shared embedding space — using, for instance, the model’s own token or sentence embeddings from the companion book (Embeddings and Positional Encoding), or a dedicated sentence-embedding model — and flags a benchmark example as contaminated if its nearest neighbors in the training corpus, measured by cosine similarity, fall above some similarity threshold. Embedding-based search catches semantic near-duplicates that -gram search misses (a benchmark question rephrased in different words, or translated, while preserving its meaning and answer), at the cost of requiring a similarity threshold to be chosen and validated, and of being substantially more expensive to run at the scale of a full pretraining corpus, which is why it is typically applied to a filtered candidate set (for instance, documents an -gram pass already flagged as suspicious, or a random sample of the corpus) rather than the entire corpus directly. Neither technique gives a perfect audit — a sufficiently reworded contamination instance can evade both — but used together, and reported explicitly per benchmark as Sainz et al. recommend, they turn contamination from an unquantified, silently-inflating confound into a measurable and disclosable property of a specific model-and-benchmark pairing.
Continue with the book
Explore the full treatment, worked examples, and exercises in LLMs Derived.
Companion article for LLMs Derived, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
