On the interplay between noise and curvature and its effect on optimization and generalization

Valentin Thomas, Fabian Pedregosa, Bart van Merrienboer, Pierre-Antoine Manzagol, Nicolas Le Roux

TL;DR

This paper investigates how the curvature of a loss function and the noise in its gradients interact to affect how quickly machine learning models optimize and generalize. The authors clarify the distinct roles of the Hessian, Fisher, and gradient covariance matrices, showing that a common confusion between them hinders accurate generalization gap estimation. They propose the Takeuchi Information Criterion (TIC) as a more robust estimator, leveraging both curvature and noise information.

What Problem Does This Paper Address?

Training machine learning models often involves minimizing a loss function. This minimization is typically done using stochastic gradient descent (SGD) or its variants. The speed and success of this optimization, as well as the model's ability to generalize to unseen data (generalization performance), are known to depend on two key factors: the "curvature" of the loss landscape (how quickly the gradient changes) and the "noise" in the gradients (the variability introduced by using mini-batches of data).

However, much of the existing research tends to focus on either curvature or noise in isolation. This paper argues that their interaction is crucial for a complete understanding of optimization speed and, importantly, for accurately estimating the generalization gap. A significant problem identified is the confusion between different information matrices that capture these properties. Specifically, the Hessian (measuring curvature), the Fisher matrix (related to curvature and model distribution), and the covariance matrix of gradients (related to noise) are often conflated, leading to flawed theoretical analyses and practical algorithms. This confusion is particularly problematic when trying to estimate how well a model will perform on unseen data.

Methods

The paper's core methodological contributions lie in:

  • Theoretical Analysis of Information Matrices: The authors rigorously define and analyze the relationships between three key matrices:
  • Hessian (H): The matrix of second derivatives of the loss function with respect to parameters.
  • Fisher Information Matrix (F): Related to the curvature but based on the model's probability distribution.
  • Gradient Covariance Matrix (C): Captures the variance and covariance of the gradients across different data samples. They derive bounds on the distances between these matrices, showing they are distinct in general but can become similar under specific conditions (e.g., when the model distribution matches the data distribution, or for certain types of models like generalized linear models).

  • Extending Optimization Convergence Rates: The paper extends existing theoretical results on SGD convergence (e.g., Schmidt, 2014) to account for the full geometry of both the Hessian and the gradient noise covariance matrix. This provides a more nuanced understanding of how curvature and noise interact to determine convergence speed, especially for quadratic functions.

  • Investigating Generalization Gap Estimation: A central theme is the estimation of the generalization gap (the difference between training and test error). The authors critically examine existing methods like "flatness" and "sensitivity," arguing they fail because they don't adequately account for noise. They champion the Takeuchi Information Criterion (TIC), a criterion that naturally incorporates both curvature (Hessian) and noise (gradient covariance). They provide theoretical justification and empirical validation for TIC's effectiveness.
  • Empirical Validation: Extensive experiments are conducted on various neural network architectures (MLPs, CNNs) and datasets (MNIST, CIFAR-10, SVHN) to validate their theoretical findings. This includes analyzing the distances between H, F, and C during training, evaluating the impact of noise geometry on second-order optimization methods, and comparing TIC with other generalization gap estimators.

Datasets

The paper uses standard benchmark datasets for its experiments:

  • MNIST: A dataset of handwritten digits.
  • CIFAR-10: A dataset of small color images in 10 classes.
  • SVHN: The Street View House Numbers dataset, a real-world image dataset.

The authors also mention using subsets of these datasets and manipulating label corruption to create specific experimental conditions. No new datasets are introduced.

