Simple Algorithm
Deep Learning · Emergence · 26 min

Benchmarking Deep Learning Fairly

Seed variance, tuning budgets and time-to-result: comparing training methods honestly.

Train the same network twice with different random seeds and the test accuracy moves, often by as much as the improvements papers report. Benchmarking honestly means measuring that noise, sizing experiments to see through it, giving every method the same tuning budget, and choosing a metric, such as time to a target on fixed hardware, that harder tuning cannot game.

What you’ll learn

  • Identify the sources of run-to-run variance in deep learning (data sampling, initialization, data order, augmentation, nondeterministic kernels) and what controlled studies found about their sizes.
  • Compute the standard error of a test accuracy and the number of seeds a claim needs, from n≈(zσ/δ)2n\approx(z\sigma/\delta)^2 for a confidence interval and 2(z1−α/2+z1−β)2σ2/Δ22(z_{1-\alpha/2}+z_{1-\beta})^2\sigma^2/\Delta^2 for a comparison, and quantify the bias of reporting the best seed.
  • Explain why optimizer comparisons were unreliable, and how the AlgoPerf benchmark measures time to result under external-tuning and self-tuning rules and scores it with performance profiles.
  • Assess benchmark reuse and the benchmark lottery, and list what a reproducible report must contain.

Where run-to-run variance comes from

A reported number is one draw from a distribution. Its randomness comes from several sources:

  • Data sampling: which examples ended up in the training and test sets. A finite test set measures accuracy with binomial noise of standard error p(1−p)/ntest\sqrt{p(1-p)/n_{\text{test}}}.
  • Initialization: the seed of the weights.
  • Data order and augmentation: the shuffle of each epoch, the random crops and flips, the dropout masks.
  • Nondeterministic kernels: floating-point addition is not associative, and parallel GPU reductions may sum in a different order on every run, so even "identical" runs differ in their last bits.
  • Hyperparameter search: a random or Bayesian search lands on different configurations each time it is run.
StudySettingFinding
Bouthillier et al. (2021)five deep learning tasks; each source randomized 200 times with the others fixedbootstrapping the data was the largest source of variance; weight initialization usually contributed less than half as much, on a par with the order of SGD's visits; the measured test-set noise matched a binomial model
Summers & Dinneen (2021)image classification and language modelingall sources of nondeterminism had similar effects on the diversity of the trained models; changing a single bit of the initial weights led to very different final models, and they traced the effect to the instability of training
Dodge et al. (2020)BERT fine-tuned on four GLUE tasks, 2,100 runs differing only in the seedweight initialization and data order contributed comparably to the variance; on small datasets many runs diverged partway through training
Two lessons follow. Fixing one seed does not remove the variance that matters, which includes the data sample. And the instability is intrinsic to training, so "deterministic" settings make a run repeatable without making its result representative.
Predict before you look

A classifier scores 95% on a test set of 10,000 images. Treating the test examples as independent draws, what is the standard error of that accuracy, in percentage points?

Show the answer

0.22 pp

0.95×0.05/10,000≈0.0022\sqrt{0.95\times0.05/10{,}000}\approx0.0022, that is 0.22 points, so a 95% interval is about ±0.43\pm0.43 points from the test set alone, before any seed variance. Two models whose accuracies differ by 0.2 points on such a test set are not distinguished by that number.

python
import torch
from torch.utils.data import DataLoader

torch.manual_seed(seed)                      # seeds the CPU and CUDA generators
torch.use_deterministic_algorithms(True)     # error on ops with no deterministic version
torch.backends.cudnn.benchmark = False       # no per-shape autotuning of conv kernels
g = torch.Generator().manual_seed(seed)      # the data order as well
loader = DataLoader(train_ds, batch_size=128, shuffle=True, generator=g)

Making a run repeatable, for debugging. PyTorch's documentation warns that completely reproducible results are not guaranteed across releases, platforms or CPU and GPU, and deterministic kernels can be slower. For measuring a method, the opposite is needed: vary the seeds, and report the spread.

How many seeds a claim needs

Treat the final metric of a run as a random variable with mean μ\mu and run-to-run standard deviation σ\sigma, estimated from pilot runs. Everything below follows from the normal approximation to the mean of nn runs.

