Pipeline Parallelism

Pipeline parallelism adds a time schedule to tensor ownership. Microbatch order, bubbles, activation lifetime and backward dependencies must be correct before throughput tuning.

Section 6 of 10 · 10 units · about 42 hours

0/10

By the end you can Generate valid GPipe and 1F1B traces, match a two-stage PyTorch run on outputs and gradients, predict bubbles and activation peaks, and diagnose an injected ordering or stalled-peer failure.

Units

Build it

Mini project · about 10 to 14 hours

Pipeline schedules with validated simulation and measured trade-offs

Build pipeline stages and microbatch flow in trainlab, validate fill-drain and one-forward-one-backward schedules in an event simulator, and measure schedule trade-offs with equivalence kept. Stalled peers, recompute and group composition turn schedule sketches into runnable evidence.

  1. 1Partition an ordered layer stack into stages with embedding-first and output-last ownership in parallel/, splitting batches into equal microbatches with a stated remainder policy. Anchor the map with the PyTorch pipelining tutorial splits and the TorchFeather microbatch variation, keeping output equality as the gate.
  2. 2Send activations forward and gradients backward between processes over the Gloo backend with per-microbatch tags and shape assertions, reading stalled peers from event traces. Execute fill-drain and one-forward-one-backward schedules over the pairs, matching losses across schedules as the PyTorch tutorial and TorchFeather run do.
  3. 3Derive bubble and lifetime predictions for each schedule from the model, and pass the TensorTonic bubble-utilization cases. Encode the schedules as an event simulator in parallel/ with trace output, live-activation accounting and named rejection of wrong order, short microbatches and stalled peers.
  4. 4Extend the validated simulator with one interleaved-schedule variant, keeping bubble and memory deltas against the baseline. Place parameters, loss and optimizer state by stage with final-stage loss and a stated tied-weight contract, proving update equivalence against the model/ oracle with the microbatch-mean scaling correction.
  5. 5Checkpoint one stage with recompute equivalence checks, and compose pipeline groups with data groups with gradient averaging on the replicate group against the model/ oracle. Measure bubble, memory, transfer and step time across configurations in trace/, keeping equivalence passing and predictions distinct from measurements.
What you hand in
  • The parallel/ stages, microbatch flow and validated schedule simulator with traces.
  • Stage ownership, recompute and group-composition proofs against the single-process oracle.
  • trace/ and reports/ with bubble, memory, transfer and step-time comparisons and residuals.
How to check it
How it's graded

Schedule validity

Pass: Hand traces match simulator cells, and wrong order, short microbatches and stalled peers fail by name.

Great: The interleaved extension replays with bubble and memory deltas attributed to schedule changes.

Transfer and stall reading

Pass: Tagged transfers round-trip with shape agreement, and event logs name the unmatched side.

Great: A broken-tag run is diagnosed from the trace without rerunning with extra logging.

Ownership and equivalence

Pass: Stage state placement is drawn from memory, and updates match the oracle after scaling correction.

Great: Recompute and group composition keep equivalence, with the averaging group named correctly.

Measurement honesty

Pass: Every row states its setup, keeps equivalence passing and separates prediction from measurement.

Great: Residuals name the bottleneck, and one regime where the smaller bubble does not win is kept.

Resources

  • Ultra-Scale Playbook - Pipeline ParallelismHugging Face

    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.

  • Picotron - Pipeline ParallelismHugging Face

    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.

  • TorchFeather - Pipeline Minimal Example and RuntimeTorchFeather

    Run minimal_examples/pp_gpipe.py with 8 Gloo processes on CPU (two stages by four replicas); it checks outputs and averaged gradients against a reference. Read its tagged isend and irecv calls, then distributed/pipeline_parallel.py, and compare the event order with Picotron.

  • PyTorch Pipeline Parallelism TutorialPyTorch

    Complete the tutorial and compare ScheduleGPipe and Schedule1F1B, 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.

  • Picotron Tutorial - Steps 7 and 8Hugging Face

    Read step7_pipeline_parallel_afab and step8_pipeline_parallel_1f1b with their diffs; the video series stops before pipeline parallelism.

  • First-Principles Video - Pipeline Parallelism SegmentUmar Jamil

    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.

  • How to Scale Your Model - Pipeline Parallelism in Chapter 5Google DeepMind

    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)

    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)

    Read the PipeDream-Flush (1F1B) schedule and its activation-memory bound. Compare its stashed-activation count with GPipe in your simulator.

  • Zero Bubble Pipeline ParallelismQi et al. (ICLR 2024)

    Read the split of backward into input and weight gradients and the handcrafted schedules. Optional vocabulary for zero-bubble and DualPipe schedules.

  • TensorTonic - Pipeline Bubble UtilizationTensorTonic

    Solve the pipeline bubble utilization problem, then extend its model to 1F1B and interleaved stages in your simulator.

  • Distributed Training Subsystem - Pipeline SchedulerRoadmap-Final

    Complete the scheduler, event trace, activation-lifetime accounting and failure injection required in Milestone B. Keep the simulator runnable without GPUs.