A model was pretrained at 8k context. You need 128k. What are your options? Explain position interpolation and YaRN.
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The failure you're fixing: RoPE encodes position as rotation angles, and positions past 8k produce angle combinations the model has never seen - attention behaviour degrades catastrophically out-of-distribution. Naive fine-tuning at 128k from scratch positions is expensive and slow to converge, so the practical methods rescale RoPE so long contexts land inside (or near) the distribution the model already understands.
Full worked answer with diagram
The failure you're fixing: RoPE encodes position as rotation angles, and positions past 8k produce angle combinations the model has never seen - attention behaviour degrades catastrophically out-of-distribution. Naive fine-tuning at 128k from scratch positions is expensive and slow to converge, so the practical methods rescale RoPE so long contexts land inside (or near) the distribution the model already understands.
Position interpolation (PI): compress positions linearly - to run at 32k on an 8k-trained model, multiply every position by 1/4 (equivalently, scale RoPE frequencies down) so the full range maps into [0, 8k]. All angles are now in-distribution; the cost is resolution - adjacent tokens are only a quarter of a "position unit" apart, blurring the fine-grained local distinctions the high-frequency dimensions were providing. A short fine-tune (order of ~1B tokens) recovers most quality. Simple and effective; local precision suffers most at large scale factors.
NTK-aware scaling (the intermediate idea): instead of compressing all frequencies equally, rescale the RoPE base so low-frequency (long-wavelength) dims get interpolated a lot while high-frequency dims stay nearly intact - preserving local resolution while stretching long-range coverage. Popular because it works surprisingly well even without fine-tuning.
YaRN combines and refines these: divide RoPE dimensions into bands by how many full wavelengths fit in the trained context - high-frequency bands are left untouched (they've seen all phases; they encode local structure), low-frequency bands are fully interpolated (their absolute angles matter), and a middle band is smoothly ramped between the two - plus a small attention-temperature adjustment (scaling attention logits) that compensates for the entropy shift longer contexts induce. YaRN reaches strong long-context quality with roughly an order of magnitude less fine-tuning data than plain PI, and it's the basis of many open-model long-context variants.
Also mention: production long-context models typically combine such scaling with dedicated long-context mid-training (continued pretraining on genuinely long documents) - frequency surgery makes long positions representable; training on long-range dependencies makes them usable. And verify with retrieval evals (needle-in-a-haystack and, better, multi-fact reasoning benchmarks like RULER-style suites) - advertised length ≠ usable length.
Worth sketching. Banding the frequencies is what separates a YaRN answer from a plain position-interpolation answer.
flowchart TD
P["position beyond the trained 8k"] --> B{"which RoPE frequency band?"}
B -->|"high freq, many wavelengths already seen"| HI["leave untouched,<br/>local resolution preserved"]
B -->|"middle band"| MID["ramp smoothly between the two"]
B -->|"low freq, long wavelength"| LO["interpolate fully,<br/>absolute angle stays in range"]
HI --> AT["plus attention temperature scaling<br/>for the entropy shift"]
MID --> AT
LO --> AT
AT --> FT["short fine-tune on genuinely long documents"]
What a good answer covers
- The failure you're fixing
- Naive fine-tuning at 128k from scratch positions is expensive and slow to converge, so the practical…
- Position interpolation (PI)
- All angles are now in-distribution; the cost is resolution - adjacent tokens are only a quarter of a…
- A short fine-tune (order of ~1B tokens) recovers most quality
Key terms: Position interpolation (PI) · NTK-aware scaling · high-frequency dims stay nearly intact · YaRN · long-context mid-training
In the glossary: RoPE · Position interpolation · YaRN · Continued pretraining · Temperature scaling · Temperature
Interviewer follow-ups to expect
Why do high-frequency RoPE dims need no interpolation?
Why does long-context extension usually still require some fine-tuning on long documents?
How would you verify usable context length before shipping?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep