Large Language Models (LLMs) face significant challenges in long-context processing, including quadratic computational costs, information forgetting, and the context fragmentation inherent in retrieval-augmented generation (RAG). We propose a cognitively inspired framework for efficient long-context inference based on chunk-wise compression and selective memory recall, rather than processing all raw tokens. The framework segments long inputs into chunks and encodes each chunk into compressed memory representations using a learned compressor. A gating module dynamically selects relevant memory blocks, which are then iteratively processed by a reasoning module with an evolving working memory to solve downstream tasks. The compressor and reasoner are jointly optimized via end-to-end reinforcement learning, while the gating module is trained separately as a classifier. Experimental results show that the proposed method achieves competitive accuracy on multi-hop reasoning benchmarks such as RULER-HQA, extrapolates context length from 7K to 1.75M tokens, and offers a favorable accuracy-efficiency trade-off compared to strong long-context baselines. In particular, it achieves up to a 2 times reduction in peak GPU memory usage and a 6 times inference speedup over MemAgent.


翻译:大型语言模型(LLMs)在长上下文处理中面临显著挑战,包括二次计算成本、信息遗忘以及检索增强生成(RAG)固有的上下文碎片化问题。我们提出一种受认知启发的框架,用于实现高效的长上下文推理,其核心在于基于分块压缩与选择性记忆检索,而非处理所有原始标记。该框架将长输入分割为多个块,并使用一个学习到的压缩器将每个块编码为压缩的记忆表示。一个门控模块动态选择相关的记忆块,随后由推理模块结合不断演化的短期记忆进行迭代处理,以解决下游任务。压缩器与推理器通过端到端强化学习进行联合优化,而门控模块则作为分类器单独训练。实验结果表明,所提方法在RULER-HQA等多跳推理基准上取得了具有竞争力的准确率,能够将上下文长度从7K标记外推至1.75M标记,并且与强大的长上下文基线模型相比,提供了更优的准确率-效率权衡。特别地,与MemAgent相比,该方法实现了高达2倍的峰值GPU内存使用降低和6倍的推理加速。

0
下载
关闭预览

相关内容

面向大型推理模型的强化学习综述
专知会员服务
29+阅读 · 2025年9月11日
130页pdf《长上下文语言建模综合研究》综述
专知会员服务
39+阅读 · 2025年3月25日
【MIT博士论文】数据高效强化学习,176页pdf
长文本表示学习概述
云栖社区
15+阅读 · 2019年5月9日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
国家自然科学基金
42+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
42+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员