Exercises — Evaluation of LLMs (benchmarks, LLM-as-judge)
Before we start, one shared picture of the whole evaluation world:

The green road (benchmarks) is used when a ground-truth answer exists. The coral road (LLM-as-judge) is used when quality is subjective. Every exercise below sits on one of these two roads.
Level 1 — Recognition
Goal: can you name the right tool and read the notation?
Exercise 1.1
Match each task to whether it should be scored by a benchmark (objective ground truth) or by an LLM-as-judge (subjective quality):
- "Solve: ."
- "Write a comforting message to someone who lost a pet."
- "What is the capital of France? (A) Berlin (B) Paris (C) Rome (D) Madrid"
- "Which of these two summaries is more helpful?"
Recall Solution 1.1
A benchmark needs a single checkable answer; LLM-as-judge handles open-ended quality.
- Benchmark — one correct number (), exact-match scoring.
- LLM-as-judge — no single right message; "comforting" is subjective.
- Benchmark — multiple-choice with one correct letter (B), accuracy scoring.
- LLM-as-judge — "more helpful" is a preference, no ground truth.
Rule of thumb: if you can write the answer key in advance, use a benchmark.
Exercise 1.2
In the pairwise judge prompt, the judge is told to output one of [[A]], [[B]], or [[Tie]]. In plain words, what does each verdict mean, and what does the judge compare?
Recall Solution 1.2
The judge reads one instruction and two responses, then decides which response better satisfies criteria like accuracy/helpfulness/safety.
- A — response A is better.
- B — response B is better.
- Tie — neither is clearly better.
Crucially, the judge is comparing the two responses to each other, not to a hidden gold answer. That is exactly why we use a judge here: there is no gold answer to compare against.
Level 2 — Application
Goal: plug numbers into the formulas built in the parent note.
Exercise 2.1 (Accuracy)
A model answers MMLU questions and gets correct. What is its accuracy, as a percentage rounded to one decimal place?
Recall Solution 2.1
What accuracy is: the fraction of items the model got exactly right. Why division: each question contributes equally, so we average a 0/1 score over all questions.
Exercise 2.2 (Simple Pass@k)
A coding benchmark has problems. For samples each, a model produces at least one passing sample on of them. Using the simple estimator compute Pass@5. (Round to 3 decimals.)
Recall Solution 2.2
What the formula says: the chance of getting at least one correct in tries equals minus the chance all fail.
Here , so the single-try failure rate is . Why so high? With a 75% per-try success rate, failing five times in a row is astronomically unlikely — the exponent crushes it.
Exercise 2.3 (Observed agreement)
An LLM judge and a human agree on the winner in out of pairwise comparisons. What is the observed agreement ?
Recall Solution 2.3
is just the raw agreement fraction: Warning for later: this number looks great, but it ignores agreement that could happen by pure luck. Level 3 fixes that.
Level 3 — Analysis
Goal: use the pieces together and interpret the result.
Exercise 3.1 (Cohen's Kappa)
Reuse Exercise 2.3: over comparisons. Suppose the human picks response A of the time and the judge picks A of the time. Compute the chance-corrected agreement , and classify it.
Recall Solution 3.1
Step 1 — expected-by-chance agreement . If both parties chose independently, they'd still coincide sometimes. They agree on "A" with probability and on "B" with probability : Why the products: independent events → multiply; two ways to accidentally agree (both A, both B) → add.
Step 2 — subtract out the luck. Reading the scale: = moderate agreement. So despite the flashy raw number, once we remove the we'd expect from chance, the judge is only moderately aligned with the human.
Exercise 3.2 (Why Kappa < Accuracy)
In 3.1, raw agreement was but was only . Explain in one or two sentences why dropped, and describe a scenario where would be negative.
Recall Solution 3.2
dropped because a binary A/B choice already collides ~ of the time by luck; measures agreement above that floor, and rescales the remaining of "room to agree" to a max of .
happens when — the judge and human agree less often than random chance would predict, i.e. they are systematically anti-correlated (when the human likes A, the judge tends to pick B). That is worse than a coin flip.
Level 4 — Synthesis
Goal: combine formulas and reasoning to make a decision.
Exercise 4.1 (Unbiased Pass@k vs simple estimator)
The parent note gives the unbiased Pass@k estimator for a single problem with total samples and passing ones: For one problem, we drew samples, of which passed. Compute the unbiased Pass@3. Then compute the naive version and explain which is correct and why.
Recall Solution 4.1
Unbiased (sampling without replacement). The chance all chosen samples come from the failing ones is So Naive (sampling with replacement). Which is right? We already generated a fixed pool of samples and are asking "if I pick of these, does one pass?" — that is drawing without replacement, so the unbiased combinatorial form () is correct. The naive form assumes we re-roll the true probability each time (with replacement) and here underestimates Pass@3. Why the gap: without replacement, each failure you draw makes the remaining pool richer in successes, nudging Pass@k up relative to the independent-trials assumption.
Exercise 4.2 (Position bias defense)
An LLM judge is run on instruction pairs. When the better answer is placed as A, the judge picks it times. When the same better answer is placed as B, the judge picks it only times. (a) What phenomenon does this reveal? (b) Propose a concrete fix and state what the "true" win rate estimate becomes after applying it.
Recall Solution 4.2
(a) Position bias. The judge favors whichever response sits in slot A regardless of content — evidence: the same answer scores in slot A but in slot B.
(b) Fix — swap-and-average (order randomization). Run every pair twice, once as (A,B) and once swapped to (B,A), and average. The debiased estimate of how often the truly-better answer wins is This cancels the constant slot-A advantage. (A stricter variant: only count a "win" when the better answer wins in both orders, discarding order-dependent flips as ties.)
Level 5 — Mastery
Goal: end-to-end judgement call combining every concept and the wider chapter.
Exercise 5.1 (Choosing an evaluation stack)
You fine-tuned a chatbot with RLHF and want to prove it improved. You have three claims to evaluate:
- (i) "It got better at grade-school math."
- (ii) "It's more helpful in open-ended chat."
- (iii) "Our automated judge actually reflects human taste."
For each claim, name the evaluation method, the metric, and the one number that would make you distrust the result.
Recall Solution 5.1
| Claim | Method | Metric | Red flag |
|---|---|---|---|
| (i) math | Benchmark (e.g. GSM8K) | Exact-match accuracy | A big jump that vanishes on held-out/unseen problems → benchmark contamination (leakage into training data) |
| (ii) chat | LLM-as-judge, pairwise vs old model | Win rate (both orders, swap-averaged) | Win rate near , or a rate that flips when you swap A/B → position bias not controlled |
| (iii) judge trust | Compare judge to human labels | Cohen's | → judge disagrees with humans beyond chance; a high raw accuracy alone is not enough |
Key mastery point: (i) needs ground truth, (ii) needs a judge, and (iii) needs a chance-corrected agreement to validate the judge itself — you cannot trust the win rate in (ii) until in (iii) is at least substantial ().
Exercise 5.2 (The full alignment-tax tradeoff)
Your RLHF model wins of open-ended chat comparisons (judged, swap-averaged) but its GSM8K accuracy dropped from to . (a) Name this tradeoff. (b) Compute the relative drop in math accuracy. (c) Given both numbers, argue whether to ship — and name one other chapter technique you'd try to recover the loss.
Recall Solution 5.2
(a) This is the Alignment Tax: making a model more helpful/aligned can cost raw capability on objective tasks.
(b) Relative drop in math accuracy: (Absolute drop is points; relative drop is about of the original score.)
(c) Decision: the chat win rate of is a clear, judge-verified helpfulness gain, while the math cost is a modest relative drop. If chat is the product's primary use, ship — but mitigate the tax. One recovery lever from this chapter: Constitutional AI (align with model-generated principles to reduce reliance on capability-eroding human labels), or preserve math skill with Few-Shot Learning prompting (in-context math exemplars at inference time) so you don't need to re-train the weights. Either way, re-run both the benchmark and the judge after the fix — never trust one road alone.
Recall One-screen summary
Objective task ::: benchmark + accuracy / Pass@k / exact-match Subjective task ::: LLM-as-judge, pairwise win rate Pass@k meaning ::: probability at least one of k samples passes Why ::: subtract the chance that all k samples fail Why unbiased Pass@k uses binomials ::: samples are drawn without replacement from a fixed pool Cohen's purpose ::: agreement corrected for chance ( minus , rescaled) means ::: judge and human agree less than random chance Position bias fix ::: evaluate both A/B orders and average Alignment tax ::: capability lost while gaining alignment