Benchmarking and Evaluation

Ask “Are you enjoying the CS224N lectures?” and grade four replies against the reference “Heck yes !”. Word-overlap BLEU gives “Heck no !” 0.67, its top score, and “Yup .” 0. The grader decides what a score means.

Switch the grader and watch the four scores move. Then we build each grader from zero. We also build the benchmarks they grade: why tests wear out, how models cheat them, and how people and models judge open answers.

You need a little Python and what a probability is. We build the rest from zero.

Lecture 11, "Benchmarking and Evaluation", of Stanford CS224N, Natural Language Processing with Deep Learning (Winter 2026, Diyi Yang and Yejin Choi; this lecture’s slides are Yejin Choi’s). Its readings are Ruder’s "Challenges and Opportunities in NLP Benchmarking", MMLU (Hendrycks et al.), HELM (Liang et al.) and AlpacaEval. The hero’s example is from the lecture’s slides. Before: Lecture 10, Agents, Tool Use, and RAG. Next: Lecture 12, Reasoning 1.

Grade one reply four ways

The question, the reference and the four replies are the lecture’s. The page computes exact match and BLEU (unigram, with the brevity penalty) live; BLEU gives the slide’s 0.61, 0.25, 0 and 0.67. The embedding scores use invented word vectors (Chapter 4), and the judge’s scores are illustrative.

Chapter 0

The Test Stops Telling Models Apart

Watch a fixed test fill up as models improve, and see why new benchmarks keep arriving

A benchmark is a fixed set of questions, an answer key and a scoring rule. It turns “is this model good?” into one number anyone can reproduce, and leaderboards on it drive progress.

They also wear out fast. GLUE (2018) bundled nine sentence tasks, and people scored 87.1 on it. BERT reached 80.5, up from 72.8. A year later the SuperGLUE authors wrote that GLUE performance “has recently surpassed the level of non-expert humans” and released a harder test. Its human baseline, 89.8, fell to a single model (DeBERTa, 89.9) in December 2020.

MMLU asks four-option questions in 57 subjects. GPT-3 scored 43.9% in 2020, Chinchilla 67.6% in 2022 and GPT-4 86.4% in 2023, close to the authors’ estimate of expert accuracy, about 89.8%. GPQA (2023) aimed to be “Google-proof”: PhD experts reached 65%, skilled non-experts with the web 34%, GPT-4 39%. In 2024 OpenAI reported 78% for o1 on its hardest subset. Humanity’s Last Exam (2025) started with every frontier model under 10%. Shelf lives shrink; people are no longer the ceiling.

Why does a test fill up? Give a model a skill θ and each question a difficulty b. The chance of a right answer depends on θ − b.

Push two models up one test

Model B is always 0.5 skill points ahead of model A. Pick a test, then drag A’s skill up and watch the pink gap.

0.00

Illustrative. Each test has 200 four-option questions with difficulties spread around its mean (standard deviation 1); the human expert has skill 2.2. The curves are the formula below, averaged over the 200 questions.

Say it aloud

P of correct equals g, plus one minus g, times sigma of theta minus b.

P(correct)
P of correct the chance the model answers this question right.
g
g the guessing floor: 0.25 for four options.
σ
sigma the logistic curve 1 / (1 + e−z): it turns any number into a value between 0 and 1.
θ
theta the model’s skill, on the same scale as difficulty.
b
b the question’s difficulty.
In plain words

Subtract the difficulty b from the skill θ. Pass the gap through σ, and stretch the result from the floor g up to 1. Average over all questions to get the expected score.

With numbers

With made-up numbers: θ − b = 2 gives σ(2) = 0.881, so P = 0.25 + 0.75 × 0.881 = 0.911. On the easy test, A at skill 0 and B at 0.5 score 88.3% and 92.1%: a gap of 3.8 points. At skill 3 and 3.5 they score 99.2% and 99.5%: the same skill gap now shows as 0.3 points.

When θ is far above most b, every question sits on the flat top of the curve, and the gap drowns in noise. That is saturation.

Symptom: the top models sit within a point of each other, near the ceiling.

Measure: the gap against its error bar (the statistics of evaluation): 0.3 points here, smaller than a 500-question test can see.

Fix: a harder or fresher test, built to the checklist of Chapter 9.

