Working the roofline for DeepSeek-V3 on Blackwell

DRAFT (unlisted study). Sheets first, prose to follow; generated from ~/Dev/scaling-dsv3-refs/blackwell-roofline/roofline-gen.mjs — edit the generator, not this file.

Part 3 worked the roofline for DeepSeek’s own run: 2,048 H800s, DualPipeV, EP64 across InfiniBand. This page runs the same method on the configuration NVIDIA publishes for GB300 NVL72: 256 GPUs, Megatron’s interleaved 1F1B at PP 2 with eight virtual stages, EP 32 inside one NVLink domain, MXFP8 on every GEMM including attention and the LM head, ZeRO-1, no recompute. Count the FLOPs, count the bytes each parallelism moves per link, divide by the link’s rate, check that compute covers the communication, and compare against what NVIDIA measures. The sheets are live as in part 3: the formula column is the program and blue values are knobs.

Speed of light on a GB300

Spec-sheet dense peaks are 2.5 PFLOP/s BF16 and 5 PFLOP/s FP8 per GPU. A sustained GEMM rate is not one number on Blackwell Ultra: the part is power limited, and how far under the architectural peak a perfectly efficient kernel settles depends on how much its operands make the datapath switch. Public B300 microbenchmarks reach about 94 % of the BF16 peak on low-switching operands and report the SM clock dropping under a sustained GEMM; random training data costs more power. The sheet carries 1.8 PFLOP/s BF16 and twice that for MXFP8 as the sustained rates, the same figures as the Kimi K3 roofline; both are knobs. The scale-out network is one ConnectX-8 (800 Gb/s) per GPU, twice Hopper’s; NVLink 5 is 900 GB/s per direction per GPU, and an NVL72 rack is one NVLink domain, of which NVIDIA’s DeepSeek-V3 recipes use 64 GPUs.

cellquantityvalue (exact)scientific SIformula
πbf16GB300 BF16 dense peak, spec (FLOP/s)2,500,000,000,000,0002.50 × 10152.50 PFLOP/s(hardware spec, dense)
πsolbf16BF16 GEMM, sustained on random data (FLOP/s)1,800,000,000,000,0001.80 × 10151.80 PFLOP/s(model input: a power-limited estimate from public B300 microbenchmarks — see the text)
ηbf16share of the spec peak0.727.20 × 10−172 %πsolbf16 / πbf16
πfp8GB300 FP8 dense peak, spec (FLOP/s)5,000,000,000,000,0005.00 × 10155 PFLOP/s(hardware spec, dense)
πsolfp8MXFP8 GEMM, sustained on random data (FLOP/s)3,600,000,000,000,0003.60 × 10153.60 PFLOP/s(model input: 2× the BF16 figure, the spec ratio)
ηfp8share of the spec peak0.727.20 × 10−172 %πsolfp8 / πfp8
βNVNVLink per GPU, per direction (B/s)900,000,000,0009.00 × 1011900 GB/s(hardware spec: NVLink 5, 1.8 TB/s bidirectional)
βIBscale-out per GPU (B/s)100,000,000,0001.00 × 1011100 GB/s(hardware spec: ConnectX-8, 800 Gb/s)
NVLGPUs per NVLink domain64(model input: 64 of an NVL72 rack’s 72, as NVIDIA’s DeepSeek-V3 recipes lay it out)

The model

The same model as part 3, with one change in the BF16 tally: NVIDIA’s GB300 recipe also runs the LM head in MXFP8, which leaves only the 58 routers in BF16.

