Rotary Position Embedding for Vision Transformer

Byeongho Heo, Song Park, Dongyoon Han, Sangdoo Yun
3/20/2024
cs.CVcs.LG

Official code: naver-ai/rope-vit (465 stars, last commit 2025-10-29).

Abstract

Rotary Position Embedding (RoPE) performs remarkably on language models, especially for length extrapolation of Transformers. However, the impacts of RoPE on computer vision domains have been underexplored, even though RoPE appears capable of enhancing Vision Transformer (ViT) performance in a way similar to the language domain. This study provides a comprehensive analysis of RoPE when applied to ViTs, utilizing practical implementations of RoPE for 2D vision data. The analysis reveals that RoPE demonstrates impressive extrapolation performance, i.e., maintaining precision while increasing image resolution at inference. It eventually leads to performance improvement for ImageNet-1k, COCO detection, and ADE-20k segmentation. We believe this study provides thorough guidelines to apply RoPE into ViT, promising improved backbone performance with minimal extra computational overhead. Our code and pre-trained models are available at https://github.com/naver-ai/rope-vit

View on arXivView PDF

Code Implementations(1)

naver-ai/rope-vitOfficial100%

[ECCV 2024] Official PyTorch implementation of RoPE-ViT "Rotary Position Embedding for Vision Transformer"

46515C++, CudaMar 18, 202411 months agoNOASSERTION
eccv2024position-embeddingrotary-position-embeddingself-attentiontransformer+1 more

Similar Papers

Cite this paper

@article{heo2024rotary,
  title  = {Rotary Position Embedding for Vision Transformer},
  author = {Byeongho Heo and Song Park and Dongyoon Han and Sangdoo Yun},
  year   = {2024},
  eprint = {2403.13298},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.13298v2},
  journal = {ECCV 2024 2024}
}

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/2403.13298.svg)](https://codeofpaper.com/paper/2403.13298)

Discussion