解决大模型推理中预填充与解码任务的资源不公平问题
FairBatching: Fairness-Aware Batch Formation for LLM Inference
- 动态调整批处理容量,平衡预填充与解码资源分配
- 将首令牌延迟尾部降低2.29倍,单节点吞吐提升20%
- 适合追求高公平性与高吞吐的生产级推理系统
大语言模型推理系统面临新请求的首令牌延迟(TTFT)与持续输出速率(TPOT)之间的根本矛盾。现有无阻塞批处理调度器虽能避免解码阻塞,却过度优先解码任务,导致解码空闲资源浪费和预填充排队延迟,整体服务质量下降。本文指出问题根源在于时间间隔(TBT)非单调性及僵化的解码优先策略。为此提出FairBatching,通过自适应批处理容量机制,在不违反服务等级目标(SLO)前提下提升显卡利用率。其公平动态批处理算法打破解码优先范式,可将突发解码任务的资源回收用于应对预填充高峰,实现全局公平。此外,引入新颖负载估计方法,增强与上层调度器协同。在真实工作负载上评估显示,该方案将TTFT尾部延迟降低最多2.29倍,单节点容量提升20.0%,集群容量提升54.3%。
原文摘要 · Abstract (English)
Large language model (LLM) inference systems face a fundamental tension between minimizing Time-to-First-Token (TTFT) latency for new requests and maintaining a high, steady token generation rate (low Time-Per-Output-Token, or TPOT) for ongoing requests. Existing stall-free batching schedulers proposed by Sarathi, while effective at preventing decode stalls, introduce significant computational unfairness. They prioritize decode tasks excessively, simultaneously leading to underutilized decode slack and unnecessary prefill queuing delays, which collectively degrade the system's overall quality of service (QoS). This work identifies the root cause of this unfairness: the non-monotonic nature of Time-Between-Tokens (TBT) as a scheduling metric and the rigid decode-prioritizing policy that fails to adapt to dynamic workload bursts. We therefore propose FairBatching, a novel LLM inference scheduler that enforces fair resource allocation between prefill and decode tasks. It features an adaptive batch capacity determination mechanism, which dynamically adjusts the computational budget to improve the GPU utilization without triggering SLO violations. Its fair and dynamic batch formation algorithm breaks away from the decode-prioritizing paradigm, allowing computation resources to be reclaimed from bursting decode tasks to serve prefill surges, achieving global fairness. Furthermore, FairBatching provides a novel load estimation method, enabling more effective coordination with upper-level schedulers. Implemented and evaluated on realistic traces, FairBatching significantly reduces TTFT tail latency by up to 2.29x while robustly maintaining TPOT SLOs, achieving overall 20.0% improvement in single-node capacity and 54.3% improvement in cluster-level capacity.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。