Rotary Position Embedding (RoPE) is the de facto positional encoding in large language models due to its ability to encode relative positions and support length extrapolation. When adapted to vision transformers, the standard axial formulation decomposes two-dimensional spatial positions into horizontal and vertical components, implicitly restricting positional encoding to axis-aligned directions. We identify this directional constraint as a fundamental limitation of the standard axial 2D RoPE, which hinders the modeling of oblique spatial relationships that naturally exist in natural images. To overcome this limitation, we propose Spiral RoPE, a simple yet effective extension that enables multi-directional positional encoding by partitioning embedding channels into multiple groups associated with uniformly distributed directions. Each group is rotated according to the projection of the patch position onto its corresponding direction, allowing spatial relationships to be encoded beyond the horizontal and vertical axes. Across a wide range of vision tasks including classification, segmentation, and generation, Spiral RoPE consistently improves performance. Qualitative analysis of attention maps further show that Spiral RoPE exhibits more concentrated activations on semantically relevant objects and better respects local object boundaries, highlighting the importance of multi-directional positional encoding in vision transformers.


翻译:旋转位置嵌入(RoPE)因其能够编码相对位置并支持长度外推,已成为大语言模型中事实上的位置编码方法。当将其适配到视觉Transformer时,标准的轴向公式将二维空间位置分解为水平和垂直分量,这隐含地将位置编码限制在轴对齐的方向上。我们指出这种方向性约束是标准轴向二维RoPE的一个根本性局限,它阻碍了对自然图像中天然存在的倾斜空间关系的建模。为了克服这一局限,我们提出了螺旋RoPE,这是一种简单而有效的扩展,它通过将嵌入通道划分为多个与均匀分布方向相关联的组,从而实现多方向的位置编码。每个组根据图像块位置在其对应方向上的投影进行旋转,从而允许空间关系在水平和垂直轴之外也能被编码。在包括分类、分割和生成在内的广泛视觉任务中,螺旋RoPE均能持续提升性能。对注意力图的定性分析进一步表明,螺旋RoPE在语义相关物体上表现出更集中的激活,并且更好地尊重了局部物体边界,这凸显了在视觉Transformer中进行多方向位置编码的重要性。

0
下载
关闭预览

相关内容

Transformer它就是个支持向量机
专知会员服务
38+阅读 · 2023年9月7日
专知会员服务
30+阅读 · 2021年7月30日
【ICML2021】具有线性复杂度的Transformer的相对位置编码
专知会员服务
25+阅读 · 2021年5月20日
图节点嵌入(Node Embeddings)概述,9页pdf
专知会员服务
40+阅读 · 2020年8月22日
图节点嵌入(Node Embeddings)概述,9页pdf
专知
15+阅读 · 2020年8月22日
知识图谱嵌入的Translate模型汇总(TransE,TransH,TransR,TransD)
深度学习自然语言处理
31+阅读 · 2020年6月12日
从头开始了解Transformer
AI科技评论
25+阅读 · 2019年8月28日
图嵌入(Graph embedding)综述
人工智能前沿讲习班
449+阅读 · 2019年4月30日
百闻不如一码!手把手教你用Python搭一个Transformer
大数据文摘
18+阅读 · 2019年4月22日
多图带你读懂 Transformers 的工作原理
AI研习社
10+阅读 · 2019年3月18日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
11+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
美陆军设想无人系统司令部
专知会员服务
2+阅读 · 今天13:45
【博士论文】已对齐人工智能系统的持久脆弱性
专知会员服务
0+阅读 · 今天13:52
扭曲还是编造?视频大语言模型幻觉研究综述
专知会员服务
0+阅读 · 今天13:41
《采用系统思维应对混合战争》125页
专知会员服务
2+阅读 · 今天12:47
战争机器学习:数据生态系统构建(155页)
专知会员服务
6+阅读 · 今天8:10
内省扩散语言模型
专知会员服务
6+阅读 · 4月14日
国外反无人机系统与技术动态
专知会员服务
4+阅读 · 4月14日
相关资讯
图节点嵌入(Node Embeddings)概述,9页pdf
专知
15+阅读 · 2020年8月22日
知识图谱嵌入的Translate模型汇总(TransE,TransH,TransR,TransD)
深度学习自然语言处理
31+阅读 · 2020年6月12日
从头开始了解Transformer
AI科技评论
25+阅读 · 2019年8月28日
图嵌入(Graph embedding)综述
人工智能前沿讲习班
449+阅读 · 2019年4月30日
百闻不如一码!手把手教你用Python搭一个Transformer
大数据文摘
18+阅读 · 2019年4月22日
多图带你读懂 Transformers 的工作原理
AI研习社
10+阅读 · 2019年3月18日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
11+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员