HieraSparse: 分层半结构化稀疏KV注意力
HieraSparse: Hierarchical Semi-Structured Sparse KV Attention
AI总结:
本文提出HieraSparse,通过分层KV缓存压缩框架和GPU稀疏张量核心,提升LLM的KV缓存效率与注意力计算速度,实现稀疏性与效率的平衡。
摘要:
长上下文大语言模型的部署面临自注意力计算成本高和KV缓存内存开销大的挑战。本文介绍HieraSparse,一种分层KV缓存压缩框架,利用GPU稀疏张量核心加速半结构化KV缓存注意力计算,适用于prefill和decode阶段。通过分层设计,方法允许灵活的质量-稀疏性权衡,将稀疏性转化为效率。与使用无结构稀疏性的最新解码方法相比,HieraSparse在相同稀疏水平下实现了1.2倍的KV压缩比和4.57倍的注意力加速。此外,将半结构化KV缓存剪枝扩展到prefill阶段,最高稀疏性下实现了1.85倍的注意力加速。最后,通过简单的幅度基剪枝方法评估HieraSparse的生成质量,结果表明在无显著质量下降的情况下,实现了1.37倍的prefill加速和1.77倍的解码加速。代码库可在https://github.com/psl-ntu/HieraSparse获取。
英文摘要:
The deployment of long-context Large Language Models (LLMs) poses significant challenges due to the intense computational cost of self-attention and the substantial memory overhead of the Key-Value Cache (KV Cache). In this paper, we introduce \textit{HieraSparse}, a hierarchical KV Cache compression framework with acceleration kernels that leverage GPU sparse tensor cores to speed up semi-structured KV Cache attention for both the prefill and decode phases. With the hierarchical design, our method allows for a flexible quality-sparsity trade-off and successfully converts sparsity into efficiency. Compared to the state-of-the-art decode method that utilizes unstructured sparsity, \textit{HieraSparse} achieves $\mathbf{1.2\times}$ KV compression ratio and $\mathbf{4.57\times}$ attention speedup at the same sparsity level. Furthermore, we extended the semi-structured KV Cache pruning to the prefill stage, which demonstrated up to $\mathbf{1.85\times}$ attention speedup at the highest sparsity. Lastly, we evaluate the generation quality of \textit{HieraSparse} with a simple magnitude-based pruning method, and the results show that $\mathbf{1.34\times}$ prefill and $\mathbf{1.71\times}$ decode attention speedup can be achieved without significant quality drop. The codebase can be found at https://github.com/psl-ntu/HieraSparse.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。