Explain the pass@k metric and why the unbiased estimator matters for code gen evaluation
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Explain the pass@k metric for code generation evaluation. Why is the naive estimator (randomly pick k samples and check if any pass) high-variance, and how does the unbiased estimator correct for this?
pass@k is the chance at least one of k code samples passes the tests. Estimate it from n samples with the unbiased Codex formula, not a single random draw of k, which is high-variance.
Imagine a student who solves a tricky problem correctly about a third of the time. pass@k asks: if they get k attempts and we keep the best one, how often does at least one attempt work? You could measure this the lazy way: have them try exactly k times and see if any passed. But that's a coin flip with few tosses, so the number bounces around wildly between problems. The smarter way is to let them try many more times, count how many attempts succeeded overall, and do the arithmetic for what k tries would give. Using all those extra attempts makes the estimate steady instead of jumpy. It also reminds you that one lucky success out of many is not the same as a student who reliably gets it right.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: define pass@k, motivate k=1 versus oracle k, show why the plug-in and single-k draw are biased and noisy, derive the closed-form estimator, and cover what pass@k hides.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Estimating pass@k by drawing k samples once and checking if any pass. That single Bernoulli trial is high-variance, so two models can swap ranks just from sampling luck.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.