Rapid Overfitting of Multi-Pass Stochastic Gradient Descent in Stochastic Convex Optimization

Shira Vansover-Hager, Tomer Koren, Roi Livni · DOI

Abstract

While one-pass Stochastic Gradient Descent (SGD) is the gold standard for generalization in convex optimization, this paper reveals that running just one additional pass can lead to catastrophic overfitting. We prove that the "optimal" step size for a single epoch can cause population loss to explode from near-zero to a constant value ($\Omega(1)$) in the second epoch. This work highlights a sharp phase transition in how SGD generalizes in non-smooth regimes, suggesting that the common practice of multi-pass training requires careful theoretical re-evaluation in the context of generalization risk.

Introduction: The Gap Between Theory and Practice

In Stochastic Convex Optimization (SCO), a classic result states that running SGD for a single pass over $n$ data points achieves the minimax optimal excess population loss of $\Theta(1/\sqrt{n})$. However, practitioners rarely stop after one pass; they typically run multiple epochs to minimize training error.

While the theoretical community has extensively studied how multi-pass SGD aids optimization (minimizing empirical risk), its effect on generalization (performance on unseen data) remains less understood. This paper addresses a critical question: How fast does overfitting occur? Specifically, if we tune our step size to be optimal for a single pass, does the model collapse the moment we begin the second pass?

Methodology

The authors investigate the general non-smooth SCO setting, where the loss function is convex and Lipschitz but not necessarily differentiable. To establish their results, they employ several sophisticated theoretical constructions:

  • Hard Loss Functions: The use of variants of Feldman’s function, which are designed to contain "spurious" empirical minimizers far from the true population minimizer.
  • Memorization Mechanism: The authors demonstrate that during the first pass, while SGD minimizes population risk, it simultaneously "memorizes" training samples. At the start of the second pass, the algorithm uses this memory to steer iterates toward a "bad" vector—one that achieves zero empirical risk but performs poorly on the true distribution.
  • High-Dimensionality: These constructions are situated in the overparameterized regime, where the dimension $d$ of the problem scales linearly with the number of samples $n$ ($d = O(n)$).
  • Packing Arguments: High-dimensional geometry is used to ensure the existence of these "bad" vectors that the algorithm cannot easily avoid once the second pass begins.

The V-Shape of Generalization

A central finding of the paper is the dramatic "phase transition" that occurs at the boundary between the first and second epochs. For standard step sizes, the population loss follows a V-shaped trajectory: it drops at the optimal rate during the first epoch and spikes immediately upon entering the second.

Population loss vs. epochs for different learning rates, illustrating the rapid overfitting after the first pass.

As shown in the figure above, the canonical step size $\eta = \Theta(1/\sqrt{n})$ (represented by the green line $\eta = n^{-0.5}$) is the most "dangerous" choice. While it provides the best performance at the end of epoch 1, it provides enough signal to memorize the data and enough flexibility to overfit rapidly thereafter. In contrast, much smaller step sizes (like $\eta = n^{-1.5}$) avoid the spike but fail to reach low loss values within the first few epochs.

Key Insights and Results

1. Tight Population Risk Bounds

The authors establish that for multi-pass SGD with $T$ total steps and step size $\eta$, the population excess risk is $\Theta(1/(\eta T) + \eta \sqrt{T})$. This formula captures the trade-off between optimization (the first term) and the rapid onset of overfitting (the second term).

2. Generalization Gap vs. Population Risk

The study reveals that the generalization gap—the difference between training and test error—is a poor proxy for performance during the first pass of SGD. However, it becomes "tight" and accurately explains the algorithm's failure from the second pass onward.

3. With-Replacement vs. Without-Replacement

The paper proves that "with-replacement" SGD (sampling a random point every step) eventually suffers the same fate as "without-replacement" (shuffling epochs). However, the with-replacement version takes slightly longer to overfit—roughly $O(n \log n)$ steps, corresponding to the time required to see most of the training set at least once (the "coupon collector" problem).

Discussion and Limitations

This work establishes a sharp separation between the smooth case, where overfitting is typically slower, and the non-smooth case, where it is nearly instantaneous. However, several open questions remain:

  • Smoothness: Characterizing population risk bounds for the smooth setting remains a significant challenge, as the dynamics of overfitting are less aggressive.
  • Transition Dynamics: While the analysis is highly effective from the end of the second epoch onward, precisely modeling the transition during the early stages of the second pass requires further refined techniques.
  • Uniform Convergence: It remains to be seen if these results hold in settings where uniform convergence applies, such as low-norm linear predictors.

Summary updated

BibTeX
@inproceedings{vansoverhager2025rapid,
  author = {Shira Vansover-Hager and Tomer Koren and Roi Livni},
  title = {{Rapid Overfitting of Multi-Pass Stochastic Gradient Descent in Stochastic Convex Optimization}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Qq5h78Eshy},
}
Figure