arXiv:2604.06070cs.CLcs.LG2026-04

用短数据蒸馏长位置知识,让小模型也能处理超长文本。

Short Data, Long Context: Distilling Positional Knowledge in Transformers

论文配图:Short Data, Long Context: Distilling Positional Knowledge in Transformers
图 1 · 摘自论文原文
  • 通过基于输出概率的蒸馏,从大模型转移位置感知能力。
  • 在仅用短序列训练时,模型仍能保持长上下文性能。
  • 揭示了查询向量中位置信息的传播机制和参数敏感性。

扩展语言模型的上下文窗口通常需要昂贵的长上下文预训练,对训练效率和数据收集构成重大挑战。本文提出,即使仅在长上下文窗口内使用打包的短上下文样本进行训练,也能通过基于输出概率的知识蒸馏,将长上下文检索能力传递给学生模型。我们以旋转位置编码(RoPE)为视角展开全面分析,得出三个关键发现:第一,与已有研究一致,分阶段的RoPE缩放策略在每个训练阶段最大化旋转频谱利用率,也实现了最佳的长上下文表现;第二,基于输出的概率蒸馏可直接实现位置信息的迁移。通过使用打包重复标记序列的实验设置,我们追踪了查询与键向量中的位置扰动在各层变压器结构中的传播路径,发现位置信息系统性地影响教师模型的输出分布,并作为蒸馏信号被学生模型接收;第三,我们的分析揭示了长上下文扩展过程中查询状态的结构性更新模式,不同参数区间对长上下文训练表现出显著敏感性。

原文摘要 · Abstract (English)

Extending the context window of language models typically requires expensive long-context pre-training, posing significant challenges for both training efficiency and data collection. In this paper, we present evidence that long-context retrieval capabilities can be transferred to student models through logit-based knowledge distillation, even when training exclusively on packed short-context samples within a long-context window. We provide comprehensive insights through the lens of Rotary Position Embedding (RoPE) and establish three key findings. First, consistent with prior work, we show that phase-wise RoPE scaling, which maximizes rotational spectrum utilization at each training stage, also achieves the best long-context performance in knowledge distillation setups. Second, we demonstrate that logit-based knowledge distillation can directly enable positional information transfer. Using an experimental setup with packed repeated token sequences, we trace the propagation of positional perturbations from query and key vectors through successive transformer layers to output logits, revealing that positional information systematically influences the teacher's output distribution and, in turn, the distillation signal received by the student model. Third, our analysis uncovers structured update patterns in the query state during long-context extension, with distinct parameter spans exhibiting strong sensitivity to long-context training.

知识蒸馏位置编码长文本Transformer

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。