Why LLM Generation Cannot Be Parallelized Per Request
What a Hugging Face post says about how LLMs generate text token by token and why that cannot be parallelized inside one request.
For: Learners who know what an LLM is.
How LLMs generate text
Most LLMs generate text token by token, which guarantees that every new token is computed based on all preceding tokens (this model property is called auto-regressive).[1]
What each token depends on
The first output token depends on all prompt tokens, but the second output token already depends on all prompt tokens plus the first output token, and so on.[1]
What follows
As a consequence, token generation cannot be parallelized at the level of an individual request.[1]
Sources
- Prefill and Decode for Concurrent Requests (huggingface.co · checked )
More articles
- 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.
- LearningHow Speculative Decoding Splits the Work Into Two StagesWhat a Hugging Face post says speculative decoding accelerates and what the draft model and the target model each do.
- 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.