Why does static batching waste GPU capacity for LLMs, how does continuous batching fix it, and what new problems appear?
Theme reported publicly: Anthropic
Answer
Model answer, written in a candidate's voice
In short
- Static batches pad to the longest sequence and wait for all members to finish, wasting compute and blocking newcomers.
- Continuous batching schedules at iteration/step level, admitting and retiring sequences every step.
- This fills the GPU with active tokens and typically multiplies throughput at comparable latency.
- New problems: prefill can interrupt decodes, KV-cache pressure forces preemption/recompute/swap, and fairness/priorities/SLOs need explicit handling.
In full
Static batching wastes GPU capacity because a batch is held together until the longest sequence finishes, so shorter sequences are padded or idle and new requests wait behind the whole group. Continuous batching fixes this by scheduling at the iteration level: each step admits new sequences, retires finished ones, and keeps the batch filled with whatever is actively decoding. That usually multiplies throughput at similar latency, but it is not free. Prefill work can interrupt decode steps, so systems need chunked prefill or careful scheduling to protect decode latency. KV-cache memory becomes a first-class constraint, forcing preemption, recompute, or swap when capacity is tight. It also makes fairness and priorities harder, because requests arrive and finish at different times and the scheduler must balance throughput, latency, and SLOs rather than just filling a fixed batch.
What a strong answer covers
- Static batches wait for the longest sequence, pad, and block newcomers → poor utilisation and latency
- Iteration-level scheduling admits and retires sequences every step
- New issues: prefill interrupting decodes (chunked prefill), KV-memory pressure (preemption, recompute/swap), fairness and priorities
- Typically multiplies throughput at equal latency
Common mistakes
- Confusing web-server request batching with iteration-level scheduling
- ignoring KV memory as the binding constraint