Blogs / Why Decoding Can Be Batched but Reading the Prompt Cannot

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.

  • Learning
  • 1 min read

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]

Decode stepsnot compute-intensive, sobatching increasesthroughputPrefillbatching does not work
How does the post contrast batching decode steps with batching prefill?

Sources

  1. How Long Prompts Block Other Requests - Optimizing LLM Performance (huggingface.co · checked )

More articles