CS 336: Language Modeling from Scratch Lecture 8 — Parallelism Basics

Stanford University
Autumn 2026

Why Parallelism? Compute and Memory Ceilings

Parameters (log scale) 10B 100B 1T 3T Single B300 (288 GB ≈ 24B @ 12 B/p) GPT-3 175B (2020) MT-NLG 530B (2021) DS-V3 671B (2024) DS-V4.1-Flash 552B (2026) Kimi K3 2.8T (2026) Historical baselines (grey) → 2026 frontier MoEs (blue)
  • Memory ceiling: one 288 GB B300 fits ~24B dense params; 2026 MoEs reach 552B–2.8T
  • Compute ceiling: frontier runs train on tens of trillions of tokens (45T for DeepSeek-V4.1-Flash) — exaflops of cluster compute
  • Scaling goals across $N$ GPUs:
    • Linear memory scaling (model size $\propto N$)
    • Linear compute scaling (useful FLOP/s $\propto N$)

The datacenter is the unit of compute: training a frontier LM splits memory and FLOPs across thousands of GPUs.

Lecture Roadmap

  1. Interconnects and Collectives
    • Scale-up NVLink domains (Blackwell NVL72) vs. scale-out RDMA fabrics
    • Collective primitives and the All-Reduce = Reduce-Scatter + All-Gather identity
  2. Parallelism Primitives & Low Precision
    • Data parallelism & ZeRO Stages 1–3 (FSDP); BF16, FP8, MXFP8, and NVFP4
    • Pipeline, Tensor, Sequence, Expert, and Context parallelism
  3. Systems Practice at Frontier Scale
    • Overlap, distributed Muon, Megatron Core guidelines, fault tolerance, and worked layouts

We use Megatron Core as our reference implementation and focus on underlying mechanisms rather than CLI flags.

GPU Interconnect Hierarchy: Scale-Up vs. Scale-Out

Rack 0: GB200 / GB300 NVL72 Domain 72 GPUs · 145 kW all-in (GB200) · 13.8–20.7 TB HBM GPU 0 GPU 1 ··· GPU 70 GPU 71 NVSwitch Fabric (NVLink 5) 900 GB/s uni-di per GPU (1.8 TB/s bi-di) 64.8 TB/s rack total uni-di (72 GPUs) Scale-Out IB / RDMA Fat-tree 50 GB/s uni-di (400 Gb/s / GPU) 18× slower Rack 1: GB200 / GB300 NVL72 Domain Same 72-GPU all-to-all NVLink domain GPU 0 GPU 1 ··· GPU 70 GPU 71 NVSwitch Fabric (NVLink 5) Historical baseline: HGX A100/H100/B200 had only 8 GPUs per NVLink domain (1 node)

Network Topology Matches Communication Traffic

Direct Mesh / Torus Low radix, cheap links Many hops for irregular routing Switched All-to-All NVSwitch / Leaf-Spine 1 hop up, 1 hop down Uniform latency for any pair
  • No network fits every traffic pattern
  • Direct mesh / torus: low cost per link; strong for structured neighbor traffic (rings, dense TP)
  • Switched all-to-all: critical for unstructured MoE expert routing, where tokens jump to arbitrary GPUs
  • Blackwell clusters pair an NVSwitch scale-up rack with a switched fat-tree RDMA scale-out fabric

Topology governs placement: irregular all-to-all traffic belongs inside the NVSwitch fabric.

Collective Communication Primitives

Broadcast A AAAA One root sends its tensor to all ranks Reduce ABCD Σ Sum across ranks onto a single root All-Reduce ABCD ΣΣΣΣ Every rank gets the full elementwise sum (DDP, TP) All-Gather Concatenate shards onto every rank (ZeRO/FSDP, SP) Reduce-Scatter Σ₀Σ₁Σ₂Σ₃ Sum across ranks and keep one shard per rank All-to-All 0→00→10→20→3 Transpose data across ranks (MoE EP, Ulysses CP)

Every distributed training strategy decomposes into these collectives plus point-to-point sends.

Key Identity: All-Reduce = Reduce-Scatter + All-Gather

