Prefill vs Decode : LLM Inference phases

Sitesh Pattanaik

2026/09/10

Every llm request runs in two distinct phases: prefill, where the model reads the whole prompt in one parallel burst, and decode, where it generates the response one token at a time, each one depending on the last.

Prefill - this processes your entire input prompt at once, including system instruction, retrived context, and the user message. It builds the internal state, called the KV cache, that the model needs for the generation phase.

Decode - this generates response one token at a time. using the cache state from prefill, it produces a token, feeds it back in, and repeats this until the response is complete.

due to the way the job is done, prefill is a compute bound process while decode is a memory-bandwidth-bound process considering how fast GPU can move data around.

Prefill: drives the time to first token (ttft)

optimization levers

Decode: token generation drives the inter token latency (itl)

optimization levers

Appendix

Reference: https://redis.io/blog/prefill-vs-decode/