Sub topic 13
Reporting Judge Metrics with Confidence Intervals
This chapter assumes you can read Python and know what a pass rate is. You should also know how an LLM judge turns outputs into verdicts, as covered earlier in this tutorial. No statistics beyond proportions and averages is needed.
Why a single number misleads
A judge run over an evaluation set produces a headline such as "pass rate 0.72". That number comes from a finite sample of items. A different sample of similar items, or the same items judged again, would give a different value. If you report only 0.72, readers cannot tell whether 0.72 versus 0.68 is a real difference or noise.
A confidence interval (CI) is a range that expresses this sampling uncertainty. A 95% interval is built by a procedure that, across many repeated experiments, contains the true value about 95% of the time. It does not say there is a 95% chance the true value sits in this one interval. For judge metrics, the practical reading is simple: a wide interval means the evaluation set is too small to support a firm claim.
How wide is the interval?
For a pass rate p measured on n independent items, the standard error is roughly sqrt(p(1-p)/n). A 95% interval is about p ± 1.96 × standard error. The table below uses p = 0.7.
| Items (n) | Approximate 95% half-width |
|---|---|
| 50 | ±0.13 |
| 100 | ±0.09 |
| 400 | ±0.045 |
| 1600 | ±0.023 |
Half-width shrinks with the square root of n. Quadrupling the set only halves the interval. A 50-item set cannot distinguish 0.70 from 0.62 with any reliability, which is a common size for hand-built evaluation sets.
Computing a bootstrap interval
The normal approximation works poorly for small n or for rates near 0 or 1, because it can produce bounds outside the range 0 to 1. The percentile bootstrap avoids that. It resamples your own verdicts with replacement many times, computes the pass rate each time, and reads the interval from the middle 95% of those rates.
import random
def bootstrap_ci(passes, n_boot=2000, alpha=0.05, seed=0):
rng = random.Random(seed)
n = len(passes)
rates = sorted(sum(rng.choices(passes, k=n)) / n for _ in range(n_boot))
lo = rates[int((alpha / 2) * n_boot)]
hi = rates[int((1 - alpha / 2) * n_boot) - 1]
return lo, hi
print(bootstrap_ci([1, 1, 0, 1, 1, 0, 1, 1, 1, 0] * 5))Here the 50 verdicts have a pass rate of 0.70. The printed interval is roughly 0.57 to 0.83, in line with the table. Fixing the seed makes the report reproducible. Use at least 1000 resamples, and 2000 or more if you will quote the bounds to two decimals.
Comparing two systems with a paired interval
Most decisions compare two prompts, models, or versions on the same items. Computing two separate intervals and checking whether they overlap is a poor test. It ignores that both systems saw the same items, and overlapping intervals can still hide a real difference.
Instead, compute the per-item difference and bootstrap that. Items that both systems pass or both fail contribute zero, so the pairing removes item difficulty from the noise.
import random
def paired_bootstrap_diff(a, b, n_boot=2000, alpha=0.05, seed=0):
if len(a) != len(b):
raise ValueError("a and b must cover the same items")
rng = random.Random(seed)
n = len(a)
diffs = [x - y for x, y in zip(a, b)]
means = sorted(sum(rng.choices(diffs, k=n)) / n for _ in range(n_boot))
lo = means[int((alpha / 2) * n_boot)]
hi = means[int((1 - alpha / 2) * n_boot) - 1]
return sum(diffs) / n, lo, hi
new = [1, 1, 1, 0] * 10 # 30 of 40 pass
old = [1, 1, 0, 0] * 10 # 20 of 40 pass
print(paired_bootstrap_diff(new, old))The observed difference is 0.25. The interval is roughly 0.12 to 0.38. It excludes zero, so the improvement is unlikely to be sampling noise. If the interval had straddled zero, the honest report would be "no detectable difference on this set".
For pairwise judging, the same idea applies to win rates. Count ties as half a win, or report win, tie, and loss rates separately with an interval on each.
What the interval does not cover
The bootstrap above captures only one source of uncertainty: which items you happened to sample. A judge adds others.
- Judge error. If the judge disagrees with humans on 15% of items, the pass rate is biased, and no interval on judge verdicts reveals that. Validate the judge against human labels, as in the earlier chapter on agreement and Cohen's kappa, and report that agreement next to the metric.
- Judge variance. Re-running the same judge on the same items can change some verdicts. This variance adds noise on top of item sampling.
- Systematic bias. Position, verbosity, and self-preference biases shift scores in one direction. More items make the interval narrower, not more correct.
A tight interval around a biased judge is precise and wrong. Treat the interval as a necessary check, not as evidence that the metric is valid.
Handling repeated judge runs
If you judge each item k times, for example at nonzero temperature, do not pool all n × k verdicts as if they were independent. Verdicts on the same item are correlated, and pooling makes the interval too narrow. Average within each item first, then bootstrap over items.
def per_item_scores(runs_by_item):
"""runs_by_item: list of lists, e.g. [[1, 1, 0], [0, 0, 0], ...]"""
return [sum(runs) / len(runs) for runs in runs_by_item]
runs = [[1, 1, 1], [1, 0, 1], [0, 0, 0], [1, 1, 1], [0, 1, 0]] * 10
scores = per_item_scores(runs)
print(bootstrap_ci(scores))The bootstrap_ci function works on fractional values as well as 0/1 verdicts, because it only sums and averages. The unit of resampling is the item, which is the unit you want to generalize over.
Common errors
- Resampling judge calls instead of items. This understates uncertainty when items repeat or runs are correlated.
- Comparing unpaired intervals. Use the paired difference when both systems ran on the same items.
- Testing many variants and keeping the winner. With 20 comparisons at 95%, about one will look significant by chance. Pre-register the comparison, or tighten the threshold.
- Reporting
0.72with false precision. Quote the interval andn, for example "0.72 (95% CI 0.61 to 0.82, n = 80)". - Slicing too thin. Per-category pass rates on 8 items each have enormous intervals. Show the interval, or merge categories.
- Changing the judge between runs. A new judge version changes the metric's meaning, so intervals from before and after are not comparable. Pin the judge and re-validate when it changes.
A reporting checklist
For each judge-based number you publish, include:
- the pass rate or win rate and the number of items
n - a 95% interval and how it was computed (percentile bootstrap, items resampled, seed fixed)
- the judge model, version, and prompt identifier
- judge-human agreement, with kappa, on a labeled subset
- for comparisons, the paired difference with its interval
Exercise
A team evaluates two prompts on the same 60 items. Prompt B passes 42 items and prompt A passes 36. Their separate 95% intervals are about 0.58 to 0.80 for B and 0.47 to 0.72 for A, so they overlap. A teammate concludes there is no difference. What is wrong with that reasoning, and what should the team compute instead?
Show answer
Overlap of two separate intervals ignores that both prompts ran on the same items. Item difficulty is shared, and a paired analysis removes it from the noise, so the paired interval can exclude zero even when the separate intervals overlap. The team should compute the per-item difference (B minus A), bootstrap it by resampling items, and check whether the interval for the mean difference includes zero. They should also report judge-human agreement, because the interval only covers item sampling, not judge bias.
Exercise
You judge each of 100 items 5 times at temperature 0.7, giving 500 verdicts. A colleague runs bootstrap_ci on all 500 verdicts. Why is the interval too narrow, and how do you fix it?
Show answer
Five verdicts on the same item are correlated, so the 500 verdicts are not 500 independent samples, and pooling them overstates the effective sample size. Average the five verdicts within each item to get 100 per-item scores, then run the bootstrap over those 100 items.