Optimal mini-batch and step sizes for SAGA

Nidham Gazagnadou, Robert M. Gower, Joseph Salmon

TL;DR

This paper provides the first closed-form expressions for calculating the optimal mini-batch size and step size for the SAGA algorithm a priori. By deriving tight bounds on the "expected smoothness constant," the authors demonstrate that SAGA achieves a linear speedup with mini-batching—aligning theoretical complexity with practical performance and eliminating the need for expensive hyperparameter grid searches.

What Problem Does This Paper Address?

Stochastic variance-reduced gradient methods like SAGA are workhorses in modern machine learning, offering fast linear convergence for convex problems. However, they come with a tuning headache: users must choose both a step size ($\gamma$) and a mini-batch size ($b$).

Historically, theoretical analysis often suggested that a mini-batch size of $b=1$ was optimal for overall complexity. This directly contradicted practical experience, where researchers found that larger mini-batches often led to faster wall-clock times and better stability. Recent theory suggested these parameters depend on an "expected smoothness constant" ($\mathcal{L}$), but this constant was considered computationally intractable to find. Consequently, practitioners were forced to rely on time-consuming numerical grid searches to find the "sweet spot" for their specific datasets.

Methods

The authors bridge the gap between theory and practice by developing tractable upper bounds for the expected smoothness constant $\mathcal{L}$ under $b$-nice sampling (sampling mini-batches of size $b$ without replacement). Their approach includes:

  1. The Simple Bound: A straightforward bound that is tight for small mini-batch sizes.
  2. The Bernstein Bound: A refined bound derived using matrix concentration inequalities, which proves more effective for large mini-batch sizes and high-dimensional data.
  3. Practical Estimate ($\mathcal{L}_{practical}$): A heuristic formula that interpolates between known theoretical limits. As shown in Figure 3 (below), this estimate tracks the true (but intractable) constant $\mathcal{L}$ remarkably well.
Figure 3: Expected smoothness constant L and its upper- bounds as a function of the mini-batch size b for ridge regres- sion on the unscaled staircase eigval dataset (λ = 10−3).

By plugging these bounds into iteration complexity formulas, the authors define the total complexity $K_{total}(b)$ as a function of $b$ and solve for the $b$ that minimizes it.

Datasets

The authors validated their theory across a diverse set of benchmarks:

  • Artificial Datasets: Synthetic matrices (uniform, alone eigval, staircase eigval) designed to test specific spectral properties and verify the tightness of the new bounds.
  • Real-World Datasets: Standard benchmarks from LIBSVM and the UCI repository, including YearPredictionMSD, slice, ijcnn1, covtype.binary, real-sim, rcv1.binary, and news20.binary.
  • Tasks: The experiments focused on Ridge Regression and Regularized Logistic Regression.

Key Insights and Ideas

  • Linear Speedup is Real: The paper proves that SAGA's total complexity decreases linearly as the mini-batch size $b$ increases, up to a specific optimal value $b^*$. This confirms that mini-batching isn't just a practical hack; it's theoretically sound.
  • The "V-Curve" of Complexity: Total complexity follows a piecewise linear "V" shape. Increasing $b$ initially helps by allowing for much larger step sizes, but past $b^*$, the marginal gain in step size no longer offsets the increased cost of computing a larger gradient batch.
  • Spectral Sensitivity: The optimal mini-batch size is not universal; it depends heavily on the data's eigenvalues. Datasets with a few dominant eigenvalues (high "spectral stiffness") benefit more from larger mini-batches.
  • Larger Step Sizes: The new theory allows for step sizes that are significantly larger than previous theoretical recommendations, leading to much faster convergence in practice.
Figure 1: Step size as a function of the mini-batch size for a regularized (λ = 10−3) logistic regression problem applied to the feature-scaled covtype.binary dataset from LIBSVM.

Key Results

  • Grid Search Parity: The proposed practical settings ($b_{practical}, \gamma_{practical}$) achieve performance comparable to an exhaustive numerical grid search but at zero additional computational cost.
  • Empirical Optimality: In tests on the slice dataset, the predicted $b_{practical}$ was very close to the empirical optimum found by testing every possible power-of-two batch size.
  • Convergence Speed: As seen in Figure 5, the authors' settings significantly outperform standard defaults (like $b=1$ or $b=20$ with conservative step sizes), reaching target error levels in far fewer epochs.
Figure 5: Comparison of SAGA settings for ridge regression on the unscaled slice dataset (λ = 10−1).

Limitations and Future Work

  • GLM Focus: The current analysis is tailored to Generalized Linear Models (GLMs) with quadratic regularization. While this covers many common use cases (Logistic Regression, Ridge Regression), it remains to be seen how well these bounds generalize to non-GLM objectives.
  • Sampling Schemes: The results are specific to sampling without replacement ($b$-nice sampling). Extending this to other schemes, like importance sampling, is a logical next step.
  • Other Algorithms: The authors conjecture that similar "linear speedup" results exist for other variance-reduced methods like SVRG, suggesting a broad path forward for hyperparameter auto-tuning in stochastic optimization.

Summary updated

BibTeX
@inproceedings{gazagnadou2019optimal,
  author = {Nidham Gazagnadou and Robert M. Gower and Joseph Salmon},
  title = {{Optimal mini-batch and step sizes for SAGA}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=H1-5Ejb_WH},
}
Figure