The road

  1. Shortcuts: models pass tests for the wrong reasons.
  2. Short answers: exact match and token F1.
  3. BLEU: grade by shared words; the hero’s default grader.
  4. Meaning: grade by word vectors; the hero’s embedding grader.
  5. Diversity: how many different texts a set holds.
  6. People: when raters agree beyond chance; Chatbot Arena.
  7. Judges: an LLM as judge, its biases, and a jury; the hero’s judge.
  8. Leaks: contamination and Goodhart’s law.
  9. Showcase: design a benchmark that works.
  10. Field guide: the metrics, the numbers and the code.
Two models differ by the same skill on an easy test and on a hard test. Why does the easy test show a smaller score gap?

Chapter 1

Right for the Wrong Reasons

Fool a reader that matches words with one added sentence, and see why every benchmark leaks cues

The lecture lists what a good benchmark needs. Scale and diversity: enough varied examples to cover the skill. Difficulty: easy for people, hard for the best model. Quality: the right answer is clearly right, and there is no spurious bias, a surface cue that predicts the answer without the skill. Spurious biases are also called annotation artifacts.

SQuAD (2016) shows how cues get in. Crowdworkers read a Wikipedia paragraph and wrote questions about it. They looked at the paragraph while they wrote, so they reused its words. A model can then win by finding the sentence that shares the most words with the question.

Jia and Liang (2017) tested this. They added one sentence that shares many question words but answers nothing. Across sixteen published models, average F1 fell from 75% to 36%. Here is their example.

Fool a word-matching reader

Blue words also appear in the question; dotted ones are near misses. The reader answers from the sentence with the highest overlap. Add the distractor.

The paragraph, question and distractor are Figure 1 of Jia and Liang (2017), where the BiDAF Ensemble model answered John Elway, then Jeff Dean. The reader is a toy that counts shared words. A near miss (37 for 38, XXXIV for XXXIII, Champ for Super) counts 0.8, the way word vectors blur them.

With numbers: the question’s content words are name, quarterback, 38, Super, Bowl and XXXIII. Elway’s sentence shares four of them: overlap 4.0. The distractor shares two exactly and has three near misses: 2 + 3 × 0.8 = 4.4. The fake sentence wins.

The same thing happens elsewhere. On natural language inference, HANS (McCoy et al., 2019) built pairs where “the words overlap, so it follows” is wrong. BERT scored 84% on the MNLI test but 16% on these pairs, where chance is 50%. In SQuAD 2.0, people often made a question unanswerable by inserting “not”, so models learned that “not” means unanswerable.

The answer is to put a model in the loop. In adversarial collection, people write examples that fool the current model. ANLI did three such rounds: RoBERTa scored 91.0 on MNLI but 53.7 on ANLI. Dynamic benchmarks such as Dynabench keep collecting: annotators write examples the model gets wrong but a person gets right.

Symptom: a high in-distribution score that collapses on slightly changed inputs.

Measure: accuracy on a diagnostic or adversarial set: 75% to 36% F1 on SQuAD with one added sentence.

Fix: collect with a model in the loop (adversarial and dynamic benchmarks), and test each cue on its own.

Why did one added sentence fool so many SQuAD models?

Chapter 2

Short Answers: Exact Match and Token F1

Grade a short answer two ways, and give partial credit word by word

How hard grading is depends on the kind of answer. The lecture sorts benchmarks into four kinds:

AnswerGradingExamples
Multiple choiceaccuracy: the easiestGLUE, MMLU, TruthfulQA, GPQA Diamond
A short answerexact or near-exact match of a span, a number or an expressionSQuAD, AIME 2025, FrontierMath
A sentenceopen: overlap metrics, model metrics, peopletranslation, summarization, captioning
A long answeropen: people or LLM judgesIFEval, LongGenBench, WriteBench

Take a short answer from SQuAD’s first article. Question: “Which NFL team represented the AFC at Super Bowl 50?” Gold answer: “Denver Broncos”. Before comparing, SQuAD’s script normalizes both strings: lowercase, drop punctuation and the words a, an and the. Exact match is then 1 if the strings are equal and 0 if not.

Grade a short answer

Yellow chips are the gold answer; warm chips are the model’s, lit where they match. Pick an answer or type your own.

