Long-Short Alignment for Effective Long-Context Modeling in LLMs

Tianqi Du, Haotian Huang, Yifei Wang, Yisen Wang
6/13/2025
cs.CLcs.LG

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Large language models (LLMs) have exhibited impressive performance and surprising emergent properties. However, their effectiveness remains limited by the fixed context window of the transformer architecture, posing challenges for long-context modeling. Among these challenges, length generalization -- the ability to generalize to sequences longer than those seen during training -- is a classical and fundamental problem. In this work, we propose a fresh perspective on length generalization, shifting the focus from the conventional emphasis on input features such as positional encodings or data structures to the output distribution of the model. Specifically, through case studies on synthetic tasks, we highlight the critical role of \textbf{long-short alignment} -- the consistency of output distributions across sequences of varying lengths. Extending this insight to natural language tasks, we propose a metric called Long-Short Misalignment to quantify this phenomenon, uncovering a strong correlation between the metric and length generalization performance. Building on these findings, we develop a regularization term that promotes long-short alignment during training. Extensive experiments validate the effectiveness of our approach, offering new insights for achieving more effective long-context modeling in LLMs. Code is available at https://github.com/PKU-ML/LongShortAlignment.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{du2025longshort,
  title  = {Long-Short Alignment for Effective Long-Context Modeling in LLMs},
  author = {Tianqi Du and Haotian Huang and Yifei Wang and Yisen Wang},
  year   = {2025},
  eprint = {2506.11769},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.11769v1},
  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/2506.11769.svg)](https://codeofpaper.com/paper/2506.11769)

Discussion