Rethinking Memory and Communication Costs for Efficient Data Parallel Training of Large Language Models

Hanxiao Zhang, Lin Ju, Chan Wu, Jinjing Huang, Youshao Xiao, Zhenglei Zhou, Zhiming fan, Zhaoxin Huan, Siyuan Li, Fanzhuang Meng, Lei Liang, Xiaolu Zhang, Jun ZhouNeurIPS 2024

TL;DR

The Partial Redundancy Optimizer (PaRO) is a new framework that accelerates Large Language Model (LLM) training by strategically balancing memory usage and communication overhead. By introducing a "middle-ground" partitioning strategy and optimizing communication topologies for heterogeneous networks, PaRO achieves up to a 266% speedup over standard ZeRO-3 baselines.

The Challenge of Distributed LLM Training

Training LLMs with billions of parameters requires distributing the model across hundreds or thousands of GPUs. Standard Data Parallelism (DP) techniques, like Microsoft’s ZeRO (Zero Redundancy Optimizer), offer a strict trade-off: ZeRO-1 and ZeRO-2 keep training fast but consume significant memory, while ZeRO-3 minimizes memory but introduces massive communication bottlenecks.

The authors identify a critical gap: existing strategies treat all network connections as equal. In reality, modern GPU clusters are hierarchical. GPUs within a single machine communicate lightning-fast via NVLink, while communication between machines (inter-node) is significantly slower. Standard ZeRO-3 forces "global" communication across these slow inter-node links for every layer. PaRO addresses this by rethinking how we partition model states to exploit fast local connections while minimizing slow global ones.

Introducing PaRO: Partial Redundancy Optimizer

The authors introduce two primary components to tackle these inefficiencies:

1. PaRO-DP (Data Parallelism)

Instead of just choosing between "no partitioning" (N) and "global partitioning" (G), PaRO introduces Intra-group partitioning (I). This allows model states (parameters, gradients, and optimizer states) to be partitioned within a local group (e.g., a single machine) while being replicated across groups.

This "partial redundancy" reduces the need for slow inter-node communication during the forward and backward passes. The authors define strategies using the notation $P_{p+g+os}$ (e.g., $P_{IIG}$ means parameters and gradients are partitioned locally, while optimizer states are partitioned globally).

Schematic of PaRO-DP strategies showing the flow of data and communication primitives.

2. PaRO-CC (Collective Communication)

Standard "Ring" topologies for operations like All-Gather are inefficient in heterogeneous networks because every step is limited by the slowest link. PaRO-CC rearranges the communication into a hierarchical structure (inner and outer rings) so that intra-node and inter-node transfers can happen more efficiently or even in parallel.

3. Selection Guideline

To help engineers choose the best strategy, the authors provide a quantitative formula that predicts training time based on model size, batch size, and network bandwidth, minimizing the guesswork in cluster configuration.

Key Insights

  • Redundancy is a Tool, Not a Waste: While "Zero Redundancy" sounds ideal for memory, "Partial Redundancy" is often the key to speed. By allowing some memory overlap between nodes, you can drastically cut down on the communication "tax" paid to the network.
  • The "Optimizer State" Rule: A key insight from their analysis is that the optimizer state should always be partitioned at least as finely as the parameters and gradients. Partitioning it more coarsely uses more memory without providing any communication benefit.
  • Topology Matters: Algorithms often assume a "flat" network. By making the communication algorithm (PaRO-CC) aware of the physical hardware layout (groups/nodes), you can unlock significant performance without changing the underlying math of the model.

Experimental Results

The researchers evaluated PaRO using the LLaMA-7B and LLaMA-65B architectures on the C4 corpus from the RedPajama dataset. The performance gains are substantial across different model scales and training types:

  • Massive Speedups: In LLaMA-65B training, PaRO-DP achieved a 266% improvement in throughput compared to ZeRO-3. For LLaMA-7B, the improvement was 128%.
  • PEFT Efficiency: In LoRA/PEFT scenarios, where only a fraction of parameters are trained, the $P_{ING}$ strategy improved throughput by 44% over ZeRO-3.
  • Scalability: PaRO demonstrates near-linear scalability, consistently outperforming ZeRO-2 and ZeRO-3 baselines as the number of GPUs scales from 16 to 128.
  • Integration: When PaRO-CC was integrated into a Megatron-LM (Tensor Parallel) task, it boosted end-to-end training speed by 17%.
Throughput comparison showing PaRO's superior performance across different model scales.

Limitations and Future Work

The authors note that their method primarily focuses on data parallelism. While they showed that PaRO-CC can help other forms of parallelism (like Tensor Parallelism), the full PaRO-DP suite is designed for DP-heavy workloads.

Additionally, the performance gains are most pronounced in heterogeneous networks. In a hypothetical environment where inter-node bandwidth is as fast as intra-node NVLink, the advantages of partial redundancy would diminish. Future work could involve more deeply integrating these strategies with automated "auto-parallelism" frameworks that slice models at an even finer operator-level granularity.

Summary updated

BibTeX
@inproceedings{zhang2024rethinking,
  author = {Hanxiao Zhang and Lin JU and Chan Wu and Jinjing Huang and Youshao Xiao and Zhenglei Zhou and Zhiming fan and Zhaoxin Huan and Siyuan Li and Fanzhuang Meng and Lei Liang and Xiaolu Zhang and JUN ZHOU},
  title = {{Rethinking Memory and Communication Costs for Efficient Data Parallel Training of Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=4Un2TD9bNe},
}
Figure