Abstract: Typical search agents concatenate the entire interaction history into the LLM context, preserving information integrity but producing long, noisy contexts, resulting in high computation and memory costs. In contrast, using only the current turn avoids this overhead but discards essential information. This trade-off limits the scalability of search agents. To address this challenge, we propose MemSearcher, an agent workflow that iteratively maintains a compact memory and combines the current turn with it. At each turn, MemSearcher fuses the user's question with the memory to generate reasoning traces, perform search actions, and update memory to retain only information essential for solving the task. This design stabilizes context length across multi-turn interactions, improving efficiency without sacrificing accuracy. To optimize this workflow, we introduce multi-context GRPO, an end-to-end RL framework that jointly optimize reasoning, search strategies, and memory management of MemSearcher Agents. Specifically, multi-context GRPO samples groups of trajectories under different contexts and propagates trajectory-level advantages across all conversations within them. Trained on the same dataset as Search-R1, MemSearcher achieves significant improvements over strong baselines on seven public benchmarks: +11% on Qwen2.5-3B-Instruct and +12% on Qwen2.5-7B-Instruct relative average gains. Notably, the 3B-based MemSearcher even outperforms 7B-based baselines, demonstrating that striking a balance between information integrity and efficiency yields both higher accuracy and lower computational overhead.
Introduction
The scalability of search-capable LLM agents is currently hindered by the standard ReAct (Reason + Act) paradigm. In this setup, every thought, search query, and retrieved document is appended to the context window. This linear growth leads to two primary issues: computational explosion, as inference costs scale quadratically with context length, and information noise, which can distract the model and degrade reasoning accuracy. MemSearcher is proposed to break this trade-off by maintaining a compact, iteratively updated memory.
The MemSearcher Framework
MemSearcher introduces a "Reason-Act-Update" loop that stabilizes context length across multi-turn interactions.
Workflow
Unlike traditional agents that preserve the entire interaction history, MemSearcher fuses the user's question with a compact memory buffer (limited to 1,024 tokens). At each turn, the model generates a reasoning trace and a search action. Once a search result is obtained, the LLM acts as its own memory manager, reading the new information and generating an updated memory that overwrites the previous state. This process ensures that only essential information is retained, keeping the context length stable even during long-running tasks.
Training with Multi-Context GRPO
Optimizing an agent to manage its own memory requires specialized training. The authors propose Multi-Context GRPO, an end-to-end reinforcement learning framework. While standard GRPO is designed for single-turn outputs, Multi-Context GRPO samples groups of trajectories across different contexts and propagates the final success signal (the advantage) back through every turn in the sequence. This training signal teaches the model to value effective memory management as much as the final answer.
Experimental Evaluation
The framework was evaluated on seven public benchmarks, including Natural Questions (NQ), HotpotQA, and TriviaQA. MemSearcher achieved significant improvements over strong baselines, with relative average gains of +11% on Qwen2.5-3B-Instruct and +12% on Qwen2.5-7B-Instruct. Notably, the 3B-parameter MemSearcher model outperformed 7B-parameter baselines, demonstrating that a cleaner, shorter context can be more valuable for reasoning than a long, noisy one.
Efficiency and Scalability
While ReAct-based agents saw their context grow linearly, often exceeding 14,000 tokens, MemSearcher maintained a stable context of approximately 2,000 to 4,000 tokens across 10+ turns. This stability significantly reduces peak GPU memory usage and latency, making it a more viable solution for production-scale agentic workflows.
Conclusion
MemSearcher demonstrates that striking a balance between information integrity and efficiency yields both higher accuracy and lower computational overhead. By treating memory management as a learnable skill through reinforcement learning, LLMs can become more effective and efficient search agents.
Summary updated