Uniform-in-Time Weak Error Analysis for Stochastic Gradient Descent Algorithms via Diffusion Approximation

Yuanyuan Feng, Tingran Gao, Lei Li, Jian-Guo Liu, Yulong LuarXiv 2019

Introduction

Stochastic Gradient Descent (SGD) is the workhorse of modern machine learning. To understand its complex dynamics, researchers often employ diffusion approximation, a framework that models discrete SGD iterates using continuous-time Stochastic Differential Equations (SDEs). While continuous calculus offers powerful tools for analysis, a significant theoretical gap has persisted: standard diffusion approximations are typically only valid over finite time horizons. As the algorithm approaches a stationary distribution or runs toward infinity, the approximation error often explodes.

In this paper, we introduce a new theoretical framework that bridges this gap. By applying "backward error analysis" to the diffusion approximation, we demonstrate that a modified SDE can track the distribution of SGD iterates with $O(\eta^2)$ accuracy uniformly in time, provided the objective function is locally strongly convex.

The Challenge of Infinite Time Horizons

The primary motivation for using SDEs is that they are often easier to analyze than discrete-time Markov chains. However, the "catch" in existing literature is the lack of long-term stability. For practitioners interested in the stationary behavior of SGD—such as its ability to generalize or its behavior near a local minimum—a finite-time approximation is insufficient.

When an SDE model is used to approximate SGD over an infinite horizon, the discrepancy between the continuous path and the discrete steps tends to accumulate. This makes it difficult to draw rigorous conclusions about the algorithm's asymptotic properties using the diffusion framework.

Methodology: Backward Error Analysis and Modified Equations

To solve the error accumulation problem, we pivot from analyzing the SDE's sample paths to analyzing the Backward Kolmogorov Equation. This equation describes how the expectation of a "test function" (an observable property of the system) evolves over time. Our approach incorporates several key technical innovations:

  1. Stochastic Modified Equations: We utilize a specific SDE that includes a "correction term" proportional to the step size $\eta$. This term is designed to better align the continuous dynamics with the discrete jumps of SGD.
  2. Backward Error Analysis: Borrowed from numerical analysis, this technique involves identifying a "modified" equation that the numerical scheme (in this case, SGD) solves more accurately than the original SDE.
  3. Truncated Formal Power Expansion: We expand the solution of the Kolmogorov equation into a power series of the step size $\eta$. By keeping only the first few terms, we derive a "local" approximation. Unlike global SDE solutions, these expansion coefficients are determined by derivatives at the current point, making them significantly more stable over long durations.
  4. Uniform-in-Time Bounds: The core mathematical result is proving that these expansion coefficients remain bounded and decay exponentially near a local minimum. This prevents the error from growing as $t \to \infty$.

Key Insights

Our analysis reveals that the "locality" of the truncated expansion is a critical feature. Because the coefficients only depend on local information rather than the global landscape, the approximation remains stable near a local minimum indefinitely.

Furthermore, we identify an $O(\eta^2)$ "sweet spot." While the SDE serves as a second-order approximation, attempting to reach higher orders (e.g., $O(\eta^3)$) within the diffusion approximation framework encounters inherent mathematical limits. This work effectively connects the Markov Chain perspective (accurate for long-term behavior but computationally difficult) with the SDE perspective (mathematically tractable but previously limited to short-term behavior).

Results and Validation

The theoretical framework yields two major results:

  • Uniform Weak Error: We prove that the difference between the expected value of a test function under SGD and our proposed approximation is bounded by $C\eta^2$ for all time $t \ge 0$.
  • Convergence Rates: The analysis shows that SGD reaches an $O(\eta)$ neighborhood of the global minimum in $O(\eta^{-1} \log \eta^{-1})$ time. This matches existing empirical knowledge but provides a rigorous new derivation.

To validate these findings, we conducted experiments using synthetic one-dimensional objective functions, including a simple quadratic and a non-quadratic locally convex function. Numerical results confirmed the theory: log-log plots of the error versus the step size $\eta$ consistently showed a slope of approximately 2.0, validating the $O(\eta^2)$ prediction.

Limitations and Future Work

While this work extends the reach of diffusion approximation, some constraints remain. The current proof requires the objective function to be locally strongly convex, which describes the final stages of training but may not capture the "exploration phase" in highly non-convex landscapes. Additionally, the analysis focuses on constant step sizes. Future research will look toward extending these uniform-in-time techniques to adaptive methods (like Adam), decaying step size schedules, and momentum-based variants like Nesterov acceleration.

Summary updated

BibTeX
@misc{feng2019uniform,
  author = {Yuanyuan Feng and Tingran Gao and Lei Li and Jian-Guo Liu and Yulong Lu},
  title = {{Uniform-in-Time Weak Error Analysis for Stochastic Gradient Descent Algorithms via Diffusion Approximation}},
  year = {2019},
  eprint = {1902.00635},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.00635},
}
Figure