arXiv:2505.12942cs.CLcs.AI2025-05被引 5

A3通过分解注意力层实现无运行时开销的高效压缩

A3 : an Analytical Low-Rank Approximation Framework for Attention

  • 将Transformer层拆解为QK、OV、MLP三部分,分别优化
  • 在相同计算与内存预算下,LLaMA 3.1-70B困惑度降至4.69
  • 支持量化、缓存压缩等场景,适合部署优化需求者

大语言模型性能卓越,但参数量巨大导致部署成本高昂。低秩近似虽具压缩潜力,但现有方法存在两大缺陷:(1) 仅关注单个线性层输出误差,忽视Transformer架构特性;(2) 将大权重矩阵分解为两个小低秩矩阵,常逊于剪枝与量化,且引入额外GEMM调用和内存操作等运行时开销。为此,我们提出A³——一种后训练低秩近似框架。A³将Transformer层分解为QK、OV、MLP三个功能组件,提供解析解,在最小化各组件功能损失的同时降低内部隐藏维度。该方法直接减少模型规模、键值缓存大小与浮点运算量,且无运行时开销。实验表明,A³在性能上优于现有最优方案。例如,在相同计算与内存压缩预算下,经低秩近似后的LLaMA 3.1-70B在WikiText-2上的困惑度为4.69,优于此前最优方案的7.87,提升3.18。此外,我们展示了A³在键值缓存压缩、与量化结合、微调及混合秩分配等方面的多样化应用。代码已开源:https://github.com/DeepWok/a3。

原文摘要 · Abstract (English)

Large language models have demonstrated remarkable performance; however, their massive parameter counts make deployment highly expensive. Low-rank approximation offers a promising compression solution, yet existing approaches have two main limitations: (1) They focus on minimizing the output error of individual linear layers, without considering the architectural characteristics of Transformers, and (2) they decompose a large weight matrix into two small low-rank matrices. Consequently, these methods often fall short compared to other compression techniques like pruning and quantization, and introduce runtime overhead such as the extra GEMM kernel launches and memory operations for decomposed small matrices. To address these limitations, we propose $A^3$, a post-training low-rank approximation framework. $A^3$ splits a Transformer layer into three functional components, namely $\texttt{QK}$, $\texttt{OV}$, and $\texttt{MLP}$ and provides analytical solutions that reduces the hidden dimension size inside each component while minimizing the component's functional loss. This approach directly reduces model sizes, KV cache sizes, and FLOPs without introducing any runtime overheads. Through extensive experiments, we show that $A^3$ maintains superior performance compared to SoTAs. For example, under the same reduction budget in computation and memory, our low-rank approximated LLaMA 3.1-70B achieves a perplexity of 4.69 on WikiText-2, outperforming the previous SoTA's 7.87 by 3.18. We also show versatile applications of $A^3$ in KV cache compression, integration with quantization, fine-tuning and mixed-rank assignments. We open-sourced our framework and code at https://github.com/DeepWok/a3.

模型压缩低秩近似注意力机制推理优化

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