SARAH: A Novel Method for Machine Learning Problems Using Stochastic Recursive Gradient

Lam M. Nguyen, Jie Liu, Katya Scheinberg, Martin Takác

Presented at ICML 2017, SARAH (StochAstic Recursive grAdient algoritHm) introduces a powerful variance-reduction method for solving finite-sum optimization problems—the bread and butter of supervised machine learning.

SARAH is a novel stochastic gradient method that uses a recursive update rule to achieve state-of-the-art convergence rates. It effectively combines the best of both worlds: the memory efficiency of SVRG (eliminating the need to store $n$ gradients) and the stability of a decreasing variance in its inner loop, a feature that SVRG notably lacks.

The Optimization Bottleneck

In machine learning, we frequently aim to minimize a loss function that is the average of losses over $n$ individual data points: $\min P(w) = \frac{1}{n} \sum f_i(w)$.

Standard Gradient Descent (GD) is highly stable but requires calculating $n$ gradients for every single step, which becomes computationally prohibitive for large datasets. Conversely, Stochastic Gradient Descent (SGD) is fast because it uses only one data point per step. However, its high variance leads to slow (sublinear) convergence and requires careful tuning of the learning rate.

Existing "variance reduction" methods like SVRG and SAGA were designed to bridge this gap, offering linear convergence. However, SAGA requires $O(n)$ storage (storing a gradient for every data point), and SVRG’s "inner loop" can be unstable because the variance of its gradient estimates doesn't necessarily decrease as the loop progresses.

The SARAH Algorithm

To address these shortcomings, the authors propose the Stochastic Recursive Gradient (SARAH) algorithm. Its defining feature is the recursive update of the gradient estimate ($v_t$):

$$v_t = \nabla f_{i_t}(w_t) - \nabla f_{i_t}(w_{t-1}) + v_{t-1}$$

How it differs from SVRG

In SVRG, the update is $v_t = \nabla f_{i_t}(w_t) - \nabla f_{i_t}(w_0) + v_0$. SVRG always references the very beginning of the "epoch" ($w_0$). SARAH, however, references the immediately preceding iterate ($w_{t-1}$). This seemingly small change has massive theoretical and practical implications for the algorithm's stability.

SARAH+

The authors also introduce SARAH+, a practical variant. While standard SARAH uses a fixed number of inner steps ($m$), SARAH+ uses an adaptive stopping criterion. It monitors the norm of the gradient estimate $\|v_t\|^2$ and terminates the inner loop early if the estimate has provided sufficient reduction, or if it reaches a maximum step limit.

Key Insights and Stability

  • Inner Loop Convergence: The most significant breakthrough is that SARAH’s stochastic steps converge linearly within a single inner loop. In SVRG, the iterates can wander randomly around the optimum; in SARAH, they follow a much more stable, directed path.
Comparison of optimization paths for SVRG and SARAH. SARAH demonstrates a much more stable, directed path to the optimum.
  • No Storage Burden: Unlike SAG/SAGA, SARAH does not need to store $n$ previous gradients. This makes it much more feasible for high-dimensional problems where memory is a strict bottleneck.
  • Larger Learning Rates: Theoretically, SARAH allows for a larger learning rate ($\eta < 1/L$) than SVRG ($\eta < 1/4L$). In practice, larger learning rates usually translate to faster convergence.
  • Bias vs. Unbiasedness: Unlike SGD or SVRG, SARAH's gradient estimate $v_t$ is biased. However, the authors show that this bias is controlled and actually contributes to the algorithm's superior stability.

Empirical Results

The algorithm was evaluated on four standard large-scale datasets for $\ell_2$-regularized logistic regression: covtype, ijcnn1, news20, and rcv1.

  • Theoretical Parity/Superiority: SARAH matches the best-known convergence rates for strongly convex functions ($O((n + \kappa) \log(1/\epsilon))$).
  • Empirical Performance: In head-to-head tests against SVRG, SAGA, and FISTA, SARAH and SARAH+ consistently reached lower loss residuals faster.
Training loss over effective passes on the rcv1 dataset, showing SARAH achieving lower loss faster than SVRG, SGD+, and FISTA.
  • Robustness to Parameters: SARAH+ proved to be very robust. The authors found that a single hyperparameter setting ($\gamma = 1/8$ for the stopping criterion) worked optimally across different datasets, suggesting it is easier to tune than its predecessors.

Limitations and Future Work

  • Convexity Assumptions: The primary analysis in this paper focuses on convex and strongly convex functions. While many ML problems fit this description (like Logistic Regression or SVMs), deep learning involves highly non-convex landscapes. (Note: Subsequent research has since extended SARAH to non-convex settings).
  • Computational Cost: Like SVRG, SARAH requires a "full gradient" computation at the start of every epoch, which can be a significant "up-front" cost before the fast stochastic steps begin.
  • Two Gradients per Step: Each inner iteration requires two stochastic gradient evaluations ($\nabla f(w_t)$ and $\nabla f(w_{t-1})$), which is double the per-step cost of vanilla SGD, though this is a standard and acceptable trade-off for variance reduction.

Summary updated

BibTeX
@inproceedings{nguyen2017sarah,
  author = {Lam M. Nguyen and Jie Liu and Katya Scheinberg and Martin Takác},
  title = {{SARAH: A Novel Method for Machine Learning Problems Using Stochastic Recursive Gradient}},
  booktitle = {International Conference on Machine Learning},
  year = {2017},
  url = {https://openreview.net/forum?id=SyE-dj-O-S},
}
Figure