Spiral RoPE: Rotate Your Rotary Positional Embeddings in the 2D Plane

Haoyu Liu, Sucheng Ren, Tingyu Zhu, Peng Wang, Cihang Xie +3 more
2/3/2026
cs.CV
transformer-attention

No confident code implementation found for this paper.

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2026spiral,
  title  = {Spiral RoPE: Rotate Your Rotary Positional Embeddings in the 2D Plane},
  author = {Haoyu Liu and Sucheng Ren and Tingyu Zhu and Peng Wang and Cihang Xie and Alan Yuille and Zeyu Zheng and Feng Wang},
  year   = {2026},
  eprint = {2602.03227},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.03227v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2602.03227.svg)](https://codeofpaper.com/paper/2602.03227)

Discussion