Skip to content
inference.academy

glossary/compute/prefill

Prefill

also prompt processing, context encoding

The forward pass over the whole prompt at once, producing the KV cache for every token and the first output token. All the prompt's tokens go through the weights together, so the arithmetic per byte of weight read is high and the GPU is compute-bound above a few hundred tokens. Its duration is the time to first token. Prefix caching skips the part already stored; chunking spreads it over steps.


208 tokens

The prompt length above which prefill on an A100 becomes compute-bound, the roofline's ridge point for BF16.


See it happen


Related