Multi-Bin Batching for Increasing LLM Inference Throughput

Ozgur Guldogan, Jackson Kunde, Kangwook Lee, Ramtin Pedarsani · DOI

Introduction

Large Language Model (LLM) inference is a computationally intensive task. To optimize resource utilization, engineers typically employ batching, where multiple requests are processed simultaneously on a GPU. However, LLMs generate text auto-regressively, token-by-token. Because different requests vary significantly in their output lengths, standard batching often leads to inefficiencies.

In a standard batching system, the GPU remains occupied until the longest request in the batch is completed. If a batch contains several short requests and one long "straggler," the resources allocated to the short requests remain idle once they finish, leading to what the authors term "Waste of Computation" (WoC).

Standard vs. Binning-Based Batching illustrating the Waste of Computation (WoC) problem and the proposed solution.

Multi-Bin Batching Methodology

To mitigate this waste, the authors propose Multi-Bin Batching, a control policy that groups requests by their predicted output lengths. The workflow consists of four primary stages:

  1. Length Prediction: Upon arrival, a request's output length is estimated using a predictor, such as a fine-tuned BERT model or a simple linear regression.
  2. Binning: The system maintains $k$ distinct bins, each corresponding to a specific range of output lengths.
  3. Batch Formation: Requests are routed to their respective bins. A batch is dispatched to the GPU once a bin reaches a target batch size ($B$).
  4. Processing: By ensuring that requests within a batch have similar lengths, the system minimizes idle time, as most requests finish near-simultaneously.

The researchers provide a queueing-theoretic analysis to demonstrate that as the number of bins ($k$) increases, the system's throughput approaches the theoretical maximum of the hardware.

Experimental Setup

The approach was validated using several benchmarks and models:

  • Datasets: Real-world response length distributions were sourced from GSM8K (math queries) and a 120k sample subset of LMSYS-Chat-1M.
  • Models: Experiments utilized Microsoft’s Phi-3.5 Mini Instruct and Vicuna 13B.
  • Hardware: Performance was evaluated on an NVIDIA A100-80G GPU.

Key Results and Insights

The study reveals a significant "Variance Trap": throughput is limited not just by raw GPU speed, but by the variance of task lengths within a batch. By reducing this variance, Multi-Bin Batching unlocks latent GPU capacity.

Average Latency vs. Traffic Intensity (Lambda) showing how increasing the number of bins improves the throughput threshold.
  • Throughput Improvements: In an "oracle" scenario with perfect length prediction and 32 bins, the system achieved a 70% throughput increase over standard batching. In a practical implementation using a BERT-based predictor for Vicuna 13B, the authors observed an 8% throughput gain.
  • Latency-Throughput Trade-off: Increasing the number of bins improves throughput but can introduce additional latency. Requests may wait longer in a bin to form a full batch if the arrival rate for that specific length range is low.
  • Robustness: The system is remarkably resilient to prediction errors. Even if a request is misclassified into an adjacent bin, the performance gains remain substantial compared to no binning.

Conclusion and Future Work

Multi-Bin Batching offers a theoretically sound and practically viable method for improving LLM inference efficiency. While the current study focuses on static batching, the authors identify several avenues for future research:

  • Improving Predictors: The gap between oracle (70%) and real-world (8%) gains suggests that more accurate length estimation is a key bottleneck.
  • Continuous Batching Integration: Adapting multi-bin strategies to modern "continuous batching" engines (like vLLM) is a critical next step.
  • Adaptive Binning: Dynamically adjusting bin boundaries based on real-time traffic patterns could further optimize the latency-throughput balance.

Summary updated

BibTeX
@misc{guldogan2024multi,
  author = {Ozgur Guldogan and Jackson Kunde and Kangwook Lee and Ramtin Pedarsani},
  title = {{Multi-Bin Batching for Increasing LLM Inference Throughput}},
  year = {2024},
  eprint = {2412.04504},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.04504},
}
Figure