Rotary Position Embedding for Vision Transformer

Byeongho Heo, Song Park, Dongyoon Han, Sangdoo Yun

arXiv:2403.13298 · 2026-07-27 공개 · arXiv · PDF

vision-language vision-transformer position-encoding length-extrapolation image-net-1k image-resolution coco-detection rotary-position-embedding

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

한국어 요약

한 줄 요약

2D RoPE-Mixed를 활용한 Vision Transformer(ViT)의 정밀도 향상과 해상도 확장 성능 개선을 제시한다.

핵심 기여도

핵심 아이디어

기존 ViT는 절대 또는 상대 위치 임베딩(APE, RPB)을 사용하지만, 해상도 변화에 유연하지 못하다. RoPE는 언어 모델에서 성공적으로 사용된 상대 위치 임베딩 방식으로, 토큰의 순서 정보를 회전 매트릭스로 인코딩한다. 본 연구는 RoPE를 2D 이미지에 확장하여, RoPE-Mixed라는 새로운 모듈을 제안한다. 이는 기존의 Axial 2D RoPE가 대각선 방향을 처리하지 못하는 문제를 해결하기 위해, x축과 y축의 주파수를 모두 학습 가능한 파라미터로 사용한다. 이는 CNN의 정사각 커널이 대각선 정보를 중요하게 다루는 특성과 일치하며, ViT의 어텐션 메커니즘에 더 적합하다는 점에서 핵심적 통찰이다.

기술적 접근법

주요 결과

의의 및 한계

본 연구는 RoPE를 시각 모델에 효과적으로 적용할 수 있음을 입증하며, ViT의 해상도 확장 문제를 해결하는 실질적인 방안을 제시한다. 특히 RoPE-Mixed는 대각선 방향 정보를 처리하는 데 강점을 가지며, 기존 ViT 구조에 추가적인 계산 부담 없이 통합 가능하다는 점에서 실용적 가치가 높다. 그러나 RoPE-Mixed는 주파수 파라미터를 학습해야 하므로, 초기 학습 곡선이 다소 길어질 수 있다. 또한, 매우 고해상도 이미지(예: 896px 이상)에서의 성능은 명시되지 않아 추가 연구가 필요하다.

실용적 활용

RoPE-Mixed는 객체 탐지, 세분화 분할, 다중 해상도 분류 등 고해상도 이미지 처리가 필요한 시각 인식 시스템에 적용 가능하다. 특히, ViT와 Swin Transformer 기반의 모델에서 성능 향상을 기대할 수 있으며, 이미지 증강 없이도 해상도 확장에 안정적으로 대응할 수 있어 산업 현장에서 유용하게 활용될 수 있다.