6.7Evaluation, benchmarks & their pitfalls
How LLMs are tested, from MMLU to SWE-bench to chatbot arenas, why headline scores mislead, and how to build an evaluation you can actually trust.
Why evaluating LLMs is hard
For a classic classifier, evaluation is simple: hold out labeled data and count correct predictions. LLMs make that hard in every direction at once. They do thousands of different tasks. Their outputs are free-form text, so “correct” may need judgment. Their training data is a large slice of the internet, which may include the test questions. And small changes in how you ask can move the score.
Yet decisions ride on these numbers: which model to deploy, whether a fine-tune helped, whether a research idea worked, and which lab “wins” this month. This lesson is about reading benchmark numbers skeptically and producing ones that deserve trust.
Think of benchmarks as standardized exams for models. Everyone recognizes how exams go wrong: a student who saw the leaked answer key aces the test without understanding; a school that “teaches to the test” raises scores but not learning; a test so easy everyone scores 98% tells you nothing; a 10-question quiz makes lucky guessers look brilliant; and an essay grader who prefers long essays rewards padding.
The leaked answer key is contamination. Teaching to the test is Goodhart’s law. The too-easy exam is saturation. The 10-question quiz is sampling error, quantified by a confidence interval. The padding-loving grader is an LLM judge’s verbosity bias. Every one of these has a direct analogue in LLM evaluation.
The main kinds of evals
Multiple-choice knowledge and reasoning. MMLU (Hendrycks et al., 2020) asks four-option questions across 57 subjects, from law to virology. GPQA (2023) contains graduate-level science questions written to be “Google-proof”: in the paper, PhD-level experts in the field reached about 65% accuracy, while skilled non-experts with web access reached about 34%. Multiple choice is cheap to grade, but a model can sometimes exploit answer-option patterns, and it doesn’t test open-ended generation.
Math. GSM8K (grade-school word problems) and MATH (competition problems) were long the standards; frontier models now score so high on them that attention has moved to contest problems such as AIME, the American Invitational Mathematics Examination, where each answer is an integer from 0 to 999 and each exam has only 15 problems. That small size matters, as you’ll see in the demo.
Code. HumanEval (Chen et al., 2021) has 164 hand-written Python functions to implement, each checked by unit tests. SWE-bench (Jimenez et al., 2023) moved to realistic software engineering: given a real GitHub issue and the repository, produce a patch that makes the project’s hidden tests pass. SWE-bench Verified is a 500-task subset whose tasks were screened by human engineers to remove ones that were ambiguous or impossible to grade fairly.
Agentic tasks. Benchmarks increasingly test whole agent loops (see tool use & agents): operating a terminal, browsing websites, using a computer’s GUI, or serving a simulated customer with tools. Scores depend on the scaffold (tools, prompts, step limits) as much as on the model, so they compare systems, not just models.
Human preference. Chatbot Arena (now LMArena) shows people two anonymous models’ answers to the same prompt and asks which is better, then fits a rating from millions of such votes (a Bradley–Terry model, the statistics behind Elo ratings). It captures what users like, including style: length and formatting sway votes, which is why the arena later introduced style-controlled rankings.
Metrics
- Accuracy: fraction correct, after extracting the answer from the model’s text. The extraction rule (a regex? the last number? the letter in parentheses?) is itself a source of disagreement between harnesses.
- pass@kpass@kThe probability that at least one of k sampled answers is correct. It measures what a model can reach with a perfect verifier, not what it answers by default.: for code, the probability that at least one of sampled programs passes the tests. pass@1 measures what you get on a single try; pass@10 measures whether the model can solve the problem at all.
- Win rate / rating: for pairwise comparisons, the fraction of matchups won, or a fitted rating.
- Rubric scores: for open-ended tasks, a grader (human or model) scores against explicit criteria.
Bars are 95% Wilson intervals. True accuracies are 74%, 71%, 66% and 55%. At 100 questions, re-run a few times and watch A and B swap places; the 3-point gap needs a few thousand questions to resolve reliably.
All scores are simulated from made-up “true” accuracies; no real models are shown.
Things to try:
- Too few questions, n = 100. Models A and B (true accuracies 74% and 71%) have overlapping error bars. Re-run a few times: B sometimes beats A. Slide to 5,000 and the gap becomes detectable. Now remember AIME has 15 questions per exam.
- Contamination. Model D is genuinely the weakest. Leak 30% of the test set into its training and it overtakes C on the public leaderboard, while its score on fresh questions doesn’t move.
- Judge bias at 50/50. Two equally good models, a judge with a +20-point first-position bias: whichever model is shown first “wins” roughly two times out of three. Swap-and-average lands back near 50%, and a large share of verdicts flip when the order is swapped.
LLM-as-a-judge and its biases
Human grading is slow and expensive, so open-ended outputs are increasingly graded by another model: LLM-as-a-judgeLLM-as-a-judgeUsing a language model to grade or compare other models' outputs, which scales cheaply but brings biases such as favoring the first or the longer answer.. Zheng et al. (2023) found that a strong judge (GPT-4 at the time) agreed with human preferences about as often as humans agreed with each other, over 80%, which made the approach respectable. They also catalogued its biases:
- Position bias: preferring the answer in a particular slot, often the first.
- Verbosity bias: preferring longer answers, even when the extra length adds nothing.
- Self-enhancement bias: preferring answers written by itself or its own model family.
Standard mitigations: judge each pair in both orders and count disagreements as ties; give the judge a rubric and, where possible, a reference answer; ask for reasoning before the verdict; control or normalize for length; use a judge from a different model family than the models being compared; and periodically check the judge against human labels on a sample.
Contamination, saturation and sensitivity
ContaminationData contaminationWhen benchmark questions leak into training data, which inflates scores.. Pretraining corpora are scraped from the web, and benchmark questions (with answers) are on the web: in papers, GitHub repos, forums and blog posts. A model that has seen a question can recall the answer rather than reason its way there. Defenses include n-gram overlap checks between training data and test sets, “canary strings” embedded in benchmark files so their presence in a corpus can be detected, and, most convincingly, fresh questions of the same difficulty. When Zhang et al. (2024) wrote GSM1k, a new set of grade-school problems mirroring GSM8K, some models scored markedly lower on it than on the original, a sign of overfitting to the public set. “Live” benchmarks that keep adding problems published after models’ training cutoffs follow the same logic.
Saturation. When top models all score in the high 80s or 90s, the remaining gap is often dominated by noise and by mislabeled questions. Audits have found that a few percent of MMLU’s questions contain errors, which caps the meaningful score below 100%. A saturated benchmark can’t separate strong models; the field then moves on to harder ones, as it did from GSM8K to AIME and from HumanEval to SWE-bench.
Prompt and format sensitivity. The same model can score several points differently depending on the number of few-shot examples, whether chain-of-thought is allowed, the exact prompt template and the answer-extraction rule (see prompting). Two papers reporting “MMLU 5-shot” may not have run the same test. Compare numbers only when the setup is the same, ideally from the same harness.
Goodhart’s law
“When a measure becomes a target, it ceases to be a good measure.” Goodhart’s lawGoodhart's lawWhen a measure becomes a target, it ceases to be a good measure: optimizing hard for a benchmark tends to inflate the score more than the underlying skill. is the umbrella over all of the above. Once a benchmark drives funding, press and leaderboards, everyone optimizes for it: training on similar data, tuning prompts to it, selecting checkpoints by it, even training directly against a judge’s preferences. Each step can raise the score faster than the underlying ability. The practical upshot: weigh results from many benchmarks, prefer held-out and fresh evaluations, and treat any single headline number as one noisy signal.
Building your own eval
Public benchmarks tell you about models in general; you need to know about your task. A small custom eval beats any leaderboard for that.
- Collect real inputs. Start from actual user requests or the task as it will really appear, including messy and adversarial ones. 50–200 examples is a useful start.
- Define what good means. For each example, write a reference answer, or a rubric with the specific properties a good answer must have.
- Automate grading where you can. Exact match or regex for closed answers, unit tests for code, schema validation for structured output, and an LLM judge with a rubric for the rest. Spot-check the judge against your own labels.
- Track it over time. Run the eval on every prompt change, model upgrade or fine-tune. A regression on 3 of 150 examples is a lead to investigate, not noise to ignore.
- Read the failures. The numbers tell you whether something changed; reading the transcripts tells you why.
- Keep a hold-out. If you tune prompts against your eval set for weeks, you will overfit to it too. Keep some examples you look at rarely.
MATH CORNER · optionalConfidence intervals and pass@k, by hand
Sampling error of accuracy. If a model’s true accuracy is and we test it on independent questions, the observed accuracy has standard error
| questions | observed | SE | 95% CI (normal approx.) |
|---|---|---|---|
| 15 | 0.733 (11/15) | 0.114 | ±22.4 pts |
| 100 | 0.72 | 0.0449 | ±8.8 pts |
| 1,000 | 0.72 | 0.0142 | ±2.8 pts |
| 10,000 | 0.72 | 0.0045 | ±0.9 pts |
Each 10× more questions only shrinks the interval by . For small or near 0 or 1, the Wilson interval used in the demo behaves better: for 72/100 it gives instead of , slightly shifted toward 0.5.
Comparing two models on the same questions with independent errors: . For 74% vs 71% at : , so the 95% interval of the 3-point difference is about points. It includes zero: not yet distinguishable. A paired analysis, using the fact that both models answered the same questions, is typically tighter.
pass@k. Generate samples per problem and count that pass. The unbiased estimate (Chen et al., 2021) is
With samples and correct: pass@1 , and pass@5 . The same model looks very different depending on , so always say which you report.
In code
The unbiased pass@k estimator and a Wilson interval, the two formulas you’ll reach for most.
import numpy as np
from math import sqrt
def pass_at_k(n: int, c: int, k: int) -> float:
"""Unbiased pass@k from n samples with c correct (Chen et al., 2021)."""
if n - c < k:
return 1.0
return 1.0 - np.prod(1.0 - k / np.arange(n - c + 1, n + 1)) # stable form of 1 - C(n-c,k)/C(n,k)
def wilson(correct: int, n: int, z: float = 1.96):
p = correct / n
den = 1 + z**2 / n
center = (p + z**2 / (2 * n)) / den
half = z * sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / den
return center - half, center + half
print(pass_at_k(10, 3, 1), pass_at_k(10, 3, 5)) # 0.3, 0.9167
print(wilson(72, 100)) # (0.625, 0.799)
- “Model A scored 1 point higher, so it’s better.” On a few hundred questions, a 1-point gap is usually well inside the noise. Without a confidence interval, the comparison means little.
- “A high benchmark score means the model will do well on my task.” Benchmarks measure narrow slices under specific setups, and some are contaminated or saturated. Your own eval on your own inputs is the only direct evidence.
- “An LLM judge is an objective grader.” Judges show position, verbosity and self-preference biases. Swap orders, use rubrics and references, and validate against human labels.
- “Contamination is just cheating.” It is usually accidental: test questions are scattered across the web that models train on. That’s why fresh, held-out evaluations matter.
- “More benchmarks are always better.” Many correlated, saturated benchmarks add little. A few well-chosen, unsaturated, uncontaminated ones, with uncertainty reported, are worth more.
Check your understanding
Q1.Model A scores 74% and Model B 71% on a 100-question benchmark. What is the most defensible conclusion?
Q2.A model scores far higher on a public math benchmark than on a freshly written set of problems of the same difficulty. The most likely explanation is…
Q3.An LLM judge prefers whichever answer is shown first. What is the standard fix?
Q4.A code model has n = 10 samples per problem and c = 3 pass the tests. What is pass@1?
Q5.Which statement best captures Goodhart's law for benchmarks?
Further reading
- paperJudging LLM-as-a-Judge with MT-Bench and Chatbot Arena — Zheng et al.: judge agreement with humans, and position, verbosity and self-enhancement biases.
- paperAdding Error Bars to Evals: A Statistical Approach to Language Model Evaluations — Miller (Anthropic): confidence intervals, paired tests and clustered errors for evals.
- paperSWE-bench: Can Language Models Resolve Real-World GitHub Issues? — The real-repository coding benchmark behind SWE-bench Verified.
- paperEvaluating Large Language Models Trained on Code — Chen et al.: HumanEval and the unbiased pass@k estimator.
- paperGPQA: A Graduate-Level Google-Proof Q&A Benchmark — Expert-written science questions and how experts and non-experts score.
- paperA Careful Examination of Large Language Model Performance on Grade School Arithmetic — GSM1k: fresh problems that expose overfitting to GSM8K.