All-Reduce ABCD ΣΣΣΣ = Reduce-Scatter Σ₀Σ₁Σ₂Σ₃ + All-Gather Each half: ((N−1)/N) Ψ ≈ Ψ Total volume: 2((N−1)/N) Ψ ≈ 2Ψ

Naïve Data Parallelism (DDP)

Split batch $B$ across $M$ GPUs; each holds a full copy of weights and computes gradients on $B/M$ examples:

$$\theta_{t+1} = \theta_t - \eta \sum_{i=1}^{B} \nabla f(x_i)$$

  • Compute: scales linearly while $B/M$ saturates each GPU
  • Communication: 1 gradient All-Reduce ($2\Psi$ bytes/step)
  • Memory: zero scaling — full model on every GPU
  • Batch wall: $M \le B$, and gains stall past noise scale $\mathcal{B}$
Diminishing Returns to Batch Size Training Speed (log) Batch Size / Noise Scale (B / ℬ) 10⁰ 10⁻² 10² Perfect scaling Ineffective scaling

DDP hits two walls: static memory does not shrink with $M$, and global batch size cannot grow indefinitely.

Why Naïve DP Runs Out of Memory: 12–16 B/Param

Mixed-precision AdamW stores 5 copies of parameter-sized tensors per GPU:

Standard FP32 Optimizer State (16 B/param, K = 12): Params 2B Grads 2B FP32 Master Weights (4B) Adam m (4B) Adam v (4B) BF16 Moments / Kahan Baseline (12 B/param, K = 8): Params 2B Grads 2B FP32 Master (4B) m (2B) v (2B) Opt state = 67–75%

ZeRO: Sharding Redundant State Across DP Ranks

Partition optimizer states, gradients, and parameters across $N_d$ ranks using Reduce-Scatter + All-Gather.

Stage Per-GPU State Across $N_d$ Ranks (GPU 0 ··· GPU $i$ ··· GPU $N_d{-}1$) Memory / GPU
DDP
Baseline
··· ··· $(2 + 2 + K)\Psi$
ZeRO-1
$P_{os}$
··· ··· $2\Psi + 2\Psi + \dfrac{K\Psi}{N_d}$
ZeRO-2
$P_{os+g}$
··· ··· $2\Psi + \dfrac{(2+K)\Psi}{N_d}$
ZeRO-3
FSDP
··· ··· $\dfrac{(2+2+K)\Psi}{N_d}$

Parameters (2B)    Gradients (2B)    Optimizer State ($K$ B)

Megatron Core's distributed optimizer implements ZeRO-1/2 semantics; PyTorch FSDP implements ZeRO-3.

ZeRO Stage 1 and Stage 2: Free Memory Wins

  1. Backward: every GPU computes gradients on its micro-batch
  2. Reduce-Scatter gradients ($\Psi$ bytes): each rank receives only its owned gradient slice
    • Stage 2: reduce-scatter layer by layer during backward and immediately free unowned gradients
  3. Local optimizer step: each rank updates only its $1/N_d$ slice of master weights and moments
  4. All-Gather parameters ($\Psi$ bytes): collect updated weights onto every rank
MethodCollectives per StepComm VolumeMemory per GPU
Naïve DDP1 All-Reduce (grads)$2\Psi$$(4 + K)\Psi$
ZeRO-11 Reduce-Scatter + 1 All-Gather$2\Psi$ (free!)$(4 + K/N_d)\Psi$
ZeRO-2Per-layer Reduce-Scatter + All-Gather$2\Psi$ (almost free)$(2 + (2+K)/N_d)\Psi$

Because Reduce-Scatter + All-Gather matches All-Reduce bandwidth, ZeRO-1 should almost always replace plain DDP.

ZeRO Stage 3 (FSDP): Shard Parameters Too

Forward (per FSDP block) All-Gatherweights LocalForward Free FullWeights NextBlock Comm cost: Ψ (All-Gather) Backward + Update (per FSDP block) All-Gatherweights LocalBackward Reduce-Scatter FreeFull W LocalStep Comm cost: Ψ (All-Gather) + Ψ (Reduce-Scatter)

