# Decode

- **Canonical URL:** https://getaimath.com/dictionary/decode/
- **Topics:** [LLM Inference: Prefill & Decode](https://getaimath.com/dictionary/category/llm-inference-prefill-and-decode/)
- **Also called:** Decode Phase
- **Last updated:** 2026-11-25

## What is Decode?

**In one sentence:** Decode is the second step of answering, where the model writes its reply one token at a time.

Each new token needs a full pass through the model, using the KV cache so it does not reread everything. Because tokens are made one after another, decode is usually limited by how fast memory can feed the weights to the chip, not by raw math speed.

![How an AI Replies: 1. Read Your Question → 2. Type the Answer — Simple two-step cartoon: Step 1 (Prefill) shows the AI scanning your entire question in one flash (causing the brief pause before it starts talking); Step 2 (Decode) shows it typing out the reply one word at a time.](https://getaimath.com/diagrams/llm-inference-prefill-and-decode.png)
*Napkin Diagram (LLM Inference: Prefill & Decode): Every AI reply has two halves: gulping down your whole prompt at once, then speaking the answer one word at a time.*

## What is an example of Decode?

The steady stream of words you see after a chatbot starts typing is the decode phase.

## Why does Decode matter?

Decode speed sets how fast answers appear once they start.

## Decode vs. Prefill

Prefill digests your entire input prompt in parallel (compute-bound) to produce the first token; decode generates the reply one token at a time (memory-bandwidth-bound).

| Dimension | Decode | [Prefill](https://getaimath.com/dictionary/prefill/) |
| --- | --- | --- |
| Processing style | Sequential—1 output token per step | All prompt tokens processed in parallel |
| Hardware bottleneck | VRAM memory bandwidth (GB/s) | GPU compute (TFLOPS) |
| User metric | Time Per Output Token (TPOT) / TPS | Time to First Token (TTFT) |

## Related Concepts

- [Prefill](https://getaimath.com/dictionary/prefill/): Prefill is the first step of answering, where the model reads your whole prompt at once and builds its memory of it.
- [Time to First Token (TTFT)](https://getaimath.com/dictionary/time-to-first-token-ttft/): Time to First Token is how long you wait between sending a request and seeing the first token of the answer.
- [Inference Pipeline](https://getaimath.com/dictionary/inference-pipeline/): An inference pipeline is the full chain of steps from receiving a request to returning the model's answer.
- [Time Per Output Token (TPOT)](https://getaimath.com/dictionary/time-per-output-token-tpot/): Time Per Output Token is the average time it takes to generate each new token after the first one.
- [Inference Engine](https://getaimath.com/dictionary/inference-engine/): An inference engine is software built to run trained AI models quickly and efficiently.
- [Inter-Token Latency (ITL)](https://getaimath.com/dictionary/inter-token-latency-itl/): Inter-token latency is the time gap between one generated token and the next.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/decode/)
