Experience Memory Graph: One-Shot Error Correction for Agents
Summary
This paper introduces Experience Memory Graph (EMG), a framework that reformulates agent failure recovery as a graph matching problem to enable one-shot error correction for LLM agents without test-time trial-and-error.
View Cached Full Text
Cached at: 07/16/26, 04:24 AM
# Experience Memory Graph: One-Shot Error Correction for Agents Source: [https://arxiv.org/html/2607.13884](https://arxiv.org/html/2607.13884) Wenjun Wang,Yuchen FangUniversity of Electronic Science and Technology of ChinaChengduChina[fangyuchen@std\.uestc\.edu\.cn](https://arxiv.org/html/2607.13884v1/mailto:[email protected]),Fengrui LiuUniversity of Electronic Science and Technology of ChinaChengduChina[202522080925@std\.uestc\.edu\.cn](https://arxiv.org/html/2607.13884v1/mailto:[email protected]),Zibo LiangUniversity of Electronic Science and Technology of ChinaChengduChina[zbliang@std\.uestc\.edu\.cn](https://arxiv.org/html/2607.13884v1/mailto:[email protected])andKai ZhengUniversity of Electronic Science and Technology of ChinaChengduChina[zhengkai@uestc\.edu\.cn](https://arxiv.org/html/2607.13884v1/mailto:[email protected]) \(2027\) ###### Abstract\. Large Language Model \(LLM\) agents have shown remarkable capabilities in autonomous decision\-making by generating sequential trajectories of states, actions, and observations\. However, in complex, long\-horizon tasks, these agents frequently suffer from compounding errors and struggle to recover from failures\. Existing self\-correction mechanisms rely on prompt\-based reflection, which is inherently brittle, incurs heavy time and API costs due to iterative trial\-and\-error loops, and produces task\-specific memory that may be hard to generalize to new scenarios\. To address this, we propose Experience Memory Graph \(EMG\), a framework that reformulates agent failure recovery as a graph matching problem\. At training time, we convert both failed exploration trajectories and successful expert trajectories into directed action decision graphs\. By matching these graphs, we extract common subgraphs \(successful workflows\) and graph edit paths that explicitly indicate how to correct failures \(e\.g\., which actions to add, delete, or relabel under a given observation\), and store them in a memory graph with intra\-task nodes and cross\-task edges\. At test time, EMG retrieves relevant insights and guides the agent in a single, loop\-free execution\. Experiments on ALFWorld and ScienceWorld show that EMG consistently outperforms state\-of\-the\-art reflection baselines in success rate and average reward, while requiring no test\-time trial\-and\-error\. Large Language Models, Agent, Agent memory ††journalyear:2027††conference:33rd SIGKDD Conference on Knowledge Discovery and Data Mining; August 1–5, 2027; San Jose, United States\.††booktitle:33rd SIGKDD Conference on Knowledge Discovery and Data Mining, August 1–5, 2027, 2027, San Jose, United States\.††doi:10\.1145/……††isbn:……††ccs:Computing methodologies Artificial intelligence## 1\.Introduction Large Language Models \(LLMs\) have evolved from passive text assistants into autonomous agents with planning, memory, and tool\-use capabilities, enabling closed\-loop interaction with environments\(Xuet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib35); Fanget al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib36)\)\. This architecture has demonstrated strong zero‑shot and few‑shot performance across complex domains such as web navigation, multi‑step mathematical reasoning, and automated software engineering\(Liet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib1); Weiet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib2); Reddyet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib3)\)\. As agents act iteratively, they generate long‑horizon trajectories—sequential structures of states, actions, and observations\. Rather than being mere logs, these trajectories contain rich, reusable experience\. By systematically extracting successful workflows and failure patterns from past trajectories, agents can build experience memory that helps avoid repeated mistakes and improve task success rates on subsequent attempts\(Huet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib4); Miet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib38)\)\. To construct experience memory from interaction trajectories, early approaches relied exclusively on extracting workflows from successful executions\(Wanget al\.,[2025b](https://arxiv.org/html/2607.13884#bib.bib5); Zhenget al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib18)\)\. Subsequent methods have increasingly leveraged failed trajectories to enhance learning\. While some studies focus on isolating decisive erroneous actions or performing failure credit assignment\(Zhanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib6); Zhenget al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib7); Zhuet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib8)\), others extend this paradigm by actively rectifying failed trajectories to achieve task success\(Ouyanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib9); Huanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib10); Kimet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib11); Fanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib12); Geet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib13); Xiaet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib14); Gaoet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib15); Kruengkrai and Yoshino,[2025](https://arxiv.org/html/2607.13884#bib.bib16); Zhanget al\.,[2026a](https://arxiv.org/html/2607.13884#bib.bib20); Yaoet al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib22); Yanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib24); Shaoet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib37); Yaoet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib39)\)\. Typically, these approaches prompt LLMs to reflect on the root causes of failure—specifically, identifying the erroneous action and hypothesizing a corrective counterpart\. The model then replays the task grounded in this refined memory, thereby constituting an iterative reflect\-and\-replay mechanism, as illustrated in Fig\. 1\(a\)\. While previous methods successfully construct memory by rectifying failed trajectories and achieve impressive performance, they suffer from three primary limitations\. Figure 1\.Difference of error correction based on \(a\) reflect\-replay loop and \(b\) Experience Memory Graph\. Existing methods rely on iterative test‑time reflection — the agent replans and re‑executes after each failure, causing high latency and cost\. Our Experience Memory Graph extracts error correction paths offline by computing graph edit paths that transform failed trajectories into successful ones from paired training trajectories of the same task, distills them into insights, and stores them in a memory graph\. At test time, retrieval enables one‑shot exectution without loops\.Limitation 1: Dependence on LLM Capabilities\. This prompt\-based reflection paradigm can be sensitive to prompt design, and its effectiveness is often constrained by the model’s inherent capabilities\.For instance, smaller LLMs usually struggle to break out of repetitive error cycles, which can hinder their ability to perform effective self\-reflection and correction\. Moreover, in long\-horizon trajectories, accurately identifying the root cause of a failure — which may be deeply buried in a long sequence of states and actions — can be challenging for such models\. Limitation 2: Inference Cost\. After each failure, the model needs to reflect, adjust, and re\-execute the trajectory\. This iterative looping process multiplies both latency and API costs\. In commercial or real\-time scenarios, such back\-and\-forth loops may become less efficient, potentially limiting their practicality for time\-sensitive applications\. Limitation 3: Limited Cross\-Task Generalization\. Most existing approaches perform reflection and re\-execution directly on the test set for individual failed tasks, rather than extracting reusable memory from training failures\. Consequently, the synthesized memory is task\-specific, resulting in limited transferability to unseen scenarios\. To address these issues, we proposeExperience Memory Graph \(EMG\), a novel framework that shifts the paradigm from online LLM reflection to offline, deterministic graph computation\. EMG structures memory as a comprehensive network where nodes store localized task knowledge \(successful workflows or corrective paths for individual tasks\) and edges capture generalized action patterns across similar tasks\. To construct each node in the experience memory graph, we convert both the failed exploration trajectory and the successful expert trajectory of the same training task into action decision graphs\. By performing graph matching between them, we extract thecommon subgraph\(representing correctly executed workflows\) and compute theshortest graph edit path\. Thispathserves as a deterministic, one\-shot error correction plan—dictating exactly which actions to retain, delete, or replace under specific observations\. By relying on algorithmic exactness rather than prompt\-based guessing, this mechanism robustly localizes root errors and fully resolves theover\-reliance on LLM capabilities \(Limitation 1\)\. To construct each edge in the experience memory graph, we further connect semantically similar task queries \(via top\-kknearest neighbors\) and perform graph matching between their respective expert trajectories\. This process extractscross\-task insightsstored on the edges, capturing reusable, high\-level action patterns that transfer across different scenarios\. Crucially, the entire memory construction is performed offline on the training set\. Once built, this memory graph can be applied to any test set, directly addressing thelimited generalizability of task\-specific memory \(Limitation 3\)\. During test\-time inference, the agent simply retrieves the pre\-computed correction paths and cross\-task insights without any iterative trial\-and\-error, thereby circumventing theprohibitive inference overhead and API costs \(Limitation 2\)\. This makes EMG a highly efficient and accurate solution for real\-time applications\. In summary, our contributions are three\-fold: - •We proposeExperience Memory Graph \(EMG\), a novel framework that structures experience for LLM agents as a relational graph\. By organizing memory into nodes for localized task knowledge and edges for generalized action patterns, EMG enables robust cross\-task generalization that surpasses traditional task\-specific memory banks\. - •We introduce a deterministic memory acquisition mechanism based on graph matching to populate EMG\. By extracting thecommon subgraphto preserve successful workflows and computing theshortest graph edit pathfor one\-shot error correction, our approach replaces brittle, iterative LLM reflection loops with algorithmic exactness, significantly reducing API costs and latency\. - •Extensive experiments on challenging benchmarks demonstrate that EMG significantly outperforms state\-of\-the\-art self\-reflection baselines\. Notably, EMG exhibits superior performance and computational efficiency in long\-horizon tasks requiring complex reasoning\. ## 2\.Related Work ### 2\.1\.Experience Memory Experience memory aims at extracting the reusable workflow and insight from history trajectories\. Early studies on experience memory construction mainly extract reusable workflows from successful trajectories\(Wanget al\.,[2025b](https://arxiv.org/html/2607.13884#bib.bib5); Zhenget al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib18)\), assuming that successful executions directly encode high\-quality procedural knowledge\. However, such approaches ignore informative signals from failed trajectories\. To leverage failures, some works focus on failure diagnosis\. AgenTracer\(Zhanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib6)\)leverages counterfactual replay and fault injection to perturb trajectories and trace back the root cause of failures, enabling fine\-grained attribution to specific actions or modules\. Trajectory graph copilot\(Zhenget al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib7)\)models trajectories as a graph structure and applies graph neural networks to capture temporal dependencies and detect error\-prone action patterns, allowing pre\-action diagnosis\. AgentDebug\(Zhuet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib8)\)further conducts a large\-scale empirical study of LLM agent failures, categorizing error types and revealing common failure modes\. Another line of work focuses on correcting failed trajectories via reflection\(Wanget al\.,[2025a](https://arxiv.org/html/2607.13884#bib.bib19); Lianget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib21)\)\. R2D2\(Huanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib10)\)performs step\-level reflection to locate the first erroneous action, truncates the trajectory from that point, and stores corrected sub\-trajectories along with reflections for future reuse\. ReasoningBank\(Ouyanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib9)\)goes beyond trajectory replay by abstracting experiences into reusable high\-level reasoning strategies, improving generalization across tasks\. Building on this paradigm, principles\(Kimet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib11)\)learns synthetic strategy memory for proactive decision\-making, Memp\(Fanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib12)\)introduces procedural memory that captures action\-level execution knowledge, and some works\(Geet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib13); Xiaet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib14),[2025](https://arxiv.org/html/2607.13884#bib.bib23)\)organize experiences into structured or graph\-based skill representations to enhance compositionality\. Moreover, CDMem\(Gaoet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib15)\)additionally improves context\-aware memory retrieval, and\(Kruengkrai and Yoshino,[2025](https://arxiv.org/html/2607.13884#bib.bib16)\)explicitly trains agents to learn sequential decision policies from failed attempts\. These methods typically follow a reflect–replay paradigm, where the agent first analyzes failure causes \(e\.g\., identifying erroneous actions and suggesting corrections\), then re\-executes the task using refined memory\. Despite their effectiveness, they often rely heavily on the quality of reflection and may suffer from inefficient iterative correction or error propagation\. ### 2\.2\.Graph for Agent Memory Recent studies have explored graph memory mechanisms to enhance long\-term reasoning and experience reuse in LLM agents\(Liuet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib43)\)\. AriGraph\(Anokhinet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib40)\)constructs a unified graph that integrates semantic and episodic memories for planning and reasoning in interactive environments\. A\-Mem\(Xuet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib35)\)further enables autonomous memory evolution by dynamically linking and restructuring memories into an interconnected knowledge network\. G\-Memory\(Zhanget al\.,[2026b](https://arxiv.org/html/2607.13884#bib.bib42)\)extends graph\-based memory to multi\-agent settings through hierarchical interaction and insight graphs, facilitating cross\-trial knowledge transfer\. Recent efforts such as SGMem\(Wuet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib44)\), GAM\(Wuet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib45)\), and H\-Mem\(Yuet al\.,[2026](https://arxiv.org/html/2607.13884#bib.bib46)\)further investigate sentence graphs, hierarchical graph memories, and hybrid graph\-based memory evolution mechanisms to enhance long\-horizon retrieval and adaptive reasoning capabilities\. Despite encouraging progress, existing methods mainly focus on memory storage and retrieval, while the extraction of reusable high\-level insights and the modeling of transferable experience relationships remain underexplored\. Our EMG fills this gap by using graph matching to derive common subgraphs and edit paths, transforming raw trajectories into transferable correction workflows\. ## 3\.Preliminary We consider LLM\-based agents that interact with environments to solve long\-horizon tasks\. Following prior work, we formulate such agentic tasks as a partially observable Markov decision process \(POMDP\) without explicitly modeling the latent state\. The process is defined by the tuple\(𝒬,𝒜,𝒪,T,R\)\(\\mathcal\{Q\},\\mathcal\{A\},\\mathcal\{O\},T,R\), where𝒬\\mathcal\{Q\}is the query \(instruction\) space,𝒜\\mathcal\{A\}the action space,𝒪\\mathcal\{O\}the observation space,T:𝒜×𝒪→𝒜T:\\mathcal\{A\}\\times\\mathcal\{O\}\\rightarrow\\mathcal\{A\}a transition function that determines the next action given the current action and observation, andR:𝒜×𝒪→\[0,1\]R:\\mathcal\{A\}\\times\\mathcal\{O\}\\rightarrow\[0,1\]the reward function\. Since our focus is on the task planning capability of LLM agents,𝒬\\mathcal\{Q\},𝒜\\mathcal\{A\}, and𝒪\\mathcal\{O\}are subsets of the natural language space\. Given a task queryq∈𝒬q\\in\\mathcal\{Q\}, the LLM agentπθ\\pi\_\{\\theta\}interacts with the environment as follows\. At each time steptt, the agent samples an actionat∼πθ\(⋅∣q,τt−1\)a\_\{t\}\\sim\\pi\_\{\\theta\}\(\\cdot\\mid q,\\tau\_\{t\-1\}\)based on the query and the history of previous interactions\. It then receives environmental feedback as an observationot∈𝒪o\_\{t\}\\in\\mathcal\{O\}\. The historical interaction trajectory up to stept−1t\-1is denoted byτt−1=\(o0,a1,o1,a2,o2,…,at−1,ot−1\)\\tau\_\{t\-1\}=\(o\_\{0\},a\_\{1\},o\_\{1\},a\_\{2\},o\_\{2\},\\ldots,a\_\{t\-1\},o\_\{t\-1\}\), whereo0o\_\{0\}is the initial observation of the environment before any action is taken\. The interaction loop continues until the agent either completes the task or reaches the maximum allowed number of steps\. The complete trajectory is written asτ=\(q,o0,a1,o1,a2,o2,…,am,om\)\\tau=\(q,\\,o\_\{0\},\\,a\_\{1\},\\,o\_\{1\},\\,a\_\{2\},\\,o\_\{2\},\\,\\ldots,\\,a\_\{m\},\\,o\_\{m\}\), whereo0o\_\{0\}is the initial observation of the environment, andmmdenotes the trajectory length\. Finally, a rewardr\(q,τ\)∈\[0,1\]r\(q,\\tau\)\\in\[0,1\]is assigned to indicate whether the task is successfully completed or has failed\. Figure 2\.Overall architecture of EMG \(Experience Memory Graph\)\. In the offline construction phase, we collect exploration trajectories on training tasks and convert them into action decision graphs\. Graph matching on failed–successful pairs extracts edit paths for error correction, while matching on successful–successful pairs from similar tasks yields common subgraphs for transferable workflows\. These structural insights are distilled into natural‑language guidance and stored in a memory graph with intra‑task nodes and cross‑task edges\. At test time, the agent retrieves relevant node and edge insights, enabling correct one‑shot execution without trial‑and‑error loops\. ## 4\.Method In this section, we present Experience Memory Graph \(EMG\), a framework that constructs structured experience memory from training tasks and applies it to new tasks, which is shown in fig\. 2\. The overall pipeline consists of three stages: \(1\) preparing training trajectories and converting them into action decision graphs; \(2\) constructing a memory graph where nodes store intra\-task insights and edges store cross\-task insights; and \(3\) retrieving relevant memory at test time to guide the agent without additional loops\. We detail each stage below\. ### 4\.1\.Preparation Before constructing the experience memory graph, we first collect trajectories on the training tasks and convert them into action decision graphs\. #### 4\.1\.1\.Collecting Exploration Trajectories For each training task queryqqin the training set𝒬train\\mathcal\{Q\}\_\{\\text\{train\}\}, we let an LLM agent interact with the environment to produce a single exploration trajectoryeme\_\{m\}\(which may either succeed or fail\)\. For the same tasktit\_\{i\}, we assume access to a successful expert trajectoryτi∗\\tau\_\{i\}^\{\*\}, provided by datasets such as ETO\(Songet al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib17)\)\. Thus, for each training task, we obtain a pair\(τi,τi∗\)\(\\tau\_\{i\},\\tau\_\{i\}^\{\*\}\)\. Failed exploration trajectories are particularly valuable, as they contain mistakes that can be corrected; successful ones can be used as positive examples directly\. We collect such pairs over all training tasks\. #### 4\.1\.2\.Transforming Trajectories into Action Decision Graphs To explicitly model the decision process —which action should be taken under a given observation— we convert each raw trajectory into a directedaction decision graph\. A successful trajectory and a failed one often differ precisely in this decision mapping\. By constructing a graph where nodes are actions and edges carry the preceding observation, we make explicit the rule:for a given state, which action is chosen\. This decision‑centric representation enables the graph edit path to learn meaningful correction insights — e\.g\., under a specific observation, which wrong action should be replaced by which correct action\. Compared to raw sequential sequences, where the same action may appear in different contexts without a clear link to the triggering observation, our graph formulation yields far more actionable and transferable correction knowledge\. Graph representation\.We denote the action decision graph asG=\(V,E,q,r\)G=\(V,E,q,r\), whereqqis the task query andrris the final reward\. Nodes represent actions, edges represent the observations preceding those actions\. To obtain compact yet discriminative representations for labeling, we normalize each action into a tuplek=\(type,object,receptacle\)k=\(\\text\{type\},\\text\{object\},\\text\{receptacle\}\)\(e\.g\.,\(take,apple,table\)\(\\text\{take\},\\text\{apple\},\\text\{table\}\)\), capturing the action type and the objects it operates on; the raw action textavrawa\_\{v\}^\{\\text\{raw\}\}\(e\.g\., ”take apple from table”\) is also kept\. Each node is represented asvi=\(ki,airaw,ℓn\(v\)\)v\_\{i\}=\(k\_\{i\},a\_\{i\}^\{\\text\{raw\}\},\\ell\_\{n\}\(v\)\)with node labelℓn\(vi\)∈ℕ\\ell\_\{n\}\(v\_\{i\}\)\\in\\mathbb\{N\}\. A virtual INIT nodevinitv\_\{\\text\{init\}\}\(ℓn\(vinit\)=0\\ell\_\{n\}\(v\_\{\\text\{init\}\}\)=0\) provides an incoming edge for the first action, carrying the initial observationo0o\_\{0\}\. Each directed edge is denoted asei=\(\(vi,vi\+1\),si,ℓe\(ei\)\)∈Ee\_\{i\}=\(\(v\_\{i\},v\_\{i\+1\}\),s\_\{i\},\\ell\_\{e\}\(e\_\{i\}\)\)\\in E\.\(vi,vi\+1\)\(v\_\{i\},v\_\{i\+1\}\)represents the connection from action nodeviv\_\{i\}tovi\+1v\_\{i\+1\}\. Soeie\_\{i\}is both the observations resulting from the actionviv\_\{i\}and the preceding observation of the next actionvi\+1v\_\{i\+1\}\.eie\_\{i\}also carries a normalized observation textsis\_\{i\}derived from the raw observationoio\_\{i\}\(e\.g\., “kitchen: apple, potato”\) and its edge labelℓe\(ei\)∈ℕ\\ell\_\{e\}\(e\_\{i\}\)\\in\\mathbb\{N\}\. Construction design\.Two design choices ensure the action decision graph captures decision\-level information\.1\. node reuse: if the same normalized action tuple appears multiple times in the trajectory, we do not create a new node; instead, we reuse the existing node\. This gives the node multiple incoming edges, each associated with a different preceding observation, thus capturing the decision pattern that the same action may be taken under various observed states\.2\. parallelizing consecutive invalid actions: when an action leads to an uninformative observation \(e\.g\., “nothing happens”\), the environment state does not change\. We keep the current valid state unchanged and connect all such invalid actions from the same previous valid node, treating them as parallel attempts from the same decision point rather than a spurious chain\. To implement these ideas, we scan the trajectory once, maintaining the current valid statess\(initialized as normalizedo0o\_\{0\}\) and the nodelastlast\(initiallyvinitv\_\{\\text\{init\}\}\) that produced it\. A dictionaryΦ\\Phimaps each normalized action tuple to its node, enabling node reuse\. The detailed Algorithm[1](https://arxiv.org/html/2607.13884#alg1)and a concrete example is available in Appendix A\. After building the structure, we assign labels: each distinct action tuplekkreceives a unique positive integer as node labelℓn\(v\)\\ell\_\{n\}\(v\)\(0 forvinitv\_\{\\text\{init\}\}\), and each distinct normalized observation textssreceives a unique positive integer as edge labelℓe\(e\)\\ell\_\{e\}\(e\)\. Thus, identical contents yield identical labels, allowing graph matching to compare semantics by simple label equality\. The resulting action decision graph abstracts raw action and observation texts into discrete labels \(node labels for action tuples, edge labels for observation texts\), enabling efficient structure comparison via label equality in the subsequent graph matching stage\. At the same time, each node and edge preserves the original raw texts, which are later used to convert extracted common subgraphs and graph edit paths into natural‑language insights\. ### 4\.2\.Construction of Experience Memory Graph To move beyond test‑time self‑reflection, we build an offline experience memory graph that stores structured, reusable experience\. This memory graph provides two key benefits: \(1\) it captures precise error corrections and successful workflows for individual tasks, and \(2\) it generalizes across similar tasks by extracting shared decision patterns\. To construct such a memory graph, we leverage graph matching on the action decision graphs obtained from Section 4\.1\. By matching failed exploration graphs with their corresponding expert graphs, we extract intra‑task common subgraphs and graph edit paths; by matching expert graphs of semantically similar tasks, we obtain cross‑task insights\. These structured pieces of knowledge are organized into the experience memory graph𝒢m=\(𝒱,ℰ\)\\mathcal\{G\}\_\{m\}=\(\\mathcal\{V\},\\mathcal\{E\}\), where each nodeν∈𝒱\\nu\\in\\mathcal\{V\}stores intra‑task insights and each edgeϵ∈ℰ\\epsilon\\in\\mathcal\{E\}stores cross‑task reusable insights\. We first define the experience memory graph formally\. Let𝒱=\{ν1,…,νN\}\\mathcal\{V\}=\\\{\\nu\_\{1\},\\dots,\\nu\_\{N\}\\\}where each nodeνi\\nu\_\{i\}is a tuple: \(1\)νi=\(qi,embedi,Iiintra,Gi,Gi∗,ri\),\\nu\_\{i\}=\\bigl\(q\_\{i\},\\;\{embed\}\_\{i\},\\;I\_\{i\}^\{\\text\{intra\}\},\\;G\_\{i\},\\;G\_\{i\}^\{\*\},\\;r\_\{i\}\\;\\bigr\),whereqiq\_\{i\}is the task query,embedi\{embed\}\_\{i\}the query embedding,IiintraI\_\{i\}^\{\\text\{intra\}\}is the intra‑task insight, andGi,Gi∗G\_\{i\},G\_\{i\}^\{\*\}are the action decision graphs of the exploration trajectory and the expert trajectory, respectively \(built via Algorithm[1](https://arxiv.org/html/2607.13884#alg1)\)\.ri∈\{0,1\}r\_\{i\}\\in\\\{0,1\\\}is the reward \(success/failure\) of exploration trajectoryGiG\_\{i\}, and the reward of expert trajectory is always 1 and we omit it here\. Each edgeϵij∈ℰ\\epsilon\_\{ij\}\\in\\mathcal\{E\}connectsνi\\nu\_\{i\}andνj\\nu\_\{j\}and is defined as: \(2\)ϵij=\(sij,Iijcross\),\\epsilon\_\{ij\}=\\bigl\(s\_\{ij\},\\;I\_\{ij\}^\{\\text\{cross\}\}\\bigr\),wheresij=cos\(embedi,embedj\)s\_\{ij\}=\\cos\(\{embed\}\_\{i\},\{embed\}\_\{j\}\)is the cosine similarity between query embeddings, andIijcrossI\_\{ij\}^\{\\text\{cross\}\}is the cross‑task insight text\. #### 4\.2\.1\.Constructing Node Insights Recall thatGiG\_\{i\}andGi∗G\_\{i\}^\{\*\}are the action decision graphs built from the raw exploration and expert trajectories using the method in Section 4\.1\. This graph representation allows us to compare them structurally via graph matching\. Given a pair of exploration graphGiG\_\{i\}and expert graphGi∗G\_\{i\}^\{\*\}, we can extract two kinds of structured knowledge: thecommon subgraphGicG\_\{i\}^\{c\}\(the correct actions in the failed trajectory that should be maintained, revealing the successful workflow\) and thegraph edit pathGieG\_\{i\}^\{e\}\(a sequence of edit operations that transforms failed explorationGiG\_\{i\}into successful expertGi∗G\_\{i\}^\{\*\}\), fromGieG\_\{i\}^\{e\}we directly obtain: \(a\) which actions to add or avoid under specific observations \(from node deletions/insertions\), and \(b\) which action to replace with another under a given observation \(from relabeled actions\)\. To computeGicG\_\{i\}^\{c\}andGieG\_\{i\}^\{e\}, we first find a node matching between the two graphs viagraph matching, then we compare the two graphs: the parts that are identical in both structure and labels form the common subgraph; the differences \(mismatched nodes and edges\) directly yield the graph edit path\. Thus, instead of test‑time trial‑and‑error, we directly obtain correction instructions and successful workflows\. Concretely, we first obtain the node matching betweenGiG\_\{i\}andGi∗G\_\{i\}^\{\*\}via graph matching\. Since supervised matching heavily relies on ground‑truth node correspondences, we adopt an unsupervised approach based on optimal transport \(OT\)\. Most OT‑based methods adopt the Fused Gromov‑Wasserstein \(FGW\) distance\(Tanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib26); Chenget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib29)\), which jointly considers node labels and edge structures\. For two graphsGGandG′G^\{\\prime\}with soft assignmentπ∈ℝ\|V\|×\|V′\|\\pi\\in\\mathbb\{R\}^\{\|V\|\\times\|V^\{\\prime\}\|\}, our FGW objective is: \(3\)FGW=minπ∑i,jCijπij\+∑i,j,k,l\|Aijg−Aklg′\|2πikπjl,\\mathrm\{FGW\}=\\min\_\{\\pi\}\\sum\_\{i,j\}C\_\{ij\}\\pi\_\{ij\}\+\\sum\_\{i,j,k,l\}\|A\_\{ij\}^\{g\}\-A\_\{kl\}^\{g^\{\\prime\}\}\|^\{2\}\\pi\_\{ik\}\\pi\_\{jl\},whereπij\\pi\_\{ij\}indicates the matching strength between nodeiiinGGand nodejjinG′G^\{\\prime\},CijC\_\{ij\}is the cost of relabeling nodeiitojj, andAg,Ag′A^\{g\},A^\{g^\{\\prime\}\}are adjacency matrices\. Unlike the standard FGW formulation which includes a factor12\\frac\{1\}\{2\}for undirected graphs where each edge is counted twice\)\(Tanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib26); Chenget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib29)\), our directed graphs require no such factor, and we drop it\. We adopt the FGWAlign solver\(Tanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib26)\)to optimize this objective, which supports edge\-labeled graphs\. The time complexity of the solver isO\(\|𝒱\|3⋅\|ℒ\|\)O\(\|\\mathcal\{V\}\|^\{3\}\\cdot\|\\mathcal\{L\}\|\), where\|ℒ\|\|\\mathcal\{L\}\|is the number of edge label types\. Since our trajectory graphs typically contain at most a few dozen nodes, the solver is highly efficient\. After obtaining the optimal soft planπ∗\\pi^\{\*\}, we discretize it into a hard node matching matrixP∈\{0,1\}\|V\|×\|V′\|P\\in\\\{0,1\\\}^\{\|V\|\\times\|V^\{\\prime\}\|\}via linear assignment: \(4\)P=argmaxP∈ℙn⟨π∗,P⟩,P=\\arg\\max\_\{P\\in\\mathbb\{P\}\_\{n\}\}\\langle\\pi^\{\*\},P\\rangle,whereℙn\\mathbb\{P\}\_\{n\}denotes the set of permutation \(or partial permutation\) matrices\. Each entryPij=1P\_\{ij\}=1indicates that nodeiiinGGis matched to nodejjinG′G^\{\\prime\}\. Given the node matching matrixPP, we define a node matchingM:V↦V′M:V\\mapsto V^\{\\prime\}whereM\(u\)=vM\(u\)=vifPuv=1P\_\{uv\}=1\(anduuis unmatched if no suchvvexists\), then we derive the graph edit path and the common subgraph by comparing the two graphs\. Classical methods for extracting edit paths and common subgraphs are designed for undirected graphs with only node labels; they cannot handle edge labels and do not respect edge directions\. Directly applying them to our directed edge‑labeled action decision graphs would discard the semantic information carried by edge observations \(the preconditions of actions\)\. Therefore, we adapt these methods to our setting\. Specifically, Algorithm[2](https://arxiv.org/html/2607.13884#alg2)retains edges that exist in both graphs with identical labels under the matching \(the correct workflow\); Algorithm[3](https://arxiv.org/html/2607.13884#alg3)collects unmatched or mismatched nodes and edges to form edit operations \(deletions, insertions, relabelings\), directly indicating the necessary corrections\. The detailed algorithm is available in Appendix B\. Finally, we generate the intra‑task insight\. If the exploration succeeded \(ri=1r\_\{i\}=1\), we retain the common subgraphGicG\_\{i\}^\{c\}\(extracted via Algorithm[2](https://arxiv.org/html/2607.13884#alg2)\) as the correct workflow\. If it failed \(ri=0r\_\{i\}=0\), we use the graph edit pathGieG\_\{i\}^\{e\}\(via Algorithm[3](https://arxiv.org/html/2607.13884#alg3)\) as the correction instructions\. For environments with continuous reward \(e\.g\., ScienceWorld\), a partially successful trajectory \(0<ri<10<r\_\{i\}<1\) contains both correct and incorrect actions; we therefore feed bothGicG\_\{i\}^\{c\}\(to preserve the correct actions\) andGieG\_\{i\}^\{e\}\(to correct the errors\) to the LLM\. In all cases, the LLM takes the task queryqiq\_\{i\}as input, the original exploration graphGiG\_\{i\}, the expert graphGi∗G\_\{i\}^\{\*\}, and the extracted structure\(s\)XiX\_\{i\}\(whereXiX\_\{i\}isGicG\_\{i\}^\{c\}\(ri=1r\_\{i\}=1\), orGieG\_\{i\}^\{e\}\(ri=0r\_\{i\}=0\), or both \(0<ri<10<r\_\{i\}<1\)\), and summarizes them into intra\-task insight: \(5\)Iiintra=LLM\(intra\-prompt\(qi,Gi,Gi∗,Xi\)\)\.I\_\{i\}^\{\\text\{intra\}\}=\\mathrm\{LLM\}\\bigl\(\\text\{intra\-prompt\}\(q\_\{i\},G\_\{i\},G\_\{i\}^\{\*\},X\_\{i\}\)\\bigr\)\. In summary,IiintraI\_\{i\}^\{\\text\{intra\}\}supplies either the correct workflow or explicit corrections, enabling test‑time guidance without trial‑and‑error\. #### 4\.2\.2\.Constructing Edge Insights Using the action decision graph representation for all expert trajectories, we can compare the successful decision patterns of different tasks\. We further aim to extract generalizable knowledge that transfers across similar tasks \(e\.g\., different environments with analogous goals\)\. For two task nodesνi\\nu\_\{i\}andνj\\nu\_\{j\}with similar queries in the memory graph, comparing their expert graphsGi∗G\_\{i\}^\{\*\}andGj∗G\_\{j\}^\{\*\}via graph matching reveals a common subgraph — actions that are correct under similar observations in different environments which should be learned and maintained\. This provides cross‑task insights that are robust to environmental variations\. To realize this, after building all nodes we compute pairwise query embedding similaritiessij=cos\(embedi,embedj\)s\_\{ij\}=\\cos\(\{embed\}\_\{i\},\{embed\}\_\{j\}\), whereembedi\{embed\}\_\{i\}is the embedding of nodeνi\\nu\_\{i\}’s query\. An edgeϵij\\epsilon\_\{ij\}is added ifsij≥τs\_\{ij\}\\geq\\tau, and we only connect each node to its top\-kkmost similar neighbors\. For each edgeϵij\\epsilon\_\{ij\}connecting node taskνi\\nu\_\{i\}andνj\\nu\_\{j\}, we perform graph matching between the expert graphsGi∗G\_\{i\}^\{\*\}andGj∗G\_\{j\}^\{\*\}ofνi\\nu\_\{i\}andνj\\nu\_\{j\}, and use the same adapted FGW solver and Algorithm[2](https://arxiv.org/html/2607.13884#alg2)to obtain the common subgraphGijcG\_\{ij\}^\{c\}\. We then prompt an LLM to summarizeGijcG\_\{ij\}^\{c\}into the cross‑task insight: \(6\)Iijcross=LLM\(cross\_prompt\(qi,qj,Gi∗,Gj∗,Gijc\)\)\.I\_\{ij\}^\{\\text\{cross\}\}=\\mathrm\{LLM\}\\bigl\(\\text\{cross\\\_prompt\}\(q\_\{i\},q\_\{j\},G\_\{i\}^\{\*\},G\_\{j\}^\{\*\},G\_\{ij\}^\{c\}\)\\bigr\)\.This insight is stored on the edgeϵij\\epsilon\_\{ij\}, which can guide the agent when facing new tasks similar to either endpoint\. ### 4\.3\.Retrieval of Experience Memory Graph During test time, given a new task queryqtestq\_\{\\text\{test\}\}, we first embed it using the same embedding model to obtainembedtest\{embed\}\_\{\\text\{test\}\}\. The similarity to each memory nodeνi\\nu\_\{i\}is computed assi=cos\(embedtest,embedi\)s\_\{i\}=\\cos\(\{embed\}\_\{\\text\{test\}\},\{embed\}\_\{i\}\)\. We retrieve the top\-KKnodes with the highestsis\_\{i\}\. For each such nodeνi\\nu\_\{i\}, we also retrieve the most relevant cross‑task insights: we look at all edges incident toνi\\nu\_\{i\}, and for each neighborνj\\nu\_\{j\}we compute its similarity toqtestq\_\{\\text\{test\}\}as above\. The edges with the top\-TTneighbor similarities are selected, and their stored cross‑task insights are collected\. Formally, the retrieval result forqtestq\_\{\\text\{test\}\}is: \(7\)ℛ\(qtest\)=⋃νi∈TopK\{\(Iiintra,\{Iijcross∣νj∈TopT\(νi\)\}\)\},\\mathcal\{R\}\(q\_\{\\text\{test\}\}\)=\\bigcup\_\{\\nu\_\{i\}\\in\\text\{TopK\}\}\\left\\\{\\bigl\(I\_\{i\}^\{\\text\{intra\}\},\\;\\\{I\_\{ij\}^\{\\text\{cross\}\}\\mid\\nu\_\{j\}\\in\\text\{TopT\}\(\\nu\_\{i\}\)\\\}\\bigr\)\\right\\\},whereTopT\(νi\)\\text\{TopT\}\(\\nu\_\{i\}\)are the neighbors ofνi\\nu\_\{i\}with the highest query similarities\. The retrieved insights, derived from structured graph comparisons, provide concrete decision rules, making them directly usable for the agent\. For instance, when faced with a task such as “put some pencil on shelf,” the retrieved node insight may specify that once the agent is holding the pencil at the sidetable, the correct next action is to go directly to the shelf rather than placing it elsewhere, and that the action of taking the pencil must precede any movement toward the target\. The retrieved edge insights further provide cross‑task guidance, such as adapting the final navigation step when the target changes from shelf to desk, or expanding the search strategy when the object changes from pencil to pen\. These insights are then passed to the agent’s prompt as guidance, eliminating any need for test‑time reflection or trial‑and‑error loops\. The complete Experience Memory Graph𝒢m\\mathcal\{G\}\_\{m\}is built offline on the training set\. Its construction cost is amortized over many test tasks, and the retrieval is fast \(embedding similarity \+ neighbor lookup\)\. This makes EMGboth efficient and scalable\. ## 5\.Experiments ### 5\.1\.Experimental Settings Table 1\.Statistics of the datasets used for evaluation\.#### 5\.1\.1\.Datasets We conduct experiments across two mainstream datasets: ALFWorld and ScienceWorld\. The detailed statistics are summarized in Table[1](https://arxiv.org/html/2607.13884#S5.T1)\. ALFWorld provides embodied household tasks to assess the agent’s capacity for spatial memory and sequential execution in everyday scenarios\. ScienceWorld simulates interactive science experiments and features the longest trajectories, serving as a rigorous benchmark for evaluating long\-term memory retention, multi\-step planning, and complex scientific reasoning\. To measure both in\-distribution learning and out\-of\-distribution generalization capabilities, we evaluate agent performance on both seen and unseen test splits for ALFWorld and ScienceWorld with the same split of ETO\(Songet al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib17)\)\. The reward of ALFWorld is either 0 or 1, and the reward of ScienceWorld is from 0 to 1\. #### 5\.1\.2\.Baselines In this paper, we benchmark our EMG against a spectrum of representative frameworks, containing both methods with reflect\-replay loop and memory construction\. We first consider ReAct\(Yaoet al\.,[2023](https://arxiv.org/html/2607.13884#bib.bib32)\), a widely adopted prompting strategy that interleaves reasoning traces with task\-specific actions, serving as our fundamental memory\-less baseline\. Reflexion\(Shinnet al\.,[2023](https://arxiv.org/html/2607.13884#bib.bib33)\)enables the agent to leverage short\-term episodic memory of past mistakes to iteratively refine its behavior within a single environment\. Extending beyond transient self\-reflection, we evaluate ExpeL\(Zhaoet al\.,[2024](https://arxiv.org/html/2607.13884#bib.bib34)\), which accumulates rules from historical trajectories, acting as an experiential learning baseline\. Furthermore, we compare against recent CDMem\(Gaoet al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib15)\), which constructs both short\-term memory and long\-term memory based on reflection, and MemP\(Fanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib12)\), which explicitly constructs procedural memory to reuse complex execution routines\. Our EMG adopts ReAct as the base model and retrieves insights in the constructed memory graph when testing\. Each baseline is equipped with few\-shot examples\. For baselines with reflect\-replay loop \(Reflexion, Expel and CDMem\), we run for 5 iterations\. #### 5\.1\.3\.Evaluation Metrics and Settings We employ two commonly used metrics: Success Rate \(SR\) and Average Reward \(AR\)\. While SR acts as the primary indicator of ultimate task completion, AR provides a granular assessment of partial progress and intermediate sub\-goal achievement, reflecting the agent’s step\-by\-step reasoning and memory utilization throughout long\-horizon interactions\. We apply DeepSeek V3\.2 \(chat mode\) to collect exploration trajectories, and construct the experience memory graph with DeepSeek V3\.2 \(chat mode\) for Scienceworld, and Deepseek V4\-flash \(chat mode\) for ALFWorld\. For testing tasks, we use both the open\-source small model Qwen3:4B\-instruct\-2507\-q8 and the large model DeepSeek\-V4 flash \(chat mode\) to compare the performance of baselines\. Table 2\.Main results of our EMG compared with various baselines, where DeepSeek is abbreviated in DS\. S\-SR and U\-SR denote Success Rate \(%\) on Seen and Unseen splits respectively, and S\-AR and U\-AR denote Average Reward \(%\) on Seen and Unseen splits\. ### 5\.2\.Main Results The main results are presented in Table[2](https://arxiv.org/html/2607.13884#S5.T2)\. An analysis of these results reveals three key insights as follows\. Consistent Superiority over Iterative Paradigms\.Across both datasets and all evaluation splits, EMG consistently outperforms all baseline methods in terms of SR and AR with both small and large models\. Notably, our method demonstrates a clear advantage over frameworks based on reflect\-replay loop such as Reflexion, ExpeL, and CDMem\. Those baselines rely on reasoning about erroneous actions and re\-executing attempts to self\-correct\. While our EMG directly uncovers the correct correction paths from the training set and constructs memory, thereby guiding test\-time decisions more reliably and achieving higher success rates\. Overcoming the Reasoning Bottleneck of Compact LLMs\.The performance gap between EMG and the baselines is more evident for the smaller Qwen3\-4B than for the larger DeepSeek\-V4\-Flash, specially for ALFWorld\. Iterative frameworks like expel require strong intrinsic reasoning to analyze past mistakes and derive alternative actions, the capacity that smaller LLMs often lack\. By providing insights from error correction and workflow, EMG helps smaller models overcome this limitation, leading to substantially larger relative gains compared to large models\. Moreover, when adopting DeepSeek for testing, although iterative baselines are equipped with DeepSeek model for better reflection, they still underperform EMG, suggesting that the structured extraction of corrections and workflows provides additional benefits that scaling alone and iterative reflection do not fully capture\. Bridging the Scale Gap in Complex Tasks\.The efficacy of EMG is highlighted in the highly demanding ScienceWorld environment, which necessitates intricate multi\-step scientific reasoning\. Remarkably, the 4B\-parameter Qwen3 model equipped with EMG achieves performance comparable to—and in some metrics exceeding—the significantly larger DeepSeek model running standard baselines\. This suggests that our EMG can effectively polish the capacity of small models when tackling complex, long\-horizon decision\-making problems\. Table 3\.Ablation study of EMG \. ### 5\.3\.Ablation Study To isolate the contributions of each component, we evaluate two ablated variants:EMG w/o NE: removing both node’s intra\-task insights and edge’s cross\-task insights, and it is actually ReAct without memory;EMG w/o E: removing only the edge’s cross\-task insights and retaining node’s intra\-task insights\. The results are detailed in Table[3](https://arxiv.org/html/2607.13884#S5.T3), from which we draw three principal conclusions\. Crucial Role of Intra‑Task Node Memory\.Comparing EMG w/o NE \(no memory\) with EMG w/o E \(node only\) shows that node memory alone brings substantial gains in most cases\. For instance, DeepSeek’s Unseen SR in ScienceWorld jumps from 13\.74% to 23\.22%, and Qwen’s Unseen SR in ALFWorld from 21\.64% to 52\.99%\. However, on ScienceWorld with the small Qwen model, the improvement is modest \(Seen SR: 11\.86% → 12\.37%; Unseen SR: 8\.53% → 9\.48%\), suggesting that extremely complex reasoning may still require additional cross‑task support\. Overall, node memory serves as a solid foundation, effectively preventing repeated failures where the task is within the model’s basic reasoning capacity\. Differential Sensitivity to Cross‑Task Insights\.Adding edges \(comparing EMG w/o E to full EMG\) yields asymmetric gains\. The small Qwen3\-4B benefits noticeably from cross‑task insights, e\.g\., ScienceWorld Unseen SR rises from 9\.48% to 16\.11%\. In contrast, the large DeepSeek gains marginally \(e\.g\., Unseen SR 23\.22% → 24\.17%\), indicating that large models already possess strong generalization ability, while small models rely on explicit cross‑task knowledge to compensate for limited parameters\. Synergistic Superiority of Dual Memory\.The full EMG \(nodes \+ edges\) achieves the best performance across all metrics\. For Qwen in ALFWorld, Average Reward climbs steadily from baseline \(w/o NE\) to node only \(w/o E\) to full model, and the same trend holds for other settings\. This demonstrates that local error correction \(node\) and global knowledge transfer \(edge\) work synergistically, leading to both high success rates and robust intermediate reasoning\. Figure 3\.Success rate between one\-shot memory and iterative correction methods\. The one\-shot memory methods \(EMG, ReAct and Memp\) only run for 1 iteration, and the iterative methods \(Reflexion, Expel and CDMem\) run for 5 iterations\. ### 5\.4\.One‑Shot Memory vs\. Iterative Correction We evaluate all methods on the seen splits of ALFWorld \(with Qwen3\-4B\) and ScienceWorld \(with DeepSeek\-V4\-Flash\)\. For iterative baselines \(Reflexion, ExpeL, CDMem\), we allow up to five test\-time iterations and report their final success rate\. For one\-shot memory, they perform a single execution per test task without online trial\-and\-error\. The results are shown in figure 3\. The results show that while some iterative baselines \(e\.g\., Reflexion, ExpeL\) can surpass simple one‑shot methods like ReAct or MemP after several rounds of reflection, our one‑shot EMG consistently achieves the highest success rate among all methods on both benchmarks\. For instance, on ALFWorld with Qwen3\-4B, the iterative success rates range from 27\.14% to 38\.57%, whereas EMG reaches 53\.57% with a single execution\. Similarly, on ScienceWorld with DeepSeek\-V4\-Flash, the iterative results vary between 12\.89% and 19\.07%, while EMG attains 28\.87%\. This demonstrates that our offline‑structured memory not only provides more effective correction than online trial‑and‑error loops, but also eliminates the need for multiple test‑time attempts, thereby significantly reducing both time and API costs\. Figure 4\.Time cost of EMG and iterative self\-reflection baselines\. ### 5\.5\.Time Cost Comparison We evaluate the inference time efficiency of our EMG against iterative baselines \(CDMem, Reflexion, ExpeL\) on ScienceWorld using the Qwen3\-4B model, as shown in figure 4\. While iterative methods require up to five test‑time attempts to self‑correct, EMG performs only a single execution per task, leveraging offline‑constructed memory\. As a result, EMG incurs substantially lower total inference time than all baselines, while simultaneously achieving higher success rates \(see main results\)\. The time advantage of EMG is consistent across both seen and unseen splits\. Notably, when deployed with larger closed‑source models \(e\.g\., DeepSeek\-V4\-Flash\), the inference cost per attempt is considerably higher; EMG’s one‑shot nature therefore multiplies the savings in both time and API expenses, further underscoring its practical efficiency\. Figure 5\.Sensitivity analysis of EMG\. We report the success rate of EM when the retrieved node counts change\. ### 5\.6\.Hyperparameter Sensitivity Analysis We analyze the sensitivity of EMG to the number of retrieved nodes \(top‑kk\) on two benchmarks: ALFWorld seen and ScienceWorld unseen, both using DeepSeek\-V4\-Flash\. On ALFWorld, we vary top‑kkfrom 5 to 9; on ScienceWorld, we vary it from 2 to 6\. Each node includes all of its connected edge insights for the retrieved memory, and we report the success rate as shown in figure 5\. Overall, EMG exhibits strong robustness across the tested range ofkk\. Performance remains consistently high with only minor fluctuations, and even the smallest retrieval sets achieve competitive results, indicating that the stored insights are highly informative and do not require many examples to be effective\. A slight decline is observed whenkkbecomes too large, which may be due to the inclusion of too many examples that occasionally distract the model in selecting the most appropriate correction\. Nevertheless, the variation is modest, confirming that EMG is not sensitive to the exact choice ofkkand performs reliably without extensive tuning\. ## 6\.Conclusion We propose Experience Memory Graph \(EMG\), a framework that constructs structured experience memory from training trajectories via graph matching\. Unlike iterative self‑reflection methods that rely on costly test‑time trial‑and‑error, EMG formulates error correction as finding the shortest graph edit path between a failed exploration trajectory and a successful expert trajectory\. By converting trajectories into directed action decision graphs and applying graph matching offline, we extract common subgraphs \(successful workflows\) and graph edit paths \(correction instructions\)\. These insights are organized into a memory graph where nodes store intra‑task knowledge and edges store cross‑task generalizable patterns, enabling one‑shot test‑time guidance without repeated loops\. Experiments on extensive datasets demonstrate that EMG consistently outperforms strong iterative baselines in success rate and average reward, while requiring only a single test‑time attempt\. Ablation and sensitivity studies confirm the effectiveness and robustness of the proposed model\. For future work, we plan to extend EMG to environments without expert trajectories\. ## References - P\. Anokhin, N\. Semenov, A\. Y\. Sorokin, D\. Evseev, A\. Kravchenko, M\. Burtsev, and E\. Burnaev \(2025\)AriGraph: learning knowledge graph world models with episodic memory for LLM agents\.InProceedings of the Thirty\-Fourth International Joint Conference on Artificial Intelligence, IJCAI 2025, Montreal, Canada, August 16\-22, 2025,pp\. 12–20\.External Links:[Link](https://doi.org/10.24963/ijcai.2025/2),[Document](https://dx.doi.org/10.24963/IJCAI.2025/2)Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - Q\. Cheng, D\. Yan, T\. Wu, Z\. Huang, and Q\. Zhang \(2025\)Computing approximate graph edit distance via optimal transport\.Proceedings of the ACM on Management of Data3\(1\),pp\. 1–26\.Cited by:[§4\.2\.1](https://arxiv.org/html/2607.13884#S4.SS2.SSS1.p2.17),[§4\.2\.1](https://arxiv.org/html/2607.13884#S4.SS2.SSS1.p2.5)\. - J\. Fang, X\. Deng, H\. Xu, Z\. Jiang, Y\. Tang, Z\. Xu, S\. Deng, Y\. Yao, M\. Wang, S\. Qiao, H\. Chen, and N\. Zhang \(2026\)LightMem: lightweight and efficient memory\-augmented generation\.InThe Fourteenth International Conference on Learning Representations,External Links:[Link](https://openreview.net/forum?id=dyJ0GWpjJB)Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - R\. Fang, Y\. Liang, X\. Wang, J\. Wu, S\. Qiao, P\. Xie, F\. Huang, H\. Chen, and N\. Zhang \(2025\)Memp: exploring agent procedural memory\.arXiv preprint arXiv:2508\.06433\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1),[§5\.1\.2](https://arxiv.org/html/2607.13884#S5.SS1.SSS2.p1.1)\. - P\. Gao, J\. Zhao, X\. Chen, and L\. Yilin \(2025\)An efficient context\-dependent memory framework for llm\-centric agents\.InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies \(Volume 3: Industry Track\),pp\. 1055–1069\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1),[§5\.1\.2](https://arxiv.org/html/2607.13884#S5.SS1.SSS2.p1.1)\. - R\. Ge, Y\. Fu, Y\. Qian, J\. Su, Y\. Zhao, P\. Zhao, and H\. Zhang \(2026\)Internalizing agency from reflective experience\.arXiv preprint arXiv:2603\.16843\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - Y\. Hu, S\. Liu, Y\. Yue, G\. Zhang, B\. Liu, F\. Zhu, J\. Lin, H\. Guo, S\. Dou, Z\. Xi,et al\.\(2025\)Memory in the age of ai agents\.arXiv preprint arXiv:2512\.13564\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - T\. Huang, K\. Basu, I\. Abdelaziz, P\. Kapanipathi, J\. May, and M\. Chen \(2025\)R2d2: remembering, replaying and dynamic decision making with a reflective agentic memory\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 30318–30330\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - N\. Kim, K\. T\. Ong, Y\. Hwang, M\. Kang, I\. Jihn, G\. Kim, M\. Kim, and J\. Yeo \(2025\)PRINCIPLES: synthetic strategy memory for proactive dialogue agents\.InThe 2025 Conference on Empirical Methods in Natural Language Processing \(EMNLP 2025\),Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - C\. Kruengkrai and K\. Yoshino \(2025\)Teaching text agents to learn sequential decision making from failure\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 31619–31635\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - X\. Li, W\. Jiao, J\. Jin, G\. Dong, J\. Jin, Y\. Wang, H\. Wang, Y\. Zhu, J\. Wen, Y\. Lu,et al\.\(2026\)Deepagent: a general reasoning agent with scalable toolsets\.InProceedings of the ACM Web Conference 2026,pp\. 2219–2230\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - X\. Liang, M\. Tao, Y\. Xia, J\. Wang, K\. Li, Y\. Wang, Y\. He, J\. Yang, T\. Shi, Y\. Wang,et al\.\(2025\)Sage: self\-evolving agents with reflective and memory\-augmented abilities\.Neurocomputing647,pp\. 130470\.Cited by:[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - Y\. Liu, G\. Zhang, K\. Wang, S\. Li, S\. Pan, and B\. An \(2026\)Graph\-augmented large language model agents: current progress and future prospects\.IEEE Intelligent Systems41\(2\),pp\. 45–55\.Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - Q\. Mi, Z\. Ma, M\. Yang, H\. Li, Y\. Wang, H\. Zhang, and J\. Wang \(2026\)Skill\-pro: learning reusable skills from experience via non\-parametric ppo for llm agents\.InProceedings of the 43rd International Conference on Machine Learning \(ICML 2026\),Note:SpotlightExternal Links:[Link](https://arxiv.org/abs/2602.01869)Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - S\. Ouyang, J\. Yan, I\. Hsu, Y\. Chen, K\. Jiang, Z\. Wang, R\. Han, L\. T\. Le, S\. Daruki, X\. Tang,et al\.\(2025\)Reasoningbank: scaling agent self\-evolving with reasoning memory\.arXiv preprint arXiv:2509\.25140\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - R\. G\. Reddy, S\. Mukherjee, J\. Kim, Z\. Wang, D\. Hakkani\-Tur, and H\. Ji \(2025\)Infogent: an agent\-based framework for web information aggregation\.InFindings of the Association for Computational Linguistics: NAACL 2025,pp\. 5745–5758\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - J\. Shao, H\. Yin, Y\. Lyu, X\. Yu, L\. Guo, I\. Tsang, J\. Kwok, and Y\. Li \(2026\)Lifting traces to logic: programmatic skill induction with neuro\-symbolic learning for long\-horizon agentic tasks\.arXiv preprint arXiv:2605\.01293\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1)\. - N\. Shinn, F\. Cassano, A\. Gopinath, K\. Narasimhan, and S\. Yao \(2023\)Reflexion: language agents with verbal reinforcement learning\.Advances in neural information processing systems36,pp\. 8634–8652\.Cited by:[§5\.1\.2](https://arxiv.org/html/2607.13884#S5.SS1.SSS2.p1.1)\. - Y\. Song, D\. Yin, X\. Yue, J\. Huang, S\. Li, and B\. Y\. Lin \(2024\)Trial and error: exploration\-based trajectory optimization of llm agents\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 7584–7600\.Cited by:[§4\.1\.1](https://arxiv.org/html/2607.13884#S4.SS1.SSS1.p1.6),[§5\.1\.1](https://arxiv.org/html/2607.13884#S5.SS1.SSS1.p1.1)\. - J\. Tang, X\. Zhao, L\. Kong, X\. Zhou, and J\. Li \(2025\)Fused gromov\-wasserstein alignment for graph edit distance computation and beyond\.Proceedings of the VLDB Endowment18\(10\),pp\. 3641–3654\.Cited by:[Appendix C](https://arxiv.org/html/2607.13884#A3.p1.3),[§4\.2\.1](https://arxiv.org/html/2607.13884#S4.SS2.SSS1.p2.17),[§4\.2\.1](https://arxiv.org/html/2607.13884#S4.SS2.SSS1.p2.5)\. - H\. Wang, J\. Wang, C\. T\. Leong, and W\. Li \(2025a\)Steca: step\-level trajectory calibration for llm agent learning\.InFindings of the Association for Computational Linguistics: ACL 2025,pp\. 11597–11614\.Cited by:[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - Z\. Z\. Wang, J\. Mao, D\. Fried, and G\. Neubig \(2025b\)Agent workflow memory\.InInternational Conference on Machine Learning,pp\. 63897–63911\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p1.1)\. - Z\. Wei, W\. Yao, Y\. Liu, W\. Zhang, Q\. Lu, L\. Qiu, C\. Yu, P\. Xu, C\. Zhang, B\. Yin,et al\.\(2025\)Webagent\-r1: training web agents via end\-to\-end multi\-turn reinforcement learning\.InProceedings of the 2025 Conference on Empirical Methods in Natural Language Processing,pp\. 7920–7939\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1)\. - Y\. Wu, Y\. Zhang, S\. Liang, and Y\. Liu \(2025\)Sgmem: sentence graph memory for long\-term conversational agents\.arXiv preprint arXiv:2509\.21212\.Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - Z\. Wu, H\. Zhang, F\. Lin, W\. Xu, X\. Xu, Y\. Chen, H\. P\. Zou, S\. Chen, W\. Zhang, X\. Liu,et al\.\(2026\)Gam: hierarchical graph\-based agentic memory for llm agents\.arXiv preprint arXiv:2604\.12285\.Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - S\. Xia, Z\. Xu, J\. Chai, W\. Fan, Y\. Song, X\. Wang, G\. Yin, W\. Lin, H\. Zhang, and J\. Wang \(2025\)From experience to strategy: empowering llm agents with trainable graph memory\.arXiv preprint arXiv:2511\.07800\.Cited by:[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - T\. Xia, L\. Hu, Y\. Sun, M\. Xu, L\. Xu, S\. Wang, W\. Xu, and J\. Jiang \(2026\)GraSP: graph\-structured skill compositions for llm agents\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p3.1)\. - W\. Xu, Z\. Liang, K\. Mei, H\. Gao, J\. Tan, and Y\. Zhang \(2026\)A\-mem: agentic memory for llm agents\.Advances in Neural Information Processing Systems38,pp\. 17577–17604\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p1.1),[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - W\. Yang, J\. Xiao, H\. Zhang, Q\. Zhang, Y\. Wang, and B\. Xu \(2025\)Coarse\-to\-fine grounded memory for llm agent planning\.arXiv preprint arXiv:2508\.15305\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1)\. - S\. Yao, J\. Zhao, D\. Yu, N\. Du, I\. Shafran, K\. R\. Narasimhan, and Y\. Cao \(2023\)ReAct: synergizing reasoning and acting in language models\.InThe Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1\-5, 2023,External Links:[Link](https://openreview.net/forum?id=WE%5C_vluYUL-X)Cited by:[§5\.1\.2](https://arxiv.org/html/2607.13884#S5.SS1.SSS2.p1.1)\. - T\. Yao, Y\. Chen, Y\. Zheng, P\. Li, Z\. Shen, and K\. Zhang \(2026\)ParamMem: augmenting language agents with parametric reflective memory\.arXiv preprint arXiv:2602\.23320\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1)\. - W\. Yao, S\. Heinecke, J\. C\. Niebles, Z\. Liu, Y\. Feng, L\. Xue, R\. Ramapura Narasimha Murthy, Z\. Chen, J\. Zhang, D\. Arpit,et al\.\(2024\)Retroformer: retrospective large language agents with policy gradient optimization\.InInternational Conference on Learning Representations,Vol\.2024,pp\. 10091–10111\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1)\. - J\. Yu, Y\. Fang, X\. Liu, and Y\. Ma \(2026\)H\-mem: a novel memory mechanism for evolving and retrieving agent memory via a hybrid structure\.arXiv preprint arXiv:2605\.15701\.Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - D\. Zhang, X\. Liu, L\. Cheng, Y\. Wang, K\. Murray, and H\. Wei \(2026a\)SELAUR: self evolving llm agent via uncertainty\-aware rewards\.arXiv preprint arXiv:2602\.21158\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1)\. - G\. Zhang, M\. Fu, K\. Wang, F\. Wan, M\. Yu, and S\. Yan \(2026b\)G\-memory: tracing hierarchical memory for multi\-agent systems\.Advances in Neural Information Processing Systems38,pp\. 12988–13018\.Cited by:[§2\.2](https://arxiv.org/html/2607.13884#S2.SS2.p1.1)\. - G\. Zhang, J\. Wang, J\. Chen, W\. Zhou, K\. Wang, and S\. Yan \(2025\)AgenTracer: who is inducing failure in the llm agentic systems?\.arXiv preprint arXiv:2509\.03312\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p2.1)\. - A\. Zhao, D\. Huang, Q\. Xu, M\. Lin, Y\. Liu, and G\. Huang \(2024\)Expel: llm agents are experiential learners\.InProceedings of the AAAI Conference on Artificial Intelligence,Vol\.38,pp\. 19632–19642\.Cited by:[§5\.1\.2](https://arxiv.org/html/2607.13884#S5.SS1.SSS2.p1.1)\. - L\. Zheng, R\. Wang, X\. Wang, and B\. An \(2024\)Synapse: trajectory\-as\-exemplar prompting with memory for computer control\.InInternational Conference on Learning Representations,Vol\.2024,pp\. 19036–19066\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p1.1)\. - X\. Zheng, Z\. Chen, C\. Lin, H\. Wei, H\. Chen, W\. Cheng, and D\. Luo \(2026\)Trajectory graph copilot: pre\-action error diagnosis in llm agents\.External Links:[Link](https://openreview.net/forum?id=ighxnB6nJF)Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p2.1)\. - K\. Zhu, Z\. Liu, B\. Li, M\. Tian, Y\. Yang, J\. Zhang, P\. Han, Q\. Xie, F\. Cui, W\. Zhang,et al\.\(2025\)Where llm agents fail and how they can learn from failures\.arXiv preprint arXiv:2509\.25370\.Cited by:[§1](https://arxiv.org/html/2607.13884#S1.p2.1),[§2\.1](https://arxiv.org/html/2607.13884#S2.SS1.p2.1)\. ## Appendix ADetails for constructing action decision graph Figure 6\.A concrete example for constructing action decision graph\. Nodes/ Edges with different colors represent different types of actions/ observations\.Algorithm 1Building Action Decision GraphInput: Trajectoryτ=\(q,o0,a1,o1,…,am,om\)\\tau=\(q,o\_\{0\},a\_\{1\},o\_\{1\},\\dots,a\_\{m\},o\_\{m\}\)and its rewardrr\. Output: GraphG=\(V,E,q,r\)G=\(V,E,q,r\)with node attributes\(k,araw\)\(k,a^\{\\text\{raw\}\}\)and edge attributesss; labelsℓn,ℓe\\ell\_\{n\},\\ell\_\{e\}assigned post\-hoc\. 1: s←normalize\(o0\)s\\leftarrow\\text\{normalize\}\(o\_\{0\}\)// current valid state 2: last←vinitlast\\leftarrow v\_\{\\text\{init\}\}// virtual INIT node 3: Φ←\{\}\\Phi\\leftarrow\\\{\\\}// map from action tuple to node 4:for t=1t=1to mmdo 5: k←normalize\(atraw\)k\\leftarrow\\text\{normalize\}\(a\_\{t\}^\{\\text\{raw\}\}\); keep raw text atrawa\_\{t\}^\{\\text\{raw\}\} 6:if k∉Φk\\notin\\Phithen 7:Create new node vvwith \(k,atraw\)\(k,a\_\{t\}^\{\\text\{raw\}\}\); Φ\[k\]←v\\Phi\[k\]\\leftarrow v 8:else 9: v←Φ\[k\]v\\leftarrow\\Phi\[k\]// reuse node 10:endif 11:Add edge \(last,v\)\(last,v\)with attribute ss\(i\.e\., set s\(last,v\)=ss\_\{\(last,v\)\}=s\) 12: o~←normalize\(ot\)\\tilde\{o\}\\leftarrow\\text\{normalize\}\(o\_\{t\}\) 13:if o~\\tilde\{o\}is validthen 14: s←o~s\\leftarrow\\tilde\{o\}; last←vlast\\leftarrow v 15:endif 16:endfor 17:Set G\.q←qG\.q\\leftarrow q, G\.r←rG\.r\\leftarrow r 18:return GG Algorithm[1](https://arxiv.org/html/2607.13884#alg1)details the procedure of constructing the directed action decision graph\. Figure 6 demonstrates a concrete example of how to transform the sequential raw exploration trajectoryene\_\{n\}into directed action decision graphGnG\_\{n\}, whereoio\_\{i\}represents observations andaia\_\{i\}represents actions\. In the raw trajectoryene\_\{n\}, observationso2o\_\{2\}ando3o\_\{3\}are uninformative \(e\.g\., “nothing happened” in ALFWorld\), indicating that actionsa2a\_\{2\}anda3a\_\{3\}are both invalid attempts under the same valid observationo1o\_\{1\}\. The subsequent actiona4a\_\{4\}is a valid action also taken undero1o\_\{1\}\. If we directly applied graph edit distance to the raw sequential trajectory, we would deleteo2,o3,a2,a3o\_\{2\},o\_\{3\},a\_\{2\},a\_\{3\}; however, aso2o\_\{2\}ando3o\_\{3\}carry no meaningful information, the resulting edit path would produce an insight such as “under observationo2o\_\{2\}do not takea3a\_\{3\}”, which is meaningless\. The correct insight should be “under observationo1o\_\{1\}, avoida2a\_\{2\}anda3a\_\{3\}”\. To capture this, we introduceparallelizing consecutive invalid actions: all actions that follow the same valid stateo1o\_\{1\}without changing the environment are connected in parallel from the same previous valid node\. Hencea2a\_\{2\},a3a\_\{3\}, anda4a\_\{4\}all receive edges froma1a\_\{1\}with the same edge labelo1o\_\{1\}\. This makes the graph edit path directly indicate which actions are invalid undero1o\_\{1\}\. Additionally, we observe that the same core action may be taken under different observations\. To better model this, we proposenode reuse: if a normalized action appears later in the trajectory \(e\.g\.,a7a\_\{7\}is the same action asa4a\_\{4\}\), we do not create a new node; instead, we connect the incoming edge \(carryingo6o\_\{6\}\) directly to the existing node of that action \(a4a\_\{4\}\)\. This allows a single node to collect multiple incoming edges with different observation labels, revealing under which conditions that action is appropriate\. ## Appendix BAlgorithm of extracting common subgraph and graph edit path Given a node matchingMMbetween two directed labeled graphsGGandG′G^\{\\prime\}\(obtained via the FGW solver\), the following two algorithms extract structured knowledge from the matched graphs\. Algorithm[2](https://arxiv.org/html/2607.13884#alg2)constructs the common subgraph by retaining only those edges inGGwhose both endpoints are matched and whose corresponding edge exists inG′G^\{\\prime\}with an identical edge label\. This yields the set of actions that are already correct under the same observation, i\.e\., the successful workflow\. Algorithm[3](https://arxiv.org/html/2607.13884#alg3)derives a complete graph edit path fromMM\. It collects unmatched nodes \(deletions fromGGand insertions fromG′G^\{\\prime\}\), node label mismatches \(relabelings\), and edge mismatches \(missing edges, extra edges, or label differences\) to produce edge deletions, insertions, and relabelings\. All collected operations together form a legal edit path that transformsGGintoG′G^\{\\prime\}\. Unlike classical methods designed for undirected graphs without edge labels, our algorithms explicitly handle directed edges and edge labels, preserving the semantic information carried by observations\. Algorithm 2Extract Common Subgraph from Node MatchingInput: Directed labeled graphsG=\(V,E,ℓn,ℓe\)G=\(V,E,\\ell\_\{n\},\\ell\_\{e\}\),G′=\(V′,E′,ℓn′,ℓe′\)G^\{\\prime\}=\(V^\{\\prime\},E^\{\\prime\},\\ell\_\{n\}^\{\\prime\},\\ell\_\{e\}^\{\\prime\}\), and a node matchingM:V↦V′M:V\\mapsto V^\{\\prime\}\(injective on matched nodes\)\. Output: Common subgraphGc=\(Vc,Ec\)G\_\{c\}=\(V\_\{c\},E\_\{c\}\)whereVc⊆VV\_\{c\}\\subseteq V\(matched nodes\) andEc⊆EE\_\{c\}\\subseteq E\(edges preserved under matching\)\. 1: Vc←\{u∈V∣M\(u\)defined\}V\_\{c\}\\leftarrow\\\{u\\in V\\mid M\(u\)\\text\{ defined\}\\\} 2: Ec←∅E\_\{c\}\\leftarrow\\emptyset 3:foreach edge \(u1,u2\)∈E\(u\_\{1\},u\_\{2\}\)\\in Ewith u1,u2∈Vcu\_\{1\},u\_\{2\}\\in V\_\{c\}do 4: \(v1,v2\)←\(M\(u1\),M\(u2\)\)\(v\_\{1\},v\_\{2\}\)\\leftarrow\(M\(u\_\{1\}\),M\(u\_\{2\}\)\) 5:if \(v1,v2\)∈E′\(v\_\{1\},v\_\{2\}\)\\in E^\{\\prime\}and ℓe\(u1,u2\)=ℓe′\(v1,v2\)\\ell\_\{e\}\(u\_\{1\},u\_\{2\}\)=\\ell\_\{e\}^\{\\prime\}\(v\_\{1\},v\_\{2\}\)then 6:Add \(u1,u2\)\(u\_\{1\},u\_\{2\}\)to EcE\_\{c\} 7:endif 8:endfor 9:return GcG\_\{c\} Algorithm 3Derive Graph Edit Path from Node MatchingInput: Same as Algorithm[2](https://arxiv.org/html/2607.13884#alg2)\. Output: Graph edit operation setsΔndel,Δnins,Δnrelab,Δedel,Δeins,Δerelab\\Delta\_\{n\}^\{\\text\{del\}\},\\Delta\_\{n\}^\{\\text\{ins\}\},\\Delta\_\{n\}^\{\\text\{relab\}\},\\Delta\_\{e\}^\{\\text\{del\}\},\\Delta\_\{e\}^\{\\text\{ins\}\},\\Delta\_\{e\}^\{\\text\{relab\}\}\. 1: Δndel←\{u∈V∣M\(u\)undefined\}\\Delta\_\{n\}^\{\\text\{del\}\}\\leftarrow\\\{u\\in V\\mid M\(u\)\\text\{ undefined\}\\\} 2: Δnins←\{v∈V′∣M−1\(v\)undefined\}\\Delta\_\{n\}^\{\\text\{ins\}\}\\leftarrow\\\{v\\in V^\{\\prime\}\\mid M^\{\-1\}\(v\)\\text\{ undefined\}\\\} 3:foreach matched pair \(u,v\)\(u,v\)with M\(u\)=vM\(u\)=vdo 4:if ℓn\(u\)≠ℓn′\(v\)\\ell\_\{n\}\(u\)\\neq\\ell\_\{n\}^\{\\prime\}\(v\)then 5:Add \(u,ℓn\(u\),ℓn′\(v\)\)\(u,\\ell\_\{n\}\(u\),\\ell\_\{n\}^\{\\prime\}\(v\)\)to Δnrelab\\Delta\_\{n\}^\{\\text\{relab\}\} 6:endif 7:endfor 8:foreach edge \(u1,u2\)∈E\(u\_\{1\},u\_\{2\}\)\\in Ewhere M\(u1\),M\(u2\)M\(u\_\{1\}\),M\(u\_\{2\}\)defineddo 9: \(v1,v2\)←\(M\(u1\),M\(u2\)\)\(v\_\{1\},v\_\{2\}\)\\leftarrow\(M\(u\_\{1\}\),M\(u\_\{2\}\)\) 10:if \(v1,v2\)∉E′\(v\_\{1\},v\_\{2\}\)\\notin E^\{\\prime\}then 11:Add \(u1,u2\)\(u\_\{1\},u\_\{2\}\)to Δedel\\Delta\_\{e\}^\{\\text\{del\}\} 12:else 13:if ℓe\(u1,u2\)≠ℓe′\(v1,v2\)\\ell\_\{e\}\(u\_\{1\},u\_\{2\}\)\\neq\\ell\_\{e\}^\{\\prime\}\(v\_\{1\},v\_\{2\}\)then 14:Add \(u1,u2,ℓe\(u1,u2\),ℓe′\(v1,v2\)\)\(u\_\{1\},u\_\{2\},\\ell\_\{e\}\(u\_\{1\},u\_\{2\}\),\\ell\_\{e\}^\{\\prime\}\(v\_\{1\},v\_\{2\}\)\)to Δerelab\\Delta\_\{e\}^\{\\text\{relab\}\} 15:endif 16:endif 17:endfor 18:foreach edge \(v1,v2\)∈E′\(v\_\{1\},v\_\{2\}\)\\in E^\{\\prime\}where M−1\(v1\),M−1\(v2\)M^\{\-1\}\(v\_\{1\}\),M^\{\-1\}\(v\_\{2\}\)defineddo 19: \(u1,u2\)←\(M−1\(v1\),M−1\(v2\)\)\(u\_\{1\},u\_\{2\}\)\\leftarrow\(M^\{\-1\}\(v\_\{1\}\),M^\{\-1\}\(v\_\{2\}\)\) 20:if \(u1,u2\)∉E\(u\_\{1\},u\_\{2\}\)\\notin Ethen 21:Add \(v1,v2\)\(v\_\{1\},v\_\{2\}\)to Δeins\\Delta\_\{e\}^\{\\text\{ins\}\} 22:endif 23:endfor 24:return Δndel,Δnins,Δnrelab,Δedel,Δeins,Δerelab\\Delta\_\{n\}^\{\\text\{del\}\},\\Delta\_\{n\}^\{\\text\{ins\}\},\\Delta\_\{n\}^\{\\text\{relab\}\},\\Delta\_\{e\}^\{\\text\{del\}\},\\Delta\_\{e\}^\{\\text\{ins\}\},\\Delta\_\{e\}^\{\\text\{relab\}\} ## Appendix CDiscussion about the robustness of graph edit path We further analyze the robustness of our graph edit path extraction \(Algorithm[3](https://arxiv.org/html/2607.13884#alg3)\)\. The overall graph matching procedure relies on the FGWAlign solver\(Tanget al\.,[2025](https://arxiv.org/html/2607.13884#bib.bib26)\), which may not always produce the globally optimal node correspondence\. According to the original FGWAlign evaluation, for graph pairs with tens of nodes, the recall of the predicted edit path against the ground‑truth shortest path is around 90%\. It is important to clarify that a recall below 100% does not imply an invalid edit path\. Given any node matchingMM\(optimal or suboptimal\), Algorithm[3](https://arxiv.org/html/2607.13884#alg3)always generates a*legal*edit path: applying the returned insertions, deletions, and relabelings to the source graphGGexactly yields the target graphG′G^\{\\prime\}\. The only difference is that a suboptimal matching may lead to a longer path \(i\.e\., more edit operations\) than the shortest possible one\. Recall measures how many of the operations in the shortest path are preserved in our derived path; the remaining operations are legitimate but redundant alternatives\. Consequently, our method is highly robust to matching inaccuracies\. Even when the node matching is not optimal, the extracted correction instructions remain valid and can successfully repair the failed trajectory\. In the extreme \(and practically improbable\) case where the node matching is completely wrong — for instance, every node inGGis matched to an unrelated node inG′G^\{\\prime\}— Algorithm[3](https://arxiv.org/html/2607.13884#alg3)will produce an edit path that essentially deletes all actions of the failed trajectory and inserts \(or relabels\) all actions of the expert trajectory\. The resulting insight reduces to “follow the successful trajectory entirely”, which, although not leveraging partial correctness, still provides a correct and executable plan\. Hence, even under the worst possible matching, our framework offers a safe fallback\. This robustness, together with the high empirical recall of the matching solver, guarantees that EMG reliably produces useful correction knowledge across a wide range of scenarios\. ## Appendix DNotations Table 4\.Summary of key symbols\.
Similar Articles
ExpGraph: Model-Agnostic Experience Learning with Graph-Structured Memory for LLM Agents
ExpGraph is a model-agnostic framework that enables LLM agents to reuse past experiences via a self-evolving graph of skills and failures, improving task performance by 12–21% without retraining the executor.
@neural_avb: Here's the latest paper on Graph Memory on LLM agents
A new paper introduces Graph Memory for LLM agents.
Memory is Reconstructed, Not Retrieved: Graph Memory for LLM Agents
MRAgent introduces a novel graph-based memory framework that dynamically reconstructs memory during reasoning, achieving up to 23% improvement on long-horizon benchmarks while reducing computational costs.
MemGym: a Long-Horizon Memory Environment for LLM Agents
MemGym is a benchmark for evaluating memory formation in LLM agents over long-horizon tasks, unifying existing agent gyms and synthetic pipelines with memory-isolated scores. It spans tool-use dialogue, multi-turn search, coding, and computer use, and includes a lightweight reward model (MemRM) for efficient evaluation.
MemEvoBench: Benchmarking Memory MisEvolution in LLM Agents
MemEvoBench introduces the first benchmark for evaluating memory safety in LLM agents, measuring behavioral degradation from adversarial memory injection, noisy outputs, and biased feedback across QA and workflow tasks. The work reveals that memory evolution significantly contributes to safety failures and that static defenses are insufficient.