Variance Reduction Methods Do Not Need to Compute Full Gradients: Improved Efficiency through Shuffling

Daniil Medyakov, Gleb Molodtsov, Savelii Chezhegov, Alexey Rebrikov, Aleksandr Beznosikov

TL;DR

This paper introduces a novel approach that eliminates the expensive requirement of computing full gradients in variance-reduced stochastic optimization methods like SVRG and SARAH. By combining data shuffling with a memory-efficient moving average gradient approximation, the proposed algorithms achieve state-of-the-art convergence rates without the massive memory overhead typical of prior methods.

What Problem Does This Paper Address?

Stochastic Gradient Descent (SGD) is the bedrock of large-scale machine learning, but it suffers from a major drawback: the variance of its stochastic gradient estimators remains high throughout training, slowing down convergence. To fix this, researchers developed Variance Reduction (VR) methods like SVRG and SARAH. However, these methods introduce a new bottleneck—they require periodic computations of the full gradient across the entire dataset, which is prohibitively expensive for massive datasets.

While other VR methods like SAG and SAGA avoid full gradient computations, they pay a heavy price in memory, requiring $O(nd)$ additional storage (where $n$ is the dataset size and $d$ is the parameter dimension). This paper tackles a critical gap: How can we eliminate full gradient computations in VR methods while maintaining a minimal $O(d)$ memory footprint?

Methods

The authors introduce two new algorithms: No Full Grad SVRG (Algorithm 1) and No Full Grad SARAH (Algorithm 2). The core innovation lies in how they approximate the full gradient without storing historical gradients for every single data point.

  1. The Shuffling Heuristic: Instead of sampling data points completely at random at each step, the algorithms use data shuffling (like Random Reshuffling). This guarantees that every data sample is visited exactly once per epoch.
  2. Moving Average Approximation: Because shuffling ensures every sample is processed exactly once in an epoch, the authors can reliably approximate the full gradient by maintaining a simple running average of the stochastic gradients computed during the previous epoch. This requires only $O(d)$ additional memory.
  3. The SAG vs. SAGA Insight: Prior attempts to modify SARAH used a SAGA-like framework to maintain an unbiased estimator, which inadvertently inflated variance. This paper leverages a biased, SAG-like update rule. Since shuffling inherently introduces bias anyway, embracing this bias allows for larger step sizes and significantly faster convergence rates.

Datasets

The authors evaluated their methods on several standard optimization and deep learning benchmarks:

  • ijcnn1 and a9a: Used for non-linear least squares regression tasks.
  • CIFAR-10 and CIFAR-100: Used for training a ResNet-18 image classification model from scratch.
  • Tiny ImageNet: Used to fine-tune a hierarchical vision transformer (Swin Transformer).

Key Insights and Ideas

  • Shuffling as an Enabler for Approximation: Shuffling isn't just a practical trick to speed up SGD; its mathematical property of touching every data point exactly once per epoch is what makes the memory-efficient moving average a mathematically sound proxy for the full gradient.
  • Embracing Bias for Better Bounds: In shuffling settings, striving for an "unbiased" gradient estimator (like SAGA) actually degrades performance. Accepting a biased estimator (like SAG) reduces variance by an order of magnitude, unlocking tighter convergence bounds.
  • Optimal Memory-Complexity Tradeoff: The proposed algorithms achieve the best of both worlds: the optimal oracle complexity of full-gradient VR methods and the low memory footprint ($O(d)$) of standard SGD.

Key Results

  • Theoretical Guarantees: For non-convex objectives, the algorithms match the convergence rates of standard shuffling methods ($O(nL/\epsilon^2)$). For strongly convex objectives, they improve upon existing no-full-grad shuffling methods, achieving a rate of $O(\frac{nL}{\mu} \log \frac{1}{\epsilon})$.
  • Empirical Performance:
  • On CIFAR-10, No Full Grad (NFG) SVRG and NFG SARAH significantly reduced training loss oscillations and achieved smoother, faster convergence compared to standard SGD and their regular VR counterparts.
  • On CIFAR-100, NFG SARAH stabilized training and outpaced standard SARAH, leading to lower final test loss and reduced overfitting.
No Full Grad SVRG vs SVRG on CIFAR-10
No Full Grad SARAH vs SARAH on CIFAR-10
  • Transformer Fine-Tuning: When fine-tuning a Swin Transformer on Tiny ImageNet, the authors' modified RR NFG-SARAH achieved the highest final accuracy (77.875%) compared to standard SGD (76.545%) and the baseline VR methods.

Limitations and Future Work

The primary limitation acknowledged by the authors is a theoretical one: a gap still remains between their proven upper bounds and the absolute lower bounds for this class of stochastic first-order shuffling methods. The authors suggest that future research incorporating mini-batching strategies into the analysis could help close this gap and yield even tighter convergence estimates.

Summary updated

BibTeX
@misc{medyakov2025variance,
  author = {Daniil Medyakov and Gleb Molodtsov and Savelii Chezhegov and Alexey Rebrikov and Aleksandr Beznosikov},
  title = {{Variance Reduction Methods Do Not Need to Compute Full Gradients: Improved Efficiency through Shuffling}},
  year = {2025},
  eprint = {2502.14648},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.14648},
}
Figure