atlas

Research map / Large language models / Language, safety and interpretability

Why Does the Effective Context Length of LLMs Fall Short?

ICLR 2025 · Large language models › Language, safety and interpretability · approach: LLM pruning and scaling data · 3 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes StRing, a training-free inference-time method that shifts well-trained relative positions onto the undertrained tail positions to improve effective context length within the training window, lifting Llama3.1 70B and Qwen2 72B on RULER and InfiniteBench.

Problem

Open-source LLMs' effective context length typically falls below half their training length; the authors attribute this to a left-skewed frequency distribution of relative positions seen during training, which leaves long-distance positions undertrained.

Approach

During inference, drop the infrequent tail of relative positions (beyond a threshold N) and shift the frequent positions from the main diagonal toward the bottom-left corner with offset S, plus a small local window W; implemented with FlashAttention as sliding-window attention plus shifted causal self-attention merged by log-sum-exp style weighting.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Apply StRing instead of RoPE7 base models · NIAH (4 needles), average across 7 modelsscore: 67.8 -> 85.7Helped
Apply StRing instead of RoPELlama3.1-70B · RULER, 128KAvg. (13 tasks): 66.6 -> 81.7Helped
Apply StRing instead of RoPEQwen2-72B · RULER, 128KAvg. (13 tasks): 53.7 -> 84.6Helped
Apply StRing instead of RoPELlama3.1-8B · InfiniteBenchAvg.: 46.43 -> 52.54Helped
Apply StRing instead of RoPELlama3.1-70B · InfiniteBenchAvg.: 45.25 -> 56.88Helped
Set local window W to at least 32 (ablation)StRing · NIAH (4 needles)scoreHelped
Increase local window W while keeping W much smaller than S (ablation)StRing · NIAH (4 needles)scoreNo clear effect
Increase shifted offset S from L/5 toward L/2 (ablation)StRing · NIAH (4 needles)scoreHelped
Increase shifted offset S beyond L/3 (ablation)StRing · NIAH (4 needles)scoreMixed
Train with a 4K rather than 2K context windowTinyLlama-1.3B · Needle-in-a-Haystack effective context length after 400B tokenseffective context length: 1.4KHelped

Surprising findings

Limitations

Experimental setup

Datasets: SlimPajama-627B Paul Graham Essays (NIAH haystack) RULER InfiniteBench Needle-in-a-Haystack

Benchmarks: Needle-in-a-Haystack (4-needle) RULER InfiniteBench

Metrics: accuracy average score across RULER tasks InfiniteBench task scores

Baselines: RoPE NTK-Aware RoPE YaRN ReRoPE Self-Extend DCA GPT-4-128K Claude 2 Kimi-chat

Builds on: RoPE FlashAttention NTK-aware RoPE YaRN DCA

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy