Why does pure long-context FT (without RoPE scaling) fail to extrapolate?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
RoPE rotation angles past the trained context length are off-distribution. The model never learned them, so fine-tuning alone cannot help until you rescale the frequencies.
Imagine a clock where each word's position is an angle on the dial. The model spent all its training watching the hand sweep from 0 to 4 o'clock, so it only knows what those angles mean. Now you ask it to read positions way out at 32 o'clock. The hand spins to an angle it has literally never seen, and the model has no idea how words at that distance should relate. Just feeding it more long examples does not help, because the angles themselves are alien. The fix is to slow the hand down so positions up to 32 still land inside the 0-to-4 range it understands. That remapping is RoPE scaling, and a short training phase then teaches the model to settle into the rescaled dial.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: RoPE position encoding + why angles beyond the trained length are off-distribution + why FT data alone fails + the rescaling family (linear, NTK, YaRN) + the short continued-training phase + cost versus pretraining.
| Method | How it rescales | Trade-off |
|---|---|---|
| Linear position interpolation | Divide every position by the scale factor | Simple; blurs high-frequency local resolution |
| NTK-aware scaling | Change the RoPE frequency base | Keeps high frequencies sharp; can be near zero-shot |
| YaRN | Per-frequency ramp plus attention-temperature scaling | Best quality per training token; more moving parts |
| Pure long-context FT only | No rescaling at all | Fails; inputs stay off-distribution |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming more long-context training data alone extends context. The blocker is off-distribution rotation angles, not data volume. You must rescale RoPE frequencies first.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.