execution

Compute, Memory, and Performance

Follow the work, the bytes and the time window. Then ask whether the same estimate survives memory, scaling and durable progress.

Published 2026-04-08 · Updated 2026-10-28
On this page

Which resource limits this workload?

A slow workload does not tell you which resource would make it faster. A larger accelerator can leave a small decode request almost unchanged. More ranks can reduce local computation while increasing communication. High GPU activity can coexist with little committed training progress.

Start with three quantities: the work to perform, the bytes to move, and the storage needed while that work executes. Then match those quantities to the hardware and the measurement window. Each estimate should expose an assumption you can test.

This note connects operator arithmetic to a complete resource plan. Ideal bounds help reject impossible estimates and choose an investigation. They do not replace measurements of the full stack. Profiling explains how to test the resulting bottleneck hypothesis.

Define the result and its measurement window

Choose the result before measuring
QuantityBoundaryImportant distinction
LatencyTime for one declared operation/requestEnd-to-end, service, queue, first-token and inter-token time differ
ThroughputCompleted useful work per unit timeOffered load and attempted/replayed work are not completed work
BandwidthBytes per second at a named interfaceCapacity versus achieved transfer rate; bits versus bytes
Tail latencyA percentile of a stated request populationp99 is a threshold, not a mean over the slowest 1%
JitterVariation in timingState the statistic and observation interval
Step timeFull declared training-step intervalInclude the required completion boundary and participating ranks

Round-trip time (RTT) measures a request and return path. It is one latency definition, not a synonym for every operation’s latency. Report p90, p95 or p99 with the workload and sampling method. An average can hide a small group of very slow requests.

A change is useful only relative to the target. Increasing tokens per second while violating the latency service-level agreement is not a successful serving optimization. Likewise, faster attempted training steps need not imply faster durable progress.

Latency, throughput and in-flight work

L=λWL=\lambda W
L is finite mean in-flight count; λ is the conserved mean admitted/completed rate and W is finite mean residence time inside the same stable boundary. Rates and times must use matching units and populations.

Little’s law connects averages under a stable flow with consistent boundaries. W includes service and waiting, not only queue delay. Count the same items in L and λ; do not mix requests, tokens and batches.

At 100 completed requests/s and 0.2 s average residence time, average in-flight work is 20 requests. This is an accounting relationship, not proof that adding twenty workers will sustain that rate.

As offered load approaches capacity, queues can grow and tail latency can worsen. The shape depends on arrival, service and scheduling distributions. There is no universal exponential latency curve. Beyond sustainable capacity, an unbounded queue has no stable average to which this calculation can be applied.

A request that waits for several parallel services can finish only after its required slowest dependency. More fan-out can expose tail behavior even when each service’s average is small. Measure the complete dependency path.

Batching trades shared work against waiting and larger service intervals. Distinguish the delay to assemble a batch from the time to execute it. A batch of 100 messages can amortize fixed overhead while delaying the first message.

An optimization changes a specific part of the path

A cache removes some repeated work when it hits. A content delivery network can shorten a network path. Protocol choices can reduce particular setup or serialization costs. None guarantees a universal speed ranking independent of the workload.

A queue decouples producers from consumers; it does not create consumer capacity. Batching amortizes fixed work and can reuse weights. Horizontal scaling adds independent capacity only when ownership, state and shared dependencies allow it.

Predict the intervention’s effect
InterventionExpected change to testPossible cost
Cache or in-memory working setFewer slow-path accessesMisses, invalidation and capacity
Edge placementShorter request pathReplication and consistency
BatchingLess overhead/traffic per completed itemBatch wait and larger service interval
More replicasMore independent service capacityShared storage/network saturation
Protocol changeSpecific connection/serialization work decreasesCompatibility and implementation constraints

Memory access is often much faster than a disk seek, but “disk has low throughput” is too broad. Sequential storage bandwidth, random-access latency and a cache hit describe different operations. Compare the relevant pattern and boundary.

For example, Redis can serve an in-memory cache and a CDN can serve edge copies. HTTP/3 and gRPC change different protocol and serialization boundaries. Treat these as candidates to measure, not interchangeable guarantees of lower latency.

Orders of magnitude are not current specifications

The following rounded values are historical mnemonic estimates carried by the original reference. Their hardware, date and measurement methods are unspecified. Use them to remember different scales, not to size a current system or assert a benchmark.

Historical order-of-magnitude mnemonics—not current specifications
OperationOld rounded value
L1 cache reference0.5 ns
Main-memory reference100 ns
Compress 1 KB with Zippy3,000 ns
Send 2 KB over 1 Gbit/s network20,000 ns
Read 1 MB sequentially from memory250,000 ns
Round trip within a data center500,000 ns
Disk seek10,000,000 ns
Read 1 MB sequentially from disk20,000,000 ns
California → Netherlands → California150,000,000 ns

A mechanical seek does not describe an SSD. A bandwidth-derived serialization time excludes propagation, queueing and protocol overhead. Compression depends on content and CPU. Replace a mnemonic with an explicit specification or representative measurement before using it in a capacity plan.

Speed and scaling answer different questions

Performance describes speed and resource use for a specified workload. Scalability describes how those results change as work and resources increase. They are related, but neither can be inferred from one lightly loaded measurement.

A query that takes 5 s even for one user suggests a slow-path investigation. A query that takes 100 ms for one user but 10 s at 1,000 concurrent users suggests a load-dependent investigation. These are assigned examples, not measured service results. Either case can involve inefficient code and shared resource limits.

S(n)=t(1)t(n)E(n)=S(n)n\begin{aligned}S(n)&=\frac{t(1)}{t(n)}\\E(n)&=\frac{S(n)}{n}\end{aligned}
n≥1 is the resource count; t(1),t(n)>0 are elapsed times for identical useful work. Strong scaling holds that work fixed. Weak scaling instead increases work with resources under a declared rule.

Do not compare different token counts as if they were fixed-work speedups. Throughput scaling at an equal latency/quality constraint is another useful comparison. Report the baseline, resource count, workload and cost.

More resources can expose another limit

The next limit may be a serial stage, shared database, network link, rank imbalance or small per-device matrix. Heterogeneous workers can also create stragglers. More total peak compute does not remove these limits automatically.

