Necessary and Sufficient Hypothesis of Curvature: Understanding Connection Between Out-of-Distribution Generalization and Calibration

Hiroki Naganuma, Masanari KimuraDG @ ICLR 2023

TL;DR

This paper proposes a novel hypothesis: low curvature in a neural network's loss landscape is both necessary and sufficient for achieving good Out-of-Distribution (OOD) generalization and model calibration. They demonstrate this empirically using Sharpness-Aware Minimization (SAM) and provide theoretical backing, suggesting a unified approach to tackling two major challenges in deploying deep learning models in the real world.

What Problem Does This Paper Address?

Deep neural networks (DNNs) have achieved remarkable success in various applications. However, two critical issues hinder their widespread adoption in real-world scenarios:

  1. Out-of-Distribution (OOD) Generalization: Standard machine learning assumes training and test data are drawn from the same distribution (i.i.d.). In reality, data distributions often shift (e.g., a medical model trained on one hospital's data might perform poorly on another's). This makes models brittle and unreliable when encountering unseen data distributions.
  2. Calibration: Even when a DNN makes a prediction with high confidence (e.g., 99%), its accuracy might be significantly lower (e.g., only 50% correct). This overconfidence is problematic for applications requiring reliable uncertainty estimates, such as medical diagnosis or autonomous driving.

While OOD generalization and calibration have been studied separately, this paper posits a unifying principle: curvature of the loss landscape. They hypothesize that improving OOD generalization, achieving good calibration, and reducing loss curvature are fundamentally linked and, in fact, equivalent.

Methods

The core of the paper's methodology revolves around exploring the relationship between loss landscape curvature and the two key problems.

  • Sharpness-Aware Minimization (SAM): The authors leverage SAM, a training technique known to find flatter minima in the loss landscape. By minimizing a "smoothed" version of the loss, SAM encourages models to be robust to small perturbations in their parameters, effectively reducing the curvature around the learned parameters.
  • Empirical Evaluation: They train various model architectures (Vision Transformer, ResNet, MLP) on standard datasets and evaluate their performance on OOD datasets. They compare SAM with traditional optimizers like Momentum SGD and Adam, focusing on metrics like accuracy and Expected Calibration Error (ECE).
  • Theoretical Analysis: The paper provides theoretical arguments to support their hypothesis. They analyze the Focal Loss, a known calibration-enhancing technique, and show that it implicitly encourages higher conditional entropy, which can be linked to lower curvature. They also present theoretical results connecting OOD generalization to curvature, drawing on prior work.

Datasets

The experiments were conducted on the following datasets:

  • Training Datasets: CIFAR10, ImageNet-1K
  • OOD Evaluation Datasets: CIFAR10.1 (derived from CIFAR-10), ImageNet-V2 (a more recent benchmark designed to mitigate adaptive overfitting)

Key Insights and Ideas

  • Curvature as a Unifying Principle: The central idea is that the "sharpness" or "flatness" of the loss landscape (its curvature) is the common thread connecting OOD generalization and calibration. Flatter minima are hypothesized to be more robust to distribution shifts and lead to more reliable confidence estimates.
  • SAM's Dual Benefit: The paper provides strong empirical evidence that SAM, by design, finds flatter minima, not only improves OOD generalization but also significantly enhances model calibration. This suggests SAM is a powerful tool for building more robust and trustworthy deep learning models.
  • Focal Loss and Calibration: The theoretical analysis of Focal Loss reveals that its mechanism for reducing overconfidence is related to maximizing conditional entropy, which in turn is linked to minimizing loss curvature. This provides a theoretical bridge between a practical calibration technique and the curvature hypothesis.
  • Hypothesis 1: The paper formally states their core hypothesis: "Improvement of OOD generalization performance," "Learning well-calibrated model," and "Reduction of loss curvature" are equivalent.

Key Results

  • Empirical Validation: Across multiple datasets and model architectures, SAM consistently outperformed Momentum SGD and Adam in terms of both OOD accuracy and lower ECE. For instance, Figure 1 and 3 show SAM achieving better trade-offs between accuracy and ECE on OOD datasets.
  • Effect of SAM's Regularization Parameter (ρ): Experiments showed that increasing ρ (the strength of SAM's regularization) generally improved both calibration and OOD accuracy, reinforcing the benefit of seeking flatter minima (Figure 2).
  • Theoretical Support: The paper presents theoretical arguments (Propositions 1, 2, 3, and Theorems) that mathematically link calibration and OOD generalization to loss curvature, providing a foundation for their empirical findings.

Limitations and Future Work

  • Dataset Scope: The authors acknowledge that their experiments could have benefited from a more comprehensive range of distribution shift datasets. They suggest evaluating on benchmarks like DomainBed, WILDS, and SHIFT15M as future work.
  • Theoretical Guarantees for OOD: While they empirically demonstrate that low curvature leads to high OOD accuracy, they suggest further theoretical work is needed to formally guarantee this relationship. Specifically, they propose investigating how curvature relates to the convergence rate of OOD generalization error, aiming for a bound of the form $R_{OOD}(\theta) \le R(\theta) + \phi(r)$, where $r$ is a curvature quantity.
  • Model Architectures: While they tested several architectures, future work could explore a wider variety to see if the curvature-based benefits hold universally.

Summary updated

BibTeX
@inproceedings{naganuma2023necessary,
  author = {Hiroki Naganuma and Masanari Kimura},
  title = {{Necessary and Sufficient Hypothesis of Curvature: Understanding Connection Between Out-of-Distribution Generalization and Calibration}},
  booktitle = {DG @ ICLR},
  year = {2023},
  url = {https://openreview.net/forum?id=jxj6YJE8lS},
}
Figure