Demystifying the Communication Characteristics for Distributed Transformer Models

Quentin Anthony, Benjamin Michalowicz, Jacob Hatef, Lang Xu, Mustafa Abdul Jabbar, Aamir Shafi, Hari Subramoni, Dhabaleswar K. PandaHoti 2024

Abstract

Deep learning (DL) models based on the transformer architecture have revolutionized many DL applications such as large language models (LLMs), vision transformers, audio generation, and time series prediction. Much of this progress has been fueled by distributed training, yet distributed communication remains a substantial bottleneck to training progress. This paper examines the communication behavior of transformer models - that is, how different parallelism schemes used in multi-node/multi-GPU DL Training communicate data in the context of transformers. We use GPT-based language models as a case study of the transformer architecture due to their ubiquity. We validate the empirical results obtained from our communication logs using analytical models. At a high level, our analysis reveals a need to optimize small message point-to-point communication further, correlations between sequence length, per-GPU throughput, model size, and optimizations used, and where to potentially guide further optimizations in framework and HPC middleware design and optimization.

Introduction

The rapid evolution of Large Language Models (LLMs) has pushed the boundaries of computational requirements, necessitating the use of massive distributed systems. As models scale to hundreds of billions of parameters, the efficiency of distributed training becomes paramount. However, a significant hurdle remains: the communication bottleneck. While GPU compute power continues to advance, the interconnect bandwidth and latency often fail to keep pace, leading to diminished Model FLOPs Utilization (MFU). This paper provides a systematic characterization of these communication bottlenecks across various parallelism strategies, offering a roadmap for future optimizations in both software frameworks and hardware design.

Methodology

Our research employs a dual-pronged approach to understand communication dynamics. First, we developed comprehensive analytical models to predict communication volumes based on architectural parameters such as the number of layers, hidden dimensions, and vocabulary size, tailored to specific parallelism strategies like ZeRO stages, Tensor Parallelism, and Pipeline Parallelism.

Second, we conducted empirical profiling on the Frontier supercomputer, utilizing AMD MI-250X GPUs and the HPE Slingshot 11 interconnect. Using the GPT-NeoX framework, we trained models ranging from 19 million to 13 billion parameters. This allowed us to validate our mathematical models against real-world performance data on a leading-edge HPC platform.

Key Insights: The Mechanics of Distributed Communication

The "Small Message" Trap and ZeRO-3 Overhead

A critical finding of our study is the prevalence of small messages in the kilobyte range, particularly within the ZeRO-3 (Zero Redundancy Optimizer Stage 3) strategy. While the total volume of data transferred in LLM training is massive, the frequency of these small messages creates a latency-bound environment.

ZeRO-3 data flow illustrating the frequent collective operations (All-Gather and Reduce-Scatter) required for parameter and gradient management.

As shown in the ZeRO-3 workflow, the system must perform frequent All-Gather operations to collect parameters before the forward pass and Reduce-Scatter operations for gradients. Our analysis confirms that ZeRO-3 incurs approximately 1.5x more communication volume than ZeRO-1 or ZeRO-2. The "aha moment" for developers is that optimizing for raw bandwidth is insufficient; reducing message latency is equally vital for scaling.

Sequence Length and Predictability

We observed that increasing the sequence length—the number of tokens processed simultaneously—has a varied impact. While it does not affect communication volume for Data Parallelism (DP), it leads to a linear increase in volume for Tensor Parallelism (TP) and Pipeline Parallelism (PP). Crucially, our analytical models matched empirical results with high precision, suggesting that communication overhead is highly predictable and can be used to guide automated "auto-parallelism" tools in the future.

Empirical Results: Scaling to the Limit

Communication Dominance at Scale

Our experiments on Frontier demonstrate a clear trend: as the number of GPUs (measured in Graphics Compute Dies, or GCDs) increases, the proportion of time spent on communication grows significantly. For larger models (13B+ parameters), communication time begins to overshadow computation time as we scale to hundreds of GCDs.

Breakdown of compute vs. communication time as the number of nodes/GCDs increases, showing communication dominance at scale.

This dominance highlights the diminishing returns of simply adding more hardware without addressing the underlying interconnect efficiency. However, the use of ZeRO optimizations proved beneficial, providing a 2-2.5x increase in TFlops per GPU compared to standard data parallelism, despite the increased communication volume.

Conclusion

This study demystifies the complex communication patterns inherent in distributed transformer training. By identifying the "small message trap" and quantifying the overhead of advanced parallelism schemes like ZeRO-3, we provide actionable insights for the HPC and DL communities. Future work will expand this analysis to include Mixture of Experts (MoE) architectures and evaluate performance on emerging systems like the Aurora supercomputer to further generalize our findings across different hardware and software ecosystems.

Summary updated

BibTeX
@inproceedings{anthony2024demystifying,
  author = {Quentin Anthony and Benjamin Michalowicz and Jacob Hatef and Lang Xu and Mustafa Abdul Jabbar and Aamir Shafi and Hari Subramoni and Dhabaleswar K. Panda},
  title = {{Demystifying the Communication Characteristics for Distributed Transformer Models}},
  booktitle = {Hoti},
  year = {2024},
}
Figure