cellquantityvalue (exact)scientific SIformula
dhidden dim7,168(architecture)
LmoeMoE layers58(architecture)
Ldnsdense layers3(architecture)
Llayers61Lmoe + Ldns
nhattention heads128(architecture)
dhhead dim · qk nope, v128(architecture)
dRhhead dim · qk rope64(architecture)
krouted experts per token8(architecture)
Nactivated params36,625,618,4323.66 × 101036.6 G(part 3’s checkpoint tally; the MTP module is out, as there)
Nnenon-expert params17,117,648,3841.71 × 101017.1 G(checkpoint tally: attention, shared experts, dense FFNs, norms, routers, embedding, head)
Nexprouted-expert params653,908,770,8166.54 × 1011654 G(checkpoint tally: 58 MoE layers × 256 experts × 3 × 7,168 × 2,048)
Nrrouter params, per layer1,835,0081.84 × 1061.84 M(7,168 × 256)
Nbf16params in BF16 GEMMs106,430,4641.06 × 108106 MLmoe · Nr (the routers only: NVIDIA’s GB300 recipe runs the LM head in MXFP8 too)

The batch and the cluster

NVIDIA’s benchmark trains 4,096 sequences of 4,096 tokens per step on 256 GPUs, a quarter of DeepSeek’s batch on an eighth of its GPUs: 65.5 K tokens per GPU per step, twice part 3’s.

cellquantityvalue (exact)scientific SIformula
Bsequences per step4,096(model input: NVIDIA’s Megatron-Bridge GB300 benchmark)
Stokens per sequence4,096(model input)
Dtokens per step16,777,2161.68 × 10716.8 MB · S
GPUsGPUs in the cluster256(model input: four 64-GPU domains)
DGPUtokens per GPU per step65,5366.55 × 10465.5 KD / GPUs

How many FLOPs do we need to do?

6ND for the GEMMs, split by dtype, plus the attention core, which 6ND does not count. NVIDIA’s recipe runs attention in MXFP8 (a8 = 1); set it to 0 for a BF16 attention core. Nothing is recomputed, so there is no replay term.

cellquantityvalue (exact)scientific SIformula
CFLOPs per step, 6ND3,686,855,469,403,471,8723.69 × 10183.69 EFLOP6 · N · D
Cbf16BF16 GEMM FLOPs inside 6ND10,713,641,301,049,3441.07 × 101610.7 PFLOP6 · Nbf16 · D
Cfp8MXFP8 GEMM FLOPs inside 6ND3,676,141,828,102,422,5283.68 × 10183.68 EFLOPC − Cbf16
cqkQKᵀ-shaped FLOPs · one layer, one sequence412,316,860,4164.12 × 1011412 GFLOP2 · nh · (dh + dRh) · S · S / 2 (causal keeps half the pairs)
cpvPV-shaped FLOPs · one layer, one sequence274,877,906,9442.75 × 1011275 GFLOP2 · nh · dh · S · S / 2
Cattnattention FLOPs per step618,119,048,856,600,5766.18 × 1017618 PFLOPL · B · (4 · cqk + 3 · cpv) (QKᵀ-shaped ×4 (fwd, bwd replay, dQ, dK), PV-shaped ×3 (fwd, dV, dP))
a8attention core in MXFP81(model input: 1 = MXFP8 attention (fp8_dot_product_attention, NVIDIA’s GB300 recipe), 0 = BF16)
Tfp8MXFP8 GEMM time (s)3.99 × 1003.99 sCfp8 / (GPUs · πsolfp8)
Tbf16BF16 GEMM time, routers (s)2.33 × 10−223.3 msCbf16 / (GPUs · πsolbf16)
Tattnattention core time (s)6.71 × 10−1671 msCattn / (GPUs · (a8 · πsolfp8 + (1 − a8) · πsolbf16))
Tccompute time per step (s)4.68 × 1004.68 sTfp8 + Tbf16 + Tattn (no recompute: NVIDIA’s GB300 MXFP8 recipe recomputes nothing)
φmodel FLOPs per token256,596,476,9282.57 × 1011257 GFLOP(C + Cattn) / D

The layout

