Coupling Adaptive Batch Sizes with Learning Rates

Lukas Balles, Javier Romero, Philipp Hennig

Abstract

Training deep neural networks requires a delicate balance between learning rate schedules and batch sizes. Traditionally, practitioners decay the learning rate to manage gradient noise as the model approaches an optimum. This paper introduces CABS (Coupled Adaptive Batch Size), a method that instead increases the batch size dynamically based on measured gradient variance. By explicitly coupling the batch size to the learning rate, CABS eliminates the need for manual decay schedules and makes the optimizer significantly more robust to initial hyperparameter choices.

Introduction

In standard Stochastic Gradient Descent (SGD), choosing the right batch size and learning rate is often a "black art." Early in training, small batches provide a computationally cheap, albeit noisy, estimate of the gradient. However, as the model nears the optimum, this noise causes the model to bounce around aimlessly. The conventional solution is to use a learning rate schedule to reduce step size, but this requires extensive manual tuning.

Lukas Balles and colleagues propose a more elegant solution: keep the step size constant and instead increase the batch size to improve the accuracy of each step. Their CABS rule provides a mathematically grounded way to automate this process.

The CABS Method

The core of the paper is the CABS rule, which determines the batch size $m$ as:

$$m = \alpha \frac{\text{tr}(\Sigma)}{F}$$

Where:

  • $m$ is the batch size.
  • $\alpha$ is the learning rate.
  • $\text{tr}(\Sigma)$ is the trace of the gradient covariance (a measure of gradient disagreement).
  • $F$ is the current value of the loss function.

Key Design Principles

  1. Maximizing Gain: The rule is derived to maximize the "expected gain per computational cost."
  2. Coupling: CABS recognizes that a large learning rate ($\alpha$) requires a larger batch size ($m$) to maintain a reliable gradient signal.
  3. Unit Invariance: The rule is invariant to rescaling the objective function; if the loss is multiplied by 10, the suggested batch size remains unchanged.
  4. Practical Implementation: The authors use exponential moving averages to estimate variance and loss in real-time, with a backpropagation implementation that adds only about 25% computational overhead.

Experimental Results

The authors evaluated CABS on standard benchmarks including MNIST, SVHN, CIFAR-10, and CIFAR-100.

Performance and Convergence

On natural image datasets like CIFAR-10 and CIFAR-100, CABS reached lower training losses faster than constant batch size methods. As training progresses, the batch size $m$ increases linearly, allowing the model to continue converging without manual intervention.

Training performance on CIFAR-10. CABS (orange) dynamically increases the batch size $m$ as the loss decreases, outperforming fixed-size baselines in both convergence speed and final test accuracy.

Robustness to Hyperparameters

A key advantage of CABS is its robustness to the initial choice of learning rate. By automatically tailoring the batch size to the chosen step size, CABS produces consistent training curves across a wide range of settings.

Results on CIFAR-100. CABS demonstrates superior performance and robustness, effectively managing the noise-signal trade-off throughout the training process.

Discussion and Limitations

  • The MNIST Exception: On very homogeneous datasets like MNIST, CABS may overestimate variance, leading to unnecessarily large batches. In these specific cases, a small constant batch size (e.g., 32) can be more efficient.
  • Hardware Constraints: Increasing batch size indefinitely is limited by GPU memory. The authors suggest gradient accumulation ("ghost batches") as a potential workaround.
  • Future Work: Extending this coupling logic to more complex optimizers like Adam or those using momentum is a logical next step.

Conclusion

CABS moves deep learning closer to "set-and-forget" training by automating noise management. By coupling batch size to the learning rate, it provides a robust, mathematically sound alternative to manual learning rate decay schedules.

Summary updated

BibTeX
@inproceedings{balles2017coupling,
  author = {Lukas Balles and Javier Romero and Philipp Hennig},
  title = {{Coupling Adaptive Batch Sizes with Learning Rates}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2017},
  url = {https://openreview.net/forum?id=3eUWXT6GuCv},
}
Figure