What is the AI decode phase?

The decode phase is the stage of language model inference after prefill, in which the model produces the answer's next token at each step using the key and value cache of earlier tokens, repeating until the answer ends.

Unlike prefill, which processes all prompt tokens at once in parallel and is compute-heavy, decoding produces just one new token per step but must read all model weights and the cache from memory to do so, making it memory-bandwidth bound. Inter-token latency is the duration of each of its steps.

Topic
Inference and performance
Also known as
Decoding phase, generation phase

How the AI decode phase works

  1. When prefill ends, the key and value cache for the prompt is ready.
  2. At each step the model processes the last generated token with the cache and computes next-token probabilities.
  3. The chosen token's key and value join the cache; the process repeats until a stop condition.
  4. Many requests' decode steps are batched together, sharing weights read from memory so the GPU is used more efficiently.

In more detail

Arithmetic intensity and the effect of GQA and MLA

Whether a decode step is memory-bandwidth or compute bound depends on arithmetic intensity (FLOPs per byte moved from HBM). With a small batch size, one forward pass performs few FLOPs relative to loading gigabytes of weights and KV cache, leaving tensor cores underutilised; increasing batch size or using techniques like Multi-Head Latent Attention (MLA) and GQA improves arithmetic intensity up to the GPU's hardware ridge point.

Chunked prefill and disaggregated architectures

In unified serving engines, long compute-heavy prefills can stall ongoing decode steps for other users, causing ITL spikes. Modern inference stacks mitigate this using chunked prefill (interleaving prefill slices with decode batches) or prefill-decode disaggregation, assigning separate GPU pools for each phase.

Reasoning models and weight versus KV cache quantisation

Reasoning models that emit long internal thinking chains shift workload economics heavily toward the decode phase. Similarly, weight-only quantisation (such as W4A16 or FP8) speeds up decode primarily because it cuts the number of bytes transferred from GPU HBM per token step, whereas KV-cache quantisation increases the maximum concurrent batch size that fits in VRAM.

Commonly confused terms

TermHow it differs
Time to first token versus time per output tokenTime to First Token (TTFT) measures how long a user waits before streaming starts (dominated by queuing + prefill), whereas Time Per Output Token (TPOT) / Inter-Token Latency (ITL) measures the average delay between generated tokens during the decode phase.
Speculative decodingSpeculative decoding is an acceleration technique inside the decode phase where a small draft model (or multi-token head) proposes several candidate tokens that the larger target model verifies in parallel in one forward pass, boosting arithmetic intensity without changing output quality.

Why the AI decode phase matters for on-premises AI

In in-house assistants producing long answers, most total response time passes in the decode phase; the speed a user feels in a streamed answer is its inter-token latency. Being memory-read bound, the phase is directly affected by GPU memory bandwidth, quantisation and batching. Capacity planning therefore measures and targets inter-token latency at expected concurrency, not just time to first token.

ON-PREMISES EXAMPLE

A telecoms operator finds its in-house assistant drafting suggestions for agents feels slow; measurements show good time to first token but high inter-token latency at peak hours, so it retunes batching and quantisation for the decode phase.

Common questions

Why is the decode phase slower than prefill?

It produces one token per step but must read all weights and the cache from memory each time; speed is limited by memory bandwidth.

How is the decode phase sped up?

By batching many requests, quantising to cut data read and with methods such as speculative decoding that verify several tokens per step.

Sources

In the glossary: Glossary, A to D

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.