Hello, welcome. This is a big room, so if you're in the back, don't hesitate to come closer. My name is Stefania Druga. I'm a research scientist at Sakana AI in Tokyo. I used to be based here, and AI Engineering is home community for me before Hyperloop. So it's very good to be back. Today I'm going to talk to you about memory harnesses for long-running research agents on device.
If you work with long-horizon tasks, you probably ran into this issue of context blow, right? When the model starts contradicting itself, or it has to redo the work because it forgot it did that task in the first place. Or it starts to drift from your questions because it forgot them. This matters now more than ever because, from these recent projections from Meter, we see that the trend is to solve longer and longer horizon tasks and also that we're getting fewer and fewer model releases. At some point later this year, we're going to have this convergence, right? Where we'll get many more long-term horizon tasks and fewer model releases.
That makes this issue of dealing with context rot a priority. Why did I want to tackle this problem on local models and with a local harness? Maybe some of you have seen this tweet. It's only two days old. The CEO of Coinbase actually shared how their company managed to reduce their AI spend while actually increasing AI usage. The way they did that was by transitioning to use many more local models, but also having better practices like using better routing, better caching, keeping the context clean, and then having better visibility for what people are using it for, what kind of task.
We are seeing the local models crossing the line, right? GLM is on everyone's minds, especially with Fable going away. Deep Seek v4 Flash can now be run on M3 Ultra. There's still a bottleneck for RAM. It's tricky. But these local models are starting to be useful for agentic tasks and for tool use.
I wanted to show you what has been my setup for the experiments I'm going to share with you today. This is my Mac. It's still running evaluations right now, back at my desk in Tokyo. And I'm controlling it from my phone. After running evals non-stop for a couple of days, it started to get hot, so I had my husband put fans around it. We're running out of fans. But the machine is still running, and the evals are still giving results. On this M3 Ultra with 96 gigabytes and 28 core CPUs, I'm using two models. I'm using the QN 27B quantized at 4-bit and the Deep Seek v4 Flash.
Before I show you how I built the memory harness on this machine, I wanted to tell you what this loop is an example of. Memory, when we design a harness for memory, this is the mental model I want you to have in mind. You can think of memory as a write, manage, read loop. It's not just the database store. It's actually this control loop around the model.
More concretely, how did I take that loop and customize it? This is my harness design. I started with research agents that are the small agents because they have zero durable memory. I wanted all the memory to come from the harness. In the middle, I have a core, which is always shown to the agent of traces. Then I have a recall block where I'm testing different modes, and an archival block where I'm keeping track of information across different sessions.
In that recall block, I'm actually going through a ladder of modes that I'm testing. The baseline is not to use memory at all, no recall at all. So I'm testing for that. Next is to use RAG, vector, vector RAG, just to see whatever the harness would pull in terms of similarity. Then is to use a decisions ledger, where I actually keep track of what decisions are being made for every turn. Then I can prioritize them. Last but not least, and this piece is very important, I have what I call an oracle. This is the ground truth. This is telling the harness for every loop what the correct memory that needs to be retrieved is.
The model is fixed across all the different tasks. So the only things that I'm changing are these different variables in the recall block.
I wanted to give you an example of a first task that I tested. I wanted to see if I give the agent a task of doing literature review, and I'm including a lot of papers in the corpus where there was a big scientific claim. This is actually a Nature paper where they said they discovered 742,000 promising materials. It was a very big claim, which got retracted later. But the retraction is a much smaller haystack needle in that corpus than the headlines and the citations. So I wanted to see if the system can retrieve the right answer for these types of questions.
What I found was because, for these tasks, all the papers and all the information fit into the context, the memory actually didn't add more capability. It was the same performance with memory and without memory. It only added more cost. So when your task fits in context, the harness doesn't add much. However, if I start to run tasks that are longer-term horizon and the entire task and the relevant context don't fit, then having a good memory harness really starts to pay off.
This is another example of a task that I ran. This is actually from an established benchmark for long-horizon task memory. It's called XBench. This is an example of a question, right? I'm asking a question, and the right answer is step 124. But the moment when I ask the question, I'm asking it at step 500. So it's completely outside of the context window. The model needs to use the memory harness to retrieve the specific answer from the right step. I'm testing this by changing the different policy ladder that I explained before, with memory off, by deploying recall, different types of recall, and by using the oracle as a reference.
What I found was that with the ranked recall, the model gets the right answer more frequently than without. Here's a breakdown of the decomposition of performance on this XBench task. I ran over 68 questions. For each of these questions, there were multiple cells and lots of different seeds. What I found was that the rank-only ledger performed the best. It performed better than just gating the harness by saying, do you need to use memory or do you not need to use memory?
You're probably going to ask why the oracle is not hitting the max, and I'm going to explain that too. The oracle, what it does, is provide the right information, the right memory to the model, but it doesn't force it to use it. So the model can get the right memory but still retrieve the wrong information, or choose to ignore it or be confused. That's why the oracle, in this case, doesn't hit the max performance.
I've done lots of ablations on these tasks to see what happens if I give arbitrary examples, what happens if I give it the wrong step, what happens if I give it the most recent step. I still found that the best-performing condition was the one with the ranked policy for recall. This actually works on several models, not only on the QN27B but also on the DS4 Flash, and it also works across different benchmarks. I also tried it on the Spider V2 benchmark.
It's not just that it gives you better recall, it actually costs less. Maybe a good heuristic to have here is that bad memory is expensive because it spends more token and it can send the agent the wrong way. But having a good structural policy for recall can save you a lot of tokens and budget.
One thing that I want to encourage you from this experiment is to consider the recall policy as a first-class metric, and to start to think about how you might use it in your systems. What are the types of memories that you want to store? How do you rank them? How do you design your recall function? Then, what survives when you run this over and over and over, and multiple sessions, multiple runs? This is just a simple first experiment. But the memory technique landscape is very rich. There's over 30 runnable cookbooks that are shared in this open-source repository from Diamond.
Memory is complex. We have short-term, long-term, different cognitive techniques. We can start to use evaluation results as well. Right now, there's actually a pretty broad landscape of solutions, right? Going from simple file system retrieval to training memory models, there's a wide spectrum of solutions from less structural to completely structured. I think there's a lot of research we're going to see in this space.
It's important. It becomes more and more relevant. For me, it's been super fun to test this on local models because I got to control everything. I got to control the data I was using, the entire traces of compute and evaluations. I see that as an example of sovereignty. It comes at a cost. I didn't tell you that these local models, I can only run them in serial. They don't support batch querying for the Deep Seek v4 Flash. That's why I'm still running evaluations back on my computer in Tokyo. Or I was doing it on the flight on my way here, because it takes a long time.
But I still think it's very powerful, and it's a very good test for what memory can do when you can control every single step of the pipeline. Sovereign capability is part of a bigger ecosystem that is very important for us at Sakana AI in Japan. We believe in the importance of sovereign AI today more than ever. We are also hiring. If you're interested and want to hear more about this, and if you want to come join us in Japan, come talk to me. Thank you very much. always shown to the agent of traces. And then I have a recall block where I'm testing different modes. And an archival block where I'm keeping track of information across different sessions.
And in that recall block, I'm actually going through a ladder of modes that I'm testing. The baseline is, like, not to use memory at all. No recall at all. So I'm testing for that. Next is to use rag, vector, vector rag, just to see whatever, like, the harness would pull in terms of similarity. Then is to use a decisions ledger, where I actually keep track of what decisions are being made for every turn. And then I can prioritize them. And last but not least, and this piece is very important, I have what I call an oracle. But basically, this is the ground truth. So this is, like, telling the harness for every loop what the correct memory that needs to be retrieved is.
And the model is fixed across all the different tasks. So the only things that I'm changing is, like, these different variables in the recall block. And I wanted to give you an example of a first task that I tested. So I wanted to see if I give the agent a task of doing literature review. And I'm including a lot of papers in the corpus where there was a big scientific claim. Like, this is actually a nature paper where they said they discovered 742,000 promising materials. Like, it was a very big claim, which got retracted later. But the retraction, it's as much smaller like haystack needle in that corpus
than the headlines and the citations. So I wanted to see if the system can retrieve the right answer answer for these type of questions. And what I found was because, like, for these tasks, all the papers and all the information fit into the context, the memory actually didn't add more capability. It was the same performance with memory and without memory. And it only added more cost. So when your task fits in context, the harness doesn't add much. However, if I start to run tasks that are longer-term horizon and the entire task and the relevant context doesn't fit, then having a good memory harness really starts to pay off.
So this is another example of a task that I ran. This is actually from an established benchmark for a long horizon task memory. It's called XBench. And this is an example of a question, right? So I'm asking a question, and then, like, the right answer is, you know, like, step 124. But the moment when I ask the question, I'm asking it, like, at step 500. So it's completely outside of the context window. And the model needs to use the memory harness to retrieve the specific answer from the right step. So I'm testing this by changing the different policy ladder that I explained before with memory off,
by deploying recall, different types of recall, and by using the oracle as a reference. And what I found was that with the ranked recall, the model gets the right answer more frequently than without. And here's a breakdown of the decomposition of performance on this XBench tasks. So I ran over 68 questions. And for each of these questions, there were, like, multiple multiple cells and lots of different seeds. And what I found was that the rank-only ledger performed the best. And it performed better than, like, just gating the harness by saying, do you need to use memory or do you not need to use memory?
And you're probably going to ask, like, why is the oracle not hitting, like, the max? And I'm going to explain that too. So the oracle, what it does, it provides the right information, the right memory to the model, but it doesn't force it to use it. So the model can get the right memory, but still retrieve the wrong information, or choose to ignore it or be confused. So that's why the oracle, in this case, doesn't hit the max performance. And I've done lots of ablations on these tasks to see, like, what happens if I give arbitrary examples? What happens if I give it the wrong step? What happens if I give it the most recent step? And I still found that the best performing
condition was the one with the ranked policy for recall. And this actually works on several models, not only on the QN27B, but also on the DS4 Flash, and it also works across different benchmarks. I also tried it on the Spider V2 benchmark. And it's not just that it gives you better recall, it actually costs less. So maybe a good heuristic to have here is that bad memory is expensive because it spends more token and it can send agent the wrong way. But having, like, a good structural policy for recall can save you a lot of tokens and budget. So one thing that I want to encourage you from this experiment is to consider the recall policy as a
first-class metric. And to start to think about how you might use it in your systems. Like, what are the type of memories that you want to store? How do you rank them? Like, how do you design your recall function? And then, what are the type, what survives when you run this over and over and over? And multiple sessions, multiple runs. And this is just a simple first kind of experiment. But the memory technique landscape is very rich. So there's over 30 runnable cookbooks that are shared in this open source repository from Diamond. And memory is complex. We have short-term, long-term, different cognitive techniques. We can start to use evaluation results as well.
And right now, there's actually a pretty broad landscape of solutions, right? So going from simple file system retrieval to training memory models, there's a wide spectrum of solutions from less structural to completely structured. So I think there's a lot of research we're going to see in this space. It's important. It becomes more and more relevant. And for me, it's been super fun to test this on local models because I got to control everything. I got to control the data I was using, the entire traces of compute and evaluations. And yeah, I see that as an example of sovereignty.
And it comes at a cost. I didn't tell you that these local models, I can only run them in serial. Like they don't support batch querying for the DeepSync v4 flash. So that's why I'm still running evaluations back on my computer in Tokyo. Or I was doing it on the flight on my way here because it takes a long time. But I still think it's very powerful. And it's a very good test for what memory can do when you can control every single step of the pipeline. Sovereign capability is part of a bigger ecosystem that is very important for us at Sakana AI in Japan. We believe in the importance of sovereign AI today more than ever. And we are also hiring. So
if you're interested and want to hear more about this, and if you want to come join us in Japan, come talk to me. Thank you very much.
So So So So So So So So So So So