Shengguang Wu, Hao Zhu, Yuhui Zhang, Xiaohan Wang, Serena Yeung-Levy
4 min
How can LLM agents effectively manage information over long-horizon tasks that exceed their fixed context windows? The authors propose that memory management should not be treated as a static architectural module, but as an active, learnable cognitive skill—metamemory—that can be optimized through automated feedback.
The AutoMem framework treats file-system operations (read, write, search, append) as first-class actions within the agent's action space. It optimizes this skill along two axes using two automated loops:
By optimizing memory without modifying the underlying task-action weights, AutoMem achieved 2x–4x performance gains on three long-horizon games (Crafter, MiniHack, and NetHack). A 32B parameter model using AutoMem outperformed larger 72B models and reached performance levels competitive with frontier proprietary systems like Claude Opus 4.5 and Gemini 3.1 Pro Thinking. The results suggest that memory management is a high-leverage objective that can significantly close the performance gap between open-weight and frontier models on complex, long-duration tasks.
This work shifts the paradigm of agent memory from 'fixed architecture' to 'trainable skill.' By automating the review of long-horizon trajectories, the authors provide a scalable way to improve agent reasoning and state management without requiring impractical amounts of human supervision. It demonstrates that even mid-sized models can achieve frontier-level performance if they are taught how to effectively manage their own external knowledge.
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.