Large Batch Optimization for Deep Learning: Training BERT in 76 minutes

TL;DR

LAMB optimizer trains BERT in 76 minutes on TPUv3 Pod with batch size 32868, maintaining performance.

cs.LG 🔴 Advanced 2019-04-02 2 views
Yang You Jing Li Sashank Reddi Jonathan Hseu Sanjiv Kumar Srinadh Bhojanapalli Xiaodan Song James Demmel Kurt Keutzer Cho-Jui Hsieh
deep learning large batch optimization BERT LAMB TPU

Key Findings

Methodology

The study introduces a new layerwise adaptive large batch optimization technique called LAMB, designed for deep neural networks. LAMB combines ADAM's dimension normalization and layerwise adaptivity to ensure stable convergence in large batch settings. Convergence analysis for both LARS and LAMB is provided, demonstrating convergence in nonconvex environments.

Key Results

  • LAMB enables BERT training with a batch size of 32868, reducing training time from 3 days to 76 minutes without performance loss.
  • On ResNet-50, LAMB achieves 76.4% accuracy at a 32K batch size, outperforming LARS.
  • LAMB shows superior performance across various tasks with minimal hyperparameter tuning.

Significance

This research significantly reduces training time, advancing the application of deep learning models on large datasets, particularly in NLP and computer vision. The introduction of the LAMB optimizer addresses common performance degradation issues in large batch training, offering new possibilities for large-scale distributed computing.

Technical Contribution

LAMB introduces innovative adaptive learning rates in large batch settings, combining ADAM's dimension normalization with layerwise adaptivity. Its convergence analysis provides theoretical guarantees for nonconvex optimization problems and demonstrates efficient implementation on TPUs.

Novelty

LAMB is the first to efficiently train BERT in large batch settings, overcoming LARS's performance bottlenecks in attention models. Its layerwise adaptive strategy offers unique advantages in large-scale distributed computing.

Limitations

  • LAMB's performance in small batch training remains unverified and may degrade.
  • Further research is needed on LAMB's hyperparameter tuning across different tasks.

Future Work

Future research could explore LAMB's application in other deep learning models, optimize its performance in small batch settings, and further enhance its efficiency on various hardware platforms.

AI Executive Summary

Training large neural networks in deep learning typically requires significant time and computational resources. Traditional optimization algorithms like SGD often lead to performance degradation in large batch settings. This paper introduces a new optimization algorithm, LAMB, specifically designed for large batch training, combining ADAM's dimension normalization with layerwise adaptivity.

LAMB performs exceptionally well in training BERT and ResNet-50, particularly reducing BERT's training time from 3 days to 76 minutes using a TPUv3 Pod, without performance loss. Experimental results demonstrate LAMB's superior convergence and stability in large batch settings.

While LAMB shows significant advantages in large batch training, its performance in small batch settings remains to be fully verified. Future research directions include optimizing LAMB's performance on different hardware platforms and exploring its application in other deep learning models.

Deep Analysis

Background

With the advent of large-scale datasets, training large deep neural networks has become particularly challenging. Traditional SGD is limited by its sequential nature, especially in large batch settings, often leading to performance degradation. Researchers have begun exploring large batch stochastic optimization methods to address this issue.

Core Problem

In large batch settings, traditional optimization algorithms like SGD often lead to performance degradation, particularly in attention models like BERT. Achieving efficient training in large batch settings is a significant research challenge.

Innovation

The LAMB optimizer combines ADAM's dimension normalization with layerwise adaptivity, efficiently training BERT in large batch settings for the first time. Its innovation lies in addressing performance degradation issues in large batch training through a layerwise adaptive strategy.

Methodology

  • �� Adjust learning rates using a layerwise adaptive strategy
  • �� Combine ADAM's dimension normalization for stability
  • �� Implement efficient parallel computation on TPUv3 Pod
  • �� Provide convergence analysis for LAMB and LARS

Experiments

Experiments were conducted on BERT and ResNet-50 using TPUv3 Pod for large batch training. Baselines included ADAMW and LARS, with evaluation metrics of accuracy and training time.