Redundancy can consume capacity and add replication work. A system need not have zero redundancy overhead to be scalable. Stateful systems can scale through explicit ownership and partitioning; statelessness simplifies some paths but is not a universal requirement.

Fixing unnecessary quadratic work can be more effective than adding servers. However, optimization and scaling are not a mandatory sequence: deadlines, availability and engineering cost matter. Choose the intervention whose predicted effect addresses the observed constraint.

Check p95/p99 under representative load and inspect shared dependencies. In model training, relate speedup to local shapes, communication and pipeline bubbles. Distributed Training and Parallelism owns the layout and schedule mechanisms.

A slow query can motivate algorithm changes, indexes, caching or faster local hardware. A load-dependent bottleneck can motivate load balancing or database sharding. Optimized hardware and commodity clusters are deployment choices, not definitions of performance and scalability. Distributed Services and System Design explains the ownership, cache and replication mechanisms.

Start with the tensor contraction

Y=XWX∈RM×K,W∈RK×NY∈RM×N,Fleading≈2MKN\begin{aligned}Y&=XW\\X&\in\mathbb R^{M\times K},\quad W\in\mathbb R^{K\times N}\\Y&\in\mathbb R^{M\times N},\quad F_{\rm leading}\approx2MKN\end{aligned}
M,K,N are positive integer dimensions. Count multiply and add as two FLOPs; a plain length-K dot product uses 2K−1 scalar operations, rounded to 2K here. Bias, beta·Y, conversion and extra operators are excluded.

For a two-input contraction, multiply the sizes of distinct dimensions. Count a shared batching axis once and a contracting axis once. A shared output axis indexes independent subproblems; a shared axis absent from the output is summed.

For batched matrices X[B,M,K] and W[B,K,N], the count is 2BMKN, not 2B²MKN. An elementwise product or outer product without reduction does not acquire a factor of two merely because two operands occur.

def matmul_work(m, k, n, qx=2, qw=2, qy=2):
    flops = 2 * m * k * n
    traffic = qx*m*k + qw*k*n + qy*m*n
    return flops, traffic, flops / traffic

For positive integer m, k and n and positive byte sizes, this educational function counts ideal one-time input reads and one output write. It excludes bias, beta·Y, conversion, scales, tile reloads and intermediate work. The byte model and operation model must describe the same call.

Why forward plus backward costs about 6PT

For Y=XWY=XW, backward computes dX=dY W⊤dX=dY\,W^\top and dW=X⊤dYdW=X^\top dY. The gradients match their operand shapes. Each matrix product has the same leading operation count. Together they cost about three times forward: 6MKN6MKN.

Fforward≈2PTFmodel,train≈6PTFexecuted,full remat≈8PT\begin{aligned}F_{\rm forward}&\approx2PT\\F_{\rm model,train}&\approx6PT\\F_{\rm executed,full\ remat}&\approx8PT\end{aligned}
P: active projection parameters under the declared convention; T: tokens. Full-block recomputation adds another forward-equivalent 2PT.

The shortcut neglects several operations and quadratic attention. Frozen operands, selective gradients and selective checkpointing change the count. Input embedding lookup is not a dense vocabulary matrix product. Output unembedding is a dense projection and can matter, especially for large vocabularies.

Tied input/output weights reduce stored parameters, not the output projection’s arithmetic. State whether P includes that projection. For mixed attention, recurrent layers or sparse models, count the actual operations before applying a global shortcut.

Rematerialization trades saved intermediates for repeated work. If measured useful-model FLOP/s already includes its slowdown, do not apply a second 8/6 time penalty to that rate. Count executed work when using an executed-hardware rate.

Count the projections the architecture actually uses

