长度廉价,竞争不易:注意力预测检索中的上下文腐化

·

研究论文 · 2026/11/05

本文挑战了“长输入导致语言模型失败”的常见观点,指出在检索任务中,长度本身代价很低,而竞争才是关键。在五个开放模型(0.5B到3B参数,四个家族)上,中性填充物不影响准确率(在Qwen2.5-1.5B上,32K token内准确率保持0.97-1.00),但以证据格式放置的陈述会使准确率降至0.16-0.33。一个给查询键提供竞争值的陈述会使损失增加9到110倍,且每增加一个竞争陈述损失进一步增加。模型内部,留在证据上的注意力质量能解释高达58%的损失方差,而长度对数最多解释8%。掩码填充协议在MMLU上重现了长度损害(30K token时损失11-18分),但在检索任务中可见对照失败:32K token时掩码导致45个准确率点的损失,而相同填充物可见时无损失。检索中的上下文腐烂是注意力的竞争。作者发布了探针和所有126K试验级测量数据。

本文通过大量实验(126K试验)揭示了长上下文检索失败的关键机制是注意力竞争而非长度,挑战了现有认知,并提供了可复现的探针和数据集,对理解与改进长上下文模型具有重要价值。

Why do language models fail on long inputs? The common answer is length. We show that, for retrieval, length is cheap and competition is not. On five open models (0.5B to 3B parameters, four families), neutral filler costs nothing: accuracy stays at 0.97 to 1.00, up to 32K tokens on Qwen2.5-1.5B. Statements in the format of the evidence, placed at the same positions, drop it to 0.16 to 0.33. A single statement that gives the queried key a rival value multiplies the loss by 9 to 110, and every additional rival adds to it. Inside the model, one quantity tracks the failure: the attention mass left on the evidence. Across 126,473 trials it explains up to 58% of the variance in loss; log length explains at most 8%. The masked-filler protocol behind the claim that length alone hurts reproduces on MMLU (11 to 18 points lost at 30K tokens), but fails a visible control in retrieval: masking costs 45 accuracy points at 32K tokens, while the same filler left visible costs none. In retrieval, context rot is a competition for attention. We release the probe and all 126K trial-level measurements.

阅读原文

参与讨论