arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.00760cs.LGcs.DC
收藏

MosaicKV: 通过动态二维KV缓存压缩服务长上下文LLM

MosaicKV: Serving Long-Context LLM with Dynamic Two-D KV Cache Compression

Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University(上海交通大学并行与分布式系统研究所)

Sheng Qiang, Ruiwei Chen, Yinpeng Wu, Jinyu Gu, Zhichao Hua, Yubin Xia, Binyu Zang, Haibo Chen

AI总结:

提出MosaicKV系统,利用动态二维KV缓存压缩解决长上下文服务中的内存瓶颈,通过细粒度稀疏性和压缩管理实现高吞吐和低延迟,在H800 GPU上取得最高16倍注意力加速和3倍内存节省。

摘要:

长上下文LLM服务现在支持数十万到数百万个token的提示,使得键值(KV)缓存成为首要的服务成本。由于缓存随上下文长度线性增长,它会耗尽GPU内存,迫使批量大小减小,并降低服务吞吐量。先前的KV缓存压缩技术通常只针对序列维度或通道维度,随着上下文窗口的扩展,这留下了有限的改进空间。同时压缩两个维度有望实现更高的内存减少,但直接应用两种压缩形式会导致显著的精度损失。本文介绍了MosaicKV,一个用于极长上下文服务的动态二维KV缓存压缩系统。MosaicKV利用动态二维压缩来解决精度挑战,利用KV缓存内元素重要性分布的非均匀性。MosaicKV不是全局应用一种压缩模式,而是为每个KV向量识别重要元素,并在KV缓存段的粒度上选择压缩策略。为了解决性能挑战——细粒度稀疏性和压缩管理开销可能抵消压缩带来的收益——MosaicKV引入了压缩KV缓存管理。该机制利用未充分利用的GPU和CPU资源来维护压缩的KV缓存并加速注意力计算。在H800 GPU上对多个LLM的评估表明,与未压缩的基线相比,MosaicKV实现了高达16倍的注意力加速、4.8倍更低的解码延迟和7.3倍更高的吞吐量。同时,它将内存使用减少了3倍,并且在LongBench和RULER上仅导致平均1.76%的精度损失。

英文摘要:

Long-context LLM services now sustain prompts with hundreds of thousands to millions of tokens, making the key-value (KV) cache a first-order serving cost. Because the cache grows linearly with context length, it can exhaust GPU memory, force smaller batches, and reduce serving throughput. Prior KV cache compression techniques typically target only the sequence dimension or only the channel dimension, which leaves limited headroom as context windows scale. Compressing both dimensions promises higher memory reduction, but applying the two forms of compression directly leads to significant accuracy loss. This paper introduces MosaicKV, a dynamic two-D (dimensional) KV cache compression system for extremely long-context serving. MosaicKV uses dynamic two-D compression to address the accuracy challenge, exploiting the non-uniform importance distribution of elements within the KV cache. Instead of applying one compression pattern globally, MosaicKV identifies important elements for each KV vector and selects compression strategies at the granularity of KV cache segments. To address the performance challenge, where fine-grained sparsity and compression management overhead can offset the gains from compression, MosaicKV introduces compressed KV cache management. This mechanism uses underutilized GPU and CPU resources to maintain compressed KV caches and accelerate attention computation. Evaluation on an H800 GPU with multiple LLMs shows that MosaicKV delivers up to 16x attention speedup, 4.8x lower decode latency, and 7.3x higher throughput than the uncompressed baseline. At the same time, it reduces memory usage by 3x and incurs only 1.76% average accuracy loss on LongBench and RULER.

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

↑