Pattn=2D2+2DHkvKPFFN={2DFtwo projections3DFgated, three projections\begin{aligned}P_{\rm attn}&=2D^2+2DH_{\rm kv}K\\P_{\rm FFN}&=\begin{cases}2DF&\text{two projections}\\3DF&\text{gated, three projections}\end{cases}\end{aligned}
D: width; F: intermediate width; Hq/Hkv: query/KV heads; K: head width; assume D=HqKD=H_qK. The 3DF3DF form is a gated FFN.

Query and output projections each contain D² entries. Key and value each contain D·Hkv·K entries. Multi-head attention gives 4D². Grouped-query attention reduces K/V projections and cache size; it leaves Q/O unchanged.

A two-projection FFN has an up and down matrix. A gated FFN also has a gate matrix. Using an old 2DF rule for a three-matrix SwiGLU block undercounts the projection work.

Count layers, vocabulary projection, shared experts and unusual projections separately. Shape-based accounting should also state biases and small operations that were neglected. “Exact per layer” is exact only within that declared operation inventory.

Long context adds work that parameter counts miss

Fattention,fwd≈4BS2DFlinear,fwd≈2BS Player\begin{aligned}F_{\rm attention,fwd}&\approx4BS^2D\\F_{\rm linear,fwd}&\approx2BS\,P_{\rm layer}\end{aligned}
B: sequences; S: context; D: query width. The first expression counts dense full-pair QKᵀ and probability–value products, excluding softmax.

For MHA, a gated FFN with F=4DF=4D gives Player≈16D2P_{\rm layer}\approx16D^2. The full-pair attention-to-linear ratio is then S8D\frac S{8D}. Parameter-only estimates increasingly undercount attention as context grows. Other FFN ratios and head layouts change the crossover.

Causal attention has S(S+1)2\frac{S(S+1)}2 useful pairs, not exactly S22\frac{S^2}2 at small S. A causal-aware kernel can skip masked work; a dense masked implementation may still execute it. FlashAttention reduces intermediate traffic but does not make all required attention arithmetic disappear.

Context can change what dominates arithmetic

One layer; 1 sequence; width 1024; 8 query heads; gated FFN 4096Projection/MLP:46.708GFLOPsAttention products:3.221GFLOPsExtra full forward:0GFLOPsBar fractions are arithmetic shares—not elapsed time.

Sequence=512; KV heads=2; pair policy=full; remat=no; experts=dense; active parameters=15204352; stored parameters=15204352; model training=49.929GFLOPs; executed training=49.929GFLOPs; attention/linear=0.069.

GQA changes K/V projections, not the number of query-head attention products. Causal uses exact useful pairs S(S+1)2\frac{S(S+1)}2; actual masked tiles can execute more work. MoE assigns 8 stored experts and 2 selected experts per token, without router, padding, shared experts or communication. Full rematerialization adds one forward. Norms, softmax and vocabulary projection are outside this layer model.

The bar shows assigned arithmetic shares, not time shares. A bandwidth-bound operator can dominate time while occupying little of the FLOP bar. Use the complete forward/backward kernel behavior to turn this inventory into a timing hypothesis.

MoE separates stored capacity from active work

An MoE expert matrix is stored for each expert, but a token executes only its selected experts. For E experts and top-k routing, stored FFN parameters scale with E; leading token-level expert work scales with k.

Record total parameters, active parameters, E, k and any always-active shared expert. Use total state for checkpoint and persistent-memory capacity. Use active executed matrices for the first-order arithmetic estimate.

Routing, padding, token dropping, imbalance and expert communication remain separate costs. A group can store experts that receive little work while another expert sets the step’s critical path. Arithmetic alone cannot establish efficient sparse execution. Mixture of Experts connects those routing and systems mechanisms.

Turn arithmetic and traffic into resource bounds

I=FQ,Iridge=CβR(I)=min⁡(C,βI)tideal≥max⁡ ⁣(FC,Qβ)\begin{aligned}I&=\frac{F}{Q},\qquad I_{\rm ridge}=\frac{C}{\beta}\\R(I)&=\min(C,\beta I)\\t_{\rm ideal}&\ge\max\!\left(\frac{F}{C},\frac{Q}{\beta}\right)\end{aligned}
F,Q,C,β>0: FLOPs, bytes crossing the named boundary, matching peak FLOP/s and bandwidth in bytes/s. I is FLOP/byte. The ideal bound assumes only these two resource constraints; measured time can be larger.

Below the ridge, the bandwidth ceiling is lower. Above it, the compute ceiling is lower. These describe the two-resource ideal model, not proof that the measured kernel saturates either resource.

For ideal resource times a and b, max(a,b) describes full overlap and a+b describes serialization. Actual execution can exceed their sum because of launch, dependencies, extra traffic or ineffective instructions. Do not call the sum an upper bound on the real program.

Compare measured throughput with the bound under the same counting convention. A point far below the roof motivates another investigation: insufficient reuse, small tiles, instruction mismatch, synchronizations or a different memory boundary. The roof does not identify that cause by itself.

Operational intensity is another name for arithmetic intensity when the counted byte boundary is the same.

To build a useful roofline, first choose the operation, precision and memory boundary. Then count its FLOPs and boundary-crossing bytes. Obtain matching hardware ceilings, compute intensity, and compare measured performance with the bound.

A roofline suggests a hypothesis, not a proven bottleneck
ObservationCandidate changeWhat to verify
Bandwidth ceiling is lowerReduce traffic; fuse, tile, reuse, coalesce or use a smaller representationActual boundary bytes and latency decrease without changing required results
Compute ceiling is lowerUse a suitable Tensor Core path, better tiles/instructions or fewer synchronizationsShapes and precision match; achieved kernels improve, not merely occupancy
Measured point is far below both ceilingsInspect launches, dependencies, instruction mix and hidden trafficFind the critical path in a representative trace

cuBLAS, fused kernels and FlashAttention are candidates for their supported operations. They are not interchangeable replacements for arbitrary code. Choose a change that addresses the measured operation and preserve its numerical contract.

Match precision, instruction path and memory boundary

Match the arithmetic to the precision and instruction path. Scalar FP32, TF32, BF16 Tensor Core and FP8 peaks are different ceilings. Structured-sparse specifications cannot be applied to an arbitrary dense matrix.

An Iridge calculation needs matching compute and bandwidth specifications. The historical example below uses the 40 GB A100, not an unspecified A100 variant. Do not mix its FP32 roof with BF16 weight arithmetic.

Increasing the relevant compute roof while holding bandwidth fixed moves the ridge right. That does not make memory-bound work faster. Lower-precision weights can instead reduce bytes; whether the compute path also changes is a separate question.

HBM, L2, shared memory, registers and inter-GPU links have distinct boundaries. An HBM roof counts HBM traffic, not every register access. Cache residency and tiling can change which boundary supplies the useful constraint. Use a relevant specification and a representative measurement rather than one universal GPU roof.

NVIDIA’s June 2021 A100 data sheet ↗ lists 19.5 TFLOP/s FP32 and 1,555 GB/s HBM bandwidth for the 40 GB PCIe and SXM variants. Dense BF16 Tensor Core peak is 312 TFLOP/s; the 624 value requires sparsity. These are manufacturer ceilings, not achieved measurements.

Iridge,FP32=19.5×10121555×109≈12.54Iridge,BF16 dense=312×10121555×109≈200.64\begin{aligned}I_{\rm ridge,FP32}&=\frac{19.5\times10^{12}}{1555\times10^9}\approx12.54\\I_{\rm ridge,BF16\ dense}&=\frac{312\times10^{12}}{1555\times10^9}\approx200.64\end{aligned}
Both ridges use the 40 GB A100 HBM ceiling and have units FLOP/byte. The compute paths differ. The sheet lists different bandwidths for 80 GB PCIe and SXM; do not reuse this pair for those variants.

Under the weight-dominated BF16 estimate, batch 32 has intensity about 32, below 200.64. It does not cross this BF16 roof. The FP32 ridge cannot justify the opposite conclusion. Extra activation/cache traffic and inefficient kernels can lower achieved performance further.

Reuse changes the bytes, not the mathematical result

Assigned traffic examples
OperationArithmetic and bytesInterpretation
FP32 y=a+b1 addition;4+4+4=12 bytes; I=112I=\frac1{12}Low intensity even with ideal access
Poor-reuse matmulAssigned I=0.25I=0.25 FLOP/byteLarge math alone does not establish efficient reuse
Ideal square FP16/BF16 GEMMF≈2N3,Q=6N2,I≈N3F\approx2N^3,\quad Q=6N^2,\quad I\approx\frac N3One read per input and one output write, beta=0
N=4096 ideal square GEMMI≈40963≈1365I\approx\frac{4096}{3}\approx1365About 1,365 FLOP/byte; ideal traffic; finite tiling/cache can reload inputs

On the assigned 1,555 GB/s FP32 bandwidth roof, the add ceiling is about 129.6 GFLOP/s. At I=0.25I=0.25 it is about 388.8 GFLOP/s, approximately 2% of 19.5 TFLOP/s. These are bounds from assigned traffic, not measured kernel results.

Fusion can keep a producer’s intermediate on chip instead of writing and rereading it from HBM. Tiling can reuse input blocks. Better coalescing can improve achieved bandwidth. Each intervention needs actual traffic and latency evidence; a theoretical one-read model can be unattainable for a finite working set.

Occupancy is not an independent objective. More registers or shared memory can lower residency while eliminating expensive traffic. Conversely, high residency does not guarantee useful throughput. Profiling and Kernel Optimization distinguishes these measurements.

Batching moves intensity toward the compute ceiling

For a small dense decode batch, leading forward projection work is roughly 2BP2BP FLOPs while BF16 weights contribute roughly 2P2P bytes. If weight traffic dominates, I≈BI\approx B FLOP/byte. Batch 1, 8 and 32 therefore have approximate intensities 1, 8 and 32—not universal compute-bound thresholds.

Weight reuse moves the dot, not the hardware roof

141664256Ceiling (TFLOP/s), log₂ scaleCompute roof: 200Ridge: 200 FLOP/B141664256512Arithmetic intensity (FLOP/byte), log₂ scale

Token rows=16; width=4096; weight bytes=2; FLOPs=2.147G; ideal traffic=134.873MB; intensity=15.922FLOP/B; ceiling=15.922TFLOP/s; ideal time=134.873µs.

The assigned compute roof stays 200 TFLOP/s and bandwidth stays 1 TB/s. This is not a real accelerator specification. Inputs/outputs stay 2 bytes. Weight-only compression changes traffic; conversion/scale costs are omitted. The dot is a ceiling, not a measured kernel. Weight reuse raises intensity, but the bandwidth roof still supplies the larger ideal time.

Input, output and KV-cache traffic keep the exact intensity below a weight-only estimate. Large token rows can reuse weights, but a limited matrix width or finite tiles constrain that benefit. Weight quantization changes traffic; scales, unpacking and the compute implementation can change the time too.

Prefill exposes many prompt-token rows and often larger GEMMs. Single-user decode often has little weight reuse. Long-context decode can instead be dominated by KV access. Batch, context, architecture and implementation determine the regime; phase names alone do not prove the bottleneck.

When comparing prefill and decode pools, preserve their distinct latency, memory and utilization requirements. A simplified BF16 weight model must use a matching BF16 compute roof, not the lower FP32 example to claim a real crossover.

Batching needs shared weights

Batching helps because several rows reuse one matrix. Merely grouping independent operations does not create that reuse.

Compare X[B,D]W[D,F]→Y[B,F]X[B,D]W[D,F]\to Y[B,F] with X[B,D]W[B,D,F]→Y[B,F]X[B,D]W[B,D,F]\to Y[B,F]. In the second contraction, each row has its own matrix. Both perform the same leading arithmetic, but their weight traffic differs.

Ishared=2BDF2BD+2DF+2BFIper row=2BDF2BD+2BDF+2BF=DFD+DF+F\begin{aligned}I_{\rm shared}&=\frac{2BDF}{2BD+2DF+2BF}\\I_{\rm per\ row}&=\frac{2BDF}{2BD+2BDF+2BF}=\frac{DF}{D+DF+F}\end{aligned}
B,D,F are positive integer row count, input width and output width. Every stored element uses two bytes. Count two leading FLOPs per multiply-add, one read of each input/weight and one output write; beta=0. Intensities are FLOP/byte.

For a weight-dominated shared matrix, Ishared≈BI_{\rm shared}\approx B. With distinct matrices and large widths, Iper row≈1I_{\rm per\ row}\approx1. The batch factor cancels in the second ratio.

Assigned two-byte comparison: D=64, F=128
RowsShared weight bytesDistinct weight bytesShared FLOP/byteDistinct FLOP/byte
116384163840.9770.977
8163841310726.7370.977
321638452428818.2860.977
12816384209715232.0000.977

The table is ideal accounting, not a benchmark. Cache residency, tiling and conversion can change actual traffic. In MoE, reuse depends on rows routed to the same expert, not the total input batch.

How to Scale Your Model, Rooflines: independent per-row matrices ↗ gives the one-byte variant. This comparison uses two-byte storage consistently.

MFU, HFU and calendar progress have different numerators

MFU=Fmodeltstep nCHFU=Fexecutedtstep nC\begin{aligned}\mathrm{MFU}&=\frac{F_{\rm model}}{t_{\rm step}\,nC}\\\mathrm{HFU}&=\frac{F_{\rm executed}}{t_{\rm step}\,nC}\end{aligned}
n≥1 devices, C>0 matching peak FLOP/s per device and tstep>0 seconds. Model and executed FLOPs use declared counting conventions over this same interval. No clamping: a ratio above one signals inconsistent inputs or conventions.

Model FLOPs utilization (MFU) estimates useful model arithmetic relative to the declared peak. Hardware FLOPs utilization (HFU), under this convention, includes recomputed arithmetic. A GPU-busy percentage or occupancy measures something else.

Busy hardware and committed progress have different denominators

Ideal assigned executed rate: 10 TFLOP/s; 6 TFLOPs model/stepCalendar fraction available for healthy steppingCommitted model arithmetic / assigned peak calendar arithmeticOther overheads omitted; step and calendar windows differ.

Downtime=20%; remat=no; step time=0.6s; healthy MFU=100%; healthy HFU=100%; calendar model fraction=80%.

Without rematerialization, assigned executed and model work both equal 6 TFLOPs. Downtime removes calendar progress, not FLOPs from the healthy-step numerator. Fractions are a constructed accounting example, not achieved hardware results. Replayed work must not be counted again as newly committed tokens.

End-to-end progress also loses time to checkpoints, failure, replay, recovery and degraded placement. Count accepted logical tokens only once. A replayed step can use the hardware effectively while adding no new durable progress.

Pair healthy-step efficiency with a calendar productivity measure and an explicit reference rate. If an end-to-end measured rate already includes downtime, do not discount it again. If executed work exceeds the declared peak interval, inspect units, FLOP convention, precision and timing instead of clamping the ratio to 100%.

MFU=1 means the declared useful-model FLOP rate equals the declared peak. It does not prove that every operation or every calendar interval is efficient.

Declare what the numerator counts
WorkUseful-model convention hereEffect on the timing window
Leading projection, attention and selected-expert matrix productsIncluded under the declared architecture conventionMatch actual tokens, masks and selected matrices
Activation recomputationExcluded from useful model work; included in the assigned executed-work HFUConsumes the same measured step interval
Elementwise/optimizer work, input delivery, CPU orchestration and synchronizationOutside a leading-matmul numerator unless explicitly addedTheir exposed time still belongs to a complete step
Checkpoint, startup, failure, replay and recoveryUse a separate calendar-progress boundaryA healthy-step MFU alone does not capture these losses

Use the same FLOP convention when comparing kernels, parallel layouts or regressions. High GPU-busy percentage can coexist with low useful arithmetic rate. High healthy-step MFU can coexist with poor durable progress. Follow run design and restart contracts for the operational checks. Frontier training recipes connect this distinction to the Llama 3 and MAI reports.

Reconcile a utilization claim before interpreting it

Consider eight devices, each assigned 10¹⁵ FLOP/s peak, and a 0.40 s step. Their available peak work is 3.2×10¹⁵ FLOPs. Keep this denominator fixed while checking the claimed numerator.

The original 1.2×10¹⁶ numerator gives 375%, not 37.5%. A consistent 37.5% example uses 1.2×10¹⁵ model FLOPs. The change is explicit; a ratio above one calls for an input/convention investigation, not clamping.

Favailable=0.40×8×1015=3.2×10151.2×1016Favailable=3.75inconsistent original input1.2×1015Favailable=0.375explicit corrected input\begin{aligned}F_{\rm available}&=0.40\times8\times10^{15}=3.2\times10^{15}\\\frac{1.2\times10^{16}}{F_{\rm available}}&=3.75\quad\text{inconsistent original input}\\\frac{1.2\times10^{15}}{F_{\rm available}}&=0.375\quad\text{explicit corrected input}\end{aligned}
Favailable is peak FLOPs available during the assigned 0.40-second, eight-device interval. The corrected numerator is ten times smaller; it is not a re-interpretation of the original number.
Fmodel≈6(7×109)(2×106)=8.4×1016Favailable=2.8(64)(1015)=1.792×1017MFU≈8.4×10161.792×1017=0.46875\begin{aligned}F_{\rm model}&\approx6(7\times10^9)(2\times10^6)=8.4\times10^{16}\\F_{\rm available}&=2.8(64)(10^{15})=1.792\times10^{17}\\\mathrm{MFU}&\approx\frac{8.4\times10^{16}}{1.792\times10^{17}}=0.46875\end{aligned}
This assigned 7B/2M-token example uses the 6PT convention, 64 identical devices, 2.8 seconds and 10¹⁵ FLOP/s/device. The original intermediate ratio 8.4/179.2 omitted a factor of ten; the final 46.9% result was correct.

Under these stated conditions, the second example gives about 46.9%. Both examples are assigned arithmetic, not measured training runs.

Small matrices, launch cost, exposed communication, routing imbalance and rematerialization can reduce MFU. Larger matrices can amortize fixed costs and improve achieved kernels. A smaller model’s lower MFU does not alone prove worse engineering.

Longer context does not inherently lower correctly counted MFU. It adds useful attention work and changes shapes, memory and kernels. Compare conventions and measured step time rather than treating every changed ratio as an efficiency regression.

A compute allocation is a scenario with units

Use consistent units before choosing a model. A billion is 10⁹; a trillion is 10¹². TFLOP/s is 10¹² FLOP/s, not a quantity of work. One day is 86,400 s; 30 days are 2.592×10⁶ s; 90 days are 7.776×10⁶ s.

Fnominal=nCutFcommitted=nCutg\begin{aligned}F_{\rm nominal}&=nCut\\F_{\rm committed}&=nCutg\end{aligned}
n≥1 devices, C>0 matching FLOP/s/device, t≥0 elapsed seconds, and dimensionless u,g∈[0,1]. u is healthy-step model efficiency; g is the calendar fraction producing new committed work at that reference rate. A repeated loss allocation must not be discounted twice.

An illustrative allocation has 256 H100 SXM devices, an assigned dense BF16 peak of 989 TFLOP/s each, 40% MFU and 90 days. Its nominal model-work budget is about 7.875×10²³ FLOPs. This is scenario arithmetic, not a measured run.

Reserving 25% of that allocation for other experiments, integration, evaluation, failures and finishing leaves about 5.906×10²³ FLOPs for the main run. Define whether that reserve already contains downtime. Applying both a failure reserve and the same downtime factor would charge it twice.

Illustrative sensitivity assumptions—not forecasts
ScenarioHealthy MFUUnavailable fraction
Conservative30%15%
Expected40%8%
Optimistic50%3%

Hardware peak and achieved utilization must match precision and density. A sparse or FP8 peak does not represent dense BF16 arithmetic. The highest uncertainty is often the achieved full-stack rate; rehearse representative work to narrow it.

For decimal scientific units, thousand, million, billion and trillion mean powers 3, 6, 9 and 12 of ten. PFLOP/s and EFLOP/s mean powers 15 and 18 FLOP/s. Keep intermediate arithmetic unrounded; round the planning result only after cross-checking it.

A feasible curve is not an equal-quality curve

T≈Fmain6P,P≈Fmain6TT\approx\frac{F_{\rm main}}{6P},\qquad P\approx\frac{F_{\rm main}}{6T}
Positive P,T and Fmain use the first-order dense 6PT projection convention. Correct for attention, output work and other architecture costs when they matter. A feasible compute pair is not an equal-quality claim.
Rounded feasibility points for about 5.91×10²³ FLOPs
ParametersTokensApproximate 6PT
7B14.1T5.92×10²³
13B7.6T5.93×10²³
30B3.28T5.90×10²³
70B1.41T5.92×10²³

Equal compute does not imply equal quality. Unique usable data, optimization risk, model capacity, serving cost, context and post-training needs constrain the choice. The rounded token counts need not match the envelope to the last digit.

Use scaling experiments to compare feasible candidates, not the resource calculator to infer accuracy. Scaling Laws connects data exposure, capacity and lifetime economics. For MoE, use an explicit active-work model alongside total-state memory.

Check the same plan in tokens and steps

For the same assigned 256-device, 40%-MFU case, useful rate is about 1.013×10¹⁷ FLOP/s. A 30B model uses about 1.8×10¹¹ FLOPs/token under 6P. The predicted healthy throughput is therefore about 563,000 tokens/s.

rtokens=F˙modelfmodel/tokentstep=Btokensrtokensnsteps=TBtokens\begin{aligned}r_{\rm tokens}&=\frac{\dot F_{\rm model}}{f_{\rm model/token}}\\t_{\rm step}&=\frac{B_{\rm tokens}}{r_{\rm tokens}}\\n_{\rm steps}&=\frac{T}{B_{\rm tokens}}\end{aligned}
Ḟmodel>0 is achieved useful-model FLOP/s; fmodel/token>0 is model FLOPs per token. Btokens>0 is tokens per optimizer step and T≥0 is target tokens. The step ratio is idealized; partial final steps need a policy. Do not multiply the achieved rate by MFU again.

A four-million-token batch takes about 7.1 s. Training on 3.28T tokens takes 820,000 optimizer steps. Their healthy duration is about 67 days, consistent with roughly 75% of a 90-day allocation.

Check the plan both ways: total arithmetic divided by useful rate, and step count times measured step duration. If they disagree, inspect token definition, padding, accumulation, stage changes, rounding and timing windows. A healthy-step estimate needs a separate calendar allowance.

Count independent data, not cooperating model ranks

Btokens=Bmicro S G DdpB_{\rm tokens}=B_{\rm micro}\,S\,G\,D_{\rm dp}
Bmicro: sequences per local microbatch; S: tokens/sequence; G: accumulation steps; Ddp: independent data replicas.

Do not multiply by tensor- or pipeline-parallel degree. Those ranks cooperate on the same replica’s data. A global device count is not necessarily the data-parallel degree.

With Bmicro=1B_{\rm micro}=1, S=8192S=8192, G=16G=16 and Ddp=32D_{\rm dp}=32, the batch is 4,194,304 tokens. At 563,000 tokens/s, predicted healthy step time is about 7.45 s. This is a different batch from the four-million-token example, not a contradiction.

State whether padding and masked positions count as processed work, training targets or useful tokens. Packing can reduce wasted positions. Accumulation changes optimizer-step count without multiplying the number of independent parameter replicas.

Build state memory from its actual components

One illustrative mixed-precision Adam layout
StateBytes per parameter
BF16 model weights2
BF16 gradients2
FP32 master weights4
FP32 first moment4
FP32 second moment4
Total16

This layout is conditional. Some stacks omit master weights, keep gradients in FP32, quantize states or hold extra buffers. Enumerate the implementation rather than treating 16 B/P as a universal constant.

Decimal storage, excluding activations and temporary memory
ParametersBF16 weightsIllustrative full state
7B14 GB112 GB
13B26 GB208 GB
30B60 GB480 GB
70B140 GB1.12 TB

If every state component were perfectly sharded over D ranks, its persistent share would be 16PD\frac{16P}D bytes. Real layouts shard different components differently. A gather can materialize a larger weight tensor temporarily even while persistent storage remains sharded.

Use total stored MoE parameters here, not only active parameters. Include metadata, alignment and actual distributed ownership. Decimal GB means 10⁹ bytes; GiB means 2³⁰ bytes. Do not switch units silently.

A model can fit persistently and fail at peak

Mpeak=max⁡τ∈T∑jMj(τ)M_{\rm peak}=\max_{\tau\in\mathcal T}\sum_j M_j(\tau)
𝒯 is the declared observation interval. Mⱼ(τ) are disjoint live-byte categories, such as state, activations, workspaces and buffers. Count shared storage once. Sum at each time before taking the maximum; allocator-reserved capacity is a different boundary.

A coarse activation term scales with microbatch sequences, context, layers and hidden width: BmicroSLWB_{\rm micro}SLW. The coefficient depends on saved tensors, backward kernels, checkpointing and sharding. Naive attention can add quadratic score/probability storage.

FlashAttention-style kernels avoid materializing the complete attention matrix. Selective or full checkpointing reduces retained values while adding recomputation. Neither policy can be inferred from parameter count alone.

Estimate a candidate analytically, then measure a representative full block and complete step. Leave explicit headroom for collective buffers, workspaces, allocator fragmentation and unexpected shapes. A configuration with only a few percent spare capacity is fragile, not a proven safe deployment.

Inference also stores the past

Training activations and inference caches have different lifetimes. Autoregressive inference retains keys and values so that later queries can attend to earlier tokens without recomputing their projections.

mKV/token=2LHkvKq,MKV=BS mKV/tokenm_{\rm KV/token}=2LH_{\rm kv}Kq,\qquad M_{\rm KV}=BS\,m_{\rm KV/token}
L,Hkv,K are positive layer count, KV-head count and head width. q>0 is bytes/cache element; B,S≥0 are sequences and retained tokens/sequence. The factor two counts keys and values. This is an unsharded uniform full-context payload, not allocated device memory.
Assigned cache comparison: 32 layers, 32 query heads, head width 128, BF16, one 8,192-token sequence
LayoutKV headsBytes per retained token, all layersLogical cache
MHA32524288 B4 GiB
GQA8131072 B1 GiB
MQA116384 B0.125 GiB

The cache formula uses KV heads, not query heads. At fixed layer count, head width and precision, changing 32 KV heads to 8 reduces this payload fourfold. This comparison does not claim equal model quality or measured speed.

Mixed local/global layers require a sum over each layer’s retained length. Latent caches, shared prefixes, cache sharing and quantization metadata need their own inventory. Paging, reserved capacity and temporary buffers change allocated memory. Serving Models explains cache ownership and scheduling; Attention explains the head layouts.

Count the bytes on the relevant path

Vring≈2(D−1)D Mtlink≥Vringβeffective\begin{aligned}V_{\rm ring}&\approx\frac{2(D-1)}{D}\,M\\t_{\rm link}&\ge\frac{V_{\rm ring}}{\beta_{\rm effective}}\end{aligned}
D≥2 participants and M≥0 payload bytes; balanced ring reduce-scatter plus all-gather count outgoing bytes per rank. βeffective>0 is the corresponding path bytes/s. This transfer bound excludes startup and assumes matching byte/direction boundaries.

Collective startup, dependency readiness, topology and contention add time. Match byte volume to the effective path bandwidth and message regime. Bidirectional totals and per-direction bandwidth must not be mixed.

Some communication overlaps backward computation. Sum of individual collective durations is not automatically exposed step time. Inspect critical-path ranks and the work that depends on completion.

ρ=texposed communicationtstep\rho=\frac{t_{\rm exposed\ communication}}{t_{\rm step}}
tstep>0 and texposed communication≥0 use the same critical-path interval. This investigation ratio is not an additive resource-utilization fraction; summing concurrent profiler durations does not measure exposed time.

Possible changes include group placement, parallel degrees, larger useful compute per collective, overlap, pipeline scheduling, sequence parallelism and expert balance. Each changes another constraint too. Follow Parallelism for the ownership mechanisms; the communication implementation requires separate evidence.

Storage bandwidth is only part of a checkpoint pause

Checkpoint storage includes weights and the state required by the restart contract. A 30B BF16 model is about 60 GB; the illustrative full 16 B/P state is about 480 GB. Distributed formats, manifests and temporary duplication add requirements.

At an assigned aggregate 20 GB/s, transferring 480 GB takes at least 24 s. The observed pause can also include consistency, synchronization, metadata and filesystem behavior. Storage serialization time is not the complete save or restore time.

If a 60 s pause occurs once per 1,800 s elapsed cycle, its fraction is 3.33%. If 1,800 s instead means useful work between pauses, the fraction is 601860≈3.23%\frac{60}{1860}\approx3.23\%. State the interval convention.

Asynchronous saving can hide some pause but needs a consistent snapshot and completion before retirement. A file write is not automatically a durable recoverable checkpoint. Pretraining: Experiments and Run Design owns the restart transaction and validation.

Short pauses and rollback compete for useful time

I∗≈2CM,E[trollback]≈I2I^*\approx\sqrt{2CM},\qquad \mathbb E[t_{\rm rollback}]\approx\frac I2
C,M>0 are checkpoint pause and job-level mean time between failures in matching units; I is a useful-work interval. This first-order approximation omits restart/correlation effects. The rollback mean uses an approximately uniform failure position within that interval.

For C=1 minute and M=360 minutes, the approximate interval is 720≈26.8\sqrt{720}\approx26.8 minutes. Longer intervals reduce checkpoint frequency but increase average rollback. The objective is productive time, not the fewest pauses.

This simple result assumes an approximate failure model and small overheads. Restart, correlated failures, asynchronous saves, contention and interval conventions require refinements. Uniform failure position within a checkpoint interval motivates I2\frac I2; it is not guaranteed for every failure process.

At scale, use job-level failure behavior rather than only one device’s reliability. Include save, rollback, restore and reconfiguration. A failure rehearsal can test the operational contract even when healthy-step MFU looks strong.

Small average payload can still hide a slow input path

At four bytes per token ID, 3.28T stored token IDs occupy about 13.12 TB. Reading that payload once over 67 days averages roughly 2.27 MB/s. That small average does not prove a loader is fast enough at every step.

Millions of small objects, remote metadata, parsing, decompression, shard imbalance, reshuffling and shared-storage contention can create stalls. Prefetch and dynamic sequence construction also affect tail delivery. Repeated exposure or extra fields change the payload model.

Plan storage for immutable raw and normalized data, tokenized versions, manifests, optimizer checkpoints, evaluations, logs, profiles, temporary saves, retention and disaster recovery. Average payload, request rate, CPU work and burst/tail behavior are separate constraints.

Inspect the path that supplies the next batch, not only its monthly byte total. A full-stack rehearsal connects this estimate to input delivery and run design.

Separate a hypothetical rate from a total cost

Haccelerator=n×24×ddaysCcompute=Haccelerator phourly\begin{aligned}H_{\rm accelerator}&=n\times24\times d_{\rm days}\\C_{\rm compute}&=H_{\rm accelerator}\,p_{\rm hourly}\end{aligned}
n is accelerator count, ddays≥0 elapsed days and phourly≥0 assigned currency units per accelerator-hour. Twenty-four converts days to hours. The rate is hypothetical unless tied to a dated contract; currency is unspecified here.

256 accelerators for 90 days give 552,960 accelerator-hours. Rates of 3, 6 and 10 units per accelerator-hour give approximately 1.66M, 3.32M and 5.53M units. These are scenario costs, not market quotes.

Add CPU hosts, network, storage, support, evaluation, idle allocation, failed runs and engineering. Reserved capacity can bill unavailable or unused time. For owned infrastructure, distinguish purchase cost from amortized cost and include power, cooling, facilities and operations.

Use a sensitivity range and an explicit accounting boundary. Lower healthy step time does not automatically reduce a fixed reservation bill, although it can create capacity for additional useful work.

Serving volume changes the model-size decision

Clifetime=Ctrain+V cinference(P)C_{\rm lifetime}=C_{\rm train}+V\,c_{\rm inference}(P)
V≥0 is lifetime served tokens and cinference(P) is cost/token under an explicit workload and serving implementation. All costs use the same currency and accounting scope. This chosen model omits any separately uncounted lifecycle costs.

At high serving volume, extra training of a smaller model can be preferable if it meets the quality target. At small volume, the one-time training budget can dominate. Neither outcome follows from model size alone.

Include latency, memory, required parallel group, batch distribution and long-context behavior. A model that trains efficiently can still require an expensive serving layout. Inference-aware scaling provides the model/data allocation view; serving mechanisms determine the recurring rate.

Do not reuse one utilization estimate across every phase

Short-context pretraining, long-context continuation, post-training rollouts and serving do not share one resource profile. Context can add quadratic attention, reduce microbatch size and change achieved kernels. Data supply and evaluation also change.

For each stage, count its operations, estimate attainable memory/batch, measure its rate, and allocate its elapsed time. Sum the stage budgets under consistent useful versus executed conventions. Do not extrapolate a short static GEMM’s utilization to a complete long-context job.

For long-context continuation, budget suitable long documents, retrieval/extrapolation evaluation and short-context regression tests. Different evidence answers different questions: arithmetic feasibility, system throughput and model quality remain separate.

A compact resource worksheet and cross-check

Resource worksheet—state the assumption before the result
GroupFields to record
ObjectiveTarget capability and evaluation metrics; latency/quality boundary
AllocationDevice type/count; relevant peak; MFU range; downtime/goodput; wall time; main-run fraction
WorkActive and stored parameters; training tokens; context; global tokens/step; tokens/s; step time; optimizer steps
MemoryBytes/state component; activation estimate; workspaces/buffers; persistent and peak sharding layout
TopologyParallelism mapping; largest collective; relevant link and effective bandwidth
ContinuityCheckpoint size/interval; storage footprint; recovery behavior; evaluation and contingency budget
EconomicsTraining/lifetime cost range; largest uncertainty; rehearsal to reduce it

Check these common failures: wrong sparse/precision peak; applying MFU twice; confusing total and active MoE capacity; multiplying batch by model-parallel ranks; missing accumulation; treating 6PT as exact at long context; charging remat twice; perfectly dividing every memory term; omitting gathers/buffers; mixing GB/GiB; calling healthy MFU calendar progress; spending the entire allocation on the main run; quoting an undated price.

A complete estimate answers how long, whether it fits, what the batch means, which communication remains exposed, how restart works, and what the cost includes. State the least trustworthy assumption and a test. Consistent arithmetic makes a design plausible; representative execution and evaluation determine whether it works.

For communication, record collective frequency as well as the largest payload. For memory, measure allocated and reserved peaks separately. For restart, include restore and reconfiguration, then validate the plan with an injected-failure rehearsal. These checks test the assumptions that simple arithmetic cannot establish. The largest uncertainty can be achieved MFU, unique usable data volume, full-scale stability or overlap. Name it and choose a rehearsal that reduces it.

Qwen: optimize the resource that each phase actually uses

The same architectural change has different costs in training, prefill and decode. Qwen makes that distinction explicit. A FLOP reduction is not enough if the implementation adds a memory bottleneck or a long tail of tiny kernels.

Reported systems choices and the bottleneck each addresses
PathChangeBoundary of the claim
GDN trainingTileLang FlashQLA fused kernels2–3× forward and about 2× backward versus FLA Triton across reported GPU settings; not whole-run speedup
Long-context attentionCompressed selector plus sparse core attentionAt 1M: 7.6× prefill and 4.9× decode attention-module speedup versus FlashInfer paged GQA
Residual streamRemove branch mixing; separately fuse read/write; FP8 storageHalf the residual-state storage bytes versus BF16, not half all traffic
N-gram lookupHost-memory storage; asynchronous prefetch for Layer 2Overlap Layer 1 computation; not zero host-memory or transfer cost
Muon distributed stepBalance estimated NS FLOPs; reconstruct whole logical matricesEqual parameter counts are not equal optimizer work
Split-parameter updateCapture the optimizer step in a CUDA graphAmortize many small kernel launches; not a megakernel

Attention prefill measurements use the last 16K-token chunk, batch size 1. Decode uses batch size 4 and next_n=4, including three additional MTP steps. Both selector and sparse core attention count in the attention-module comparison. These are not full-prompt prefill timings or end-to-end generation multipliers. The figure does not provide enough hardware detail to turn the ratios into a universal device forecast.

Deterministic n-gram addresses are known from tokens before Layer 2 runs. That permits prefetch while Layer 1 computes. A single lookup layer avoids repeated transfers at several depths. As a capacity illustration only, 51B parameters at two bytes each occupy 102GB decimal before optimizer states or metadata. The report does not declare that hypothetical payload to be the actual table storage precision.

Why equal-size sharding is wrong for Muon work

FNS(A,B,K)≈4Kmax⁡(A,B)min⁡(A,B)2F_{\rm NS}(A,B,K)\approx4K\max(A,B)\min(A,B)^2
Approximate orthogonalization FLOPs for K iterations on an A × B matrix. It depends strongly on shape, not only AB parameters.

For K=8, a 4096×4096 matrix costs about 2.20 trillion orthogonalization FLOPs under this estimate. A 1024×16384 matrix contains the same number of parameters but costs about 0.55 trillion. These are calculated arithmetic examples, not measured step times.

Canzona separates logical optimizer ownership from physical tensor layout. A static partitioner assigns whole matrices across data-parallel ranks using estimated NS cost. An asynchronous Micro-Group pipeline reconstructs each matrix with fused all-to-all across tensor-parallel ranks. The owner then performs an update mathematically equivalent to unsharded Muon. Existing ZeRO-1 bucket geometry and reduce-scatter/backward overlap remain intact.

After semantic splitting, one layer can contribute roughly a hundred submatrices. Their updates become launch-bound. Capturing the step in a CUDA graph reduces dispatch overhead without turning it into one fused kernel. Validate full-matrix equivalence, reconstruction buffers, matrix ownership, critical-rank time and resume state before measuring throughput.

The full system still needs model weights, KV/recurrent states, residual buffers, lookup storage and optimizer state. The report does not disclose a complete cluster topology or production GPU-hours. Collectives and ownership → · Semantic optimizer splitting → · Compute claims →.

Qwen3.8-Next architecture report, §§2.1–2.3 and 3.1, Figures 1 and 6 (26 August 2026) ↗.

Sources and connected topics

The interactive examples are original ideal accounting models, not measured hardware traces or reconstructed benchmarks. Continue with Attention for operator/IO mechanisms, Precision and Quantization for numerical contracts, and Speculative Decoding for reducing serial generation work.