Optimal Mini-Batch and Step Sizes for SAGA

Nidham Gazagnadou, Robert M. Gower, Joseph Salmon

Introduction

In large-scale machine learning, Empirical Risk Minimization (ERM) is often solved using Stochastic Gradient Descent (SGD). However, SGD requires tedious tuning of decaying step sizes. Variance-reduced methods like SAGA improve upon this by allowing for a constant step size and achieving faster, linear convergence.

Despite these theoretical advantages, a persistent friction point has remained between theory and practice. Most theoretical analyses suggest that a mini-batch size of $b=1$ is optimal for total complexity. Yet, practitioners almost always use larger mini-batches to speed up training. Furthermore, setting the step size ($\gamma$) usually requires an expensive numerical grid search because theoretical "safe" step sizes are often too conservative.

This paper bridges that gap. By deriving closed-form expressions for the "expected smoothness constant," the authors provide a principled way to select optimal mini-batch sizes and larger step sizes, proving that a mini-batch size of 1 is often not the most efficient choice.

Methods: Bounding Expected Smoothness

The paper operates within the JacSketch framework, a general family of variance-reduced methods that includes SAGA. The core approach involves analyzing how the smoothness of the objective function changes when sampling a mini-batch of size $b$ without replacement (referred to as $b$-nice sampling).

The authors identify the expected smoothness constant ($\mathcal{L}$) as the missing link. If this constant can be calculated or tightly bound, it unlocks much larger step sizes and allows for analytically determining the best mini-batch size. They derive three ways to estimate $\mathcal{L}$:

  • The Simple Bound: A straightforward interpolation between the average smoothness and the maximum smoothness of individual data points.
  • The Bernstein Bound: A more refined bound using matrix concentration inequalities, particularly useful for high-dimensional data ($d \gg n$).
  • The Practical Estimate: A heuristic that performs exceptionally well in experiments, closely matching the true (but computationally intractable) value of $\mathcal{L}$.

By plugging these bounds into SAGA's complexity formulas, they derive a formula for the optimal mini-batch size ($b^*$) that minimizes the total number of stochastic gradient computations.

Key Insights

  • Linear Speedup is Real: The total complexity of SAGA decreases linearly as the mini-batch size $b$ increases, up to a specific threshold $b^*$. This confirms that mini-batching isn't just a hardware trick; it is mathematically sound for reducing total work.
  • The "V" Shape of Complexity: Total complexity follows a piecewise linear path. Initially, increasing $b$ reduces complexity because it allows for much larger step sizes. Eventually, the cost of computing a larger mini-batch outweighs the gains in step size, and complexity starts to rise again.
Theoretical V-shape of total complexity
  • Step Size is Batch-Dependent: The "safe" step size is not a single static number but a function of $b$. As the mini-batch size increases, the "expected smoothness" improves, allowing for more aggressive steps.

Experimental Results

The authors validated their theory using synthetic datasets and real-world datasets from LIBSVM and the UCI Repository (e.g., covtype.binary, slice) on tasks like Regularized Logistic Regression and Ridge Regression.

  • Superior Defaults: The proposed "practical" settings for $b$ and $\gamma$ significantly outperformed standard defaults suggested in prior literature (such as those by Defazio et al. or Hofmann et al.).
  • Grid Search Performance without the Grid Search: In experiments on the slice dataset, the analytically derived optimal mini-batch size ($b=70$) was nearly identical to the best size found through an exhaustive, expensive numerical grid search.
  • Significant Speedups: The authors' method achieved convergence in fewer epochs and less time compared to traditional SAGA configurations.
Convergence comparison showing practical settings outperforming defaults

Limitations and Future Work

  • Generalized Linear Models (GLMs): The specific closed-form bounds for $\mathcal{L}$ are derived for GLMs. While the authors conjecture these results apply to other variance-reduced methods (like SVRG or SARAH), the explicit formulas might differ.
  • Strong Convexity: The complexity analysis relies on the objective being $\mu$-strongly convex. Extending this to non-convex problems, such as deep learning, remains an open challenge.
  • Computational Overhead: While the formulas are relatively simple, they still require calculating quantities like the maximum smoothness ($L_{max}$) and average smoothness ($\bar{L}$), which might introduce an extra step for some automated pipelines.

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