arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.07115cs.LGcs.AImath.OC
收藏

在线调度用于具有KV缓存约束的LLM推理

Online Scheduling for LLM Inference with KV Cache Constraints

Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology(麻省理工学院电子工程与计算机科学系);HKUST(香港科技大学);Microsoft Research(微软研究院);Sloan School of Management, Massachusetts Institute of Technology(斯隆管理学院,麻省理工学院);Operations Research Center, Massachusetts Institute of Technology(运营研究中心,麻省理工学院)

Patrick Jaillet, Jiashuo Jiang, Konstantina Mellou, Marco Molinaro, Chara Podimata, Zijie Zhou

AI总结:

本文提出了一种在线调度算法,通过理论建模和实证验证,在管理KV缓存内存的同时最小化LLM推理延迟,显著优于现有基准算法。

摘要:

大型语言模型(LLM)推理是一种计算密集型过程,要求高效的调度以优化延迟和资源利用率。LLM推理中的一个关键挑战是键值(KV)缓存的管理,它减少了冗余计算但引入了内存限制。在本工作中,我们从理论上建模了具有KV缓存约束的LLM推理,并提出了一种新的批量和调度算法,该算法在最小化推理延迟的同时有效管理KV缓存的内存。具体而言,我们做出了以下贡献。首先,为了评估在线调度算法在LLM推理中的性能,我们引入了一个 hindsight 最优基准,其形式化为一个整数规划问题,计算在完全未来信息下的最小总推理延迟。其次,我们证明了当到达过程任意时,没有任何确定性在线算法可以达到常数竞争比率。第三,受在大规模上求解整数规划计算不可行的启发,我们提出了一种多项式时间在线调度算法,并证明在某些条件下,该算法可以达到常数竞争比率。我们还通过在合成数据集上与hindsight最优进行比较,展示了我们算法的强大经验性能。最后,我们在一个现实世界的公开LLM推理数据集上进行了实证评估,模拟了在A100 GPU上的Llama2-70B模型,并证明我们的算法显著优于基准算法。总体而言,我们的结果为更可持续和经济高效的LLM部署提供了一条路径。

英文摘要:

Large Language Model (LLM) inference, where a trained model generates text one word at a time in response to user prompts, is a computationally intensive process requiring efficient scheduling to optimize latency and resource utilization. A key challenge in LLM inference is the management of the Key-Value (KV) cache, which reduces redundant computations but introduces memory constraints. In this work, we model LLM inference with KV cache constraints theoretically and propose a novel batching and scheduling algorithm that minimizes inference latency while effectively managing the KV cache's memory. More specifically, we make the following contributions. First, to evaluate the performance of online algorithms for scheduling in LLM inference, we introduce a hindsight optimal benchmark, formulated as an integer program that computes the minimum total inference latency under full future information. Second, we prove that no deterministic online algorithm can achieve a constant competitive ratio when the arrival process is arbitrary. Third, motivated by the computational intractability of solving the integer program at scale, we propose a polynomial-time online scheduling algorithm and show that under certain conditions it can achieve a constant competitive ratio. We also demonstrate our algorithm's strong empirical performance by comparing it to the hindsight optimal in a synthetic dataset. Finally, we conduct empirical evaluations on a real-world public LLM inference dataset, simulating the Llama2-70B model on A100 GPUs, and show that our algorithm significantly outperforms the benchmark algorithms. Overall, our results offer a path toward more sustainable and cost-effective LLM deployment.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