Your eval suite reports 87% on Monday and 84% on Tuesday, and nothing changed. Someone re-runs it and gets 86%. The team learns to shrug at movements of a few points, which means a real two-point regression now hides in the noise. Most advice about this focuses on the aggregate: run more cases, compute a confidence interval. That helps, but it skips a cheaper and more actionable question: which individual cases are the noisy ones? In most suites the noise is not spread evenly. A minority of cases flip between pass and fail from run to run, and they account for most of the wobble in the headline number.

This article shows how to measure that per case, sort cases into three buckets, and handle each bucket differently. It is about eval cases, not about the model's overall nondeterminism; the goal is a suite whose failures mean something.

Why flaky cases are a different problem from a noisy average

A case can be unstable for several unrelated reasons, and the fix depends on which one it is:

  • The task is borderline. The model succeeds about half the time because the prompt, or the model, is at the edge of what it can do. This is real information about your product, not a defect in the test.
  • The grader is unstable. An exact-match check on free text, a regex that is sensitive to phrasing, or an LLM judge with a vague rubric can disagree with itself on near-identical outputs. Here the case is flaky but the model is fine.
  • The case depends on something that moves. A live web fetch, the current date, a retrieval index that is rebuilt nightly, a tool that returns results in arbitrary order. The input is not actually the same input each run.
  • The expected answer is underspecified. Two reasonable answers exist and the grader accepts only one.

Averaging hides all four. If you only look at the overall pass rate, a grader bug and a genuinely hard task look the same: a case that "sometimes fails." Splitting them apart is the whole point of the exercise.

Measure it: repeat every case, then bucket by outcome

The mechanism is simple. Run each case k times against the same prompt and model, record pass or fail for each repeat, and classify by the pattern. For most suites k=5 is a reasonable start: enough to see disagreement, cheap enough to run on a subset nightly.

from collections import defaultdict

def run_repeats(cases, run_case, k=5):
    """run_case(case) -> bool. Returns {case_id: [bool] * k}."""
    out = defaultdict(list)
    for case in cases:
        for _ in range(k):
            out[case["id"]].append(bool(run_case(case)))
    return dict(out)

def classify(results):
    report = {"stable_pass": [], "stable_fail": [], "flaky": []}
    for cid, runs in results.items():
        passes = sum(runs)
        if passes == len(runs):
            report["stable_pass"].append(cid)
        elif passes == 0:
            report["stable_fail"].append(cid)
        else:
            report["flaky"].append((cid, passes, len(runs)))
    return report

Run it with your normal sampling settings, not with a special low-temperature configuration. The point is to measure the variability your production traffic will see. If your eval runs at one setting and production at another, you are measuring a different system.

The three buckets mean different things:

  • Stable pass (k of k). Probably healthy, with a caveat covered below.
  • Stable fail (0 of k). A consistent failure. Either the model really cannot do this, or the case or grader is wrong in a repeatable way. Both are worth a look, and both are easier to debug than flakiness because the failure reproduces.
  • Flaky (some of k). The interesting bucket. Sort it by pass count and read the extremes first.

Read the flaky cases, and sort them by cause

For each flaky case, pull the k outputs side by side with the grader's verdict on each. You are looking for one of three signatures.

Outputs differ in substance, verdicts match the substance. Two runs gave materially different answers and the grader correctly marked one wrong. This is a borderline task. Keep the case, and treat its pass rate as a measurement. A case that passes 3 of 5 is telling you the feature is unreliable at that task. That is a prompt or model problem to work on, and it should stay in the suite precisely because it is not solved.

Outputs are equivalent, verdicts differ. Two runs gave answers a human would accept equally, and the grader disagreed. This is a grader bug. Loosen the check to compare what matters (a parsed field, a normalized value, a set of required claims) rather than the surface string. If the grader is an LLM judge, tighten the rubric until it states what to accept and what to reject, and spot-check it against a few labeled examples.

Inputs differ across runs. Log the full rendered input for every repeat and diff them. If the prompt text, retrieved documents or tool results are not identical, the case is not a fixed test. Freeze the volatile input: stub the clock, snapshot the retrieved documents, sort tool results. A case that cannot be frozen belongs in a separate monitoring set, not in the regression suite.

A quick triage loop is to print, per flaky case, the number of distinct normalized outputs alongside the pass count. One distinct output with mixed verdicts points at the grader. Many distinct outputs with mixed verdicts points at the task. Many distinct inputs points at the harness.

What "5 of 5" does and does not prove

Stable-pass deserves a caveat, because repeated runs give less certainty than they seem to. Suppose a case truly passes 90% of the time. The chance it passes all five repeats is 0.9^5, about 0.59, so more than half the time you would label a 90%-reliable case "stable." Even at a 95% true pass rate, five clean repeats happen only about 77% of the time (0.95^5). Going the other way, a coin-flip case with a true pass rate of 50% lands all-pass or all-fail only 2 × 0.5^5, about 6%, of the time, so true coin flips are caught reliably.

The practical reading: repeats are good at exposing serious flakiness and poor at certifying high reliability. Label the bucket "no instability observed in k runs," not "reliable." If a particular case guards something critical and you need a real reliability claim, run it many more times, or treat it as an estimate with an interval rather than a binary flag.

This is also why the technique complements, rather than replaces, aggregate confidence intervals. Repeats tell you where the noise lives; intervals tell you how much movement in the total you can trust.

Policy: what to do with each bucket

Decide the handling in advance, so it does not get relitigated on every red build.

  1. Gate on stable cases only. Let the pull-request check fail on regressions in stable-pass cases (one that passed k of k before and fails now is a strong signal). Rerun a failing stable case a few times before blocking, because a single failure of a case with true pass rate 95% will occasionally happen.
  2. Track flaky cases as rates, not verdicts. Report "3/5 → 2/5" for the borderline-task group. Do not make them block merges; make them a trend line you review weekly.
  3. Quarantine, don't delete. A case that is flaky because of a grader or input bug goes into a quarantine list with an owner, the cause and a date. Quarantined cases still run but do not count toward the headline score. Without the date, quarantine becomes a graveyard.
  4. Fix the grader before the prompt. If equivalent outputs get different verdicts, no prompt edit will help, and prompt edits made to chase grader noise are the kind that quietly make the product worse.
  5. Re-measure after any model, prompt or harness change. Stability is a property of the whole setup. A case that was solid last month can become flaky after a provider-side model change.

The trade-off is cost: k repeats multiply your eval spend by k. Contain it by running repeats on the full suite nightly or weekly, and the single-run version on every pull request, using the stability labels from the last full run to decide which cases may fail a build.

Checklist

  • Run every case k times (start with 5) under production sampling settings.
  • Bucket by pattern: stable pass, stable fail, flaky.
  • For each flaky case, compare outputs, verdicts and rendered inputs across repeats.
  • Output equivalent but verdicts differ: fix the grader. Inputs differ: freeze them or move the case to monitoring. Outputs genuinely differ: keep it and track the pass rate.
  • Remember that k clean runs shows no observed instability, not high reliability.
  • Gate merges on stable cases; trend the flaky ones; quarantine with an owner and a date.
  • Re-measure stability after every model, prompt or harness change.