Unit 4.4 · about 4 h
314 / 324Uncertainty, robustness and honest claims
A single mean hides where a model fails and how fragile the number is. Slices plus uncertainty plus sensitivity turn a leaderboard entry into a claim you can defend.
- implement
- measure
You can now
- Build slices, paired comparisons and bootstrap intervals for a small evaluation, and read overlapping intervals correctly.
- Measure prompt, order and sampling sensitivity under fixed compute budgets and report the range, not just the best run.
- Separate capability results from safety results with distinct gates and stop conditions.
Covers
- Slices, paired comparisons and bootstrap uncertainty
- Prompt sensitivity, robustness and sampling-compute budgets
- Capability versus safety evaluation boundaries
Study, in this order
4 steps
- Modern LLM Notebook 25-evaluation: aggregation and composite scoresModern LLM Notebook - evaluation and FLOP accounting
Section 5 comparison table with analysis points (same-scale compare, business-relevant metrics, trends over single numbers, labeled source and config) and Section 5.2 (arithmetic, normalized, weighted, geometric and rank-sum methods with geometric penalizing weak spots)
- Modern LLM Notebook 25-evaluation: robustness and pitfallsModern LLM Notebook - evaluation and FLOP accounting
Section 8.2 (
CR@K, prompt, order and sampling robustness) and Sections 10.1 to 10.3 (prompt sensitivity 5 to 15 percent with OLMES prompts, few-shot counts, HumanEval 164 variance,seed,temperature, mean plus minus std, per-subject slices, length bias, best-score reporting) - lm-eval-harness: bootstrap uncertainty in `metrics.py`Language Model Evaluation Harness
bootstrap_stderrwith resampling anditers,stderr_for_metricwith the bootstrappable list (median,matthews,f1,perplexity,bleu,chrf,ter,nanmean) and closed-form mean andacc_all, pluspooled_sample_stderrfor groups - CS336 Lecture 12: safety benchmarks and realismStanford CS336 - resource accounting, inference and evaluation
Function
safety_benchmarks()with HarmBench 510 behaviors, AIR-Bench 314 categories and 5694 prompts, GCG transfer, contextual safety and dual-use CyBench; plusrealism()with GDPVal, MedHELM 121 tasks from 29 clinicians, and Clio
Focus on
- Slice first, then aggregate. Report per-slice means before any composite, and say which slice drives the headline.
- Compare paired deltas on the same prompts, not two independent means. Pairing cancels prompt difficulty, which two independent intervals would both include.
- Bootstrap resamples with replacement and reports the std of the stat. Use the closed-form SE for plain means and bootstrap for medians, F1, perplexity and similar.
- Fix the sampling and prompt budget before comparing. Temperature, seed, few-shot and prompt version are part of the result.
Reproduce closed-book
Traps
- Reading overlapping intervals as proof of no difference without a paired test. Pair the prompts first, then test the \(\delta\).
- Reporting the best prompt or seed. Prompt swings of 5 to 15 percent dwarf small model gaps.
- Claiming safety from a capability average. A model at 90 math and 10 safety averages 50 and is still unsafe, so gate safety separately.
Practice
The section mini-project covers this: 20-example two-slice evaluator with raw outputs, paired deltas and bootstrap intervals, plus one deliberate prompt or sampling failure.
Self-test
-
Exercise 3 scores Model A at 82, 71, 65, 78 and Model B at 78, 75, 70, 72. What do the two means say?
Arithmetic: A 74.0, B 73.8, so A leads by 0.25. Geometric: both about 73.7, so the gap vanishes. B is more balanced (range 8 versus 17) because the geometric mean punishes the weak 65 that the headline average hides. -
When should you use
bootstrap_stderrinstead of a closed-form SE?Plain means andacc_allhave closed forms (mean_stderr,acc_all_stderr). Medians, F1, perplexity, BLEU and similar usebootstrap_stderrwith resampling, and groups combine withpooled_sample_stderr. -
Why compare paired deltas rather than two independent means?
Both models see the same prompts, so prompt difficulty cancels and the \(\delta\) isolates the model effect. Independent means mix model differences with prompt sampling noise. -
How should capability and safety results be gated?
Gate them separately with distinct primary tasks, regressions, slices, safety checks and stop conditions. Dual-use tasks such as CyBench count as both, so state which claim each result supports.
Completion criterion
Stop when
Your two-slice report shows per-slice means, a paired \(\delta\) with an interval, and a sensitivity range for one prompt or sampling change.
Mark passed, then open 4.5 Only mark this when you can do it without notes.Leads to
- 4.5 Contamination and memorization Add the contamination boundary to the release gate.
- 4.7 Memory, arithmetic intensity and reconciling estimates Carry interval discipline into quality-compute comparisons with uncertainty ranges.
Comes after
- 3.5 Bayes rule, conjugate priors and posterior predictivesCarry the posterior-versus-confidence distinction into model uncertainty claims.
- 4.3 Intervals, hypothesis tests, power and effect sizeUse coverage and test assumptions to qualify evaluation claims.
- 4.6 Missingness and selection mechanismsCarry missingness assumptions and sensitivity analysis into evaluation claims.
- 4.7 Randomized experiment design, power and MDEUse predeclared thresholds and a validity audit when reporting evaluation results.
- 4.8 Causal claims, causal graphs, adjustment and identificationKeep causal identification separate from predictive evaluation claims.
- 3.4 Keeping training numerically healthyTreat seed and run variability as uncertainty instead of noise to ignore.
- 4.1 Likelihood and perplexity, and their limitsTreat perplexity gaps with slices and intervals instead of reading them as wins.
- 4.2 Task contracts and automatic metricsAdd slices and uncertainty to the harness before claiming any gap is real.
- 4.3 Model judges and human reviewCarry judge error into slices and intervals instead of quoting a bare win rate.
- 4.5 Contamination and memorizationReport decontaminated deltas with intervals instead of a single full-set mean.
Resources for this unit
- Stanford CS336 - resource accounting, inference and evaluation Use Spring 2026 Lectures 2, 10 and 12 for FLOPs, memory, arithmetic intensity, inference and evaluation. Reproduce the small calculations locally. Assignment 3 IsoFLOPs analysis is optional; do not require its hosted training API or costly experiments.
- Modern LLM Notebook - evaluation and FLOP accounting Use English notebook 25-evaluation and Appendix B FLOP and memory accounting. Build a 20-example evaluator with two slices, raw outputs and bootstrap intervals, and deliberately create one parser, prompt or judge failure.
- Language Model Evaluation Harness After the small evaluator passes, inspect task versioning, request construction and result schemas to understand production evaluation plumbing. Do not use the harness as a substitute for owning the task and metric contract.
Also in this section
- LLMs from Scratch companion - GPT FLOP analysis Use ch04/02_performance-analysis/flops-analysis.ipynb as a concrete calculator, then rebuild the formulas from the model configuration and reconcile parameters and at least one memory or operation estimate with runtime state.
- LLM Foundations Checkpoint - evaluation and arithmetic slice Use the contamination, evaluator-bias, parameter, FLOP, activation, state and KV requirements as the assessment contract. Keep raw outputs and distinguish a verified task result from a broad model capability claim.
- Stanford CS336 Assignment 3 - IsoFLOPs scaling Use Section 2.1 and Problem
chinchilla_isoflopswithdata/isoflops_curves.jsonfor the bounded curve-fitting exercise only. Do not use the hosted training API or costly experiments.