Evaluation lab · San Francisco · London · Zürich
Reinforced Labs Request a briefing
Research note

Your benchmark's error bars are too narrow: clustered standard errors for LLM evals

A 1,000-question benchmark built from 100 passages can carry the information of a few hundred independent questions. We show how to measure the design effect, compute clustered standard errors and compare models on paired differences, with seeded simulations.

Most benchmark scores are reported with an error bar computed as if every question were an independent draw. They rarely are. Reading-comprehension questions share passages, synthetic suites are stamped out from templates, and many harnesses sample several answers per prompt. When items arrive in correlated groups, the honest standard error can be twice the naive one or more, and a "significant" gap between two models can be nothing but which passages happened to land in the test set. This note shows how big the effect is, how to compute clustered standard errors and paired differences correctly, and how to tell from your own data whether you need them. Every number below comes from a seeded simulation we ran for this article.

A 1,000-question benchmark that is really 100 observations#

Take a reading-comprehension test built the way SQuAD was [1]: annotators read a passage and write several questions about it. Suppose the test set has 100 passages with 10 questions each, so items, and a model answers 70% of them correctly. The textbook binomial standard error is percentage points, so the 95% interval is about points.

Now look at how a model actually fails on such a test. If it misreads a dense legal passage, it tends to miss several of that passage's questions. If a passage is about a topic heavily represented in pretraining, it tends to get most of them. Questions inside a passage are positively correlated. A second sample of 100 passages would give a noticeably different score, more different than a fresh draw of 1,000 independent questions would. The binomial formula answers the wrong question: it measures the noise from re-drawing questions while holding the passages fixed, but the passages are also a sample.

The same structure shows up across modern evaluation:

  • Shared context. Passages, documents, long-context haystacks, code repositories with many tests, conversations with several turns graded separately.
  • Shared templates. Synthetic math or reasoning items generated by filling slots in a few hundred templates; red-team prompts produced by mutating a smaller set of seed attacks.
  • Repeated sampling. Running each prompt times at nonzero temperature and averaging. The prompt is the cluster and the samples are far from independent.
  • Shared annotators or sources. All items written by the same contractor, scraped from the same site or translated by the same pipeline.

The design effect#

Survey statisticians solved this problem for household surveys, where interviewing ten people on the same street gives less information than ten people from ten streets. Kish named the variance inflation the design effect [2]. Write for the 0/1 score on question in cluster , with clusters of equal size , so . Let be the item variance and the intra-cluster correlation (ICC): the correlation between the scores of two different questions in the same cluster. Then the variance of the benchmark mean is

Here for a 0/1 score with accuracy , is the number of questions, the questions per cluster, and the ICC. The derivation is short: the variance of a cluster total is from the diagonal plus from the off-diagonal covariances, and the mean averages independent cluster totals. Intuitively, each extra question in a cluster adds only a fraction of new information, because a share of its outcome was already predictable from its siblings.

A useful restatement is the effective sample size

the number of independent questions that would give the same precision. When you get back. When , every question in a cluster is a copy of the others and : you have exactly as many observations as clusters.

Worked example#

With , , and , the design effect is . The effective sample size is questions. The standard error grows by , from 1.45 to 2.42 points, and the 95% half-width grows from to points. An ICC of 0.2 is not extreme for items that share a passage or a template; it means that knowing the model got one question in a passage right shifts your belief about a sibling question noticeably, nothing more.

Two features of the formula matter in practice. First, the damage scales with , so a tiny ICC can still dominate when clusters are large: with 50 items per cluster gives a design effect of about 2. Second, clusters of unequal size make things worse. A standard approximation is , where is the mean cluster size and the coefficient of variation of cluster sizes, so a handful of very large clusters can carry the whole variance.

How wrong are naive intervals? A simulation#

Setup (simulation). We generated benchmarks of binary items with true accuracy 70%, split into clusters of size . Each cluster has its own accuracy drawn from a beta distribution with mean 0.7 and ICC (the beta-binomial model, where ), and items are Bernoulli draws from their cluster's accuracy. For each of 4,000 replications per setting we built two 95% intervals: the naive binomial interval and a clustered interval (defined in the next section) with a critical value. Coverage is the share of intervals containing 70%.

30%50%70%90%100%00.020.050.10.20.3nominal 95%naive, m=5naive, m=10naive, m=20naive, m=50clustered, m=50Intra-cluster correlation ρCoverage of nominal 95% CI
Figure 1. Simulated coverage of nominal 95% intervals for a 1,000-item benchmark (4,000 replications per point). Naive intervals fall far below 95% as soon as items cluster; the clustered interval (dashed, shown for the worst case ) stays at nominal coverage across the whole range. Clustered coverage for the other cluster sizes is similar and omitted for legibility.

