Stochastic Gradient Descent with Large Learning Rate

Kangqiao Liu, Ziyin Liu, Masahito Ueda

TL;DR

This paper provides a theoretical framework for understanding Stochastic Gradient Descent (SGD) with large learning rates, moving beyond the limitations of existing continuous-time approximations. The authors derive exact, solvable results for the stationary distribution of SGD, revealing that discrete-time dynamics lead to significantly larger and distorted fluctuations than previously predicted, with important implications for optimization and generalization.

What Problem Does This Paper Address?

Stochastic Gradient Descent (SGD) is the workhorse optimization algorithm for training modern deep neural networks. While its behavior with vanishingly small learning rates is well-understood, often by approximating it with continuous-time diffusion processes (like Ornstein-Uhlenbeck processes), its performance with large learning rates remains a theoretical puzzle. In practice, larger learning rates can speed up training and sometimes lead to better generalization. However, the continuous-time approximations break down in this regime, failing to capture the observed phenomena. This paper aims to bridge this gap by developing a precise theoretical understanding of SGD and its variants in the non-vanishing learning rate regime, focusing on deriving exact, analytically tractable results.

Methods

The core of this work lies in deriving exact analytical solutions for the stationary distribution of discrete-time SGD. Instead of relying on continuous-time approximations, the authors directly analyze the discrete update rules. They focus on a quadratic loss function, which is a standard simplification for analyzing optimization dynamics near a local minimum. The key technical contribution is the derivation of exact formulas for the stationary covariance matrix of the model parameters for SGD, both with and without momentum. These formulas are then extended to analyze various aspects like approximation error, escape from sharp minima, and the behavior of second-order optimization methods. The authors leverage matrix algebra and properties of quadratic forms to derive these exact solutions.

Datasets

Not discussed in the paper. The paper focuses on theoretical analysis and uses synthetic quadratic loss functions for derivations and illustrative examples.

Key Insights and Ideas

  • Discrete-time dynamics matter: The most striking insight is that the discrete nature of SGD updates, especially with large learning rates, leads to fluctuations that are dramatically larger and distorted compared to what continuous-time theories predict. This means the standard diffusion analogy is insufficient.
  • Large learning rates can be "ill-conditioned": The paper shows that as the learning rate approaches a critical value (related to the Hessian of the loss function), the discrete-time dynamics can lead to divergence, a phenomenon that continuous-time theories often fail to predict accurately.
  • Momentum's role is nuanced: While momentum can help stabilize training, its interaction with large learning rates in discrete time is complex and doesn't always align with continuous-time intuition.
  • Second-order methods behave differently: Methods like Damped Newton's Method (DNM) and Natural Gradient Descent (NGD) show more robust behavior in the discrete-time, large learning rate regime, often requiring fewer corrections compared to SGD. NGD, in particular, appears to be less sensitive to the ill-conditioning issues.
  • Minibatch noise approximation is key: The paper highlights that the common approximation of minibatch noise covariance as being proportional to the Hessian ($C \approx K$) has limitations, especially when fluctuations become large.

Key Results

  • Exact stationary covariance formulas: The paper derives explicit, analytical formulas for the stationary covariance matrix of SGD and its momentum variant in a quadratic loss landscape. These formulas are shown to agree well with experimental results across a range of learning rates, unlike continuous-time approximations which fail at larger rates.
  • Distorted fluctuations: The derived formulas demonstrate that the shape of the stationary distribution can be significantly distorted from Gaussian, especially in directions corresponding to large eigenvalues of the Hessian, when using large learning rates.
  • Improved predictions for phenomena: The theoretical framework is applied to explain:
  • Approximation error: The discrete-time theory predicts larger approximation errors than continuous-time theories.
  • Escape from sharp minima: The discrete dynamics can lead to higher escape efficiencies from sharp minima compared to continuous-time predictions.
  • Bayesian inference: The optimal learning rate for approximate Bayesian inference is derived, showing deviations from previous results at larger learning rates.
  • Analysis of second-order methods: Exact formulas for the stationary covariance of DNM and NGD are derived, showing their improved stability and alignment with the underlying loss landscape compared to SGD.

Limitations and Future Work

  • Quadratic loss assumption: The primary theoretical results are derived under the assumption of a quadratic loss function. While this is a standard simplification for analyzing local minima, extending these results to more complex, non-convex loss landscapes of deep neural networks remains a challenge.
  • State-dependent noise: While the paper mentions state-dependent noise (where the noise covariance depends on the model parameters) and provides a general framework, the detailed analysis is mostly for constant noise covariance. The authors point to related work that further explores this.
  • Accuracy of coefficients: For phenomena like the Kramers escape rate, the authors acknowledge that their corrections to the continuous-time results are not precise and may not guarantee the accuracy of the coefficients, suggesting the need for a discrete-time Fokker-Planck equation.
  • Generalization gap: While the paper touches upon how discrete-time dynamics might affect generalization, a deeper theoretical understanding of the generalization gap in the context of large learning rates and discrete-time SGD is an open area.
  • Future work: The authors suggest extending their framework to analyze adaptive gradient methods more thoroughly and to explore the implications for generalization in more complex settings. They also highlight the need for a more precise discrete-time Fokker-Planck equation for phenomena like escape rates.

Summary updated

BibTeX
@inproceedings{liu2021stochastic,
  author = {Kangqiao Liu and Ziyin Liu and Masahito Ueda},
  title = {{Stochastic Gradient Descent with Large Learning Rate}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=SfZEjKyIl9},
}
Figure