Skip to content
StackDecode
System Design
19. AI System Design and LLM InfrastructureAnimated

Continuous Batching

Add and remove requests from the batch every step.

The idea

Finished requests leave and new ones join immediately, keeping the GPU full.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

GPU batch (one row per slot)request 1: 8 tokens leftrequest 2: 9 tokens leftrequest 3: 8 tokens leftwaiting: 3finished: 0idle slot-ticks: 0

Continuous batching: every tick, each running request makes one token of progress.

tick:
1
1/17

Continuous batching is how vLLM, TGI and TensorRT-LLM keep throughput high.

Step by step

  1. 1Run a decoding step for all requests
  2. 2Remove finished ones
  3. 3Insert waiting ones
  4. 4Repeat

Where it is used

LLM serving.

Watch out for

Scheduling complexity and memory limits.

Related