arXiv:2512.12167cs.CLcs.AI2025-12被引 22

不微调即可扩展大模型上下文,只需移除位置编码

Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddings

  • 训练后移除位置编码,实现零样本长文本推理
  • 无需微调,在任意长度序列上表现优于现有方法
  • 适合需要长上下文但无标注数据的场景

目前,要有效扩展语言模型(LM)的上下文长度,必须进行昂贵的微调。本文提出一种简单方法:在预训练完成后移除位置编码(DroPE)。该方法基于三个关键观察:第一,位置编码在预训练中至关重要,能显著促进收敛;第二,过度依赖显式位置信息导致测试时无法泛化到未见长度序列,即使使用常见位置编码缩放方法也无效;第三,位置编码并非语言建模的本质要求,可在预训练后安全移除,并通过短时重校准恢复性能。实验表明,DroPE实现无缝零样本上下文扩展,无需长文本微调,快速适应不同长度输入,且不损害原训练上下文能力。该方法在多种模型和数据集规模下均表现优异,显著超越以往专用架构及主流旋转位置编码缩放方法。

原文摘要 · Abstract (English)

So far, expensive finetuning beyond the pretraining sequence length has been a requirement for effectively extending the context of language models (LM). In this work, we break this key bottleneck by Dropping the Positional Embeddings of LMs after training (DroPE). Our simple method is motivated by three key theoretical and empirical observations. First, positional embeddings (PEs) serve a crucial role during pretraining, providing an important inductive bias that significantly facilitates convergence. Second, over-reliance on this explicit positional information is also precisely what prevents test-time generalization to sequences of unseen length, even when using popular PE-scaling methods. Third, positional embeddings are not an inherent requirement of effective language modeling and can be safely removed after pretraining, following a short recalibration phase. Empirically, DroPE yields seamless zero-shot context extension without any long-context finetuning, quickly adapting pretrained LMs without compromising their capabilities in the original training context. Our findings hold across different models and dataset sizes, far outperforming previous specialized architectures and established rotary positional embedding scaling methods.

大模型位置编码上下文扩展零样本

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