Abstract
Large language model (LLM) agents are constrained by limited context windows, necessitating external memory systems for long-term information understanding. Current memory-augmented agents typically depend on pre-defined instructions and tools for memory updates. However, language models may lack the ability to determine which information to store, how to structure it, and when to update it, especially as memory systems become more complex. This results in suboptimal memory construction and information loss. To this end, we propose Mem-alpha, a reinforcement learning framework that trains agents to effectively manage complex memory systems through interaction and feedback. We also construct a specialized training dataset spanning diverse multi-turn interaction patterns paired with comprehensive evaluation questions designed to teach effective memory management. During training, agents process sequential information chunks, learn to extract and store relevant content, then update the memory system. The reward signal derives from downstream question-answering accuracy over the full interaction history, directly optimizing for memory construction. To illustrate the effectiveness of our training framework, we design a memory architecture comprising core, episodic, and semantic components, equipped with multiple tools for memory operations. Empirical evaluation demonstrates that Mem-alpha achieves significant improvements over existing memory-augmented agent baselines. Despite being trained exclusively on instances with a maximum length of 30k tokens, our agents exhibit remarkable generalization to sequences exceeding 400k tokens, over 13x the training length, highlighting the robustness of Mem-alpha.
Introduction
Large Language Models (LLMs) are notoriously limited by their context window, which restricts their ability to process vast amounts of information simultaneously. While external memory systems like Retrieval-Augmented Generation (RAG) or MemGPT have been developed to mitigate this, they often rely on rigid, human-defined rules for memory management. These systems frequently struggle with determining what information is critical, how to structure it for future use, or when to prune obsolete data, leading to noisy memories or significant information loss.
Mem-α addresses these challenges by treating memory construction as a sequential decision-making problem. By employing Reinforcement Learning (RL), Mem-α enables agents to autonomously learn optimal memory management strategies, allowing even smaller models to outperform much larger, state-of-the-art baselines.
The Mem-α Framework
The core of Mem-α is a tri-component memory architecture designed to handle different types of information:
- Core Memory: A persistent, high-level summary (max 512 tokens).
- Episodic Memory: A chronological log of timestamped events.
- Semantic Memory: A structured collection of atomic factual statements.
To optimize this system, the framework utilizes Group Relative Policy Optimization (GRPO). The agent learns to use tools such as memory_insert, memory_update, and memory_delete based on a composite reward function ($r$) that balances four critical factors:
- Correctness ($r_1$): Accuracy in downstream question-answering tasks.
- Tool Call Format ($r_2$): Adherence to API specifications.
- Compression ($r_3$): Conciseness of the stored memory relative to the input.
- Memory Content ($r_4$): Semantic validity and quality of the stored content, as judged by a larger critic model.
Experimental Setup and Datasets
The researchers developed a specialized training dataset of 4,139 instances covering accurate retrieval (SQuAD, HotpotQA), test-time learning (NLU, PubMed-RCT), and long-range understanding (BookSum). Evaluation was conducted using MemoryAgentBench, which assesses retrieval accuracy, the ability to learn new behaviors during deployment, and the analysis of long sequences.
Results and Discussion
Mem-α demonstrates significant performance gains over traditional long-context models and RAG baselines. A 4B parameter model (Qwen3-4B) trained with Mem-α achieved an average score of 0.642, outperforming standard long-context models (0.588) and even GPT-4o-mini in memory-intensive tasks.
Key Insights
- Emergent Strategies: Through RL, models discover sophisticated strategies, such as consolidating multiple related events into single, efficient memory entries.
- Remarkable Generalization: Despite being trained on sequences up to 30k tokens, Mem-α agents successfully managed memories for sequences exceeding 400k tokens—a 13x increase. This suggests the model learns fundamental principles of information management rather than simple pattern matching.
- Efficiency: The framework reduced the memory footprint by approximately 50% compared to long-context baselines while maintaining superior accuracy.
Conclusion
Mem-α represents a significant step toward autonomous long-term memory management for LLM agents. While current work focuses on retrieval and understanding, future research will explore complex conflict resolution for contradictory information and the integration of more advanced structures like Knowledge Graphs. Moving toward real-world production environments will also require addressing latency and concurrent update challenges.
Summary updated