Skip to content
StackDecode
LLM Library
Running and Using LLMsAnimated

Continuous Batching

Keeping the GPU busy by swapping requests in and out every step.

The idea

Requests finish at different times. Continuous batching removes finished ones and adds waiting ones after every step, instead of waiting for a whole batch to end.

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 one step for all active requests
  2. 2Remove finished ones
  3. 3Add waiting ones
  4. 4Repeat

Where it is used

vLLM, TGI, TensorRT-LLM.

Watch out for

It needs memory management, which paged attention provides.