Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour

TL;DR

Large-batch synchronized SGD with linear scaling and warmup trains ResNet-50 on ImageNet in 1 hour on 256 GPUs, maintaining accuracy.

cs.CV 🔴 Advanced 2017-06-09 49 views
Priya Goyal Piotr Dollár Ross Girshick Pieter Noordhuis Lukasz Wesolowski Aapo Kyrola Andrew Tulloch Yangqing Jia Kaiming He
deep learning distributed training large batch optimization ImageNet

Key Findings

Methodology

The paper introduces a hyperparameter-free linear learning rate scaling rule, where the learning rate is multiplied proportionally with batch size. To address early optimization challenges with large batches, a gradual warmup strategy is employed, starting with a low learning rate and increasing it over several epochs. The implementation leverages optimized communication algorithms like recursive halving/doubling for gradient aggregation across multiple GPUs and servers, ensuring near-linear scalability. Experiments are conducted using the Caffe2 framework on a 256-GPU cluster, focusing on training ResNet-50 on ImageNet with batch sizes up to 8192, validating the approach's effectiveness in both accuracy and efficiency.

Key Results

  • Using a batch size of 8192, the trained ResNet-50 model achieved a top-1 validation accuracy of 76.2%, comparable to small-batch training, but in just 1 hour versus 29 hours previously. The training curves closely matched those of small batches, confirming optimization stability. The system maintained approximately 90% scaling efficiency from 8 to 256 GPUs, demonstrating excellent parallel performance. The approach was also validated on Mask R-CNN for object detection, showing consistent accuracy without retraining or hyperparameter tuning, thus confirming broad applicability.
  • The experiments confirmed that the main obstacle to large-batch training is optimization difficulty, not generalization loss. The warmup and linear scaling strategies effectively mitigated early training instability. The communication algorithms ensured minimal overhead, enabling near-perfect linear scaling. Results indicate that large-scale training can be both fast and accurate, opening new avenues for internet-scale data processing and model deployment. These findings significantly reduce training time, making high-performance models more accessible for industry and research.
  • Additional experiments demonstrated that the combined approach generalizes well across different tasks and architectures, including object detection and segmentation. The system's robustness was confirmed across various batch sizes and hardware configurations. The study also provided detailed implementation guidelines, emphasizing subtle but critical details like proper gradient aggregation, BN statistics handling, and synchronization procedures, which are essential for replicating the results in real-world environments.

Significance

This work fundamentally advances the field by enabling the training of high-accuracy deep neural networks on internet-scale datasets within an hour, a task previously thought infeasible at such scale. It addresses the critical bottleneck of training time, which hampers rapid iteration and deployment in industry. The proposed strategies—linear learning rate scaling and warmup—offer a simple yet powerful framework that can be adopted widely, reducing computational costs and accelerating research cycles. The ability to efficiently utilize commodity hardware for large-scale training democratizes access to state-of-the-art models, fostering innovation across academia and industry. Overall, this work paves the way for real-time, large-scale AI applications, transforming how models are trained and deployed.

Technical Contribution

The paper introduces a hyperparameter-free linear scaling rule for learning rates, validated across multiple large-batch regimes. It combines this with a novel warmup scheme that gradually increases the learning rate, stabilizing early training phases. System-wise, it employs optimized communication algorithms—recursive halving/doubling—for gradient synchronization, ensuring near-linear scalability on multi-GPU, multi-node clusters. The implementation details, including BN statistics management and gradient aggregation, are carefully designed to preserve model accuracy and training stability. These innovations collectively enable training ResNet-50 on ImageNet in 1 hour with minimal hyperparameter tuning, representing a significant leap over prior methods that required extensive hyperparameter search and suffered from accuracy degradation at large batch sizes.

Novelty

This is the first comprehensive demonstration of training ResNet-50 on ImageNet with a batch size of 8192 in just one hour, maintaining accuracy. The key novelty lies in the hyperparameter-free linear learning rate scaling combined with a gradual warmup, which together address early optimization instability without extensive tuning. Unlike previous work limited to smaller batch sizes or requiring manual hyperparameter adjustments, this approach provides a simple, robust, and generalizable framework for large-scale distributed training. The system-level optimizations for communication and BN statistics handling further distinguish this work, enabling near-perfect linear scaling across hundreds of GPUs, a feat not previously achieved at this scale.

Limitations

  • While effective up to batch sizes of 8192, the approach may face stability issues at even larger batch sizes, requiring further algorithmic refinements. Communication overhead, though minimized, still poses a challenge in extremely large clusters. The method's generalization to non-vision tasks or different network architectures needs further validation. Additionally, the reliance on specific hardware and communication libraries may limit portability. Future work should explore adaptive warmup schedules, more scalable communication algorithms, and broader applicability to diverse models and datasets.

Future Work

Future directions include developing adaptive warmup strategies tailored to different architectures and datasets, further optimizing communication algorithms for ultra-large clusters, and extending the methodology to other domains such as NLP with Transformer models. Investigating theoretical foundations of the linear scaling rule in non-convex settings and automating hyperparameter tuning for large-batch training are also promising avenues. Additionally, integrating these techniques into more flexible frameworks and hardware platforms will facilitate wider adoption, ultimately enabling real-time training of massive models on internet-scale data.

AI Executive Summary

Deep Dive

Plain Language Accessible to non-experts

想象你在一个工厂里生产玩具。以前,每个工人只做一点点工作,等到所有人都完成后再合并结果,效率很低。现在,工厂采用了一种新方法,让每个工人同时做更多的任务,而且用一种聪明的调度策略,确保他们的工作不会互相干扰。这样,所有工人都在同时努力,整个生产线的效率大大提高。这个方法就像科学家用特殊的技巧,让电脑在训练神经网络时,也能同时处理大量数据,保持效果不变,却用更少的时间完成任务。通过这些技巧,深度学习变得更快、更智能,就像工厂用新方法更快生产出玩具一样。

Abstract

Deep learning thrives with large neural networks and large datasets. However, larger networks and larger datasets result in longer training times that impede research and development progress. Distributed synchronous SGD offers a potential solution to this problem by dividing SGD minibatches over a pool of parallel workers. Yet to make this scheme efficient, the per-worker workload must be large, which implies nontrivial growth in the SGD minibatch size. In this paper, we empirically show that on the ImageNet dataset large minibatches cause optimization difficulties, but when these are addressed the trained networks exhibit good generalization. Specifically, we show no loss of accuracy when training with large minibatch sizes up to 8192 images. To achieve this result, we adopt a hyper-parameter-free linear scaling rule for adjusting learning rates as a function of minibatch size and develop a new warmup scheme that overcomes optimization challenges early in training. With these simple techniques, our Caffe2-based system trains ResNet-50 with a minibatch size of 8192 on 256 GPUs in one hour, while matching small minibatch accuracy. Using commodity hardware, our implementation achieves ~90% scaling efficiency when moving from 8 to 256 GPUs. Our findings enable training visual recognition models on internet-scale data with high efficiency.

cs.CV cs.DC cs.LG