← Latest papers
💬 NLP

Causal Episodic Memory for Feedback-Driven Agent Repair

The paper introduces MERIT, a training-free agent that leverages a dual-polarity causal episodic memory of verified corrections and failed attempts to guide hybrid retrieval for Text-to-SQL repair, achieving modest execution accuracy improvements over stateless methods on Spider and BIRD benchmarks without requiring model parameter updates.

Original authors: Khang Nhat Hoang Vo, Tam Minh Chu, Anh Trac Duc Dinh, Thuyen Vinh Ha Bui, Tho Quan

Published 2026-08-07
📖 4 min read☕ Coffee break read

Original authors: Khang Nhat Hoang Vo, Tam Minh Chu, Anh Trac Duc Dinh, Thuyen Vinh Ha Bui, Tho Quan

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a robot to write instructions for a database, a task known as "Text-to-SQL." Think of this robot as a very smart but forgetful apprentice. When the robot makes a mistake, a teacher (the "oracle") points it out and says, "No, that's wrong." The robot tries again, fixes the error, and moves on. But here's the catch: once the robot fixes a specific mistake, it often forgets how it solved it. If a similar mistake happens later with a different question, the robot has to rediscover the solution from scratch, wasting time and energy. This is the problem of "stateless" repair—learning in the moment but not remembering for the future.

To fix this, scientists have tried giving robots "memories." Some methods let the robot keep a diary of its thoughts (reflections), while others let it look up past examples of similar questions. The big question is: how do we organize this memory so the robot actually learns? If the robot just grabs any old memory that looks similar, it might find a solution that failed before or confuse a success with a failure. The goal is to build a memory system that helps the robot learn from its past victories and avoid its past pitfalls, without needing to retrain its entire brain (which is expensive and slow).

This is where the paper "Causal Episodic Memory for Feedback-Driven Agent Repair" comes in. The authors introduce a new system called MERIT (Memory-Augmented Error-Typed Retrieval for Iterative Text-to-SQL repair). Think of MERIT as a super-organized librarian for our forgetful robot. Instead of just dumping all past attempts into a messy pile, MERIT sorts them into two distinct bins: a "Green Bin" for solutions that were proven to work, and a "Red Bin" for directions that were tried and failed.

Here is how the magic happens: When the robot makes a mistake, a simple, rule-based "classifier" (like a traffic cop) quickly tags the error with a broad category, such as "Syntax Error" or "Missing Table." Then, the librarian (the retriever) looks into the Green Bin and Red Bin for past mistakes that had the same tag. It mixes a quick keyword search (looking for exact word matches) with a deeper "semantic" search (understanding the meaning) to find the best past example. The robot then uses this past example to fix its current problem. Crucially, the robot can only use memories from finished episodes in the past; it cannot peek at its own unfinished work or future attempts. This ensures the learning is "causal"—it only learns from what has already happened.

The researchers tested this on two big datasets of database questions: Spider (1,034 questions) and BIRD (1,534 questions). They used a standard robot brain (Qwen2.5-7B-Instruct) and gave it a budget of 7 attempts to fix each question. The results were a mix of success and nuance. On the Spider dataset, MERIT was a clear winner, boosting the robot's success rate from 66.34% to 69.79%. This suggests that having a structured memory of past fixes really does help the robot solve new, similar problems.

However, the story gets a bit more complicated on the BIRD dataset. Here, MERIT improved the score slightly from 47.35% to 48.44%, but the evidence was weaker. Interestingly, a different memory style called "Reflexion-style" (which relies on the robot writing out long verbal reflections about what went wrong) actually performed better on BIRD, reaching 51.24%, though it was much more expensive in terms of computing power. The paper suggests that while MERIT is great for certain types of errors, there isn't one single "perfect" memory system for every situation.

The authors also ran experiments to see which parts of MERIT were doing the heavy lifting. They found that the "Red Bin" (negative memory of failed attempts) didn't help much on its own. The real power came from organizing memories by the type of error and keeping them local to the specific database schema (the structure of the data). When they tried to use memories from completely different databases, the robot's performance dropped, showing that specific, local experience is more valuable than general, cross-database analogies.

In the end, the paper concludes that giving an agent a structured, causal memory of its past repairs is a powerful way to improve without retraining. It suggests that while we can't just throw all past experiences at the robot and expect it to work, organizing those experiences by "what went wrong" and "what worked" creates a reliable path to better performance. It's a reminder that for AI agents, remembering how they fixed a mistake is just as important as fixing the mistake itself.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →