Time to first token optimization is the work of shrinking the delay between sending a request to a language model and seeing its first word appear. Time to first token optimization matters because users judge a chat product in that first second: a fast first token makes the whole answer feel instant, even if the full response takes longer. The central question is what actually controls that delay, and the answer is that it is mostly queueing plus prefill, so the fixes are shorter queues, faster prompt processing and cached work.
Time to first token, usually shortened to TTFT, is one of two latency numbers that define how a language model feels. The other is time per output token, the gap between the words that follow.
TTFT is dominated by the prefill phase, when the model reads the whole prompt at once and builds the KV cache, while the later tokens come from the decode phase, which is limited by memory bandwidth. Because prefill is compute-bound and decode is memory-bound, the two phases respond to different fixes, and optimising one does not automatically fix the other.
Key takeaways
- Time to first token optimization targets queueing plus prefill, the two parts of the wait before the first word.
- Prompt caching and shorter prompts give the largest TTFT gains for the least effort.
- Chunked prefill protects running streams from long prompts, at a small cost to the new request’s own TTFT.
- Prefill and decode disaggregation separates the two phases onto different hardware for strict latency targets.
- Measure TTFT at the 95th percentile, split by prompt length, before choosing a fix.
What time to first token really measures
TTFT is measured from the moment a request is sent to the moment the first token reaches the user. That interval has three parts: queueing, waiting for a free slot on the server; prefill, processing the prompt; and the network and application overhead around both. Queueing is often the largest part under load, which surprises teams that expect the model itself to be the bottleneck.
Prefill time grows with prompt length, roughly with the square of the number of tokens for the attention step, so a 32,000-token document takes far longer to process than a short question. That is why long-context products feel slow even on fast hardware, and why prompt length is the first thing to examine when TTFT is high. A product that sends the same long system prompt and retrieved context with every request pays the prefill cost on every request.
Shorten the prompt before touching the engine
The cheapest TTFT win is a shorter prompt. System prompts accumulate instructions over months, retrieval returns more documents than the model needs, and conversation history grows without limit.
Each extra thousand tokens adds prefill time directly. Audit the prompt: remove instructions the model already follows, cap retrieved documents to the few that actually inform the answer, and summarise old conversation turns instead of sending the full history.
Prompt compression uses a small model to shrink long context before the main model sees it, but it adds a processing step of its own, so the net gain should be measured. For most products, simple trimming and capping beat clever compression. Best for: products whose prompts grew organically and now carry instructions, context and history that no one has audited.
Routing is the other prompt-level fix. If a request is simple, a smaller model will prefill it faster, because prefill cost scales with model size.
Sending easy requests to a small model and hard ones to a large model cuts average TTFT without touching the engine. Our guide to cutting LLM prompt tokens covers the trimming techniques in detail.
Prompt caching: never prefill the same text twice
Prompt caching stores the KV cache for a repeated prefix, such as a system prompt or a retrieved document, so later requests skip the prefill work for that prefix entirely. When the shared prefix is long, the saving is large: a 2,000-token system prompt that is cached costs almost nothing on the second request. vLLM supports prefix caching with hash-based reuse of cached blocks, and several hosted providers offer prompt caching as a priced feature.
Caching works best when the repeated text sits at the start of the prompt, because the cache is keyed on the prefix. If each request begins with a unique user message and the shared instructions come later, the cache cannot be reused.
Reorder prompts so shared content comes first and variable content comes last, and the same cache serves every request. Cache hit rate is the metric to watch: if it is low, the prompt structure is probably defeating the cache.
Semantic caching is a different tool: it answers a repeated question from stored earlier responses without calling the model at all, which makes TTFT effectively zero for exact repeats. It suits support and search workloads, but it needs a similarity threshold and a freshness policy, because a stale cached answer is worse than a slow fresh one. See our guide to LLM application caching for the trade-offs.

