arXiv:2504.11320cs.LGcs.AI2025-04被引 22

针对大模型推理内存暴涨问题,提出动态调度算法提升吞吐与降低延迟。

Optimizing LLM Inference: Fluid-Guided Online Scheduling with Memory Constraints

  • 基于流体模型构建在线调度框架,捕捉内存增长与请求平衡关系。
  • 在真实GPU测试中,新算法使延迟下降,稳定运行范围扩大30%以上。
  • 适合高并发场景下部署大模型服务的工程师和系统优化人员。

大型语言模型每日服务数百万用户,服务商日均成本超70万美元。每个请求需逐标记推理,使GPU调度成为影响延迟、容量与成本的核心。挑战在于内生内存增长:生成标记会扩展键值缓存(KV cache),溢出将导致进行中的请求被驱逐并浪费先前计算。本文将推理建模为具有内生内存增长、线性迭代时间及驻留于GPU的KV缓存约束的多阶段在线调度问题。提出流体模型,刻画平衡批次构成、内存需求与稳定区域。基于该模型设计WAIT(等待累积推理阈值)策略,适用于已知输出长度;其拓展版Nested WAIT则通过控制请求在解码阶段片段中的推进,处理未知输出长度。两种算法在给定内存条件下渐近逼近流体基准。Nested WAIT引入适度规模的安全缓冲,防范未知输出长度下的内存溢出驱逐。在配置为Llama-2-7B、A100 GPU的Vidur仿真中,相比广泛使用的基线算法,新策略显著扩大了实际观测到的稳定运行范围,并在接近或超出负载时有效降低延迟。附录提供真实GPU验证结果。

原文摘要 · Abstract (English)

Large language models now serve millions of users daily, with providers incurring costs exceeding $700,000 per day. Each request requires token-by-token inference, making GPU scheduling central to latency, capacity, and cost. The difficulty is endogenous memory growth: generated tokens expand the Key-Value (KV) cache, and overflow can evict in-progress requests and waste prior computation. We formulate inference as a multi-stage online scheduling problem with endogenous memory growth, linear iteration times, and GPU-resident KV-cache constraints. We introduce a fluid model that characterizes equilibrium batch composition, memory requirement, and stability region. Guided by the fluid model, we design WAIT (Waiting for Accumulated Inference Threshold), a threshold-based admission rule for known output lengths, and Nested WAIT, which extends the rule to unknown output lengths by regulating how requests advance across decode-stage segments. Both algorithms approximate the fluid benchmark asymptotically under the stated memory conditions. Nested WAIT uses an additional safety buffer of moderate scale to hedge against memory-overflow-induced evictions under unknown output lengths. In Vidur simulations configured for Llama-2-7B on an A100 GPU, with supplemental real-GPU validation reported in the appendix, the policies enlarge the empirically observed stable operating range relative to widely used baseline algorithms and reduce latency especially in near-overloaded and overloaded regimes.

大模型推理调度优化内存管理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。