Skip to content

What are prefill, decode, TTFT, and ITL?

Prefill and decode are the phases that process the prompt and generate the answer; TTFT and ITL measure the initial wait and the gaps between streamed outputs.

Prefill and decode are the phases a language model uses to process a request and generate an answer. During prefill, the model reads the prompt (the input text) and produces the first token, a chunk of text. During decode, it generates the remaining tokens using the prompt and those already produced. Time to first token (TTFT) measures the wait from sending a request to receiving its first output. Inter-token latency (ITL) measures the gaps between successive outputs in a streamed response, which appears as it is generated. The two metrics answer different questions: how long the response takes to start and how steadily it continues. All of this belongs to inference, running the model to answer a request, not to training. Measured times depend on the request queue and the network as well as on the model's processing. A fast first output therefore does not guarantee a fast complete response.

See also: InferenceAI inference applies a trained model to new data to produce predictions or responses; latency and cost depend on the workload and the infrastructure behind it.

How to read TTFT, ITL, and TPOT

Definitions vary across tools. The vLLM benchmark documentation defines TTFT client-side, from sending the request to receiving its first output. ITL captures the gaps between consecutive outputs. TPOT, the average time per output token, is computed per request over everything after the first token. If a single streamed output contains several tokens, ITL and TPOT can differ. A server-side figure, which may exclude queuing, preprocessing, and network time, is not directly comparable to a client-side one.

For one response with at least two tokens, time to the last token equals TTFT plus TPOT multiplied by the number of tokens after the first. It holds per request and cannot be applied to aggregate percentiles. Averages hide the longest pauses, so ask for a percentile as well (the threshold a stated share of measurements falls below) to surface the slow cases.

Where delays arise

In many workloads, prefill processes prompt tokens in parallel, while decode at small batch sizes is often limited by memory bandwidth. The pattern is not universal: it shifts with the model, hardware, prompt length, and batch size. The DistServe study also shows that larger batches can push decode toward being compute-bound. The KV cache stores intermediate results needed by later steps.

When prefill and decode share a GPU, a long prefill can delay generation already in progress; the continuous batching entry explains how engines limit these pauses. Running the phases on separate devices is another option, though moving intermediate data between them adds a cost to weigh.

An enterprise example

A company compares two services for an assistant that uses documents. It uses the same requests, response lengths, and load conditions, including concurrent requests. Service A has a shorter initial wait; B has shorter gaps after the first output. If users read as the answer arrives, both metrics matter. If an automated process uses only the complete answer, total time is what counts: with long answers, B's shorter gaps can make up for its longer initial wait. The scenario is hypothetical and does not show that either service is always better.

Why it matters for decision makers

A contract should specify the measurement point, input and output lengths, concurrent requests, and percentiles, plus targets for TTFT, ITL, and total duration. Prompt caching can cut work on a repeated prefix, so keeping cached and uncached runs apart avoids misleading comparisons. Before buying more capacity or splitting the phases, also check cost, cache transfer, and performance on real traffic.

Frequently asked questions

TTFT measures the wait for the first output; ITL measures the gaps between consecutive outputs during the response.

Not necessarily: total time also depends on how many tokens are generated and how long generation takes after the first token.

No. Separating them can reduce interference, but you have to weigh the resources required and the transfer of intermediate data.
  • InferenceAI inference applies a trained model to new data to produce predictions or responses; latency and cost depend on the workload and the infrastructure behind it.
  • KV cacheThe KV cache stores a language model's intermediate attention values so the model does not recompute them as it generates an answer, one token at a time.
  • Continuous batchingContinuous batching changes which LLM requests are processed together at each iteration, freeing capacity when a response ends so others can be served at once.
  • Prompt cachingReusing the fixed part of a prompt across requests: the model does not reprocess it from scratch and costs plummet.

See it in the universe

If you need the AI in production, not in a demo, that is my job.

See AI integrations

Or write to me.