Memory · Training

Extending Context Window of LLMs (PI)

First page
Extending Context Window of LLMs (PI)
Paper summary

Position Interpolation extends LLaMA's context to 32K with minimal fine-tuning (within 1000 steps).

Ask this paper

Key points
01

Position interpolation: Linearly interpolates positional indices so pretrained RoPE attention generalizes to longer sequences without breaking.

02

1000-step adaptation: Requires only ~1000 fine-tuning steps versus prior methods that needed much more compute.

03

Quality preservation: Maintains strong performance on tasks while reaching 32K context - both long-context tasks and standard-length benchmarks.

04

Standard long-context recipe: Became the standard approach for extending open-source model context windows throughout 2023 and early 2024.

Abstract

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.

Every Monday
Get next week’s papers.
Subscribe on Substack