DerivationSizing an experiment
  1. zσn≤δ⟺n ≥ (z σδ)2(σ=0.3, δ=0.1: n≥34.6)z\frac{\sigma}{\sqrt n}\le\delta\quad\Longleftrightarrow\quad n\ \ge\ \Big(\frac{z\,\sigma}{\delta}\Big)^2\qquad(\sigma=0.3,\ \delta=0.1:\ n\ge34.6)

    Precision. The mean of nn independent runs has standard error σ/n\sigma/\sqrt n. For a 95% confidence interval of half-width δ\delta, with z=z0.975≈1.96z=z_{0.975}\approx1.96:

  2. n ≥ 2 (z1−α/2+z1−β)2 σ2Δ2,α=0.05, 1−β=0.8:  2(1.96+0.84)2≈15.7  times  σ2/Δ2n\ \ge\ \frac{2\,(z_{1-\alpha/2}+z_{1-\beta})^2\,\sigma^2}{\Delta^2},\qquad\alpha=0.05,\ 1-\beta=0.8:\ \ 2(1.96+0.84)^2\approx15.7\ \text{ times }\ \sigma^2/\Delta^2

    Comparison. To detect a true difference Δ\Delta between two methods with independent seeds, at two-sided level α\alpha and power 1−β1-\beta, the difference of means must clear z1−α/2z_{1-\alpha/2} standard errors with probability 1−β1-\beta. Its standard error is σ2/n\sigma\sqrt{2/n}, so per method:

  3. n ≥ (z1−α/2+z1−β)2 σd2Δ2n\ \ge\ \frac{(z_{1-\alpha/2}+z_{1-\beta})^2\,\sigma_d^2}{\Delta^2}

    Pairing. Run both methods with the same seeds, data orders and splits, and analyze the per-pair differences. If their standard deviation σd\sigma_d is smaller than σ2\sigma\sqrt2, which shared randomness often makes it, fewer runs suffice:

  4. P(A>B)=Φ(Δ2 σ)≥0.75⟺Δ ≥ 2 Φ−1(0.75) σ≈0.95 σP(A>B)=\Phi\Big(\frac{\Delta}{\sqrt2\,\sigma}\Big)\ge0.75\quad\Longleftrightarrow\quad\Delta\ \ge\ \sqrt2\,\Phi^{-1}(0.75)\,\sigma\approx0.95\,\sigma

    Probability of improvement. Bouthillier et al. (2021) recommend asking how often a run of AA beats a run of BB, and requiring P(A>B)≥0.75P(A>B)\ge0.75. For Gaussian scores with common spread σ\sigma, A−B∼N(Δ,2σ2)A-B\sim\mathcal N(\Delta,2\sigma^2), so the criterion demands a mean difference of about one run-to-run standard deviation:

Predict before you look

Run-to-run standard deviation of test accuracy is σ=0.2\sigma=0.2 points. With independent seeds, a two-sided test at α=0.05\alpha=0.05 and 80% power, how many seeds per method do you need to detect a true difference of Δ=0.1\Delta=0.1 points?

Show the answer

63 seeds

2(1.96+0.84)2×(0.2/0.1)2≈15.7×4≈62.82(1.96+0.84)^2\times(0.2/0.1)^2\approx15.7\times4\approx62.8, so 63 seeds per method, 126 runs in all. Halving the detectable difference quadruples the cost. That is why papers with three seeds per method cannot resolve differences of a fraction of the run-to-run spread, and why pairing seeds across methods helps.

