The Implicit Regularization of Stochastic Gradient Flow for Least Squares

Alnur Ali, Edgar Dobriban, Ryan J. Tibshirani

In machine learning, Stochastic Gradient Descent (SGD) is the engine that powers the training of massive models. It is fast, scalable, and memory-efficient. Interestingly, researchers have long noticed that even without explicit penalties like $\ell_2$ regularization, SGD tends to "prefer" simpler solutions that generalize well to unseen data. This phenomenon is known as implicit regularization.

While it is well-established that standard, full-batch Gradient Descent behaves similarly to Ridge regression, the "S" in SGD introduces a layer of complexity. SGD is inherently noisy because it estimates the gradient using only a small "mini-batch" of data at each step. Does this noise help or hurt regularization? Does the relationship to Ridge regression hold throughout the entire training process, or only at convergence?

This paper provides a rigorous mathematical bridge between SGD and Ridge regression for least squares problems, quantifying exactly how much "extra" risk we pay for the computational speed of mini-batching.

Continuous-Time Modeling with SGF

To make the mathematics tractable, the authors adopt a continuous-time perspective. Instead of analyzing the discrete, step-by-step updates of SGD, they study a Stochastic Differential Equation (SDE) proxy called Stochastic Gradient Flow (SGF).

Optimization trajectories showing SGF closely tracking discrete SGD.

To justify this proxy, the authors employ moment matching. They prove that the first and second moments (the mean and covariance) of their continuous SGF model perfectly match those of discrete-time SGD. This ensures that the SDE is a faithful representation of the actual algorithm's behavior in the optimization landscape.

The Path-wise Connection to Ridge Regression

Unlike previous work that primarily looked at where SGD eventually converges, this paper demonstrates that the relationship to Ridge regression holds across the entire optimization path.

The authors establish a direct mapping between "training time" in SGF and "regularization strength" in Ridge regression. Specifically, they compare SGF at time $t$ directly to a Ridge regression model with a tuning parameter $\lambda = 1/t$. This implies that early-stopping SGD is mathematically equivalent to choosing a specific $\lambda$ penalty in Ridge.

Coefficient paths for Ridge Regression, SGD, and SGF, demonstrating their striking similarity.

To quantify the differences, the authors break down the "excess risk" (the difference in performance between SGF and Ridge) into three distinct parts:

  1. The variance inherent in the Ridge regression itself.
  2. A "price of stochasticity" term that vanishes over time.
  3. A term tied to the limiting optimization error.

Key Findings and Insights

  • Quantifying the Noise: The analysis shows that mini-batching doesn't just inject random noise; it adds a specific type of variance that scales proportionally with the step size ($\epsilon$) and inversely with the batch size ($m$). This gives practitioners a concrete way to calculate the "cost" of using smaller batches.
  • Coefficient Proximity: Beyond just achieving similar error rates, the authors prove that the actual weights (coefficients) learned by SGF remain close to the Ridge coefficients in Euclidean distance throughout training.
  • The Interpolation Regime: In "overparameterized" settings (where the model has more parameters than data points), the stochastic noise eventually vanishes because the model can perfectly fit every mini-batch. In "underparameterized" settings, however, the noise persists, causing the solution to continuously fluctuate around the optimum.
  • Computational-Statistical Trade-off: Numerical results reveal that an optimally stopped SGD can achieve a risk within 1.0032x of the optimally tuned Ridge solution, but it often reaches this point in significantly less computational time.

Limitations and Future Work

While this paper provides a robust theoretical framework, it is currently limited to least squares regression. Extending this analysis to classification tasks (like logistic regression) or the highly non-convex landscapes of deep neural networks remains a significant challenge.

Furthermore, the current analysis focuses on constant step sizes. In practice, modern deep learning relies heavily on learning rate schedules (like step decay or cosine annealing) and adaptive optimizers (like Adam or RMSProp). These methods introduce different implicit biases and would require a more complex, time-varying SDE to model accurately. Finally, while the moments of SGF and SGD match, a "strong" proof showing the two paths stay close in a strict trajectory sense is left for future research.

Summary updated

BibTeX
@inproceedings{ali2020implicit,
  author = {Alnur Ali and Edgar Dobriban and Ryan J. Tibshirani},
  title = {{The Implicit Regularization of Stochastic Gradient Flow for Least Squares}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=a_aE0664IyX},
}
Figure