[Paper Review] Accelerated Large Batch Optimization of BERT Pretraining in 54 minutes
This paper proposes LANS, an accelerated large-batch optimization method for BERT pretraining that combines per-block gradient normalization with a novel learning rate scheduler featuring a constant learning rate phase after warmup. By enabling stable training at mini-batch sizes of 96K and 33K, LANS achieves BERT pretraining in 54 minutes on 192 AWS EC2 P3dn.24xlarge instances, setting a new speed record in the cloud without accuracy loss.
BERT has recently attracted a lot of attention in natural language understanding (NLU) and achieved state-of-the-art results in various NLU tasks. However, its success requires large deep neural networks and huge amount of data, which result in long training time and impede development progress. Using stochastic gradient methods with large mini-batch has been advocated as an efficient tool to reduce the training time. Along this line of research, LAMB is a prominent example that reduces the training time of BERT from 3 days to 76 minutes on a TPUv3 Pod. In this paper, we propose an accelerated gradient method called LANS to improve the efficiency of using large mini-batches for training. As the learning rate is theoretically upper bounded by the inverse of the Lipschitz constant of the function, one cannot always reduce the number of optimization iterations by selecting a larger learning rate. In order to use larger mini-batch size without accuracy loss, we develop a new learning rate scheduler that overcomes the difficulty of using large learning rate. Using the proposed LANS method and the learning rate scheme, we scaled up the mini-batch sizes to 96K and 33K in phases 1 and 2 of BERT pretraining, respectively. It takes 54 minutes on 192 AWS EC2 P3dn.24xlarge instances to achieve a target F1 score of 90.5 or higher on SQuAD v1.1, achieving the fastest BERT training time in the cloud.
Motivation & Objective
- To reduce the training time of BERT pretraining, which traditionally takes days, by enabling efficient large-batch optimization.
- To overcome the instability and accuracy degradation that occur when scaling mini-batch sizes beyond 64K in existing large-batch optimizers like LAMB.
- To design a learning rate scheduler that maintains high learning rates for longer durations without divergence, enabling faster convergence.
- To achieve state-of-the-art training speed for BERT in cloud environments without sacrificing model performance.
Proposed method
- LANS introduces per-block gradient normalization to extend LAMB’s block-wise adaptive learning rate, ensuring stable updates across different layers.
- It modifies the momentum term by leveraging the connection between classic momentum and Nesterov’s momentum to improve convergence.
- The method employs a new learning rate schedule that includes a constant learning rate phase after warmup, extending the use of high learning rates beyond the initial warmup phase.
- The learning rate is scaled using a square root rule but adjusted to avoid divergence at large batch sizes, with empirical tuning to maintain stability.
- The framework supports distributed training with data sharding across workers to minimize gradient variance and ensure non-redundant sampling.
- The implementation is optimized for cloud infrastructure, using 192 AWS EC2 P3dn.24xlarge instances with EFA for high communication efficiency.
Experimental results
Research questions
- RQ1Can a modified large-batch optimizer maintain model accuracy while scaling mini-batch sizes to 96K and 33K in BERT pretraining?
- RQ2Does introducing a constant learning rate phase after warmup improve training stability and convergence speed compared to linear warmup schedules?
- RQ3Can LANS outperform LAMB in training speed on cloud-based GPU clusters without accuracy degradation?
- RQ4What hyperparameter settings (learning rate, warmup, constant phase ratios) are optimal for achieving fast convergence at large batch sizes?
Key findings
- LANS achieved a SQuAD v1.1 dev set F1 score of 90.60 in 53.6 minutes using 1536 V100 GPUs, setting a new record for fastest BERT pretraining in the cloud.
- The method successfully scaled mini-batch sizes to 96K in phase 1 and 33K in phase 2 of BERT pretraining without performance degradation.
- LAMB failed to converge at 96K/33K batch sizes, while LANS achieved the same target F1 score in significantly fewer iterations (4301 vs. 8599).
- The proposed learning rate schedule reduced the performance gap between learning rates of 0.007 and 0.01 from 5.28 AUC points to 1.91, demonstrating improved robustness.
- Using a constant learning rate phase after warmup allowed sustained training progress at high learning rates, enabling faster convergence.
- The training time was reduced to 54 minutes on 192 AWS EC2 P3dn.24xlarge instances, outperforming prior methods that required 76.2 minutes on TPUs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.