[Paper Review] Farther the Shift, Sparser the Representation: Analyzing OOD Mechanisms in LLMs
This paper shows that as input difficulty increases, last-hidden-state representations in LLMs become sparser, and introduces sparsity-guided in-context learning (SG-ICL) to improve reasoning under OOD.
In this work, we investigate how Large Language Models (LLMs) adapt their internal representations when encountering inputs of increasing difficulty, quantified as the degree of out-of-distribution (OOD) shift. We reveal a consistent and quantifiable phenomenon: as task difficulty increases, whether through harder reasoning questions, longer contexts, or adding answer choices, the last hidden states of LLMs become substantially sparser. In short, extbf{ extit{the farther the shift, the sparser the representations}}. This sparsity--difficulty relation is observable across diverse models and domains, suggesting that language models respond to unfamiliar or complex inputs by concentrating computation into specialized subspaces in the last hidden state. Through a series of controlled analyses with a learning dynamic explanation, we demonstrate that this sparsity is not incidental but an adaptive mechanism for stabilizing reasoning under OOD. Leveraging this insight, we design extit{Sparsity-Guided Curriculum In-Context Learning (SG-ICL)}, a strategy that explicitly uses representation sparsity to schedule few-shot demonstrations, leading to considerable performance enhancements. Our study provides new mechanistic insights into how LLMs internalize OOD challenges. The source code is available at the URL: https://github.com/MingyuJ666/sparsityLLM.
Motivation & Objective
- Identify how last-layer representations of LLMs change with increasing task difficulty under OOD shift.
- Investigate mechanisms driving the emergence of representation sparsity during OOD challenges.
- Assess whether sparsity can be leveraged to improve reasoning through curriculum-based in-context learning.
Proposed method
- Quantify last-hidden-state sparsity using L1 norm and Top-k Energy across multiple difficulty axes.
- Create controlled OOD settings: reasoning complexity, distractor expansion, knowledge conflict, and context length.
- Propose Sparsity-Guided Curriculum In-Context Learning (SG-ICL) to select demonstrations by sparsity-derived difficulty.
- Conduct synthetic pretraining with a toy knowledge-graph dataset to analyze learning dynamics and sparsity emergence.
- Provide theoretical and empirical analysis linking sparsity dynamics to data familiarity and learning phases.

Experimental results
Research questions
- RQ1RQ1: How does the geometry of the last hidden state evolve as reasoning tasks become increasingly difficult?
- RQ2RQ2: What mechanisms drive the emergence of sparsity when models face OOD challenges?
- RQ3RQ3: How can this sparsity signal be practically leveraged to enhance model reasoning capabilities?
Key findings
- Across four difficulty axes, harder inputs yield sparser last-layer representations, measured by L1 norm decrease and Top-k Energy increase.
- Sparsity correlates strongly with lower accuracy, indicating a link between activation compression and performance degradation.
- Increased distractor counts in MMLU-Pro (Normal → Moderate → Large) lead to higher sparsity across disciplines and metrics.
- Conflict knowledge settings show statistically significant increases in sparsity across multiple metrics.
- Long-context reasoning shows sparsity increases as context length grows, with the final layer most affected.
- SG-ICL improves few-shot reasoning performance, e.g., 76.60% accuracy on MATH500 with Qwen2.5-7B, surpassing Auto-CoT at 75.20%.
- Pretraining experiments with synthetic data reveal sparsity–difficulty patterns emerge as a learned property only after sufficient capacity and convergence.
- A two-stage learning dynamic is observed: initial sparsification followed by consolidation (densification) of representations, forming a finite-horizon U-shaped sparsity pattern.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.