ZeRO++: Extremely Efficient Collective Communication for Large Model Training

Guanhua Wang, Heyang Qin, Sam Ade Jacobs, Xiaoxia Wu, Connor Holmes, Zhewei Yao, Samyam Rajbhandari, Olatunji Ruwase, Feng Yan, Lei Yang, Yuxiong HeICLR 2024

Training massive Large Language Models (LLMs) is a constant battle against physics. As models grow to hundreds of billions of parameters, the time spent moving data between GPUs often eclipses the time spent actually calculating gradients. While Microsoft’s ZeRO (Zero Redundancy Optimizer) revolutionized this by partitioning model states across GPUs, it still struggles in "hostile" environments: clusters with low-bandwidth networking or scenarios requiring small batch sizes.

At ICLR 2024, researchers from Microsoft DeepSpeed and their collaborators introduced ZeRO++, a suite of three clever communication optimizations that reduce data movement by up to 4x, making high-performance LLM training accessible even on sub-optimal hardware.

TL;DR

ZeRO++ introduces three novel techniques—quantized weights, hierarchical partitioning, and quantized gradients—to reduce communication volume by 4x during LLM training. This results in up to a 2.16x throughput increase on low-bandwidth clusters and a 3.3x speedup for RLHF training, all while maintaining model accuracy.

What Problem Does This Paper Address?

In standard distributed training, every GPU needs a full copy of the model. ZeRO-3 solved the memory crisis by "sharding" the model across all GPUs, fetching only the pieces needed for a specific layer's calculation via a process called all-gather.

However, this creates a massive communication overhead. If your network is slow (e.g., standard Ethernet vs. high-end InfiniBand) or your batch size is small (meaning the GPU finishes its math quickly and sits idle waiting for the next data shard), communication becomes the primary bottleneck.

Impact of bandwidth and batch size on ZeRO-3 performance

The authors identify that ZeRO-3's efficiency drops significantly in these "low-compute, high-comm" scenarios. As shown above, throughput (TFLOPs per GPU) degrades substantially when communication bandwidth is constrained or when the batch size per GPU is reduced, particularly at larger cluster scales (384 GPUs).

Methods

ZeRO++ tackles the bottleneck from three different angles, collectively referred to as qwZ, hpZ, and qgZ:

ZeRO-3 baseline partitioning strategy across machines
  1. Quantized Weight Communication (qwZ): Before performing the "all-gather" to collect weights for the forward pass, ZeRO++ quantizes weights from FP16 (16-bit) down to 8-bit or 6-bit. This immediately cuts the communication volume in half. To prevent accuracy loss, they use block-based quantization, which scales small subsets of weights independently.
  2. Hierarchical Weight Partition (hpZ): In the backward pass, instead of gathering weights from every single GPU in the cluster (cross-node) as seen in standard ZeRO-3 partitioning, ZeRO++ maintains a full copy of the weights within each node (intra-node). While this uses slightly more memory, it allows the system to use ultra-fast intra-node connections (like NVLink) instead of the much slower cross-node cables.
  3. Quantized Gradient Communication (qgZ): To reduce the cost of averaging gradients (the "reduce-scatter" step), ZeRO++ uses a hierarchical all-to-all approach. It first reduces gradients within a node, then quantizes them to 4-bit for the slow cross-node hop, and finally dequantizes them on the other side.

Datasets

The researchers evaluated ZeRO++ across a variety of standard LLM tasks:

  • Pre-training: They used the Pile dataset to train GPT-style models ranging from 350M to 13B parameters.
  • Fine-tuning: They tested OPT (1.3B, 13B) and LLaMA (30B) models on high-quality open-source instruction datasets (e.g., Dahoas/rm-static).
  • RLHF: Reinforcement Learning from Human Feedback (RLHF) was tested using OPT-30B and LLaMA-2-70B.

Key Insights and Ideas

  • Trading Memory for Speed: The hpZ technique is a strategic retreat from ZeRO’s "zero redundancy" philosophy. By allowing a tiny bit of redundancy (one copy per node), they eliminate the most expensive communication step in the entire training loop.
  • Quantization as a Training Tool: Usually, quantization is something you do after training to make a model run faster on a phone. ZeRO++ proves that you can use aggressive quantization during the training process itself to speed up communication without hurting the final model's intelligence.
  • The "Free" Quantized Model: A fascinating byproduct of qwZ is that the model is naturally weight-quantized by the end of training. This means it can be deployed for inference immediately without needing additional post-training quantization (PTQ) steps.

Key Results

  • Throughput Gains: On a 384-GPU cluster with limited bandwidth, ZeRO++ achieved 2.16x higher throughput than vanilla ZeRO-3.
  • RLHF Efficiency: RLHF is notoriously communication-heavy because it involves both generation and training. ZeRO++ delivered a massive 3.3x speedup in this specific workflow.
  • Accuracy Preservation: Despite quantizing weights down to as low as 2-bits during fine-tuning, the models showed "on-par" accuracy and perplexity compared to full FP16 training.
  • Scalability: ZeRO++ enabled GPT-3 sized models to sustain over 45% of peak GPU throughput even at large scales (384 GPUs).

Limitations and Future Work

While ZeRO++ is a major step forward, the authors note a few areas for growth:

  • Memory Overhead: hpZ does require more GPU memory than ZeRO-3 (though still significantly less than basic data parallelism). For the absolute largest models on memory-constrained GPUs, this might be a tight fit.
  • Kernel Optimization: Much of the speedup relies on custom, highly-optimized CUDA kernels for quantization. Extending this to non-NVIDIA hardware would require significant engineering effort.
  • Extreme Quantization: The authors suggest that exploring 1-bit or 2-bit training for even smaller models is a promising future direction.

ZeRO++ effectively "democratizes" large model training, proving that you don't necessarily need a multi-million dollar networking infrastructure to train the next generation of AI.

Summary updated

BibTeX
@inproceedings{wang2024zero,
  author = {Guanhua Wang and Heyang Qin and Sam Ade Jacobs and Xiaoxia Wu and Connor Holmes and Zhewei Yao and Samyam Rajbhandari and Olatunji Ruwase and Feng Yan and Lei Yang and Yuxiong He},
  title = {{ZeRO++: Extremely Efficient Collective Communication for Large Model Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=gx2BT0a9MQ},
}
Figure