On the Hyperparameters in Stochastic Gradient Descent with Momentum

Bin Shi · DOI

Abstract

Following the same routine as [SSJ20], we continue to present the theoretical analysis for stochastic gradient descent with momentum (SGD with momentum) in this paper. Differently, for SGD with momentum, we demonstrate it is the two hyperparameters together, the learning rate and the momentum coefficient, that play the significant role for the linear rate of convergence in non-convex optimization. Our analysis is based on the use of a hyperparameters-dependent stochastic differential equation (hp-dependent SDE) that serves as a continuous surrogate for SGD with momentum. Similarly, we establish the linear convergence for the continuous-time formulation of SGD with momentum and obtain an explicit expression for the optimal linear rate by analyzing the spectrum of the Kramers-Fokker-Planck operator. By comparison, we demonstrate how the optimal linear rate of convergence and the final gap for SGD only about the learning rate varies with the momentum coefficient increasing from zero to one when the momentum is introduced. Then, we propose a mathematical interpretation why the SGD with momentum converges faster and more robust about the learning rate than the standard SGD in practice. Finally, we show the Nesterov momentum under the existence of noise has no essential difference with the standard momentum.

Introduction

Despite being the workhorse of modern deep learning, the precise mechanism behind the success of Stochastic Gradient Descent (SGD) with momentum—especially in non-convex settings—has remained somewhat "mysterious." While practitioners know that a momentum coefficient ($\alpha$) around 0.9 often works best, theoretical understanding has lagged behind empirical success.

The core challenge lies in understanding the interplay between two key hyperparameters: the learning rate ($s$) and the momentum coefficient ($\alpha$). Specifically, how do these parameters together dictate the linear convergence rate and the final "error floor" (the gap between the found solution and the global minimum)? This paper aims to bridge this gap by providing an explicit mathematical expression for the convergence rate in non-convex optimization.

Theoretical Framework: The hp-dependent SDE

The author employs a continuous-time approximation strategy. Instead of looking at discrete iterative steps, they model SGD with momentum as a second-order hyperparameter-dependent SDE (hp-dependent SDE).

Key technical components include:

  • Kramers-Fokker-Planck Equation: The evolution of the probability density of the SDE is analyzed using this kinetic equation, which accounts for both position and "velocity" (momentum).
  • Spectral Analysis: The convergence rate is determined by the "spectral gap" of the Kramers-Fokker-Planck operator. The author uses semi-classical analysis to find the first non-zero eigenvalue, which represents the rate at which the system reaches its equilibrium distribution.
  • Hypocoercivity: Since the noise in the SDE only directly affects the velocity and not the position, standard tools like the Poincaré inequality fail. The author uses the theory of hypocoercivity to prove that the system still converges linearly to a unique invariant Gibbs distribution.
  • Mixing Parameter ($\beta$): A novel parameter $\beta(s, \alpha) = \frac{s(1+\alpha)}{2(1-\alpha)}$ is introduced, which effectively "mixes" the learning rate and momentum into a single value that governs the system's "temperature" and final error.
The relationship between the momentum coefficient $\alpha$ and the mixing parameter $\beta$.

Empirical Motivation

The paper uses a motivating experimental comparison to ground its theoretical findings. A 20-layer convolutional neural network (CNN) was trained on the CIFAR-10 dataset to illustrate the performance gap between standard SGD and SGD with momentum.

Training error comparison between standard SGD and SGD with momentum on CIFAR-10.

This experiment confirms that while momentum might lead to a slightly higher final training error, it reaches stabilization much faster than standard SGD.

Key Insights and Results

The analysis reveals several critical properties of momentum-based optimization:

  • The Power of $\alpha > 1/3$: The analysis reveals a threshold for the momentum coefficient. When $\alpha > 1/3$, the convergence rate increases sharply. This provides a theoretical basis for why high momentum values (like 0.9) are so effective in practice.
  • Robustness to Learning Rate: One of the most significant findings is that SGD with momentum is more "robust" than standard SGD. In standard SGD, a small change in the learning rate can lead to an astronomical difference in the time required to converge. Momentum "flattens" this sensitivity, making the algorithm easier to tune.
  • Momentum as a Noise Rescaler: The momentum coefficient effectively rescales the noise term. Instead of the noise being proportional to $\sqrt{s}$, it becomes proportional to $\sqrt{\beta(s, \alpha)}$. This allows for faster traversal of the loss landscape without the system becoming as unstable as it would with a high raw learning rate.
  • Explicit Rate Formula: The author derives a quantitative expression for the convergence rate $\lambda_{s,\alpha}$ that depends on the "height" of potential barriers ($H_f$) in the non-convex landscape and the mixing parameter $\beta$.
  • Numerical Demonstration of Robustness: The paper compares the iteration counts needed for convergence at different learning rates ($s=0.1$ vs $s=0.001$). For standard SGD, the ratio of iterations is a staggering $10^{45}$. For SGD with momentum ($\alpha=0.9$), this ratio drops to $6 \times 10^7$, demonstrating vastly superior robustness.

Conclusion and Future Work

The paper successfully carries the continuous-time guarantees back to the discrete regime, proving that the iterates of SGD with momentum converge linearly to a neighborhood of the global minimum. However, some limitations remain:

  • Small Learning Rate Assumption: The SDE approximation relies on the learning rate being "sufficiently small," which may not capture dynamics at the very start of training with large learning rates.
  • Fixed Hyperparameters: The current work focuses on fixed $s$ and $\alpha$. Extending this analysis to adaptive learning rate schedules or algorithms like Adam and RMSProp is a promising future direction.
  • Discretization Gap: Characterizing the gap between the stationary distribution of the SDE and the actual discrete algorithm remains an open challenge.

Summary updated

BibTeX
@misc{shi2021hyperparameters,
  author = {Bin Shi},
  title = {{On the Hyperparameters in Stochastic Gradient Descent with Momentum}},
  year = {2021},
  eprint = {2108.03947},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.03947},
}
Figure