Token throughput estimator
Generating text one token at a time is mostly a memory problem. Every decode step reads all of the model’s weights, and the KV cache of every sequence in the batch, from GPU memory. The arithmetic for one token is small by comparison, so a single user rarely keeps the GPU’s compute busy.
2,037 tokens/s across 16 sequences (127 tokens/s each) on 1 × NVIDIA H100 SXM. Memory-bound at every batch size.
Model, hardware and workload
8B parameters, all used for every token.
80 GB, 3.35 TB/s, 989 dense TFLOPS (16-bit)
Modelled as ideal: bandwidth and FLOPS add up, communication costs nothing.
Our assumption, not a measured figure: real kernels fall short of the datasheet peak.
Our assumption. For scale, Pope et al. measured 76% on large-batch prompt processing with a tuned TPU setup.
The rest is left for activations and runtime overhead. vLLM’s default is 90%.
Speed and memory
Each step reads 18.4 GB per GPU, which takes 7.85 ms. The arithmetic needs only 647 µs. A bigger batch adds tokens almost for free until the two meet.
| Per decode step | Bytes read | Time |
|---|---|---|
| Weights | 16 GB | 6.82 ms |
| KV cache at 1.2K tokens | 2.4 GB | 1.03 ms |
| Arithmetic, 256B FLOPs | n/a | 647 µs |
Request time: 2.66 s for 1K tokens in and 256 out.
What it shows
This estimator uses a roofline model: a step takes as long as the slower of reading its bytes and doing its arithmetic. Pick a model, a GPU, a precision and a batch size to see the step time, the speed each user sees, the total tokens per second, and whether memory or compute sets the limit.
It is an estimate for planning, not a benchmark. Real servers lose time to scheduling, sampling, communication between GPUs and kernels that don’t reach peak speed. The two percentage inputs stand for that loss, and you should replace the defaults with numbers you measure.
How to read it
- Inter-token latency is one decode step: the longer of memory time and compute time. Memory time reads the weights and the average KV cache; compute time is 2 × active parameters × batch.
- “Per user” is one divided by the step time. Aggregate throughput multiplies it by the batch, so it grows until compute takes over.
- Time to first token is the prefill: 2 × active parameters × prompt tokens × batch of arithmetic, never faster than one read of the weights.
- The chart plots memory time (solid) and compute time (dashed) against batch size. Where they cross, decode becomes compute-bound.
- “Never” in “Compute-bound above batch” means cache reads outgrow the arithmetic, so a bigger batch only saves the shared weight reads.
- The two percentages are our assumptions, not measured. For scale, Pope et al. measured 76% on large-batch prompt processing with a tuned TPU setup.
- Multi-GPU is modelled as perfect scaling, so treat it as an upper bound. For mixture-of-experts models, bytes use all experts and arithmetic only the active ones.
Questions
Why is LLM decoding memory-bound?
A decode step produces one token per sequence but must read every weight (and the KV cache) from GPU memory. Each weight is used for only a couple of floating-point operations per sequence, so the GPU waits on memory long before its arithmetic units are busy. Batching reuses each weight read for more sequences, which is why total throughput rises with batch size.
What is the roofline model?
It says a computation takes at least as long as moving its data and at least as long as doing its arithmetic, so its speed is capped by whichever is slower. The ratio of arithmetic to bytes moved decides which limit applies. Williams, Waterman and Patterson introduced it in 2009, and Pope et al. apply the same reasoning to transformer inference.
What are good values for bandwidth efficiency and MFU?
There is no universal figure. Good kernels reach a large share of peak bandwidth, but the share depends on the GPU, the kernel and the batch. Pope et al. report model FLOPS utilisation of 76% for prefill on their setup. Measure your own stack and replace the defaults.
Why does the estimate differ from my benchmark?
The model leaves out scheduling, sampling, tokenisation, attention arithmetic, communication between GPUs and the cost of padding or fragmentation. It also reads the KV cache at the average context length. Use it to see which resource limits you and by how much, then check it against a real run.
Does quantising the weights make decoding faster?
When decode is memory-bound, yes: fewer bytes per weight means a shorter read, so the step gets shorter in proportion. The gain shrinks as the KV cache grows, because the cache is not reduced by weight quantisation. If your kernels have to dequantise on the fly, they may not reach the same bandwidth efficiency, so lower the efficiency to match.
Sources
- Pope et al. (2022). Efficiently scaling transformer inference.
- Williams, Waterman and Patterson (2009). Roofline: an insightful visual performance model for multicore architectures.
- Kwon et al. (2023). Efficient memory management for large language model serving with PagedAttention.
- Llama Team, Meta (2024). The Llama 3 herd of models.
Last updated
More tools
All tools- simulatorRequest batching simulatorRun the same LLM requests through static and continuous batching and compare latency and throughput.Open tool
- simulatorSpeculative decoding simulatorFind the draft length that speeds up LLM decoding most, and watch drafts get accepted or rejected.Open tool
- estimatorQuantisation memory plannerSee how much GPU memory a model needs at each precision, and how many GPUs that takes.Open tool