Testing, briefly. Paired tests on the same test examples (McNemar's test), corrected resampled tt-tests, and procedures for many datasets and many comparisons are treated in depth in the Machine Learning course's Comparing Models Statistically. Two deep-learning specifics deserve emphasis. Randomize as many sources of variance as you can afford, including data splits, rather than only the seed: an estimator that varies more sources of variation gets closer to the variance that matters, which Bouthillier et al. found also cuts the compute needed for a reliable comparison. And when only a handful of runs is affordable, as in reinforcement learning, report interval estimates (bootstrap confidence intervals, robust aggregates such as the interquartile mean, and performance profiles) rather than point estimates (Agarwal, Schwarzer, Castro, Courville & Bellemare, 2021).

Benchmarking training algorithms

Comparing optimizers is the hardest case, because an optimizer is defined only together with its hyperparameters and how they were tuned. Two studies made this concrete:

  • Search spaces decide rankings. Choi, Shallue, Nado, Lee, Maddison & Dahl (2019) argued that the hyperparameter search space may be the single most important factor behind the rankings in published optimizer comparisons, and that changing it can reverse them. They also used inclusion relations: Adam can mimic momentum SGD, which can mimic plain SGD, so with enough tuning the more general method should never lose. In their experiments, tuned adaptive methods indeed never underperformed momentum or plain SGD.
  • No universal winner. Schmidt, Schneider & Hennig (2021) benchmarked fifteen popular optimizers in tens of thousands of runs. Performance varied greatly across tasks, no optimizer dominated, trying several optimizers at their default settings worked about as well as tuning one, and Adam remained a strong contender.

Both point to the same requirement: a benchmark must fix the tuning protocol and charge each method for the tuning it needs.

AlgoPerf design choice (Dahl et al., 2023)What it does
time to result on fixed hardwareeach submission trains until it reaches a fixed validation target; the score is wall-clock time on standard hardware, so per-step overheads (preconditioners, extra gradient computations) are charged
many workloads8 fixed workloads covering image classification, speech recognition, machine translation, MRI reconstruction, click-through-rate prediction and chemical property prediction, plus randomized workload variants revealed only after submissions are frozen
external-tuning ruleseta submission supplies one workload-agnostic search space; 20 trials are drawn from it by quasi-random search on every workload, and the fastest trial to reach the target counts
self-tuning rulesetno hyperparameters may be set per workload; the algorithm must adapt on its own
performance profilesfor each submission, the fraction of workloads on which its time is within a factor τ\tau of the fastest submission's, as a function of τ\tau, integrated into one score (Dolan & Moré, 2002)
Dahl et al. named three obstacles to fair comparisons that these rules address: deciding when training is complete and measuring its time precisely, the sensitivity of results to small details of a workload, and comparing algorithms that need different amounts of tuning.
rs,w=ts,wmin⁡s′ts′,w,ρs(τ)=1∣W∣ ∣{w∈W: rs,w≤τ}∣r_{s,w}=\frac{t_{s,w}}{\min_{s'}t_{s',w}},\qquad \rho_s(\tau)=\frac{1}{\abs{W}}\,\big|\{w\in W:\ r_{s,w}\le\tau\}\big|
The performance profile of submission ss: ts,wt_{s,w} is its time to the target on workload ww, and ρs(τ)\rho_s(\tau) the fraction of workloads on which it is within a factor τ\tau of the best. A method that is never fastest but always close can beat one that wins a few workloads and fails the rest.

What it found. No baseline reached the target on every fixed workload. NAdamW, with a search space that also tuned β1\beta_1, reached it on seven of the eight and scored clearly above AdamW; with β1\beta_1 fixed at 0.9 the two scored about the same, a reminder that the search space is part of the algorithm (Dahl et al., 2023). The first competition drew 18 submissions from 10 teams (Kasimbeg et al., 2025). Distributed Shampoo won the external-tuning ruleset, showing that non-diagonal preconditioning can beat Adam-style methods even in wall-clock time; Schedule-Free AdamW won the self-tuning ruleset. The top submissions were surprisingly robust to the workload variants, and the authors describe the engineering challenges of keeping the comparison between training algorithms fair.

Check your understanding

Why does AlgoPerf time training in wall-clock time on fixed hardware rather than counting optimizer steps?

  1. Because steps cannot be counted reliably on GPUs
  2. Because different algorithms do different amounts of work per step, and step counts would hide that cost
  3. Because wall-clock time is the same on every machine
  4. Because counting steps would favor plain SGD
Show the answer

B. Because different algorithms do different amounts of work per step, and step counts would hide that cost

A step of Shampoo, SAM or a line-search method costs more than a step of SGD or Adam. Counting steps would reward methods that do more work per step; time to a target on standard hardware charges for it.

When benchmarks wear out

A benchmark reused for years becomes part of the training process: architectures and hyperparameters are selected on it, thousands of times. Recht, Roelofs, Schmidt & Shankar (2019) built new test sets for CIFAR-10 and ImageNet following the original collection procedures. Accuracy dropped by 3 to 15 points on CIFAR-10 and by 11 to 14 points on ImageNet, yet gains on the original test sets translated into larger gains on the new ones, so the ordering of models largely held. They attributed the drop to a small distribution shift (the new images were slightly harder) rather than to adaptive overfitting of the old test sets. The Machine Learning course's Benchmark Overfitting & Adaptive Data Analysis covers the theory of test-set reuse.

Benchmarks also encode choices. Dehghani et al. (2021) showed that, on several common benchmark suites, changing which tasks are included can by itself reorder the ranking of methods: a benchmark lottery in which the benchmark's design, not only the method's merit, decides who wins.

A report that can be trusted states, at minimum:

  • the mean and standard error over runs, the number of runs, and which sources of randomness were varied;
  • the tuning protocol for every method: search space, number of trials, selection metric, and the split it was measured on;
  • the baselines, tuned with the same protocol and budget, and ablations of each new component;
  • hardware, training time, and code with configurations.

The NeurIPS 2019 reproducibility program combined a code-submission policy, a reproducibility checklist in the submission process and a community reproducibility challenge, and its report describes what each component achieved (Pineau et al., 2021).

Key takeaways

  • Run-to-run variance comes from data sampling, initialization, data order, augmentation and nondeterministic kernels. In controlled studies data sampling was the largest source, and a one-bit change in the initial weights could yield a very different model.
  • Size experiments before running them: the mean of nn runs has standard error σ/n\sigma/\sqrt n, a comparison needs about 2(z1−α/2+z1−β)2σ2/Δ22(z_{1-\alpha/2}+z_{1-\beta})^2\sigma^2/\Delta^2 runs per method, pairing helps, and P(A>B)≥0.75P(A>B)\ge0.75 requires a gap of about one run-to-run standard deviation.
  • Reporting the best of nn seeds inflates a result by about cnσc_n\sigma (1.5σ1.5\sigma for ten). Report means, standard errors and the number of runs.
  • Optimizer rankings depend on search spaces and tuning protocols. AlgoPerf measures wall-clock time to a validation target on fixed hardware across eight workloads and held-out variants, under fixed tuning rules, and scores submissions with performance profiles.
  • Benchmarks wear out and encode choices: fresh ImageNet test sets cost 11 to 14 points of accuracy but preserved the ordering of models, and the choice of tasks can decide a ranking.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

In Bouthillier et al.'s controlled study of variance in deep learning benchmarks, which source contributed the most variance?

  1. Nondeterministic GPU kernels
  2. The random seed of the weight initialization
  3. Sampling of the data, the training and test examples, as simulated by bootstrapping
  4. The order in which mini-batches were visited
Show the answer

C. Sampling of the data, the training and test examples, as simulated by bootstrapping

Bootstrapping the data stood out as the largest source; weight initialization usually contributed less than half as much, comparable to the data order. Re-running with new seeds on a fixed split therefore underestimates the variance that matters for generalizing a claim.

Question 2

Run-to-run standard deviation is σ=0.4\sigma=0.4 points. How many independent runs give a 95% confidence interval of half-width 0.10.1 points for the mean?

  1. 4
  2. 16
  3. 62
  4. 400
Show the answer

C. 62

n≥(1.96×0.4/0.1)2≈61.5n\ge(1.96\times0.4/0.1)^2\approx61.5, so 62 runs. The cost grows with the square of the precision.

Question 3

A paper reports the best of 10 seeds for its method and a single run for the baseline. If all runs are normal with the same mean and spread σ\sigma, how large an advantage does this reporting create on average?

  1. about 1.5σ1.5\sigma
  2. none, since the methods are equally good
  3. about 0.1σ0.1\sigma
  4. about 10σ10\sigma
Show the answer

A. about 1.5σ1.5\sigma

The expected maximum of 10 standard normals is about 1.54, so the best of 10 runs exceeds the mean by about 1.5σ1.5\sigma, while a single baseline run averages the mean itself.

Question 4

What did Recht et al. (2019) find when they evaluated ImageNet classifiers on a freshly collected test set?

  1. Accuracy was unchanged, so the benchmark had not been overfit
  2. Accuracy dropped by 11 to 14 points and the ranking of models was scrambled
  3. Only the newest models lost accuracy, a sign of adaptive overfitting
  4. Accuracy dropped by 11 to 14 points, yet gains on the original test set carried over, so the ranking largely held
Show the answer

D. Accuracy dropped by 11 to 14 points, yet gains on the original test set carried over, so the ranking largely held

The drop was large and nearly uniform in its effect on the ordering: better models on the old test set were better on the new one, with even larger gains. The authors attributed the drop to a slight distribution shift toward harder images, not to adaptive overfitting.

Further reading

  • X. Bouthillier et al., "Accounting for variance in machine learning benchmarks," MLSys (2021).
  • C. Summers & M. J. Dinneen, "Nondeterminism and instability in neural network optimization," ICML (2021).
  • D. Choi, C. J. Shallue, Z. Nado, J. Lee, C. J. Maddison & G. E. Dahl, "On empirical comparisons of optimizers for deep learning," arXiv:1910.05446 (2019).
  • G. E. Dahl, F. Schneider, Z. Nado et al., "Benchmarking neural network training algorithms," arXiv:2306.07179 (2023).
  • P. Kasimbeg et al., "Accelerating neural network training: An analysis of the AlgoPerf competition," ICLR (2025).
  • B. Recht, R. Roelofs, L. Schmidt & V. Shankar, "Do ImageNet classifiers generalize to ImageNet?," ICML (2019).