arXiv:2502.15955cs.DScs.AI2025-02被引 3

证明自回归Transformer推理必须用线性以上内存,无法压缩。

Compression Barriers for Autoregressive Transformers

  • 从通信复杂度出发,证明任何注意力生成算法需Θ(nd)空间
  • 低维时空间下界为Ω(d·e^d),SubGen算法达到该最优边界
  • 揭示稀疏假设对实现真正亚线性空间的关键作用

自回归Transformer在推理时需缓存所有先前的键值(KV)嵌入,占用大量内存。现有压缩方法通常依赖特定结构假设。本文证明:不加假设时,任何基于注意力的令牌生成算法都必须使用Θ(nd)空间,其中n为已生成令牌数,d = Ω(log n)为嵌入维度。通过归约至经典通信复杂度问题,并利用类Johnson-Linderstrauss投影的随机构造完成证明。对于d = o(log n)的低维情形,我们证明空间下界为Ω(d·e^d),并验证SubGen算法达到此紧界。进一步分析稀疏性如何支持真正亚线性空间,提出一种针对滑动窗口注意力的新压缩算法(当窗口外值缓存未掩码时)。最后,通过不可区分性论证,证明无自适应算法可在所有令牌上以亚线性时间在线计算注意力。

原文摘要 · Abstract (English)

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.

Transformer内存压缩理论分析注意力机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。