arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.12665cs.CL
收藏

A$^2$ATS:基于窗口旋转位置嵌入和查询感知向量量化的检索式KV缓存缩减方法

A$^2$ATS: Retrieval-Based KV Cache Reduction via Windowed Rotary Position Embedding and Query-Aware Vector Quantization

Wuhan University(武汉大学);Alibaba Cloud Computing(阿里云计算);Jinan University(济南大学);City University of Hong Kong(香港城市大学);MBZUAI

Junhui He, Junna Xing, Nan Wang, Rui Xu, Shangyu Wu, Peng Zhou, Qiang Liu, Chun Jason Xue, Qingan Li

AI总结:

本文提出A$^2$ATS方法,通过窗口旋转位置嵌入和查询感知向量量化实现检索式KV缓存缩减,在降低开销的同时提升长上下文LLM服务吞吐量高达2.7倍。

摘要:

长上下文大语言模型(LLMs)由于KV缓存的内存占用大和访问开销高,给高效服务带来了显著挑战。基于检索的KV缓存缩减方法可以缓解这些挑战,通常通过将完整KV缓存卸载到CPU并在推理过程中按需检索必要的token来实现。然而,这些方法仍然存在精度下降不理想和额外检索开销的问题。为了解决这些局限性,本文提出了A$^2$ATS,一种新颖的基于检索的KV缓存缩减方法。A$^2$ATS旨在通过对key状态应用向量量化技术来获得注意力分数的精确近似,从而实现高效且精确的top-K token检索。首先,我们提出了窗口旋转位置嵌入,它在位置嵌入之后将位置依赖与query和key状态解耦。然后,我们提出了查询感知向量量化,直接优化注意力分数近似的目标。最后,我们设计了用于KV缓存卸载的异构推理架构,支持更大批处理规模的长上下文服务。实验结果表明,与现有方法相比,A$^2$ATS能够以相似或更低的开销实现更低的性能下降,从而将长上下文服务吞吐量提升高达$2.7 \ imes$。

英文摘要:

Long context large language models (LLMs) pose significant challenges for efficient serving due to the large memory footprint and high access overhead of KV cache. Retrieval-based KV cache reduction methods can mitigate these challenges, typically by offloading the complete KV cache to CPU and retrieving necessary tokens on demand during inference. However, these methods still suffer from unsatisfactory accuracy degradation and extra retrieval overhead. To address these limitations, this paper proposes A$^2$ATS, a novel retrieval-based KV cache reduction method. A$^2$ATS aims to obtain an accurate approximation of attention scores by applying the vector quantization technique to key states, thereby enabling efficient and precise retrieval of the top-K tokens. First, we propose Windowed Rotary Position Embedding, which decouples the positional dependency from query and key states after position embedding. Then, we propose query-aware vector quantization that optimizes the objective of attention score approximation directly. Finally, we design the heterogeneous inference architecture for KV cache offloading, enabling long context serving with larger batch sizes. Experimental results demonstrate that A$^2$ATS can achieve a lower performance degradation with similar or lower overhead compared to existing methods, thereby increasing long context serving throughput by up to $2.7 \times$.

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

↑