Calibrated Chaos: Variance Between Runs of Neural Network Training is Harmless and Inevitable

Keller JordanarXiv 2023 · OpenReview

Abstract

Typical neural network trainings have substantial variance in test-set performance between repeated runs, impeding hyperparameter comparison and training reproducibility. We present the following results towards understanding this variation. (1) Despite having significant variance on their test-sets, we demonstrate that standard CIFAR-10 and ImageNet trainings have very little variance in their performance on the test-distributions from which those test-sets are sampled, suggesting that variance is less of a practical issue than previously thought. (2) We present a simplifying statistical assumption which closely approximates the structure of the test-set accuracy distribution. (3) We argue that test-set variance is inevitable in the following two senses. First, we show that variance is largely caused by high sensitivity of the training process to initial conditions, rather than by specific sources of randomness like the data order and augmentations. Second, we prove that variance is unavoidable given the observation that ensembles of trained networks are well-calibrated. (4) We conduct preliminary studies of distribution-shift, fine-tuning, data augmentation and learning rate through the lens of variance between runs.

Introduction

The frustrating variance in accuracy between different training runs of the same neural network is largely a statistical illusion. If you train the exact same ResNet architecture on CIFAR-10 twice, using different random seeds for initialization and data shuffling, you might see a performance gap of over 1%. In a field where state-of-the-art improvements are often measured in fractions of a percent, this "stochasticity" is a nightmare for reproducibility and hyperparameter tuning. This paper demonstrates that for standard models, this variation is mostly "finite-sample noise" from the test set rather than genuine differences in model quality, and it can be accurately predicted using a simple formula derived from the model's calibration properties.

Methodology

The authors take a massive empirical approach, training hundreds of thousands of models to observe the statistical structure of their errors. The main setup involved training 60,000 ResNet-9 models on CIFAR-10 for various durations (0 to 64 epochs) to see how variance evolves.

Distributions of test-set accuracy for CIFAR-10 models across different training durations.

To analyze this, they used a "Split-Test Analysis," dividing the test set into two halves. If a "lucky" seed produced a model that was genuinely better, it should outperform the average on both halves. They also derived a mathematical formula to separate "test-set variance" (noise from specific examples) from "distribution-wise variance" (genuine differences in model quality). The study utilized standard benchmarks including CIFAR-10, ImageNet, and variants for distribution shifts (ImageNet-V2, ImageNet-R, ObjectNet, ImageNet-Sketch), as well as NLP tasks like BERT fine-tuning on MRPC.

Key Insights and Results

Lucky Seeds Don't Generalize

For models trained to convergence, there is near-zero correlation between performance on two different halves of a test set. A seed that is "lucky" on your validation set is likely just average on your hidden test set. Training a model is essentially like generating a series of independent, biased coin flips for every test example.

Correlation of accuracy between odd and even test-set examples drops significantly as models converge.

Variance is Inevitable and Predictable

The paper proves that if a model is well-calibrated (meaning its confidence matches its accuracy), variance is a mathematical necessity. They provide a "rule of thumb" formula for binary classification: Variance ≈ Error Rate / 2n (where n is the test set size). Their proposed formula for predicting variance achieved an $R^2$ of 0.996 across 511 different binary classification tasks.

Stabilizing Training

  • Distribution-wise variance is tiny: For converged CIFAR-10 and ImageNet models, the genuine difference in quality between runs is roughly 20x to 200x smaller than the observed variance on the test set.
  • Data Augmentation: Removing data augmentation increases variance by 3.5x, even when mean accuracy is controlled.
  • Optimal Learning Rate: The learning rate that yields the highest accuracy also tends to yield the lowest variance, suggesting that "stable" training is synonymous with "good" training.

Limitations and Future Work

The findings do not hold for inherently unstable training setups, such as fine-tuning BERT-Large, where genuine distribution-wise variance remains high. Additionally, when models are evaluated on shifted data (like ImageNet-Sketch), variance spikes significantly. Why distribution shift triggers this instability and the exact mechanical reason why data augmentation stabilizes training remain open questions for future research.

Summary updated

BibTeX
@misc{jordan2023calibrated,
  author = {Keller Jordan},
  title = {{Calibrated Chaos: Variance Between Runs of Neural Network Training is Harmless and Inevitable}},
  year = {2023},
  eprint = {2304.01910},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.01910},
}
Figure