LLM latency: how to measure median, p95 and time to first token
Short answer: measure three things on your real prompts: time to first token (how long before text starts appearing), total response time (until the last token) and output tokens per second. Report the median and the p95 (the time 95% of requests beat), not the average: the slow 5% is what users remember.
Which number matters for you
| Your feature | Watch |
|---|---|
| Chat, streamed to the screen | Time to first token, then tokens per second |
| Background job: extraction, classification, a reply the user sees only when complete | Total response time, p95 |
| Batch processing overnight | Throughput and cost, not latency |
How to measure it
- Use 30–100 real prompts, not "hello": latency grows with input length and, above all, with output length.
- Stream the response and record when the request was sent, when the first token arrived and when the last one arrived.
- Run each model at the same time of day, from the same region, ideally at your peak hours too.
- Sort the total times: the middle value is the median, the value 95% of the way up is p95.
- Record output tokens too. A model that writes twice as much will be slower even at the same tokens per second.
What makes responses faster
- A smaller model. Usually the biggest win, if it passes your tests.
- Shorter answers. Ask for them and set max output tokens; output time grows with every token.
- Less reasoning. Models that think first spend seconds before the first visible token. Lower the reasoning effort setting where the API offers one, or pick a non-reasoning model for simple tasks.
- A faster provider for open models: same model, different providers.
- Prompt caching for long fixed prefixes can cut time to first token as well as cost.
Speed trackers measure their prompts at their moment. Your p95 on your prompts is the only number that tells you whether your users will wait.
Speed is one column in the comparison, next to pass rate and cost: how to compare models on your own prompts.