跳到正文
arXiv (AI + Vision + Imaging)· Winfried van den Dool, Patrick Forr\'e, Amir Habibian, Yuki M. Asano, Max Welling·· 1 天前AI 评分30

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

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

AI 导读

AVQ-Attention-2 将自适应向量量化注意力与精确局部注意力结合,改为关注每个簇内 key 的均值而非码字。训练成本从 O(N²) 降至 O(NM),在相近成本下质量更优,且近似精度足以直接替换预训练 transformer 中的层而无需微调。在多种序列长度下,其表现不仅优于其他近似注意力,也可与精确稠密注意力竞争,运行速度快于 FlashAttention 且质量几乎无损。

正文 · 原文

arXiv:2611.32989v1 Announce Type: new Abstract: 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.

来源:arXiv (AI + Vision + Imaging) · arxiv.org