The question and gold answer are from SQuAD’s Super Bowl 50 article. The normalization and the F1 follow the official SQuAD script, computed live.

Exact match gives “the Broncos” nothing. Partial credit needs two counts. Precision P is the share of predicted words found in the gold answer. Recall R is the share of gold words found in the prediction. Token F1 combines them:

Say it aloud

F-one equals two times P times R, over P plus R.

F1
F-one the token F1: partial credit from 0 to 1.
P
P precision: shared words divided by the number of predicted words.
R
R recall: shared words divided by the number of gold words.
In plain words

Normalize both answers and count the shared words. Divide by the predicted length to get P and by the gold length to get R. F1 is their harmonic mean: it is high only if both P and R are high.

With numbers

From the device: “the Broncos” normalizes to one word, broncos, which is in the gold. P = 1/1 = 1 and R = 1/2 = 0.5, so F1 = 2 × 1 × 0.5 / 1.5 = 0.67. “Broncos of Denver” shares 2 of its 3 words: P = 0.67, R = 1, F1 = 0.80.

The harmonic mean punishes the lopsided case. A one-word answer has perfect precision but loses recall; a padded answer keeps recall but loses precision.

Symptom: two papers report different scores for the same model on the same test.

Measure: the answer-extraction script. The lecture warns that the exact script, and even one missing space in the prompt, can change scores sharply.

Fix: publish the normalizer and the parser with the score. For multiple choice graded by probabilities, see CS336’s evaluation lesson.

The gold answer is “Denver Broncos”. Why does “Denver” get F1 0.67 but exact match 0?

Chapter 3

BLEU: Count the Shared Words

Work BLEU by hand on the hero’s replies, and see why it calls “Heck no !” a good answer

A sentence answer has many right forms, so exact match is useless. The classic fix is a model-free metric: count what the candidate shares with a human-written reference. BLEU (Papineni et al., 2002) does this for machine translation.

BLEU looks at n-grams, runs of n words. For each n it computes a clipped precision pn: the share of the candidate’s n-grams found in the reference. Each n-gram counts at most as often as the reference has it. Clipping stops “yes yes yes” from scoring three hits for one “yes”.

Work BLEU by hand

Teal chips match the reference; a dashed chip is a repeat that clipping refuses. Pick a reply or type one, then raise n.

1

Sentence-level BLEU against one reference, lowercased, no smoothing, computed live. Standard BLEU uses N = 4 over a whole test corpus; on a three-word reply BLEU-4 is 0 without smoothing.

Precision alone rewards short answers: one shared word gives p1 = 1. So BLEU multiplies by a brevity penalty BP that shrinks the score when the candidate is shorter than the reference.

Say it aloud

BLEU equals B-P times e to the power of the sum over n from one to N of w-n times log p-n.

BLEU
BLEU the score, from 0 to 1.
BP
B-P the brevity penalty: 1 if the candidate length c is longer than the reference length r, else e1 − r/c.
Σn=1N
the sum over n from one to N one term for each n-gram length, up to N (4 in standard BLEU).
wn
w-n the weight of length n: 1/N each, so the exp of the sum is a geometric mean.
pn
p-n the clipped precision of n-grams of length n.
In plain words

For each n, count the candidate’s n-grams found in the reference, clipped, and divide by all its n-grams: that is pn. Take the geometric mean of the pn. Multiply by BP if the candidate is short.

With numbers

The lecture’s numbers are BLEU with N = 1. “Heck no !”: 2 of 3 words match, p1 = 0.67, c = r = 3, so BP = 1 and BLEU = 0.67. “Yes !”: p1 = 2/2 = 1, but c = 2 is short: BP = e1 − 3/2 = 0.61. “Yup .” shares nothing: 0.

Raise N to 2 and “Heck no !” drops to 0, since neither of its bigrams is in the reference. That helps here by luck. The deeper problem stays: n-grams have no idea of meaning. ROUGE (Lin, 2004) counts recall instead, for summaries. METEOR adds stems and synonyms. All three reward copying the reference’s surface.

Symptom: a correct paraphrase scores 0 while a reply with the opposite meaning scores high.

Measure: how well the metric’s ranking agrees with people’s: here it puts the one wrong reply first.