Hiding FSDP Communication via Prefetching

For $(W_1 W_0 + W_2 W_0)x = y$, separate compute and communication streams overlap parameter prefetches with GEMMs.

GPU ComputeStream GPU CommStream Time → Forward Pass Backward Pass AG W₀ AG W₁ AG W₂ AG W₂ RS g₂ AG W₁ RS g₁ RS g₀ FWD 0 FWD 1 FWD 2 BWD 2 BWD 1 BWD 0 Forward Backward All-Gather (AG) Reduce-Scatter (RS) Free Weight

ZeRO in Practice: Will It Fit on 8× B300?

Assume 12 B/param (2 B params + 2 B grads + 8 B opt state) on 8× NVIDIA B300 (288 GB HBM each), ignoring activations:

StrategyFormula (B/param)B/param ($N_d=8$)Max Model on 8× B300Historical 8× A100 (80 GB)
Baseline DDP$12$$12.00$24 B ($288/12$)6.7 B
ZeRO Stage 1$2 + 2 + 8/8$$5.00$57.6 B ($288/5$)16 B
ZeRO Stage 2$2 + 10/8$$3.25$88.6 B ($288/3.25$)24.6 B
ZeRO Stage 3$12/8$$1.50$192 B ($288/1.5$)53.3 B

Before adding model parallelism, low-precision formats offer a direct lever on both memory and communication.

Low-Precision Training as a Parallelism Lever

Lower precision accelerates Tensor Core GEMMs and halves memory and collective communication bytes:

FormatEra / HardwareKey Mechanism
BF16Standard (recap Lec. 5)Matches FP32 exponent range, eliminating FP16 loss scaling (2 B/param)
FP8 (block-scaled)Hopper (DeepSeek-V3, 2024)Fine-grained tile/block scaling stabilizes forward & backward GEMMs
MXFP8Blackwell native (2025–26)Hardware microscaling FP8 with shared block exponents
NVFP4Blackwell native (2025–26)4-bit GEMMs + block scales, random Hadamard & stochastic rounding

Blackwell NVFP4 Pretraining Recipe

Precision & Scaling Layout (NVIDIA, Sept 2025) BF16 / Original Precision: First 2 & Last 8 Blocks (~16%) Plus attention GEMMs, embeddings, LM head & norms NVFP4 Linear GEMMs (~84% of layers) Weights: 16×16 2D Same quant in fwd & bwd Acts & Grads: 1×16 Fine-grained 1D blocks Random Hadamard: weight-grad GEMM inputs only Stochastic rounding: gradients only FP32: Master Weights, Gradients & Optimizer State
  • $16\times 16$ 2D weight blocks ensure forward and backward GEMMs see identical quantized weights
  • Targeted noise control: Hadamard smooths outliers on weight-grad GEMMs; stochastic rounding keeps gradients unbiased
  • 12B / 10T token test: 62.58 MMLU-Pro vs. 62.62 for FP8
  • Pretrained Nemotron 3 Super & Ultra; Kimi K3 (July 2026) trains MoE experts with MXFP4 QAT

Beyond Data Parallelism: Model Parallelism

Model parallelism shards parameters across GPUs (like ZeRO-3), but communicates activations instead of weights — scaling memory without growing global batch size.
1. Pipeline (Depth) L0–3 L4–7 L8–11 L12–15 Point-to-point between stages Fits slower inter-rack RDMA links 2. Tensor + Seq (Width) W (col 0) W (col 1) All-Reduce / AG+RS per layer Needs high-BW NVLink domain 3. Expert (MoE) Exp 0..k Exp k..2k Exp ... All-to-All token dispatch/combine Rack-wide EP standard on NVL72

Plus Context Parallelism (CP), which shards the sequence dimension across GPUs for long contexts (up to 1M tokens).

Pipeline Parallelism: Micro-Batches and the Bubble

