RoPE and context extension: the math of Position Interpolation, NTK-aware scaling and YaRN
How can a language model trained on 4096 tokens read a text of 64 thousand? A derivation of Rotary Position Embedding (RoPE), frequencies and wavelengths, why extrapolation fails, Position Interpolation, NTK-aware scaling, Dynamic NTK, NTK-by-parts, YaRN’s attention temperature, and experiments with a small Transformer. Keywords: RoPE, Rotary Position Embedding, context extension, context window, Position Interpolation, PI, NTK-aware scaling, NTK-by-parts, Dynamic NTK, YaRN, attention temperature, positional encoding, extrapolation, interpolation, long context, Code Llama, DeepSeek-V3, large language models, deep learning
Authors
- Mehmet Emin YAYLA (ORCID: https://orcid.org/0009-0003-2017-805X)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-02
- DOI
- https://doi.org/10.5281/zenodo.24762261
- Primary Topic
- Topic Modeling
- Type
- article
- Field-Weighted Citation Impact
- 0.00