Pipeline Parallelism
A model with 70 billion parameters does not fit on one GPU, so training it means cutting it up. Pipeline parallelism makes the most natural cut: give each device a different slice of the layer stack and pass activations down the line.
Stages, micro-batches and the bubbleLayers 1 to 20 live on device 0, layers 21 to 40 on device 1, and so on; each slice is a stage. Done naively this wastes almost everything, because stage 2 idles until stage 1 finishes its forward pass and then idles again waiting for gradients. The fix is to cut each batch into micro-batches so different stages work on different micro-batches at the same time, the way an assembly line keeps every station busy. The idle time left at the start and end of each step is the pipeline bubble, and shrinking it — more micro-batches, interleaved one-forward-one-backward schedules — is most of the engineering.
Why it is one of three- It cuts memory per device almost proportionally and sends only stage-boundary activations across the wire, so it tolerates slow interconnects — which is why it spans machines while tensor parallelism splits individual matrices inside one machine.
- Large runs combine pipeline, tensor and data parallelism, the three-dimensional configuration used in Megatron-LM and DeepSpeed for GPT-3-scale and LLaMA-scale training.
- It helps less at serving time: a single request still crosses the stages in order, so pipelining adds latency unless many requests are in flight.
Pipeline parallelism splits a model's layers across devices, each holding one consecutive stage, with activations passed from stage to stage. Batches are divided into micro-batches so stages compute concurrently instead of waiting, leaving a residual idle bubble. It is what allows a model too large for one accelerator to be trained at all, and because only stage-boundary activations cross the wire, it is the parallelism used across machines.
Pipeline parallelism is an assembly line for a model too big to fit on one chip. The model's layers are divided into groups, and each group is handed to a different processor. Work moves along the line: the first processor handles the beginning of the calculation, passes its result to the second, and so on to the end. To stop the later stations standing idle, the data is fed in small portions, so every processor is busy on a different portion at the same time. It is one of the standard tricks that makes training today's largest language models possible at all.