Naïve Layer-Wise (Active 1/p) GPU 0 F B GPU 1 F B GPU 2 F B GPU 3 F B 3/4 of GPU cycles idle GPipe: Split Batch into m = 4 Micro-Batches F0 F1 F2 F3 B3 B2 B1 B0 F0 F1 F2 F3 B3 B2 B1 B0 F0 F1 F2 F3 B3 B2 B1 B0 F0 F1 F2 F3 B3 B2 B1 B0 Step Bubble At batch size 8, throughput drops sharply with PP; at batch size 128, throughput stays nearly flat

Next: better schedules shrink both in-flight activation memory and the bubble itself.

Cutting Memory and Bubbles: 1F1B & Virtual Stages

1F1B Schedule (1 stage/GPU): activation memory drops from O(m) to O(p) GPU 0 F0 F1 F2 F3 B0 F4 B1 F5 B2 B3 B4 B5 GPU 3 F0 B0 F1 B1 F2 B2 F3 B3 F4 B4 F5 B5 1F1B frees activations as soon as each micro-batch finishes backward Interleaved 1F1B (v virtual stages/GPU): bubble drops v×, P2P traffic rises v× GPU 0: Stages 0 & 4 GPU 1: Stages 1 & 5 GPU 2: Stages 2 & 6 GPU 3: Stages 3 & 7 Activations loop around the pipeline v times → smaller chunks, faster warmup/cooldown

Zero-Bubble Pipelining and DualPipeV

Split Backward into B (input) and W (weight) F y = σ(Wx) B (urgent) ∇x = Wᵀ ∇z W (flexible) ∇W = ∇z · xᵀ ZB Schedule: pack W blocks into idle gaps F0 F1 F2 F3 B0 W0 B1 W1 B2 W2 B3 W3 F0 B0 F1 B1 F2 B2 F3 B3 W0 W1 B unblocks the upstream stage immediately; W fills cooldown bubbles before the optimizer step
  • Zero-bubble (ZB-H1 / ZB-H2): decoupling $\nabla_x L$ ($B$) from $\nabla_W L$ ($W$) lets $W$ fill idle bubbles without delaying upstream stages
  • DualPipe & DualPipeV: bidirectional schedules overlap forward and backward; DualPipeV cuts DualPipe in half to need half the devices
  • Library support: PyTorch's pipelining library ships GPipe, 1F1B, Interleaved 1F1B, ZeroBubble variants, and DualPipeV

Tensor Parallelism: Splitting Matrix Multiplies

(a) MLP: Column A = [A₁, A₂] → Row B = [B₁; B₂] X f X A₁ Act Y₁ B₁ X A₂ Act Y₂ B₂ g Z Elementwise GeLU / SwiGLU runs locally with no sync (b) Self-Attention: Split Heads Across GPUs f Q₁, K₁, V₁ Attn₁ O₁ W_O1 Q₂, K₂, V₂ Attn₂ O₂ W_O2 g Z Each GPU runs full attention on its subset of heads

Tensor Parallelism Tradeoffs & Domain Limits

  • Pros vs. PP: zero bubble, works at small batch sizes, simple layer wrapping
  • Cons vs. PP: heavy per-layer All-Reduce:
    • PP: $bsh$ P2P per micro-batch
    • TP: $8bsh \frac{t-1}{t}$ All-Reduce per layer
  • Historical A100 result (Narayanan 2021): TP capped at 8 GPUs because HGX nodes had 8 NVLink GPUs — crossing to TP=16/32 hit inter-node links
  • 2026 rule: TP is bounded by the NVLink domain (and GEMM width), not by the number 8
Historical 8-GPU Node Cliff (3B Model) Tokens / sec / GPU 2 4 −10.8% 8 −12.2% Crosses 8-GPU NVLink boundary 16 −42.7% 32 −65.6% Tensor Parallel Size (TP)

The Other Half of Memory: Dynamic Activations

Static weights shrink with TP/PP/ZeRO-3, but stored activations for backward can exceed static memory.

$\text{Activations per Transformer layer (bytes)} = sbh\left(34 + 5\dfrac{as}{h}\right)$

With Tensor Parallelism ($t$):   $sbh\left(\mathbf{10} + \dfrac{24}{t} + 5\dfrac{as}{ht}\right)$

Without sharding that $10sbh$ term, activation memory stops shrinking as $t$ grows.

