Inference, Serving & Production·Question 8 of 76BasicAI-75

What's the difference between static and continuous batching, and why did continuous batching become universal?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Static batching: group N requests, run them through the model together, return when all are done. Two problems. First, the convoy effect: sequences finish at different times (one asks for 10 tokens, another 800), but the batch slot is held until the longest finishes - finished sequences waste compute as padding, and new requests wait for the entire batch to drain. Second, arrival mismatch: you either wait to fill a batch (adds latency) or run underfull batches (wastes throughput).

Full worked answer with diagram

Static batching: group N requests, run them through the model together, return when all are done. Two problems. First, the convoy effect: sequences finish at different times (one asks for 10 tokens, another 800), but the batch slot is held until the longest finishes - finished sequences waste compute as padding, and new requests wait for the entire batch to drain. Second, arrival mismatch: you either wait to fill a batch (adds latency) or run underfull batches (wastes throughput).

Continuous (in-flight) batching - introduced by Orca (OSDI '22), now standard in vLLM, TGI, TensorRT-LLM, SGLang: scheduling happens at the iteration level, not the request level. Each decode step, the engine assembles whichever sequences are active: a sequence that emits its EOS token leaves the batch that step, and a queued request can be admitted immediately (its prefill is run, then it joins the decode stream). The batch is a constantly churning population rather than a fixed cohort.

Why it wins: decode throughput scales with batch size almost for free (one weight-read serves everyone), so keeping the batch as full as possible at every step directly converts to throughput - several-fold to order-of-magnitude improvements over naive static batching, with better average latency because nobody waits for stragglers. It also makes latency more predictable and lets the scheduler enforce policies (priorities, fairness, preemption when KV memory runs low).

Going further: follow-up territory

The interaction to mention for extra credit: admitting a new request means running its prefill, which can stall in-flight decodes and spike everyone's ITL - the problem chunked prefill exists to solve.

Worth sketching. Two short timelines side by side make the convoy effect obvious without any arithmetic.

flowchart LR
    S1["Static: 4 requests admitted together"] --> S2["Short sequence finishes,<br/>slot idles as padding"]
    S2 --> S3["New arrivals wait for<br/>the longest sequence to drain"]
    C1["Continuous: schedule per iteration"] --> C2["Sequence emits EOS,<br/>leaves the batch that step"]
    C2 --> C3["Queued request prefills<br/>and joins the decode stream"]
    C3 --> C2

What a good answer covers

  • Static batching: group N requests, run them through the model together, return when all are done
  • First, the convoy effect: sequences finish at different times (one asks for 10 tokens, another 800), but…
  • Second, arrival mismatch: you either wait to fill a batch (adds latency) or run underfull batches…
  • Continuous (in-flight) batching - introduced by Orca (OSDI '22), now standard in vLLM, TGI,…
  • Each decode step, the engine assembles whichever sequences are active

Key terms: Static batching · convoy effect · Continuous (in-flight) batching

Interviewer follow-ups to expect

  1. What new scheduling problems does continuous batching create?

  2. How does the engine decide when to preempt a running sequence, and what happens to its KV cache?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep