A model trained with a 2k context degrades sharply when given 8k-token inputs. What architectural causes would you investigate?

Last updated 22 November 2026

  • First suspect is positional encoding extrapolation: learned absolute embeddings have no vectors past 2048, and RoPE sees unseen rotation angles (fix with PI, NTK scaling, or YaRN).

  • Also check attention dilution (softmax flattens over more keys, fix with log-n temperature), attention-sink tokens being evicted, length-specific windows or masks, wrong max_position_embeddings config, and low-precision RoPE angles.

  • Diagnose with per-position loss: a cliff at 2k points to positional encoding, gradual decay points to dilution. Long-context fine-tuning is usually needed anyway since 2k data never taught long-range dependencies.

  • https://medium.com/data-science-collective/positional-encoding-from-sinusoidal-to-rope-to-alibi-02774e73a6a8
  • https://medium.com/@saneshashank/understanding-rope-rotary-position-embeddings-b99dff4a1aa5
  • https://aiengineeringfromscratch.com/interviews/transformers/extend-context-past-training
All Transformers interview questions