End to end latency: fill in the queue, prefill and decode components.
End-to-end latency decomposes into queue_time + TTFT + (N_out - 1) * TPOT, where TTFT is compute-bound prefill and TPOT is bandwidth-bound decode.
Picture sending a package through a busy mailroom. First it sits in line behind other packages: that is queue time. Then a clerk has to read the whole address (the entire prompt) before anything can move: that is TTFT, paid once. After that, the clerk hand-writes one stamp at a time onto the box, again and again, until it is fully labeled. Each stamp is the same small wait, but you pay it once per stamp. If the package needs hundreds of stamps, that second pile of waits ends up much bigger than the one-time address-reading. End-to-end latency is the sum of all three pieces.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
End-to-end latency is the most-watched, most-misunderstood metric in LLM serving. Engineers new to the space often quote a single 'response time' number, then get surprised when their chat UI feels broken at p95 even though the average looks fine. The fix is to stop treating latency as one number and start treating it as a sum of three structurally different terms.
This deep dive walks through the canonical decomposition queue + TTFT + (N_out - 1) * TPOT, why each term has a different cost driver, what production levers move each one, and why separate SLOs for TTFT and total completion time are non-negotiable on any serious chat product.
The three-term decomposition in detail
A single LLM request producing N_out output tokens spends time in exactly three places.
- Queue time: the interval between request arrival at the server and the start of compute. On an idle server this is near zero. Under load, it is the dominant component of p95 and p99 latency because requests pile up behind running batches.
- TTFT: the wall-clock cost to read the entire input prompt, run one parallel prefill forward pass, and emit the first output token. TTFT scales with input length T_in but not with output length. It is what a streaming client observes as the gap before the first character appears.
- (N_out - 1) * TPOT: the autoregressive decode loop. Each of the remaining output tokens requires its own forward pass, and each pass costs roughly TPOT (a few tens of milliseconds on modern hardware). This term scales linearly with N_out.
The breakeven math
For TTFT around 300ms and TPOT around 25ms, decode equals prefill at N_out around 13. Past that, decode dominates. Most real-world completions are 50-1000 tokens, putting them firmly in the decode-dominated regime.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- vLLM v1's benchmark scripts report p50/p95/p99 for both TTFT and inter-token latency (effective TPOT) separately, plus queue depth.
- Anthropic Claude Sonnet 4.6 dashboards alert on TTFT and total completion time as separate SLOs; long-context chat targets p95 TTFT under one second.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf TTFT = 200ms and TPOT = 30ms, what is the breakeven output length where decode equals prefill?
Solve (N_out - 1) * 30ms = 200ms, giving N_out about 8. Past 8 output tokens, decode dominates. Most real completions are 50-500 tokens, so decode is the main cost driver almost always.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Lumping TTFT and per-token decode into one latency number. They move on different axes and need separate SLOs because prefill is compute-bound while decode is bandwidth-bound.
60 second bullets to scan on the way to the call.
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.