Back to LLMs Mind Map
中文·English
LLMsID: rope-extrapolation

RoPE Extrapolation PI/NTK/YaRN

RoPE 外推方案 PI/NTK/YaRN
🎯Core Definition
three ways to extend RoPE from the training length to longer contexts at low cost: PI (Position Interpolation) linearly rescales position mm to m/sm / s (ss = scaling factor); NTK-aware changes the rotary base to θ=10000sdd2\theta = 10000 \cdot s^{\frac{d}{d-2}} so high-frequency dims stay mostly uninterpolated while low-frequency dims stretch; YaRN (NTK-by-parts + temperature) interpolates only dims whose wavelength is much longer than the context window, keeps high-frequency dims untouched, and divides attention logits by a temperature tst \approx \sqrt{s}.
💡Use Cases
cheap post-training context extension, e.g. LLaMA-2 from 4K to 32K/64K/128K; YaRN is currently the most used and best-performing option (adopted by many long-context open models), and comparing the three is a classic interview question.
Key Problems Solved
naive extrapolation misreads the rotation periods of low-frequency dims beyond the trained length, collapsing perplexity; plain PI compresses every dimension uniformly, destroying high-frequency resolution and short-range dependencies; NTK-by-parts interpolates only dims with wavelength larger than the window, preserving local resolution, and YaRN adds a temperature to fix attention sharpness — at 16x extension it stays close to original perplexity, making it the best in quality and stability.
🎯5 High-Frequency Exam Points
1
Why does direct RoPE extrapolation fail (periodic ambiguity, frequencies beyond training coverage)?
2
How PI works and its main flaw (uniform scaling loses high-frequency resolution)?
3
Difference between NTK-aware and NTK-by-parts? The wavelength criterion?
4
What are YaRN's two components? Role of temperature tst \approx \sqrt{s}?
5
How to evaluate extrapolation methods (long-doc perplexity + needle precision recall)?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "RoPE Extrapolation PI/NTK/YaRN"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardPositional Encoding RoPE/ALiBiNext CardFFN & SwiGLU

🔗 More LLMs Knowledge Cards

Agent & Tool CallingAlignment Tax & Preference DataScaled Dot-Product AttentionAttention Variants MHA/MQA/GQA