Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Is the new prompt really better?
If you flip a coin 20 times and get 12 heads, the coin isn’t necessarily biased. Testing a prompt on a few dozen examples is similar: a better score can be luck. And if you try twenty prompts and keep the best, it will look better than it really is, because you picked the luckiest. Good evaluation uses enough test examples, keeps a separate final test set, compares prompts on the same examples, and reports a range, not just one number. The demo shows how wide that range is.
Before changing a production prompt, evaluate on a fixed, representative test set with confidence intervals; small gains on a few examples are usually noise.
- 1. A score on 50 examples is…
- 2. Picking the best of many prompts makes its score…
- 3. The final score should come from…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Eval set: representative inputs with reference answers or a rubric; cover edge cases and failure modes; version it.
- Metrics: exact match, F1, pass rates, rubric scores, LLM-as-judge (F14-3), latency and cost.
- Uncertainty: standard error √(p(1 − p)/n); Wilson or bootstrap intervals; about 900 items for ±3 points at 70%.
- Paired comparison: run both prompts on the same items; McNemar’s test uses only the items where they disagree, removing item-difficulty noise.
- Multiple comparisons: comparing many prompts inflates false discoveries; select on a dev set, report once on a test set, or correct thresholds (Bonferroni).
- Variability: temperature, provider nondeterminism and paraphrase sensitivity; run repeats and paraphrases and report the spread.
- 1. Standard error of 70% on 200 items is about…
- 2. McNemar's test uses…
- 3. Items for ±3 points at 70% (95%):
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Evaluating prompts in practice
Exercise 1.
- Compute a Wilson confidence interval for an accuracy.
- Compute the McNemar statistic for a paired comparison.
- Compute the items needed for a target margin.
Practice.
- Tools: promptfoo, OpenAI Evals, Inspect, LangSmith, or a simple script with a CSV of cases.
- Keep dev and test splits; freeze the test set and report on it once per decision.
- Log per-item outputs so differences can be inspected and paired.
- Report mean, interval, and variability across seeds or paraphrases; track cost and latency too.
import csv, statistics
rows = list(csv.DictReader(open("eval_cases.csv")))
res = {name: [grade(call(prompt, r["input"]), r["expected"]) for r in rows] for name, prompt in prompts.items()}
b = sum(x and not y for x, y in zip(res["new"], res["old"])); c = sum(y and not x for x, y in zip(res["new"], res["old"]))
print({k: statistics.mean(v) for k, v in res.items()}, "McNemar z =", mcnemar_z(b, c))- 1. A tool for prompt evaluation:
- 2. Log outputs per item so that…
- 3. Report results with…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Winner’s curse. Each prompt’s dev score is its true accuracy plus noise. Picking the maximum selects prompts whose noise happened to be large and positive, so the chosen score is biased upwards, by roughly the expected maximum of the noise terms (about 2 standard errors for 20 prompts). The fix is to estimate the chosen prompt’s accuracy on data not used for choosing.
Why pairing helps. Item difficulty varies a lot, and both prompts tend to succeed or fail on the same items. An unpaired test treats the two scores as independent and must overcome the full item-sampling variance; a paired test conditions on items and uses only the discordant ones, whose count reflects the true difference. The more correlated the prompts’ outcomes, the bigger the gain.
Power. Detecting a difference δ with power 80% needs roughly n ≈ (2.8 σ_d / δ)², with σ_d the standard deviation of per-item differences. For a 3-point gap this is thousands of items unless outcomes are highly correlated.
- 1. The winner's curse is a…
- 2. Paired tests gain power when outcomes are…
- 3. Detecting small gaps needs…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How noisy are prompt comparisons, and how much do eval-set size and pairing help?
History.
- Q. McNemar (1947): the paired test for proportions.
- P. Liang et al., “HELM” (2022); M. Sclar et al., “Quantifying language models’ sensitivity to spurious features in prompt design” (ICLR 2024).
- E. Miller, “Adding error bars to evals” (2024).
Exercise 2. Simulated evaluations.
- Items: difficulty logits N(0, 1.5²), shared by all prompts, so outcomes are correlated.
- Selection: 20 prompts with true accuracies around 0.70 (best 0.74); pick the best on a dev set of 50, 200 or 1000 items; 200 repetitions.
- Comparison: two prompts with a true gap of 3 points; detection rate at the 5% level with an unpaired two-proportion test and a paired McNemar test; 400 repetitions.
| dev items | chosen prompt’s dev score | chosen prompt’s true accuracy | P(picked the best) |
|---|---|---|---|
| 50 | 0.810 | 0.715 | 0.185 |
| 200 | 0.764 | 0.725 | 0.240 |
| 1000 | 0.744 | 0.731 | 0.495 |
(Best possible 0.739; average prompt 0.700.)
| items | unpaired detection rate | paired detection rate |
|---|---|---|
| 200 | 0.068 | 0.142 |
| 500 | 0.150 | 0.230 |
| 1000 | 0.278 | 0.410 |
- Small dev sets lie: on 50 items the winner looked 10 points better than it was, and the truly best prompt won less than a fifth of the time.
- More items help: with 1000 items the chosen prompt was within a point of the best.
- A 3-point gap is hard to detect: at 200 items an unpaired test barely beat its 5% false-alarm rate; even at 1000 items most comparisons missed it.
- Pairing helped by about half again; here per-item outcomes were only moderately correlated, and the gain is larger when prompts agree on more items.
- Seeds 1 and 2: within 0.03 for selection; paired 0.40 and 0.41 at 1000 items.
Evaluation discipline in AI, robotics and aerospace
- LLM product teams: regression suites of fixed cases gate prompt and model changes.
- Robotics: success rates from 20–50 trials have wide intervals; compare policies on the same seeds and scenarios (paired).
- Certification-minded work: pre-registered test sets and reported uncertainty are basic requirements for credible claims.
References
- E. Miller (2024). “Adding error bars to evals: a statistical approach to language model evaluations.” arXiv:2411.00640.
- M. Sclar, Y. Choi, Y. Tsvetkov and A. Suhr (2024). “Quantifying language models’ sensitivity to spurious features in prompt design.” ICLR.
- Q. McNemar (1947). “Note on the sampling error of the difference between correlated proportions or percentages.” Psychometrika.
- P. Liang et al. (2023). “Holistic evaluation of language models.” TMLR.