Sequence Parallelism & Selective Recomputation

Seq Parallel Norm g Tensor Parallel Attn Proj ḡ Seq Parallel Drop + Norm g Tensor Parallel MLP (Col→Row) ḡ Drop+ Forward: g = All-Gather, ḡ = Reduce-Scatter (reversed in backward) → exact same comm volume as TP All-Reduce
ConfigurationActivations / LayerScaling
No parallelism$sbh(34 + 5as/h)$None
TP only$sbh(10 + 24/t + 5as/(ht))$Hits $10sbh$ floor
TP + Sequence Parallel (SP)$sbh(34/t + 5as/(ht))$Shards norms & dropout
TP + SP + Selective Recomputation$\mathbf{sbh(34/t)}$True linear scaling ($1/t$)

Selective recomputation often pays for itself: freed HBM unlocks larger micro-batches and higher net throughput.

Expert Parallelism (EP): Route Tokens, Keep GEMMs Intact

Rank 0 (Experts 0..k−1) Rank E−1 (Last k) Router (FP32) Router (FP32) All-to-All Dispatch (send tokens to owning rank) Local Expert FFNs Local Expert FFNs All-to-All Combine (return outputs to origin rank) Repeated in backward: 4 All-to-Alls per MoE layer
  • Critical collective: each MoE layer runs All-to-All dispatch + combine in forward and again in backward
  • Why EP beats TP for experts:
    • Larger local GEMMs → better Tensor Core utilization
    • Lower communication than slicing every expert with TP
    • Cleaner overlap graph for hiding communication
    • At $\text{EP} = \text{num\_experts}$, local token permutation disappears
  • Historical check: Mixtral 8×7B EP8×TP1 beats EP4×TP2

Decoupling Attention & Experts: MoE Parallel Folding

MoE applies to MLPs, not attention — forcing both onto one grid creates a mismatch (attention wants TP/CP; experts want wide EP).

Outdated Coupled Layout DP replicas shared with EP splits Hard limit: EP ≤ DP Long context (high CP) shrinks DP, blocking wide EP for 256–896 experts → Megatron Core: MoE Parallel Folding Attention: TP × CP × DP × PP Experts: ETP × EP × EDP × PP Same GPUs, separate grids: removes EP ≤ DP

Token Dispatchers: All-Gather, All-to-All & Fused Kernels

DispatcherMechanismBest Regime / Tradeoff
All-GatherGather all tokens to all EP ranks, compute local experts, Reduce-ScatterSimple, avoids variable-length sends; wastes bandwidth at high EP
Standard All-to-AllNCCL exchange of routed tokens onlyBandwidth-efficient, but CPU launch & two-tier NVLink/RDMA overhead
DeepEP / HybridEPFused GPU-initiated kernels: NVLink inside domain, RDMA across domainsStandard for wide EP; minimizes cross-domain traffic via hierarchical combine

Hiding All-to-All, Static Shapes & Router Stability

Context Parallelism (CP): Ring Attention vs. Ulysses

Ring Attention (Pass KV Chunks) GPU 0Q₀ · (Kⱼ, Vⱼ) GPU 1Q₁ · (Kⱼ, Vⱼ) GPU 2Q₂ · (Kⱼ, Vⱼ) KV blocks circulate around the ring Overlaps KV send with local FlashAttention compute No head-count ceiling; works with GQA / MLA Ulysses (All-to-All Over Heads) Seq-sharded (s / CP, H) All-to-All transpose Head-sharded (s, H / CP) Local full-sequence attention per head → All-to-All back Low volume per step; pairs cleanly with sparse attention Bounded by head count (CP ≤ H_KV without KV copies)

Hierarchical CP & Hybrid Attention Architectures

Hybrid models shrink long-context communication drastically, focusing KV-ring traffic on the periodic full/sparse layers.

General Principle: Communication–Computation Overlap

FSDP prefetching is one instance of a universal systems rule: never leave Tensor Cores idle waiting on the network.

