TL;DR
When humans learn a new skill, our mistakes teach us what traps to avoid, while our wins teach us shortcuts. This paper reveals that AI tool-use agents learn the exact same way: memories derived from past failures broaden an agent's exploration and task coverage, while memories from successes sharpen its speed and precision. By maintaining bounded, dual-polarity pools of both lessons, agents can continuously adapt across messy, multi-domain task streams without updating model weights or relying on complex retrieval systems.
What Problem Does This Paper Address?
Teaching Large Language Model (LLM) agents to learn on the job—without expensive retraining—usually involves saving compressed lessons from past tasks as "procedural memory." However, existing methods typically look at whole-task outcomes in clean benchmarks where explicit pass/fail signals are handed to the agent on a silver platter.
Real-world environments are much messier. User requests are vague, ground-truth answers don't exist at test time, and hundreds of noisy tools might be hidden behind a search bar. Furthermore, a failed task might contain brilliant intermediate steps worth repeating, just as a successful task might include clumsy detours worth avoiding. The authors ask: In a realistic, long-horizon stream of diverse tasks, how can an agent extract granular lessons from both local successes and failures without overflowing its context window—and what distinct roles do those two types of memory actually play?
Methods
The authors introduce Dual-Polarity Memory with Periodic Maintenance (DualPM), a simple, retrieval-free workflow that processes incoming tasks in fixed-size blocks using three phases:
- Task Phase: For a block of $b$ tasks, the agent executes actions using a frozen memory context injected directly into its system prompt (no embedding search or retrieval required).
- Reflection Phase: Without seeing any ground-truth answers, an LLM reviews each completed trajectory—looking at local actions and tool responses—and drafts structured procedural principles. Crucially, it extracts both success memories (effective behaviors to repeat) and failure memories (pitfalls to avoid or recover from) from every episode.
- Maintenance Phase: Simply appending lessons forever causes "memory explosion." Instead, DualPM periodically consolidates new drafts into separate success and failure pools under a strict capacity cap (e.g., max 10 items per polarity). An LLM maintainer acts like a ruthless editor—merging, revising, refining, or deleting older items based on new evidence so only the most durable, cross-domain principles survive.
Datasets
- Modified TRAJECT-Bench: Using the
parallel-hardsubset (colloquial, multi-step requests across hundreds of APIs), the authors built a realistic ReAct-style runtime. Instead of handing the agent all tool schemas upfront, tools are hidden behind a BM25tool_searchfunction, forcing the agent to discover, select, and properly parameterize tools through trial and error. Tasks were grouped into four 200-task synthetic user profiles (e.g., Information worker, Entertainment lover) mixing primary and secondary domains. - EvoMemBench (
CrossEp-Tool): An external benchmark evaluating self-evolving, cross-episode agent memory across four distinct domains: file systems, vehicle control, trading bots, and travel booking.
Key Insights and Ideas
- Failure broadens, success sharpens: Failure memories act like coverage-and-recovery checklists—pushing the agent to break down multi-part requests, issue targeted tool searches, and keep digging when a subtask is unresolved. Success memories act like routing guides—organizing parallel tool calls to finish tasks in fewer turns with fewer syntax or parameter errors.
- Practical cost-performance trade-offs: Because the two polarities do different jobs, developers have a clean dial to turn. If latency and token costs are tight, success-only memory gives you fast, high-precision execution; if thoroughness matters most, dual-polarity memory maximizes coverage and accuracy.
- Self-stabilizing vs. adaptive memory: Lineage tracking shows that when learning a single user's workflow from scratch, DualPM's memory structure stabilizes halfway through the task stream, shifting from adding new rules to quietly refining existing ones. Yet if you transplant User 1's memory into User 4's completely different domain stream, DualPM wakes back up—actively revising and replacing rules to fit the new environment.
Key Results
- Complementary Gains (TRAJECT-Bench with GPT-5.5): Compared to a no-memory baseline (66.0% tool usage recall, 50.5% precision, 6.1 turns, 68.1% answer accuracy), Failure-only jumped coverage to 71.9% usage recall, while Success-only boosted efficiency to 56.2% precision and 5.4 turns. Both on (DualPM) integrated both strengths, achieving the highest discovery recall (81.1%), usage recall (72.4%), and final answer accuracy (73.2%) in 5.5 turns.
- Cross-User Transfer: Warm-starting an agent with another user's memory from mostly non-overlapping domains and allowing adaptation hit 78.5% accuracy—matching or slightly beating memory built from scratch (78.0%) and outperforming no memory (72.0%).
- Portability (EvoMemBench with DeepSeek-V3.2): Despite updating only in blocks rather than after every task and using zero task-specific retrieval, DualPM achieved a 69.8% overall success rate (up from 45.0% with no memory), edging out specialized retrieval-based methods like ReasoningBank (68.5%).
Limitations and Future Work
- Benchmark rigidity: TRAJECT-Bench only recognizes one ground-truth tool trajectory per task, potentially penalizing valid alternative solutions. Its task sequences also keep domain distributions steady across blocks rather than simulating sudden real-world shifts.
- Coupled design & fixed hyperparameters: The authors did not isolate whether the polarity effect comes more from the nature of the source event or how the lesson is phrased, nor did they tune capacity limits ($m=10$, $b=20$).
- Future directions: Rather than fixed block sizes and injecting the entire memory pool into every prompt, real-world deployments could run maintenance during off-peak hours, reflect selectively on high-value trajectories, and use "lazy loading"—showing the agent lightweight memory titles upfront so it can fetch full guidance on demand.
Summary updated