At and , the naive "95%" interval covers the truth 83.4% of the time. At it covers 76.0%. With 50 items per cluster and , coverage is 45.0%: the advertised 95% interval is wrong more often than it is right. The simulated coverage tracks the analytic prediction closely (44.9% predicted for that cell), which is what the interactive figure below uses. The clustered interval stays between 94.1% and 95.5% in every cell we ran. Clustered standard errors do not shrink the uncertainty; they report the uncertainty that was always there.

Computing clustered standard errors#

You do not need to know to correct the interval. The clustered sandwich variance estimator of Liang and Zeger [3] sums residuals within each cluster before squaring, so any within-cluster correlation is absorbed automatically:

Here is the number of clusters, the number of items, and the inner sum is cluster 's total residual. The factor is a small-sample correction. If items within a cluster are independent, the cross terms average to zero and the estimator agrees with the naive one; if they are positively correlated, the cluster totals are more spread out and the variance grows to match. For a plain mean this is the same as treating each cluster's mean as one observation, weighted by its size.

The design effect is still worth estimating, because it tells you how much a new benchmark will cost. The one-way ANOVA estimator of the ICC is

where MSB is the mean square between cluster means (scaled by ) and MSW is the mean square of items around their own cluster mean. It compares how much cluster averages differ against how much they would differ if items were shuffled at random.

When you have few clusters#

The clustered estimator is a large- approximation. Its effective degrees of freedom are closer to the number of clusters than to the number of items, a point Cameron and Miller stress in their practitioner's guide [4]. We reran the simulation with , , and between 5 and 100 clusters, comparing the naive interval, the clustered interval with a normal critical value, the same with a critical value, and a cluster bootstrap that resamples whole clusters (400 resamples, 1,000 replications; the other columns use 4,000).

Clusters Items NaiveClustered, normalClustered, Cluster bootstrap
55079.5%84.8%92.9%83.7%
1010083.8%91.1%94.5%90.2%
2020082.8%93.0%94.2%91.5%
5050083.8%93.7%94.1%92.8%
1001,00085.2%94.9%95.3%94.1%

With 5 clusters, even the clustered interval with a normal critical value covers only 84.8%, and the percentile cluster bootstrap does no better. Switching to recovers most of the gap (92.9%). From about 20 clusters the corrected intervals are close to nominal. With fewer than about 20 clusters, use critical values at minimum, and consider the wild cluster bootstrap of Cameron, Gelbach and Miller [5], which was designed for exactly this regime. Note that the naive interval does not approach 95% as grows: its coverage is set by the design effect, not by the sample size.

Comparing two models: pair first, then cluster#

Leaderboards are about differences, and the difference between two models has its own structure. Both models answer the same questions, so the natural statistic is the per-question difference , where and are the two models' 0/1 scores on question . Its variance is

where and are the item-level variances of each model's score, is their covariance across questions, and is the ICC of the differences. Two forces act in opposite directions. Pairing removes shared difficulty: hard questions are hard for both models, so and the difference is far less noisy than two independent accuracies. Clustering of the difference comes from model-by-cluster interaction: model A happens to be better at legal passages and B at sports, so their gap varies by cluster. That interaction is exactly what changes if you redraw the passages.

Setup (simulation). Two identical models (same expected accuracy, about 71%) answer passages of questions. A question is answered correctly when a latent score exceeds zero; the score is the sum of a shared passage difficulty (s.d. 0.8), a shared question difficulty (s.d. 0.8), a model-specific passage effect with s.d. , and independent noise. We vary and, over 4,000 replications each, count how often three two-sided 5% tests declare a winner: the naive unpaired two-proportion test, a naive paired test on , and a paired test with clustered standard errors.

0%5%10%15%20%25%155σ_t=0ρ_d=0.00266σ_t=0.15ρ_d=0.01495σ_t=0.3ρ_d=0.046145σ_t=0.45ρ_d=0.0811185σ_t=0.6ρ_d=0.1318245σ_t=0.8ρ_d=0.20unpaired, naivepaired, naivepaired, clusteredFalse-win rate (true gap = 0)
Figure 2. False-win rate between two identical models, by test, as model-by-passage variation grows (4,000 simulated benchmarks per group; is the estimated ICC of the per-question differences). Only the paired, clustered test holds its 5% error rate. Values are percentages.