ParallelismCommunicationCompute That Overlaps It
DDPGradient bucket All-ReduceEarlier layers' backward pass (bucket fires as soon as ready)
FSDP / Dist. OptParam All-Gather & grad Reduce-ScatterNext layer's forward & previous layer's backward
Tensor ParallelActivation All-Gather / Reduce-ScatterChunked producer/consumer GEMMs along sequence/batch tiles
Pipeline ParallelStage-boundary P2P send/recvCurrent micro-batch forward/backward on adjacent stages
Expert ParallelAll-to-All Dispatch & CombineOther micro-batch (1F1B / DualPipe) + shared-expert FFN
Context ParallelRing KV send/recvLocal FlashAttention block on previously arrived KV chunk

When overlap succeeds, effective step time is $\max(T_{\text{compute}},\, T_{\text{comm}})$ instead of $T_{\text{compute}} + T_{\text{comm}}$.

Optimizers Meet Parallelism: Distributed Muon

Summary: Comparing Parallelism Dimensions

MethodComm / SyncParam Mem / RankAct / KV Mem / RankMain Bandwidth CostScales Batch?Complexity
DDP / ZeRO-1Grad RS + Param AG (or AR)No param split (ZeRO-1 shards opt)None$2\Psi$ / stepYes ($\propto$ DP)Low
FSDP / ZeRO-3Per-layer AG + RS (overlapped)$\sim 1/\text{DP}$ (all static state)None$3\Psi$ / stepYes ($\propto$ DP)Moderate
Pipeline (PP)Stage P2P; bubbles$\sim 1/\text{PP}$Schedule-dependent ($O(p)$ in 1F1B)$bsh$ P2P between stagesNeeds large $m$High
Tensor + SPPer-layer AG + RS (blocking if unoverlapped)$\sim 1/\text{TP}$$\sim 1/\text{TP}$ (with SP + recompute)$8bsh\frac{t-1}{t}$ / layerNoHigh
Context (CP)Ring KV or head A2ANone$\sim 1/\text{CP}$ (seq acts & KV)KV or head activations / layerNoHigh
Expert (EP)4× A2A / MoE layer (dispatch + combine)$\sim 1/\text{EP}$ (experts only)None (attn); scales expert MLPToken-routing All-to-AllNeeds tokens/expHigh

No single dimension solves static memory, sequence length, and throughput together — frontier runs compose 4 to 5 dimensions.

Composing 5D Parallelism: Megatron Core Guidelines

Key regime variable: batch size per GPU ($B/N$) — pure FSDP becomes comm-bound at small $B/N$, where adding model parallelism keeps compute above communication.

  1. Minimize model parallelism, maximize DP: shard optimizer state first, adding TP/PP/EP only as needed to fit memory and hit target batch size
  2. Keep bandwidth-heavy axes inside the NVLink domain: place TP, EP, and Ulysses CP inside the 72-GPU NVL72 rack (900 GB/s uni-di)
  3. Use PP (+ virtual stages) across domains: low-volume P2P fits inter-rack RDMA links
  4. Prefer EP over TP for MoE layers: decouple attention and experts via MoE Parallel Folding
  5. Enable CP for long contexts ($\ge 8\text{K}$ to 1M tokens); order groups fastest-to-slowest link: [TP, CP, PP, DP]

When global batch size is small relative to cluster size, gradient accumulation increases micro-batches to amortize communication.

Real-World Training Layouts: Historical to 2026

Model (Era)HardwareTPPPCPEPDP / Notes
Llama 3 405B (2024, dense)16,384 H1008161→16–DP 128→8; 8K→131K ctx; 38–43% BF16 MFU
DeepSeek-V3 (Dec 2024, 671B)H800 (8-GPU nodes)116164ZeRO-1; EP across 8 nodes + 1F1B A2A overlap
Qwen3 235B-A22B (May 2025)512 GPUs28132Qwen3 30B-A3B: TP1/PP1/EP8 (single 8-GPU node)
Nemotron 3 Super (early 2026, LC)GB200 NVL722–6464120B-A12B long-context stage; folded CP64 & EP64
Wide-EP Blackwell shape (2026)GB200/GB300 NVL7214var64EP64 inside 1 NVL72 rack via HybridEP; PP across racks

Keeping Long Runs Alive: Failures & Fault Tolerance

