INFINITE UPSIDE

Business and technology

Continuous Batching: Who Gets Finished Sooner?

An earlier free slot can help queued requests while delaying the long request already in progress.

A server can finish more customers' requests by a deadline while making one customer wait longer. Continuous batching makes that possibility easier to see because it changes who joins the next generation step, rather than keeping the original group together until its longest request finishes.

The word continuous does not settle the service decision. Prompt processing, generation, memory admission and preemption still consume resources. Follow a small scheduler trace before turning a high aggregate completion count into a promise about every user's experience.

The mechanism between iterations

The September 2023 PagedAttention paper describes iteration-level batching: completed requests leave and new ones can enter between generation iterations. It distinguishes the prompt phase from subsequent autoregressive generation and explains how KV-cache capacity constrains admission. Its historical evaluations use specified models, hardware and synthesized arrival traces; their speed multipliers are not a current serving-library guarantee.

The existing GPU-memory guide explains why fitting model weights is insufficient. Here we hold capacity fixed and examine a different choice: what happens when an empty request slot becomes available while another request is still generating?

One fictional machine, four requests

Use an original, deliberately simplified machine. It has two active request slots, each reserving enough cache for a sequence of six tokens. Every request has a one-token prompt. Waiting requests have not yet allocated an active slot. The longest case below has one prompt token plus five output tokens, so no admitted request exceeds its slot; there is no swapping, recomputation or memory failure.

A prompt-processing operation takes one second for either one request or a batch of two, and emits each admitted request's first output token. A later decode iteration also takes one second and emits one additional token for each generating request in that iteration. Prompt processing and decoding share the same execution resource, so one pauses the other. These are stipulated timings, not measurements of a GPU or a claim that real prefill time is constant.

The requests are: A arrives at time 0 and needs five output tokens; B arrives at time 0 and needs two; C arrives at time 1 and needs two; D arrives at time 2 and needs two. Output lengths are fixed facts of this exercise, not information the scheduler uses to choose who is shortest. At a time boundary, completed work is processed before admission, and equal-time arrivals are eligible for that next decision.

Both policies use the same machine, arrivals, prompts, outputs and first-come ordering. There are no other tasks, communication delays or costs. All times below are seconds after time 0. The question is a finite scheduling comparison, not a dollar-cost or production-capacity estimate.

Keep the original request batch

The request-batch policy admits A and B together. Prompt processing runs from 0 to 1 and emits their first tokens. Decode from 1 to 2 gives both a second token, completing B at 2.

This policy keeps the batch membership fixed until A completes. A receives its remaining tokens at 3, 4 and 5. B's freed slot remains unused. C and D wait even though each is already queued.

At 5, A finishes and the policy admits C and D together. Their prompt phase runs from 5 to 6, producing first tokens. Decode from 6 to 7 completes both. Completion times are A: 5, B: 2, C: 7 and D: 7.

Admit between generation iterations

The continuous-admission policy starts identically: prompt processing from 0 to 1, then decode from 1 to 2. B completes at 2. A still needs three more output tokens.

The free slot admits C. Prompt processing from 2 to 3 emits C's first token while A waits. Decode from 3 to 4 advances both: C finishes at 4, while A still needs two tokens.

D enters the newly free slot. Its prompt phase from 4 to 5 again pauses A. Decode from 5 to 6 completes D and leaves A one token short. Decode from 6 to 7 finishes A. Completion times are A: 7, B: 2, C: 4 and D: 6.

The policy admitted waiting work earlier but paid for two separate one-request prompt phases after the initial batch. The request-batch policy processed C and D's prompts together. The simplified timings make that extra prompt operation offset a saved decode iteration; both schedules finish the entire workload at 7.

Whose wait improved?

At time 6, request batching has completed two requests, A and B. Continuous admission has completed three, B, C and D. In that finite window, continuous admission has served more completed requests. By time 7 both have completed all four, so this trace supplies no improvement in full-workload makespan or steady-state capacity.

Measure response time from arrival to completion. Request batching gives A, B, C and D response times of 5, 2, 6 and 5 seconds, averaging 4.5. Continuous admission gives 7, 2, 3 and 4, averaging 4.0. The average improves while A's response gets two seconds worse. B's does not change.

Queue time also tells only part of the story. C waits until prompt processing starts at 5 under request batching, versus 2 under continuous admission. D starts at 5 versus 4. A began immediately under both policies, but later prompt admissions interrupt its progress. A dashboard showing admission delay alone would miss that consequence.

Change the assumptions before extending the result

A real scheduler may mix or split prompt processing differently. Longer prompts can make interruption more expensive; a larger active batch can change iteration time; cache growth can force preemption. The paper separately discusses recovering evicted cache through swapping or recomputation. None of those operations is present or free in this fictional trace.

Likewise, unknown output lengths complicate capacity planning. Reserving each request's maximum may leave room unused; admitting optimistically can create a later memory problem. This exercise intentionally removes that uncertainty to isolate admission and shared prompt work. It does not prove that its simple policy is optimal or reproduce a particular vLLM release.

For the actual service choice, compare schedules on representative arrivals and lengths, including prompt stalls and overload. Define whether the requirement concerns time to first token, completion, a particular customer class or total completed work. Keep incomplete requests and errors in the population rather than dropping the people still waiting when the measurement stops.

The latency-percentile guide explains the separate problem of interpreting a measured tail. Four fictional requests do not estimate a service's p99. They do show why “more finished by six seconds” and “everybody waited less” need different evidence.

Explore Infinite Upside

For Vijay Sheth’s personal accounts, read Infinite Upside: Building Wealth With Room to Live, published by Sheth Capital, Inc.

Find your edition · Chapter companion

Why does an AI model need more GPU memory than its file size?

Why does an AI model need more GPU memory than its file size?

ABOUT THE CONTRIBUTOR

Luna Lim

DIRECTOR OF FINANCIAL RESEARCH & EDITORIAL STRATEGY

SHETH CAPITAL, INC.

Luna Lim writes about business, investing, and the judgment behind financial decisions. She joined PCH Exotics Inc. as Director of Operations in 2022, working across La Jolla and Miami. Today, she reports directly to Vijay Sheth at Sheth Capital, Inc., bringing an operator’s perspective to the ideas she covers.

Based in Pacific Beach, California, Luna is curious about the people behind the numbers: what they’re building, how they weigh uncertainty, and what makes a risk worth taking. Her articles for Infinite Upside follow those questions through the details, with clear explanations and a feel for how decisions play out in everyday business.

More from Luna Lim

The Infinite Upside store