Skip to main content
QUICK REVIEW

[Paper Review] Reducing BERT Pre-Training Time from 3 Days to 76 Minutes

Yang You, Jing Li|arXiv (Cornell University)|Apr 1, 2019
Advanced Neural Network ApplicationsComputer Science73 citations
TL;DR

This paper introduces LAMB (Layer-wise Adaptive Moments), a novel large-batch optimization method that accelerates BERT pre-training from 3 days to just 76 minutes by enabling extremely large batch sizes (up to 32,868) on a TPUv3 pod. LAMB achieves this through layer-wise adaptive learning rates and formal convergence guarantees, outperforming prior methods on both BERT and ResNet-50.

ABSTRACT

Training large deep neural networks on massive datasets is very challenging. One promising approach to tackle this issue is through the use of large batch stochastic optimization. However, our understanding of this approach in the context of deep learning is still very limited. Furthermore, the current approaches in this direction are heavily hand-tuned. To this end, we first study a general adaptation strategy to accelerate training of deep neural networks using large minibatches. Using this strategy, we develop a new layer-wise adaptive large batch optimization technique called LAMB. We also provide a formal convergence analysis of LAMB as well as the previous published layerwise optimizer LARS, showing convergence to a stationary point in general nonconvex settings. Our empirical results demonstrate the superior performance of LAMB for BERT and ResNet-50 training. In particular, for BERT training, our optimization technique enables use of very large batches sizes of 32868; thereby, requiring just 8599 iterations to train (as opposed to 1 million iterations in the original paper). By increasing the batch size to the memory limit of a TPUv3 pod, BERT training time can be reduced from 3 days to 76 minutes. Finally, we also demonstrate that LAMB outperforms previous large-batch training algorithms for ResNet-50 on ImageNet; obtaining state-of-the-art performance in just a few minutes.

Motivation & Objective

  • To address the challenge of slow training times for large deep neural networks like BERT, which require massive computational resources and long training durations.
  • To improve the efficiency of large-batch stochastic optimization in deep learning, a method that remains poorly understood and heavily hand-tuned in practice.
  • To develop a generalizable, adaptive optimization strategy that enables stable and fast training with very large minibatches.
  • To provide formal convergence analysis for LAMB and the prior LARS optimizer in nonconvex settings, ensuring theoretical robustness.
  • To demonstrate state-of-the-art performance on BERT and ResNet-50 with significantly reduced training time and fewer iterations.

Proposed method

  • Proposes LAMB, a layer-wise adaptive large-batch optimization technique that scales learning rates per layer based on the ratio of gradient to parameter norm.
  • Adapts the Adam optimizer by introducing layer-wise adaptive learning rates, improving stability and convergence under large-batch training.
  • Introduces a normalization mechanism that stabilizes training by balancing gradient and parameter magnitudes across layers.
  • Employs a formal convergence analysis showing convergence to a stationary point in general nonconvex settings for both LAMB and LARS.
  • Leverages the memory capacity of a TPUv3 pod to scale batch sizes up to 32,868, drastically reducing the number of training iterations.
  • Uses a learning rate schedule that maintains model stability even at extremely large batch sizes, avoiding divergence common in standard large-batch methods.

Experimental results

Research questions

  • RQ1Can a general adaptation strategy for large-batch training significantly reduce the pre-training time of BERT without sacrificing model quality?
  • RQ2How can layer-wise adaptive learning rates improve optimization stability and convergence in large-batch settings for deep networks?
  • RQ3Does LAMB achieve theoretical convergence guarantees in nonconvex optimization, similar to prior methods like LARS?
  • RQ4Can LAMB enable training BERT with batch sizes approaching the memory limit of modern accelerators like TPUv3 pods?
  • RQ5How does LAMB compare to existing large-batch optimization methods in terms of accuracy and training speed on standard benchmarks like ImageNet and GLUE?

Key findings

  • LAMB reduces BERT pre-training time from 3 days to just 76 minutes by enabling a batch size of 32,868 on a TPUv3 pod.
  • BERT training requires only 8,599 iterations with LAMB, compared to 1 million iterations in the original BERT paper.
  • LAMB achieves state-of-the-art performance on ResNet-50/ImageNet in just a few minutes, outperforming previous large-batch methods.
  • The method demonstrates stable training at extremely large batch sizes, avoiding the divergence issues common in standard large-batch optimization.
  • Formal convergence analysis confirms that LAMB converges to a stationary point in general nonconvex settings, providing theoretical grounding.
  • LAMB outperforms prior large-batch training algorithms on both BERT and ResNet-50, showing consistent gains in speed and accuracy.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.