Glossary

Time to first token

Time to first token (TTFT) is the delay between sending a request to a language model and receiving the first token of its response.

Time to first token (TTFT) is the time between sending a request to a language model and receiving the first token of its response. It covers everything that happens before output begins: the network round trip, time spent waiting in the provider’s queue, processing the input, and generating the first token. In a chat interface that streams its replies, TTFT is the pause a user sits through before any text appears, which makes it the latency figure people notice most.

TTFT is one of two numbers that describe how fast a large language model responds. The other is the rate at which tokens arrive once output has started, usually given as time per output token or tokens per second. Together they set end-to-end LLM latency, and they respond to different changes. A longer prompt mostly raises TTFT. A longer answer mostly raises total time and leaves TTFT where it was.

What happens before the first token

A request passes through several stages before the model emits anything. Each one adds to TTFT, and each has its own fixes.

Network and queueing. The request travels to the provider, is authenticated, and waits for capacity. On a busy shared endpoint, queueing can vary from a few milliseconds to several seconds, and it is the part you control least. Dedicated capacity, regional endpoints and an LLM gateway that fails over between providers reduce the variance without changing the model.

Prefill. The model reads the entire input in one forward pass, computing attention across every token in the prompt and storing the results in the KV cache. This is the prefill phase, and for long prompts it dominates TTFT. Prefill cost grows with input length, and because the attention mechanism relates each token to the others, very long inputs cost more per token than short ones. A request carrying a 30,000-token conversation history takes noticeably longer to start than the same question asked with 2,000 tokens of context.

First decode step. Once the input is processed, the model generates its first output token. This step is short and roughly constant for a given model and hardware setup. Reasoning models change the picture: they produce reasoning tokens before the visible answer, so the first token a user sees can arrive many seconds after the first token the model generated. Providers differ on whether TTFT is reported to the first reasoning token or the first visible one, so check before comparing figures.

In an application there is usually a further stage that the provider never sees. Before calling the model, a RAG pipeline embeds the query, searches an index, perhaps runs reranking, and assembles the prompt. An AI agent may also load memories, read files or call tools first. All of that time counts toward the TTFT your users experience, even though it appears nowhere in the provider’s metrics.

TTFT and the rest of LLM latency

Total response time for a single call is roughly TTFT plus the time per output token multiplied by the number of output tokens. The two parts are limited by different resources. Prefill is limited by compute, since the model processes many input tokens in parallel. Decoding is limited by memory bandwidth, since each new token requires reading the model’s weights and the growing KV cache. That is why a provider can serve one model with low TTFT but slow streaming, or the reverse.

The split also shows which optimisations help where. Cutting input tokens shortens prefill and lowers TTFT. Cutting output tokens, with a tighter max tokens setting or instructions to be brief, shortens decoding and lowers total time. Input and output tokens are priced differently too, so the two levers affect cost in different ways.

With streaming responses, TTFT becomes the main measure of perceived speed, because text starts appearing as soon as the first token arrives and the user reads while the rest is generated. Without streaming, the user waits for the full response, and total time matters more than TTFT. Most chat interfaces stream for this reason. Batch inference sits at the other extreme: jobs run in bulk with nobody waiting, so throughput and price take over.

Time to first token

Time per output token

Total response time

What it measures

Delay before output starts

Gap between tokens once output has started

Time from request to final token

Main drivers

Input length, queueing, steps before the model call

Model size, hardware, load on the endpoint

Both, plus output length

Felt most in

Streaming chat, voice, multi-step agents

Long answers

Calls without streaming, batch jobs

Main levers

Shorter context, prompt caching, faster retrieval

Smaller or quantised model, shorter answers

All of these

What drives TTFT up

Input length is the largest factor you control. Every token in the system prompt, conversation history, retrieved chunks and tool definitions passes through prefill on every call. Prompts tend to grow over time: a few more instructions, a longer history window, two extra retrieved chunks. Each change looks small, and together they push TTFT up month by month. Our breakdown of a 15,000-token request shows how much of a typical request is history and loosely related chunks.

Long conversations make it worse in a way that is easy to miss in testing. A chat that sends its full history on each turn has a TTFT that rises with every message, so the twentieth reply starts more slowly than the first. Teams that test with short sessions see a fast product, while their most engaged users, the ones with the longest threads, see a slow one. The same applies to long context models: a model that accepts a million tokens will process them when asked, and the user waits for prefill to finish. We cover the wider trade-offs in why long context fails in production.

Model choice matters as well. Larger models take longer for both prefill and decoding, and reasoning models add their thinking time before the visible answer. Model routing can send simple requests to a smaller, faster model. It works best alongside smaller inputs, and our post on model routing as a cost strategy explains why routing alone tends to disappoint.

In agents, TTFT compounds. An agent loop that makes six model calls before answering pays for prefill six times, and each call usually carries the growing transcript of earlier steps and tool results. A step that adds 400 milliseconds of TTFT adds well over two seconds to the full task. Test-time compute settings, such as a higher reasoning effort, multiply the effect further.

How to measure TTFT

Measure TTFT on the client, from the moment your code sends the request to the moment the first content chunk arrives on the stream. Record it separately from the time spent in your own steps before the model call, so you can tell whether a slow response came from the provider or from your retrieval. Agent tracing and LLM observability tools capture both as spans within one trace.

