仅上下文长度就会损害LLM性能,即使检索完美
Context Length Alone Hurts LLM Performance Despite Perfect Retrieval
AI总结:
本研究揭示即使检索完美,输入长度本身也会显著降低LLM性能,并提出通过先背诵证据再解题的简单策略来缓解,在RULER上提升GPT-4o达4%。
摘要:
大型语言模型(LLMs)在长上下文任务上的性能往往无法与其支持的上下文长度成比例地扩展。这一差距通常归因于检索失败——即模型无法在长输入中识别相关信息。因此,近期的研究往往聚焦于评估和提升LLMs的检索性能:如果检索是完美的,原则上模型在长输入上的表现应该与在短输入上一样好——但果真如此吗?本文呈现的发现表明,这个问题的答案可能是否定的。我们在5个开源和闭源LLM上,针对数学、问答和编码任务进行的系统性实验揭示,即使模型能够完美检索所有相关信息,其性能仍会随着输入长度的增加而大幅下降(13.9%至85%),尽管输入长度仍远在模型声称支持的范围内。这种失败甚至在无关token被替换为干扰性极小的空白字符时也会发生,更令人惊讶的是,当所有无关token都被掩码且模型被迫仅关注相关token时,性能下降依然存在。当所有相关证据被直接放置在问题之前时,也观察到类似的性能下降。我们的发现揭示了一个此前未被认识到的局限性:仅输入本身的长度就可能损害LLM性能,这与检索质量无关,也无需任何干扰。这一发现促使我们提出一种简单且与模型无关的缓解策略,即通过提示模型在尝试解决问题之前先背诵检索到的证据,将长上下文任务转化为短上下文任务。在RULER基准上,我们观察到GPT-4o在已很强的基线上持续提升了高达4%的性能。
英文摘要:
Large language models (LLMs) often fail to scale their performance on long-context tasks performance in line with the context lengths they support. This gap is commonly attributed to retrieval failures -- the models' inability to identify relevant information in the long inputs. Accordingly, recent efforts often focus on evaluating and improving LLMs' retrieval performance: if retrieval is perfect, a model should, in principle, perform just as well on a long input as it does on a short one -- or should it? This paper presents findings that the answer to this question may be negative. Our systematic experiments across 5 open- and closed-source LLMs on math, question answering, and coding tasks reveal that, even when models can perfectly retrieve all relevant information, their performance still degrades substantially (13.9%--85%) as input length increases but remains well within the models' claimed lengths. This failure occurs even when the irrelevant tokens are replaced with minimally distracting whitespace, and, more surprisingly, when they are all masked and the models are forced to attend only to the relevant tokens. A similar performance drop is observed when all relevant evidence is placed immediately before the question. Our findings reveal a previously-unrealized limitation: the sheer length of the input alone can hurt LLM performance, independent of retrieval quality and without any distraction. They motivate our simple, model-agnostic mitigation strategy that transforms a long-context task into a short-context one by prompting the model to recite the retrieved evidence before attempting to solve the problem. On RULER, we observe a consistent improvement of GPT-4o up to 4% on an already strong baseline.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。