LongRoPE2: Near-Lossless LLM Context Window Scaling
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.
Community
We introduce LongRoPE2, an advanced version of LongRoPE that significantly improves long-context extension for RoPE-based LLMs. It has been adopted in Phi4-mini and Phi4-multimodal.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- LongPO: Long Context Self-Evolution of Large Language Models through Short-to-Long Preference Optimization (2025)
- MoBA: Mixture of Block Attention for Long-Context LLMs (2025)
- Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Models (2025)
- Rope to Nope and Back Again: A New Hybrid Attention Strategy (2025)
- A Training-Free Length Extrapolation Approach for LLMs: Greedy Attention Logit Interpolation (GALI) (2025)
- Massive Values in Self-Attention Modules are the Key to Contextual Knowledge Understanding (2025)
- AlphaAdam:Asynchronous Masked Optimization with Dynamic Alpha for Selective Updates (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper