What is pipeline parallelism?
Pipeline parallelism is a model parallelism method that places consecutive groups of a neural network's layers on different accelerators as stages, passing data through the stages in turn for training or inference.
Unlike tensor parallelism, which splits one layer's computation across devices, pipeline parallelism leaves layers whole and distributes groups of them. Only activations at stage boundaries (and their gradients in training) move between devices, so communication needs are lower.
- Topic
- Infrastructure and runtime
- Also known as
- Inter-layer model parallelism
How pipeline parallelism works
- Layers are split into consecutive stages, each assigned to a device or group of devices.
- A batch is split into micro-batches; when a stage finishes one it passes it on before taking the next.
- Different stages thus work on different micro-batches at once, reducing device idle time.
- If stage workloads are unbalanced, the slowest stage sets the pace, so the split is tuned accordingly.
In more detail
Bubble fraction and 1F1B, Zero-Bubble and DualPipe scheduling
The idle gap while pipeline stages fill and drain is called the pipeline bubble; under naive GPipe scheduling (all forward micro-batches then all backward), the bubble fraction is roughly (P-1)/(M+P-1) for P stages and M micro-batches and all M activations must stay in memory simultaneously. Modern schedules such as 1F1B (one-forward-one-backward), interleaved 1F1B, Zero-Bubble PP and DualPipe sharply cut both activation memory and bubble overhead.
Activation memory in training and the latency-throughput balance in decoding
During training, pipeline parallelism adds activation-storage overhead for in-flight micro-batches; during autoregressive inference, decode steps are small and sequential, so pipeline parallelism helps throughput under high batching (continuous batching) rather than single-request latency, where tensor parallelism is usually preferred.
Multi-dimensional parallelism and stage imbalance
Large frontier and Mixture-of-Experts (MoE) training combines 3D+ parallelism: tensor and sequence/context parallelism inside high-bandwidth NVLink nodes, pipeline parallelism across nodes, data parallelism (FSDP/ZeRO) across replicas and expert parallelism for sparse MoE layers. Additionally, embedding layers, LM heads and uneven MoE routing complicate naive equal-layer stage balancing.
Commonly confused terms
| Term | How it differs |
|---|---|
| Data parallelism | Data parallelism (including ZeRO / FSDP) replicates or shards model state while feeding different data batches to each replica and synchronising gradients, whereas pipeline parallelism partitions the model layers themselves across devices. |
| Context parallelism | Context/sequence parallelism splits long input sequences along the sequence dimension to fit long-context activations/KV caches, whereas pipeline parallelism splits along the model depth (layer) dimension. |
Why pipeline parallelism matters for on-premises AI
Pipeline parallelism lets models too large for one server spread across several; since only activations pass between stages, it needs less inter-server communication than tensor parallelism. Its cost is idle time while the pipeline fills and drains. In-house capacity planning weighs server count, stage balance and inter-server links together. Large setups can use tensor parallelism within servers and pipeline parallelism across them.
On its in-house training cluster, a carmaker splits a model too large for one server across two servers with pipeline parallelism; each holds part of the layers while micro-batches keep both working at once.
Common questions
How does pipeline parallelism differ from tensor parallelism?
Pipeline parallelism spreads groups of layers across devices. Tensor parallelism splits each layer across devices, needing more frequent communication.
Why are micro-batches used?
So stages can work on different pieces of data at the same time. This reduces idle time while one stage waits for another.
Related terms
- Tensor parallelism
- Model parallelism
- Data parallelism
- Distributed training
- Distributed inference
- Graphics Processing Unit
Sources
- Huang et al., GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism, 2018
- Narayanan et al., Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM, 2021
In the glossary: Glossary, M to Q