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

RaaS:面向高效LLM推理的推理感知注意力稀疏化

RaaS: Reasoning-Aware Attention Sparsity for Efficient LLM Reasoning

SCS, Peking University, Beijing, China(北京大学计算机科学系);Key Lab of HCST (PKU), MOE, Beijing, China(北京大学高校计算机科学与技术关键实验室);School of Computer Science, Nanjing University, Nanjing, China(南京大学计算机科学系);Huawei Cloud, Shanghai, China(华为云)

Junhao Hu, Wenrui Huang, Weidong Wang, Zhenwen Li, Tiancheng Hu, Zhixia Liu, Xusheng Chen, Tao Xie, Yizhou Shan

AI总结:

针对LLM推理任务中KV缓存面临的准确性、时间和内存“不可能三角”,本文提出RaaS算法,通过识别并保留解码阶段的里程碑token的KV向量,在$O(L)$时间和内存复杂度下实现高准确率。

摘要:

大型语言模型(LLMs)在各个领域展现了强大的能力,近期在数学和编程等具有挑战性的推理任务上也取得了进展。然而,解决推理任务通常需要LLM生成长序列,每个token产生$O(N)$的时间和内存复杂度,其中$N$是当前序列长度。为降低复杂度,现有的基于稀疏性的算法提出仅保留最关键token的键值(KV)向量(即中间表示)。但这些算法面临准确性、时间和内存的“不可能三角”。例如,最先进的算法Quest以$O(L)$时间和$O(N)$内存实现了高准确率($L$为缓存预算,$L \ll N$)。为解决该“不可能三角”,本文在推理任务的解码阶段发现了一种新的注意力模式:里程碑token(类似于数学证明中的引理)出现、被利用,随后变得不再重要。基于此模式,我们提出新算法RaaS,识别里程碑token并保留其KV向量直到不再需要,以$O(L)$时间和$O(L)$内存复杂度实现了高准确率。

英文摘要:

Large Language Models (LLMs) have demonstrated strong capabilities across various domains, with recent advancements in challenging reasoning tasks such as mathematics and programming. However, solving reasoning tasks often requires an LLM to generate long sequences, incurring $O(N)$ time and memory complexities per token, where $N$ is the current sequence length. To reduce complexities, existing sparsity-based algorithms propose to retain Key-Value (KV) vectors, the intermediate representations of only the most critical tokens. However, these algorithms struggle with the "impossible trinity" of accuracy, time, and memory. For example, the state-of-the-art algorithm, Quest, achieves high accuracy with $O(L)$ time but $O(N)$ memory ($L$ is the cache budget, $L \ll N$). To address the "impossible trinity", in this paper, we identify a new attention pattern during the decode stage of reasoning tasks, where milestone tokens (analogous to lemmas in mathematical proofs) emerge, are utilized, and then become unimportant afterward. Based on this pattern, we propose a new algorithm RaaS that identifies milestone tokens and retains their KV vectors until they are no longer needed, achieving high accuracy with $O(L)$ time and $O(L)$ memory complexities.

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

↑