F = multiply-add FLOPs; B = modeled operand bytes. Arithmetic intensity I = F / B.
Choose a recipe.
Work its roofline.
Configure the parallelism, batch, precision and hardware. Calculate the roofline for that recipe.
Study 01 followed the tensor shapes. Study 02 budgeted the live copies. This study turns those shapes into an analytic roofline: FLOPs divided by hardware rates, operand bytes divided by bandwidth, and the configured parallelism and recomputation. There is no universal throughput number: every result belongs to the selected recipe. Measured training throughput is a separate comparison, never an input to the analytic model.
Configure your recipe in the calculator, choosing GB200 or GB300 and starting from the default GB200 setup. Its results include the modeled compute/HBM, communication and pipeline constraints. CUDA graphs do not change analytic FLOP and byte counts; CPU/launch overhead and memory feasibility need separate validation.
Three roofs, three different byte counts
A kernel can be limited by HBM. Distributed work can instead be limited by NVLink or the scale-out network. Divide work by the bandwidth of the resource that actually carries its bytes. In particular, a fast NVLink roof does not make cross-domain traffic disappear.
| Resource | GB200 reference profile | GB300 reference profile | How to read it |
|---|---|---|---|
| BF16 Tensor Cores | 1,800 TFLOP/s / GPU, uncalibrated proxy | 1,800 TFLOP/s / GPU, practical target | Edward's sustained random-data target at the GB300 power envelope, informed by public B300 evidence. GB200 temporarily reuses it as an explicit proxy: no practical GB200 compute calibration is supplied. Neither entry uses NVIDIA's advertised compute peak. |
| MXFP8 Tensor Cores | 3,600 TFLOP/s / GPU, uncalibrated proxy | 3,600 TFLOP/s / GPU, assumed target | Edward's MXFP8 target, modeled as twice the practical BF16 rate. It is an assumption, not a directly measured MXFP8 kernel rate. Only routed expert GEMMs use it here; dense, shared, router, LM head, attention-core and Muon contractions remain BF16. |
| HBM | 8 TB/s / GPU | 8 TB/s / GPU | The operand-bandwidth roof used for both generations, not HBM capacity. GB300's larger memory capacity is not a bandwidth multiplier; memory fit needs the separate memory study. |
| NVLink | 900 GB/s / GPU, one direction | 900 GB/s / GPU, one direction | Edward's one-direction NVLink budget. Actual collective bandwidth and contention can lower effective service; do not double this denominator for bidirectional traffic. |
| Scale-out network | 100 GB/s / GPU, reference input | 100 GB/s / GPU, reference input | Matches Edward's 800-Gbit/s GB300 network assumption, not an intrinsic GPU property or a measured allocation rate. Set 50 GB/s for a 400-Gbit/s-equivalent per-GPU budget, or the correct shared NIC budget for the system being modeled. |
The inputs are synchronized with Edward Yang's current K3 analysis: practical sustained targets of 1.8 PFLOP/s BF16 and 3.6 PFLOP/s MXFP8, 900 GB/s one-way NVLink, and 100 GB/s scale-out. His sustained compute targets are empirically informed model inputs, not NVIDIA's spec peaks. The GB200 profile explicitly borrows them until practical GB200 rates are provided. Identical rate inputs produce identical modeled times for the same recipe; this does not claim identical sustained GB200/GB300 performance. Edit the compute and bandwidth inputs for the hardware and network being modeled. Measured end-to-end throughput and FakePG runtime are not used to fit the result.
Left of the ridge, fewer HBM bytes help. Right of it, the compute ceiling matters. A point under a roof need not attain that roof.
From hardware numbers to a throughput ceiling
For every GEMM phase: forward, DGRAD, WGRAD, and any checkpoint replay t_op = max(F_op / practical_SOL_rate_for_its_dtype, operand_bytes / HBM_bandwidth) T_stage = sum(t_op over all local chunks) + attention_core_FLOPs / BF16_SOL_rate T_compute = max over PP stages(T_stage) rho_compute = global_tokens_per_update / (GPU_count * T_compute) Nominal bubble overhead: VPP = 1: (PP - 1) / M [existing ordinary 1F1B model] VPP > 1: (PP - 1) / (M * VPP) [balanced-chunk interleaved estimate] VPP changes chunk placement and PP edges, not the token or logical FLOP count. Separate distributed model: T_resource = max(T_compute, shared_NVLink_service, shared_NIC_service) T_step_model = T_resource + nominal_pipeline_bubble rho_recipe = global_tokens_per_update / (GPU_count * T_step_model) model_TFLOPs_per_GPU = rho_recipe * conventional_FLOPs_per_token / 1e12
The calculator reports rhorecipe and its conventional model TFLOP/s/GPU for the configured recipe, not a compute-only headline. Compute/HBM, shared-link service and the nominal pipeline bubble are its ingredients. The communication protocol, topology and lifecycle are explicit inputs, not a fit to HybridEP, Dist-MoE, measured tokens/s or FakePG timings. This is an optimistic accounting model, not a complete schedule simulation: optimizer and non-matmul service are omitted, and CP-specific communication is not yet priced. The result is not proof that the configuration fits memory.
Configure a recipe and calculate its roofline
Start with the default 512-GB200 recipe below, then choose GB200 or GB300, GPU count, parallelism, batch, precision, lifecycle and hardware rates. Every result updates from those inputs. VPP1 keeps the existing TP1, ordinary-1F1B model unchanged. VPP2 and VPP4 opt into an estimated interleaved-1F1B mode with an automatic loop-style layer split. Changing rows or microbatches changes the global batch; changing CP changes the number of independent data replicas. Memory feasibility still needs its own budget.
Switching GPUs loads that hardware profile's reference rates without changing the recipe. Rates remain editable. Scenario buttons change only their named inputs and preserve the selected hardware and custom rates; the reset button restores the complete default.
Default analyzed recipe: 512 GB200 GPUs
| Field | Default recipe |
|---|---|
| Hardware profile | GB200; uncalibrated GB300 compute-rate proxy. Replace with practical GB200 rates for a hardware comparison. |
| Parallelism | PP8 / CP1 / TP1 / DP64 / EP64; dense FSDP64, expert FSDP1 |
| Batch | One 4,096-token row per microbatch; 64 microbatches in one schedule; 16,777,216 tokens/update |
| Precision | FP32 master weights, gradient accumulation/reduction and optimizer state; BF16 compute throughout |
| Recomputation and schedule | Full layer recomputation; ordinary 1F1B; one contiguous stage per rank |
| FSDP communication model | 65 BF16 weight all-gathers and one FP32 gradient reduce-scatter per update |
| Routing and placement | Balanced routing without token dropping; EP64 inside one NVLink domain; PP over the scale-out link |
This is the calculator's default analyzed configuration, not a launch recipe or a claim of optimality. Hardware inputs are below.
GB200: the compute preset uses Edward's GB300 targets as an uncalibrated proxy. Replace them with practical GB200 rates before comparing the two GPUs. The NIC budget is a separate system assumption; hardware selection does not establish memory fit.
VPP > 1 is an estimate, not a schedule simulation. Layers are split into PP × VPP chunks, assigned round-robin to physical ranks. The nominal bubble assumes balanced virtual chunks. Every inter-rank chunk edge carries full hidden/residual packets forward and matching gradients backward; cache reuse and communication startup are omitted. VPP does not divide resident parameters or establish memory fit.
| Quantity | Recipe-specific result |
|---|---|
| Pipeline model | VPP1 / existing ordinary 1F1B model |
| Tokens/update | 16.78M |
| Expected rows/local expert | 4,681.14 |
| Resource + nominal pipeline time | 17.631 s |
| Recipe roofline, tokens/s/GPU | 1,859 tokens/s/GPU |
| Recipe roofline, model TFLOP/s/GPU | 1,199.1 model TFLOP/s/GPU |
Default recipe: compute/HBM and shared-link service, plus a nominal ordinary-1F1B bubble. Optimizer and non-matmul service omitted; not measured training throughput.
Stored parameters are not activated FLOPs
For Y = XW, with X [M,K] and W [K,N], forward costs 2MNK FLOPs. Backward has two more contractions of the same size: dX = dYWT and dW = XTdY. Three contractions give 6MNK. Summed over learned matrices, this becomes 6NactiveDtokens. Here N is activated matrix weights, not the entire 2.780T checkpoint.
Routed expert weights activated / token = 92 layers * 16 experts * 3 matrices * 3584 * 3072 = 48,620,371,968 All learned active matrices = 104,174,092,288 Learned-matrix training work = 625.04 GFLOP / token
The familiar 104.1895B active-parameter count also includes small non-matmul weights. It is useful for a conventional metric, but those weights do not each cause a dense matmul. The input embedding lookup and text-only vision path are excluded from per-token matrix compute; the LM head is included.
Attention adds work without adding a weight matrix
| Core | Algorithmic training work / token | What is not in the formula |
|---|---|---|
| 69 KDA layers | 69 × 3 × 96 × (6 × 128² + 10 × Cchunk × 128) = 3.5814 GFLOP at Cchunk = 64 | Matches Edward's K3 chunkwise estimate: state contractions plus intra-chunk terms, forward plus gradients. The chunk inverse, non-matmul FP32 work and kernel memory traffic are still omitted; this is a contraction estimate, not a kernel benchmark. |
| 24 causal MLA layers | 24 × 3 × 96 × (192 + 128) × (Seff + 1) | Seff = Σ sdoc2 / Σ sdoc. This counts causal QK and PV contractions, not norms, softmax or gating. |
| FlashAttention replay | 24 × 96 × 192 × (Seff + 1) | The QK contraction rematerialized by attention backward. Counted for the runtime sketch, not conventional model FLOPs. |
| Full layer checkpoint | One extra forward for decoder matrices and attention cores | The model-wide output-head GEMM is not included in the layer checkpoint replay. Full recompute also repeats MoE communication. |
Equal documents make Seff easy to see: one 4K document gives 4,096; four independent 1K documents give 1,024. Two 2K rows have the same tokenwise projection work as one 4K row, but roughly half the MLA contractions. Flattening [rows, context] to T does not remove document boundaries. CP shortens local token arrays, not the logical context attended by MLA.
Model FLOPs, issued-work estimates, MFU and HFU are different quantities
The fixed training results below follow TorchTitan's convention: 6 × 104,189,515,872 + recurrent-only KDA contractions + non-causal MLA contractions, using the configured row context. At 4K that is 645.210 GFLOP/token. The runtime sketch instead uses causal pairs, learned matrices only, KDA intra-chunk work, FlashAttention replay and the selected layer recomputation. Adding the KDA chunk terms to the runtime model does not retroactively change the FLOP metric used by those training logs.
MFU = model FLOP/s divided by the chosen nominal dense hardware peak. It should not reward checkpoint recomputation. HFU includes actual hardware work, but an algorithmic replay estimate is not a measured HFU: custom-kernel implementation work is still missing. More recompute can make a job look compute-bound while making time-to-result worse.
A payload budget first; protocol overhead separately
K3 compresses the routed stream from 7,168 to 3,584 channels before dispatch. A BF16 latent row is 7,168 bytes, not 14,336. The shared experts stay on the 7,168-wide dense path and are not dispatched. With full checkpointing, the route is traversed three times: forward, recomputed forward, and the two reverse communication operations in backward.
No checkpoint: 4 payload exchanges / layer / microbatch Full checkpoint: 6 payload exchanges / layer / microbatch Assignment budget, uniform routing: remote GPU copies / token = top_k * (1 - 1 / EP) cross-domain copies = top_k * (1 - local_EP_ranks / EP) Payload bytes = exchanges * local_tokens * latent_width * 2 * remote_copies
One-copy-per-assignment is a conservative payload budget. If the dispatcher sends a token once per destination rank and sums results before returning them, multiple chosen experts on that rank can share a copy. The second accounting option models this ideal deduplication under uniform sampling without replacement; it does not assert that every backend or phase implements it. Metadata, alignment and routing weights are additional.
The extra HybridEP all-gather is not an expert weight gather
This is an optional, backend-specific addition, disabled in the default payload-only ledger. It is not a requirement of K3's expert computation or an input to compute service. The 4K reference exchanges a Boolean routing map [4,096, 896] before dispatch: 3.5 MiB locally, 224 MiB gathered across EP64, of which 220.5 MiB came from other ranks. The original and recomputed forward each do it. On a 12-MoE-layer stage, 64 microbatches × 12 layers × 2 = 1,536 metadata all-gathers per update. Small inputs can thus imply a substantial global output and a repeated dependency.
FSDP counts depend on the lifecycle, not just the acronym
At the default 512-GPU PP8/EP64 layout, routed experts have expert FSDP1: there is no routed-weight FSDP gather. Dense weights are sharded over 64 ranks. A BF16 ring all-gather receives 2P(1 − 1/n) bytes per rank; an FP32 reduce-scatter has the corresponding 4P(1 − 1/n) budget. Multiply by the actual number of collectives.
| Lifecycle model | Weight AG rounds / update | Gradient RS rounds / update | Tradeoff |
|---|---|---|---|
| 4K reference-like | M + 1 = 65 | 1 | 65 gathers per layer observed in the interior-stage trace. Extrapolating that multiplier to other lab shapes is illustrative. |
| Textbook reshard | 2M = 128 | M = 64 | Gather before forward and backward; reduce each microbatch. Lower residency can cost much more communication. |
| Retain views across the schedule | 1 | 1 | An optimistic lifecycle alternative. Keeps BF16 views and deferred gradients live; requires a different memory budget and runtime support. |
| Reshard views, defer gradients | 2M = 128 | 1 | Release parameters after forward and backward; accumulate FP32 unreduced gradients until schedule end. The selected GB300 policy; at M=32, the nominal counts are 64 gathers and one reduction. |
For a hierarchical collective, a domain with a of n shards need only import P(1 − a/n) parameters once, then share them locally. Dividing its import by a models the per-rank share of an a-NIC aggregate budget. This is an ideal domain-level network bound, not the measured wire volume of NCCL's chosen algorithm. NIC sharing or a different rank layout changes it.
| Traffic / update | Endpoint budget | NVLink service | NIC-domain budget | Network service |
|---|
Budgets are balanced one-direction endpoint traffic or amortized one-direction domain import; opposite-direction capacity is not added to the bandwidth denominator. The two projections are not disjoint byte categories to add. Different collectives on the same resource compete; overlap does not grant each its own full NVLink or NIC bandwidth.
Long-context CP scenarios keep the logical attention length, DP count and local-token shape straight, but CP attention communication is not priced here. KDA state/prefix exchange, MLA KV/head redistribution and backend-specific CP collectives require their own trace-derived ledger. The 64K preset is a shape and compute comparison, not a complete long-context step-time prediction.
The unchanged VPP1 model and an opt-in interleaved estimate
Under balanced stage costs, an ideal ordinary 1F1B schedule has compute-bubble overhead (PP − 1) / M relative to useful scheduled work. At PP8 and M64 that is 10.94% overhead, or 9.86% of the compute-plus-bubble interval. Each optimizer update fills and drains its own pipeline; a previous warmup update does not remove those structural bubbles.
For VPP > 1, the optional estimate uses the nominal interleaved overhead (PP − 1) / (M × VPP), as in Edward's K3 analysis. Decoder layers are divided into logical chunks, with embedding and head each counted as one split slot, then assigned in loop order: chunk index modulo PP gives its physical rank. Compute service is summed across all chunks on that rank; the slowest rank still sets the compute envelope. Unequal chunk durations and actual interleaved action ordering are not simulated. Only the nominal bubble term gets the 1/VPP factor, not all computation or memory.
More microbatches help amortize the bubble, but there is a tradeoff. At fixed global batch, each microbatch gets smaller, potentially lowering GEMM efficiency. In this lab the row shape stays fixed when M changes, so the global batch grows. Science determines whether that larger update is appropriate.
The PP packet is bigger than [T, 7168]
K3 sends (hiddenTD, deltaTND). With one stage per rank, a microbatch visits each receiving rank for the first time, so the residual cache cannot omit the earlier blocks. With the released/current TorchTitan interval of 12 decoder layers and the default 12-layer PP split, outgoing residual-bank counts are 1, 2, 3, 4, 5, 6 and 7. The final hop carries one hidden stream plus seven residual streams: 8 × 56 MiB = 448 MiB forward, and a matching gradient payload backward. The memory study distinguishes these bank references from temporary materialized stacks.
Interleaving with multiple virtual stages can shrink a stage's gathered working set, revisit a rank with a populated residual cache, and offer different scheduling opportunities. It also adds stage boundaries and communication, including last-rank-to-first-rank wraparound. This estimate conservatively sends every residual bank at each boundary, even on revisits. A residual-cache-aware implementation can move fewer bytes; the estimated PP budget is not a claim about its exact traffic. VPP1 continues to use the original contiguous split and byte arithmetic. Both modes require separate validation of live activations, gathered chunks, graph pools and memory capacity.
Muon is a matrix workload of its own
FP32 momentum is persistent training history. Newton–Schulz uses a BF16 working matrix. For one expert matrix [3,584, 3,072], orient the working matrix as X [r,c] with r = 3,072 and c = 3,584. A standard iteration forms A = XXT, B = bA + ccoefA2, then updates X using BX and a scaled X. The leading contractions cost 4r2c + 2r3 FLOPs per iteration.
Five iterations cost about 0.966 TFLOP per logical expert matrix. An interior PP rank with 12 MoE layers and 14 experts per layer has 12 × 14 × 3 = 504 such matrices: about 487 TFLOP per update, before the smaller non-routed matrices, redistribution, normalization, pointwise work and communication. That is a workload estimate, not an optimizer timing measurement.
Fused gate/up storage still contains two logical expert matrices. Muon orthogonalizes those matrices separately; using one wider fused storage shape would give a different Newton–Schulz cost and a different update.
Exposed optimizer-phase interval, including clipping/checks/update/scheduler. This is not the duration of a CPU DistMuon annotation.
A long CPU optimizer span can include waiting for the pipeline's last backward or a gradient-norm collective. The reference's complete exposed optimizer tail was small compared with its clean step; it does not support blaming the throughput gap on Muon alone. More tokens per update amortize one optimizer update, but also change optimization and memory requirements.
Historical measurements: comparison only, not the roofline
The fixed 512-GB200 HybridEP references below completed 12 updates with FP32 resident/master weights and optimizer states, BF16 compute, full checkpointing, PP8/FSDP64/EP64, 64 microbatches, and no CUDA graphs. Clean throughput excludes the profiled update and trace-export disturbance. These old backend-specific measurements stay fixed when you change the lab. They neither set calculator results nor represent current optimized Dist-MoE throughput.
| Reference | Rows × context | Tokens/s/GPU | Implied clean update | Model TFLOP/s/GPU | Nominal dense BF16 MFU |
|---|
MFU here uses a fixed 2,500-TFLOP/s dense denominator and the documented TorchTitan estimator, not a 5,000-TFLOP/s sparse ceiling. The 4K data are packed C4, so using a full 4K document for every row in the calculator is an attention-work upper scenario, not an audited document-length histogram. The learned-routing reference also changes HybridEP to blocking mode; its slowdown is not a controlled routing-imbalance-only measurement.
A concrete discrepancy: metadata wait versus byte service
In the inspected middle-stage trace, all 1,536 same-shape routing-map all-gathers were effectively exposed relative to useful model compute. Their kernel residency times varied far more than a constant-byte model predicts. NCCL residency includes peer waiting and contention; it is not a direct bandwidth sample.
| Routing-map all-gather | Duration | Interpretation |
|---|---|---|
| Default nominal byte-service sketch | 220.5 MiB / 900 GB/s, under the assumed all-local EP placement. Not measured. | |
| Observed median | 1.398 ms | Identical payload, one profiled rank/update. |
| Observed P95 | 36.600 ms | A large long tail; not explained just by message size. |
| Observed maximum | 277.746 ms | Includes progress/waiting, not only active transfer. |
Metadata calls overlapping FSDP all-gathers had a 31.464-ms median, versus 1.029 ms without that overlap. This is evidence of correlated communication delay, not proof of one cause: rank arrival skew, contention and earlier compute stalls can coincide. Summing overlapping NCCL bars would double-count wall time; measure interval unions and the wait before the consumer can start.
Calibrate the compute roof
Benchmark the actual grouped expert shapes and dense GEMMs at the real power cap. Separately time KDA, MLA, SiTU-GLU, norms and routing; sustained BF16 contraction rates do not price these kernels.
Validate the fabric mapping
Map ranks to NVLink domains and NIC budgets. EP64 fitting inside NVL72 is a placement possibility, not proof that this allocation achieved it.
Match the collectives
Use process-group, sequence number, dtype and element count. Routing metadata and FSDP parameters can have the same NCCL kernel-family name.
Measure the dependency gap
Find when the router map is ready, when the all-gather finishes, and when scan/dispatch starts. Across ranks, compare arrival skew and the downstream PP receive.
The lab omits CP-specific communication, optimizer service from its main step sketch, backend chunk work, pointwise kernels, CPU/launch cost, collective startup, imbalance, allocator effects and non-ideal overlap. Its resource-plus-bubble number is an optimistic diagnostic sketch, not a speedup promise, validated prediction, or complete training speed of light.
Sources and reproducible accounting
- Kimi K3 technical report and released configuration: 69 KDA / 24 MLA layers, expert and latent dimensions, attention heads.
- Edward's practical Blackwell hardware-rate inputs set the SOL denominators. Hardware capacity and precision context come from GB200 NVL72 specifications; advertised Tensor Core peaks do not price the default compute model. Rates use decimal bytes; allocation sizes use binary MiB/GiB.
- TorchTitan FLOP accounting, Kimi K3 implementation, and DistMuon: conventional model FLOPs, parameter and optimizer shapes. The lifecycle and profile observations are specific to the reference recipe.
- PyTorch pipeline parallelism and FSDP: scheduling, mixed precision and sharding semantics.
- Method and current hardware/KDA accounting checked against Edward Yang's K3 roofline, Blackwell analysis, and original DeepSeek-V3 roofline study. The practical SOL rate inputs match his current K3 sheet, and our MXFP8 option changes only the routed experts, not all linear layers. The configured parallelism and FullAC policy also differ from his default K3 recipe. Background: the original roofline paper (Berkeley PDF) and All About Rooflines.
The calculation source is available as plain JavaScript, with shared structural accounting used by the memory study. Export the current stage ledger to inspect the inputs and numbers; the export contains assumptions, not profiler measurements. Fixed reference numbers are summarized from the associated training notes without internal run URLs, dataset paths or host identifiers.