This research introduces Experience Memory Graph (EMG), a method that uses graph-theoretical mathematics to perform one-shot error correction for AI agents. Instead of relying on LLMs to reflect on failures (which is expensive and unreliable for small models), EMG represents failed and successful agent trajectories as directed action decision graphs, then applies the Fused Gromov-Wasserstein algorithm to mathematically compute structural edits needed to transform failure into success. These corrections are stored offline in a database and retrieved during test time, enabling efficient error correction without costly reflection loops.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
From LOOPS to GRAPHS: AI Agents Learn Graph-Based Error Corrections
Added:Hello community. So great that you are back. Today we have a brand new research paper on the interface of memory optimization with graph structures. So let's have a look. This is the complete idea of this new paper and we're going to talk about this and in about 5 minutes time you will understand absolutely everything here beautifully.
But first yeah we humans we still need some papers and here you have it published July 15, 2026. experience here a memory graph optimization with a oneshot error correction for our agents and this is here by the University of Electronic Science and Technology of China in Changdu and I said where is Changdu and I said oh here look at this wow absolutely fascinating so today we have a paper from this particular experts so let's start my last video I showed you here MIMO harness where we talked about an agent harness that learns here from experience how to configure its perfect optimal harness for a particular task. And this here was here the YouTube thumbnail if you want to find it and have a look at this. And now we talk again about Maymo.
Why again memory? Well, it turns out it is the most important thing for agents and for the harness dynamics. Now I showed you mimo harness learns what harness configuration to deploy for a new task. This means the context construction all the different tools that we need the complete orchestration of the agents and sub aents all the memory dynamic and the memory creation all the generation settings and all the output processing and more.
And you might say so what is now the main new idea of this preprint here from our Chinese colleagues? Well it is simple. We move now from text to graph structures. So we move from something that we have no mathematic on like text.
We move to something where we have graph theory in mathematics and we are much more precise. This is here today the big jump. So let's have a look.
EMG this means experience memory graph learns now what action level correction and workflows to inject into the agent.
So it compares here a failed trajectory with guess what an expert good trajectory. It represents both here as a graph as a directed action decision graph with our node and edge structure and it computes here mathematically the structural edits to acquire good required to transform the failure into a success.
Those correction are stored offline and can be retrieved before a new execution.
And you might say why why we have to do this? Yeah. What is this status quo? Now currently if an agent fails you know you say hey you failed reflect on why you failed and try again and you hope that the LLM is intelligent enough for this.
But as it turns out especially for small LLMs like four or eight billion free trainable parameter models that you have locally on your laptop. This has two flaws. At first, this runs a incredible expensive because running here LLM multiple times per test case, this really gets through all your tokens and second, as I told you, it relies on your particular LLM being smart enough to diagnose its own hallucination. And guess what? Small LLMs are simply not excel at this particular task. They're not as good as here a fable five and they get stuck in infinite error loops.
And just to make it a little bit more traumatic, look those are the loops that we have here. We have the LLM core and then we have here in the harness just going crazy here the area loop. So you burn token millions of token but you get no result at all. So what is the solution to this? Now the new idea is to shift another error correction from this nice LLM guesswork of next token prediction in a natural human language like English to something much more stronger to a deterministic mathematical graph matching algorithm. So you immediately understand where we are now. Do not ask an agent to verbally reason why it failed. Present the failed behavior and the correct behavior as graphs. Mathematically compute now the structural difference here in a mathematical space between those two different sort of graphs and store the difference as a reusable correction memory for the next task that you have.
You see this is the solution as simple as can be and I put here an exclamation mark that you know exactly this is the way forward.
So you say wait a minute how do we learn this on graphs? Now we have here we run some tests. Now we have a failed graph where here the agent failed to find a solution. We have a lot of dead ends and wrong ends and whatever. And then we have a cor graph where we come really to a success. And now the task seems to be simple. No, we just compare the complexity of this graph structure.
Sometimes the graph has 10,000 nodes or up to millions of nodes and you see hey wait a minute maybe this is not such a simple mathematical process. So how can we optimize this?
So you see instead of asking here the LLM to guess what went wrong and you really only depend here on the LLM if you want pre-trained knowledge the new researcher have now two if you want inputs into the learning process. They have the failed exploration of the agent. You know this is here the failed graph and guess what then they have the successful expert trajectory and this was the blue graph on the right hand side. So they take now both for this contrastive [clears throat] learning here and they convert both of these timelines into direct action decision graphs where the nodes are the action like here take the apple and the edges are simply the environmental observation like on the table. simple then they use something here like a fused gram of vaserstein algorithm. So this is now if you want the exact mathematical algorithms to compute here the differences between these different graph structures and now the solution is simple the overlapping parts of these two graph become now the common subgraph. So this is the correct workflow that you know this is done correctly here also in the failed graph.
Let's say from the step one to the step 25 this is the correct path forward and then starting maybe at step 25 you see now a difference in the graph structure and this difference has become now the graph edit paths. So the exact action that needs to be deleted maybe or some inserted some new ideas or maybe completely releabeled under specific observation in order to turn the failure graph into a success graph.
Now this particular vasstein distance is here a as I told you a rigorous mathematical engine that allows now the system to compare the shape and the content of the AI behavior itself over the little py of doing this here in graph theory completely eliminating here the need for an LLM like in my last video to hey guess in my little AI system where did you make the mistake or where did the other AI make the mistake.
So we do not rely on a blackbox CI but we have a mathematical model now. So how do they do this? Simple. They feed both graphs into this algorithm. Now and the algorithm iteratively shuffles the node around in a particular mathematical space and guess what trying to minimize the fused cost. So you see we have here again an optimization uh mathematical procedure like in the training of EI until it finds the optimal soft assignment matrix.
Now I might say what is it? Let's have a look. Simple. The matrix is a grid showing here the probability that the node I in the field graph in the red graph corresponds to the node J in the expert graph in the blue graph. And because of the vasstein part, it correctly maps here the identical action to each other. And you might say great, but we also need the grammar of part because it represents here the timeline.
So if you want the observation edges, it won't accidentally map here the take the apple action from step two to a take the apple action at step 50 when the complete environment change and I have complete different timeline because the structural penalty would simply be too high under the gram of such time optimization.
I ask here and this is here an AI generator graph. I don't paint this.
Some ask me do you do this? No, I just give you the instruction here to my AI system to build this. So a fused grammar fashion. Yeah, of course we have to fuse it. I will explain to you why. And here we have an align graph by fusing the node content and the structure. So let's start. We have here again our red graph, our graph G that is not successful. Then we have the graph G dash, the blue graph that is successful. And now fused, you got it. We have here what they call here the note cost. This is here a content or a feature dissimilarity and then we have the structure cost function and this is a pair-wise relational dissimilarity function and then we just fuse it together. Guess what? So now let's have a closer look. So let's start here with the red one. We treat our nodes as act as actions and the edges as observation conditioned transitions. So the dense red structure in the image suggests here since it's red okay some wrong action branches maybe some repeated actions maybe some incorrect loop maybe some dead ends here and some transition that differ here from the expert policy that you see here in blue now blue the nodes may not occur as you see in the same order as of G because this is G dash it may also contain some additional actions some missing actions some different branches some different edge structure.
We have different node or edge labels [snorts] at all and a different number of nodes entirely. And now you might say okay but how can we compare these two different graph structures? Well this is now the beauty because now with this few squ of algorithm we can do this even if the two graphs are not isomorphic.
So let's have a look. Now just want to tell you the half here the transport or the the heat map as I call it here is the most important object here. Because guess what? Its rows corresponds to the nodes of G and its columns correspond to the nodes of G dash. And a bright cell position that is really lighting up in the dark at a position I K means simply the node I in G corresponds to the note K in G dash with a relative high matching strength. So you see here in a mathematical object here of a simple matrix how this note structure is connected here between G and G dash. Now please note yeah I just ask you for a diagonal heat map because it was able to produce this but it does not have to be diagonal. No you can have some misplaced diagonals. You have multiple clusters in this or you have diffuse pattern. This is not that we talk about diagonalization vector and value cooperation. This is something different. Yeah. So and then we have here as I told you the note cost function. So what it does yeah you see here a beautiful function but what is the core idea it simply asks hey does the transport plan associate semantical compatible nodes and it is simple that a coupling that assigns a large mass to semantically incompatible nodes receives a high cost.
So we know now this here about the node costs but you notice immediately hey wait a minute you can have two actions with the identical labels. No let's say G3 and G3 and maybe another one while occupying complete different causal position here in this graph structures.
So somehow we have to take care about this different positioning in the graph itself. No and this is now where our structure cost function comes into play.
The structure cost panel here in blue here pairwise relational dissimilarity is simple. What does it ask? It asks okay if I is matched with K and J is matched with L are the relationship from I to J and K to L compatible with each other. And this is the essence if you want the main idea of the grammar style matching. It compares relation within one space to relation within the other space rather than requiring both graphs to live in a shared coordinate system where we have at first to have a mapping function to a unique mathematical space.
We can leave those function in their space and with grom compare it.
Yeah. And the central objective combines now these two signals. So we have the node cost and the structure cost function now combine in the guess what fused gram of vaserstein objective and you see this is exactly here where we have the node compatibility now combined with the relational compatibility and this is here a simple explanation of a rather complex mathematical idea but of course you might say okay can you show me here the pure mathematics of this of This is it. But you see, I just explained you this single mathematical formula here in simple English words so that everybody can understand. Even if some of my viewers were whenever I see a mathematical equation, I somehow am a little bit afraid. You see how simple and easy it was. It is just two terms and now you understand exactly what each term is doing. But of course, we can transport this mathematical equation into the human language. And this sentence simply means, hey, a good note correspondence is not merely one that connects semantically similar nodes, but it was also map relational neighbors in one graph onto compatible relational neighbors to another graph or another graph section. This is all that it tells you.
Now, if you want the building algorithm for this action decision graph, here we go. And of course we just talked about this for the extract comments upgra for the node matching here. This is your part one. This is the red part and this here is our blue part. If you want to see this here in this code. So this means for that alignment the system can now determine what was already correct and this is here the common graph subgraph and what must be deleted inserted or relabeled or modified here on our graph structure so that that our G becomes closer structurally isomorphic to G dash.
Now here we see not the complete process. No so we have in our testing here. Yeah, this is here in the training time especially important this is here all in the training because we then want to employ it here at inference time. So therefore we have to prepare the training data and minute to training we have the failed exploration trajectories where the agent is not able to come up with a correct solution and then we have the successful trajectories and all of these training samples and the dense training materials. We build here our trajectories and of course if the system fails we get failed trajectories where we have dead end or you simply see this is not working from the successful trajectories we have here the perfect no we have a working graph structure it is not the optimal graph structure but more about this later but it's working and we find a solution and then we do exactly what we just talked about we have this graph matching this alignment engine where we see Okay, we have here in green our common subgraph and then in red we have the parts we identified the node and the edges are not identical in G and G dash and therefore we take have to take care about them and therefore we start building here our final solution graph what we call here EMG experience memory graph this is it as simple as can be but of course we don't throw go away. Whatever we learned during the way, we use here each and every element and we even the failures. We put it in a database. So we know exactly what did not work in a particular task in a particular situation at a particular complexity level. And you guess what exactly the more we build this up the more we have insight how to build next time a better graph structure. Faster, less token and higher precision.
And now in this time reading here the paper I had an open question. I said but wait a minute we are just now comparing G&G dash. But what about how do we come up with a new mathematical graph structure for the non-ommon sub graph part for the open part? No that has no solution because now the system has more or less to find a new path on an unknown graph complexity for my particular problem in theoretical physics. No. But how is the system doing this? And I continue to read here in the paper and it simply turned out well it's not doing at all because remember I talked to you that this memory database this offline database is here built during the training. So this means how is the training data structured. So this means for every task in the training set they have two things. They have the failed attempts.
This is our graph G the red graph and then the expert trajectory the blue graph our G dash. Now either the authors of this paper had human provided solution or some from some data set or some internet solution data set provided golden expert trajectories. So therefore you understand the algorithm is not exploring an unknown infinite state space to search for the optimal solution and have then search optimization algorithms but we have already the correct solution and we just have at the beginning of our agent who has no idea how to do it. It fails, it fails, it fails and then we bring it closer and closer here to the expert trajectory on a graph structure, not on a textbased structure.
So strictly computing here the shortest bridge between the two known graphs and if you want graph G the red one is where the agent ended up incorrectly and the graph G dash the blue one is where the agent should have ended up.
Now remember I showed you here exactly this derive graph edit p from the node matching how we find out exactly how we build and modify here G to arrive at G dash. Now this code I transfer now here into single simple human words. So let's have a look what is happening. The zip system scans here the mismatch parts here and categorizes them into three distinct mathematical sets. This is the simplest set. You can have as much as you want. At first you have the deletions, then you have the insertions and then you have the reabeling. Why?
Now this a simple operation that will bring us to the next step in our procedure. Now let's look first at the deletions. The node and the edges that exist in the failed graph but have no mathematical port in the expert graph.
So this simply means hey delete this action. No because it's not here in the expert solution. So you my little agent you're on the complete wrong track.
Insertion note and edges that exist in the expert graph are totally missing in the failed graph. So we know we have missing parts of the solution. So therefore we say as a rule hey insert this particular actions and then we have a re lababeling. So this means here fgw matched a node in g to a node in g dash because they occurred in the exact same structural place in the timeline but their texture labels are different. So let's say for example under observation y you choose put a pencil on a table but the expert choose put a pencil on the shelf. So therefore we have now a releabeling from table to shelf. You see simple operation but you notice something. This is not anymore a mathematical operation. It is based on a graph mathematical operation. But now we are developing rules and rules are formulated in English. And now we are going back and I think this is the weak point here or the a weaker point here in this beautiful paper that we move now into. You get it?
Embedded spaces. But before I have a closer look, let's have a result. Let's see how good is it. Now we have alpha world and we have science world and we have the average performance. And you see for a Q3 4 billion mile you have here all the other miles. And here in the pink line you have your EMG our new methodology. Just look at the average here at the last column and you see okay all the other elements here at the 20 somethings and our new methodology is at 40. So first indication okay that seems interesting but you might say hey wait a minute why exactly is it here better and especially if you look here at the time costs of the seen science world and of the unseen science world you see the time cost here in minutes. Our new methodology hardly wastes any time. Look at the other reflection here. Almost four times as much time here for a particular success rate. And you might ask why? So why is it happening? Now think about it. It's easy. By formulating now the error correction as a set of I just showed you this delta the discrete statebound edit operators derived here from the expert templates.
The mathematical complexity collapses absolutely as I told you we lose the mathematical precision when we move back to the human language now at test time. So when the agent faces your genuine unknown task and the expert trajectory is no longer available, it doesn't need to do any graph mat. Why? Well, you have seen the operation. It simply takes the current task searches now in a database where we have all this human language correction that resulted here from the graph operation. It searches here this vector database applies a simple cosine similarity and pulls out this premputed edit path from the training task that look similar and this solution that come out of our vector database are now passed to the LLM to the prompt of the LLM as again human text like hey avoid making error X here instead do this Y and again you see how close it is to skills No, when we have skills in markground files and we have skills that we put here in databases or in vector databases, we embed here the skill configuration in vector databases, it is always more or less the same basic idea how we can operate here on artificial intelligence complexities.
So I think that we take here this beautiful graph result and then force it back into a human language and put this human language instruction into a database. Okay, take a normal database or a vector database doesn't matter and then we just extract here this textual instruction based on a cosign similarity from the task description. I think this is this is the weak point in the paper.
Let's talk about limitations.
Now this new methodology does not guarantee the discovery of the global minimal transformation. It is not the best graphical structure we will detect.
No, because it depends on the training data and maybe in the training data set we had just an average solution that works. No, but it was not the energy minimal or the time minimal or the token minimal solution. It was just average.
So since we are based here on the training data set we have no idea if this is really a global minimum in our manifold complexity and second when we have unseen task the system more or less breaks apart because this new methodology does not construct the unknown correct graph because it was not in the training data set. So we just can hope that in the similarity of our known vector embedding space of our synthetic mathematical space the similarity gives us an indication or maybe this is close to another solution and maybe this provides now the next step in our solution path or maybe not.
So this is here this is also rather weak and then at test time the correct graph is genuinely unknown but EMG does not reconstruct it at all mathematically.
Yeah, because we had the training time where the beautiful mathematical graph operation take place and we fed all the results from the training time into our database. And now at test time, we don't do any uh algebra at all or any graph structure at all. We just go to the database and have a rag retrieval from a database and it retrieves the correction principles learned from the previous known graph pairs during the training time and relies here on the LLM now to apply this new instruction to the new task. Big question mark will the LLM exceed succeed will it be able to understand the complexity of the instruction from another task or not?
So you see during test time compute there's zero graph mathematic happening and I think this is yet the weak point and at test time it is strictly a vector database lookup and we are back to the rag system from 5 years ago and I think we have better ideas how to do this particular step but what I love in this paper is the first step in the training time the training time to map this here on a graph structure and apply here an advanced algorithm here to compare the graphs and find exactly here for nonisomorphic graph here a coherent development path. This is a beautiful solution.
Anything left? Yes, of course. So by pushing all the complex mathematical graph operation to the offline training phase, EMG achieves here what they call now the authors call a oneshot execution because everything that they trained their model on and remember this training here is now a graph structure that they built is now what becames becomes now the content of the database of the vector database and yeah you can send around this database file here to any other machine.
Now think about my paper yesterday and this paper of today and you'll see that is the exact same test time philosophy that also the Mayo harness of yesterday uses. No. So both preprints yesterday was here from America and this was here from China. Both preprints and just a day apart they were published. Both realize that the secret to deploying some autonomous agent development isn't giving them more time to think when a user ask you a particular question but giving them a massive instantly retrievable database of precomputed lessons.
So this means we fall back to known solution. We do not have the artificial intelligence to find novel unique unseen solution. All breaks down, all falls back to the same old patterns that we discovered already years ago, to the same code solution from years ago. And we never make this evolutionary step forward to a higher complexity level to a unique never seen before code solution or a mathematical explanation or an explanation in physics in medicine in finance. So whenever you have this second part that you have to go back here to database structures and you just rely maximum here on a combinatorial alteration of all the solution path in a database and you hope then there suddenly some intelligent emerges out of the dark. Well I guess this would be a non-scientific approach. So therefore the first part of this paper was beautiful. I highly recommend it. I have some doubts here on the uniqueness on the second part of the paper because you see like in memorus they have went here with the same test time idea of a vector database and I think we have overcome this already 3 years ago. I hope you had a little bit of fun. Oh, I still have something left. Okay, test inference.
What is happening? Okay, yeah, why not?
So when a user actually deploys the agent and gives it a brand new task, the system drops all the graph matt says no graph mat anymore takes the user prompt passes it through an embedded model to get here a particular query vector embedded in the correct mathematical space. Let's say a24 dimensional space.
It runs a simple co and similarity search here with the 20 nearest neighbor against the offline memory database where hopefully this database were trained on your particular domain on your comp particular complexity class.
Then it retrieves the pre-transated pre-transated pre-solved natural language insights and then it stuffs this text string like a classical rack system into the agent prompt context.
And I think this is not up to current end of July 2026.
Compare multiple papers. You can learn so much of this. I think the Mayo harness introduces a dynamic system configuration of the harness around our core LLM. EMG introduces here something completely different and let's call it an algorithmic error routing. And if you were building here the ultimate production grade AI agent, let's end on a positive note and why not combine both of them. So I would use now the MIMO harness rackbased control layer for the configuration of the harness elements around the core to dynamically configure here the agent memory and all the tools and then I would use here if I'm forced to do this here use MG's graph matching inside the agent procedural memory to ensure it executes the precise sequence of action without needing costly reflection loops here in the test runtime.
So you can save a lot of time and money if you have this solution already found.
But the negative point is you have a fallback to known solution and therefore not unique solutions that were discovered by the intelligence of our artificial intelligence but it was just more or less a lookup table. This is the part that I don't really think is up to our times.
So if you ask here what are they fixing?
What is here the elements while you use them? Memo harness looks at the agent failure and assumes it is a structural failure of the harness configuration itself. EMG looks at a failure of an agent and assume it is an internal decision failure. So it assumes that the agent has the right tools but pushes here the wrong button. So it asks under observation X did the agent choose the action Y when it should have chosen the action Z. So it fixes here the action sequence based on known solution.
And why this EMG works so well on tiny models like a four billion parameter model here in the experiments of the paper is because the hard work of the reflection on all the mathematical graph engineering is done by mathematics already in the training phase and then all their insight is stored in the database and therefore you don't have to do with a 4 billion parameter any mathematics at all at the test time at the inference time you just have to look up here the results in a database. So this is beautiful. You have no big calculation but the neural networks parameter of your 4 billion parameter LLM because everything is outsourced.
The intelligence and the knowledge is here in the database and I imagine this here similar to the skill MD bank where exactly the the path forward know how to how to construct the code solution is exactly in the skill MD files and this is now done here on a higher level. I showed you yesterday here on the configuration here of the harness structure itself. And now we went into the decision framework here to have here for long running task here for if you go 3 hours or maybe 20 hours here that you stay in a coherent solution path forward. I hope you enjoyed it. I hope there were some new ideas. Maybe you disagree with my personal reflection here on the second part here with the vector databases here. In anyway, I hope there was something that you found it interesting. It would be great to see you in my next video.
Related Videos

Expanding Stikbot thumbnails
leopoldshorts
2K views•2023-09-24

Digital Discrimination: Cognitive Bias in Machine Learning
redmonktechevents2974
4K views•2019-12-18

Evolutionary Approach to Clustering by Ujjwal Maulik
ICTStalks
279 views•2019-06-26

Rose Yu "Learning from Large-Scale Spatiotemporal Data"
networkscienceinstitute
2K views•2019-03-04

Stanford Seminar - Generalization through Task Representations with Foundation Models
stanfordonline
4K views•2025-07-14

Satellite-Based Wheat Yield Forecasting using GEE & Transformer Neural Network
gisrsinstitute
634 views•2025-06-15

Paradigm Shifts in Data Processing for the Generative AI Era: Robert Nishihara of Anyscale & Ray.io
GradientFlow
2K views•2025-01-02

How to Build Your Own GenAI-Based Knowledge Management System
2150GmbH
360 views•2025-06-03
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23