LLM Tokens per Second: What Sets Speed and How to Measure
LLM tokens per second is the rate at which a model writes its answer, and for a single user it is capped by one ratio: how fast the GPU can read memory, divided by how many bytes it has to read for each token. For a dense model that is roughly the whole set of weights. An 8B model at 4-bit is about 4.8 GB, so on a GPU with 864 GB/s of bandwidth the ceiling is about 180 tokens per second, and real servers land somewhat below it.
That single number hides three others that matter just as much in production: how long the user waits before the first token appears, how speed per user changes when 30 people share the GPU, and how much total throughput the server delivers. This post explains each one, shows the arithmetic, and ends with a short script that measures all of them against any OpenAI-compatible endpoint.
Prefill and decode are two different jobs
Every request runs in two phases, and they are limited by different parts of the GPU.
Prefill reads your whole prompt in one pass and builds the KV cache, the stored attention keys and values for every token. Because all prompt tokens are processed in parallel, prefill is limited by compute, not memory. Its cost grows with prompt length: a rough rule is 2 floating-point operations per parameter per prompt token, so a 4,000-token prompt to an 8B model is about 64 trillion operations.
Decode produces the answer one token at a time. Each step needs the full model weights plus that request's KV cache, and the arithmetic per byte read is small, so the GPU spends most of each step waiting on memory. That is why decode speed tracks memory bandwidth so closely. Our KV cache explainer covers what is in the cache and why it grows with context.
Two user-facing numbers come out of this:
- Time to first token (TTFT) is queue time plus prefill. Long prompts, such as a RAG request with 20 retrieved chunks, raise it even on an idle server.
- Output tokens per second is decode speed for that request. Some tools report its inverse, time per output token (TPOT), in milliseconds.
Total response time is about TTFT plus output tokens divided by tokens per second. A 400-token answer at 50 tokens per second with 0.5 s TTFT takes 8.5 s.
LLM inference speed from first principles
For one request on a dense model:
max tokens/s ~ memory bandwidth / (weight bytes + KV cache bytes for that request)
At short context the KV cache term is small and you can drop it. Some ceilings, using vendor bandwidth figures and weight sizes of about 0.6 bytes per parameter at 4-bit and 1.06 at 8-bit:
| Model and quantization | Weights | L40S (864 GB/s) | RTX PRO 6000 (1,597 GB/s) | H100 SXM (3,350 GB/s) | H200 (4,800 GB/s) |
|---|---|---|---|---|---|
| 8B at 4-bit | ~4.8 GB | ~180 | ~330 | ~700 | ~1,000 |
| 8B at 8-bit | ~8.5 GB | ~100 | ~190 | ~390 | ~560 |
| 70B at 4-bit | ~42 GB | does not fit | ~38 | ~80 | ~114 |
| 70B at 8-bit | ~74 GB | does not fit | ~22 | does not fit | ~65 |
Bandwidth figures are from NVIDIA's L40S, RTX PRO 6000 Blackwell Server Edition, H100 and H200 pages. These are upper bounds, not predictions. Kernels never reach the full rated bandwidth, and every step has fixed overhead for sampling and scheduling. As a planning estimate, not a measured constant, expect a well-tuned server to reach somewhere around half to three quarters of the ceiling for a single stream. The best GPU for LLM inference post compares more cards on the same basis.
Two consequences follow. A GPU with more compute but the same bandwidth will not write faster for one user. And a long conversation slows down as it goes, because each step reads a bigger KV cache: at 32K tokens, Llama 3.1 8B's cache is 4 GB, nearly as large as its 4-bit weights.
Quantization changes bytes, so it changes speed
Fewer bits per weight means fewer bytes read per token. Going from 8-bit to 4-bit roughly halves the weight bytes, which is why the table above nearly doubles. In practice the gain is smaller than 2x, because the GPU has to unpack the 4-bit values before using them and that work is not free. Some formats unpack faster than others on a given GPU and engine; our LLM quantization guide covers the quality side of the trade.
This is one reason we benchmark rather than calculate. In AI Refinery, a self-hosted LLM platform, every quantization variant in the catalog is measured before it is listed, with its size on disk, the GPU memory it needs at the full context window and its measured tokens per second. Picking between a Q4 and a Q8 variant becomes a choice between two measured numbers. The AI Refinery private model catalog shows how models and their variants are offered.
Mixture-of-experts: active parameters set the speed
A mixture-of-experts (MoE) model activates only some of its weights for each token. Qwen3-30B-A3B has 30.5B parameters in total and 3.3B activated, and gpt-oss-120b activates about 5.1B of its 117B.
For speed, use active parameters in the formula. Qwen3-30B-A3B at 4-bit reads roughly 2 GB per token, so its ceiling on an L40S is in the hundreds of tokens per second, far above a dense 30B model. For memory, use total parameters, because every expert must stay loaded. Real MoE speed sits further below the ceiling than dense models do: routing tokens to experts adds overhead, and under batching different requests hit different experts, so more of the weights get read per step.
Per-user speed vs aggregate throughput
This is where most capacity planning goes wrong. Batching servers run many requests through the same decode step. The weights are read once per step and shared by every request in the batch, while each request still reads its own KV cache.
Take Llama 3.1 8B at 8-bit on one H100 SXM, with each user at 4K tokens of context (about 0.5 GB of KV cache each). Using the bandwidth model:
| Concurrent requests | Bytes read per step | Per-user ceiling | Aggregate ceiling |
|---|---|---|---|
| 1 | 8.5 + 0.5 = 9 GB | ~370 tokens/s | ~370 tokens/s |
| 16 | 8.5 + 8 = 16.5 GB | ~200 tokens/s | ~3,250 tokens/s |
| 64 | 8.5 + 32 = 40.5 GB | ~83 tokens/s | ~5,300 tokens/s |
Going from 1 to 16 users cost each user about half their speed and multiplied the server's total output by almost nine. Past that, the KV cache dominates the bytes read, per-user speed keeps falling, and aggregate gains flatten. At large batches compute also starts to matter, and the bandwidth model no longer describes the whole picture, which is another reason to measure.
The trade-off between throughput and latency is a product decision. A chat assistant needs each user to stay above reading speed; a rough estimate is 5-6 tokens per second for 250 words a minute, though people skim faster, so 20 or more feels responsive. A nightly batch job that summarizes 50,000 tickets only cares about aggregate throughput. Set the per-user floor first, then find the concurrency that keeps it at p95. Our vLLM vs Ollama comparison explains continuous batching, and the LLM load balancing post covers spreading load across servers once one is full.
How to measure LLM tokens per second yourself
The script below sends streaming requests to any OpenAI-compatible /v1/chat/completions endpoint at increasing concurrency and reports TTFT, per-user decode speed and aggregate throughput. It counts streamed chunks as tokens, which matches most servers (one token per chunk) but can undercount if a server groups tokens.
# pip install openai
import asyncio, os, statistics, time
from openai import AsyncOpenAI
client = AsyncOpenAI(base_url=os.environ["BASE_URL"], api_key=os.environ["API_KEY"])
MODEL = os.environ["MODEL"]
PROMPT = "Explain how a heat pump works in about 300 words."
async def one_request():
start = time.perf_counter()
first, chunks = None, 0
stream = await client.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": PROMPT}],
max_tokens=400,
stream=True,
)
async for event in stream:
if event.choices and event.choices[0].delta.content:
if first is None:
first = time.perf_counter()
chunks += 1
end = time.perf_counter()
decode = (chunks - 1) / (end - first) if chunks > 1 else 0.0
return first - start, decode, chunks
async def run(users):
t0 = time.perf_counter()
results = await asyncio.gather(*[one_request() for _ in range(users)])
wall = time.perf_counter() - t0
ttft = sorted(r[0] for r in results)
decode = [r[1] for r in results]
total = sum(r[2] for r in results)
print(f"{users:>3} users | TTFT p50 {statistics.median(ttft):.2f}s max {ttft[-1]:.2f}s"
f" | per-user {statistics.median(decode):.1f} tok/s"
f" | aggregate {total / wall:.0f} tok/s")
async def main():
await one_request() # warm-up
for users in (1, 4, 16, 32):
await run(users)
asyncio.run(main())
Run it with BASE_URL=http://your-server:8000/v1 API_KEY=... MODEL=... python tps.py. Then swap the prompt for real ones from your logs, including your longest, because TTFT depends heavily on prompt length.
If you run the engines directly, they ship their own tools. For a vLLM server, vllm bench serve replays synthetic prompts at a set concurrency and reports TTFT, TPOT and inter-token latency percentiles:
vllm bench serve --dataset-name random --random-input-len 1024 \
--random-output-len 128 --num-prompts 100 --max-concurrency 8 \
--base-url http://127.0.0.1:8000
For a GGUF file on one machine, llama.cpp's llama-bench measures prompt processing (512 tokens by default) and generation (128 tokens by default) separately: llama-bench -m model.gguf. It runs without a server or concurrency, so treat it as a single-user number.
A few habits make the results trustworthy. Discard the first request, which pays for warm-up. Report p50 and p95, not averages. Keep max_tokens fixed so every run writes similar lengths. And test at the concurrency you expect at peak, since a server that is fast for one user may be slow for thirty. Once you are in production, track the same metrics continuously; the LLM observability guide lists what to alert on.
Realistic ranges
These are estimates derived from the ceilings above at roughly half to three quarters efficiency, for a single stream at short context. Your hardware, engine and prompts will move them.
| Setup | Single-user decode, estimate |
|---|---|
| 8B at 4-bit on an L40S | ~90-135 tokens/s |
| 8B at 8-bit on an H100 SXM | ~200-290 tokens/s |
| 70B at 4-bit on an H100 SXM | ~40-60 tokens/s |
| 70B at 4-bit on an RTX PRO 6000 | ~19-28 tokens/s |
| 70B at 8-bit on an H200 | ~33-49 tokens/s |
If your measurement is far below these, look for the usual causes: part of the model offloaded to CPU memory, a model split across PCIe GPUs, a long context making the KV cache the bigger read, or requests queuing behind a full batch. If you are still choosing hardware, the on-premise AI infrastructure guide covers servers, power and cooling around the GPU.