Continuous Batching vs Static Batching for Enterprise LLM Inference: Architecture, Latency, and Throughput Performance

NoraLin 94 2026-11-16 23:13:55 Edit

Deploying large language models (LLMs) in enterprise production environments requires solving a fundamental economic dilemma: balancing per-request response latency against aggregate serving throughput. In traditional deep learning inference, serving engines utilized static batching, grouping incoming requests into fixed rectangular tensors. However, generative transformers exhibit extreme output length variance: one user prompt may require a concise 10-token completion, while an adjacent request in the same batch generates 1,500 tokens of reasoning code. Under static batching, faster requests complete early but remain trapped in GPU High Bandwidth Memory (HBM), forcing tensor cores to process meaningless padding tokens until the slowest sequence terminates. To eliminate these massive padding bubbles, modern inference runtimes have standardized on continuous batching—also known as iteration-level or cellular scheduling. Examining the underlying architectural mechanics reveals how continuous batching quadruples serving throughput while fundamentally reshaping memory and compute dynamics.

Continuous Batching vs Static Batching LLM Inference Architecture

Mechanics of Continuous Batching: Iteration-Level Scheduling vs Naive Static Batches

The core distinction between static and continuous batching lies in the granularity of the scheduling execution loop. In static batching, the scheduling quantum is the entire request lifecycle: a batch of size N is formed, moved to GPU memory, and stepped through the forward pass repeatedly until every sequence emits an end-of-sequence (EOS) token or reaches maximum context length.

Continuous batching—originally pioneered by systems like Orca and productized by vLLM and TensorRT-LLM—shifts the scheduling quantum to the individual iteration token step. At every forward pass iteration, the inference engine inspects the current batch state: requests that generate an EOS token are evicted immediately, releasing their Key-Value (KV) cache slots, while incoming new requests in the prefill queue are dynamically inserted into the running batch without waiting for neighboring sequences to finish.

The Anatomy of Padding Bubbles

The inefficiency of static batching can be formalized mathematically. Consider a batch of N requests where each request i generates L_i tokens, and L_max = max(L_1, ..., L_N). Under static batching, the total compute cycles expended are proportional to N * L_max, whereas useful compute is strictly the sum of L_i. The wasted compute fraction—the padding bubble—is defined as:

// Wasted Compute Fraction in Static Batching:
// Wasted_Ratio = 1 - ( Sum(L_i for i in 1..N) / (N * L_max) )

In real-world enterprise traffic with high variance, L_max frequently reaches 1,000+ tokens while the median length is under 150 tokens, causing over 65% of GPU tensor core cycles to be squandered processing padding masks.

Architectural Dimension Static Batching Continuous (Iteration-Level) Batching
Scheduling Quantum Whole request lifecycle (Request-level) Single forward token pass (Iteration-level)
Padding Overhead High (Tensors padded to L_max sequence) Zero (Dynamic ragged tensor execution)
GPU Compute Efficiency Low (Tensor cores stall on masked padding) High (90%+ streaming multiprocessor saturation)
KV Cache Memory Management Static contiguous pre-allocation to max_length Dynamic non-contiguous paging (PagedAttention)
Latency Tail Behavior (P99) Severe head-of-line blocking Stable, deterministic Time Per Output Token (TPOT)

Throughput and Latency Dynamics: TTFT, TPOT, and Memory Fragmentation

Continuous batching fundamentally alters the relationship between the two primary latency metrics governing enterprise LLM service level agreements: Time to First Token (TTFT) and Time Per Output Token (TPOT).

PagedAttention Memory Allocation and Block Table Flowchart

Pre-fill vs Decode Phase Contention

Transformer inference operates in two fundamentally distinct computational regimes:

  1. Prefill Phase (Compute-Bound): Ingests the entire user prompt simultaneously. Compute intensity is high because attention computation scales quadratically with prompt length, fully saturating GPU matrix multiplication units (e.g., Tensor Cores).
  2. Decode Phase (Memory-Bandwidth-Bound): Generates one token at a time autoregressively. Each new token requires reading the entire preceding KV cache from HBM, making the operation strictly limited by GPU memory bandwidth rather than floating-point compute capacity.

