Zenaique

Contrast time to first token with tokens per second as serving SLOs

Flashcard·Medium·4.0 · 0·~30s·Asked atDustHebbiaSnap
Attempt it
TL;DR

TTFT is the user-perceived latency floor for interactive surfaces, dominated by prefill; tokens per second is the wall-clock metric for non-interactive workloads, dominated by decode batching.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture two diners at the same restaurant. One is hungry and just wants the bread to land at the table so they know food is coming. They will happily wait for the rest as long as something arrives quickly. The other is at a takeout window placing a big catering order; they do not care when the first dish is ready, only when the whole order is bagged and they can leave. The hungry diner cares about how fast the bread shows up (time to first token); the takeout customer cares about total prep time (tokens per second over the whole order). The kitchen configures itself differently for each: small fast batches for the bread crowd, large efficient batches for the takeout.

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.

LLM serving SLOs split along two metrics that look similar at first glance but measure different parts of the request lifecycle and respond to different optimizations. Confusing them leads to serving configurations that fail one SLO while optimizing the other, often without the operator realizing why. The TTFT versus TPS distinction is foundational for any production LLM serving decision in 2026.

This card walks through what each metric measures, what dominates it, how the serving-runtime configuration affects the trade-off, and why mature deployments often run separate fleets for interactive and batch workloads.

TTFT: the prefill-dominated metric

Time to first token measures the gap from request submission to the first emitted output token. The components are queue wait, prefill (forward pass over the full input prompt to populate the KV cache), and scheduling overhead.

For typical interactive inputs (1k-4k tokens including system prompt) prefill is a meaningful fraction of total request latency, often the dominant component. Larger inputs (8k+ tokens in long-context RAG or agent loops) make prefill the overwhelming TTFT cost.

The user-perception story. In an interactive surface, the user is staring at the screen between submitting and seeing the first character. That gap is the perceived latency of the system, regardless of how fast tokens stream after. A 2-second TTFT followed by 50 tok/s streaming feels slow; a 300 ms TTFT followed by 20 tok/s streaming feels snappy. Streaming hides total generation time from the user; it cannot hide TTFT.

Optimizations that help TTFT. Chunked prefill interleaves prefill and decode work so a new request can start streaming its first tokens before its full prefill has finished, lowering effective TTFT under concurrency. Prefix caching (RadixAttention-style sharing of KV across requests with shared prefixes) eliminates redundant prefill on the shared portion, which is huge for agent workloads with long system prompts. Smaller batch sizes reduce queue wait. Faster prefill kernels (FlashAttention v3) cut the raw prefill compute time.

TPS: the decode-dominated metric
The inverse correlation and the trade-off
The two-fleet production pattern and SLO targets
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • ChatGPT's interactive surface runs serving configurations tuned for sub-500 ms TTFT, with chunked prefill and prefix caching to absorb long system prompts.
  • Anthropic's batch API trades TTFT for half-price token costs, optimized for throughput-per-GPU on workloads where latency does not matter.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow would you choose batch size for an interactive fleet?
A

Start small (4-8), measure TTFT P95 and TPS P50 under representative concurrency, increase until TTFT begins violating SLO, back off one step; chunked prefill widens the safe range.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Tuning one fleet for both SLOs. Large continuous batches help throughput but hurt TTFT; the production answer is usually two fleets with different configurations when both workloads are heavy.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • TTFT as prefill-dominated, user-perceived latency for interactive surfaces

  • TPS as decode-dominated, wall-clock metric for batch workloads

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Why a circuit breaker around the primary LLM provider is more than a fancy retry
Flashcard·Medium