Chunked prefill and scheduling
Under continuous batching, a long prompt arriving at a busy server can stall every stream already running, because the prefill step occupies the GPU while decodes wait. Chunked prefill, introduced by the Sarathi-Serve system in 2024, splits long prompts into smaller pieces and interleaves each piece with decode steps, so no single step is enormous and running streams keep flowing.
The trade is that the new request’s own prefill takes more steps, so its TTFT gets slightly worse while everyone else’s time per token stays smooth. The chunk size is the tuning knob: larger chunks finish prefill sooner but stall decodes more, smaller chunks protect decodes but stretch TTFT. vLLM ships chunked prefill and documents that choosing the right chunk size is difficult, which is why teams with strict latency targets often move to the next technique instead.
Scheduling also matters. Prioritising short prompts over long ones, known as shortest-job-first, cuts average TTFT, but it can starve long requests if applied blindly.
A fairer approach is to admit prompts in arrival order while reserving capacity for interactive traffic, so batch jobs cannot crowd out chat. Best for: busy servers where long prompts regularly stall the streams of other users.
Prefill and decode disaggregation
Disaggregation splits the two phases onto separate pools of machines: one pool handles prefill, the other handles decode, with the KV cache transferred between them over a fast network. Because the phases have opposite resource profiles, prefill being compute-bound and decode being memory-bound, separating them lets each pool be sized and tuned for its own work. Systems such as DistServe, presented at OSDI 2024, and Microsoft’s Splitwise demonstrated the approach, and vLLM now supports disaggregated prefill in its serving stack.
DistServe’s measurements on a 13-billion-parameter model showed a single GPU serving only prefill sustained about 5.6 requests per second and only decode about 10, while a combined system sustained roughly 1.6 at the same latency target. The cost is complexity: the KV cache must be transferred between pools, both pools need their own model weights, and the split must match traffic.
Disaggregation is not the first step for most teams. It pays when TTFT and time per output token both have strict targets, the traffic is large enough to fill two pools, and simpler fixes such as caching and chunked prefill are already in place. Smaller deployments usually get further with caching, routing and a well-tuned single pool.
Comparing TTFT techniques
| Technique | What it reduces | TTFT gain | Main cost | Best for |
|---|---|---|---|---|
| Prompt trimming | Prefill work | Large, proportional to tokens cut | Prompt audit effort | Overgrown prompts |
| Prompt caching | Repeated prefill | Large on repeated prefixes | Cache storage, prompt ordering | Shared system prompts, RAG |
| Smaller model routing | Prefill compute | Moderate | Router quality checks | Mixed-difficulty traffic |
| Chunked prefill | Decode stalls, queueing | Small cost to own TTFT | Tuning the chunk size | Busy servers, long prompts |
| Disaggregation | Phase interference | Large at strict targets | Two pools, KV transfer | Large-scale strict SLOs |
| More replicas | Queueing | Moderate under load | Extra machines, cold starts | Bursty traffic |
Measuring TTFT properly
TTFT should be measured at the 95th percentile, split by prompt length, because averages hide the long prompts that users notice most. Record queueing time separately from prefill time, since the fixes are different: queueing points at capacity and scheduling, while prefill points at prompt length and caching. Most serving engines expose both numbers, and observability tools can show them per model and per endpoint.
Set a target that matches the product, written as a service-level objective, such as 95 per cent of requests seeing a first token within two seconds, with alerts when attainment falls. For a broader view of latency work, see our guide to cutting low-latency LLM inference without breaking quality.
Time to first token optimization checklist
- TTFT is measured at the 95th percentile, split by prompt length, with queueing and prefill recorded separately.
- System prompts and retrieved context are audited and trimmed, with conversation history capped or summarised.
- Shared content sits at the start of the prompt so prefix caching can reuse it.
- Prompt cache hit rate is tracked, and a low rate triggers a prompt-structure review.
- Simple requests are routed to smaller models with faster prefill.
- Chunked prefill is enabled where long prompts stall running streams.
- Interactive and batch traffic are separated so batch work cannot crowd out chat.
- Streaming is enabled so users see the first token as soon as prefill finishes.
- A TTFT service-level objective exists, with alerts on attainment.
- Disaggregation is evaluated only after caching, trimming and scheduling are in place.
Frequently asked questions
What is a good time to first token?
It depends on the product. Chat interfaces usually aim for the first token within about a second for typical prompts, while background jobs can tolerate several seconds. The right approach is to set a percentile target, such as 95 per cent of requests within two seconds, and measure attainment against it.
Why is TTFT high even when the GPU is idle?
Queueing is the usual cause: the request waits for a slot, a replica, or a cold model to load. Long prompts are the other cause, since prefill grows with prompt length. Check queueing time separately from prefill time to see which one applies.
Does a longer prompt always mean a slower first token?
Almost always, because prefill work grows with prompt length. The exception is a fully cached prompt, where the repeated prefix is skipped. Trimming prompts and caching shared prefixes are the two most reliable fixes.
Can quantization improve TTFT?
Modestly. Quantization speeds up the memory-bound decode phase more than the compute-bound prefill phase, so it helps time per output token more than TTFT. Smaller models, which prefill faster, have a larger effect on TTFT.
Is disaggregation worth it for a small deployment?
Usually not. It needs enough traffic to fill two pools and adds real operational complexity. Small deployments get further with prompt caching, trimming, routing and chunked prefill, and should revisit disaggregation only when those are exhausted.
How does TTFT differ from time per output token?
TTFT is the wait before the first word, dominated by queueing and prefill. Time per output token is the average gap between later words, dominated by the memory-bound decode phase. Users feel TTFT as responsiveness and time per token as reading speed, and the two need different fixes.