Fix: several references, or a metric that compares meanings (Chapter 4).

Why does “Yes !” score 0.61 and not 1, though both its words are in the reference?

Chapter 4

Model-Based Metrics: Match by Meaning

Match each word to its nearest word by vector, and find what the vectors cannot see

“Yup” and “yes” share no letters but mean the same. A model-based metric compares words by their vectors instead of their spelling. BERTScore (Zhang et al., 2020) gives each token a vector from BERT. Then it matches each reference token to the candidate token with the highest cosine, the similarity of two directions (1 means the same direction).

Match words by vector

Each line joins a yellow reference token to its closest warm candidate token, labelled with the cosine. Pick a pair.

Illustrative: we invented 8-number word vectors so that yes, yup and no sit close, as words used in the same places do. Real BERTScore uses BERT’s contextual vectors, optional idf weights and rescaling. The 1942 and 1924 example is from the lecture’s slides.

Call the reference tokens x1 to xm and the candidate tokens y1 to yk. The recall asks how well the candidate covers each reference word:

Say it aloud

R equals one over m, times the sum over i, of the max over j, of cos of x-i and y-j.

R
R the recall: how well the candidate covers the reference, from about 0 to 1.
1/m
one over m divide by m, the number of reference tokens, to get an average.
Σi
the sum over i one term for each reference token xi.
maxj
the max over j keep the best candidate token yj for this reference token: a greedy match.
cos(xi, yj)
cos of x-i and y-j the cosine of the two token vectors.
In plain words

For each reference token xi, find the candidate token yj with the highest cosine and keep that cosine. Average over the m reference tokens. Precision does the same from the candidate’s side, and F1 combines the two as in Chapter 2.

With numbers

With the toy vectors, for “Yup .”: heck matches yup at 0.39, yes matches yup at 0.99, ! matches . at 0.96. R = (0.39 + 0.99 + 0.96) / 3 = 0.78. Precision is 0.97, so F1 = 0.865. BLEU gave this reply 0.

Now pick “Heck no !”. Two tokens match exactly and “no” matches “yes” at 0.66, so F1 = 0.887: higher than “Yup .”. Vectors put words close when they appear in the same places, and yes and no do. The lecture’s other example: “born in 1942” against “born in 1924” scores near perfect.

The lecture lists more concerns. The metric inherits the model’s biases and is not calibrated across domains. It costs compute, and longer texts get more chances to match. BLEURT (Sellam et al., 2020) trains a model to mimic human ratings instead. Reference-free metrics drop the reference: FActScore splits a text into atomic claims and checks each against Wikipedia; SelfCheckGPT checks whether facts stay the same across several samples.

Symptom: a hallucinated date or a flipped answer still scores above 0.9.

Measure: score pairs that differ only in a key fact: 0.996 for 1942 against 1924 in the toy.

Fix: check facts directly (FActScore), or grade with people or a judge for the parts that matter.

Why can an embedding metric score “Heck no !” above “Yup .” against “Heck yes !”?

Chapter 5

Diversity: How Many Different Texts?

Turn a similarity matrix into an effective count of distinct texts with the Vendi score

Does a benchmark cover many kinds of question? Does a model write varied stories, or one story a hundred times? The lecture asks whether entropy, the average surprise of a random variable, can measure this.

In theory, yes. In practice, it depends what you take entropy over. Compare two corpora from the slides:

Corpus 1: “My horse ate my homework” · “Quantum entanglement enables teleportation”
Corpus 2: “201 lampshades debated the viscosity of tugboats” · “202 lampshades debated the viscosity of tugboats”

Both strings in corpus 2 are rare, so their raw surprise is high. Yet they say the same thing. Classic counts help a little. Distinct-n (Li et al., 2016) is the share of n-grams that are unique. Self-BLEU (Zhu et al., 2018) scores each text with BLEU against the others.

Count the distinct texts

Each cell is the word-overlap cosine of two sentences; darker blue is more alike. Pick sentences, or load a corpus.

Corpora 1 and 2 are from the lecture’s slides; sentences 5 and 6 are ours. Similarity here is the cosine of word counts, so the eigenvalues and the score are exact for this similarity. Papers use embeddings instead.

