What time to first token measures
NVIDIA's benchmarking guide defines TTFT as the time from query submission to the first received token, and notes that it generally includes request queuing time, prefill time and network latency. It is measured from the client side, so it is what a user feels between pressing enter and seeing text start to stream.
Two phases make up any LLM request. Prefill reads the full prompt in one large, compute-heavy pass and fills the KV cache. Decode then emits output tokens one at a time. TTFT covers everything up to the end of prefill plus the first decode step. The pace after that is measured separately, as inter-token latency and tokens per second.
End-to-end latency ties the two together. The NVIDIA guide gives it as TTFT plus generation time. A short answer is dominated by TTFT; a long answer is dominated by decode speed.
References: NVIDIA NIM LLM benchmarking: metrics
The TTFT formula, with a worked example
A useful approximation is: TTFT ≈ network + queue wait + prompt tokens ÷ prefill rate + one decode step. Each term has a different fix, which is why splitting TTFT into parts is more useful than tuning the total.
Here is an illustrative calculation with assumed numbers, not a benchmark. A retrieval-augmented request carries a 6,000-token prompt. Assume the server prefills at 10,000 tokens per second for this model and GPU, one decode step takes 25 ms, the network adds 40 ms and the request waits 200 ms in the queue at peak. TTFT ≈ 40 + 200 + 600 + 25 = 865 ms.
Now cut the prompt to 2,000 tokens and assume a prefix cache hit covers a 1,500-token system prompt, leaving 500 tokens to prefill. Prefill drops to 50 ms and TTFT to about 315 ms. The same GPU feels three times faster because it does less work before the first token.
| Component (illustrative) | 6,000-token prompt | 500 new tokens after cache hit |
|---|---|---|
| Network | 40 ms | 40 ms |
| Queue wait | 200 ms | 200 ms |
| Prefill at an assumed 10,000 tokens/s | 600 ms | 50 ms |
| First decode step | 25 ms | 25 ms |
| TTFT | 865 ms | 315 ms |
What raises TTFT and how to lower it
Most slow first tokens come from one of five causes. The table maps each to a check and a fix. Change one setting at a time and re-measure at the same load.
| Cause | Symptom | Fix |
|---|---|---|
| Long prompts | TTFT grows with input length | Trim context, retrieve fewer chunks, enable prefix caching |
| Queueing at peak | TTFT fine at low load, poor at high load | Add replicas, cap concurrency, autoscale earlier |
| Prefill starved by decodes | p99 TTFT spikes while ITL stays low | Raise the per-step token budget (max-num-batched-tokens) |
| Cache pressure | Requests wait or get preempted | Free memory: FP8 cache, shorter max context, bigger GPU |
| Cold start | First request after idle takes seconds or minutes | Keep a warm replica, preload weights |
References: vLLM documentation: Optimization and tuning · vLLM documentation: Automatic prefix caching design · SGLang documentation: Server arguments
Measure and tune it in vLLM, SGLang and llama.cpp
vLLM exports a vllm:time_to_first_token_seconds histogram on its Prometheus endpoint. For load tests, vllm bench serve reports TTFT by default (its --percentile-metrics default is ttft,tpot,itl), takes --metric-percentiles such as 50,95,99, and accepts --goodput ttft:500 to count only requests that meet a target. To keep load realistic, set --request-rate or --max-concurrency.
To tune vLLM, use --max-num-batched-tokens. The optimization guide says larger values give better TTFT because more prefill tokens fit in a batch, while smaller values give better inter-token latency. Chunked prefill is on by default in the V1 engine where possible, and --enable-prefix-caching lets repeated prompt prefixes skip prefill.
SGLang exposes sglang:time_to_first_token_seconds when launched with --enable-metrics. Its --chunked-prefill-size sets the prefill chunk (-1 disables chunking), and RadixAttention prefix caching is on unless you pass --disable-radix-cache. In llama.cpp, llama-bench reports prompt processing speed as pp512 by default, and the server's streaming responses include a prompt_progress object with processed tokens and time_ms. Our guide to how to benchmark LLM inference covers the full test method.
| Engine | Live metric | Load test | Main TTFT levers |
|---|---|---|---|
| vLLM | vllm:time_to_first_token_seconds | vllm bench serve --percentile-metrics ttft | --max-num-batched-tokens, --enable-prefix-caching |
| SGLang | sglang:time_to_first_token_seconds (--enable-metrics) | Prometheus histogram under load | --chunked-prefill-size, radix cache |
| llama.cpp | prompt_progress in streamed responses | llama-bench pp512 | -ub / -b batch sizes, GPU offload with -ngl |
References: vLLM documentation: Metrics design · vLLM serving benchmark options · vLLM documentation: Optimization and tuning · SGLang documentation: Production metrics · SGLang documentation: Server arguments · llama.cpp llama-bench README · llama.cpp server README
TTFT targets by use case
There is no universal target. Pick one from how the output is used, then express it as a percentile under expected load, as GPU inference SLO explains. A chat interface needs a fast first token because users watch the screen. A batch summarization job barely cares, as long as total throughput is high.
Agents sit in between. Each tool call adds a full TTFT, so a five-step agent pays it five times. For agents, prefix caching of the shared system prompt and tool definitions is often the biggest single gain.
| Workload | What users notice | Priority |
|---|---|---|
| Chat and assistants | Pause before text appears | Low p95 TTFT |
| Code completion | Delay while typing | Very low TTFT, short outputs |
| Agents and tool loops | Delay multiplied by steps | TTFT plus prefix cache hit rate |
| Batch jobs | Total job time | Throughput over TTFT |
How time to first token changes cost per token
A tight TTFT target limits how hard you can load each GPU. As concurrency rises, queue wait and prefill contention push p99 TTFT up, so you stop adding users before the GPU reaches its best throughput. Fewer tokens per GPU-hour means a higher cost per token.
An illustrative example with assumed numbers: one GPU at an assumed $2 per hour. Under a loose 2-second p99 target it can run at a load that produces 2,000 output tokens per second. Under a 500 ms target it must run lighter, at an assumed 1,200 tokens per second. Cost per million output tokens rises from about $0.28 to about $0.46. Prefix caching or a shorter prompt can restore some of that headroom without new hardware.
| p99 TTFT target (illustrative) | Assumed output tokens/s | Tokens per hour | Cost per million at $2/h |
|---|---|---|---|
| 2 seconds | 2,000 | 7.2 million | $0.28 |
| 500 ms | 1,200 | 4.32 million | $0.46 |
Common misconceptions
A fast GPU does not guarantee a fast first token: if requests queue, TTFT rises no matter how quick prefill is. Averages also hide the problem, because a mean of 300 ms can sit on top of a p99 of 3 seconds. Report percentiles.
TTFT is not the same as cold start. A cold start is the time to load a model onto a GPU that was idle or scaled to zero, and it shows up as a huge TTFT on the first request; serverless GPU cold starts covers it. Finally, streaming does not lower TTFT; it only lets users see tokens as soon as TTFT is over.
References: NVIDIA NIM LLM benchmarking: metrics
Related terms
Tokens per second and inter-token latency measure the decode phase that follows. The KV cache is what prefill fills. Continuous batching decides when a waiting request joins the running batch, which sets queue time. Speculative decoding speeds up decode but does not shorten prefill.
Checklist and next step
Measure TTFT at p50, p95 and p99 under realistic load. Split it into queue, prefill and network. Trim prompts and turn on prefix caching. Tune the prefill token budget. Add replicas before p99 crosses your target. Keep one warm replica if traffic is bursty.
Once you know the load one GPU can carry inside your target, size the rental to it. NeuraMesh rents GPUs by the hour: choose a GPU, a plan, GPU count, hours and region on rent GPUs, and you receive a confirmed quotation, typically within one business day, with nothing charged until you approve. The compute advisor can suggest a starting GPU.
NeuraMesh prices for these GPUs
| GPU | Memory | Data center | Value |
|---|---|---|---|
| RTX 4090 | 24 GB | $0.46 | $0.40 |
| L40S | 48 GB | $1.26 | $0.54 |
| A100 | 80 GB | $1.56 | $0.98 |
| H100 | 80 GB | $2.88 | $2.00 |
Every order is confirmed in a quotation before you pay. See all GPU prices.
Questions readers ask
What is a good time to first token?
It depends on the product. Interactive chat usually aims for well under a second at p95, while batch jobs can accept several seconds. Set the target as a percentile under expected load, not as an average from a single test request.
Why is my TTFT high when the GPU is not busy?
Check the prompt length, the network path and whether the model was cold. A long prompt needs a long prefill even on an idle GPU, and a model loading from scratch can add seconds or minutes to the first request.
Does a bigger GPU lower TTFT?
Prefill is compute-heavy, so a faster GPU or tensor parallelism across more GPUs does shorten it. It will not fix queueing, network delay or an oversized prompt, which are often the larger share.
How is TTFT different from latency per token?
TTFT is the wait before the first token. Inter-token latency, also called time per output token, is the gap between later tokens. Users feel TTFT as the pause before text starts, and inter-token latency as reading speed.
Does prefix caching reduce time to first token?
Yes, when requests share a prefix such as a system prompt. The engine reuses stored cache blocks for that prefix and only prefills the new part. It has no effect on requests with unique prompts.
Sources and editorial notes
- NVIDIA NIM LLM benchmarking: metrics
- vLLM documentation: Optimization and tuning
- vLLM documentation: Automatic prefix caching design
- SGLang documentation: Server arguments
- vLLM documentation: Metrics design
- vLLM serving benchmark options
- SGLang documentation: Production metrics
- llama.cpp llama-bench README
- llama.cpp server README
Primary documentation reviewed November 24, 2026. Provider descriptions reflect published documentation. Recommendations are our analysis; worked figures are illustrative unless explicitly stated otherwise. No independent provider benchmark or uptime ranking is claimed.
Need this GPU? Rent it from NeuraMesh: choose a GPU and plan, get a confirmed quotation, and pay only when you approve. See pricing.

