AutoMem: Automated Learning of Memory as a Cognitive Skill

AK's Picks LLM Model Editing Latent Reasoning Agent Agent Memory
2026年07月01日
记忆专长是一种后天习得的技能:它包括知道该编码哪些信息、何时进行提取,以及如何组织已有知识——这一能力在认知科学中被称为“元记忆”。我们将这一视角引入大语言模型(LLM)的研究中,将记忆管理本身视为一种可训练的技能。具体而言,我们将文件系统操作提升至与任务操作同等重要的“一级记忆动作”地位,使模型能够自主决定如何管理其记忆。这种记忆技能的提升体现在两个维度上:一是支撑该技能的结构基础(包括提示词设计、文件模式定义、动作词汇表等),二是模型自身执行该技能的熟练程度。然而,这两个维度均难以通过人工方式有效优化:在长程任务中,单次运行往往持续数千步;而一次微小的记忆失误可能长期潜伏、迟迟不显现后果,导致人类无法对完整执行轨迹进行实际可行的逐条审查。为此,我们提出了AutoMem框架,以自动化方式同步优化上述两个维度。在第一重优化循环中,一个能力更强的大语言模型负责全面审视智能体的完整执行轨迹,并迭代式地修订其记忆结构,从而重塑智能体与记忆文件交互的方式;在第二重优化循环中,系统从大量执行片段中自动识别出智能体所做出的优质记忆决策,并将其作为监督信号,直接用于提升模型在记忆管理方面的熟练度。我们在三款程序化生成的长程游戏环境(Crafter、MiniHack 和 NetHack)中开展了实验验证:仅优化记忆管理模块(完全不改动模型在任务动作层面的行为策略),就使基线智能体的性能提升了约2至4倍,甚至令一个320亿参数的开源权重模型在性能上可与前沿闭源系统(如Claude Opus 4.5和Gemini 3.1 Pro Thinking)相媲美。我们的结果表明,记忆管理是一项可独立学习的技能,且是一项高杠杆率的优化目标,能在长程任务中带来显著的性能提升。
Memory expertise is a learned skill: knowing what to encode, when to retrieve, and how to organize knowledge--a capacity known in cognitive science as metamemory. We bring this perspective to LLMs by treating memory management as a trainable skill. We promote file-system operations to first-class memory actions alongside task actions, letting the model itself decide how to manage its memory. This memory skill improves along two axes: the structure that supports it (prompts, file schemas, action vocabulary), and the proficiency of the model exercising it. Both axes resist manual optimization: episodes in long-horizon tasks run for thousands of steps, and a single memory mistake can hide long before it surfaces, making human review of full trajectories impractical. We introduce AutoMem, a framework that automates both axes. In the first loop, a strong LLM reviews complete agent trajectories and iteratively revises the memory structure that shapes how the agent interacts with its memory files. In the second loop, the agent's own good memory decisions are identified from many episodes and used as training signal to sharpen the model's memory proficiency directly. Across three procedurally generated long-horizon games (Crafter, MiniHack, and NetHack), optimizing memory alone--without modifying the model's task-action behavior--improved the base agent's performance ~2x-4x, bringing a 32B open-weight model competitive with frontier systems such as Claude Opus 4.5 and Gemini 3.1 Pro Thinking. Our results show that memory management is an independently learnable skill, and a high-leverage objective yielding large gains on long-horizon tasks.
许愿