The Vendi score (Friedman and Dieng, 2023) counts how many different items a set holds. Put the n texts in a similarity matrix K, with 1 on the diagonal. Divide K by n and take its eigenvalues λ1 to λn: they are positive and add up to 1, like a probability distribution over directions of variety.

Say it aloud

V-S equals e to the power of minus the sum over i of lambda-i times log lambda-i.

VS
V-S the Vendi score: the effective number of distinct items, from 1 to n.
exp
e to the power of turns an entropy back into a count.
−Σi
minus the sum over i one term per eigenvalue; with the minus sign, this is the Shannon entropy.
λi
lambda-i the i-th eigenvalue of K/n.
In plain words

Build K from pairwise similarities and divide by n. Take its eigenvalues λi. Compute their entropy, then raise e to it. If the n texts share nothing, every λi is 1/n and VS = n. If all are copies, one λi is 1 and VS = 1.

With numbers

Corpus 2: the two sentences share 6 of 7 words, cosine 0.857. The eigenvalues of K/2 are (1 + 0.857)/2 = 0.929 and (1 − 0.857)/2 = 0.071. Entropy = 0.069 + 0.188 = 0.257, so VS = e0.257 = 1.29. Corpus 1 shares no words: VS = 2.00.

Load all six and the score is 3.62: the three lampshade lines count as about one and a half. The lecture shows a variant, G-Vendi (Jung et al., 2025), which runs the score on gradient vectors and predicts out-of-distribution performance better than other diversity measures. MAUVE (Pillutla et al., 2021) compares a model’s texts with people’s by clustering their embeddings.

Symptom: a “diverse” set of generated data where every item says the same thing in new words.

Measure: the Vendi score under a similarity that sees meaning: 1.29 for two lampshade lines.

Fix: choose the similarity on purpose; word overlap misses paraphrases, embeddings miss facts.

Three texts are exact copies. What is their Vendi score, and why?

Chapter 6

People as Judges: Agreement Beyond Chance

Measure whether two raters agree more than chance would, and see what crowds in an arena add

We test every automatic metric one way: does it agree with people? Human evaluation is the reference. But the lecture lists its flaws: it is costly and slow, it is subjective, and studies are hard to reproduce. People fall for plausible, fluent and long answers too. You cannot compare scores from two studies run differently, even if both claim to measure the same thing.

Doing it right means clear rubrics (correctness, fluency, originality), worked examples, a calibration discussion, and a number for how much raters agree. Raw agreement flatters. If 90% of replies are good and both raters say “good” to almost everything, they agree often by chance.

Correct agreement for chance

Two raters each label 100 replies good or bad, and each matches the true label with the same accuracy. Move the share of replies that are truly good.

90%
50%

Illustrative raters who err independently. The table shows expected counts out of 100.

Call the share of items where the raters agree po, the observed agreement. Call the agreement two raters would reach by labelling at random with their own rates pe, the chance agreement. Cohen’s kappa asks how much of the possible gain over chance they reached:

Say it aloud

Kappa equals p-o minus p-e, over one minus p-e.

κ
kappa agreement beyond chance: 1 is perfect, 0 is chance level.
po
p-o the share of items both raters labelled the same.
pe
p-e the agreement expected by chance: P(both good) + P(both bad) if each labels at random with its own rate.
In plain words

Subtract chance agreement pe from observed agreement po. Divide by the most anyone could gain over chance, 1 − pe.

With numbers

From the device, raters 90% accurate: po = 0.9² + 0.1² = 0.82. With half the replies good, each rater says good half the time, pe = 0.5, and κ = 0.32/0.5 = 0.64. With 90% good, each says good 82% of the time: pe = 0.82² + 0.18² = 0.705, and κ = 0.115/0.295 = 0.39. Same raters, same 82%.

Chatbot Arena takes people into the wild. A user types any prompt, sees two anonymous models answer, and votes. By January 2024 it had over 240,000 votes from about 90,000 users, turned into ratings with the Bradley-Terry model (worked in CS336’s evaluation lesson). The lecture weighs it: real but often odd prompts, a large community cost, slow ratings for new models, and votes that may reward surface appeal.

Symptom: a study reports 82% agreement, and the labels still look noisy.

Measure: Cohen’s κ: 0.39 when 90% of replies are good.

