Why Decoding Can Be Batched but Reading the Prompt Cannot
What the TNG post says a later output token needs, why decode steps can be batched together and why batching does not work for prefill.
For: Learners curious about how language models are served.
What later tokens need
For all later output tokens (decode steps), only a single additional token needs to be processed, which is less compute-intensive but must be done sequentially.[1]
Why decodes can be batched
Since individual decode steps are not compute-intensive, one can increase throughput by batching decodes of multiple requests.[1]
Why prefill cannot
For prefill, however, this approach does not work.[1]
Sources
- How Long Prompts Block Other Requests - Optimizing LLM Performance (huggingface.co · checked )
More articles
- LearningHow a Model Larger Than Free RAM Can Run on an Old DeviceWhich devices one project names, where its numbers come from, and the idea that lets a large model fit in little memory.
- LearningWhy a Mixture-of-Experts Model Needs So Much MemoryWhy the Hugging Face post says mixture-of-experts models have a costly memory caveat, how few experts run per token and what pruning does.
- LearningHow Large LLMs Are and What They Need to Run FastWhat a Hugging Face post says about how large LLMs often are, an example with more than 100 billion parameters and what they need to run fast.