[论文解读] Learnable Fourier Features for Multi-Dimensional Spatial Positional Encoding
引入基于可学习傅里叶特征的多维空间数据位置编码,结合 MLP,能够在 Transformer 模型中对图像和 UI 结构等多种场景实现归纳性、可扩展性和距离保持的位置信息表示,从而提升性能。展示在多项视觉与 UI 任务上收敛速度和准确性的提升。
Attentional mechanisms are order-invariant. Positional encoding is a crucial component to allow attention-based deep model architectures such as Transformer to address sequences or images where the position of information matters. In this paper, we propose a novel positional encoding method based on learnable Fourier features. Instead of hard-coding each position as a token or a vector, we represent each position, which can be multi-dimensional, as a trainable encoding based on learnable Fourier feature mapping, modulated with a multi-layer perceptron. The representation is particularly advantageous for a spatial multi-dimensional position, e.g., pixel positions on an image, where $L_2$ distances or more complex positional relationships need to be captured. Our experiments based on several public benchmark tasks show that our learnable Fourier feature representation for multi-dimensional positional encoding outperforms existing methods by both improving the accuracy and allowing faster convergence.
研究动机与目标
- 在多维空间域(如图像、UI 布局)中为基于 Transformer 的模型引入有效且可扩展的位置信息编码的需求提供动机。
- 提出基于可学习傅里叶特征的位置信息编码,以捕捉类欧几里得距离和复杂的空间关系。
- Show that the proposed encoding is inductive, parameter-efficient, and scalable to unseen positions and higher dimensions.
- Show that the proposed encoding is inductive, parameter-efficient, and scalable to unseen positions and higher dimensions.
提出的方法
- 用可学习的傅里叶特征 r_x 表示多维位置 x in R^M,其中 r_x = (1/sqrt{D}) [ cos(x W_r^T) || sin(x W_r^T) ],其中 W_r 是可训练的且初始化为 N(0, gamma^{-2}).
- 计算一个平移不变的点积 r_x · r_y,近似高斯核在位置上的形式 (k(x,y) ≈ exp(-||x-y||^2 / gamma^2)).
- 通过一个多层感知机 (phi) 和一个线性投影将傅里叶特征传递,以产生最终的位置信息嵌入 PE_x = phi(r_x, theta) W_p.
- 通过将坐标分组并对每组应用相同的编码管线来整体处理多维位置,然后拼接结果。
- 该方法具有归纳性(能处理未见位置)和参数高效性(与序列长度无关的可扩展性)。
- 将该编码与基于 Transformer 的模型集成,在下游注意力计算中将生成的 PE_X 加到内容嵌入上。
实验结果
研究问题
- RQ1可学习的傅里叶特征基位置信息编码是否能比固定的正弦嵌入或离散嵌入更好地捕捉有意义的多维空间关系(例如二维欧氏距离)?
- RQ2所提出的编码是否提升涉及空间数据(图像、目标检测、UI 布局)的 Transformer 任务的收敛速度和准确性,并能泛化到未见的位置/尺寸?
- RQ3Learnable-Fourier Features + MLP 的组合是否在不同任务上比单独使用傅里叶特征或 MLP 更有效?
- RQ4将多维位置分组(分区)编码策略在像 UI 小部件边界框这样高维空间设置下对性能有何影响?
主要发现
- Learnable-Fourier + MLP 编码在图像生成、目标检测、图像分类和小部件标注基准上持续优于基线位置信息编码。
- 将可学习傅里叶特征与 MLP 结合比单独使用任一组件更快收敛且精度更高。
- 对于未见图像尺寸和位置的情况,Learnable-Fourier + MLP 相对于离散嵌入或正弦方法具有更好的泛化性,缩小了分布外位置的性能差距。
- 将多维位置分成组并对每组使用共享的傅里叶特征进行编码,能够建模比简单的 L2 距离更复杂的空间关系,有利于 UI 小部件标注等任务。
- 在 Vision Transformer 的图像分类中,Learnable-Fourier + MLP 的 top-1 准确率高于 Embed-1D,展示在标准基准上的实际收益。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。