Open Agent School · Public worked example
Continuous Batching: meaning and example
Welcome! Take one idea with you today.
Continuous batching lets a serving engine change the active request set between generation steps. Finished requests leave and waiting requests can enter without waiting for a whole fixed group. It improves resource use for unequal output lengths, subject to memory, prefill and fairness constraints. This is inference scheduling, not a training batch that updates weights.
Picture it: Four synthetic jobs A, B, C and D arrive together. A and C need two output ticks each; B and D need six. Two slots are available, each producing one token per shared tick of ten milliseconds. Compare fixed groups A/B then C/D with immediately refilling a free slot.
What is easy to mix up?
These requests use fixed model weights. The scheduler changes which inference sequences share an iteration. Training batches have a different purpose: combining examples for a parameter-update procedure.
Teaching example by Open Agent School. Source: Hugging Face Text Generation Inference - Continuous batching features.