Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
You want to extend a base model trained on 4k context to support 32k context via fine-tuning. Why is RoPE the relevant lever, what scaling variants (linear, NTK-aware, YaRN) are commonly used, and why is a short FT pass also needed?
RoPE encodes position by rotating Q and K. Scaling (linear, NTK-aware, YaRN) remaps frequencies to long positions; a short FT pass lets attention adapt.
Imagine a clock whose hands tell the model where each word sits. The model only ever practiced reading the clock for the first 4,000 seconds. Past that, the hands spin into positions it has never seen, so it gets confused. RoPE scaling slows the hands down so the 32,000th word lands at a clock angle the model already recognises. But slowing the hands changes every reading slightly, so the model still needs a little refresher practice on long documents. That short practice is the fine-tuning pass. Slow the clock first, then practice reading it. Skip either step and the model still gets lost on long inputs.
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.
5 min: how RoPE encodes position, why unseen angles collapse attention, the three scaling variants, why scaling alone fails on big jumps, and why the light fine-tune is required.
| Variant | What it rescales | Strength | Weakness |
|---|---|---|---|
| Linear (Position Interpolation) | Position indices divided by factor | Simple, stable, easy to apply | Blurs high-frequency local detail |
| NTK-aware | RoPE base theta, per frequency | Preserves short-range attention | Tuning the base needs care |
| YaRN | Per-dimension interp plus logit temperature | SOTA quality at 8 to 32 times | More moving parts, bundles an FT pass |
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.
Thinking fine-tuning alone extends context. Without rescaling RoPE, the model cannot even represent positions past its training range, so long-sequence training stalls.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.