Pipeline Parallelism › Worked Example: Four-Stage 1F1B Pipeline
Language AI HandbookAll chapters Pipeline Parallelism › Worked Example: Four-Stage 1F1B PipelineOne section · Sections in this chapter6 / 10 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To make the scheduling mechanics concrete, let us trace a 4-stage pipeline with micro-batches through a standard 1F1B schedule. Label the stages S1 through S4 and the micro-batches B1 through B4. Use "F" to denote the forward pass of micro-batch and "B" to denote the backward pass of micro-batch .
The timeline proceeds as follows.
During the warmup phase, S1 runs F1. After S1 completes F1, S2 can start F1 while S1 starts F2. After S2 completes F1, S3 can start F1; and so on. The warmup expands the pipeline: after time steps, all stages are simultaneously occupied with forward passes. At this point, S4 completes F1 and can begin B1, which marks the start of the steady-state phase.
During the steady state, S4 alternates: after completing B1, it runs F2, then B2, then F3, then B3, then F4, then B4. S3 runs its forward passes one step behind S4 and its backward passes one step after S4. S1 and S2 follow the same pattern at their respective offsets.
During the drain phase, after S4 completes F4 (the last forward pass), the pipeline empties as backward passes drain from S4 back to S1. No new forward passes enter, and stages become idle one by one as their remaining backward passes complete.
The total number of time steps for the complete run is:
where:
- : forward and backward work time steps for four micro-batches
- : bubble time steps from the startup ramp and drain
Of the 14 total time steps, 8 represent useful forward or backward work and 6 are pipeline overhead, giving a bubble fraction of . The example is deliberately small to make the schedule traceable; in practice , which makes the bubble fraction much smaller.
The activation memory at any stage in this 1F1B schedule is bounded by the maximum number of concurrent forward-pass activations. In standard 1F1B, this maximum is micro-batches' worth of activations per stage, regardless of . At the peak of the warmup phase, S1 has processed F1, F2, F3, and F4 in the forward direction and is holding all four sets of activations. It then frees each set as the corresponding backward pass returns from the later stages. The peak is activations, confirming the memory bound.
