# Prefill

> Prefill: Processing the whole prompt in one parallel pass before the first output token can be produced.

Canonical: https://llmdojo.dev/glossary/prefill

Processing the whole prompt in one parallel pass before the first output token can be produced.

Learn it in the lesson: [Prefill and decode](https://llmdojo.dev/learn/model-foundations/context/prefill-and-decode) (Model Foundations · Context Windows, Prefill and the KV Cache).

## Interview questions about Prefill

- [Users say your summariser 'takes ages to start' on long documents but then writes quickly. Explain what's happening in terms of prefill and decode.](https://llmdojo.dev/interview/q/users-say-your-summariser-takes-ages-to-start-on-long-documents-but)
- [Design and implement a KV cache for autoregressive decoding in a Transformer: tensor shapes for prefill and per-step decode, per-layer caches, batching, memory limits and beam search.](https://llmdojo.dev/interview/q/design-and-implement-a-kv-cache-for-autoregressive-decoding-in-a-transformer)
- [How would you show, on a given machine, that decode is bandwidth-bound and prefill compute-bound?](https://llmdojo.dev/interview/q/how-would-you-show-on-a-given-machine-that-decode-is-bandwidth)
- [An upgrade makes your 960-token prefill 5% faster in one before-and-after run. Do you ship it?](https://llmdojo.dev/interview/q/an-upgrade-makes-your-960-token-prefill-5-faster-in-one-before)
- [Request A has a 960-token prompt and 10 output tokens. Request B has a 16-token prompt and 200 output tokens. Same model and machine: which finishes first, and what does that tell you about a chat app that resends the full history every turn?](https://llmdojo.dev/interview/q/request-a-has-a-960-token-prompt-and-10-output-tokens-request)
- [A chat reply streams in token by token. What two waits does the user feel, and which one does streaming make matter most?](https://llmdojo.dev/interview/q/a-chat-reply-streams-in-token-by-token-what-two-waits-does)
- [Explain how a server like vLLM runs a decoder-only model efficiently.](https://llmdojo.dev/interview/q/explain-how-a-server-like-vllm-runs-a-decoder-only-model-efficiently)
- [Design inference serving for a model with 100 million daily users. Give back-of-the-envelope QPS and memory for weights and caches, and explain how you'd control tail latency.](https://llmdojo.dev/interview/q/design-inference-serving-for-a-model-with-100-million-daily-users-give)

## Related
- [Context window](https://llmdojo.dev/glossary/context-window)
- [Position embedding](https://llmdojo.dev/glossary/position-embedding)
- [Decode](https://llmdojo.dev/glossary/decode)
- [KV cache](https://llmdojo.dev/glossary/kv-cache)
- [Glossary of every term](https://llmdojo.dev/glossary)
