arXiv:2604.14339cs.CL2026-04

通过扰动位置编码提升大模型长文本理解的稳定性

Shuffle the Context: RoPE-Perturbed Self-Distillation for Long-Context Adaptation

  • 用旋转位置编码扰动构造上下文不同视角,强制模型跨视角保持一致输出
  • Llama-3-8B在RULER-64K上提升12.04%,Qwen-3-4B在RULER-256K上提升2.71%
  • 适合需要稳定长文本推理的场景,如多文档问答与检索增强生成

大语言模型在需要可靠长上下文理解的任务中表现日益重要,如检索增强生成和多文档推理。现有方法通常在目标序列长度下微调预训练短上下文模型,但发现标准长上下文适应仍易受干扰:模型准确率对关键证据的绝对位置敏感,即使控制任务格式和难度,仍存在显著位置方差。本文提出RoPE-Perturbed Self-Distillation训练正则化方法,通过扰动旋转位置编码(RoPE)索引,为同一训练序列生成多个“视角”,并利用自蒸馏使模型在不同视角下输出一致,从而减少对位置依赖的脆弱性,强化语义信号依赖。在Llama-3-8B和Qwen-3-4B上的实验表明,该方法在长上下文基准测试中均取得稳定提升,包括在RULER-64K上对Llama-3-8B提升12.04%,在RULER-256K上对Qwen-3-4B提升2.71%(经SFT后),同时增强了超出训练上下文窗口的长度外推能力。

原文摘要 · Abstract (English)

Large language models (LLMs) increasingly operate in settings that require reliable long-context understanding, such as retrieval-augmented generation and multi-document reasoning. A common strategy is to fine-tune pretrained short-context models at the target sequence length. However, we find that standard long-context adaptation can remain brittle: model accuracy depends strongly on the absolute placement of relevant evidence, exhibiting high positional variance even when controlling for task format and difficulty. We propose RoPE-Perturbed Self-Distillation, a training regularizer that improves positional robustness. The core idea is to form alternative "views" of the same training sequence by perturbing its RoPE indices -- effectively moving parts of the context to different positions -- and to train the model to produce consistent predictions across views via self-distillation. This encourages reliance on semantic signals instead of brittle position dependencies. Experiments on long-context adaptation of Llama-3-8B and Qwen-3-4B demonstrate consistent gains on long-context benchmarks, including up to 12.04% improvement on RULER-64K for Llama-3-8B and 2.71% on RULER-256K for Qwen-3-4B after SFT, alongside improved length extrapolation beyond the training context window.

长上下文位置编码自蒸馏鲁棒性

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