cellquantityvalue (exact)scientific SIformula
PPpipeline ranks2(model input: NVIDIA’s GB300 benchmark)
VPvirtual stages per rank8(model input: layout Et*4|(t*4|)*14tmL, sixteen chunks)
EPexpert parallelism32(model input)
DPreplicas of a non-expert slice128GPUs / PP
EDPreplicas of an expert slice4GPUs / (PP · EP)
domainsNVLink domains4GPUs / NVL

Expert parallelism over NVLink

On Hopper the expert all-to-all crossed InfiniBand and was the largest communication term. On GB300 EP 32 lives inside one NVLink domain, so dispatch and combine ride NVLink at nine times the scale-out bandwidth. Each token goes once to each distinct GPU holding one of its eight experts; the forward sends MXFP8 out and BF16 back, the backward sends BF16 both ways.

cellquantityvalue (exact)scientific SIformula
qchance one expert pick misses a given GPU0.968759.69 × 10−11 − 1 / EP
q8chance all k picks miss it7.76 × 10−1q · q · q · q · q · q · q · q (k = 8; picks treated as independent, group limit ignored)
MNVother GPUs a token is sent to6.95 × 100(EP − 1) · (1 − q8) (deduped: one copy per destination GPU, however many of its experts the token picked)
Vdispdispatch bytes/token·layer5.14 × 10451.4 KBMNV · d · (1 + 1 / 32) (MXFP8 + one E8M0 scale per 32)
Vcombcombine bytes/token·layer9.97 × 10499.7 KBMNV · d · 2 (BF16)
VtokEP NVLink bytes per token2.03 × 10720.3 MB(Vdisp + 3 · Vcomb) · Lmoe (forward: an MXFP8 dispatch and a BF16 combine; backward: both directions again, in BF16)
VEPEP NVLink bytes per GPU·step1.33 × 10121.33 TBVtok · DGPU
TEPEP time per step (s)1.48 × 1001.48 sVEP / βNV
fEPEP time, share of compute3.16 × 10−131.6 %TEP / Tc (under 100 %: the 1F1B all-to-all overlap can hide it behind another microbatch’s compute)

ZeRO-1

Megatron’s distributed optimizer shards the optimizer state over the data-parallel replicas: 128 for the non-expert slice of a stage, 4 for an expert slice. Gradients reduce-scatter in BF16 and the updated weights all-gather in BF16 once per step. The non-expert traffic splits across a domain’s 64 NICs, as in part 3’s two-bandwidth argument; the expert traffic is charged to a single GPU’s NIC.

cellquantityvalue (exact)scientific SIformula
Λnenon-expert params a domain receives4,279,412,0964.28 × 1094.28 Gmax(0, Nne / PP · (1 − NVL · PP / GPUs)) (the domain’s one copy of a stage, minus the shards its own GPUs own; zero when a stage’s replicas fit in one domain)
βdomscale-out into a domain (B/s)6,400,000,000,0006.40 × 10126.40 TB/sNVL · βIB
Λexpexpert params a GPU receives7,662,993,4087.66 × 1097.66 GNexp / (PP · EP) · (1 − 1 / EDP) (its slice minus its own shard, all charged to scale-out (some replicas share a domain: an overestimate))
Tagparameter all-gather, BF16 (s)1.55 × 10−1155 ms2 · Λne / βdom + 2 · Λexp / βIB (MXFP8 parameters are gathered in BF16 and quantized locally)
Trsgradient reduce-scatter, BF16 (s)1.55 × 10−1155 ms2 · Λne / βdom + 2 · Λexp / βIB (grad_reduce_in_fp32 off)
TsyncZeRO-1 time per step (s)3.09 × 10−1309 msTag + Trs

Pipeline parallelism

Interleaved 1F1B with V virtual stages divides the bubble by V: (PP − 1)/(V · m). At PP 2, V 8 and 32 microbatches per replica that is 0.391 %. The price is traffic: each token crosses every chunk boundary, 2V times per rank per pass instead of 2.

