Prefill
Also called: Prefill Phase
What is Prefill?
In one sentence: Prefill is the first step of answering, where the model reads your whole prompt at once and builds its memory of it.
During prefill, all input tokens are processed in parallel, which keeps the GPU very busy. The model stores what it learned about each token in the KV cache. Long prompts mean longer prefill, which is why big documents make the first word take longer to appear.
What does Prefill look like?
Pasting a 50-page report makes prefill take longer before the chatbot starts typing.
Why does Prefill matter?
Prefill sets how long you wait before the first token appears.
Prefill vs. Decode
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 | Prefill | Decode |
|---|---|---|
| Processing style | All prompt tokens processed in parallel | Sequential—1 output token per step |
| Hardware bottleneck | GPU compute (TFLOPS) | VRAM memory bandwidth (GB/s) |
| User metric | Time to First Token (TTFT) | Time Per Output Token (TPOT) / TPS |
Last updated · Fact-checked by The AI Math
Linking to this page from a lesson or article? <a href="https://getaimath.com/dictionary/prefill/">Prefill, explained simply</a> (The AI Math Dictionary)