Assessing Generalization of SGD via Disagreement

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

Abstract

We empirically show that the test error of deep networks can be estimated by simply training the same architecture on the same training set but with a different run of Stochastic Gradient Descent (SGD), and measuring the disagreement rate between the two networks on unlabeled test data. This builds on—and is a stronger version of—the observation in Nakkiran & Bansal '20, which requires the second run to be on an altogether fresh training set. We further theoretically show that this peculiar phenomenon arises from the well-calibrated nature of ensembles of SGD-trained models. This finding not only provides a simple empirical measure to directly predict the test error using unlabeled test data, but also establishes a new conceptual connection between generalization and calibration.

Introduction

Understanding generalization—the ability of a machine learning model to perform well on unseen data—remains a fundamental challenge in deep learning. Traditionally, generalization is estimated using a labeled test set. However, in many practical applications, such as medical imaging or privacy-sensitive domains, obtaining labels for new data is costly or impossible.

Previous research by Nakkiran & Bansal (2020) introduced the idea that the disagreement rate between two models trained on independent datasets can serve as a proxy for test error. While insightful, this approach is often impractical due to the requirement for two distinct, full-sized training sets. This paper investigates whether this "Generalization Disagreement Equality" (GDE) holds when models are trained on the same dataset and explores the underlying theoretical reasons for this phenomenon.

Methodology: Stochasticity and Calibration

The researchers employed a combination of extensive empirical evaluation and theoretical analysis to bridge the gap between disagreement and generalization.

Empirical Setup

Thousands of models, including ResNets, CNNs, and Fully Connected Networks, were trained across various hyperparameters like width, depth, and batch size. To understand what drives disagreement, they isolated different sources of stochasticity:

  • DiffInit: Models share the same data but use different random weight initializations.
  • DiffOrder: Models share data and initialization but use different data shuffling orders during training.
  • DiffData: Models are trained on different subsets of the data.

Theoretical Framework

The authors propose that GDE is a consequence of Class-Aggregated Calibration. They prove that if an ensemble of SGD-trained models is well-calibrated—meaning its predicted probabilities accurately reflect true success rates—then the expected disagreement between any two models in the ensemble must equal the expected test error.

Empirical Findings

The study validated the GDE phenomenon across several benchmarks, including in-distribution datasets (CIFAR-10, CIFAR-100, SVHN) and out-of-distribution (OOD) datasets like PACS (Photo, Art, Cartoon, Sketch).

Test error vs. disagreement for different sources of stochasticity on CIFAR-10. The strong correlation ($R^2 > 0.94$) across all conditions supports the Generalization Disagreement Equality.

As shown in Figure 1, the relationship between disagreement and test error consistently follows the $y=x$ diagonal. Across CIFAR and SVHN experiments, $R^2$ correlation coefficients frequently exceeded 0.98. The authors introduced the Class Aggregated Calibration Error (CACE) to quantify deviations; they found that when calibration is high, the equality is nearly perfect.

Generalization, Calibration, and OOD Performance

A key insight of this work is the bridge between generalization and calibration. The results suggest that the success of deep learning is intimately tied to how well models represent their own uncertainty. This has significant implications for unsupervised accuracy estimation in production environments.

GDE holds for out-of-distribution data on the PACS dataset, particularly when using pre-trained models.

On the PACS dataset, which involves significant distribution shifts, the GDE remained remarkably robust, especially for models pre-trained on ImageNet. This suggests that robust feature representations help maintain calibration even under domain shift, allowing disagreement to remain a reliable proxy for error.

Conclusion and Future Work

This work provides a practical "black-box" method for monitoring model performance in production without labeled data. By tracking the disagreement between two versions of a model on live traffic, practitioners can reliably infer accuracy drops.

While the paper establishes that calibration implies GDE, it leaves open the question of why SGD-trained models are naturally well-calibrated. Future research is needed to explore the limits of this phenomenon, particularly under extreme distribution shifts where models may become overconfident on completely novel data.

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