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

自索引KV缓存:从压缩键预测稀疏注意力

Self-Indexing KVCache: Predicting Sparse Attention from Compressed Keys

Xu Yang, Jiapeng Zhang, Dongyang Zhao, Guo Chen, Zhuo Tang

AI总结:

本文提出自索引KV缓存方法,通过1位符号向量量化统一压缩与检索,减少内存开销并提升大模型推理效率。

摘要:

在自注意力机制中,KV缓存已成为长上下文和大批次推理中LLM的主要瓶颈。现有方法常将稀疏性预测与压缩视为独立模块,依赖辅助索引结构选择相关token,并通过复杂量化方案减少内存使用。这种碎片化设计引入冗余开销并限制了可扩展性。本文提出一种新范式:将压缩后的键表示不仅作为存储,更作为自索引结构,直接实现高效稀疏注意力。通过设计基于符号的1位向量量化(VQ)方案,我们的方法在单一硬件友好的格式中统一了压缩与检索。该方法消除了对外部索引或学习预测器的需求,为内存受限的推理提供了一种轻量且稳健的解决方案。所有组件均设计为硬件高效且易于实现。通过实现自定义CUDA内核,我们的方法无缝集成到FlashAttention中,最小化额外的运行时和内存开销。实验结果表明,我们的方法在效果和效率上均表现优异。

英文摘要:

The KV cache in self-attention has emerged as a major bottleneck in long-context and large-batch inference for LLMs. Existing approaches often treat sparsity prediction and compression as separate modules, relying on auxiliary index structures to select relevant tokens, and on complex quantization schemes to reduce memory usage. This fragmented design introduces redundant overhead and limits scalability. In this paper, we propose a novel paradigm: treating the compressed key representation not merely as storage, but as a self-indexing structure that directly enables efficient sparse attention. By designing a sign-based 1-bit vector quantization (VQ) scheme, our method unifies compression and retrieval in a single, hardware-friendly format. This approach eliminates the need for external indices or learning-based predictors, offering a lightweight yet robust solution for memory-constrained inference. All components are designed to be hardware-efficient and easy to implement. By implementing custom CUDA kernels, our method integrates seamlessly with FlashAttention, minimizing additional runtime and memory overhead. Experimental results demonstrate that our approach delivers both effectiveness and efficiency.

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

↑