何时记忆何时停止:用于长上下文推理的门控循环记忆
When to Memorize and When to Stop: Gated Recurrent Memory for Long-Context Reasoning
AI总结:
GRU-Mem通过引入两个文本控制的门,实现了更稳定和高效的长上下文推理,显著提升了推理速度和性能。
摘要:
尽管对长上下文进行推理对于各种现实应用至关重要,但对大型语言模型(LLMs)来说仍然具有挑战性,因为随着上下文长度的增加,性能会下降。最近的工作MemAgent尝试通过在RNN-like循环中分块处理上下文来解决这个问题,并更新文本记忆以最终回答。然而,这种简单的循环记忆更新面临两个关键缺点:(i)记忆可能迅速爆炸,因为它可以无差别地更新,即使在没有证据的块上;(ii)循环缺乏退出机制,导致在收集到足够证据后仍需进行不必要的计算。为了解决这些问题,我们提出了GRU-Mem,它结合了两个文本控制的门,以实现更稳定和高效的长上下文推理。具体来说,在GRU-Mem中,记忆仅在更新门打开时更新,且当退出门打开时,循环会立即退出。为了赋予模型这种能力,我们引入了两个奖励信号r^{\text{update}}和r^{\text{exit}},在端到端的强化学习中奖励正确的更新和退出行为。在各种长上下文推理任务上的实验表明了GRU-Mem的有效性和效率,通常比vanilla MemAgent快400%的推理速度。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。