Results

LAMB reduces BERT training time to 76 minutes with a 32K batch size, achieving an F1 score of 91.475. ResNet-50 achieves 76.4% accuracy at a 32K batch size.

Applications

The LAMB optimizer can be directly applied to large-scale deep learning models requiring rapid training, with broad applications in NLP and computer vision.

Limitations & Outlook

LAMB's performance in small batch training remains unverified and may degrade. Further research is needed on its hyperparameter tuning across different tasks.

Plain Language Accessible to non-experts

Imagine you're cooking in a kitchen. Traditional SGD is like using a small pot to cook rice, only cooking a little at a time, while LAMB is like using a large pot to cook a lot at once. LAMB adjusts the heat (learning rate) and stirring method (adaptive strategy) to ensure every grain of rice is evenly cooked (stable convergence), so even with a large pot, the rice doesn't come out undercooked (no performance loss).

ELI14 Explained like you're 14

Imagine playing a massive multiplayer online game. Traditional methods are like playing solo, while LAMB is like teaming up to defeat a big boss. Each team member has their own task (layerwise adaptivity), and everyone works together (large batch training), allowing you to defeat the boss faster. Plus, LAMB adjusts strategies based on each member's performance (adaptive learning rate), ensuring the team is always at its best.

Glossary

LAMB (Layerwise Adaptive Large Batch Optimization)

An optimization algorithm designed for large batch training, combining ADAM's dimension normalization with layerwise adaptivity.

Used to accelerate training of BERT and ResNet-50.

TPUv3 Pod

A high-performance computing device designed to accelerate deep learning tasks.

Used for large-scale distributed training to reduce training time.

BERT (Bidirectional Encoder Representations from Transformers)

A pre-trained model for natural language processing that captures contextual information.

Used as a test subject to validate LAMB's performance.

LARS (Layerwise Adaptive Rate Scaling)

An optimization algorithm for large batch training, improving training efficiency through layerwise adaptive learning rates.

Performed well in ResNet-50 training but poorly in BERT.

ADAM (Adaptive Moment Estimation)

A popular optimization algorithm that combines momentum and adaptive learning rates.

Used as a baseline to evaluate LAMB's performance.

Open Questions Unanswered questions from this research

  • 1 LAMB's performance and optimization strategy in small batch training remain unclear, requiring further research.
  • 2 Optimizing LAMB's performance on different hardware platforms is still an open question.

Applications

Immediate Applications

Natural Language Processing

LAMB can be used to accelerate training of large language models like BERT, improving efficiency in NLP tasks.

Long-term Vision

Large-scale Distributed Computing

LAMB's layerwise adaptive strategy can optimize large-scale distributed computing, enhancing resource utilization efficiency.

Abstract

Training large deep neural networks on massive datasets is computationally very challenging. There has been recent surge in interest in using large batch stochastic optimization methods to tackle this issue. The most prominent algorithm in this line of research is LARS, which by employing layerwise adaptive learning rates trains ResNet on ImageNet in a few minutes. However, LARS performs poorly for attention models like BERT, indicating that its performance gains are not consistent across tasks. In this paper, we first study a principled layerwise adaptation strategy to accelerate training of deep neural networks using large mini-batches. Using this strategy, we develop a new layerwise adaptive large batch optimization technique called LAMB; we then provide convergence analysis of LAMB as well as LARS, showing convergence to a stationary point in general nonconvex settings. Our empirical results demonstrate the superior performance of LAMB across various tasks such as BERT and ResNet-50 training with very little hyperparameter tuning. In particular, for BERT training, our optimizer enables use of very large batch sizes of 32868 without any degradation of performance. By increasing the batch size to the memory limit of a TPUv3 Pod, BERT training time can be reduced from 3 days to just 76 minutes (Table 1). The LAMB implementation is available at https://github.com/tensorflow/addons/blob/master/tensorflow_addons/optimizers/lamb.py

cs.LG cs.AI cs.CL stat.ML