Bookmarks

TTFT — time to first token

A language model inference speed metric: the time between sending a request and the appearance of the first token of the response.

Also: first token latency, latency to first token

checked 9 Nov

All terms

TTFT is an inference metric of language models: how much time passes between sending a request and the appearance of the first token of the response. The model’s answer arrives as a stream, and TTFT determines the pause before it starts — what in a chat feels like “does the bot respond straight away”. For streaming, this metric matters more than overall speed: after that, the tokens arrive with the TPOT delay.

What it consists of

By the OpenTelemetry semantic conventions, TTFT shows how much time went into the queue and prefill — processing the prompt before generation. The vLLM benchmark breaks it down roughly as ttft ≈ server_queue_time + server_ttft + frontend/network overhead, where the last part includes, for example, tokenisation, the chat template and data transfer. Prefill grows with the prompt length, the queue with the number of concurrent requests, so TTFT changes noticeably under load. Repeated requests with a shared prefix are sped up by prefix caching.

How it is measured

TTFT is measured on streaming requests and reported as a mean, a median and percentiles — usually in milliseconds. Sample output of vllm bench serve for ten ShareGPT requests:

textpart of the vLLM benchmark output
---------------Time to First Token----------------Mean TTFT (ms):                          71.54Median TTFT (ms):                        73.88P99 TTFT (ms):                           79.49-----Time per Output Token (excl. 1st token)------Mean TPOT (ms):                          7.91

The order of magnitude ranges from milliseconds to seconds: boundaries like these, from 0.001 to 10 seconds, are built into the histograms of the gen_ai.server.time_to_first_token metric in OpenTelemetry.

Related metrics

MetricWhat it measures
TTFTtime to the first token: queue, prefill, network
TPOTthe time for each token after the first; in vLLM: the e2e latency minus TTFT, divided by the number of tokens minus one
ITLthe pauses between neighbouring chunks of the stream; with regular decoding it is close to TPOT
Tokens per secondthe rate of the token stream after the first; grows with the number of concurrent requests
e2e latencythe whole response: TTFT plus the generation time

Sources

the term is written from these pages

Verified 9 Nov