Continuous batching
Compare fixed batches with a scheduler that refills slots as requests finish.
Continuous batching
Compare fixed batches with a scheduler that refills slots as requests finish.
Fixed batches · 9 ticks total
Continuous batching · 6 ticks total
All five requests arrive at tick 0. Two slots each decode one token per tick. Request lengths: 2, 4, 1, 3, 2. Bars show scheduled work; the vertical cursor marks the current tick.
Change the experiment
for each decoding_tick:
decode_one_token(active_requests)
remove_finished_requests()
fill_free_slots(queue)Try it yourself
Increase the last request length. Compare the two completion times and locate idle slots in fixed batching.
Tick 0. Fixed batches completed 0 requests; continuous batching completed 0.
Refilling free slots can improve utilization. This idealized model excludes prefill, memory limits and shared GPU contention.
Playback pauses in hidden tabs and offscreen. With reduced motion enabled, use the timeline or Next step.Turn the idea into an implementation
Increase the last request length. Compare the two completion times and locate idle slots in fixed batching.
Predict a result, change one input, then explain what happened. Use the timeline to revisit a state and compare it with the algorithm sketch.
Explain it in an interview
Refilling free slots can improve utilization. This idealized model excludes prefill, memory limits and shared GPU contention.
Describe the inputs, the state that changes, the computational cost and a limitation of the model before discussing a production implementation.