Memory as Action: Autonomous Context Curation for Long-Horizon Agentic Tasks

Yuxiang Zhang, Jiangming Shu, Ye Ma, Xueyuan Lin, Shangxi Wu, Jitao Sang

TL;DR

The paper introduces Memory-as-Action (MemAct), a framework that transforms working memory management in long-context LLMs from an external heuristic into an intrinsic, learnable policy action. By training agents to autonomously prune and summarize their own context via reinforcement learning, MemAct-RL-14B achieves accuracy competitive with models 16× larger while slashing average context length by over 50%.

What Problem Does This Paper Address?

While modern Large Language Models (LLMs) boast massive context windows, simply expanding capacity doesn't solve the problem of "attention dilution." During long-horizon tasks (like deep research or software engineering), context windows quickly saturate with irrelevant information, leading to the notorious "lost-in-the-middle" phenomenon where crucial signals are buried under noise.

Existing solutions typically rely on external controllers or fixed heuristic rules (e.g., sliding windows or periodic summarization). However, these approaches are decoupled from the agent's internal reasoning state. They risk deleting critical semantic dependencies because they don't actually "understand" what the agent is trying to accomplish. The authors tackle this by framing Context Curation as a core, learnable capability of the agent itself.

Methods

The authors propose Memory-as-Action (MemAct), which unifies task execution actions (like searching the web) and memory management actions within a single policy space.

Comparison of context management paradigms

Key components include:

  • The Prune&Write Operator: Instead of passively accumulating history, the agent can call a specific tool that specifies which historical turns to delete (using unique turn IDs) and writes a synthesized memory note (summary, reflection, or plan) to be appended in-place.
  • Dynamic Context Policy Optimization (DCPO): Standard causal LLMs assume monotonic context growth. When an agent deletes past tokens, it breaks this assumption because those deleted tokens have already influenced the representations of subsequent tokens. To train the model stably using Reinforcement Learning (specifically GRPO) without computationally prohibitive cache recomputations, DCPO logically segments fractured trajectories into independent, causally consistent blocks.
Figure 2: Workflow of MemAct: Autonomous Context Management. At timestep t, the policy generates a Prune&Write action that specifies (1) which historical turns to remove (indices 1 and 3), and (2) a synthesized memory note containing summaries or key facts. The action itself is retained in-place as persistent memory, transforming the original context into a compact state st+1 for subsequent reasoning.

Datasets

The framework was evaluated on both single-objective and multi-objective long-horizon reasoning benchmarks:

  • Single-Objective: 2WikiMultihopQA, Bamboogle, HotpotQA, Musique, Frames, and BrowseComp-Plus.
  • Multi-Objective: A synthesized multi-objective QA dataset based on HotpotQA requiring the agent to answer up to 8 independent sub-questions.
  • Training Data: Initialized via Supervised Fine-Tuning (SFT) on 930 trajectories synthesized by DeepSeek-V3.1 using a staged prompting method. RL training scaled to 10,240 trajectories from Asearcher and HotpotQA, deliberately restricted to a maximum of 3 objectives to test the agent's ability to generalize to higher complexities.

Key Insights and Ideas

  • Model-Specific Strategies Emerge Autonomously: RL training allowed different model sizes to discover distinct, capacity-aware curation strategies. Smaller models (7B) prune context frequently and aggressively to cope with limited processing capacity. Larger models (14B) adopt a bimodal strategy: fine-grained pruning (removing ~2 records) during active reasoning, and coarse-grained clearing (~6 records) once a sub-objective is completed.
  • Out-of-Distribution Complexity Generalization: Even though the models were only trained on tasks with up to 3 objectives, they successfully generalized their memory curation strategies to handle complex 8-objective tasks at inference time.
Figure 5: Pruning granularity distribution. Each violin shows the distribution of records pruned per Prune&Write action (|Itarget|) on multi-objective tasks. RL-trained policies exhibit lower variance than SFT, in- dicating convergence toward consistent strategies. The 14B-RL model shows a bimodal pattern with peaks at fine-grained (∼2) and coarse-grained (∼6) pruning.

Key Results

  • Superior Pareto Efficiency: MemAct-RL-14B achieved a multi-objective accuracy of 59.1%, outperforming the massive Qwen3-235B (53.1%) and the specialized Tongyi-DeepResearch (56.0%).
  • Massive Resource Savings: It maintained this performance edge while utilizing an average context size of just 3,500 tokens per step—nearly 50% shorter than Qwen3-235B and 60% shorter than its non-memory RL baseline (Search-R1-14B).
  • Latency Reduction: By keeping the context compact, MemAct-RL-7B reduced total inference duration by 40% compared to Search-R1-7B, primarily driven by lower pre-fill overhead and higher KV-cache hit rates.
Figure 3: Accuracy–Efficiency Trade-off. MemAct variants (stars) occupy the Pareto frontier, achieving competitive accuracy with significantly reduced context size. Dashed lines show no-tool baselines at different model scales for reference.

Limitations and Future Work

The authors note several open challenges:

  • Credit Assignment: MemAct relies on sparse, terminal rewards based on the final task outcome, making it difficult to precisely attribute success or failure to specific intermediate memory actions.
  • Lossy Compression: Because pruning is irreversible, the agent risks accidentally deleting information that might unexpectedly become relevant later in a long-horizon task.
  • Future Directions: The authors suggest expanding the action space to include selective retrieval from external data stores or tiered caching, combining learned context curation with high-precision infrastructure.

Summary updated

BibTeX
@inproceedings{zhang2026memory,
  author = {Yuxiang Zhang and Jiangming Shu and Ye Ma and Xueyuan Lin and Shangxi Wu and Jitao Sang},
  title = {{Memory as Action: Autonomous Context Curation for Long-Horizon Agentic Tasks}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.956},
}
Figure