Coupling Adaptive Batch Sizes with Learning Rates

Lukas Balles, Javier Romero, Philipp Hennig

Abstract

Training deep neural networks requires careful tuning of the learning rate and batch size. We propose CABS (Coupled Adaptive Batch Size), a method that dynamically adjusts the mini-batch size during training by coupling it to the learning rate and gradient variance. CABS eliminates the need for manual learning rate decay schedules and makes optimization significantly more robust to initial hyperparameter choices.

Introduction

Stochastic Gradient Descent (SGD) is the standard for deep learning optimization, yet it relies on two critical and often difficult-to-tune hyperparameters: the learning rate ($\alpha$) and the batch size ($m$). Typically, practitioners use a constant batch size and manually design a schedule to decay the learning rate as training progresses. This decay is necessary to manage the increasing relative noise in stochastic gradients as the model nears a local minimum.

While increasing the batch size is a theoretical alternative to decreasing the learning rate, determining an optimal schedule for batch size growth has historically been as challenging as tuning the learning rate itself. CABS addresses this by providing an automated, theoretically grounded rule for adaptive batch sizing.

Methodology: The CABS Rule

The CABS method is derived from the objective of maximizing the expected gain per computational cost. Assuming Lipschitz-continuous gradients, the authors propose a practical heuristic for the optimal batch size $m$:

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

where:

  • $\alpha$ is the learning rate.
  • $tr(\Sigma)$ is the trace of the gradient covariance matrix, representing gradient noise.
  • $F$ is the current value of the loss function, serving as a proxy for the distance to the optimum.

This rule ensures that the batch size and learning rate are coupled; a larger learning rate necessitates a larger batch size to maintain stability. As the loss $F$ decreases during training, the batch size $m$ naturally increases, providing the necessary "cooling" effect for convergence without manual intervention.

Experimental Evaluation

CABS was evaluated across four standard image classification benchmarks: MNIST, SVHN, CIFAR-10, and CIFAR-100. The results demonstrate that CABS consistently achieves faster convergence and higher final accuracy compared to fixed batch size baselines.

Performance comparison on MNIST (left) and CIFAR-10 (right). CABS (orange) shows superior performance on CIFAR-10, while MNIST represents a unique case where small constant batches remain competitive.

On more complex datasets like CIFAR-10, CIFAR-100, and SVHN, CABS reached lower training losses and higher test accuracies more quickly in terms of total examples processed. The adaptive batch size $m$ was observed to grow steadily throughout the training process, effectively automating the optimization schedule.

Performance comparison on CIFAR-100 (left) and SVHN (right). CABS (orange) consistently outperforms constant batch size methods in both training loss and test accuracy.

The MNIST Exception

On the MNIST dataset, CABS was slightly outperformed by small constant batch sizes. This is likely due to the simplicity and homogeneity of MNIST, where CABS may overestimate the required variance, leading to excessively large batch sizes in the late stages of training.

Key Insights

  • Unit Invariance: The CABS rule is unit invariant; rescaling the loss function automatically adjusts the rule so the resulting batch size remains consistent.
  • Hyperparameter Robustness: CABS significantly reduces sensitivity to the initial learning rate. Because the batch size adapts to the rate, suboptimal initial choices are often compensated for automatically.
  • Computational Efficiency: Estimating gradient variance adds approximately 25% overhead to the backpropagation pass, a cost typically offset by the gains in convergence speed.

Conclusion

CABS offers a practical and theoretically motivated approach to adaptive optimization. By coupling batch size to the learning rate and gradient noise, it simplifies the training pipeline and improves robustness. Future work may involve extending CABS to adaptive optimizers like Adam or addressing hardware memory limits through gradient accumulation.

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