41Is the new model better, or did it get lucky?
41 Is the new model better, or did it get lucky?
An OpenAI ML engineer round that was billed as system design turned almost entirely into agent harness and eval design (1 report), and an Airbnb candidate was asked how they designed an LLM judge, set its thresholds and handled ambiguous cases (1 report). Under both sits the same arithmetic: how sure a pass rate is, whether one model beats another on the same questions, how many questions that takes, and how reliable an agent is over several tries. This is practice in that shape, not a leaked question.
Set a 35-minute timer. Read one level at a time, and run only that level's tests until they pass:
pytest problems/41_eval_stats -k level1. Earlier levels must keep passing.
Level 1. One pass rate. pass_rate_ci(passed, z=1.96) takes one True or False per question and returns
(rate, low, high). The standard error of a rate p on n questions is sqrt(p × (1 - p) / n), and the interval is
z standard errors either side of p. Don't clip it to 0 and 1.
Level 2. Two models on the same questions. paired_difference(a, b, z=1.96) takes two lists graded on the
same questions in the same order. Each question gives a difference of 1, 0 or -1 (a's result minus b's). Return
(mean, low, high): the mean difference, and z standard errors either side, where the standard error is the square
root of the differences' variance (the mean squared distance from their mean) divided by n. verdict(a, b, z=1.96)
returns "a better" when the whole interval is above 0 (low > 0), "b better" when it's below (high < 0), and
"can't tell" otherwise. An interval that touches 0, like (0, 0) for two identical runs, is "can't tell". Pass
z on to the interval.
questions_needed(split, half_width, z=1.96) returns how many questions make the interval half_width wide either
side, when the two models disagree on a share split of them: z² × split / half_width², rounded up.
Level 3. Several tries per task. An agent tried one task n times and passed c of them. pass_at_k(n, c, k)
returns the chance that at least one of k tries drawn from those n without replacement passed:
1 - C(n - c, k) / C(n, k), where C counts the ways to choose. pass_hat_k(n, c, k) returns the chance that all k
passed: C(c, k) / C(n, k). Both raise ValueError unless 0 <= k <= n, so k = 0 and k = n are allowed.
Things to get right: the paired standard error, not the one for two separate samples; the verdict needs the interval, not just the sign; rounding questions up; and drawing tries without replacement. Follow-ups from the lesson: questions that come in groups, resampling one question several times, and a judge's threshold with a band for people.