arXiv:2512.13898cs.LGcs.CL2025-12被引 17

让大模型在推理时动态优化长上下文,效果远超盲目生成思考步骤。

Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs

  • 通过针对上下文做梯度更新,动态增强关键信息注意力。
  • 在LongBench-v2和ZeroScrolls上分别提升12.6%和14.1%准确率。
  • 适合需要处理超长文本的场景,如文档问答、复杂推理。

尽管训练与架构进步已使大语言模型具备百万级标记的上下文长度,但实证表明这些模型实际有效利用的文本远少于其容量。已有研究显示,推理时计算资源可通过生成思考标记来提升性能,尤其在多步推理任务中。然而,在受控的长上下文任务实验中,我们发现此类策略收益迅速递减且在长上下文场景下失效。原因在于静态自注意力机制固有的得分稀释现象,且现有方法无法在特定条件下检索相关长上下文信号。为此,我们提出一种简单方法:通过在给定上下文上进行目标梯度更新,可证明性地克服静态自注意力的局限。该方法将推理时计算转向上下文适应,显著提升多个模型在长上下文基准上的表现。在Qwen3-4B上,平均在LongBench-v2和ZeroScrolls子集上分别获得12.6和14.1个百分点的准确率提升。结论是:对于长上下文任务,少量上下文特异性推理训练,比当前生成更多思考标记更高效。

原文摘要 · Abstract (English)

Progress on training and architecture strategies has enabled LLMs with millions of tokens in context length. However, empirical evidence suggests that such long-context LLMs can consume far more text than they can reliably use. On the other hand, it has been shown that inference-time compute can be used to scale performance of LLMs, often by generating thinking tokens, on challenging tasks involving multi-step reasoning. Through controlled experiments on sandbox long-context tasks, we find that such inference-time strategies show rapidly diminishing returns and fail at long context. We attribute these failures to score dilution, a phenomenon inherent to static self-attention. Further, we show that current inference-time strategies cannot retrieve relevant long-context signals under certain conditions. We propose a simple method that, through targeted gradient updates on the given context, provably overcomes limitations of static self-attention. We find that this shift in how inference-time compute is spent leads to consistently large performance improvements across models and long-context benchmarks. Our method leads to large 12.6 and 14.1 percentage point improvements for Qwen3-4B on average across subsets of LongBench-v2 and ZeroScrolls benchmarks. The takeaway is practical: for long context, a small amount of context-specific training is a better use of inference compute than current inference-time scaling strategies like producing more thinking tokens.

长上下文推理优化大模型

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