Continuous batching, also known as iteration-level or rolling batching, is a core inference optimization for autoregressive models like LLMs. Unlike static batching which processes a fixed group of requests simultaneously, it treats the batch as a fluid queue. As each request in the batch generates its next token, finished sequences are immediately ejected, and new pending requests are dynamically inserted. This eliminates idle compute cycles, dramatically improving GPU utilization and overall throughput compared to static methods, especially for requests with variable sequence lengths.
Glossary
Continuous Batching

What is Continuous Batching?
Continuous batching is a dynamic scheduling technique for autoregressive model inference that maximizes hardware utilization by adding new requests to a running batch as previous ones complete.
The technique is fundamental to high-performance inference servers like vLLM and NVIDIA Triton. It works by managing a shared KV cache across all active sequences, allowing the hardware to perform a single, consolidated matrix multiplication per generation step for the entire active set. This approach is closely related to other latency-reduction methods like PagedAttention for efficient memory management and speculative decoding. For on-device inference optimization, continuous batching is a key strategy to extract maximum performance from constrained edge hardware.
Key Features of Continuous Batching
Continuous batching, also known as iteration-level scheduling or rolling batching, is a dynamic inference optimization technique for autoregressive models like LLMs. It maximizes hardware utilization by treating the batch as a fluid pool of requests that are added and removed as they start and finish generation.
Dynamic Request Pooling
Unlike static batching, which waits for a fixed batch to fill, continuous batching maintains a running batch of active requests. New requests are added to this pool as soon as they arrive, and finished requests are removed immediately upon generating their end-of-sequence token. This creates a fluid batch size that adapts to the real-time request load, preventing idle compute cycles and dramatically improving GPU utilization.
Iteration-Level Scheduling
Scheduling decisions are made at the granularity of a single generation step (iteration), not per request. The scheduler examines all active requests in the pool before each forward pass of the model. It groups only the tokens that need to be processed in the next step. This fine-grained control is the core mechanism that allows efficient interleaving of requests at different stages of completion, minimizing padded tokens and wasted FLOPs.
Non-Contiguous Memory Management
A key engineering challenge is managing the Key-Value (KV) cache for requests of variable sequence lengths within a dynamic batch. Advanced systems like vLLM use PagedAttention, which manages the KV cache in non-contiguous, paged memory blocks (similar to virtual memory in operating systems). This allows:
- Efficient memory sharing for identical prompts.
- Elimination of internal fragmentation from padding.
- Dynamic allocation and deallocation as requests start and finish.
Latency vs. Throughput Trade-off Control
Continuous batching provides a tunable knob between latency and throughput. Parameters like the maximum batch size and scheduling policy (e.g., First-Come-First-Served vs. prioritizing short requests) can be adjusted. This allows serving systems to be optimized for different scenarios:
- Low-latency interactive chat: Smaller, more fluid batches.
- High-throughput batch processing: Larger, more stable batches. The system inherently provides better latency for early-finishing requests compared to static batching.
Integration with Other Optimizations
Continuous batching is not a standalone technique; it combines synergistically with other inference optimizations:
- Quantization: Lower precision weights (e.g., INT4) reduce memory bandwidth, allowing larger dynamic batches.
- FlashAttention: Optimized attention computation works within the dynamic batch structure to handle variable sequence lengths efficiently.
- Speculative Decoding: The draft and verification stages can be scheduled across the dynamic request pool. Frameworks like TensorRT-LLM and vLLM integrate these techniques into a cohesive optimization pipeline.
Implementation Frameworks
Continuous batching is implemented in several high-performance open-source inference servers and frameworks, each with specific advantages:
- vLLM: Uses PagedAttention for best-in-class memory efficiency and high throughput.
- TensorRT-LLM: NVIDIA's solution offering deep kernel fusion and optimization for NVIDIA GPUs alongside continuous batching.
- TGI (Text Generation Inference): Hugging Face's server, supporting popular models with continuous batching.
- SGLang: A newer framework that extends continuous batching for complex LLM programming patterns like chained reasoning and agent loops.
Continuous Batching vs. Static and Dynamic Batching
A comparison of core batching strategies for optimizing inference throughput and latency, particularly for autoregressive models like LLMs.
| Feature / Metric | Static Batching | Dynamic Batching | Continuous Batching (Iteration-Level) |
|---|---|---|---|
Scheduling Granularity | Request (entire sequence) | Request (entire sequence) | Token (iteration) |
Batch Composition | Fixed at job start | Dynamic per request arrival | Dynamic per generation step |
GPU Utilization | Low (idle during padding) | Medium | High (near 100%) |
Tail Latency Impact | High (bound to slowest request) | Medium | Low (requests exit immediately) |
Handles Variable Sequence Lengths | |||
Padding Overhead | High | Medium | Minimal to none |
Ideal For | Offline processing, fixed workloads | Online serving with similar-length prompts | Online serving of LLMs, chat endpoints |
Implementation Complexity | Low | Medium | High |
Memory Efficiency (KV Cache) | Low | Medium | High (via PagedAttention) |
Throughput (Tokens/Sec/GPU) | Low | Medium | High |
Frameworks and Systems Using Continuous Batching
Continuous batching is a foundational optimization for modern LLM serving. The following frameworks and systems have pioneered or integrated its core principles to achieve high throughput and low latency.
SGLang & LMDeploy
These are newer, high-performance frameworks that implement advanced continuous batching strategies.
- SGLang (from LMSYS) is a co-design of frontend language and backend runtime. It uses RadixAttention, a technique that automatically caches and reuses the KV cache of common prefixes across requests (e.g., shared system prompts), which is a form of semantic-level batching optimization.
- LMDeploy (from InternLM) is a toolkit for compressing, deploying, and serving LLMs. Its serving engine, Turbomind, features continuous batching with a persistent batch scheduler and efficient W4A16 kernel support, optimized for NVIDIA Tensor Cores.
Underlying System Concept: Iteration-Level Scheduling
Continuous batching is an implementation of a broader systems concept called iteration-level scheduling or rolling batching. The core mechanism is:
- The batch is not static; it is a dynamic set of active sequences.
- The scheduler operates at the granularity of a single generation step (iteration).
- After each step, completed sequences are evicted, and new, eligible requests are inserted.
- This maximizes GPU utilization by ensuring the processing units are always fed with work, minimizing idle time between fixed batch executions. This is contrasted with static batching (fixed for the entire generation) and basic dynamic batching (batches formed only at request arrival).
Frequently Asked Questions
Continuous batching is a critical optimization for serving autoregressive models like LLMs. These questions address its core mechanisms, benefits, and implementation.
Continuous batching (also known as iteration-level scheduling or rolling batching) is an inference optimization technique for autoregressive models where new requests are dynamically added to a running batch as previous requests finish generation, maximizing hardware utilization. Unlike static batching, which processes a fixed group of inputs simultaneously, continuous batching treats each sequence in the batch independently. A central scheduler monitors the generation state of all active requests. When a request finishes (hits an end-of-sequence token), its slot in the batch is immediately freed and can be filled by a new, pending request. This creates a 'rolling' batch where compute resources are constantly saturated, dramatically improving throughput compared to waiting for an entire static batch to complete.
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
Continuous batching is a core technique within a broader ecosystem of optimizations designed to maximize hardware efficiency and minimize latency during model inference.
Static Batching
Static batching is an inference strategy where a fixed number of input samples are grouped into a batch before processing. All requests in the batch must start and finish generation together.
- Key Limitation: Poor GPU utilization when requests have different sequence lengths, as the entire batch waits for the slowest request to finish.
- Contrast with Continuous Batching: Serves as the baseline inefficient method that continuous batching was designed to improve upon by eliminating idle time.
Dynamic Batching
Dynamic batching is an inference optimization where a serving system groups incoming requests into batches on-the-fly, but typically only at request boundaries.
- Operation: The system waits a short time (a scheduling window) to collect multiple requests, then processes them as a single batch.
- Limitation: While better than static batching, it still suffers from inefficiency for autoregressive text generation, as generated tokens cannot be added to a running batch. Continuous batching is a specialized form of dynamic batching that operates at the token level.
PagedAttention
PagedAttention is an algorithm for managing the Key-Value (KV) cache in large language model inference, introduced by the vLLM system. It is a critical enabler for efficient continuous batching.
- Mechanism: Manages the KV cache in non-contiguous, fixed-size memory blocks (pages), analogous to virtual memory in operating systems.
- Benefit for Continuous Batching: Allows for flexible memory sharing between sequences and eliminates internal fragmentation. This enables new requests to be added to a batch without reallocating the entire cache, which is essential for the rolling nature of continuous batching.
Inference Latency
Inference latency is the time delay, measured in milliseconds, between submitting an input to a model and receiving its output. Continuous batching has a complex relationship with this critical metric.
- Throughput vs. Latency Trade-off: Continuous batching is primarily a throughput-maximizing technique. It can increase Time To First Token (TTFT) for individual requests as they may wait briefly in a scheduler queue.
- Optimization Goal: The scheduler's objective is to maximize overall GPU utilization (throughput) while keeping added latency within service-level agreement (SLA) bounds.
Iteration-Level Scheduling
Iteration-level scheduling is a synonym for continuous batching that emphasizes its operational granularity.
- Granularity: Scheduling decisions (adding new requests, removing finished ones) are made at each decoding iteration (step), not just at the start or end of a request.
- System View: This term highlights the continuous batching scheduler as a core component of the inference server's runtime, which must manage computation, memory, and context swaps at every step of the generation process for all concurrent sequences.

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