大语言模型(LLM)不断扩展的上下文窗口极大提升了其在各类应用中的能力,但也给维持低延迟带来了严峻挑战,尤其是首令牌生成时间(Time to First Token, TTFT)。本文发现,随着上下文长度增加,TTFT的急剧上升主要由排队延迟导致,而排队延迟的根源是GPU键值(Key-Value, KV)缓存分配需求增长与KV缓存块有限供应之间的冲突。为解决这一问题,我们提出LayerKV——一种简单有效的插件式方法,无需额外硬件、不损失输出性能,且能与现有并行策略和调度技术无缝集成,可有效降低TTFT。具体而言,LayerKV引入分层KV块分配、管理与卸载机制,实现对系统内存的细粒度控制,同时搭配服务等级目标(Service Level Objectives, SLOs)感知调度器以优化整体SLO。在7B到70B参数规模的代表性模型上、多种GPU配置下开展的综合评估表明,LayerKV将TTFT延迟最高降低69倍,SLO违反率降低28.7%,显著提升了用户体验。
英文摘要:
The expanding context windows in large language models (LLMs) have greatly enhanced their capabilities in various applications, but they also introduce significant challenges in maintaining low latency, particularly in Time to First Token (TTFT). This paper identifies that the sharp rise in TTFT as context length increases is predominantly driven by queuing delays, which are caused by the growing demands for GPU Key-Value (KV) cache allocation clashing with the limited availability of KV cache blocks. To address this issue, we propose LayerKV, a simple yet effective plug-in method that effectively reduces TTFT without requiring additional hardware or compromising output performance, while seamlessly integrating with existing parallelism strategies and scheduling techniques. Specifically, LayerKV introduces layer-wise KV block allocation, management, and offloading for fine-grained control over system memory, coupled with an SLO-aware scheduler to optimize overall Service Level Objectives (SLOs). Comprehensive evaluations on representative models, ranging from 7B to 70B parameters, across various GPU configurations, demonstrate that LayerKV improves TTFT latency up to 69x and reduces SLO violation rates by 28.7%, significantly enhancing the user experience.
Recency/Frequency Adaptive KV Caching for Large Language Model Serving
Department of Computer Science, Johns Hopkins University, Baltimore, USA(约翰霍普金斯大学计算机科学系);Argonne National Laboratory, Lemont, USA(阿贡国家实验室);Parasail, Inc., San Mateo, USA(Parasail公司)
Towards Efficient Large Language Model Serving: A Survey on System-Aware KV Cache Optimization
School of Computing and Information Systems, The University of Melbourne(墨尔本大学计算与信息系统学院);School of Computer Science and Technology, Huazhong University of Science and Technology(华中科技大学计算机科学与技术学院)
KVServe: Service-Aware KV Cache Compression for Communication-Efficient Disaggregated LLM Serving
University of Chinese Academy of Sciences(中国科学院大学);Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);Shanghai Jiao Tong University(上海交通大学)
QCFuse: Query-Aware Cache Fusion via Compressed View for Efficient RAG Serving
Zhejiang University(浙江大学);East China Normal University(华东师范大学);Ant Group(蚂蚁集团);The Hong Kong Polytechnic University(香港理工大学);Zhejiang Normal University(浙江师范大学);Tongji University(同济大学);The Chinese University of Hong Kong, Shenzhen(香港中文大学(深圳));The Hong Kong University of Science and Technology (Guangzhou)(香港科学与技术大学(广州));The Hong Kong University of Science and Technology(香港科学与技术大学)
KV-RM: Regularizing KV-Cache Movement for Static-Graph LLM Serving
Stevens Institute of Technology(史蒂文斯理工学院);The Hong Kong University of Science and Technology (Guangzhou)(香港科学与技术大学(广州));Argonne National Laboratory(阿贡国家实验室);Northwestern University(西北大学)
ProMoE: Fast MoE-based LLM Serving using Proactive Caching
Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University(上海交通大学平行与分布式系统研究所);Key Laboratory of System Software (Chinese Academy of Sciences)(中国科学院系统软件重点实验室);Zhejiang University(浙江大学)