Fix: report κ, balance the items you rate, and tighten the rubric until κ rises.

Two raters agree on 82% of replies. Why can κ still be low?

Chapter 7

An LLM as Judge, or a Jury

See where one judge fails, and how far a majority vote of judges can lift it

An LLM judge is a language model prompted to grade answers: pick the better of two, or score one on a rubric. It is far cheaper than people and follows instructions well. MT-Bench (Zheng et al., 2023) has 80 two-turn questions in 8 categories. There, GPT-4’s pairwise verdicts matched people’s 85% of the time on votes without ties, and people matched each other 81%.

Judges have biases, and the lecture names them:

One fix is a jury: several judges vote, and the majority wins. A panel of smaller models from different families beat a single large judge while costing over seven times less (Verga et al., 2024). Why does voting help?

Grow a jury of judges

The grey dashed curve has judges who err independently. Add a shared trap, such as a long wrong answer every judge likes, and watch the pink curve stop rising.

5
70%
0%

Illustrative judges. p is each judge’s chance of being right on an ordinary pair; on the trap pairs every judge is wrong together.

Call each judge’s chance of being right p, the number of judges N (odd), and the votes needed for a majority m = (N + 1)/2. If judges err independently, the jury is right when at least m judges are:

Say it aloud

P-jury equals the sum over k from m to N, of N choose k, times p to the k, times one minus p to the N minus k.

Pjury
P-jury the chance the majority verdict is right.
Σk=mN
the sum over k from m to N add every outcome where k, the number of right judges, is a majority.
C(N, k)
N choose k the number of ways to pick which k of the N judges are right.
pk (1 − p)N−k
p to the k, times one minus p to the N minus k the chance of one such pattern: k right, the rest wrong.
In plain words

For each count k from m to N, multiply the number of ways to choose k right judges by the chance of k rights and N − k wrongs. Add the terms.

With numbers

From the device: N = 5, p = 0.7, m = 3. The terms are 10 × 0.7³ × 0.3² = 0.309, 5 × 0.7⁴ × 0.3 = 0.360 and 0.7⁵ = 0.168. Pjury = 0.837: five 70% judges make an 84% jury.

The formula assumes independent errors. Judges from one family, trained on similar data, share blind spots. Set the trap to 15% and no jury can pass 85%: on those pairs every vote is wrong together. That is why the jury paper mixes model families.

Symptom: a judge’s verdict flips when you swap the answers, or it prefers the longer one.

Measure: consistency under swapping (65% for GPT-4 in MT-Bench), and the win rate of padded answers.

Fix: judge both orders, control for length, use a rubric, and vote across different model families.

Why does adding judges stop helping when they share a bias?

Chapter 8

When the Score Becomes the Target

Leak part of a test into training, watch the score rise, and rephrase the test to expose it

Goodhart’s law: “when a measure becomes a target, it ceases to be a good measure”. The lecture shows the strong form: push hard on a proxy and the true goal first improves, then gets worse. A benchmark is a proxy, and everyone pushes on it.

The bluntest break is contamination: test questions sit in the training data. Pretraining text comes from the web, and benchmarks are on the web. Synthetic data from another model can carry them too. With closed data, nobody outside can check.

Leak the test, then rephrase it

Teal rings mark questions that leaked into training; the model answers those from memory. Raise the leak, then turn on Rephrase.

30%

Illustrative. We assume the model answers every leaked question from memory, and answers a rephrased question only by skill.

Call the model’s true accuracy on fresh questions a, and the share of the test that leaked c. The measured score s is:

Say it aloud

s equals c times one, plus one minus c, times a.

s
s the measured score on the published test.
c
c the share of test questions in the training data, answered right from memory.
a
a the model’s true accuracy on questions it never saw.
In plain words

The leaked share c scores 1. The rest, 1 − c, scores at the true accuracy a. Add the two parts.

With numbers

With made-up numbers: a weak model with a = 0.40 and c = 0.30 scores 0.30 + 0.70 × 0.40 = 0.58, a gain of 18 points, 45% above its skill. A strong model with a = 0.85 scores 0.895: 4.5 points, 5.3%. A leak makes weak models look strong.

