Large Batch Training of Convolutional Networks

Yang You, Igor Gitman, Boris Ginsburg · DOI

Abstract

A common way to speed up training of large convolutional networks is to add computational units. Training is then performed using data-parallel synchronous Stochastic Gradient Descent (SGD) with mini-batch divided between computational units. With an increase in the number of nodes, the batch size grows. But training with large batch size often results in the lower model accuracy. We argue that the current recipe for large batch training (linear learning rate scaling with warm-up) is not general enough and training may diverge. To overcome this optimization difficulties we propose a new training algorithm based on Layer-wise Adaptive Rate Scaling (LARS). Using LARS, we scaled Alexnet up to a batch size of 8K, and Resnet-50 to a batch size of 32K without loss in accuracy.

The Large Batch Training Problem

In deep learning, training speed is often increased through data-parallelism, spreading large mini-batches across multiple GPUs. However, as batch sizes grow, standard optimization techniques often fail. The conventional "linear scaling rule"—increasing the learning rate (LR) proportionally with the batch size—frequently leads to training instability and divergence, particularly in the early stages. While techniques like "learning rate warm-up" have extended the limits, scaling architectures like AlexNet beyond 2K or ResNet-50 beyond 8K has remained a significant challenge.

Layer-wise Adaptive Rate Scaling (LARS)

To address these instabilities, we introduce Layer-wise Adaptive Rate Scaling (LARS). Unlike standard SGD, which applies a global learning rate to all layers, LARS computes a unique local learning rate for each layer based on the ratio of the weight norm to the gradient norm.

Local learning rates for different layers (weights vs. biases) and batch sizes using LARS.

The intuition is based on "trust": if a layer's weights are large relative to its gradient updates, it can tolerate a higher learning rate. Conversely, if updates are too aggressive relative to the weights, the local LR is scaled down. This normalization prevents any single layer's gradients from destabilizing the entire network's training process.

Optimization vs. Generalization

A common hypothesis is that large batches suffer from a "generalization gap" where the model overfits. Our analysis suggests otherwise. By examining the difference between training and testing loss, we observed that the drop in accuracy at large batch sizes is primarily an optimization failure. The models fail to converge effectively at high learning rates rather than failing to generalize.

Absolute difference between test and train loss for AlexNet-BN, illustrating optimization instability.

Key Results

LARS enables significant scaling for distributed training:

  • AlexNet-BN: Scaled to a batch size of 8K with no loss in accuracy. Without LARS, accuracy dropped by 14% at this scale.
  • ResNet-50: Scaled to a batch size of 32K, achieving 72.3% accuracy (comparable to the 73.0% baseline).
  • Robustness: LARS is notably more robust to the choice of the initial base learning rate, simplifying the hyperparameter tuning process.

Limitations and Future Work

Despite its success, LARS faces diminishing returns. At extremely large scales (e.g., 32K for AlexNet), a slight accuracy dip (2.6%) persists. Furthermore, very large batches may require more training epochs to fully recover baseline performance, suggesting that a minimum number of weight updates is still necessary for refinement. Scaling beyond 32K without any performance degradation remains an open research frontier.

Summary updated

BibTeX
@misc{you2017large,
  author = {Yang You and Igor Gitman and Boris Ginsburg},
  title = {{Large Batch Training of Convolutional Networks}},
  year = {2017},
  eprint = {1708.03888},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1708.03888},
}
Figure