Fine-tuning, RLHF & Alignment·Question 61 of 61Advanced

Walk me through pipeline-parallel training schedules: GPipe, 1F1B, interleaved stages and zero-bubble schedules. Where does the bubble come from, and what does each schedule give up to shrink it?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Pipeline parallelism splits the model's layers into p stages on p devices and splits each batch into m micro-batches. Stage i cannot start a micro-batch's forward until stage i-1 finishes it, and backward runs in the reverse direction. At the start and end of every step some stages are idle waiting: that idle time is the bubble.

Full worked answer

Pipeline parallelism splits the model's layers into p stages on p devices and splits each batch into m micro-batches. Stage i cannot start a micro-batch's forward until stage i-1 finishes it, and backward runs in the reverse direction. At the start and end of every step some stages are idle waiting: that idle time is the bubble.

GPipe. All m forwards, then all m backwards. Bubble fraction is (p-1)/(m+p-1): with 8 stages and 8 micro-batches, nearly half the time is idle. Raising m shrinks it but every stage stores activations for all m micro-batches until their backward, so activation memory grows with m.

1F1B (one forward, one backward). After a warmup of p forwards, each stage alternates one forward and one backward. The bubble fraction is the same as GPipe for the same m, but peak in-flight activations drop to about p micro-batches instead of m. The win is memory, which you then spend on a larger m to shrink the bubble. This is the default in Megatron-style stacks.

Interleaved 1F1B (virtual stages). Each device holds v non-adjacent chunks of layers instead of one contiguous block, so the pipeline has p x v shorter stages. The bubble shrinks by roughly a factor of v. The cost is v times more point-to-point communication between devices, a more complex schedule, and a constraint that m divide evenly with p. It pays when inter-stage links are fast.

Zero-bubble schedules. The key observation (Qi et al., 2023): backward has two parts, the gradient with respect to the input (B), which the previous stage is waiting for, and the gradient with respect to the weights (W), which nobody is waiting for. Splitting them lets the schedule run B early to unblock upstream stages and slot W computations into what would have been bubbles. Variants get the bubble close to zero. The costs: more activation memory held until W runs, a harder schedule to implement and debug, and care around the optimiser step, since a synchronous step needs all W work finished.

Bidirectional schedules. DeepSeek's DualPipe feeds micro-batches from both ends of the pipeline and overlaps computation with communication, including MoE all-to-all, at the cost of keeping two copies of some parameters. The DeepSeek company page covers it in depth.

How to choose in an interview answer:

  • Pipeline parallelism is usually the outer dimension, used across nodes when tensor parallelism is confined to fast intra-node links and the model does not fit with FSDP alone.
  • Start with 1F1B and a micro-batch count of at least 4p. Move to interleaved when the bubble is still large and the interconnect is good. Reach for zero-bubble when you can afford the memory and the engineering, typically at very large scale.
  • Balance stages: the slowest stage sets the pace, and embedding and output layers make the first and last stages heavier than the middle.

What a good answer covers

  • Pipeline parallelism splits the model's layers into p stages on p devices and splits each batch into m…
  • Stage i cannot start a micro-batch's forward until stage i-1 finishes it, and backward runs in the…
  • At the start and end of every step some stages are idle waiting: that idle time is the bubble
  • All m forwards, then all m backwards
  • Bubble fraction is (p-1)/(m+p-1): with 8 stages and 8 micro-batches, nearly half the time is idle

Key terms: bubble · GPipe · 1F1B (one forward, one backward) · Interleaved 1F1B (virtual stages) · Zero-bubble schedules · Bidirectional schedules

Interviewer follow-ups to expect

  1. Why does a larger global batch make pipeline parallelism cheaper, and what does that do to optimisation?

  2. How do you balance stages when the first and last layers are much heavier?

  3. How does pipeline parallelism interact with gradient accumulation and activation checkpointing?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep