LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillation

Zican Dong, Junyi Li, Jinhao Jiang, Mingyu Xu, Wayne Xin Zhao, Bingning Wang, Weipeng Chen

TL;DR

Extending the context window of Large Language Models (LLMs) often comes at a hidden cost: a significant drop in performance on short-text tasks. LongReD (Long Context Pre-training with Restoration Distillation) mitigates this by using the original model as a teacher to distill hidden states and output distributions back into the extended model, effectively "restoring" its general capabilities while scaling its context window.

What Problem Does This Paper Address?

Modern LLMs are frequently adapted to handle massive context windows (e.g., 128K tokens) through techniques like Rotary Positional Embedding (RoPE) scaling and continual pre-training. However, researchers have observed a "short-text degradation" phenomenon where the model's zero-shot performance on standard benchmarks (like MMLU or HumanEval) declines after extension.

The authors identify two root causes for this:

  1. Distribution Drift: Modifying positional encodings fundamentally changes the internal distribution of hidden states and attention scores. Even with training, the model struggles to perfectly restore its original internal "logic."
  2. Catastrophic Forgetting: During the lightweight continual pre-training phase—which typically uses long-text data—the model begins to forget the general knowledge and reasoning patterns it acquired during its massive initial pre-training on shorter, diverse texts.
Figure 1: Comparison of the original and long-context models via ABF (Xiong et al., 2024) or PI (Chen et al., 2023) on common short-text benchmarks.

Methods

LongReD introduces a three-pronged joint training objective to balance long-context adaptation with short-text preservation:

  1. Long-Text Training: Standard language modeling loss on long sequences to help the model adapt to scaled positional encodings.
  2. Short-Text Distillation: The original (short-context) model acts as a teacher. The extended model (student) is trained to minimize the discrepancy between its hidden states and the teacher's hidden states on short-text samples. Crucially, the authors use an attention-based layer selection method, distilling only the layers with the highest KL divergence in attention scores to avoid over-constraining the model.
  3. Short-to-Long Distillation: To bridge the gap between short and long processing, the authors use "skipped positional indices." They feed short text to the model but assign it positional indices that simulate long-distance dependencies (e.g., indices 0, 4678, ..., 31999). The student is then trained to align its output distribution at these "simulated" long positions with the teacher's output at normal short positions.
Overview of the LongReD framework, showing the three distillation objectives.

Datasets

  • Long-Text Data ($D_1$): Sampled from SlimPajama, packed to the target context length (e.g., 32K or 128K).
  • Short-Text Distillation Data ($D_2$): High-quality datasets including Fineweb-Edu, Stack-v2, Wikipedia, and various instruction-tuning sets like Tulu-v2 and MathInstruct.
  • Short-to-Long Data ($D_3$): Also sampled from SlimPajama, used for the skipped positional indices training.
  • Evaluation: 17 short-text benchmarks (MMLU, HumanEval, GSM8K, etc.) and the RULER benchmark for long-context retrieval and reasoning.

Key Insights and Ideas

  • The Forgetting Curve: Empirical analysis shows that short-text performance actually improves slightly in the first few steps of continual pre-training but then steadily declines. This confirms that while some adaptation is necessary, prolonged training on long-text alone is detrimental.
  • Similarity as a Proxy for Performance: The authors found a strong linear correlation between the "Hidden State Similarity" (comparing the extended model to the original) and the preservation of MMLU scores. If you can keep the hidden states similar, you keep the performance.
  • Layer Granularity Matters: Distilling every layer or just the last layer is sub-optimal. Selecting specific "disturbed" layers via KL divergence provides the best balance between preserving old knowledge and learning new context lengths.
Figure 2: Relationship between MMLU performance preservation of long-context models w.r.t. the hidden states similarity.

Key Results

LongReD consistently outperforms standard continual pre-training (CPT) and data-mixing baselines:

  • Llama-3-8B (32K extension): LongReD retained 99.4% of the original model's short-text performance, whereas naive CPT dropped to 92.5%.
  • Mistral-7B-v0.3 (128K extension): LongReD significantly improved RULER scores (long-context) compared to baselines while maintaining much higher scores on coding and math tasks.
  • Efficiency: The method requires only ~10% extra computation compared to standard CPT but yields a much more robust model.

Limitations and Future Work

  • Training Volume: The authors note that training on massive amounts of data (100B+ tokens) might eventually mitigate degradation naturally, but LongReD is designed for the "lightweight" regime (1B tokens) where most researchers operate.
  • Positional Encoding Disruption: While LongReD mitigates the effects of RoPE scaling, it doesn't solve the underlying issue that scaling itself is a disruptive operation. Future work could look into extension methods that are inherently less disruptive to the model's internal distributions.
  • Integration: The authors suggest exploring how to integrate distillation directly into the long-text training rather than treating short and long texts as separate objectives.

Summary updated

BibTeX
@inproceedings{dong2025longred,
  author = {Zican Dong and Junyi Li and Jinhao Jiang and Mingyu Xu and Wayne Xin Zhao and Bingning Wang and Weipeng Chen},
  title = {{LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure