Abstract
Memory is critical for AI agents, yet the widely-adopted static memory, aiming to create readily available memory in advance, is inevitably subject to severe information loss. To address this limitation, we propose a novel framework called general agentic memory (GAM). GAM follows the principle of "just-in time (JIT) compilation" where it focuses on creating optimized contexts for its client at runtime while keeping only simple but useful memory during the offline stage. To this end, GAM employs a duo-design with the following components. 1) Memorizer, which highlights key historical information using a lightweight memory, while maintaining complete historical information within a universal page-store. 2) Researcher, which retrieves and integrates useful information from the page-store for its online request guided by the pre-constructed memory. This design allows GAM to effectively leverage the agentic capabilities and test-time scalability of frontier large language models (LLMs), while also facilitating end-to-end performance optimization through reinforcement learning. In our experimental study, we demonstrate that GAM achieves substantial improvement on various memory-grounded task completion scenarios against existing memory systems.
Introduction: The Pitfalls of Static Memory
Traditional AI agents typically manage long-term memory through an Ahead-of-Time (AOT) approach. This involves compressing raw interaction history into summaries or embeddings stored for future retrieval. However, this method suffers from two fundamental flaws:
- Information Loss: Compression is inherently lossy. Details that seem irrelevant during summarization may become crucial for a specific future query.
- Static Structure: AOT memory lacks the flexibility to adapt to the specific needs of a request that hasn't arrived yet.
While "Long-Context" LLMs attempt to solve this by processing massive histories, they often fall victim to "context rot," where performance degrades as the model struggles to identify relevant information within a sea of noise.
The GAM Framework: Just-in-Time Research
To overcome these limitations, we introduce General Agentic Memory (GAM), which operates on the principle of "Just-in-Time (JIT) Compilation." Instead of relying on pre-compressed summaries, GAM maintains raw history and builds a navigational map to explore it dynamically.
The architecture is composed of two specialized agents:
- The Memorizer (Offline): During interactions, it generates a "memo" (a concise abstract) and a "page" (raw content with contextual headers). These are stored in a universal page-store.
- The Researcher (Online): Upon receiving a request, the Researcher uses the memos to plan a multi-step "deep research" mission. It iteratively plans what information is missing, searches the page-store using a multi-modal toolkit (Vector, BM25, and ID-based retrieval), integrates findings, and reflects on whether the information is sufficient.
The system is optimized end-to-end via Reinforcement Learning (RL), training agents to construct the most cost-effective context for task completion.
Experimental Evaluation
We evaluated GAM across several rigorous benchmarks:
- LoCoMo: Long-term conversational memory across multiple sessions.
- HotpotQA (Memory-Evaluation): Multi-hop reasoning across contexts from 56K to 448K tokens.
- RULER: Needle-in-a-haystack retrieval and multi-hop tracing.
- NarrativeQA: Question answering based on full book scripts (avg. 87K tokens).
Key Results and Insights
GAM consistently outperformed existing memory systems like Mem0 and MemoryOS, as well as standard RAG.
Test-Time Scalability
A key advantage of GAM is its test-time scalability. Performance improves as the agent is allowed more "thinking time" through increased reflection depth. This allows the system to scale its computational effort based on the complexity of the query.
Performance Highlights
- Multi-Hop Tracing: On RULER, GAM achieved over 90% accuracy on complex variable-tracking, where baselines often failed completely.
- Large-Scale Context: In HotpotQA (448K tokens), GAM reached an F1 score of ~60, significantly outperforming "Long-LLM" baselines (~54) and tripling the performance of specialized memory competitors.
Critical Insights
- Search as Memory: Memorization is redefined as enabling effective search rather than just storing answers.
- Model Sensitivity: The Researcher module is highly sensitive to LLM size; while a small model can handle the Memorizer's tasks, a powerful model is required for effective iterative research.
- Mitigating Context Rot: GAM's targeted retrieval avoids the performance degradation seen in brute-force long-context processing.
Limitations and Future Work
While effective, GAM introduces higher latency and cost due to its iterative nature. Future work will focus on exploring larger context scales and refining RL strategies to improve the efficiency of the Researcher's planning and information integration.
Summary updated