How do data, tensor, pipeline and expert parallelism combine?
Choose device layouts by partition and communication path.
Content revision 4 · 2026-10-24
S02 · Revision 1 · 2026-10-21
- DP: different samples
- TP: tensors within a layer
- PP: layers / stages
- EP: experts
The bottleneck
When one device cannot handle parameters, activations or compute, work must be distributed. DP partitions samples, TP tensors within layers, PP layers and EP experts. They can combine, but are not four independent multipliers.
The mechanism
TP frequently exchanges partial results within a layer and favors fast links. PP transfers activations between stages and fills pipelines with microbatches. DP synchronizes gradients or sharded states. EP dispatches and gathers routed tokens; in MoE, its layout often interacts with DP groups.
For a simple dense mesh: devices = DP × TP × PP
Examples and evidence
Example: 16 devices can form DP=2, TP=4, PP=2. Placing TP groups on fast local links is a starting hypothesis to benchmark. Do not blindly multiply by EP again. Megatron 2019 demonstrated intra-layer parallelism; the 2021 work studied combinations.
New constraints
PP has bubbles and stage imbalance, TP can be constrained by collectives, and EP by hot experts and all-to-all. Inspect memory, network topology, effective batch and fault recovery jointly rather than maximizing device count.
Primary sources
- Megatron-LM · 2019-09-17 · Checked 2026-10-21
- Efficient Large-Scale Language Model Training on GPU Clusters · 2021-04-09 · Checked 2026-10-21
- Switch Transformers · 2021-01-11 · Checked 2026-10-21
Manual browser reading records and interactive calculators are available with JavaScript.
Keep exploring
S01 · Which training states does ZeRO shard?