Detection starts with n-gram overlap. GPT-3 flagged any test item that shared a 13-word run with its training data. The lecture says runs of 8 to 13 words are common, sometimes with embedding checks. Without the data, rephrase: a model that knows the material scores about the same; one that memorized drops. CS336’s lesson works the n-gram check and a shuffle test.

The lecture adds two cautions. Prompt sensitivity: the number of shots, chain of thought, a missing space and the answer parser all change scores. Formatting alone moved LLaMA-2-13B by up to 76 accuracy points (Sclar et al., 2023). The generator-validator gap: in September 2023 ChatGPT answered “what is 7+8” with 15, then called “7+8=15” false. GPT-4 was consistent 76% of the time (Li et al., 2023). Answer keys have errors too: an estimated 6.49% of MMLU questions (Gema et al., 2024).

Symptom: a model beats much larger ones on an old public benchmark, then falls behind on fresh questions.

Measure: the gap between the original and a rephrased or newer test: 18 points for the weak model here.

Fix: decontaminate the training data by n-gram overlap, keep held-out tests private, and test on questions written after the training cutoff.

A model scores 92% on a public test and 65% on a rephrased copy of it. What is the most likely reason?

Chapter 9

Showcase: Design a Benchmark

Set the size, difficulty, key errors and cues of a test, and check it against the lecture’s desiderata

You now have every part. Build a test for two models: A with skill 2.0 and B with skill 2.5, the item model of Chapter 0. A third model has no skill at all: it guesses, or follows a cue when the question has one. The test passes three checks, the lecture’s desiderata as numbers:

Design a benchmark that works

Bars are scores with 95% intervals. The grey lines are the 25% guess and the ceiling that key errors leave. Change one setting at a time.

500
2%
20%

Illustrative. Four-option questions; a wrong key marks a right answer wrong and gives a wrong answer a one-in-three chance of credit. Only the no-skill model uses cues here; real models use them too. Intervals treat the two models as independent; a paired test is tighter (statistics of evaluation).

Things to try. The default, 500 medium questions with 2% bad keys and 20% cues, fails twice: the 3.7-point gap is inside its ±4.0 error, and the no-skill model scores 39.6%. Raise to 1,000 questions and the gap clears its ±2.8. Drop the cues to 0% and the no-skill model falls to 25.0%.

Now switch to Easy and 5,000 questions. A and B separate (0.8 ± 0.7 points), but B sits 1.3 points under the ceiling: there is no room left, which is Chapter 0’s saturation. Switch to Hard: B has 44 points of room and the gap is 6.9 points. Last, set wrong keys to 10% on 1,000 medium questions with no cues. The ceiling falls to 90%, the gap shrinks to 3.3 points (3.8 with perfect keys), and the test can no longer tell A from B.

Check yourself. Which setting fixes separation without touching the models? Which one only a careful annotation pass can fix?

Chapter 10

Field Guide

Keep the metrics, the numbers and the code, and see what the lecture leaves open

A benchmark turns quality into one number, and it wears out: models saturate it, take its shortcuts, or see it in training. Grading is a second choice. Multiple choice and short answers have keys; sentences and long answers need overlap metrics, vector metrics, people or LLM judges, and each one is blind somewhere. Report how you graded, with the score.

GraderWhat it comparesBlind toUse for
Exact match, accuracythe answer against a keyany other right formmultiple choice, numbers, short spans
Token F1shared words with the gold spansynonymsextractive QA
BLEU, ROUGEshared n-grams with referencesmeaning: “Heck no !” gets 0.67translation and summaries, with several references
BERTScore, BLEURTtoken vectors, or a learned ratingfacts: 1942 against 1924paraphrase-tolerant sentence scoring
Vendi, distinct-n, MAUVEa set of texts with itself, or with people’squality of each itemdiversity of data and outputs
People, Chatbot Arenajudgments against a rubric, or votestheir own traps: length, fluencythe final reference; report κ
LLM judge or juryanswers, by reading themposition, length, its own outputsopen answers at scale; swap orders, mix families
NumberValueWhere
BLEU-1 of Yes !, You know it !, Yup ., Heck no ! against Heck yes !0.61, 0.25, 0, 0.67Hero, Chapter 3
GLUE: people, BERT, previous best87.1, 80.5, 72.8Chapter 0
MMLU: GPT-3, Chinchilla, GPT-4; expert estimate43.9%, 67.6%, 86.4%; about 89.8%Chapter 0
GPQA: experts, non-experts with the web, GPT-465%, 34%, 39%Chapter 0
SQuAD with one distractor, average of 16 models75% to 36% F1Chapter 1
BERT on MNLI, on HANS overlap cases84%, 16%Chapter 1
Toy Vendi score: corpus 2, corpus 1, all six1.29, 2.00, 3.62Chapter 5
Toy κ at 82% agreement, 50% and 90% good0.64, 0.39Chapter 6
MT-Bench: GPT-4 against people, people against people (no ties)85%, 81%Chapter 7
GPT-4 judge keeps its verdict when we swap the answers65%Chapter 7
Five 70% judges, majority vote83.7%Chapter 7
Toy leak of 30%: weak model 40% to 58%+18 pointsChapter 8
Prompt formatting, LLaMA-2-13Bup to 76 pointsChapter 8

