Shifting Mechanisms: How Positional Encoding Choice Shapes In-Context Retrieval
Not on the map. Why?
Abstract (arXiv)
Language models increasingly use architectures that vary attention span and positional encoding across layers, such as applying RoPE with sliding-window attention and NoPE with global attention (SWA NoPE). However, how these choices shape in-context retrieval remains unclear. To study this question, we take a mechanistic view, tracing how positional encoding (PE) choice shapes the internal mechanisms models use for in-context retrieval. Across 22 open-weight models spanning eight families, we find that standard RoPE models rely primarily on positional retrieval, while PE hybrids shift toward semantic retrieval. We further show on a controlled pre-training ablation that confining positional encoding to local layers produces this semantic shift, degrading representations of positional information. Finally, we show that the reported long-context gains of PE hybrids mask a retrieval trade-off: SWA NoPE improves over RoPE on multiple-target retrieval and QA, but degrades when distinguishing competing keys. We show that these behavioral differences better track the mechanism shift from positional toward semantic mechanisms than a uniform improvement in long-context retrieval.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 33 of its 37 references that are in the map. First posted on arXiv 29 Sep 2026.
Builds on
33 of 37 references.
References · 33
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2025Qwen3 Technical Reportcited by 8,820
- 2024Qwen2.5 Technical Reportcited by 4,942
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,998
- 2025Gemma 3 Technical Reportcited by 1,824
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2026Gemma 4 Technical Reportcited by 259
- 2025Kimi Linear: An Expressive, Efficient Attention Architecturecited by 196
21 more
- 2026Qwen3.5-Omni Technical Reportcited by 174
- 2022Transformer Language Models without Positional Encodings Still Learn Positional Informationcited by 150
- 2024Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Trackingcited by 149
- 2025Context Length Alone Hurts LLM Performance Despite Perfect Retrievalcited by 127
- 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 115
- 2023How do Language Models Bind Entities in Context?cited by 108
- 2025NVIDIA Nemotron 3: Efficient and Open Intelligencecited by 65
- 2025Rope to Nope and Back Again: A New Hybrid Attention Strategycited by 47
- 2025Language Models use Lookbacks to Track Beliefscited by 39
- 2025Mixing Mechanisms: How Language Models Retrieve Bound Entities In-Contextcited by 26
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddingscited by 26
- 2025SWAN-GPT: An Efficient and Scalable Approach for Long-Context Language Modelingcited by 19
- 2025Decoupling the "What" and "Where" With Polar Coordinate Positional Embeddingscited by 10
- 2025Selective Rotary Position Embeddingcited by 9
- 2026RoPE Distinguishes Neither Positions Nor Tokens in Long Contexts, Provablycited by 8
- 2026Rotary Positional Embeddings as Phase Modulation: Theoretical Bounds on the RoPE Base for Long-Context Transformerscited by 7
- 2026Interpretability Can Be Actionablecited by 7
- 2025Decoupling Positional and Symbolic Attention Behavior in Transformerscited by 6
- 2026Rethinking the Role of Efficient Attention in Hybrid Architecturescited by 5
- 2026Fractional Rotation, Full Potential? Investigating Performance and Convergence of Partial RoPEcited by 4
- 2026Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalizationcited by 1
Built on by
Not cited yet.