Unit 6 of 10 · about 4 hours · derive
Interleaved virtual stages and zero-bubble and dual-pipeline schedules
Interleaved and zero-bubble schedules are the vocabulary production stacks speak. This unit teaches reading them and pricing them, not building them.
You'll be able to
- Explain virtual stages, the bubble-versus-communication trade and depth-first versus breadth-first priority.
- Explain the input-gradient versus weight-gradient backward split and what a zero-bubble schedule reschedules.
- Name each PyTorch multi-stage schedule class and its preconditions.
Covers
Read
In this order, only the parts listed
0 of 5 done
- Interleaved stagesUltra-Scale Playbook - Pipeline Parallelism
Interleaving stages with FIG.LI and FIG.LII: chunks per GPU dividing pass time by , communication growing by , depth-first versus breadth-first priority, and the Llama 3.1 schedule in FIG.LIII
- Zero bubble and DualPipe sketchUltra-Scale Playbook - Pipeline Parallelism
Zero bubble and DualPipe with FIG.LIV and FIG.LV: splitting backward into input-gradient and weight-gradient parts and scheduling weight gradients after their input gradients to fill bubbles
Stop at the integer-programming paragraph. Handcrafted and solved schedules are vocabulary here; implementation stays depth work.
- Split backprop and handcrafted schedulesZero Bubble Pipeline Parallelism
Abstract and Sections 1 to 4 (arXiv:2401.10241v1): the input-gradient versus parameter-gradient split, the handcrafted ZB-H1 and ZB-H2 schedules, the automatically searched ZB-1P schedule behind
ScheduleInterleavedZeroBubble, and the Section 4 optimizer-step sync bypass needed for true zero bubble; read for vocabulary, not for a build - Multi-stage schedule referencePyTorch Pipeline Parallelism Tutorial
Pipeline Schedules (page read 2026-10-14):
ScheduleInterleaved1F1Bdepth-first,ScheduleLoopedBFSbreadth-first,ScheduleInterleavedZeroBubbleas ZB1P,ScheduleZBVZeroBubbleneeding exactly two stages per rank with zero bubble only when forward, input-backward and weight-backward times match, andScheduleDualPipeVNames and preconditions only. Constructing multi-stage runs needs more than two stages and stays an extension of the simulator unit.
- Looped layout and the zero-bubble introFirst-Principles Video - Pipeline Parallelism Segment
06:38:54 for the interleaved looped layout with earlier flush and the hop-count cost, and 06:47:59 for the zero-bubble input-gradient versus weight-gradient split intro
Focus on
- Virtual stages cut each device's passes into chunks: the bubble shrinks by about while each microbatch crosses about times more stage boundaries.
- Only the input gradient sits on the critical path to earlier stages; the weight gradient waits only for its own input gradient plus the optimizer step, so it fills idle slots.
- Depth-first serves earlier microbatches through later stages first; breadth-first serves earlier stages with all ready microbatches first.
- Zero bubble is conditional: matched op times, enough microbatches, and bypassed optimizer-step sync all have to hold at once.
Common mistakes · 3
- Calling any interleaved run zero-bubble. Interleaving shrinks the bubble by about but keeps one; zero needs the gradient split plus the sync bypass.
- Ignoring the extra communication. Each microbatch crosses more stage boundaries, so slow links can eat the schedule win.
- Expecting ZBV zero bubble on real layers. It needs forward, input-backward and weight-backward times equal, which real models rarely satisfy.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Two chunks per GPU: what happens to the bubble and to point-to-point volume?Answer
The bubble shrinks by about a factor of 2 while P2P volume roughly doubles, since each microbatch crosses twice as many stage boundaries.
2.What does the weight gradient wait for, and what does the input gradient unblock?Answer
The weight gradient waits only for its own input gradient and the optimizer step. The input gradient unblocks the previous stage, so it stays on the critical path while weight gradients fill idle slots.
3.How do Interleaved 1F1B and Looped BFS differ when several microbatches are ready?Answer
Interleaved 1F1B is depth-first: it prioritizes earlier microbatches through later stages. Looped BFS is breadth-first: it prioritizes earlier stages and runs all ready microbatches there.
4.What are the ZBV schedule's preconditions?Answer
Exactly two stages per rank, and the zero-bubble property only when forward, input-backward and weight-backward times match.
You're done when
You can price any named schedule's bubble, memory and preconditions from its class name and state which two conditions fail first on real layers.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 8 more in the section
- Ultra-Scale Playbook - Pipeline ParallelismHugging Face · primary
Read Pipeline Parallelism through All forward, all backward, One forward, one backward, Interleaving stages and Zero bubble and DualPipe. Derive bubble fraction and peak activation count for your simulator before running any schedule.
- First-Principles Video - Pipeline Parallelism SegmentUmar Jamil · support
Watch 06:06:17 for pipeline parallelism and 06:26:52 for GPipe, 1F1B and zero-bubble schedules. Stop after GPipe and 1F1B to draw and test those event traces; zero-bubble implementation remains depth work.
- PyTorch Pipeline Parallelism TutorialPyTorch · required
Complete the tutorial and compare
ScheduleGPipeandSchedule1F1B, then read https://docs.pytorch.org/docs/2.14/distributed.pipelining.html for the interleaved, looped, zero-bubble and DualPipeV schedules the tutorial omits. Preserve the model split, microbatch and loss contracts before adapting it. - Zero Bubble Pipeline ParallelismQi et al. (ICLR 2024) · support
Read the split of backward into input and weight gradients and the handcrafted schedules. Optional vocabulary for zero-bubble and DualPipe schedules.
Also in this section
- Picotron - Pipeline ParallelismHugging Face · required
Read pipeline_parallel/pipeline_parallel.py and pp_communications.py beside the pipeline branch in train.py. Build a schedule event simulator first, then reproduce GPipe and 1F1B with shape, tag and ordering assertions.
- Picotron Tutorial - Steps 7 and 8Hugging Face · support
Read
step7_pipeline_parallel_afabandstep8_pipeline_parallel_1f1bwith their diffs; the video series stops before pipeline parallelism. - TorchFeather - Pipeline Minimal Example and RuntimeTorchFeather · required
Run
minimal_examples/pp_gpipe.pywith 8 Gloo processes on CPU (two stages by four replicas); it checks outputs and averaged gradients against a reference. Read its taggedisendandirecvcalls, thendistributed/pipeline_parallel.py, and compare the event order with Picotron. - How to Scale Your Model - Pipeline Parallelism in Chapter 5Google DeepMind · support
Work the pipeline bubble and communication examples in Chapter 5. Use them to test your cost model under different stage counts, microbatch counts and imbalanced layers.
- GPipe: Efficient Training of Giant Neural Networks using Pipeline ParallelismHuang et al. (NeurIPS 2019) · support
Read the partitioning, microbatching and re-materialization design and the bubble overhead statement. Use it as the fill-drain specification your simulator reproduces.
- Memory-Efficient Pipeline-Parallel DNN TrainingNarayanan et al. (ICML 2021) · support
Read the PipeDream-Flush (1F1B) schedule and its activation-memory bound. Compare its stashed-activation count with GPipe in your simulator.
- TensorTonic - Pipeline Bubble UtilizationTensorTonic · support
Solve the pipeline bubble utilization problem, then extend its model to 1F1B and interleaved stages in your simulator.
- Distributed Training Subsystem - Pipeline SchedulerRoadmap-Final · support
Complete the scheduler, event trace, activation-lifetime accounting and failure injection required in Milestone B. Keep the simulator runnable without GPUs.