Key Insights and Ideas

  • Confusion is Widespread and Problematic: The paper strongly emphasizes that the common conflation of the Hessian, Fisher, and gradient covariance matrices is not just a theoretical nuance but actively hinders progress in understanding optimization and generalization. Algorithms that incorrectly use one matrix for another can perform arbitrarily poorly.
  • Noise Geometry Matters for Optimization: While many optimization analyses focus on the magnitude of noise, this paper highlights that its geometry (captured by the covariance matrix C) significantly impacts the performance of second-order methods, especially when it's not aligned with the curvature (Hessian).
  • Generalization is Fundamentally About Both Curvature and Noise: The generalization gap isn't solely determined by "flat" minima (low curvature) or by the amount of noise. It's the interplay: curvature dictates how sensitive the model is to parameter changes, while noise dictates how much the gradients vary due to data sampling. Both are essential for accurate estimation.
  • TIC is a Superior Generalization Estimator: The Takeuchi Information Criterion (TIC), which uses both the Hessian and the gradient covariance, is shown to be a much more reliable estimator of the generalization gap than methods relying solely on curvature (like flatness) or input sensitivity. This is because it captures the essential components of model uncertainty.
  • H, F, and C Can Be Similar in Practice (but not always): While theoretically distinct, the paper's experiments show that for deep networks trained on standard tasks, H, F, and C often become highly aligned (in terms of angle similarity) and have similar scaling properties as training progresses, though C can be "larger" than H and F. This alignment is crucial for the effectiveness of TIC.

Key Results

  • Theoretical Bounds: The paper derives bounds showing the distances between H, F, and C, highlighting their differences and conditions for similarity.
  • Optimization Convergence: Theoretical extensions show how the geometry of noise (S) and curvature (H) jointly influence SGD and momentum convergence rates, particularly in quadratic settings. For instance, Newton's method can degrade significantly when noise is misaligned with curvature, a phenomenon not captured by simpler bounds.
  • Empirical Validation of Matrix Relationships: Experiments demonstrate that while H, F, and C can be significantly different early in training, they tend to align well in terms of angle similarity later on.
  • TIC Performance: Empirical results show that the TIC is a strong predictor of the generalization gap across various architectures, datasets, and hyperparameters, outperforming AIC and sensitivity measures. For example, Figure 4 shows a near-perfect correlation between the generalization gap and TIC.
  • Approximations to TIC: The paper proposes and validates efficient approximations to TIC using F instead of H (Tr(F⁻¹C)) and ratios of traces (Tr(C)/Tr(F)), showing they retain much of TIC's predictive power.

Limitations and Future Work

  • Computational Cost of TIC: While TIC is effective, computing the Hessian (H) can be computationally expensive for large neural networks. The paper addresses this by proposing approximations, but exact computation remains a challenge.
  • Assumptions for Theoretical Results: Some theoretical analyses, particularly for optimization convergence, are derived for quadratic functions or assume simultaneous diagonalizability of matrices, which might not always hold in practice for complex deep networks.
  • Future Work: The authors suggest exploring how to combine variance reduction techniques with geometry adaptation for optimization. They also propose adapting sensitivity measures to account for input covariance and further investigating the interplay of noise and curvature for developing new optimization and generalization estimation methods.

Summary updated

Abstract

The speed at which one can minimize an expected loss using stochastic methods depends on two properties: the curvature of the loss and the variance of the gradients. While most previous works focus on one or the other of these properties, we explore how their interaction affects optimization speed. Further, as the ultimate goal is good generalization performance, we clarify how both curvature and noise are relevant to properly estimate the generalization gap. Realizing that the limitations of some existing works stems from a confusion between these matrices, we also clarify the distinction between the Fisher matrix, the Hessian, and the covariance matrix of the gradients.
BibTeX
@inproceedings{thomas2020interplay,
  author = {Valentin Thomas and Fabian Pedregosa and Bart van Merrienboer and Pierre-Antoine Manzagol and Nicolas Le Roux},
  title = {{On the interplay between noise and curvature and its effect on optimization and generalization}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2020},
  url = {https://openreview.net/forum?id=lbx2QudW04W},
}
Figure