What a 128K prefill actually costs: flops, wall-clock, energy and dollars
Fields
flops/ctx-128k-prefill-compute-costNotes
MEASURED CROSS-CHECKS, because the numbers above are arithmetic and these are measurements, and they disagree in an informative way. GeneralCompute's 128K-input TTFT leaderboard (batch 1, cold cache, 512 output tokens, three runs median, hardware not stated) gives Qwen2.5 7B 2.1 s, Llama 4 Scout 4.2 s, Gemma 3 27B 8.7 s, DeepSeek V3 9.8 s, Qwen2.5 72B 12.4 s, Mistral Large 14.1 s. Those are 5-10x FASTER per token than the single-H100 arithmetic predicts for the larger models, which means the leaderboard is running tensor-parallel across several cards with high MFU - a reminder that a single-card flops figure is a floor, not a prediction. vLLM on 2xH100 with a 218B-total/25B-active W4A4 Command A gives the cleanest single measurement of the L-dependence because it sweeps context on one system: TTFT 512 tokens 78 ms, 2K 216 ms, 8K 785 ms, 32K 3,390 ms, 64K 7,290 ms, 128K 16,800 ms - i.e. 4x the tokens from 32K to 128K costs 5.0x the time, slightly superlinear, consistent with the quadratic term starting to matter in a 32-layer model with only 24 full-attention layers. Saturated prefill throughput on the same system falls with length: 11,587 tok/s at 512 (B=85), 10,084 at 32K (B=4), 8,080 at 128K (B=3), and the record's own reading is that per-token cost is about 35 percent above its 8K best by 128K. On GB300 with DeepSeek-R1 and FP8 KV, 128K input / 8K output under PD disaggregation and chunked PP gives TTFT 8,600 ms - versus over 15,000 ms unchunked. ENERGY AND DOLLARS, which is where an operator actually feels it. At 50 percent MFU on one 700 W H100, converting GPU seconds to facility kWh with the LBNL 2024 national-average PUE for AI-serving facilities of 1.145: a 128K prefill is 1.0 Wh for Llama-3.1-8B (4.54 s), 4.7 Wh for DeepSeek-V3 (21.31 s), 8.5 Wh for Llama-3.1-70B (37.98 s), 14.7 Wh for Mistral-Large-2411 (66.03 s). Priced at Azure's on-demand ND96isr rate of $98.32 per 8xH100 instance-hour, i.e. $12.29 per H100-hour, the COMPUTE COST OF ONE 128K PREFILL is roughly $0.0023 (8B), $0.011 (DeepSeek-V3), $0.019 (70B) and $0.034 (Mistral-Large), and at the H100 SXM market floor of $6.16/hour it is under a tenth of a cent in every case. THE DOLLAR FIGURES ARE THE MOST IMPORTANT NEGATIVE RESULT IN THIS RECORD: prefill compute is essentially free next to the memory cost of HOLDING the resulting cache. One 128K sequence of Llama-3.1-70B KV is 40 GiB and, on an 8xH100 node at TP4, costs about 5.1 GPU-hours of amortization per hour of holding at 3.8 concurrent sequences - three orders of magnitude more than the prefill that created it. An operator who optimizes prefill MFU is optimizing the cheap term. THE TTFT-vs-THROUGHPUT TRADE IS ALSO NOT SYMMETRIC: TTFT grows quadratically in input length (fitted as a*L^2 + b*L + c) while ITL grows linearly (slope*input_len + intercept), so chunked prefill and PD disaggregation buy TTFT at the cost of scheduling complexity, and the repo's own Kairos TTFT breakdown record exists because TTFT at long context decomposes into prefill compute, queueing and KV transfer, only the first of which this record prices. CAVEATS: MFU assumptions of 30-50 percent are engineering estimates for a large batch of long prompts, not measurements from this repo; the LBNL figure is a national average PUE for facilities serving AI equipment, not a specific data center; the Azure price is on-demand Linux/consumption in eastus, with spot at $2.27 per H100-hour and reservation around 36 percent cheaper; and none of these include the decode phase that follows, which at typical output lengths is orders of magnitude cheaper again but which occupies the sequence's KV cache for its entire duration.