Skip to main content
QUICK REVIEW

[Paper Review] Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM

Deepak Narayanan, Mohammad Shoeybi|arXiv (Cornell University)|Apr 9, 2021
Topic ModelingComputer Science7 citations
TL;DR

This paper proposes PTD-P, a novel combination of pipeline, tensor, and data parallelism in Megatron-LM, enabling efficient training of trillion-parameter language models on 3072 GPUs. By introducing an interleaved pipelining schedule, it achieves 502 petaFLOP/s throughput with 52% of theoretical peak GPU utilization, significantly improving throughput while maintaining memory efficiency.

ABSTRACT

Large language models have led to state-of-the-art accuracies across a range of tasks. However, training these models efficiently is challenging for two reasons: a) GPU memory capacity is limited, making it impossible to fit large models on even a multi-GPU server, and b) the number of compute operations required to train these models can result in unrealistically long training times. Consequently, new methods of model parallelism such as tensor and pipeline parallelism have been proposed. Unfortunately, naive usage of these methods leads to fundamental scaling issues at thousands of GPUs, e.g., due to expensive cross-node communication or devices spending significant time waiting on other devices to make progress. In this paper, we show how different types of parallelism methods (tensor, pipeline, and data parallelism) can be composed to scale to thousands of GPUs and models with trillions of parameters. We survey techniques for pipeline parallelism and propose a novel interleaved pipeline parallelism schedule that can improve throughput by 10+% with memory footprint comparable to existing approaches. We quantitatively study the trade-offs between tensor, pipeline, and data parallelism, and provide intuition as to how to configure distributed training of a large model. Our approach allows us to perform training iterations on a model with 1 trillion parameters at 502 petaFLOP/s on 3072 GPUs with achieved per-GPU throughput of 52% of theoretical peak. Our code is open sourced at https://github.com/nvidia/megatron-lm.

Motivation & Objective

  • To address the challenge of training large-scale language models that exceed GPU memory capacity and require prohibitively long training times.
  • To enable scalable training of models with over a trillion parameters across thousands of GPUs.
  • To optimize the composition of pipeline, tensor, and data parallelism while preserving strict optimizer semantics.
  • To reduce pipeline flush overhead and improve throughput at small batch sizes through a novel scheduling strategy.
  • To achieve high computational efficiency (52% of theoretical peak) on large-scale GPU clusters.

Proposed method

  • Combines inter-node pipeline parallelism, intra-node tensor parallelism, and data parallelism (PTD-P) to scale training across thousands of GPUs.
  • Introduces an interleaved pipelining schedule that reduces pipeline flush time and improves throughput by over 10% compared to baseline methods.
  • Uses activation recomputation to reduce memory footprint, enabling larger models to fit within GPU memory constraints.
  • Applies operator fusion and optimized data layouts to minimize memory-bound kernels and communication overhead.
  • Employs a cost model to guide model partitioning across devices, minimizing communication while maximizing device utilization.
  • Leverages high-bandwidth interconnects (e.g., NVLink) within servers and optimized inter-server communication to reduce latency in multi-node training.

Experimental results

Research questions

  • RQ1How can pipeline, tensor, and data parallelism be effectively composed to scale training to thousands of GPUs?
  • RQ2What scheduling strategy minimizes pipeline flush overhead and maximizes throughput, especially at small batch sizes?
  • RQ3How can memory constraints be overcome when training trillion-parameter models on GPU clusters?
  • RQ4What is the impact of activation recomputation and communication optimization on training efficiency?
  • RQ5To what extent can the proposed method achieve high utilization (e.g., 52% of peak) on large-scale GPU clusters?

Key findings

  • The proposed interleaved pipelining schedule improves training throughput by more than 10% compared to standard pipelining approaches.
  • The method achieves a peak training throughput of 502 petaFLOP/s on 3072 GPUs, reaching 52% of theoretical GPU peak performance.
  • Training a 1 trillion parameter model is feasible in approximately 3 months using the proposed PTD-P framework.
  • The combination of tensor, pipeline, and data parallelism enables scalable training beyond the memory and compute limits of single or multi-GPU servers.
  • Activation recomputation reduces memory usage without significantly increasing FLOP count, enabling larger model training.
  • The approach maintains strict optimizer semantics while minimizing idle time due to pipeline synchronization.

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.