Why did continuous batching replace static batching for LLM serving?
Compare static (request-level) batching with continuous (iteration-level) batching for LLM serving. Why does the switch deliver ~10-20× throughput in practice? Be specific about what happens at the end of a short sequence inside a batch.
Static batching holds every slot hostage to the longest sequence; continuous batching evicts finished requests and admits new ones every decode step, keeping the GPU full and lifting throughput 10-20x.
Imagine a tour bus that only leaves once everyone aboard reaches their stop. Some riders get off after one block, but their seats stay empty because the bus waits for the last passenger riding to the far end of town. The whole bus runs half-empty for most of the trip. Continuous batching is a smarter bus: the moment a rider gets off, the driver lets a person waiting at the curb hop into that empty seat. The bus is always full, so every seat does useful work the entire trip. In serving terms, each empty seat is a wasted slice of a very expensive GPU, and keeping every seat filled is what makes inference cheap enough to run as a product.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: batching as a memory-bandwidth win + static batching's head-of-line blocking + iteration-level scheduling (admit/evict per step) + paged KV dependency + scheduler costs.
| Dimension | Static (request-level) batching | Continuous (iteration-level) batching |
|---|---|---|
| Scheduling unit | Once per batch of requests | Once per decode step |
| Batch lifetime | Until the longest sequence finishes | Rolling window, sequences enter and leave each step |
| Idle slots | Short sequences leave empty slots until the batch ends | Freed slots refilled immediately from the queue |
| Effective batch size | Decays as sequences finish | Stays near the configured maximum |
| Throughput on mixed traffic | Baseline | Roughly 10 to 20 times higher |
| Scheduler complexity | Simple, run to completion | Admission, eviction, KV budget, preemption |
| KV-cache dependency | Contiguous per-request allocation suffices | Needs paged allocation to admit mid-flight |
Real products, models, and research that use this idea.
- vLLM pairs continuous batching with paged attention as the default open-source serving stack in 2026, packing lanes densely across requests.
- Orca first introduced iteration-level scheduling, the academic origin of continuous batching now standard across serving engines.
- Hugging Face Text Generation Inference (TGI) ships continuous batching to serve Llama 4 and Mistral Large 3 endpoints at high throughput.
- NVIDIA TensorRT-LLM implements in-flight batching, its name for continuous batching, with chunked prefill on H100 and B200 hardware.
- SGLang combines continuous batching with prefix sharing so concurrent requests reusing a long system prompt stay densely packed.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does continuous batching depend on paged attention to work well?
QHow do prefill and decode contend in a continuous-batching scheduler?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Claiming static batching wastes compute because of padding. The real loss is idle slots: short sequences finish early and their slot stays empty until the longest sequence in the batch terminates.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.