Non-determinism: pass@k & variance
Same input, different outputs: one eval run is a sample, not a measurement. Run several trials, report mean ± confidence interval, and choose pass@k (any success) or pass^k (every success) to match real use.
Analogy: A 70% free-throw shooter goes 5/10 one day and 9/10 the next. You judge them over hundreds of shots, and "makes at least one of three" is a very different claim from "makes all three".
How it works
- Temperature 0 doesn't fix it: GPU batching changes floating-point sums, a near-tie token flips, and answers diverge.
- A pass rate's 95% CI is ±~10 points at n=100 and 50%; halving it takes 4× the items.
- Reliability compounds: at 90% per independent trial, pass^3 is only ~73%.
- Flaky items pass and fail across trials; read them, because they often expose ambiguous specs.
- Compare versions on the same items with the paired difference: it cancels item difficulty and gives a tighter CI.
Check yourself
Answer to mark it learned; your answers aren't scored.
Your eval has 100 tasks, each run 5 times. A teammate computes the 95% CI of the pass rate with n = 500 and says v2's +4-point lead over v1 is significant. What's wrong?
Go deeper
Full explanation
An LLM system can return different outputs for the same input, so a single eval run is one draw from a distribution. Every score is an estimate and needs error bars.
Temperature 0 doesn't fix it. GPU kernels sum floating-point numbers in an order that depends on batch size, and on a shared API your batch depends on other people's traffic. A tiny difference flips a near-tie token and the rest of the answer diverges. Provider seed parameters are best-effort, and silent model updates add drift.
What to report:
- Mean ± 95% CI over tasks. A pass rate's standard error is √(p(1−p)/n): at n=100 and 50%, the interval is ±~10 points. Halving it takes 4× the items.
- pass@k: chance that at least one of k attempts succeeds. Fits when something picks the winner: unit tests, a user choosing a draft.
- pass^k: chance that all k succeed, i.e. reliability. At 90% per trial, pass^3 is only ~73% (if trials are independent).
- Flaky items: tasks that both pass and fail across trials. Read them; they often expose ambiguous specs.
To compare two versions, run both on the same items and compute the CI of the paired difference: it cancels item difficulty and is far tighter than two separate intervals.
Code Wilson CI, pass@k and pass^k from repeated trials
import math
import numpy as np
def wilson_ci(successes: int, n: int, z: float = 1.96) -> tuple[float, float]:
# Stays inside [0, 1] and behaves near 0% / 100%, unlike p ± z*SE
p = successes / n
denom = 1 + z**2 / n
center = (p + z**2 / (2 * n)) / denom
half = z * math.sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / denom
return center - half, center + half
def pass_at_k(n: int, c: int, k: int) -> float:
# Unbiased estimator (Chen et al., 2021): n trials, c successes, >= 1 of k
return 1.0 if n - c < k else 1 - math.comb(n - c, k) / math.comb(n, k)
def pass_hat_k(n: int, c: int, k: int) -> float:
# pass^k (tau-bench): all k trials succeed = reliability
return math.comb(c, k) / math.comb(n, k)
def report(runs: dict[str, list[bool]], k: int = 3) -> dict:
# runs[task_id] = outcome of each of n trials (e.g. n=5)
rates = np.array([sum(r) / len(r) for r in runs.values()])
# CI over TASKS, not trials: 100 tasks x 5 trials is not n=500
se = rates.std(ddof=1) / math.sqrt(len(rates))
return {
"mean": rates.mean(),
"ci95": (rates.mean() - 1.96 * se, rates.mean() + 1.96 * se),
f"pass@{k}": np.mean([pass_at_k(len(r), sum(r), k) for r in runs.values()]),
f"pass^{k}": np.mean([pass_hat_k(len(r), sum(r), k) for r in runs.values()]),
"flaky": [t for t, r in runs.items() if 0 < sum(r) < len(r)],
}
print(wilson_ci(50, 100)) # (0.404, 0.596): ±~10 points at n=100Real example
Prompt v2 of a booking agent scores 78% vs v1's 74% on 150 tasks, one run each, and the team wants to ship. Rerunning both 5 times shows v1 ranging 71–77% and v2 73–80%. The paired difference is +2.1 points, 95% CI [−0.8, +5.0]: not proven. pass^5 tells another story: v1 completes 61% of tasks on all five trials, v2 only 52%, so v2 is more capable but less reliable. Of the 23 tasks that flip between pass and fail, 14 have ambiguous instructions: fix the dataset before choosing a prompt.
Trade-offs +3 · −3
+ You gain
- Stops you shipping or reverting on noise: a 3-point "win" at n=100 is usually nothing.
- pass^k exposes unreliability that a single-run average hides.
- Flaky items point straight at ambiguous tasks and brittle prompts.
− You pay
- k trials multiply eval cost and wall-clock time by k.
- Real precision needs hundreds of items; small sets give wide intervals.
- Trials of the same task are correlated, so naive pooled CIs look tighter than they are.
Use it when
Any comparison you will act on: model swaps, prompt changes, release gates. Use pass^k for agents and unattended workflows; pass@k when a verifier or a human picks the best of k.
Avoid it when
Very early exploration, where reading 20 traces teaches more than any interval, or when a change is so large (20+ points) that one run already settles it.
Numbers to know 4
- 95% CI half-width ≈ 1.96·√(p(1−p)/n): at 50%, n=100 → ±~10 pts; n=400 → ±~5; n=1,000 → ±~3.
- pass^k ≈ p^k for independent trials: 90% per run → ~73% for 3 in a row, ~59% for 5.
- Codex (2021): 28.8% of HumanEval with 1 sample, 70.2% with 100 samples per problem.
- τ-bench (2024): GPT-4o solved <50% of tasks, and pass^8 fell below 25% in the retail domain.
Common pitfalls 4
- Declaring a winner from one run per variant on 50–100 items.
- Pooling trials into one big n: 100 tasks × 5 trials is not n=500 for the CI.
- Assuming temperature 0 or a seed makes runs reproducible across batches, hardware or provider updates.
- Reporting pass@k for an agent that gets exactly one shot in production.
Interview questions 3
Answer out loud first, then reveal.
Your new prompt scores 3 points higher on the eval. Do you ship it?Show answer
Not on that alone. First I ask for n and the number of runs: at 100 items, a 50% pass rate has a ±10-point 95% interval, so 3 points is inside the noise. I'd rerun both variants on the same items with several trials each and compute the CI of the paired per-item difference, which cancels item difficulty and is much tighter. If it still includes zero, I either grow the set or call them equal and decide on cost and latency. I'd also check per slice, because a flat average can hide a regression in one category.
pass@k vs pass^k: when do you use each?Show answer
pass@k is the chance that at least one of k attempts succeeds. It fits when something downstream picks the winner: unit tests selecting among k code samples, or a user choosing among drafts. pass^k is the chance all k succeed, which is the reliability a customer feels when an agent runs the same kind of task every day. They diverge fast: 70% per trial is ~97% pass@3 but ~34% pass^3. For unattended agents I gate on pass^k; reporting pass@k there sells capability the user never gets.
Why isn't temperature 0 deterministic?Show answer
Because the arithmetic isn't. Floating-point addition isn't associative, and GPU kernels reduce in orders that depend on batch size and how work is split; on a shared API your batch size depends on other tenants' load. A tiny numeric difference flips a near-tie token, and from there the continuation diverges. Seeds are best-effort and providers update models. So I never treat one run as ground truth: I pin model snapshots so the weights don't move, and design evals to tolerate variance with repeated trials.