arXiv:2506.21137cs.LG2025-06被引 2

提出新线性注意力机制,解决查询向量归一化导致信息丢失问题。

Norm$\times$Direction: Restoring the Missing Query Norm in Vision Linear Attention

  • 将查询向量分解为模长与方向,分别处理以恢复注意力分布尖锐性。
  • 在ImageNet-1K上提升7.5%准确率,在ADE20K上提升4.7% mIoU。
  • 内存占用减少92.3%,适合超长序列任务,适用于多模态和长序列场景。

线性注意力虽缓解了Softmax注意力的二次复杂度问题,但严重损失表达能力。我们识别出两大原因:(1) 归一化操作抵消了查询向量的模长,破坏了查询模长与注意力分布尖锐性(熵)之间的关联;(2) 标准非负性强制技术会因置零有效内积交互而造成信息破坏。为此,我们提出NaLaFormer,一种基于查询与键向量的模长×方向(ND)分解的新型线性注意力机制。利用模长成分构建感知查询模长的核函数,恢复注意力分布的尖锐性;通过基于余弦的几何相似度度量处理方向向量,保证非负性的同时保留内积的精细信息。我们在多模态任务中全面验证了其性能,首次在线性注意力领域达到新SOTA。模型在ImageNet-1K上实现最高7.5%准确率提升,在ADE20K上达4.7% mIoU增益;在高吞吐超分辨率任务中,峰值显存降低92.3%(超过7万令牌)。其通用性进一步体现在超越Mamba在常识推理表现,并在长程基准测试(LRA)上创下新纪录。代码已开源:https://github.com/ZacharyMeng/NaLaFormer。

原文摘要 · Abstract (English)

Linear attention mitigates the quadratic complexity of softmax attention but suffers from a critical loss of expressiveness. We identify two primary causes: (1) The normalization operation cancels the query norm, which breaks the correlation between a query's norm and the spikiness (entropy) of the attention distribution as in softmax attention. (2) Standard techniques for enforcing non-negativity cause destructive information loss by nullifying valid inner-product interactions. To address these challenges, we introduce NaLaFormer, a novel linear attention mechanism built upon a norm$\times$direction (ND) decomposition of the query and key vectors. We leverage each component to solve a distinct problem: The query norm is injected into our kernel to create a query-norm-aware map that restores the attention distribution's spikiness. The direction vectors are processed by a geometric, cosine-based similarity metric that guarantees non-negativity while preserving the rich, fine-grained information of the inner product. We validate NaLaFormer through a comprehensive multi-modal evaluation, where it sets new state-of-the-art benchmarks for linear attention. Our model achieves up to a 7.5% accuracy gain on ImageNet-1K and a 4.7% mIoU improvement on ADE20K over comparable baselines. It demonstrates profound efficiency, reducing peak memory by a transformative 92.3% in token-intensive super-resolution tasks (70K+ tokens). NaLaFormer's versatility is further confirmed as it surpasses strong baselines like Mamba on common-sense reasoning and sets a new state-of-the-art on the Long Range Arena (LRA) benchmark. Code is available at https://github.com/ZacharyMeng/NaLaFormer .

线性注意力图像识别长序列建模高效模型

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