Three things stand out. When there is no model-by-passage interaction (), the naive unpaired test is badly conservative: it rejects only 1.4% of the time, because it ignores the shared difficulty that pairing would cancel. That same test then becomes anti-conservative once models differ by passage: at , where , it declares a winner 17.8% of the time. The two errors partly cancel, which is why the unpaired naive test can look fine on one benchmark and fail on another. The naive paired test gets the pairing right but ignores clustering, and its false-win rate climbs from 4.8% to 24.5%, matching the analytic . The paired clustered test stays between 4.9% and 5.5% throughout.

Note the modest ICCs involved. A difference ICC of 0.08 already turns a 5% test into a 14% test at . Within a single model, scores in the same simulation had ICCs of 0.17 to 0.27, mostly from shared difficulty, which pairing removes; what is left for the difference is the smaller interaction term.

Pairing buys power back#

Clustering widens intervals, but pairing narrows them, and the net is usually favourable. In the same simulation with , we gave model A a real advantage and measured one-sided power at the 2.5% level for a clustered unpaired comparison (each model's clustered standard error, combined as if independent) and the paired clustered test.

True gap (points)Unpaired, clustered: powerPaired, clustered: powerStandard error of gap, unpaired vs paired (points)
0 (no real gap)0.0%2.2%3.31 vs 1.89
+1.10.2%8.8%3.29 vs 1.88
+2.21.5%21.5%3.26 vs 1.87
+3.24.5%39.7%3.24 vs 1.86
+4.313.9%62.6%3.21 vs 1.85

For a true gap of about 2.2 points, the paired clustered test detects it 22% of the time against 1.5% for the unpaired clustered comparison, because the standard error of the gap falls from 3.3 to 1.9 points. The lesson generalises: never compare two models with separate per-model error bars. Compute the per-question difference, then cluster it. Card and colleagues show that many NLP comparisons are underpowered even before clustering is considered [6], so it is worth knowing which design gives you power back.

Explore the design effect#

The figure below uses the article's formulas directly. The top panel shows the 95% interval for one model at 70% accuracy, naive against clustered. The middle panel draws 40 comparisons of two identical models whose true sampling spread includes the design effect, each with the naive paired interval; red rows are the comparisons a naive test would report as a win. The bottom panel is the analytic false-win rate as a function of for the chosen cluster size. For simplicity a single drives both the score and the difference.

95% interval for one model at 70% accuracy60%65%70%75%80%Naive (items independent) ±2.8 ptsClustered (DEFF 2.80) ±4.8 pts40 comparisons of two identical models-8-40+4+8Observed accuracy gap A minus B (points), naive 95% interval; red = declared a winnernominal 5%0.00.10.20.30.40.560%0%Naive false-win rate against ρ (0 to 0.5) at m = 10
0.20 10

Figure 3 (interactive). Design effect , naive and clustered 95% intervals, and the naive false-win rate for two identical models. The static version shows , , : a 24.1% false-win rate, and 5 of 40 drawn comparisons flagged. Increasing shrinks both intervals but leaves the false-win rate unchanged, because it depends only on the design effect.

Try raising with and fixed. Both intervals narrow, but the ratio between them and the false-win rate do not move. Scaling up a benchmark makes the honest interval smaller; it never makes the naive interval honest. Only computing the variance at the cluster level does that, and only reducing or lowers the price you pay per question.

What to do in practice#

A checklist for benchmark reports#

  1. Write down the sampling unit. Ask what would change if someone rebuilt the benchmark: new passages, new templates, new seed prompts, new repositories. That unit is your cluster. Abadie, Athey, Imbens and Wooldridge argue that clustering should follow the sampling or assignment design rather than whatever grouping is available [7]; for a benchmark, the design is how items were generated.
  2. Keep the cluster id in the results file. Most harnesses drop it. Without it, nobody can compute the right interval later.
  3. Report the ICC and design effect alongside accuracy, so readers can see how much the benchmark is worth in independent items.
  4. Compare models on paired differences with clustered standard errors. Use critical values, and the wild cluster bootstrap if is below about 20.
  5. Treat repeated samples as a cluster level. If you sample answers per prompt, cluster at the prompt (or at the passage, if prompts are nested in passages; cluster at the coarsest level that was sampled).
  6. Plan benchmark size in clusters, not items. When is sizeable, writing a 20th question for a passage buys almost nothing; a new passage with five questions buys a lot.
SituationCluster onNotes
Several questions per passage or documentPassageEstimate ; large passages dominate the design effect
Templated or programmatically generated itemsTemplateFew templates means few clusters; use or wild bootstrap
samples per prompt at temperature above zeroPromptOr average per prompt first, then treat prompts as items
Multi-turn conversations graded per turnConversationLater turns depend on earlier ones
Single-topic benchmark of independently written itemsItem (no clustering)Check by author or source anyway

Code#

The whole correction is a few lines once the cluster id is kept with each score:

import numpy as np
from scipy import stats

def paired_clustered_diff(a, b, cluster):
    """a, b: 0/1 scores of two models on the same items; cluster: id per item."""
    d = np.asarray(a, float) - np.asarray(b, float)
    ids, inv = np.unique(cluster, return_inverse=True)
    K, N = len(ids), len(d)
    resid_totals = np.bincount(inv, weights=d - d.mean())
    se = np.sqrt(K / (K - 1) * (resid_totals ** 2).sum() / N ** 2)
    t = stats.t.ppf(0.975, K - 1)
    return d.mean(), (d.mean() - t * se, d.mean() + t * se)

The same function with gives the clustered interval for a single model. Regression packages that offer clustered sandwich covariance give identical answers for an intercept-only model.

Failure modes#

  • Clustering at the wrong level. Clustering by subject on a benchmark whose items were written independently inflates intervals for no reason, and with only a few dozen subjects the estimate is noisy. Clustering by question when passages were the sampled unit under-corrects. Use the generating process, not the folder structure.
  • Too few clusters. A benchmark built from 8 templates has, at most, 8 observations' worth of between-template information. No estimator rescues that; report it honestly and add templates.
  • Averaging away the structure. Reporting per-category accuracies and then averaging them with a naive interval reintroduces the problem one level up.
  • Ignoring other variance sources. Clustering handles item sampling. Seed and sampling noise in the model itself is a separate component; Madaan and colleagues measured seed variance across many models and benchmarks and recommend factoring it in before comparing models [8]. Report both when you can.
  • Multiple comparisons. A leaderboard with 20 models has 190 pairs. Correct intervals per pair still produce chance wins somewhere in the table; Dror and colleagues review the testing choices for NLP [9].

Frequently asked questions#

When do I need clustered standard errors for an LLM benchmark?

Whenever items were generated in groups that could have come out differently: questions sharing a passage or document, items filled from the same template, several sampled answers per prompt, or turns of the same conversation. Cluster on the unit that would change if the benchmark were rebuilt.

What is the design effect?

The factor by which correlation inside clusters inflates the variance of a mean: 1 + (m - 1) times the intra-cluster correlation, for clusters of size m. Dividing the number of items by it gives the effective sample size.

How do I compute a clustered standard error for accuracy?

Sum the residuals (score minus overall mean) within each cluster, square the cluster totals, add them up, divide by N squared and multiply by K/(K-1). Use a t critical value with K - 1 degrees of freedom, where K is the number of clusters.

Should I compare two models with separate error bars?

No. Compute the per-question difference between the two models and put a clustered interval on its mean. Pairing removes shared question difficulty, which in our simulation cut the standard error of the gap from 3.3 to 1.9 points.

What if my benchmark has only a few clusters?

Clustered standard errors become unreliable with fewer than about 20 clusters. Use t critical values with K - 1 degrees of freedom at minimum and consider the wild cluster bootstrap. The lasting fix is to add clusters rather than items per cluster.

Sources#

  1. P. Rajpurkar, J. Zhang, K. Lopyrev, P. Liang. SQuAD: 100,000+ Questions for Machine Comprehension of Text, 2016. arxiv.org
  2. L. Kish. Survey Sampling, 1965. archive.org
  3. K.-Y. Liang, S. L. Zeger. Longitudinal data analysis using generalized linear models, 1986. doi.org
  4. A. C. Cameron, D. L. Miller. A Practitioner's Guide to Cluster-Robust Inference, 2015. doi.org
  5. A. C. Cameron, J. B. Gelbach, D. L. Miller. Bootstrap-Based Improvements for Inference with Clustered Errors, 2008. doi.org
  6. D. Card, P. Henderson, U. Khandelwal, R. Jia, K. Mahowald, D. Jurafsky. With Little Power Comes Great Responsibility, 2020. arxiv.org
  7. A. Abadie, S. Athey, G. Imbens, J. Wooldridge. When Should You Adjust Standard Errors for Clustering?, 2017. arxiv.org
  8. L. Madaan, A. K. Singh, R. Schaeffer, A. Poulton, S. Koyejo, P. Stenetorp, S. Narang, D. Hupkes. Quantifying Variance in Evaluation Benchmarks, 2024. arxiv.org
  9. R. Dror, G. Baumer, S. Shlomov, R. Reichart. The Hitchhiker's Guide to Testing Statistical Significance in Natural Language Processing, 2018. doi.org

Know the number before you ship.

A 45-minute working session with an evaluation engineer. Bring one use case; leave with a threat model, a draft eval plan with sample sizes, and an honest read on where you stand.