Transformer FLOPs and latency calculator

Prefill is compute-bound while single-user decode is starved by HBM memory bandwidth. Adjust parameter count, GPU hardware, and batch size below to find your roofline ridge point and real TTFT.

Interactive calculator

Precision TierPrefill TTFTDecode LatencySystem tok/sRidge Batch

How to beat roofline bottlenecks in LLM serving

  1. Quantize weights to FP8 or INT4 when memory-bound. At batch sizes below the ridge point, cutting weight bytes in half doubles decode tok/s because every step streams weights out of HBM.
  2. Enable chunked prefill to protect decode TPOT. Long 16K prompts can stall co-located decode requests for hundreds of milliseconds unless prefill is sliced into 512-token chunks.
  3. Disaggregate prefill and decode pools at high QPS. Compute-heavy prefill nodes run best with high TFLOPS GPUs, while decode nodes care most about HBM bandwidth per dollar.
  4. Measure effective bandwidth at 75% to 82% of spec. No real kernel hits 100% theoretical HBM bandwidth. Always size SLAs against achieved bandwidth rather than marketing datasheets.

Common questions

Why is LLM decode usually memory-bandwidth bound?

Generating one token reads every model weight from HBM once while doing only 2*P FLOPs. On an H100, tensor cores finish that math far faster than HBM can stream the weights.

What is the roofline ridge batch size?

The ridge batch is the concurrent batch size where decode math FLOPs finally catch up to HBM weight-read time. Above it, adding more requests increases per-token latency.

How accurate is the 2N FLOPs rule for prefill?

For prompts under 8K tokens, 2*P*T captures over 90% of prefill compute. Above 16K tokens, quadratic attention FLOPs add an extra term proportional to sequence length squared.

Does adding more tensor-parallel GPUs always cut latency?

It cuts weight-read time linearly, but NVLink all-reduce synchronization adds 10% to 18% overhead per layer, so diminishing returns kick in past TP4 for 70B models.

All calculations run 100% locally in your browser with zero external API calls. Hardware specs and hourly rates reflect published 2026 cloud and silicon datasheets.