Llama 3 405B: 54-Day Failure Causes (Historical 16K-GPU baseline: ~78% hardware) Faulty GPU30.1% HBM3 Memory17.2% Software Bug12.9% Switch / Cable8.4% Host Maint.7.6% SRAM / SysProc8.6% Silent Data Corr.1.4% (6×) Rare SDCs silently corrupt weights without crashing
  • Async reshardable checkpoints
    • Snapshot to host RAM & flush in background; restore into a different TP/PP/DP layout
  • Hangs, stragglers & in-process restart
    • Detect slow/hung ranks and swap faulty nodes without relaunching the job
  • Replica-level fault tolerance
    • torchft / FT-HSDP isolate failures to one DP replica; FT-HSDP lifts effective training time from 44% to 80% at $O(100\text{K})$ GPUs
  • Silent Data Corruption (SDC)
    • Re-run a suspect step to separate bad hardware from bad data; AEGIS (OSDI '26) found 18 SDCs / 13 faulty GPUs over 35M GPU-hours at 0.86% overhead

Worked Layout 1: Dense 70B Model on 64 GPUs

Target: 70B dense Transformer at 12 B/param (2 B params + 2 B grads + 8 B opt state) on 64 Blackwell GPUs (GB200 192 GB or B300 288 GB).

StageLayout ($\text{TP}\times\text{PP}\times\text{CP}\times\text{DP}$)Params / GPUStatic Memory / GPUJustification
Short context TP=4, PP=1, CP=1, DP=16 (+ SP, dist. opt) $70\text{B}/4 = 17.5\text{B}$ $17.5\text{B} \times (2 + 2 + 8/16) = \mathbf{78.75\text{ GB}}$ TP=4 stays in NVLink & cuts acts 4×; PP=1 avoids bubbles; DP=16 maximizes throughput
Long context TP=4, PP=1, CP=4, DP=4 (+ SP, dist. opt) $70\text{B}/4 = 17.5\text{B}$ $17.5\text{B} \times (2 + 2 + 8/16) = \mathbf{78.75\text{ GB}}$ Trades DP for CP=4 to cut sequence activations & KV 4× without adding PP

Worked Layout 2: Frontier MoE on GB300 NVL72

Target: 552B sparse MoE (DeepSeek-V4.1-Flash scale: 384 routed experts, 6 active, 1 shared, 1M context) on 64 GPUs inside a GB300 NVL72 rack (900 GB/s uni-di NVLink 5, 288 GB/GPU).

Same 64 GPUs Inside One NVL72 NVSwitch Domain (MoE Parallel Folding) Attention Grid: TP=2 × CP=4 × DP=8 TP=2 (+SP) and CP=4 shard long-context activations DP=8 keeps global batch throughput high Dist. optimizer shards attention opt state across DP×CP = 32 Expert Grid: ETP=1 × EP=64 × EDP=1 384 / 64 = 6 routed experts per GPU (intact GEMMs) EP=64 > DP=8 — enabled by Parallel Folding 100% of All-to-All stays on 900 GB/s NVLink 5 (HybridEP/DeepEP)

Recap: Parallelism Basics

  1. Match parallelism to the interconnect: keep bandwidth-heavy TP, EP, and Ulysses CP inside the NVLink domain (72 GPUs, 900 GB/s uni-di on GB200/GB300 NVL72); push PP and DP across racks
  2. Exploit the collective identity: All-Reduce = Reduce-Scatter + All-Gather gives ZeRO-1/2 and Sequence Parallelism memory scaling at zero extra bandwidth
  3. Stack precision & activation levers: MXFP8 / NVFP4 halve memory and comm bytes; SP + selective recomputation + CP keep activation memory linear
  4. Fold MoE grids & overlap everything: MoE Parallel Folding decouples attention (TP×CP×DP) from experts (ETP×EP×EDP); 1F1B overlap and layer-wise optimizers (Muon) keep GPUs busy
  5. Design for failure at scale: async reshardable checkpoints, replica-level recovery (torchft / FT-HSDP), and SDC detection (AEGIS) keep thousand-GPU runs alive