NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Selective Rotary Position Embedding

Sajad Movahedi, Timur Carstensen, Arshia Afzal, Frank Hutter, Antonio Orvieto, Volkan Cevher

Positional information is essential for language modeling. Standard softmax Transformers excel at recalling information from their context, largely thanks to Rotary Position Embeddings (RoPE) which encode relative token positions through fixed-angle rotations. However, their computational cost scales quadratically with sequence length.

To address this, researchers have developed sub-quadratic models like linear Transformers and State-Space Models (SSMs). While efficient, these models compress history into a fixed-size hidden state, often hurting their ability to recall specific long-horizon information. Recent linear models use "selective gating" (input-dependent decay) to decide what to forget, but they lack a direct mechanism to encode relative token positions through rotation.

This paper introduces Selective Rotary Position Embedding (Selective RoPE), an input-dependent, learnable rotary embedding that generalizes RoPE to arbitrary angles and composes seamlessly with decay gates, bridging the gap between softmax attention and linear state-space models.

The Method: Selective RoPE

Standard RoPE applies fixed-angle rotations to query-key pairs based strictly on their absolute distance from one another. Selective RoPE makes these rotation angles input-dependent and learnable.

Comparison of GLA/Mamba2 gating, standard RoPE, and Selective RoPE

Instead of fixed frequencies, the model uses a 1D short-convolution on the input tokens to dynamically determine the rotation angle, followed by a cumulative sum. It also includes a "phase gate" (a sigmoid function) that allows the model to selectively decide whether to apply the rotation.

To maintain the efficiency of linear models, the authors utilize the "RoPE trick," which allows them to compute complex-valued linear attention entirely in the real domain. They also provide a custom Triton kernel that fuses operations (like the cumulative sum) to prevent memory bottlenecks on the GPU.

Theoretical Insights: The Recipe for Recall

The authors provide a unifying theoretical framework linking gating (forgetting) and rotation (positioning):

  • Softmax Secretly Rotates: Viewed through the mathematical lens of Random Fourier Features (RFF), standard softmax attention actually performs a hidden form of input-dependent selective rotation. Linear models natively lack this, explaining their historical recall deficit.
  • Rotation + Decay: A purely rotational linear model acts like a spectral analyzer. If applied to a finite sequence, it suffers from "spectral leakage" (distorting the signal). Adding an exponential decay (a forget gate) acts as a windowing function that suppresses this leakage.
Signal processing perspective showing how decay acts as a windowing function to prevent spectral leakage
  • Division of Labor: In complex-valued sequence models, the real part of the state transition handles forgetting (suppressing leakage), while the imaginary part encodes positional structure (extracting spectral info via rotation).
  • Breaking the Expressivity Barrier: Linear RNNs and SSMs famously fail at state-tracking tasks like the "parity problem" (tracking flips between 0 and 1). Because Selective RoPE's rotations are input-dependent, it allows the model to "flip" its state based on specific tokens, successfully solving these previously out-of-reach tasks.

Key Results

The authors evaluated Selective RoPE across synthetic benchmarks and downstream language modeling tasks:

  • Synthetic Recall & State Tracking: Equipping Gated Linear Attention (GLA) with Selective RoPE dramatically improved performance on the MAD benchmark, raising the average score from 65.9 (NoPE) to 73.2. It also vastly improved Multi-Query Associative Recall (MQAR) and string copying. Furthermore, GLA with Selective RoPE perfectly solved the S2 parity task up to and slightly beyond the training sequence length—a task standard GLA completely fails at.
  • Language Modeling: The authors trained 370M parameter versions of GLA, Gated DeltaNet, and FoX on 35 billion tokens from the FineWeb dataset. Across the board, adding Selective RoPE improved average downstream zero-shot accuracy (on LAMBADA, PIQA, HellaSwag, WinoGrande, and ARC) compared to using standard RoPE or no positional embeddings.
  • Throughput: Thanks to their custom Triton kernel, the prefill throughput for Selective RoPE on long sequences (up to 128K) improved by up to 340% compared to a naive PyTorch compiled implementation.

Limitations and Future Work

While Selective RoPE significantly boosts expressivity and recall, the authors note a few limitations. Standard RoPE is notoriously detrimental to a model's ability to extrapolate to sequences longer than its training context; the extrapolation capabilities of Selective RoPE remain an area for future investigation. Additionally, adding the phase gate and bias term sometimes caused training instabilities (gradient spikes) at higher learning rates, suggesting further research is needed to stabilize and optimize these components.

Summary updated

BibTeX
@inproceedings{movahedi2026selective,
  author = {Sajad Movahedi and Timur Carstensen and Arshia Afzal and Frank Hutter and Antonio Orvieto and Volkan Cevher},
  title = {{Selective Rotary Position Embedding}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=AQo1SEElNb},
}
Figure