NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Batch-Max: Higher LLM Throughput using Larger Batch Sizes and KV Cache Compression

Michael R. Metel, Boxing Chen, Mehdi Rezagholizadeh

TL;DR

Most KV cache compression methods only discard tokens during the decoding (generation) phase, leaving substantial GPU memory tied up by long prompts during prefilling. Batch-Max compresses the KV cache during both prefilling and decoding using a simple, bias-free average-attention eviction rule. By preventing prompt prefilling from becoming a memory bottleneck, it allows LLM inference to run at much larger batch sizes—delivering up to 50% higher throughput while maintaining over 97% of full-cache accuracy.

What Problem Does This Paper Address?

In LLM inference, memory consumption is dominated by the key-value (KV) cache. When serving tasks where the input context is much longer than the generated response (e.g., document summarization or multi-shot in-context learning), the peak memory requirement occurs during the initial prompt processing stage (prefilling).

Existing KV cache eviction methods (such as $H_2O$, SnapKV, and Scissorhands) generally process the entire prompt uncompressed and only begin evicting tokens during token generation (decoding). Under a fixed GPU memory budget, this creates a major bottleneck: the memory allocated for the uncompressed prompt during prefill sits idle during decoding, severely capping the maximum allowable batch size ($b$).

Methods

The authors introduce Batch-Max (BM), a framework that enforces a maximum KV cache size $|kv|$ across both prefilling and decoding (P&D):

  • Block-wise Prefilling & Eviction: Instead of ingesting the entire input sequence at once, the prompt is processed in blocks. Once the cache reaches capacity $|kv|$, the algorithm evicts $p$ key-value pairs (set to $p = 64$) every $p$ tokens processed during prefilling or generated during decoding.
  • Hyperparameter-Free Average Attention Eviction: Prior methods like $H_2O$ score tokens by summing past attention weights, which heavily biases eviction against newer tokens (earlier tokens accumulate attention across more steps). Rather than manually maintaining a separate "recent token buffer," Batch-Max divides the accumulated attention by the token's lifetime: $$\text{ave\_weights} = \frac{\text{sum\_weights}}{\text{curr\_id} + 1 - \text{kv\_ids}}$$ Tokens with the lowest average attention are evicted.

  • Extreme Decoding Baseline (ED): To show that the throughput gains come from enabling larger batch sizes rather than just a faster eviction rule, BM is compared against an "Extreme Decoding-only" upper bound that retains only the most recent KV pair ($|kv| = 2$) during decoding.

Standard Eviction:  [---- Full Prefill (High Peak Memory) ----] -> [ Compressed Decoding ]
Batch-Max (P&D):    [-- Block Prefill + Evict (Low Peak Mem) --] -> [ Compressed Decoding ]
                    ↳ Lower peak memory enables significantly larger batch sizes!

Datasets

The authors evaluated Batch-Max on three standard long-input benchmark tasks (no new datasets were introduced):

  • CNN/DailyMail (CNN/DM): 1-shot abstractive text summarization.
  • NarrativeQA: 2-shot reading comprehension over long stories.
  • GSM8K: 16-shot grade-school mathematical reasoning.

Evaluations were performed across 960 test samples using Llama-2-13b-chat (on NVIDIA V100 32GB GPUs) and Phi-3.5-mini-instruct (3.8B on NVIDIA TITAN V 12GB GPUs).

Key Insights and Ideas

  • Overcoming Prefill Trade-offs: Evicting KV pairs during prefill introduces potential pitfalls: block-wise computation slows down prefilling, earlier evictions cannot observe future prompt tokens, and subsequent token representations carry minor approximation errors. However, the authors find that the ability to drastically increase batch size far outweighs these overheads in throughput.
  • Batch Size is King for Throughput: While decoding-only eviction speeds up token generation steps, throughput in memory-constrained settings is ultimately dominated by how many sequences can run concurrently. For example, on CNN/DM with Llama-2-13b, decoding-only eviction ran out of memory at batch size $b=5$; Batch-Max scaled up to $b=40$.
  • Attention Normalization Eliminates Recency Windows: Dividing cumulative attention by the token's existence duration naturally removes positional bias, providing a clean, tuning-free eviction metric without needing heuristic protected recency buffers.

Key Results

  • Throughput: Batch-Max achieved on average 44.0% higher throughput across all benchmarks compared to the aggressive decoding-only upper bound (ED).
  • On Llama-2-13b, BM delivered up to 50.4% higher throughput than ED (e.g., jumping from 42.0 to 80.3 tokens/s on CNN/DM).
  • On Phi-3.5-mini, BM throughput was 37.7% higher on average than ED.
  • Model Quality: Accuracy remained closely aligned with the full KV cache (FKV) baseline, exhibiting only a 2.2% average drop:
  • On Llama-2-13b CNN/DM, BM achieved 0.142–0.146 ROUGE-2 (matching or closely trailing FKV's 0.145).
  • On GSM8K with Phi-3.5, BM maintained 0.774 accuracy vs. FKV's 0.783, while boosting throughput from 27.1 to 43.8 tokens/s.

Limitations and Future Work

  • Sequence Length Asymmetry: Batch-Max is specifically beneficial when input context length ($s$) exceeds generation length ($s > |kv|$). If the prompt is short relative to generation, prefill compression yields no memory advantage.
  • Heuristic Eviction Chunking: The eviction step size ($p = 64$) and cache budgets ($|kv|$) were selected via fixed grid values rather than dynamic, per-layer, or token-adaptive allocation.
  • Error Compounding: While empirical task performance remained high, evicting KV pairs before the entire prompt is ingested introduces representation drift in deep layers that is not yet theoretically bounded.

Summary updated

BibTeX
@inproceedings{metel2025batch,
  author = {Michael R. Metel and Boxing Chen and Mehdi Rezagholizadeh},
  title = {{Batch-Max: Higher LLM Throughput using Larger Batch Sizes and KV Cache Compression}},
  booktitle = {ES-FoMo-III @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=j7OED598Kz},
}
Figure