arXiv:2512.14391cs.LGcs.AI2025-12中稿 · ICML被引 4

让大模型自己调整输入顺序,提升长文本理解能力

RePo: Language Models with Context Re-Positioning

  • 用可训练模块重新分配令牌位置,打破固定顺序限制
  • 在噪声上下文和长序列任务中显著提效,短任务性能不降
  • 适合处理复杂结构数据或超长输入的场景

上下文学习是现代大语言模型的核心能力,但现有架构采用线性或固定的位置索引,导致注意力层需承担全部结构组织负担,削弱了对关键信息的关注。为此,我们提出RePo机制,通过可微模块 $f_ϕ$ 动态重排输入位置,捕捉上下文依赖关系,而非依赖预设顺序。在OLMo-2 1B与7B模型上持续预训练后,RePo在含噪声上下文、结构化数据及长上下文任务中表现稳定提升,同时保持对一般短上下文任务的竞争力。分析显示,RePo能将更多注意力集中于远距离但相关的信息,在密集且非线性的空间中分配位置,并有效捕获输入的内在结构。

原文摘要 · Abstract (English)

In-context learning is fundamental to modern Large Language Models (LLMs); however, prevailing architectures impose a rigid and fixed contextual structure by assigning linear or constant positional indices. The rigid position information poses the full burden of organizing the input structure to attention layers, thus reducing the amount of attention that could be allocated for more critical information. To address this, we propose RePo, a novel mechanism that alleviates the burden for attention layers via context re-positioning. Unlike conventional approaches, RePo utilizes a differentiable module, $f_ϕ$, to assign token positions that capture contextual dependencies, rather than replying on pre-defined order. By continually pre-training on the OLMo-2 1B \& 7B models, we demonstrate that RePo consistently enhances performance on tasks involving noisy contexts, structured data, and longer context length, while maintaining competitive performance on general short-context tasks. Analysis reveals that RePo successfully allocates more attention mass to distant but relevant information, assigns positions in a dense and non-linear space, and captures the intrinsic structure of the input context. Our code is at https://github.com/SakanaAI/repo.

大模型注意力机制上下文学习位置编码

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