179 questions
No questions match those filters.
Why is prefill compute-bound but generation memory-bound?
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 plansDuring the prefill phase, the model processes a sequence of S tokens simultaneously. This allows the system to amortize the cost of reading model weights over S compute operations per weight element, making the process limited by the GPU’s raw compute power.
In contrast, during generation, the model produces one token at a time. This requires reading the entire weight matrix from High Bandwidth Memory (HBM) to perform a matrix-vector multiplication for every single token. Because the arithmetic intensity is very low (one compute operation per weight element loaded), the process is bottlenecked by the speed at which the GPU can stream data from memory, rather than the speed of the tensor cores.