Report percentiles rather than averages. Median TTFT describes the typical experience, but the 95th and 99th percentiles describe what your slowest users see, and queueing spikes show up there first. Break the numbers down by input length as well. A chart of TTFT against input tokens usually shows a clear upward slope, and it tells you how much latency each extra thousand tokens of context costs on your current model and provider.

Benchmark on realistic prompts. A test prompt of 200 tokens says little about a production request of 15,000. Use real traffic, or a sample that matches its length distribution, and test at the times of day when your users are active, because shared endpoints slow down under load.

How to reduce TTFT

The most effective change is to send less. Every token removed from the input is a token the model never has to prefill. Context engineering is the practice of deciding what goes into each request, and for TTFT the useful question is which parts of the prompt contribute to this particular answer. Conversation history and retrieved chunks are usually the largest sources of tokens that contribute little.

Prompt caching lets the provider reuse the KV cache for a prefix it has already processed, such as a long system prompt or a fixed set of tool definitions. Cached tokens skip most of prefill, so TTFT drops sharply for requests that share a long, stable prefix. It helps far less with the parts of a prompt that change on every turn, which in most agents means the history and the retrieved context.

Context compression and summarisation shrink older turns, but they trade accuracy for speed. A summary is written before the next question is known, so a detail that later turns out to matter may already be gone. Structured memory avoids that trade: durable facts are extracted once and retrieved individually, so the prompt carries only the facts that matter for the current request.

Speed up the steps before the model call. Run retrieval, memory lookups and other independent preparation in parallel rather than one after another. Cache embeddings for repeated queries, and consider a semantic cache for questions that recur often enough to answer without calling the model at all. Keep top-k retrieval settings tight: five chunks retrieved where one would do add both search time and prefill time.

Finally, choose a serving setup that matches the latency you need. Smaller models, model quantization and dedicated capacity all lower TTFT, at some cost in quality, flexibility or price. For voice agents, where the reply has to follow speech-to-text and come back within a natural pause in conversation, these choices often decide whether the exchange feels responsive.

A worked example

Consider a customer support agent whose average request carries about 15,000 input tokens: a 500-token system prompt, around 12,000 tokens of conversation history, five retrieved chunks of about 500 tokens each, and the user’s message. The figures here are illustrative, though the proportions are common. On the team’s chosen model, median TTFT is about 1.6 seconds early in a session and above 3 seconds for long threads, plus around 300 milliseconds of vector search before the call.

The team makes two changes. They replace the full history with the memories relevant to the current question, a few hundred tokens, and they replace the five chunks with the one or two passages that contain the answer. Input falls to about 2,800 tokens, roughly 81% fewer than before. Memory retrieval adds about 200 milliseconds before the call, but prefill shrinks by far more than that. They also cache the system prompt, which trims a little more.

The larger gain is consistency. Before the change, TTFT depended on how long a user had been talking. After it, a user on their fiftieth message gets the same start time as a user on their first, because the size of the prompt no longer tracks the length of the thread. Cost falls in step, since the same input tokens that drove prefill also drove the bill.

Where Exabase fits

Exabase does not host or serve models, so it has no control over a provider’s queueing, hardware or decoding speed. It works on the input side, which decides how much prefill each request needs. Exabase Memory turns conversations into structured facts and returns the ones relevant to the current query, with simple retrieval in about 200 milliseconds, so an agent can drop the full history from its prompt. Deep Search returns sub-document passages with page numbers or timestamps instead of whole chunks, and its precision setting controls how many results come back.

The token cost solution describes the same change from the billing side, with an illustrative request falling from about 15,100 input tokens to about 2,800. The memory retrieval guide covers the search parameters, including the optional query expansion and reranking that spend a little time for more accurate results, and the token cost calculator estimates the effect for your own traffic. For how memory services compare on accuracy and tokens per query, see our roundup of agent memory platforms.

Frequently asked questions

What is a good time to first token?

It depends on the product. For a streaming chat interface, a TTFT under about one second feels responsive to most users, and under half a second feels close to instant. Voice agents need tighter budgets because the reply has to fit inside a natural pause. Background and batch jobs can tolerate much longer.

What is the difference between TTFT and latency?

TTFT is one part of latency. It measures the delay before output starts, while total latency runs until the last token arrives and also depends on output length and generation speed.

Why does TTFT increase with prompt length?

The model has to process every input token before it can generate any output. This prefill step grows with input length, and attention makes very long inputs more expensive per token.

Does streaming reduce time to first token?

No. The first token arrives at the same moment either way. Streaming shows it straight away, so the user can start reading while the rest is generated, and TTFT becomes the delay they notice.

Does prompt caching reduce TTFT?

Yes, for the cached part of the prompt. Reusing the KV cache for a repeated prefix skips most of its prefill. Content that changes on every turn, such as history and retrieved chunks, still has to be processed.

Why is TTFT higher for reasoning models?

Reasoning models generate thinking tokens before the visible answer. When TTFT is measured to the first visible token, that thinking time is included, and it can add several seconds on hard questions.

How does Exabase affect time to first token?

Exabase reduces the input side. Memory and Deep Search return a few hundred tokens of relevant context in place of full history and broad chunks, which shortens prefill. Memory retrieval adds about 200 milliseconds before the model call.

Related pages: LLM latency, streaming responses, KV cache, prompt caching, input vs output tokens, reasoning models, token cost solution, voice agents use case, anatomy of a 15,000-token request

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.