A Training-Free Length Extrapolation Approach for LLMs: Greedy Attention Logit Interpolation (GALI)

Yan Li, Tianyi Zhang, Zechuan Li, Soyeon Caren Han
2/4/2025
cs.CLcs.AI

Official code: adlnlp/Gali (0 stars, MIT, last commit 2025-07-28). 1 more implementation below.

Abstract

Transformer-based Large Language Models (LLMs) struggle with inputs exceeding their training context window due to positional out-of-distribution (O.O.D.) issues that disrupt attention. Existing solutions, including fine-tuning and training-free methods, face challenges like inefficiency, redundant interpolation, logit outliers, or loss of local positional information. We propose Greedy Attention Logit Interpolation (GALI), a training-free method that improves length extrapolation by greedily reusing pretrained positional intervals and interpolating attention logit to eliminate outliers. GALI achieves stable and superior performance across a wide range of long-context tasks without requiring input-length-specific tuning. Our analysis further reveals that LLMs interpret positional intervals unevenly and that restricting interpolation to narrower ranges improves performance, even on short-context tasks. GALI represents a step toward more robust and generalizable long-text processing in LLMs. Our implementation of GALI, along with the experiments from our paper, is open-sourced at https://github.com/adlnlp/Gali.

View on arXivView PDF

Code Implementations(2)

adlnlp/GaliOfficial100%
MIT
00TeX, PythonFeb 1, 20251 years agoMIT
AcademyCityL/GALICommunity100%
MIT

The implementation of GALI and related experiments.

53TeX, PythonFeb 4, 20259 months agoMIT

Similar Papers

Cite this paper

@article{li2025trainingfree,
  title  = {A Training-Free Length Extrapolation Approach for LLMs: Greedy Attention Logit Interpolation (GALI)},
  author = {Yan Li and Tianyi Zhang and Zechuan Li and Soyeon Caren Han},
  year   = {2025},
  eprint = {2502.02659},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.02659v2}
}

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.02659.svg)](https://codeofpaper.com/paper/2502.02659)

Discussion