Skip to main content
QUICK REVIEW

[论文解读] PolaFormer: Polarity-aware Linear Attention for Vision Transformers

Weikang Meng, Yadan Luo|ArXiv.org|Jan 25, 2025
CCD and CMOS Imaging SensorsEngineering被引用 3
一句话总结

PolaFormer 引入极性感知的线性注意力来恢复负向查询-键交互并降低注意力熵,从而在视觉任务中提升准确性和效率。

ABSTRACT

Linear attention has emerged as a promising alternative to softmax-based attention, leveraging kernelized feature maps to reduce complexity from quadratic to linear in sequence length. However, the non-negative constraint on feature maps and the relaxed exponential function used in approximation lead to significant information loss compared to the original query-key dot products, resulting in less discriminative attention maps with higher entropy. To address the missing interactions driven by negative values in query-key pairs, we propose a polarity-aware linear attention mechanism that explicitly models both same-signed and opposite-signed query-key interactions, ensuring comprehensive coverage of relational information. Furthermore, to restore the spiky properties of attention maps, we provide a theoretical analysis proving the existence of a class of element-wise functions (with positive first and second derivatives) that can reduce entropy in the attention distribution. For simplicity, and recognizing the distinct contributions of each dimension, we employ a learnable power function for rescaling, allowing strong and weak attention signals to be effectively separated. Extensive experiments demonstrate that the proposed PolaFormer improves performance on various vision tasks, enhancing both expressiveness and efficiency by up to 4.6%.

研究动机与目标

  • 指出非负线性注意力相比于基于 softmax 的注意力在视觉变换器中的局限性与信息损失。
  • 开发一个极性感知机制,显式建模同符号和异号的查询-键交互。
  • 引入可学习的逐通道幂次重新缩放,在保持线性复杂度的同时恢复接近 softmax 的尖锐、峰值注意力。
  • 提供理论与经验证据,证明所提方法在视觉基准上提高表达能力与效率。从理论和实证层面给出支持。

提出的方法

  • 将查询和键分解为正分量与负分量,以恢复同符号和异符号的交互。
  • 使用两个带可学习系数 Gs 与 Go 的流来混合同符号与异符号的相似性,计算极性感知注意力。
  • 在通道维度上分割值向量,以在不增加额外参数的情况下处理同符号和异符号的响应。
  • 引入逐维度的可学习幂函数 p 进行特征重缩放,降低熵并保留尖锐的注意力峰值。
  • 给出理论结果,存在一个一阶和二阶导数均为正的函数可以降低注意力图中正序列的熵(PSE)。
  • 并证实线性时间复杂度 Omega = 5Nd^2 + 4Ndd' + k^2Nd + Nd 以及相对于基线的经验效率提升。

实验结果

研究问题

  • RQ1极性感知线性注意力如何在包含负分量的情况下捕获完整的查询-键交互,相较于现有线性注意力方法?
  • RQ2是否可以通过可学习的逐维度幂次重新缩放在保持线性复杂度的同时降低注意力熵,使其接近 softmax 的尖锐度?
  • RQ3极性感知机制是否在标准视觉基准(分类、检测、分割)以及长距离任务上提升性能?
  • RQ4极性系数与辅助卷积对表征能力与效率的影响为何?

主要发现

  • PolaFormer 在视觉任务上相对于基线实现高达 4.6% 的准确性/效率提升。
  • 在 ImageNet-1K 上,PolaFormer 各变体在 FLOPs 相近的情况下优于许多 DeiT 和 Swin 基线。
  • 极性感知系数 Gs 与 Go 在消融实验中约提升 1.8%,表明同符号与异符号交互的互补处理。
  • 理论分析表明具有正的一阶和二阶导数的函数可以降低注意力图中正序列的熵,从而解释更尖锐的注意力。
  • 逐通道可学习幂函数有效在保持线性复杂度的同时保留尖锐注意力。
  • PolaFormer 的变体(在 PVT/Swin 主干上实现的 PolaFormer)在目标检测和语义分割任务中显示显著改进,且 FLOP 开销适中。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。