arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2611.32989cs.LGcs.CV
收藏

AVQ-Attention-2:带有精确局部块与线性成本训练的自适应向量量化注意力机制

AVQ-Attention-2: Adaptive Vector-Quantized Attention with Exact Local Blocks and Linear-Cost Training

University of Amsterdam(阿姆斯特丹大学);Qualcomm AI Research(高通人工智能研究中心);University of Technology Nuremberg(纽伦堡工业大学)

Winfried van den Dool, Patrick Forré, Amir Habibian, Yuki M. Asano, Max Welling

AI总结:

AVQ-Attention-2将自适应向量量化注意力与精确局部注意力结合,训练成本为线性,可嵌入预训练Transformer,速度优于FlashAttention且质量损失极小。

摘要:

注意力机制的计算成本随token数量呈O(N²)增长。向量量化注意力通过对N个键进行聚类,将注意力计算成本降至O(NM),仅关注M个码本而非所有键;其自适应形式AVQ-注意力会在查询注意力质量实际集中的区域提升码本分辨率。本文提出AVQ-Attention-2,该设计将AVQ-注意力与精确局部注意力结合,且关注每个聚类键的均值而非单个码本。研究表明该方法有三项改进:在相当成本下质量持续更优;训练成本也为O(NM)而非O(N²);其近似精度足够高,可直接嵌入预训练Transformer而无需微调。在多种序列长度下,该方法不仅与其他近似注意力机制有竞争力,还可与精确密集注意力媲美,运行速度优于FlashAttention,且质量几乎无损失。

英文摘要:

Attention costs $\mathcal{O}(N^2)$ in the number of tokens. Vector-quantized attention reduces this to $\mathcal{O}(NM)$ by clustering the $N$ keys, attending to the $M$ codewords instead, and its adaptive form, AVQ-attention, concentrates codebook resolution where a query's attention mass actually falls. We present AVQ-Attention-2, a better design that merges it with exact local attention and attends to the mean of each cluster's keys rather than to a codeword. We show three improvements: consistently better quality at comparable cost; training that now also costs $\mathcal{O}(NM)$ rather than $\mathcal{O}(N^2)$; and an approximation accurate enough that the layer can be dropped into a pretrained transformer without fine-tuning. Across a variety of sequence lengths the result is competitive not merely with other approximate attention but with exact dense attention, running faster than FlashAttention at little to no loss in quality.

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

↑