[论文解读] Farther the Shift, Sparser the Representation: Analyzing OOD Mechanisms in LLMs
这篇论文表明,随着输入难度提升,LLM 的最后隐藏状态表征变得更稀疏,并提出稀疏性引导的上下文学习(SG-ICL)以在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.
研究动机与目标
- 在OOD漂移下,探究LLM 的最后层表征如何随任务难度增加而变化。
- 研究在OOD挑战中促成表征稀疏性的机制。
- 评估是否可通过课程化上下文学习来利用稀疏性来提升推理能力。
提出的方法
- 使用L1范数和Top-k Energy在多维难度轴上量化最后隐藏层的稀疏性。
- 创建受控的OOD设置:推理复杂度、干扰项扩展、知识冲突和上下文长度。
- 提出稀疏性引导的课程化上下文学习(SG-ICL),通过稀疏性派生的难度选择演示示例。
- 进行 toy 知识图数据集的合成预训练以分析学习动力学和稀疏性出现。
- 提供理论与经验分析,将稀疏性动力学与数据熟悉度及学习阶段联系起来。

实验结果
研究问题
- RQ1RQ1: 当推理任务越来越困难时,最后隐藏状态的几何结构如何演变?
- RQ2RQ2: 在模型面对OOD挑战时,促成稀疏性出现的机制是什么?
- RQ3RQ3: 如何实际利用这一稀疏性信号来提升模型的推理能力?
主要发现
- 在四个难度轴上,越难的输入会带来更稀疏的最后层表征,表现为L1范数下降和Top-k Energy 上升。
- 稀疏性与较低的准确率高度相关,表明激活压缩与性能下降之间存在联系。
- 在MMLU-Pro(Normal → Moderate → Large)中干扰项数量增加导致跨学科和指标的稀疏性上升。
- 冲突知识设定在多项指标上显示统计显著的稀疏性增加。
- 长上下文推理中,随着上下文长度增加,稀疏性提升,且最终层受影响最大。
- SG-ICL 提升了少-shot 推理的表现,例如在 Qwen2.5-7B 的 MATH500 上达到 76.60% 的准确率,超过 Auto-CoT 的 75.20%。
- 与合成数据的预训练实验显示,稀疏性–难度模式作为学习属性在具备足够容量和收敛后才出现。
- 观察到两阶段学习动态:初始稀疏化,随后对表征进行巩固(致密化),形成有限时域的U型稀疏模式。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。