When a continuous batching scheduler admits a new request with a 2,000-token prompt into an ongoing batch of decoding requests, the intensive prefill computation can monopolize the GPU for 80–150 milliseconds. This causes a sudden latency spike in the decoding streams—an effect known as prefill-induced decode jitter. Modern production engines mitigate this by implementing chunked prefill, breaking large prompts into 512-token chunks that interleave smoothly with active decode iterations.

Solving Memory Fragmentation with PagedAttention

Continuous batching cannot function efficiently with traditional contiguous memory allocators. Because sequence lengths are unpredictable, static allocation forces systems to reserve the maximum possible context window (e.g., 8,192 tokens) per request in advance. In practice, over 60% of reserved VRAM remains completely untouched, starving the system of concurrency. Run-time systems resolve this by implementing virtual memory paging—such as vLLM's PagedAttention. KV caches are segmented into small physical blocks (typically 16 tokens per block). Logical block tables dynamically map non-contiguous physical pages in GPU VRAM, reducing internal memory fragmentation from >60% down to under 4%.

Operational Boundaries and Production Sizing: Prefill-Decode Disaggregation and GPU Saturation

  • Memory Headroom Threshold: Maintain at least 15% VRAM margin above active KV cache allocation to prevent out-of-memory kernel panics during sudden concurrency spikes.
  • Prefill-Decode Disaggregation Trigger: Transition to disaggregated serving pools when prompt lengths consistently exceed 4,000 tokens to isolate decode latency from prefill compute saturation.
  • NVLink Interconnect Sizing: Ensure tensor-parallel ranks utilize high-speed NVLink fabrics to prevent inter-GPU KV cache synchronization bottlenecks.

While continuous batching dramatically improves aggregate throughput, scaling it in high-concurrency enterprise deployments introduces concrete operational boundaries.

LLM Inference Throughput and Latency Telemetry Benchmark Dashboard

Memory Headroom Sizing Formula

In production sizing, the maximum concurrency (batch size B_max) an accelerator node can sustain is strictly bounded by available GPU memory after model weights are loaded:

// KV Cache Sizing Formula for Llama-3-70B (BF16, Grouped-Query Attention):
// KV_Bytes_Per_Token = 2 * n_layers * n_kv_heads * head_dim * precision_bytes
// For 70B: 2 * 80 layers * 8 kv_heads * 128 dim * 2 bytes = 327,680 bytes/token (~320 KB/token).
// At 4,096 tokens per request: ~1.31 GB per active concurrent request.
// An 8x H100 node (640GB total VRAM) holding 140GB model weights leaves ~500GB for KV cache:
// Maximum Concurrency = 500 GB / 1.31 GB = ~380 concurrent active streams.

Architectural Frontier: Prefill-Decode Disaggregation

At extreme enterprise scale (thousands of requests per second), the interference between compute-heavy prefill and memory-heavy decode reaches an efficiency ceiling. The emerging architectural paradigm is Prefill-Decode Disaggregation: separating clusters into dedicated Prefill Worker Nodes (equipped with compute-dense accelerators) and Decode Worker Nodes (optimized for maximum HBM memory bandwidth and capacity), transferring intermediate KV cache states across high-speed RoCEv2 fabrics via RDMA.

To support these demanding memory and networking regimes, OneSource Cloud provides dedicated bare-metal GPU infrastructure engineered with non-blocking NVLink interconnects and direct RoCEv2 fabrics. By eliminating hypervisor memory overhead and offering high host-to-device PCIe Gen5 bandwidth, OneSource Cloud maximizes available KV cache memory and delivers deterministic, ultra-low-latency continuous batching performance.

Frequently Asked Questions

Why does continuous batching significantly reduce Time Per Output Token compared to static batching?

Because continuous batching evicts completed requests immediately at each token iteration, eliminating padding bubbles and allowing tensor cores to execute dense, unpadded matrix multiplications without waiting for straggler sequences.

How does OneSource Cloud optimize continuous batching performance for enterprise LLM serving?

OneSource Cloud provides dedicated bare-metal GPU nodes with non-oversubscribed NVLink memory buses and high-bandwidth host DDR5 channels, maximizing KV cache memory allocation and preventing prefill-decode starvation.

Previous: Private LLM Deployment: Infrastructure Requirements for Enterprise Teams
Next: Disaggregated Prefill and Decode for Enterprise LLMs: KV Cache RDMA Transfer, TTFT, and Serving Economics
Related Articles