Abstract
Pipeline parallelism is one of the key components for large-scale distributed training, yet its efficiency suffers from pipeline bubbles which were deemed inevitable. In this work, we introduce a scheduling strategy that, to our knowledge, is the first to successfully achieve zero pipeline bubbles under synchronous training semantics. The key idea behind this improvement is to split the backward computation into two parts, one that computes gradient for the input and another that computes for the parameters. Based on this idea, we handcraft novel pipeline schedules that significantly outperform the baseline methods. We further develop an algorithm that automatically finds an optimal schedule based on specific model configuration and memory limit. Additionally, to truly achieve zero bubble, we introduce a novel technique to bypass synchronizations during the optimizer step. Experimental evaluations show that our method outperforms the 1F1B schedule up to 23% in throughput under a similar memory limit. This number can be further pushed to 31% when the memory constraint is relaxed. We believe our results mark a major step forward in harnessing the true potential of pipeline parallelism.
Introduction
Training massive large language models (LLMs) requires sophisticated distributed strategies. Pipeline Parallelism (PP) is a standard technique that partitions a model across multiple GPUs. However, traditional PP schedules like 1F1B (One-Forward-One-Backward) suffer from "pipeline bubbles"—idle periods where processors wait for data dependencies. These bubbles have long been considered an unavoidable cost of synchronous training. This paper introduces a novel approach to eliminate these bubbles entirely while maintaining the mathematical exactness of synchronous training.
Core Innovation: Decoupling the Backward Pass
The fundamental insight of this work is the decomposition of the backward pass. In standard implementations, the backward pass is a monolithic operation. The authors propose splitting it into two distinct tasks:
- B (Backward-input): Computes the gradient with respect to the input, which is required by the preceding pipeline stage.
- W (Backward-weight): Computes the gradient with respect to the weights, which is only needed for the final optimizer update.
By separating these tasks, the W computation can be treated as "filler" work. Since W has no immediate downstream dependencies, it can be scheduled during the idle periods (bubbles) of other stages, effectively maximizing hardware utilization.
Novel Pipeline Schedules
Building on this decoupling, the researchers developed several scheduling strategies:
- ZB-H1 & ZB-H2: Handcrafted schedules where ZB-H1 matches 1F1B's memory footprint with reduced bubbles, and ZB-H2 achieves zero bubbles with increased memory.
- ZB-V: An interleaved "V-shape" schedule that achieves zero bubbles while maintaining memory efficiency comparable to 1F1B.
- Automatic Scheduling: An Integer Linear Programming (ILP) algorithm was developed to find the optimal schedule for any specific model architecture and memory constraint.
- Speculative Optimizer Step: To eliminate the final synchronization bottleneck, the authors introduced a post-validation and rollback mechanism. This allows the pipeline to proceed to the next batch speculatively, rolling back only if an anomaly (like NaNs) is detected in the previous batch's gradients.
Experimental Results
The proposed methods were evaluated on GPT-3 style models ranging from 1.5B to 28.3B parameters using NVIDIA A100 GPUs. The results demonstrate significant improvements in throughput and efficiency.
Key findings include:
- Throughput Gains: The "Zero Bubble" (ZB-2p) method improved throughput by 23% under strict memory limits and up to 31% with relaxed constraints compared to 1F1B.
- Bubble Reduction: In most scenarios, the bubble rate—the percentage of time GPUs are idle—was reduced from 10-20% to less than 1%.
- Scalability: The method proves particularly effective for configurations with a small number of microbatches, a common scenario in massive-scale training.
Conclusion
Zero Bubble Pipeline Parallelism represents a significant advancement in distributed training efficiency. By rethinking the granularity of the backward pass and employing speculative optimization, the authors have turned what was once an "inevitable tax" into a source of performance gain. The implementation is open-sourced and integrated with Megatron-LM, providing a practical path for optimizing the training of future large-scale models.
Summary updated