3D Parallelism (DP × TP × PP)

Definition

3D parallelism composes the three orthogonal axes — data × tensor × pipeline parallelism — into one training configuration, extended to 4D/5D with expert (EP) and context (CP) parallelism for MoE and long context. No single axis scales alone; the art is mapping each onto the interconnect fast enough for its traffic while the model fits in aggregate memory.

Key math / How it works

Each axis has a distinct comms profile that dictates where on the topology it must live (the ~18× NVLink-vs-IB cliff on H100 — 900 vs ~50 GB/s):

AxisSplitsCommsPlacement
TPeach matmulall-reduce every layer (critical path)inside a node, NVLink,
SPLN/dropout/residual (seq)AG/RS, fused with TPinside node
CPsequence (attention)ring P2P, overlappedfast links
PPlayers → stagesP2P at boundariesacross nodes (IB-tolerant)
EPMoE expertsall-to-allnode / cross-node
DPthe batchgrad sync once/step, overlappedoutermost (most latency-tolerant)

The placement rule: put the chattiest dimension on the fastest link. Canonical rank ordering (Llama 3): [TP, CP, PP, DP] innermost→outermost. TP innermost so its per-layer all-reduces ride NVLink; DP outermost because its single overlapped gradient sync tolerates the most latency.

How to reason about a config — memory-first, then comms:

  1. Compute per-GPU memory need (params/shard + optimizer + peak activations).
  2. Params don’t fit → add PP (cheap comms) until they do.
  3. A layer’s activations don’t fit / want higher per-GPU FLOPs → add TP (≤8, NVLink) + SP.
  4. MoE experts too big → EP. Sequence too long → CP.
  5. Fill remaining GPUs with DP (ZeRO/FSDP) for throughput; size microbatches to shrink the bubble.

Real configs:

RunGPUsTPCPPPEPDP
Llama 3 405B (8K)16,3848116—128
Llama 3 405B (128K)16,38481616—8
DeepSeek-V32,048011664ZeRO-1

Why it matters

3D/4D/5D parallelism is how frontier models are actually trained. A naive config can leave half the cluster idle (Llama 4 Behemoth ran ~19.7% of FP8 peak on 32K GPUs); a good one keeps each axis’s collective on a link that can afford it and overlaps everything. This is the core reasoning of a training-systems engineer — the toolbox from which every large run is assembled.

Taught in

See also