cellquantityvalue (exact)scientific SIformula
DPPtokens per replica·step131,0721.31 × 105131 KD · PP / GPUs
Vresresidual bytes per token14,3361.43 × 10414.3 KBd · 2 (BF16)
VPPPP bytes per GPU·step30,064,771,0723.01 × 101030.1 GB2 · VP · Vres · DPP (each token enters each of this rank’s chunks once forward, once backward; charged to scale-out (Megatron puts PP outermost, so stages sit in different domains))
TPPPP time per step (s)3.01 × 10−1301 msVPP / βIB
mmicrobatches per replica·step32DPP / S (one sequence each)
bILVinterleaved 1F1B bubble, share of compute0.003906253.91 × 10−30.391 %(PP − 1) / (VP · m)
Tbubbubble time per step (s)1.83 × 10−218.3 msTc · bILV

Putting it together

Compute dominates: EP traffic over NVLink is 31.6 % of the compute time and scale-out traffic 13.0 %, both hideable, and the bubble is a rounding error. Speed of light is 13.9 K tokens/s per GPU against the 6.29 K NVIDIA reports, a factor of 2.22 — where part 3 found DeepSeek’s run 4.3× under its speed of light.

cellquantityvalue (exact)scientific SIformula
TIBscale-out time per step (s)6.10 × 10−1610 msTsync + TPP
fIBscale-out time, share of compute1.30 × 10−113.0 %TIB / Tc (under 100 % with fEP: compute bound, comms overlapped)
Tstepstep time at speed of light (s)4.70 × 1004.70 sTc + Tbub (compute plus the bubble)
ρsoltokens/s per GPU at speed of light1.39 × 10413.9 KDGPU / Tstep
ρNVtokens/s per GPU, as reported6,2886.29 × 1036.29 K(Megatron-Bridge performance summary, 26.08.01 container: DGX-GB300, 256 GPUs, MXFP8, GBS 4,096, PP 2 · VP 8 · EP 32, forced-balanced routing)
fsolspeed of light over reality2.22 × 1002.22 ρsol / ρNV
configurationGBSlayoutTstep at SOLEP / computebubbletok/s/GPU at SOLmeasuredSOL / measured

Comparing against NVIDIA’s numbers

NVIDIA reports 1,636 model TFLOP/s per GPU alongside the throughput, which pins their FLOP count per token: 101 % of ours, close enough that the comparison is like for like. At their throughput our count is 1.61 PFLOP/s per GPU, 32.3 % of the FP8 spec peak. The benchmark has moved a long way in six months: 4,612 tokens/s per GPU in the 26.02 container, 6,338 in 26.06, 6,288 in 26.08.01. The MLPerf Training v6.0 submission routes for real, at GBS 15,360 and PP 4 · VP 4, and lands within a percent of the forced-balanced benchmark.

cellquantityvalue (exact)scientific SIformula
φNVNVIDIA’s model FLOPs per token2.60 × 1011260 GFLOP1,636 · 1012 / ρNV (the same row’s 1,636 model TFLOP/s per GPU over its tokens/s)
fφtheirs over ours1.01 × 100101 %φNV / φ
πNVachieved model FLOP rate per GPU (FLOP/s)1,613,478,646,923,2641.61 × 10151.61 PFLOP/sρNV · φ (our FLOP count at their throughput)
ηNVof the FP8 spec peak3.23 × 10−132.3 %πNV / πfp8
BMLMLPerf: sequences per step15,360(MLPerf Training v6.0, NVIDIA result 6.0-0100: 256 GB300s, PP 4 · VP 4 · EP 32, real routing)
TMLMLPerf: median step time (s)39.3553.94 × 10139.4 s(median train_step_time over the 147 steps of the three published result logs (38.8–41.1 s))
ρMLMLPerf: tokens/s per GPU6.24 × 1036.24 KBML · S / (GPUs · TML)