LongRoPE2: Near-Lossless LLM Context Window Scaling

Ning Shang, L. Zhang, Siyuan Wang, Gaokai Zhang, Gilsinia Lopez +3 more
2/14/2026

No official code found. Best implementation: microsoft/LongRoPE (289 stars, MIT, last commit 2025-10-28).

Abstract

LongRoPE2 is a novel approach that extends the effective context window of pre-trained large language models (LLMs) to the target length, while preserving the performance on the original shorter context window. This is achieved by three contributions: (1) a hypothesis that insufficient training in higher RoPE dimensions contributes to the persistent out-of-distribution (OOD) issues observed in existing methods; (2) an effective RoPE rescaling algorithm that adopts evolutionary search guided by"needle-driven"perplexity to address the insufficient training problem; (3) a mixed context window training approach that fine-tunes model weights to adopt rescaled RoPE for long-context sequences while preserving the short-context performance with the original RoPE. Extensive experiments on LLaMA3-8B and Phi3-mini-3.8B across various benchmarks validate the hypothesis and demonstrate the effectiveness of LongRoPE2. Remarkably, LongRoPE2 extends LLaMA3-8B to achieve a 128K effective context length while retaining over 98.5% of short-context performance, using only 10B tokens -- 80x fewer than Meta's approach, which fails to reach the target effective context length. Code will be available at https://github.com/microsoft/LongRoPE.

View on arXivView PDF

Code Implementations(1)

microsoft/LongRoPECommunity100%
MIT

LongRoPE is a novel method that can extends the context window of pre-trained LLMs to an impressive 2048k tokens.

28922PythonFeb 15, 202411 months agoMIT

Similar Papers

Cite this paper

@article{shang2026longrope,
  title  = {LongRoPE2: Near-Lossless LLM Context Window Scaling},
  author = {Ning Shang and L. Zhang and Siyuan Wang and Gaokai Zhang and Gilsinia Lopez and Fan Yang and Weizhu Chen and Mao Yang},
  year   = {2026},
  eprint = {2502.20082},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2502.20082},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.20082.svg)](https://codeofpaper.com/paper/2502.20082)

Discussion