179 questions
No questions match those filters.
Walk through why prefill and generation are fundamental...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansPrefill takes the entire input prompt and processes all of its tokens in a single parallel forward pass — every token’s attention and feed-forward computation happens simultaneously, which keeps GPU compute units well-utilized. It’s compute-bound: throughput scales with how much parallel arithmetic you can throw at it.
Generation is the opposite shape. Each new token depends on every token generated before it, so tokens must be produced one at a time, sequentially. Each step reloads the full model’s weights (and grows the KV cache) to produce exactly one token’s worth of new computation — the GPU spends most of its time moving data, not computing, making generation memory-bandwidth-bound rather than compute-bound.
A serving system has to handle both phases well despite their opposite resource profiles, which is why production inference stacks often schedule and batch prefill and generation differently — continuous batching systems specifically exist to interleave new requests’ prefill work with in-flight requests’ generation steps, keeping both resource types busy rather than optimizing only one phase.