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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| πbf16 | GB300 BF16 dense peak, spec (FLOP/s) | 2,500,000,000,000,000 | 2.50 × 1015 | 2.50 PFLOP/s | (hardware spec, dense) |
| πsolbf16 | BF16 GEMM, sustained on random data (FLOP/s) | 1,800,000,000,000,000 | 1.80 × 1015 | 1.80 PFLOP/s | (model input: a power-limited estimate from public B300 microbenchmarks — see the text) |
| ηbf16 | share of the spec peak | 0.72 | 7.20 × 10−1 | 72 % | πsolbf16 / πbf16 |
| πfp8 | GB300 FP8 dense peak, spec (FLOP/s) | 5,000,000,000,000,000 | 5.00 × 1015 | 5 PFLOP/s | (hardware spec, dense) |
| πsolfp8 | MXFP8 GEMM, sustained on random data (FLOP/s) | 3,600,000,000,000,000 | 3.60 × 1015 | 3.60 PFLOP/s | (model input: 2× the BF16 figure, the spec ratio) |
| ηfp8 | share of the spec peak | 0.72 | 7.20 × 10−1 | 72 % | πsolfp8 / πfp8 |
| βNV | NVLink per GPU, per direction (B/s) | 900,000,000,000 | 9.00 × 1011 | 900 GB/s | (hardware spec: NVLink 5, 1.8 TB/s bidirectional) |
| βIB | scale-out per GPU (B/s) | 100,000,000,000 | 1.00 × 1011 | 100 GB/s | (hardware spec: ConnectX-8, 800 Gb/s) |
| NVL | GPUs per NVLink domain | 64 | (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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| d | hidden dim | 7,168 | (architecture) | ||
| Lmoe | MoE layers | 58 | (architecture) | ||
| Ldns | dense layers | 3 | (architecture) | ||
| L | layers | 61 | Lmoe + Ldns | ||
| nh | attention heads | 128 | (architecture) | ||
| dh | head dim · qk nope, v | 128 | (architecture) | ||
| dRh | head dim · qk rope | 64 | (architecture) | ||
| k | routed experts per token | 8 | (architecture) | ||
| N | activated params | 36,625,618,432 | 3.66 × 1010 | 36.6 G | (part 3’s checkpoint tally; the MTP module is out, as there) |
| Nne | non-expert params | 17,117,648,384 | 1.71 × 1010 | 17.1 G | (checkpoint tally: attention, shared experts, dense FFNs, norms, routers, embedding, head) |
| Nexp | routed-expert params | 653,908,770,816 | 6.54 × 1011 | 654 G | (checkpoint tally: 58 MoE layers × 256 experts × 3 × 7,168 × 2,048) |
| Nr | router params, per layer | 1,835,008 | 1.84 × 106 | 1.84 M | (7,168 × 256) |
| Nbf16 | params in BF16 GEMMs | 106,430,464 | 1.06 × 108 | 106 M | Lmoe · 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| B | sequences per step | 4,096 | (model input: NVIDIA’s Megatron-Bridge GB300 benchmark) | ||
| S | tokens per sequence | 4,096 | (model input) | ||
| D | tokens per step | 16,777,216 | 1.68 × 107 | 16.8 M | B · S |
| GPUs | GPUs in the cluster | 256 | (model input: four 64-GPU domains) | ||
| DGPU | tokens per GPU per step | 65,536 | 6.55 × 104 | 65.5 K | D / 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| C | FLOPs per step, 6ND | 3,686,855,469,403,471,872 | 3.69 × 1018 | 3.69 EFLOP | 6 · N · D |
| Cbf16 | BF16 GEMM FLOPs inside 6ND | 10,713,641,301,049,344 | 1.07 × 1016 | 10.7 PFLOP | 6 · Nbf16 · D |
| Cfp8 | MXFP8 GEMM FLOPs inside 6ND | 3,676,141,828,102,422,528 | 3.68 × 1018 | 3.68 EFLOP | C − Cbf16 |
| cqk | QKᵀ-shaped FLOPs · one layer, one sequence | 412,316,860,416 | 4.12 × 1011 | 412 GFLOP | 2 · nh · (dh + dRh) · S · S / 2 (causal keeps half the pairs) |
| cpv | PV-shaped FLOPs · one layer, one sequence | 274,877,906,944 | 2.75 × 1011 | 275 GFLOP | 2 · nh · dh · S · S / 2 |
| Cattn | attention FLOPs per step | 618,119,048,856,600,576 | 6.18 × 1017 | 618 PFLOP | L · B · (4 · cqk + 3 · cpv) (QKᵀ-shaped ×4 (fwd, bwd replay, dQ, dK), PV-shaped ×3 (fwd, dV, dP)) |
| a8 | attention core in MXFP8 | 1 | (model input: 1 = MXFP8 attention (fp8_dot_product_attention, NVIDIA’s GB300 recipe), 0 = BF16) | ||
| Tfp8 | MXFP8 GEMM time (s) | 3.99 × 100 | 3.99 s | Cfp8 / (GPUs · πsolfp8) | |
| Tbf16 | BF16 GEMM time, routers (s) | 2.33 × 10−2 | 23.3 ms | Cbf16 / (GPUs · πsolbf16) | |
| Tattn | attention core time (s) | 6.71 × 10−1 | 671 ms | Cattn / (GPUs · (a8 · πsolfp8 + (1 − a8) · πsolbf16)) | |
| Tc | compute time per step (s) | 4.68 × 100 | 4.68 s | Tfp8 + Tbf16 + Tattn (no recompute: NVIDIA’s GB300 MXFP8 recipe recomputes nothing) | |
| φ | model FLOPs per token | 256,596,476,928 | 2.57 × 1011 | 257 GFLOP | (C + Cattn) / D |
The layout
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| PP | pipeline ranks | 2 | (model input: NVIDIA’s GB300 benchmark) | ||
| VP | virtual stages per rank | 8 | (model input: layout Et*4|(t*4|)*14tmL, sixteen chunks) | ||
| EP | expert parallelism | 32 | (model input) | ||
| DP | replicas of a non-expert slice | 128 | GPUs / PP | ||
| EDP | replicas of an expert slice | 4 | GPUs / (PP · EP) | ||
| domains | NVLink domains | 4 | GPUs / 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| q | chance one expert pick misses a given GPU | 0.96875 | 9.69 × 10−1 | 1 − 1 / EP | |
| q8 | chance all k picks miss it | 7.76 × 10−1 | q · q · q · q · q · q · q · q (k = 8; picks treated as independent, group limit ignored) | ||
| MNV | other GPUs a token is sent to | 6.95 × 100 | (EP − 1) · (1 − q8) (deduped: one copy per destination GPU, however many of its experts the token picked) | ||
| Vdisp | dispatch bytes/token·layer | 5.14 × 104 | 51.4 KB | MNV · d · (1 + 1 / 32) (MXFP8 + one E8M0 scale per 32) | |
| Vcomb | combine bytes/token·layer | 9.97 × 104 | 99.7 KB | MNV · d · 2 (BF16) | |
| Vtok | EP NVLink bytes per token | 2.03 × 107 | 20.3 MB | (Vdisp + 3 · Vcomb) · Lmoe (forward: an MXFP8 dispatch and a BF16 combine; backward: both directions again, in BF16) | |
| VEP | EP NVLink bytes per GPU·step | 1.33 × 1012 | 1.33 TB | Vtok · DGPU | |
| TEP | EP time per step (s) | 1.48 × 100 | 1.48 s | VEP / βNV | |
| fEP | EP time, share of compute | 3.16 × 10−1 | 31.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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| Λne | non-expert params a domain receives | 4,279,412,096 | 4.28 × 109 | 4.28 G | max(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) |
| βdom | scale-out into a domain (B/s) | 6,400,000,000,000 | 6.40 × 1012 | 6.40 TB/s | NVL · βIB |
| Λexp | expert params a GPU receives | 7,662,993,408 | 7.66 × 109 | 7.66 G | Nexp / (PP · EP) · (1 − 1 / EDP) (its slice minus its own shard, all charged to scale-out (some replicas share a domain: an overestimate)) |
| Tag | parameter all-gather, BF16 (s) | 1.55 × 10−1 | 155 ms | 2 · Λne / βdom + 2 · Λexp / βIB (MXFP8 parameters are gathered in BF16 and quantized locally) | |
| Trs | gradient reduce-scatter, BF16 (s) | 1.55 × 10−1 | 155 ms | 2 · Λne / βdom + 2 · Λexp / βIB (grad_reduce_in_fp32 off) | |
| Tsync | ZeRO-1 time per step (s) | 3.09 × 10−1 | 309 ms | Tag + 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| DPP | tokens per replica·step | 131,072 | 1.31 × 105 | 131 K | D · PP / GPUs |
| Vres | residual bytes per token | 14,336 | 1.43 × 104 | 14.3 KB | d · 2 (BF16) |
| VPP | PP bytes per GPU·step | 30,064,771,072 | 3.01 × 1010 | 30.1 GB | 2 · 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)) |
| TPP | PP time per step (s) | 3.01 × 10−1 | 301 ms | VPP / βIB | |
| m | microbatches per replica·step | 32 | DPP / S (one sequence each) | ||
| bILV | interleaved 1F1B bubble, share of compute | 0.00390625 | 3.91 × 10−3 | 0.391 % | (PP − 1) / (VP · m) |
| Tbub | bubble time per step (s) | 1.83 × 10−2 | 18.3 ms | Tc · 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| TIB | scale-out time per step (s) | 6.10 × 10−1 | 610 ms | Tsync + TPP | |
| fIB | scale-out time, share of compute | 1.30 × 10−1 | 13.0 % | TIB / Tc (under 100 % with fEP: compute bound, comms overlapped) | |
| Tstep | step time at speed of light (s) | 4.70 × 100 | 4.70 s | Tc + Tbub (compute plus the bubble) | |
| ρsol | tokens/s per GPU at speed of light | 1.39 × 104 | 13.9 K | DGPU / Tstep | |
| ρNV | tokens/s per GPU, as reported | 6,288 | 6.29 × 103 | 6.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) |
| fsol | speed of light over reality | 2.22 × 100 | 2.22 | ρsol / ρNV |
| configuration | GBS | layout | Tstep at SOL | EP / compute | bubble | tok/s/GPU at SOL | measured | SOL / 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.
| cell | quantity | value (exact) | scientific | SI | formula |
|---|---|---|---|---|---|
| φNV | NVIDIA’s model FLOPs per token | 2.60 × 1011 | 260 GFLOP | 1,636 · 1012 / ρNV (the same row’s 1,636 model TFLOP/s per GPU over its tokens/s) | |
| fφ | theirs over ours | 1.01 × 100 | 101 % | φNV / φ | |
| πNV | achieved model FLOP rate per GPU (FLOP/s) | 1,613,478,646,923,264 | 1.61 × 1015 | 1.61 PFLOP/s | ρNV · φ (our FLOP count at their throughput) |
| ηNV | of the FP8 spec peak | 3.23 × 10−1 | 32.3 % | πNV / πfp8 | |
| BML | MLPerf: sequences per step | 15,360 | (MLPerf Training v6.0, NVIDIA result 6.0-0100: 256 GB300s, PP 4 · VP 4 · EP 32, real routing) | ||
| TML | MLPerf: median step time (s) | 39.355 | 3.94 × 101 | 39.4 s | (median train_step_time over the 147 steps of the three published result logs (38.8–41.1 s)) |
| ρML | MLPerf: tokens/s per GPU | 6.24 × 103 | 6.24 K | BML · S / (GPUs · TML) |