Position Encoding in Transformers: From Absolute and Relative Methods to Rotary Position Embeddings and Long-Context Scaling
Not on the map. Why?
Abstract (arXiv)
Self-attention models content-dependent interactions between tokens but does not by itself encode token order. Position encoding addresses this limitation by introducing absolute coordinates, relative distances, or position-dependent rotations into Transformer representations and attention scores. This technical survey develops a unified account of sinusoidal and learned absolute position embeddings, Shaw-style relative position representations, Transformer-XL, T5 relative position bias, ALiBi, and Rotary Position Embeddings (RoPE). We derive how RoPE converts absolute position indices into relative phase differences in Query-Key inner products and compare these methods in terms of where position is injected, computational cost, compatibility with KV caching, and length extrapolation. We then examine long-context extensions, including Position Interpolation, RoPE scaling laws, NTK-aware scaling, Dynamic NTK, NTK-by-parts, YaRN, LongRoPE, and LongRoPE2, with emphasis on frequency allocation, attention rescaling, training length, and target context length. We also summarize implementation considerations, evaluation protocols, and position-encoding choices in representative large language models. A central conclusion is that the ability to compute positional features beyond the training length does not imply reliable long-context generalization; context extension must be evaluated through short-context retention, position-wise perplexity, retrieval, reasoning, and long-context code tasks.
Key facts. No citing papers in the map yet (data through 13 Oct 2026). Builds on 15 of its 25 references that are in the map. First posted on arXiv 9 Aug 2026.
Builds on
15 of 25 references.
References · 15
- 2020Language Models are Few-Shot Learnerscited by 32,320
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,549
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,979
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,628
- 2023Code Llama: Open Foundation Models for Codecited by 2,130
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,908
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,835
- 2018Self-Attention with Relative Position Representationscited by 1,116
- 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,115
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,093
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 727
- 2023The Falcon Series of Open Language Modelscited by 533
3 more
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 307
- 2023Scaling Laws of RoPE-based Extrapolationcited by 125
- 2025LongRoPE2: Near-Lossless LLM Context Window Scalingcited by 22
Built on by
Not cited yet.