FairBatching: Fairness-Aware Batch Formation for LLM Inference

Hongtao Lyu, Boyue Liu, Mingyu Wu, Haibo ChenarXiv 2025 · DOI

Abstract

FairBatching is a novel scheduling framework designed to eliminate "computational unfairness" in LLM inference. By dynamically reallocating resources between prefill and decode tasks based on accumulated "slack," it reduces Time-to-First-Token (TTFT) tail latency by up to 2.29× and increases cluster-level capacity by over 54% while maintaining strict throughput targets.

Introduction: The Prefill-Decode Dilemma

LLM inference involves two distinct phases: prefill, which processes input prompts to generate the first token, and decode, which generates subsequent tokens sequentially. Prefill is compute-intensive and sensitive to Time-to-First-Token (TTFT) latency, whereas decode is memory-bound and requires a consistent Time-Per-Output-Token (TPOT).

Current state-of-the-art schedulers, such as Sarathi, employ "stall-free batching" to prioritize decode tasks. While this ensures continuous generation, it often leads to "computational unfairness." These systems frequently over-serve decode tasks, allowing them to get "ahead of schedule" while new prefill requests languish in queues. As illustrated in Figure 5, this rigid prioritization causes significant TTFT spikes during workload bursts, even when spare capacity is available.

Comparison of scheduling strategies: FairBatching avoids the resource starvation seen in vLLM and Sarathi during burst arrivals.

The FairBatching Framework

FairBatching introduces three core mechanisms to restore balance and improve efficiency.

1. Envelope-Line SLO Tracking and Slack

Traditional metrics like "Time-Between-Tokens" (TBT) are often misleading because they don't account for historical progress. FairBatching instead utilizes an envelope-based deadline for every token. This allows the system to calculate "slack time"—the duration a request is ahead of its required schedule. Figure 6 demonstrates how identifying this slack across batches enables the scheduler to "borrow" time from non-urgent decode tasks to clear prefill bursts.

Illustration of slack calculation and batching in FairBatching.

2. Adaptive Batch Capacity

FairBatching replaces static token budgets with a linear time-budget model ($a + b \cdot \text{tokens} + c \cdot \text{context}$). By incorporating total context length (KV cache size), the model predicts execution time with significantly higher accuracy, reducing prediction error from ±5.2% to ±1.3%.

3. Fair Batch Formation

The scheduler abandons the "decode-always-first" rule in favor of a three-phase priority system:

  • Urgent Decode: Tasks nearing their SLO deadlines.
  • Prefill: New requests requiring immediate processing to minimize TTFT.
  • Non-urgent Decode: Tasks with sufficient accumulated slack that can be safely delayed.

Key Results

Evaluated using production traces such as BurstGPT and AzureTrace across models like LLaMA 3.1 and Qwen, FairBatching delivered substantial performance improvements:

  • Latency Reduction: P99 TTFT latency was reduced by up to 2.29× compared to Sarathi-style schedulers.
  • Capacity Gains: Single-node "goodput" improved by 20.0%, while cluster-level capacity surged by 54.3% when integrated with a global load balancer using the Prefill Admission Budget (PAB).
  • Workload Smoothing: The system maintained strict TPOT guarantees even while aggressively prioritizing prefill bursts, effectively smoothing out performance fluctuations.

Conclusion and Future Work

FairBatching proves that exploiting the "slack" in decode tasks can significantly enhance LLM inference responsiveness. While the system currently requires offline profiling and faces minor Python-related runtime challenges, it represents a major step toward fairer and more efficient resource allocation in distributed LLM clusters. Future research will explore integration with speculative decoding and reducing profiling overhead.

Summary updated

BibTeX
@misc{lyu2025fairbatching,
  author = {Hongtao Lyu and Boyue Liu and Mingyu Wu and Haibo Chen},
  title = {{FairBatching: Fairness-Aware Batch Formation for LLM Inference}},
  year = {2025},
  eprint = {2510.14392},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.14392},
}
Figure