Inference Latency Calculator
Inputs
| Time to first token | 200 ms |
|---|---|
| Time per output token | 20 ms |
| Output tokens | 500 |
Inference Latency Calculator
Estimate the end-to-end response time of a streaming LLM completion from time to first token, time per output token, and the number of output tokens.
Inputs
Serving Profile
Results
Enter a value to see results.
Details
Inference Latency
Inference latency is the time a user waits for a language model to answer. For a streaming completion it has two distinct parts: the initial pause before any text appears, and the steady rhythm of tokens that follows. This calculator combines both with the length of the answer to estimate the end-to-end response time and the throughput a single request actually experiences.
Time to first token and time per output token
Two measurements describe a streaming endpoint. Time to first token () is the delay from sending the request to seeing the first token. It covers reading the prompt, building the attention cache for every prompt token — the compute-bound prefill phase — and decoding one token. Long prompts lengthen it. Time per output token (), also called inter-token latency, is the gap between each subsequent token during the decode phase. Decoding is memory-bandwidth bound: each new token reads the full set of model weights once, so this figure stays roughly constant and its reciprocal is the steady generation speed in tokens per second.
The formula
The first token is already included in time to first token, so each of the remaining tokens adds one inter-token gap:
Tv=tttft+(Nout−1)ttpot=TNoutwhere is the number of output tokens, is the total response time, and is the overall throughput. The minus-one term keeps the count exact; for long answers it barely changes the result.
Worked example
Suppose an endpoint reports a 200 ms time to first token and a 20 ms time per output token — a steady generation speed of 50 tokens per second — and the model produces a 500-token answer:
Tv=0.2+(500−1)×0.02=0.2+9.98=10.18 s=10.18500≈49.1 tokens/sThe answer takes about ten seconds, and the overall throughput of 49.1 tokens per second sits just below the raw 50 tokens per second because the fixed first-token delay is spread across the whole response. The gap between the two figures shrinks for longer answers and widens for short ones, where the startup pause dominates.
Reducing latency
Time to first token responds to shorter prompts, prompt caching, and faster prefill hardware. Time per output token responds to higher memory bandwidth, quantization, and techniques such as speculative decoding that emit more than one token per model pass. Because total time grows with every generated token, capping the maximum output length is often the most direct lever for interactive applications. To explore how draft-model acceptance changes the per-token figure, see the Speculative Decoding Speedup Calculator, and to model fleet-level capacity see the Effective Tokens per Second Calculator.
Frequently Asked Questions (FAQ)
What is the difference between time to first token and time per output token?
Time to first token (TTFT) measures the initial wait: the model reads the whole prompt, fills the attention cache, and emits the first token. Time per output token (TPOT), or inter-token latency, measures the steady cadence afterwards, when each new token only needs one decode step.
TTFT scales with prompt length and is dominated by the compute-heavy prefill phase, while TPOT is set by memory bandwidth during decoding and stays roughly constant per token.
Why does the formula multiply by output tokens minus one?
The first token is already accounted for inside the time-to-first-token figure, so only the remaining tokens add an inter-token delay. A 500-token answer therefore adds 499 inter-token gaps after the first token. For long answers the difference between multiplying by the count and by the count minus one is small, but the minus-one form is exact.
How can serving latency be reduced?
Time to first token falls with shorter prompts, prompt caching, and faster prefill hardware; time per output token falls with higher memory bandwidth, quantization, or speculative decoding. Capping the maximum output length is often the simplest lever, since total time grows with every generated token.
Disclaimer
Results assume a single uninterrupted stream with constant per-token latency. Real serving systems vary with batching, queueing, network transit, and load, so treat the figure as a planning estimate rather than a service-level guarantee.