[03-dynamic-request-batching]'s static batching processes one whole batch to completion before forming the next — so if 7 of 8 requests finish quickly but 1 needs 500 more tokens, the other 7 slots sit idle waiting for that straggler. Simulate continuous batching (a.k.a. iteration-level scheduling, as used in vLLM/TGI): at every decode step, any request that has finished is removed from the active batch and any waiting request is admitted into the freed slot immediately.
remaining_tokens[r] -= 1 for every active request r, at each decode step t
active = (active - finished) + admitted_from_queue, |active| <= max_batch_size
(arrival_step, request_id, n_tokens_needed).max_batch_size.Process eviction before admission WITHIN each step: a request that finishes exactly at this step frees its slot in time for a new admission at the SAME step, not the next one. Preserve arrival order for the waiting queue (FIFO) when deciding which queued request gets an opening slot first.
No results yet
Run your code to check it against the examples, or submit to run every test.