Introduction
In the rapidly evolving landscape of Large Language Model (LLM) agents, significant strides have been made in reasoning and tool utilization. However, these agents often suffer from a form of "computational amnesia." Even after successfully navigating a complex multi-step workflow, an agent may fail to retain the logic of its success, reverting to inefficient trial-and-error when faced with the same task again. To address this, the framework Mem$^P$ introduces a learnable, updatable procedural memory that allows agents to store and reuse the "how-to" of task execution.
The Problem: Static Knowledge vs. Dynamic Experience
Humans rely on procedural memory for tasks like riding a bicycle—skills performed with minimal conscious effort after initial learning. In contrast, LLM agents typically rely on static procedural knowledge embedded in their weights or hard-coded prompts. This lack of dynamic memory leads to several issues in long-horizon tasks, such as planning a multi-city trip or navigating a virtual house:
- Inefficiency: Agents repeat mistakes rather than learning from past trajectories.
- Fragility: Minor environmental changes can derail an agent that lacks a robust "how-to" guide.
- Hallucination: Without a grounded memory of valid tool sequences, agents may invent incorrect actions.
The Mem$^P$ Framework
Mem$^P$ is a task-agnostic framework designed to endow agents with lifelong procedural memory through three core operations: Build, Retrieve, and Update.
- Build: The system "proceduralizes" memory by distilling raw logs into two formats: concrete Trajectories (execution traces) and abstract Scripts (high-level logic).
- Retrieve: For new tasks, the agent uses vector similarity (often enhanced by LLM-driven fact extraction) to find relevant past experiences.
- Update: This phase ensures lifelong learning. Strategies include "Vanilla" (simple appending), "Validation" (storing only successes), and "Adjustment" (using reflexion to correct failed memories in-place).
Experimental Evaluation
The researchers evaluated Mem$^P$ on two demanding benchmarks: TravelPlanner, which requires complex tool use under constraints, and ALFWorld, a long-horizon embodied AI environment. The results demonstrate that Mem$^P$ significantly outperforms existing methods like ReAct and Expel in both success rate and execution efficiency.
Key Insights
- Abstraction and Generalization: While raw trajectories are useful for identical tasks, abstract "Scripts" allow the agent to generalize its knowledge to novel scenarios. Combining both yielded the best results.
- Learning from Failure: The "Adjustment" strategy proved most effective, as it allows the agent to patch its memory after a mistake, turning failures into valuable error-correction templates.
- Model-Agnostic Transfer: High-quality memory built by a "teacher" model (e.g., GPT-4o) can be transferred to smaller "student" models (e.g., Qwen2.5-14B), providing a significant performance boost without additional training.
Conclusion
Mem$^P$ represents a significant step toward autonomous agents that learn from experience. By transforming past actions into a structured procedural memory, agents can achieve up to a 50% boost in success rates while cutting execution steps by nearly half. Future work will focus on improving retrieval precision and developing autonomous reward signals to allow agents to build memory in environments without explicit feedback.
Summary updated