Extending Context Window of Large Language Models via Positional Interpolation

Interesting technique to increase the context window of language models by finetuning on a small number of samples after pretraining.

(I did a double-take after seeing the heading on the first page of the pdf, but it's not actually an old paper.)

We present Position Interpolation (PI) that extends the context window sizes of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal fine-tuning (within 1000 steps), while demonstrating strong empirical results on various tasks that require long context, including passkey retrieval, language modeling, and long document summarization from LLaMA 7B to 65B. Meanwhile, the extended model by Position Interpolation preserve quality relatively well on tasks within its original context window. To achieve this goal, Position Interpolation linearly down-scales the input position indices to match the original context window size, rather than extrapolating beyond the trained context length which may lead to catastrophically high attention scores that completely ruin the self-attention mechanism. Our theoretical study shows that the upper bound of interpolation is at least $\sim 600 \times$ smaller than that of extrapolation, further demonstrating its stability. Models extended via Position Interpolation retain its original architecture and can reuse most pre-existing optimization and infrastructure.

SSamDav,

One cool thing about this work is that there was a concurrent discussion in twitter about the proposed method. From different authors.

nsa,

do you have a link?

miro,

Is this similar to what MPT did to extend its context length?

nsa,

hmmm... not sure which model you're referring to. do you have a paper link?

Blaed,

I believe it's a different technique (at least far as I understand the topics).

According to Mosaic, MPT (i.e. MPT-7B-StoryWriter-65k+) uses a different underlying architecture which enables their long context lengths.

The original author of this new method (SuperHOT by kaiokendev) shares what he has learned about this method here:

  • All
  • Subscribed
  • Moderated
  • Favorites
  • machinelearning
  • cubers
  • DreamBathrooms
  • osvaldo12
  • tacticalgear
  • InstantRegret
  • magazineikmin
  • Youngstown
  • ngwrru68w68
  • slotface
  • rosin
  • mdbf
  • kavyap
  • cisconetworking
  • khanakhh
  • JUstTest
  • thenastyranch
  • modclub
  • ethstaker
  • GTA5RPClips
  • everett
  • normalnudes
  • tester
  • Durango
  • Leos
  • megavids
  • anitta
  • provamag3
  • lostlight
  • All magazines