Evaluation
How do we know a model is good? Perplexity measures the language, benchmarks measure the skills, and every number hides a trap.
Key terms
| Term | Meaning |
|---|---|
| Perplexity | Average surprise per token; lower means the model predicts text better (Day 01) |
| Downstream task | A concrete job we care about: answering, coding, summarizing |
| Benchmark | A fixed dataset of scored questions used to compare models |
| MMLU | A benchmark of multiple-choice questions across many subjects; scored by accuracy |
| Accuracy | Fraction of items answered correctly |
| pass@k | Probability at least one of k sampled attempts is correct |
| Contamination | Test questions leaking into training data, inflating scores |
| LLM-as-judge | Using a second model to grade open-ended answers |
Perplexity vs downstream
On Day 01 we measured a model by perplexity — its average surprise per token. Lower perplexity means the model models language better. But a low-perplexity model is not automatically a useful one: fluently predicting the next word does not guarantee it can answer a question or write correct code.
So evaluation splits in two. Perplexity is an intrinsic measure — it scores the raw language modelling, using no task. Downstream measures are extrinsic — they score performance on a concrete job. A model can improve on one and not the other, so we report both.
| Measure | Type | What it scores | Needs labels? |
|---|---|---|---|
| Perplexity | Intrinsic | Next-token prediction | No |
| MMLU accuracy | Extrinsic | Subject knowledge | Yes |
| pass@k | Extrinsic | Code that runs correctly | Yes (tests) |
Benchmarks (worked MMLU-style item)
A benchmark is a fixed set of scored questions. Everyone runs the same set, so scores are comparable. MMLU is a well-known one: multiple-choice questions with four options, scored by accuracy.
Here is one MMLU-style item:
Question: A cell's mitochondria are primarily responsible for:
A) Protein synthesis
B) Energy (ATP) production
C) Storing genetic material
D) Waste removal
Gold answer: B
The model does not "click" an option. It scores each letter by the probability it would generate that letter as the answer, then we take the most likely one (argmax) and compare it to the gold answer:
| Option | Model probability | Is gold? |
|---|---|---|
| A | 0.10 | no |
| B | 0.70 | yes |
| C | 0.15 | no |
| D | 0.05 | no |
The probabilities sum to 0.10 + 0.70 + 0.15 + 0.05 = 1.00. The argmax is B (0.70 is the largest), which equals the gold answer, so this item scores 1 (correct).
Accuracy is the average over all items. Suppose the benchmark has 4 items and the model gets items 1, 2, and 4 right but misses item 3:
scores = [1, 1, 0, 1]
accuracy = (1 + 1 + 0 + 1) / 4 = 3 / 4 = 0.75
So the model scores 75% on this tiny benchmark.
pass@k
For code, one sample is a harsh test — the model might get it on a second try. pass@k asks: if we draw k independent samples and run each against the unit tests, what is the chance at least one passes?
If a single attempt succeeds with probability p, then a single attempt fails with probability 1 - p, and all k independent attempts fail with (1 - p)^k. At least one passing is the complement:
pass@k = 1 - (1 - p)^k
Work it out for a model that solves a task with p = 0.4 per attempt, so failure is 1 - 0.4 = 0.6:
| k | (0.6)^k | pass@k = 1 - (0.6)^k |
|---|---|---|
| 1 | 0.600 | 0.400 |
| 2 | 0.360 | 0.640 |
| 3 | 0.216 | 0.784 |
| 5 | 0.07776 | 0.92224 |
Step by step for k = 3: 0.6 * 0.6 = 0.36, then 0.36 * 0.6 = 0.216, so pass@3 = 1 - 0.216 = 0.784. More attempts raise the chance of at least one success, which is why pass@k always grows with k. Note the catch: pass@10 looking great does not mean the model is reliable — it just means one lucky draw in ten tends to work.
In practice p is unknown, so we estimate it by sampling n attempts and counting c correct: p = c / n. For example, 2 correct out of 5 samples gives p = 2 / 5 = 0.4, the value used above.
Contamination + LLM-as-judge caveats
Every benchmark number hides a trap, and a careful reader checks for them.
- Contamination. If the test questions appeared in the training data, the model may have memorized the answers rather than reasoned them out. The score then measures recall, not skill, and looks far better than the true ability. Guard against it by holding out fresh questions and checking for overlap between test and training text.
- LLM-as-judge. Multiple choice is easy to score, but open-ended answers (a summary, an essay) have no single gold string. A common shortcut is to ask a second, strong model to grade the answer. It scales cheaply but inherits the judge's biases: judges tend to favor longer answers, their own writing style, and the first option shown. Use it for rough comparisons, calibrate it against a sample of human grades, and never treat its score as ground truth.
The habit to build: when you see a headline benchmark number, ask which benchmark, whether it could be contaminated, and how open-ended answers were graded.
Key takeaways
- Perplexity is intrinsic (scores the language); downstream benchmarks are extrinsic (score a real task) — report both.
- A benchmark is a fixed, shared question set; MMLU scores multiple-choice items by accuracy = correct / total.
- A model answers MMLU by scoring each option's probability and taking the argmax.
pass@k = 1 - (1 - p)^k: the chance at least one ofkattempts passes, which always rises withk.- Contamination inflates scores by leaking test data into training; LLM-as-judge scales open-ended grading but carries biases — treat both with suspicion.
Checklist
- Can you explain the difference between intrinsic and extrinsic evaluation?
- Can you score one MMLU-style item given option probabilities and the gold answer?
- Can you compute accuracy from a list of per-item scores?
- Can you derive
pass@k = 1 - (1 - p)^kfrom the chance of all attempts failing? - Can you name the contamination and LLM-as-judge traps and one guard for each?