Paper extends Mistral-7B and Llama-3.1-8B context to 1M tokens without changing weights
Is context length locked by the training window? This paper says no: on the original weights of Mistral-7B and Llama-3.1-8B, changing only the geometry of rotary position encoding (RoPE, which rotates attention vectors by position) pushes effective context from 32K to 1 million tokens. The method keeps true positions for the most recent 8K tokens, re-encodes farther content into slots within the training range according to keywords in the request, and re-encodes precisely once more when rare words appear during generation. Evidence: across 32K to 1 million tokens, retrieval of a single planted fact hits 99–100/100, and distinguishing three facts scores 88–100/100; at 128K, RULER scores 70.8 versus 69.9 for dense attention (Llama-3.1-8B), but Mistral-7B at 32K scores 67.8 versus 75.5, behind the original model. At 128K, prefill is 1.85 times faster and decode 1.65–1.68 times faster, with code implemented in llama.cpp. The paper itself admits: retrieving distant information by description rather than specific words fails on all tested models, including a 70B model; and it was validated only on two 7B/8B models.
Long context has always been bought by expanding the training window or continuing pre-training, at the cost of training compute and memory. If the geometry of positional encoding can itself be retrofitted after the fact, then the long-document ability of existing open models need not require retraining.
People doing long-document retrieval can treat it as a cheap recall method: as long as the query contains the specific words from the original text, content beyond a million tokens can be retrieved; but asking with descriptions like "the part that talks about the budget" currently fails.