
For anyone running an inference server: a zero-variance control, five traffic traces, and an engine-vs-scheduler split show where the gains come from. The post Continuous Batching Beats Static and Dynamic by Up to 2.91× in vLLM appeared first on Towards Data Science .
For anyone running an inference server: a zero-variance control, five traffic traces, and an engine-vs-scheduler split show where the gains come from.
Prefer us on GoogleSharePhoto by Buzz Andersen on UnsplashThe 23× continuous batching claim bundles engine, memory manager and scheduler. Measured separately on one GPU, the scheduler alone is worth 2.91×.IntroductionThere is one number I kept seeing in LLM serving discussions: Anyscale reports up to 23× throughput over naive HuggingFace transformers using continuous batching and related memory optimizations. This is an impressive number and I'm curious to know what the scheduler itself was actually worth. Hence, I dug further into Anyscale's report, and found out that Anyscale’s comparison contains at least 3 things: a faster engine, better KV-cache management, and a scheduler that admits new requests between decoding iterations in vLLM. The scheduler is the most interesting and flexible piece, so I built a test where the scheduler was the only variable.
And the result is that the scheduler improved throughput by 2.91×. The engine was worth 1.33×, while the full naive-to-vLLM change measured 3.86× on my hardware. What gave me the most confidence was the control. The control mattered because continuous batching should provide no benefit when every request finishes together. It measured 1.00×, exactly as expected. That gave me more confidence that the larger gains in the other runs were actually coming from the scheduler, rather than from some other difference in the setup.
The main thing I found is that output-length variation matters: when requests finish at different times, continuous batching can refill the gaps; when they finish together, there is little to recover. Think of a batch like a meeting room. If people leave at different times, continuous batching fills each empty seat as it opens. If everyone leaves together, there is nothing to refill.
Anyone who is running an inference server, or choosing one, and who has seen claims of 10× or 20× gains from continuous batching can find this article beneficial.
Learn this step by step with the interactive AI Agents roadmap.
Before the batching policies make sense, I found it useful to separate transformer generation into prefill and decode. Prefill reads the prompt in one forward pass, so its cost grows with prompt length and gives the GPU plenty of arithmetic work. Decode is different: it produces one token per sequence per step, and each step has to read the model weights again. That distinction is important because I initially expected a larger decode batch to make each step noticeably slower. However, it does not show this in my measurements.
Qwen2.5-7B-Instruct in bfloat16 has about 15.2 GB of weights. The GB10 in the DGX Spark provides 273 GB/s of rated memory bandwidth, so reading those weights once gives a theoretical floor of about 55.7 ms.: I measured 78.05 ms per step at batch 1, about 1.4× that floor. That works out to 194.7 GB/s, or 71% of rated bandwidth, but I would not treat that as a DRAM-efficiency measurement. Decode does more than read weights, so I use it only as a consistency check. The useful comparison for me is a truck going to a warehouse. The trip takes roughly the same time whether I bring back one order or load several orders onto the same truck. Batching lets more sequences use the weights I already had to fetch.
Let's look at what happened when I increased the batch.
Moving from batch 1 to batch 32 increased total throughput by 26.7×, while the measured gap between streamed tokens stayed roughly flat. I saw 78.05 ms at batch 1 and 74.77 ms averaged across the batch-32 runs. This result is a surprise as the larger batch was not slower between tokens.
However, these are client-side inter-token gaps, not GPU iteration timings. The batch-32 number is also based on 3 runs of 512 requests, while batch 1 used 1 run of 16 requests, so I would not make anything of the roughly 4% difference. Serving 32 sequences in a decode step did not make that step materially slower than serving 1. Both cases still had to read the same 15.2 GB of weights.
Regarding per-request cost, a request in the batch-32 case waited about 2.8 seconds from admission to first token, compared with 121 ms for a lone request. That delay comes from batching and prefill rather than from slower token-to-token decoding. Across 128 output tokens, that extra wait reduced effective per-sequence throughput from 12.76 tokens/s to 10.66 tokens/s, a 16% drop. In other words, the penalty appeared before streaming began, not between later tokens.
Once a request was streaming, I did not observe slower token delivery at batch 32.
That is the trade I would carry into the batching policies that follow. For decode, leaving a batch slot unused does not save the weight-read cost. I would therefore focus next on keeping those slots occupied without letting prefill and queueing delay grow beyond what users can tolerate.
I kept the workload fixed: eight requests, four slots, and the same output lengths. I changed only one thing: when a waiting request was allowed to start. That small change produced most of the difference.
Towards Data Science - Medium
Original Reporting Source
Explore features, ratings, and alternatives from our 19,000+ AI tools catalog.

AssistLoop's AI chatbots slash response times by 70% and boost satisfaction, scaling support for e-commerce and SaaS without extra hires.

Design professional websites effortlessly with AI.
Hypertxt.ai is an AI-powered SEO content writing tool that helps create high-quality, optimized content for improved search engine rankings. It offers various features to streamline the content creation process, from keyword research to content optimization and plagiarism checks.