Time to first token
Definition
How long a model takes to return the first token of a response after a request, the main driver of how fast a streamed reply feels.
In more detail
TTFT covers network time, queueing and processing the whole input prompt before any output. Long prompts, cold caches and reasoning before the visible answer all raise it. After the first token, speed is measured as tokens per second.
For chat and voice, TTFT matters more than total time because people see or hear the reply begin. Cutting input size, using prompt caching for long stable prefixes and streaming the response all help. Track it as a percentile, such as p95, rather than an average, since slow outliers are what users notice.
Related terms
KV cache
Memory where a transformer stores attention keys and values for tokens it has already processed, so it does not recompute them each step.
Latency
The time from sending a request to a model to getting the response, often split into time to first token and total generation time.
Prompt caching
Reusing the processed form of a repeated prompt prefix, such as a long system prompt, across requests to reduce latency and cost.
Throughput (tokens per second)
How many tokens a model or serving system generates per second, measured per request or across all requests.
Read more about Time to first token
- Stream LLM responses to a web page with server-sent events
A Node server relays tokens as server-sent events, the page renders them as they arrive, and a Stop button cancels.
- Latency
The time from sending a request to a model to getting the response, often split into time to first token and total generation time.
- LLM observability
Tracing requests, tokens, latency and cost in AI applications running in production.
- Run local models with Ollama
Install Ollama, run an open-weight model on your own machine, call it from scripts over the local API and choose a model size your hardware can handle, offline.