Shuffling Gradient-Based Methods with Momentum

Trang H. Tran, Lam M. Nguyen, Quoc Tran-Dinh

Abstract

We combine two advanced ideas widely used in optimization for machine learning: shuffling strategy and momentum technique to develop a novel shuffling gradient-based method with momentum, coined Shuffling Momentum Gradient (SMG), for non-convex finite-sum optimization problems. While our method is inspired by momentum techniques, its update is fundamentally different from existing momentum-based methods. We establish state-of-the-art convergence rates of SMG for any shuffling strategy using either constant or diminishing learning rate under standard assumptions (i.e. $L$-smoothness and bounded variance). When the shuffling strategy is fixed, we develop another new algorithm that is similar to existing momentum methods, and prove the same convergence rates for this algorithm under the $L$-smoothness and bounded gradient assumptions. We demonstrate our algorithms via numerical simulations on standard datasets and compare them with existing shuffling methods. Our tests have shown encouraging performance of the new algorithms.

Introduction

In modern machine learning, optimization problems are typically framed as "finite-sum" minimization, where the goal is to minimize a loss function averaged over a finite set of training examples. While standard Stochastic Gradient Descent (SGD) with replacement is well-understood theoretically, practitioners often favor "without-replacement" shuffling strategies, such as Randomized Reshuffling (RR), for their superior empirical performance.

However, the statistical dependencies introduced by shuffling make theoretical analysis challenging. Furthermore, while momentum is a standard tool for accelerating SGD, combining it with shuffling in a mathematically rigorous and efficient manner has remained an open question. This paper introduces Shuffling Momentum Gradient (SMG), bridging this gap by providing state-of-the-art convergence guarantees for momentum-based shuffling in non-convex settings.

Methodology: The SMG Algorithm

The core innovation of this work is the Shuffling Momentum Gradient (SMG) algorithm. Unlike traditional momentum methods that update the momentum buffer at every iteration, SMG employs a unique epoch-based update mechanism.

Epoch-Wise Momentum Buffer

At the beginning of each epoch, the momentum term is fixed. During the epoch, the algorithm maintains an auxiliary variable to track the running average of gradients. This average is then used to update the momentum term for the subsequent epoch. This design choice is critical for handling the lack of independence inherent in shuffling strategies, allowing for a cleaner theoretical analysis without compromising practical speed.

Variants and Learning Rates

The authors also propose Single Shuffling Momentum Gradient (SSMG), a variant where data is shuffled only once at the start of training. The analysis covers four distinct learning rate schedules—constant, diminishing, exponential, and cosine annealing—demonstrating the algorithm's robustness across different training regimes.

Experimental Evaluation

The performance of SMG was benchmarked against standard optimizers (SGD, SGD with Momentum, and Adam) across several datasets.

Neural Network Benchmarks

On deep learning tasks using Fashion-MNIST (LeNet-300-100) and CIFAR-10 (LeNet-5), SMG demonstrated competitive performance. While it may start slightly slower than Adam or SGD-M, it consistently catches up and often matches or exceeds their final training loss.

Training loss comparison on Fashion-MNIST and CIFAR-10 datasets.

Statistical Learning Benchmarks

For non-convex logistic regression tasks on the w8a and ijcnn1 datasets, SMG showed significant improvements over both SGD and Adam, and a slight edge over standard SGD with momentum.

Training loss comparison on w8a and ijcnn1 datasets.

Key Insights and Results

  • Optimal Convergence Rates: SMG achieves a convergence rate of $O(1/T^{2/3})$ for general shuffling and $O(1/(n^{1/3}T^{2/3}))$ for randomized reshuffling, matching the best-known rates for non-momentum shuffling methods.
  • Hyperparameter Stability: SMG is remarkably stable with respect to the momentum decay factor $\beta$, performing optimally in the [0.1, 0.5] range, which differs from the standard $\beta=0.9$ used in SGD-M.
  • Theoretical vs. Empirical Gains: The randomized reshuffling variant of SMG is theoretically superior to standard SGD when the number of epochs $T$ is large relative to the dataset size $n$.

Conclusion and Future Work

SMG represents a significant step in unifying shuffling strategies with momentum techniques. By decoupling momentum updates from intra-epoch noise, the authors provide a robust framework with strong theoretical guarantees. Future research directions include extending this epoch-based momentum approach to mini-batch settings, minimax problems (e.g., GANs), and federated learning environments.

Summary updated

BibTeX
@inproceedings{tran2021shuffling,
  author = {Trang H. Tran and Lam M. Nguyen and Quoc Tran-Dinh},
  title = {{Shuffling Gradient-Based Methods with Momentum}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=G3b_3RyTubT},
}
Figure