The core as code: BLEU, token F1, Cohen’s κ and the Vendi score, in plain Python and NumPy.

python
import math, re
from collections import Counter
import numpy as np

def bleu(cand, ref, N=4):                          # one sentence, one reference, no smoothing
    c, r = cand.lower().split(), ref.lower().split()
    grams = lambda t, n: Counter(tuple(t[i:i+n]) for i in range(len(t)-n+1))
    logp = 0.0
    for n in range(1, N+1):
        cg, rg = grams(c, n), grams(r, n)
        hit = sum(min(v, rg[g]) for g, v in cg.items())   # clipped counts
        if hit == 0: return 0.0
        logp += math.log(hit / sum(cg.values())) / N
    bp = 1.0 if len(c) > len(r) else math.exp(1 - len(r) / len(c))
    return bp * math.exp(logp)

def token_f1(pred, gold):                            # SQuAD-style normalization
    norm = lambda s: re.sub(r"\b(a|an|the)\b", " ", re.sub(r"[^\w\s]", " ", s.lower())).split()
    p, g = norm(pred), norm(gold)
    common = sum((Counter(p) & Counter(g)).values())
    return 0.0 if common == 0 else 2 * common / (len(p) + len(g))

def cohen_kappa(a, b):                               # two lists of labels
    po = np.mean([x == y for x, y in zip(a, b)])
    pe = sum(np.mean([x == k for x in a]) * np.mean([y == k for y in b]) for k in set(a) | set(b))
    return (po - pe) / (1 - pe)

def vendi(K):                                       # K: n x n similarity, ones on the diagonal
    lam = np.clip(np.linalg.eigvalsh(K / len(K)), 0, None)
    lam = lam[lam > 1e-12]
    return float(np.exp(-(lam * np.log(lam)).sum()))

print(round(bleu("Heck no !", "Heck yes !", N=1), 2))          # 0.67
print(round(token_f1("the Broncos", "Denver Broncos"), 2))   # 0.67
print(round(vendi(np.array([[1, 6/7], [6/7, 1]])), 2))       # 1.29

What the lecture leaves open

HELM (Liang et al., 2022), a reading, scores each model on seven metrics across 16 core scenarios, instead of one number. The metrics are accuracy, calibration, robustness, fairness, bias, toxicity and efficiency.

The lecture lists behavioural benchmarks too: sycophancy, honesty, opinions. It closes on open questions. How do we tell understanding from pattern matching? How do we stop contamination and gaming, and measure calibration and honesty? How do we separate a model’s capability from how well we elicit it, and evaluate the benchmarks themselves? In its words, the science of evaluation lags behind the engineering.

Keep going

Read next

The habit. A score is a test, a grader and a dataset together. Before you trust it, ask whether the test still separates models, whether the grader sees meaning, and whether the model saw the test.
A new model tops a public leaderboard by half a point. Which question matters least before you trust the result?

Now teach it: press Present or Teach. Explain why a test saturates, how one sentence fooled SQuAD readers, why BLEU likes “Heck no !”, and why a jury cannot vote away a shared bias. Then go back to the hero and predict each grader’s score for “Yup .” before you look.

Benchmarking and Evaluation · Stanford CS224N, Lecture 11
Before: Agents, Tool Use, and RAG · Next: Reasoning 1 · Course site · Back to Gleams