Pipeline Parallelism (PP)
Definition
Pipeline parallelism splits the model across layers: assign layers to stage 0, the next chunk to stage 1, etc., on GPU groups. Communication is only the activation at stage boundaries, sent GPU→GPU with cheap point-to-point send/recv (no collective) — so PP tolerates the slower inter-node InfiniBand link, unlike TP. The cost is a new enemy: the pipeline bubble.
Key math / How it works
Naively, stage can’t start until stage finishes the whole batch → only one GPU works at a time ( slowdown). Micro-batching (GPipe, Huang et al., arXiv:1811.06965) splits the batch into micro-batches streamed through so stages overlap. But the pipe still fills (stages idle while microbatch 1 propagates) and drains — that idle time is the bubble.
Deriving the bubble fraction. With per-microbatch times on one stage: useful work ; bubble (fill + drain ) :
For , . The ratio is what matters: and both give . Shrink it by raising — capped by memory and global batch. (Example: , want → need .)
Schedules:
- GPipe — all forwards, then all backwards. Simple, but stores activations for all microbatches → activation memory.
- 1F1B (PipeDream, Narayanan et al., arXiv:1806.03377**)** — after a warmup, each stage alternates one-forward-one-backward, freeing a microbatch’s activations right after its backward → memory. Same bubble as GPipe (common misconception: 1F1B does not reduce the bubble — it’s a memory optimization).
- Interleaved 1F1B (Megatron, arXiv:2104.04473**)** — each device gets non-contiguous layer chunks (“virtual stages”), shrinking fill/drain per chunk:
Price: more P2P traffic (each microbatch crosses stage boundaries as often); Megatron routes the extra reassembly over NVLink. Constraint: a multiple of . - Zero-Bubble PP (Qi et al., 2024)
[recent]— splits backward into input-grad (B) and weight-grad (W); W has no downstream dependency, so it fills the bubble, driving it toward zero.
Why it matters
PP cuts per-GPU parameter memory with cheap, latency-tolerant P2P comms, making it the axis that spans nodes in N-D parallelism (Llama 3: PP=16; DeepSeek-V3: 16-way PP with the DualPipe bidirectional schedule hiding MoE all-to-all). The bubble is the tax you pay, amortized by many microbatches or interleaving.
Taught in
- 10-model-parallelism — §5 bubble derivation, GPipe/1F1B/interleaved.
See also
- tensor-parallelism — the within-layer alternative (NVLink-bound)
- megatron-lm — interleaved 1F1B + 3D scaling
- collective-communication — PP uses P2P, not collectives
- 3d-parallelism — PP as the across-nodes axis
- recomputation — the other activation-memory lever
- gpu-systems-for-llms