Practical technical guides / AI engineering: evaluation statistics (clustered eval cases)

Twenty Paraphrases of One Case Are Not Twenty Cases: Cluster-Aware Intervals for Eval Pass Rates

Forty scenarios with ten variants each: the naive 95 percent interval covered the true pass rate 78 percent of the time. Design effect, cluster-robust intervals and pairing.

By Sandeep Belgavi · Published 2026-11-11

Forty scenarios with ten variants each: the naive 95 percent interval covered the true pass rate 78 percent of the time. Design effect, cluster-robust intervals and pairing.

Four hundred rows, forty scenarios

Tanishka builds the evaluation set for the help-desk agent at Belgavi's Book Store. To make the set harder to game, each of 40 scenarios (a late return, a damaged parcel, a duplicate charge, and so on) is written ten ways: different phrasing, a different customer tone, an extra irrelevant detail. That gives 400 rows, and the latest run passes 275 of them, 68.8 percent.

The reporting script prints a 95 percent interval of 64.2 to 73.3 percent, the usual binomial interval for 400 independent trials. The next model version scores 72 percent, inside the old interval but close to its edge, and someone asks whether that is a real improvement.

The interval is the problem. The 400 rows are not 400 independent trials. Variants of the same scenario tend to pass or fail together, because the thing being tested, whether the agent handles a damaged-parcel CASE correctly, is the same in all ten. The real number of independent observations is much closer to 40 than to 400, and the honest interval for this run is 61.5 to 76.0 percent: more than one and a half times as wide.

Why variants are correlated

Each scenario has its own difficulty. For a given model, some scenarios are almost always solved, some almost never, and the variants mostly move a run around within the scenario's difficulty. Statisticians call this a clustered sample: units (rows) come in groups (scenarios) that share something.

The share of the variance in outcomes that sits between scenarios rather than within them is the intra-cluster correlation, written rho. If rho is 0, variants are as independent as unrelated cases. If rho is 1, all ten variants of a scenario always agree, and you effectively have 40 observations, each counted ten times.

Kish's design effect turns rho into a correction. With m rows per cluster, the variance of the mean is inflated by

DEFF = 1 + (m - 1) * rho

and the effective sample size is the row count divided by DEFF. For ten variants and rho = 0.2, DEFF is 2.8: 400 rows carry the information of about 143 independent ones. The standard error grows by the square root of DEFF, about 1.67.

Evan Miller's 2024 paper "Adding Error Bars to Evals" makes the same point for language model evaluations, recommending clustered standard errors whenever questions come in groups, such as several questions about one passage.

Measuring it on a seeded simulation

The companion simulates the situation exactly. Each of 40 scenarios gets a pass probability drawn from a beta distribution with mean 0.7 and concentration 4, which implies a true rho of 1 / (4 + 1) = 0.2. Each scenario then has ten variants that pass independently with that scenario's probability.

One simulated run gives:

QuantityValue
Pass rate0.688
Estimated rho (one-way ANOVA)0.174
Design effect2.57
Effective rows156
Naive normal interval0.642 to 0.733
Wilson interval0.640 to 0.731
Cluster-robust interval0.615 to 0.760
Cluster bootstrap interval0.613 to 0.755

The naive and Wilson intervals agree with each other, and both are too narrow. The Wilson interval fixes a different problem, poor behaviour near 0 or 1 for small samples; it does nothing about correlation.

One run cannot show that an interval is wrong. The coverage check can: repeat the whole experiment 500 times and count how often each 95 percent interval contains the true mean pass probability, 0.7.

DesignNaiveWilsonCluster-robustCluster-robust with tCluster bootstrap
40 scenarios x 10 variants, rho 0.20.7760.7660.9380.9400.936
400 scenarios x 1 variant0.9480.9420.9480.9480.950
10 scenarios x 40 variants, rho 0.20.4780.4720.9020.9400.896

With independent rows every method is close to 95 percent, as it should be. With ten variants per scenario, the naive 95 percent interval covers the truth only about 78 percent of the time. With 10 scenarios of 40 variants, it covers it less than half the time: the interval is about as wide as before, because it still sees 400 rows, but the information is that of a few dozen.

Three ways to compute an honest interval

Cluster-robust standard error. With equal cluster sizes, compute each scenario's pass rate, take the standard deviation of those scenario means, and divide by the square root of the number of scenarios. That is the standard error of the overall mean, and it already includes the between-scenario variation.

import math

def cluster_robust_interval(clusters, z=1.96):
    k = len(clusters)
    means = [sum(c) / len(c) for c in clusters]
    p = sum(means) / k
    var = sum((m - p) ** 2 for m in means) / (k - 1)
    se = math.sqrt(var / k)
    return p - z * se, p + z * se

With unequal cluster sizes, use the general clustered (sandwich) estimator that weights clusters by size; most statistics packages provide it.

Use a t value with few clusters. The standard error is estimated from k scenarios, so with small k the normal 1.96 is too small. With 10 scenarios the t critical value for 9 degrees of freedom is 2.262, and the table shows it raises coverage from 0.902 to 0.940.

Cluster bootstrap. Resample whole scenarios with replacement, recompute the pass rate each time and take the 2.5th and 97.5th percentiles. Resampling rows instead of scenarios would reproduce the naive interval, so the unit of resampling is the whole point. The bootstrap has the same small-k weakness as the plain robust interval: 0.896 coverage with 10 scenarios.

Comparing two model versions

The same correction applies to differences. When two versions run on the same scenarios, compute the difference per scenario (version B's pass rate minus version A's on that scenario's variants), then take the mean and standard error of those differences. Pairing by scenario removes the scenario difficulty from the comparison and usually narrows the interval a lot, while still respecting the clustering. Comparing two independent row-level proportions does neither.

For Tanishka's question, the move from 68.8 to 72 percent is a difference of about 3 points with a cluster-robust standard error of roughly 3.7 points per run before pairing. That is not evidence of improvement on its own. A paired per-scenario comparison is the right next step.

More scenarios or more variants

The design effect also tells you how to spend an evaluation budget. With rho = 0.2 and a budget of 400 rows:

DesignDEFFEffective rows
400 scenarios x 1 variant1.0400
80 scenarios x 5 variants1.8222
40 scenarios x 10 variants2.8143
10 scenarios x 40 variants8.845

Variants are not useless: they test robustness to phrasing, which a single wording cannot, and they let you measure rho at all. But each new scenario adds far more information about the pass rate than another variant of an existing one. A reasonable default is a few variants per scenario and as many scenarios as you can write well.

A checklist for eval reports

  • Record the cluster of every row: the scenario id, the source document, the conversation.
  • Report the number of clusters next to the number of rows.
  • Estimate rho for each run and report the design effect.
  • Use cluster-robust intervals or a cluster bootstrap, with a t value when there are fewer than about 30 clusters.
  • Compare versions per cluster, paired.
  • Treat grader repeats separately. If each output is graded several times, those repeats are another level of clustering; average them per output first.

Limits

The simulation assumes equal cluster sizes, a beta distribution of scenario difficulty and variants that are independent within a scenario. Real evaluation sets have unequal clusters, variants that differ in difficulty in structured ways, and graders with their own noise. The coverage numbers come from 500 simulated repetitions each and carry their own sampling error of about one percentage point. The method, not the exact numbers, is the point.

Primary references and authorship

Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/clustered_eval_intervals. Views are my own and do not represent any employer, past or present.