Skip to content
mentoor

Topic 1 of 5 · 5 min read

Error bars on eval scores

Goal: Compute a confidence interval for an eval pass rate and say whether two scores really differ.

An eval score is an estimate from a sample of cases, so it always comes with a range; report the range, not just the number. Your 50 cases are a small draw from all the inputs your feature will see. Draw another 50 and the score moves.

Check yourself · 1 of 3

An eval has 100 cases and a 90 percent pass rate. Roughly what is the 95 percent interval?

Choose one answer

Why it matters

Model and prompt changes are usually judged by a score going up or down by a few points. If the range around each score is wider than that move, the move tells you nothing. Teams ship regressions and drop good ideas because of noise.

How to compute it

For a pass rate, use the standard error: SE = sqrt(p * (1 - p) / n), where p is the pass rate and n the number of cases. A 95 percent confidence interval is about p +/- 1.96 * SE.

Pass rate Cases SE 95% interval
82% 50 5.4 pts 71% to 93%
82% 500 1.7 pts 79% to 85%

Ten times the cases shrinks the range by about three, not ten: error falls with the square root of n.

To compare two versions on separate, independent samples, add the variances: SE_diff = sqrt(SE_a^2 + SE_b^2). Version A scores 82 percent and version B 88 percent, each on 50 cases. SE_diff is about 7.1 points, so the interval for the 6 point gap is roughly minus 8 to plus 20. Zero is inside it. You cannot say B is better.

Near 0 or 100 percent, or when n is under about 30, the simple formula misbehaves (it can give intervals above 100 percent). Use the Wilson interval or an exact interval instead; both are in standard libraries such as scipy and statsmodels.

Before and after

Before: "The new prompt scores 88 percent, up from 82. Ship it."

After: "The new prompt scores 88 percent (n = 50) versus 82 percent for the old one. The difference is 6 points with a 95 percent interval of about minus 8 to plus 20. We cannot tell them apart yet; we need more cases or a paired comparison."

What goes wrong

  • Reading two overlapping intervals as proof of no difference. Overlap does not prove equality, and non-overlap is not required for a real gap. Compute the interval of the difference itself.
  • Treating cases as independent when they are not. Twenty questions about the same document are not twenty independent draws. The real error is larger than the formula says, so cluster the cases (see the paired comparison topic).
  • Using the formula at the edges. A 100 percent score on 20 cases does not mean zero error.

Examples

82 percent on 50 cases

A support-bot eval has 50 cases and the bot passes 41. That is 82 percent, with SE 5.4 points and a 95 percent interval of about 71 to 93 percent. A later run that scores 76 percent is well inside that range: no regression is proven.

A small gap on ten times the data

Two prompts differ by 3 points on 500 cases each (84 vs 81 percent). SE_diff is about 2.4 points, so the interval is roughly minus 1.7 to plus 7.7. Still contains zero. Ten times the data did not turn a small gap into a proven one.

Key points

  • A pass rate on n cases has a standard error of sqrt(p(1-p)/n), and a 95 percent interval is about 2 standard errors either side.
  • Error shrinks with the square root of n, so ten times the cases cuts the range by roughly a factor of three.
  • To compare two independent scores, compute the interval of their difference, not two separate intervals.
  • If the interval of the difference contains zero, the data do not show that one version is better.
  • Use Wilson or exact intervals when scores are near 0 or 100 percent or n is small.

Common mistakes

  • Reporting a single score with no n and no range.
  • Calling a 4-point gain real because the new number is higher.
  • Comparing two separate intervals by eye instead of computing the difference.
  • Using the normal formula on a score of 98 percent from 30 cases.

Check yourself · 2 of 3

Version A scores 70 percent and version B 74 percent, each on 100 cases. What does an interval for the difference most likely show?

Choose one answer

Check yourself · 3 of 3

You raise an eval from 50 to 200 cases. By about how much does the standard error of the pass rate shrink?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic