Pipeline Parallelism in Production LLM Training: Comparing 1F1B, Interleaved 1F1B, Zero-Bubble, and DualPipe Schedules
Training modern large language models spanning hundreds of billions of parameters requires distributing model layers across multiple compute nodes. While Tensor Parallelism (TP) partitions individual matrix multiplications across GPUs within a single node, its reliance on high-frequency, all-reduce communications limits its practical scaling to the high-bandwidth domain of NVLink (typically 8 GPUs per node). To scale models beyond single-node memory boundaries, distributed training systems rely on Pipeline Parallelism (PP), which partitions the model depth-wise across successive pipeline stages.
The central engineering challenge in pipeline parallelism is the pipeline bubble: worker GPUs remain idle during pipeline warmup and cooldown while waiting for activations or gradients to propagate across sequential stages. Over the past five years, pipeline scheduling has progressed from naive batching to interleaved virtual stages, decoupled gradient passes, and bidirectional communication-computation overlap.

The Pipeline Bubble Formulation
In pipeline parallelism, a model with layers is partitioned across pipeline stages, with each stage hosted on an independent GPU or tensor-parallel group. A global batch is subdivided into microbatches.
In the baseline GPipe schedule introduced by Huang et al. (2019), all microbatches execute their forward passes sequentially from stage 0 to stage , followed by backward passes in reverse order. The total execution time includes idle intervals during which downstream stages wait for forward activations and upstream stages wait for backward gradients.
The ideal computation time without idle bubbles is:
where represents the forward computation time per microbatch on one stage, and represents the backward computation time.
In GPipe, the idle bubble duration per iteration spans . The bubble fraction is expressed as:
To reduce below 10%, engineering teams must set . However, scaling arbitrarily is constrained by several physical factors:
- Global Batch Size Limits: The global batch size is , where is the microbatch size and is the data-parallel degree. Expanding increases , which can degrade optimization dynamics and validation loss beyond critical batch size thresholds.
- Activation Memory Explosion: In GPipe, every stage must store activations for all microbatches until backpropagation completes, causing GPU out-of-memory (OOM) failures on long context windows.
1F1B Scheduling (PipeDream)
To resolve the activation memory scaling of GPipe, Narayanan et al. (2019) introduced the One Forward, One Backward (1F1B) schedule in PipeDream and adapted it for memory-efficient LLM pre-training in Megatron-LM (Narayanan et al., 2021).
Execution Mechanics
Instead of batching all forward passes together, 1F1B divides execution into three distinct phases:
- Warmup Phase: Stage executes consecutive forward passes to fill the pipeline.
- Steady-State Phase: Once the first backward pass is received from the subsequent stage, each stage alternates strictly between executing one backward pass and one forward pass ().
- Cooldown Phase: After all forward passes are completed, stages process the remaining backward passes.
Stage 3: [F0][F1][F2][F3][B0][F4][B1][F5][B2][F6][B3][B4][B5][B6]
Stage 2: [F0][F1][F2][F3][F4][B0][F5][B1][F6][B2][B3][B4][B5][B6]
Stage 1: [F0][F1][F2][F3][F4][F5][B0][F6][B1][B2][B3][B4][B5][B6]
Stage 0: [F0][F1][F2][F3][F4][F5][F6][B0][B1][B2][B3][B4][B5][B6]
Time -->Resource Characteristics
In 1F1B, the maximum number of in-flight microbatches stored in memory on any stage is capped at . Peak activation memory scales with rather than , allowing training with large microbatch counts without exhausting device high-bandwidth memory (HBM).
However, 1F1B maintains the same bubble overhead as GPipe:
The bubble ratio remains approximately .
Interleaved 1F1B (Megatron-LM 1F1B-I)
To reduce the bubble ratio without increasing global batch size, Megatron-LM introduced Interleaved 1F1B (1F1B-I).
Virtual Stage Partitioning
In 1F1B-I, each physical GPU hosts virtual stages (model chunks) rather than a single contiguous block of layers. For example, with physical stages and virtual stages per device:
- Device 0 hosts Chunk 0 (layers 0-3) and Chunk 4 (layers 16-19)
- Device 1 hosts Chunk 1 (layers 4-7) and Chunk 5 (layers 20-23)
- Device 2 hosts Chunk 2 (layers 8-11) and Chunk 6 (layers 24-27)
- Device 3 hosts Chunk 3 (layers 12-15) and Chunk 7 (layers 28-31)
Microbatches cycle through all physical devices twice: forward passes travel Device , and backward passes travel in reverse order.
Bubble and Overhead Trade-Offs
Interleaving shortens the pipeline bubble duration by a factor of :
The corresponding bubble fraction decreases to:
This reduction introduces two engineering costs:
- Communication Volume: Point-to-point (P2P) peer transfers over network interfaces scale up by , increasing cross-node InfiniBand traffic.
- Activation Footprint: Storing activations across multiple virtual chunks increases peak activation memory by per stage. In production systems, is typically constrained to 2 or 4.
Zero-Bubble Pipeline Parallelism (ZB-1P, ZB-2P, ZB-V)
While 1F1B and 1F1B-I treat the backward pass as an indivisible block of time , Qi et al. (ICLR 2024) demonstrated that backward computation comprises two distinct operations with differing dependency requirements.
Decoupling Activation and Weight Gradients
For a parameterized layer , computing the backward pass given incoming gradient requires:
- Activation Gradient ( or ):
This gradient must be transmitted immediately to the upstream pipeline stage so that earlier layers can continue backpropagation.
- Parameter/Weight Gradient ( or ):
This tensor is accumulated locally into the gradient buffer for the optimizer update. No other pipeline stage requires this tensor during the forward-backward iteration.
In standard Transformer layers, the computational cost divides roughly as , where (computing ) represents of total backward computation and (computing ) represents the remaining .
Standard Backward (2/3 total step time):
[------------- Backward Step t_B_total -------------]
[-- Activation Grad B_x (t_B) --][-- Weight Grad B_W (t_W) --]
^ Required by Stage k-1 ^ Local accumulation onlyZB-1P and ZB-2P Scheduling
Because computation does not sit on the critical latency path of backpropagation, Zero-Bubble schedules decouple and :
- The activation gradient computation () is executed immediately to keep upstream stages active.
- The parameter gradient computation () is deferred and scheduled into the idle intervals (bubbles) during warmup, steady state, and cooldown.
In ZB-1P (Zero-Bubble 1-Phase), kernels are prioritized such that peak activation memory remains identical to standard 1F1B ( microbatches). The resulting bubble duration decreases to:
When , approaches zero in steady state.
In ZB-2P, the schedule allows peak activation memory to reach microbatches, enabling an optimizer-validated reordering where all pipeline bubbles are filled by deferred passes. ZB-V combines this decoupling with virtual stage interleaving to achieve zero bubble under equivalent memory bounds.
Bidirectional Overlap: DeepSeek DualPipe
In large-scale Mixture of Experts (MoE) architectures such as DeepSeek-V3 and DeepSeek-R1 (DeepSeek-AI, 2024), inter-node All-to-All communication for routed experts introduces substantial network latency. To eliminate both pipeline idle bubbles and communication overheads, DeepSeek introduced DualPipe, an open-source bidirectional pipeline parallelism schedule (GitHub: deepseek-ai/DualPipe).
Bidirectional Microbatch Streams
DualPipe deploys two symmetrical pipelines running simultaneously in opposite directions on the same physical infrastructure:
- Forward Stream 0: Flows from Stage
- Forward Stream 1: Flows from Stage
Each physical GPU is assigned two symmetric chunks: one from the first half of the model and one from the second half.
DualPipe Physical Mapping (PP = 4):
GPU 0: Chunk 0 (Layers 0..15) & Chunk 7 (Layers 96..111)
GPU 1: Chunk 1 (Layers 16..31) & Chunk 6 (Layers 80..95)
GPU 2: Chunk 2 (Layers 32..47) & Chunk 5 (Layers 64..79)
GPU 3: Chunk 3 (Layers 48..63) & Chunk 4 (Layers 64..79)Overlapped Forward-Backward Kernels ()
DualPipe integrates the gradient splitting of Zero-Bubble with kernel-level computation-communication overlap. During steady state, DualPipe executes combined instructions:
- As a forward chunk executes its dense matrix multiplications, it simultaneously drives the asynchronous non-blocking All-to-All communication of MoE dispatch for a backward chunk.
- The backward pass activation gradient () and weight gradient () are interleaved directly between forward activations.
DualPipe Computation-Communication Overlap:
[---------------- Computation Track ----------------]
[ Forward GEMM (Chunk A) ][ Backward GEMM (Chunk B) ]
[---------------- Communication Track --------------]
[ P2P Recv (Chunk B) ][ MoE All-to-All (Chunk A) ]
<------- Synchronous Execution over Dual Streams ------>The bubble duration in DualPipe drops to:
where is the execution time of the fused forward-backward overlap kernel.
Architectural Comparison and Systems Economics
The choice of pipeline parallel schedule determines the trade-off between memory allocation, network pressure, and GPU Model FLOPs Utilization (MFU).
| Feature / Metric | 1F1B (PipeDream) | Interleaved 1F1B | Zero-Bubble (ZB-1P) | DeepSeek DualPipe | | :--- | :--- | :--- | :--- | :--- | | Bubble Time | | | | | | Typical Bubble Fraction | | | | | | Peak Activation Memory | | | | | | Model Parameter Copies | | | | (Shared stages per GPU) | | P2P Network Volume | Baseline () | Baseline | Baseline () | Baseline | | MoE All-to-All Overlap | None | Limited | None | Full asynchronous overlap | | Kernel Complexity | Standard PyTorch | Standard PyTorch | Custom autograd engine | Custom dual-stream overlap |
Implementation Considerations in Production Clusters
When deploying advanced pipeline schedules in production clusters running Megatron-Core, DeepSpeed, or custom frameworks, several systems considerations apply:
- Autograd Hook Splitting: Standard PyTorch
torch.autograd.backward()bundles tensor and parameter gradient passes into a single execution graph. Implementing Zero-Bubble or DualPipe requires registering manual tensor hooks or custom C++/CUDA backward kernels that emit and return immediately, queuing onto a secondary worker queue. - CUDA Stream Synchronization: DualPipe requires multi-stream management (typically separate compute, P2P send, P2P receive, and All-to-All collective streams). Unbalanced microbatch execution times can introduce intra-device synchronization bubbles if GPU SM occupancy is saturated by GEMM kernels during non-blocking communication passes.
- Memory Budget Allocation: In MoE pre-training, parameter memory is dominated by routed experts. Because DualPipe assigns two distinct layer chunks to each physical device, the model parameter memory per GPU doubles unless weights are sharded via ZeRO-style distributed optimizers across data-parallel groups.
Sources
- PipeDream: Fast and Efficient Pipeline Parallel DNN Training (Narayanan et al., SOSP 2019 / arXiv:1906.00707)
- GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism (Huang et al., NeurIPS 2019 / arXiv:1811.06965)
- Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM (Narayanan et al., SC 2021 / arXiv:2104.04473)
- Zero Bubble Pipeline Parallelism (Qi et al., ICLR 2024 / arXiv:2401.10241)
- DeepSeek-V3 Technical Report (DeepSeek-AI, 2024 / arXiv:2412.19437)
- DeepSeek DualPipe Implementation (GitHub: deepseek-ai/DualPipe)



