Assessing Generalization of SGD via Disagreement

Yiding Jiang, Vaishnavh Nagarajan, Christina Baek, J. Zico Kolter

TL;DR Researchers have discovered a surprisingly simple way to estimate a deep network's test error without using any labels: train the same architecture twice on the same data with different random seeds, and measure how often they disagree on unlabeled test data. This phenomenon, known as "Generalization Disagreement Equality" (GDE), occurs because ensembles of models trained with Stochastic Gradient Descent (SGD) are naturally well-calibrated.

The Challenge of Estimating Generalization

In machine learning, "generalization" is the ultimate goal—we need to know how well a model will perform on new, unseen data. Traditionally, calculating test error requires a "gold standard" labeled validation set. However, in many real-world scenarios, such as medical imaging or privacy-sensitive applications, acquiring labels is expensive, slow, or impossible.

Previous research demonstrated that if two models are trained on different independent datasets, their disagreement rate on unlabeled data roughly equals their test error. This paper tackles a much harder and more practical question: Does this hold true if the models are trained on the exact same dataset? If so, why does this happen, and can we use it to predict performance in the wild?

Methods: The Generalization Disagreement Equality

The authors investigate the Generalization Disagreement Equality (GDE), which posits a simple relationship: $$\text{Test Error} \approx \text{Disagreement Rate}$$

To test this hypothesis, they trained pairs of neural networks while varying different sources of "stochasticity" (randomness) during training:

  • DiffInit: Same data, same order, but different random weight initializations.
  • DiffOrder: Same data and initialization, but different shuffling orders during training.
  • DiffData: Models trained on two different, non-overlapping halves of the data.
  • AllDiff: Different data, different order, and different initialization.

Beyond empirical tests across standard vision benchmarks (CIFAR-10/100, SVHN, PACS), the authors provide a mathematical proof showing that GDE is a direct consequence of calibration. A model is well-calibrated if its "confidence" (the probability it assigns to a class) matches the true probability of that class being correct. They introduce a specific metric called Class Aggregated Calibration Error (CACE) to bound the gap between disagreement and test error.

Key Insights and Results

The "Same Data" Surprise: Naively, one might expect two models trained on the exact same data to be nearly identical, leading to zero disagreement. Instead, the authors found that even with the same data, the models disagree just enough that their disagreement rate remains a high-fidelity proxy for test error.

Calibration is the Key: The paper establishes a formal bridge between two previously separate fields: generalization and calibration. GDE isn't just an empirical quirk; it’s a mathematical necessity for well-calibrated ensembles.

Stochasticity is Fungible: Remarkably, changing the random seed (initialization) is almost as effective at creating "useful" disagreement as changing the entire training dataset.

Test error vs. disagreement across different sources of stochasticity.

As shown above, there is a strong linear correlation across datasets. The disagreement rate and test error show a near-perfect linear relationship ($R^2 > 0.9$).

  • In the DiffData setting, the disagreement rate almost exactly equals the test error (a 1:1 ratio).
  • In DiffInit or DiffOrder, the disagreement slightly underestimates the error but remains highly predictable.
  • On the PACS dataset, GDE held up surprisingly well even under distribution shifts, especially for models pre-trained on ImageNet.
  • The authors empirically verified that when their new calibration metric (CACE) is low, the GDE holds tightly, confirming their theoretical derivation.

This provides a "black-box" way to estimate a model's error at deployment time. If a model in production and a "shadow" version of itself start to disagree on unlabeled incoming data, it is a strong signal that accuracy is dropping.

Limitations and Future Work

While promising, this approach has limitations:

  • The "Why" of Calibration: The paper proves that calibration implies GDE, but it doesn't fully explain why SGD-trained models are so well-calibrated in the first place.
  • Computational Cost: Using this as an estimator requires training a second model, doubling the training budget.
  • Expectation vs. Reality: The theory holds "in expectation" (averaged over many runs). A single pair of models works well in practice, but variance could lead to slight inaccuracies for a specific deployment.
  • Out-of-Distribution (OOD) Edge Cases: GDE was less accurate for certain extreme distribution shifts, suggesting limits to using disagreement as a universal error proxy.

Summary updated

BibTeX
@inproceedings{jiang2022assessing,
  author = {Yiding Jiang and Vaishnavh Nagarajan and Christina Baek and J. Zico Kolter},
  title = {{Assessing Generalization of SGD via Disagreement}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=Oq_5lf3rGHK},
}
Figure