自回归Transformer的压缩壁垒
Compression Barriers for Autoregressive Transformers
AI总结:
该研究证明无结构假设下自回归Transformer的KV缓存无法实现次线性空间,给出不同维度下的空间下界,分析稀疏性假设的作用并提出滑动窗口注意力的KV压缩新算法,还证明非自适应算法无法在线次线性计算注意力。
摘要:
自回归Transformer的一个关键限制是推理时缓存所有先前键值(KV)嵌入所需的大内存。已有研究通过压缩KV缓存解决这一问题,但通常假设嵌入具有特定结构特性,这自然引出如下问题:在无此类假设的情况下,能否实现真正次线性的空间利用率?本文给出了否定答案:任何基于注意力的token生成算法都必须使用$\Theta(nd)$的空间,其中$n$是已生成的token数量,$d = \Omega(\log n)$是KV嵌入的维度。我们的证明通过对经典通信复杂度问题的归约完成,并采用了遵循Johnson-Lindenstrauss引理思路、利用投影性质的随机构造方法。针对低维情形$d = o(\log n)$,我们证明任何算法都需要$\Omega(d\cdot e^d)$的空间,并通过覆盖数的紧界证明,Zandieh、Han、Mirrokni和Karbasi提出的SubGen算法恰好匹配这一界。此外,我们研究了稀疏性假设如何支持真正次线性空间下的token生成,给出了不可能性结果,并针对窗口外值缓存未被掩码的滑动窗口注意力场景,提出了一种新的KV缓存压缩算法。最后,我们分析了token生成的时间复杂度,通过不可区分性论证证明,不存在非自适应算法能在次线性时间内为所有token在线计算注意力。
英文摘要:
A key limitation of autoregressive Transformers is the large memory needed at inference-time to cache all previous key-value (KV) embeddings. Prior works address this by compressing the KV cache, but often assume specific structural properties of the embeddings. This raises the following natural question: Can truly sublinear space utilization be achieved without such assumptions? In this work, we answer this question in the negative. Any algorithm for attention-based token generation must use $Θ(nd)$ space, where $n$ is the number of tokens generated so far and $d = Ω(\log n)$ is the dimension of the KV embeddings. Our proof involves a reduction from a classic communication complexity problem and uses a randomized construction that leverages properties of projections in the spirit of the Johnson-Linderstrauss lemma. For the low-dimensional regime $d = o(\log n)$, we show that any algorithm requires $Ω(d\cdot e^d)$ space and prove, using tight bounds on covering numbers, that SubGen, proposed by Zandieh, Han, Mirrokni and Karbasi, matches this bound. Further, we investigate how sparsity assumptions enable token generation in truly sublinear space, presenting impossibility results and proposing a new KV cache compression algorithm for sliding window attention when the value cache outside the window is unmasked. Finally, we analyze token generation's time complexity, using an indistinguishability argument to prove that no non-adaptive algorithm can compute attention online in sublinear time for all tokens.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。