While reasoning over long context is crucial for various real-world applications, it remains challenging for large language models (LLMs) as they suffer from performance degradation as the context length grows. Recent work MemAgent has tried to tackle this by processing context chunk-by-chunk in an RNN-like loop and updating a textual memory for final answering. However, this naive recurrent memory update faces two crucial drawbacks: (i) memory can quickly explode because it can update indiscriminately, even on evidence-free chunks; and (ii) the loop lacks an exit mechanism, leading to unnecessary computation after even sufficient evidence is collected. To address these issues, we propose GRU-Mem, which incorporates two text-controlled gates for more stable and efficient long-context reasoning. Specifically, in GRU-Mem, the memory only updates when the update gate is open and the recurrent loop will exit immediately once the exit gate is open. To endow the model with such capabilities, we introduce two reward signals $r^{\text{update}}$ and $r^{\text{exit}}$ within end-to-end RL, rewarding the correct updating and exiting behaviors respectively. Experiments on various long-context reasoning tasks demonstrate the effectiveness and efficiency of GRU-Mem, which generally outperforms the vanilla MemAgent with up to 400\% times inference speed acceleration.


翻译:尽管长上下文推理对于各类现实应用至关重要,但大型语言模型(LLMs)在此方面仍面临挑战,其性能会随着上下文长度的增加而下降。近期工作 MemAgent 尝试通过类 RNN 循环逐块处理上下文并更新文本记忆以进行最终回答来解决此问题。然而,这种简单的循环记忆更新存在两个关键缺陷:(i)记忆可能迅速膨胀,因为即使在没有证据的文本块上,它也可能不加区分地更新;(ii)循环缺乏退出机制,导致即使在收集到充分证据后仍进行不必要的计算。为解决这些问题,我们提出了 GRU-Mem,它引入了两个文本控制门以实现更稳定高效的长上下文推理。具体而言,在 GRU-Mem 中,记忆仅在更新门开启时更新,且循环会在退出门开启时立即终止。为赋予模型此类能力,我们在端到端强化学习中引入了两个奖励信号 $r^{\text{update}}$ 和 $r^{\text{exit}}$,分别对正确的更新和退出行为进行奖励。在多种长上下文推理任务上的实验证明了 GRU-Mem 的有效性和高效性,其通常优于原始 MemAgent,推理速度最高可提升 400%。

0
下载
关闭预览

相关内容

大语言模型机器遗忘综述
专知会员服务
18+阅读 · 2025年11月2日
大型语言模型推理增强外部知识:综述
专知会员服务
37+阅读 · 2025年6月2日
停止过度思考:大型语言模型高效推理研究综述
专知会员服务
37+阅读 · 2025年3月21日
长文本表示学习概述
云栖社区
15+阅读 · 2019年5月9日
干货 | 循环神经网络(RNN)和LSTM初学者指南
THU数据派
15+阅读 · 2019年1月25日
论文浅尝 | 基于Universal Schema与Memory Network的知识+文本问答
NLP-Progress记录NLP最新数据集、论文和代码: 助你紧跟NLP前沿
中国人工智能学会
12+阅读 · 2018年11月15日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
论文浅尝 | 基于神经网络的知识推理
开放知识图谱
15+阅读 · 2018年3月12日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
VIP会员
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员