Large Scale Language Modeling: Converging on 40GB of Text in Four Hours

Raul Puri, Robert Kirby, Nikolai Yakovenko, Bryan Catanzaro

Introduction

The rapid advancement of computer vision was largely fueled by the "ImageNet moment," where massive datasets and distributed computing enabled the scaling of Convolutional Neural Networks (CNNs). In contrast, Natural Language Processing (NLP) has faced significant hurdles in scaling Recurrent Neural Networks (RNNs). Due to their sequential nature, RNNs are notoriously difficult to parallelize and often exhibit numerical instability when trained at scale. This has historically limited researchers to small batches and lengthy training cycles, often spanning weeks or months.

This paper presents a breakthrough in training efficiency for large-scale language models. By leveraging mixed-precision arithmetic and optimized distributed hardware, researchers demonstrate that a massive multiplicative LSTM (mLSTM) can be trained on 40GB of text in just four hours—a task that previously required a full month of computation.

Methodology

To overcome the "wall-clock time" bottleneck, several key engineering and algorithmic strategies were implemented:

Mixed Precision Training

The researchers utilized FP16 for storage and tensor operations while maintaining a master copy of weights in FP32. To mitigate numerical underflow—a common issue where small gradients vanish in FP16—they employed automatic loss scaling. This technique dynamically adjusts a scalar to keep gradients within the representable range of half-precision floats, resulting in a 4.2x speedup on a single GPU without compromising accuracy.

Distributed Data Parallelism and Large Batch Optimization

Training was scaled across 128 NVIDIA Tesla V100 GPUs using the NCCL2 library and high-speed interconnects like NVLink and InfiniBand. To maximize throughput, the global batch size was pushed to 32,768. To stabilize training at this scale, the authors used Weight Normalization and the Adam optimizer.

Learning Rate Scheduling

Standard scaling laws for learning rates often fail at extreme batch sizes. The authors found that an initial learning rate of $3 \times 10^{-3}$ with a linear decay to zero over 100,000 iterations was essential for convergence.

Scaling and Performance

The implementation achieved near-linear scaling, proving that the sequential nature of RNNs does not preclude massive data-parallel efficiency. Moving from a single GPU to 128 GPUs resulted in a 109x increase in throughput.

Scaling efficiency across 128 GPUs.

The most significant impact of this scaling is the reduction in training time. As batch sizes increase, the time required to reach a target Bits Per Character (BPC) decreases dramatically. At a batch size of 32,768, the model reaches the performance threshold of previous state-of-the-art benchmarks in approximately four hours.

Reduction in training time as batch size increases.

Results

The primary training corpus was the Amazon Reviews dataset, containing approximately 40GB of text. An 8192-neuron mLSTM achieved a state-of-the-art BPC of 1.038, surpassing previous benchmarks.

Beyond language modeling, the features learned during this high-speed unsupervised pre-training proved highly effective for downstream sentiment analysis tasks. By adding a simple logistic regression layer, the model achieved 93.8% accuracy on the Stanford Sentiment Treebank (SST) and 91.9% on the IMDB Movie Reviews dataset.

Conclusion

This work demonstrates that large-scale RNN training can be accelerated by orders of magnitude through the combination of mixed-precision training and massive data parallelism. By reducing training times from months to hours, researchers can iterate more rapidly, exploring larger models and datasets that were previously computationally prohibitive. While the rise of Transformer architectures offers alternative paths for parallelization, these findings provide a robust framework for scaling sequence models in the era of massive-scale NLP.

Summary updated

BibTeX
@inproceedings{puri2018large,
  author = {Raul Puri and Robert Kirby and Nikolai Yakovenko and Bryan Catanzaro},
  title = {{Large Scale Language Modeling: Converging on 40GB of Text in Four Hours}},
  booktitle = {SBAC-PAD},
  year = {2018},
  doi = {10.1109/cahpc.2018.8645935},
}
Figure