Continuous batching is an iteration of dynamic batching specifically designed for the autoregressive nature of generative models. Unlike static batching, which waits for every sequence in a batch to finish generating its end-of-sequence token before scheduling the next batch, continuous batching operates at the individual iteration level. As soon as a sequence completes, it is evicted, and a new request from the queue is inserted into the GPU's compute stream, ensuring the accelerator never stalls waiting for stragglers.
Glossary
Continuous Batching

What is Continuous Batching?
Continuous batching is an advanced serving technique for large language models that dynamically evicts completed sequences from a processing batch and immediately inserts new requests, eliminating idle GPU time inherent in traditional static batching.
This technique directly addresses the variable-length output problem inherent in text generation, where a batch might contain a 10-token response and a 500-token response. By preventing idle compute time, continuous batching dramatically increases throughput—often by an order of magnitude—without sacrificing individual request latency. It is a core architectural feature of high-performance serving engines like vLLM, which pairs it with PagedAttention for efficient KV cache memory management.
Key Features of Continuous Batching
Continuous batching is an advanced serving technique that dynamically evolves the composition of a processing batch at each generation step, eliminating idle compute time and maximizing GPU utilization for large language models.
Dynamic Sequence Eviction
Unlike static batching, which waits for the longest sequence in a batch to finish, continuous batching evicts completed sequences immediately. When a sequence generates an end-of-sequence token, its slot is freed at the next iteration. This prevents finished requests from occupying memory and compute while others continue, directly reducing P99 latency for mixed-length workloads.
Just-in-Time Request Insertion
As soon as a sequence slot is freed, a new request from the waiting queue is inserted into the active batch without delay. This greedy scheduling ensures the GPU never waits for a batch to fully drain before accepting new work. The result is a consistently high batch size and near-optimal hardware utilization, even under irregular traffic patterns.
PagedAttention KV Cache Management
Efficient continuous batching requires non-contiguous memory management for the KV cache. Implementations like vLLM use PagedAttention, which allocates key-value tensors in discrete blocks—analogous to virtual memory paging. This eliminates internal fragmentation, allows memory sharing across sequences, and enables the dynamic resizing required for eviction and insertion without costly memory copies.
Preemption and Priority Scheduling
Advanced continuous batching systems support preemption, where a low-priority sequence can be temporarily swapped out of GPU memory to make room for a high-priority request. The preempted sequence's KV cache blocks are offloaded to CPU RAM and later restored. This enables Service Level Objective (SLO)-aware scheduling, ensuring critical requests meet strict latency targets.
Throughput vs. Latency Trade-off
Continuous batching maximizes throughput—tokens generated per second across all users—by keeping the GPU saturated. However, individual request latency can increase if the scheduler prioritizes batch size over fairness. Production deployments often combine continuous batching with rate limiting and backpressure to prevent queue buildup and maintain acceptable per-user response times.
Iteration-Level Scheduling Loop
The core loop operates at the token generation step, not the request level. At each iteration, the scheduler:
- Runs one forward pass on the current batch
- Checks for newly completed sequences
- Evicts finished sequences and reclaims KV cache blocks
- Dequeues pending requests and inserts them into freed slots This tight loop allows batch composition to change every few milliseconds.
Frequently Asked Questions
Explore the mechanics, benefits, and implementation details of continuous batching—the serving technique that maximizes GPU utilization for generative models by dynamically managing in-flight requests.
Continuous batching is an advanced model serving technique that dynamically inserts new inference requests into a running batch and evicts completed sequences on-the-fly, rather than waiting for every sequence in a batch to finish before moving to the next iteration. This mechanism directly addresses the inefficiency of static batching, where a batch's throughput is gated by its longest-running sequence. In a generative large language model (LLM) serving context, the process works by monitoring the generation loop at each token step. When a sequence generates an end-of-sequence token or reaches its maximum length, it is immediately removed from the batch. Simultaneously, a new request from the waiting queue is inserted into the freed slot. This ensures that the GPU's compute units are never idle, maximizing hardware utilization and dramatically increasing the number of tokens processed per second.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core infrastructure concepts that work alongside continuous batching to minimize inference latency and maximize throughput in production generative AI systems.
P99 Latency
A tail latency percentile indicating that 99% of inference requests complete faster than this threshold. The most revealing metric for user experience in high-throughput systems.
- Averages hide the worst-case experience; P99 exposes the outliers
- Continuous batching directly improves P99 by preventing head-of-line blocking from long sequences
- Common SLO target: P99 < 200ms for real-time personalization
- Monitored alongside P50 and P95 to understand the full latency distribution curve
Backpressure
A flow control mechanism that signals upstream clients to throttle request rates when the serving system approaches saturation.
- Prevents unbounded queue growth that would cause latency spikes and OOM errors
- Implemented via HTTP 429 (Too Many Requests) with Retry-After headers or gRPC flow control frames
- Works in concert with continuous batching: when batch slots are full, backpressure protects system stability
- Essential for maintaining SLO compliance under unpredictable traffic bursts

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us