Continue where you left off ×
Batching: A Slot That Frees Early
Inference at Scale · Open board
The Inference at Scale board shows many replies sharing one card. This lesson builds the part of the engine that decides who sits in which seat, and when a seat is handed on. Stage two of the serving series, mapped in Build Your Own Inference Engine .
Before you start. Build Your Own Inference Engine is the map of the six stages, and Serve 01: The KV Cache gave each reply a cache so a new character costs one row. Later in this track, The Two Clocks (TTFT, TPOT, and why goodput is the number) names the two waits a user feels, and Chunked Prefill (one long prompt must not freeze the room) is the no-code twin of the scheduling ideas here. The small GPT that writes the replies is from Sampling and What Scale Buys . If a queue is new to you, The order slip rail (queues & the utilization cliff) covers it, but nothing here depends on it.
The idea in 30 seconds
A batch stacks several replies as rows of one pass, and the weights are read once for all of them, which is why a full batch is cheap per reply.
Static batching runs a group until its longest reply ends, so shorter replies keep computing padding. In the toy that was 39 percent of the rows.
Continuous batching hands a slot to the next waiting reply the round it frees, so no row is wasted until the queue is empty.
Orca (OSDI 2022) named this iteration-level scheduling, and vLLM’s scheduler uses it. The three schedules in the toy write identical text.
The toy shows padding waste and the speedup order. It cannot show where a GPU stops gaining as the batch grows.
Read the story
Lesson 72 of 83 in AI
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson July 2022: a batch that could not change Eight seats, and why a full bus is cheap Continuous batching: the seat is handed on at the stop What the numbers say, and what they do not A bus of four, by hand Counting the real bus What the file does at each stop All of it in code Break it Terms it explains: pass, batch, slot, static batching, padding, 39 percent, continuous batching, stop, row.
Review AI
Mark as read Saved in this browser, and to your account when you sign in.