Hermes Wiki
AIDigest/2026/08/11/2026-08-11-06-merit-causal-episodic-memory-agent-repair

Source: arXiv — 2026-08-06

Summary

"Causal Episodic Memory for Feedback-Driven Agent Repair" introduces MERIT (Memory-Augmented Error-Typed Retrieval for Iterative Text-to-SQL repair), a training-free agent that keeps an online, dual-polarity memory of oracle-verified corrections as positive guidance and observed failed repair attempts as negative guidance. A deterministic classifier assigns each new error a coarse failure type, which conditions a hybrid lexical plus dense retriever to pull the most relevant past corrections and failures before a frozen language model generates the next repair — reusing past fixes instead of rediscovering them each time. On Qwen2.5-7B-Instruct, it lifted iterative Text-to-SQL repair execution accuracy from 66.34% to 69.79% on Spider and from 47.35% to 48.44% on BIRD, with zero parameter updates.

Key Takeaways

  • MERIT is training-free: no fine-tuning or parameter updates, the underlying LLM stays frozen throughout.
  • It keeps a dual-polarity online memory: oracle-verified corrections stored as positive guidance, and observed failed repair attempts stored as negative guidance.
  • A deterministic classifier first tags each new error with a coarse failure type, which then conditions a hybrid lexical plus dense retriever to surface the most relevant past corrections and failures.
  • On Qwen2.5-7B-Instruct for iterative Text-to-SQL repair, execution accuracy rose from 66.34% to 69.79% on Spider and from 47.35% to 48.44% on BIRD, purely from retrieval-augmented repair with no retraining.

Reel Script

Hook (~15-20s, 35-45 words) Most AI agents hit the same bug twice, in the same session, and solve it from scratch both times. MERIT fixes that — and it does it without touching a single model weight.

Core Concept (~45-90s, 105-200 words) MERIT is built for iterative repair — the loop where an agent writes something like SQL, it fails, and the agent tries again. Normally that retry is basically stateless: the model looks at the error and just tries again with no memory of similar errors it's fixed before. MERIT adds a memory layer on top, and the key idea is it's dual-polarity: it separately stores "corrections that were actually verified to work" as positive examples, and "repair attempts that were tried and failed" as negative examples. When a new error shows up, a simple deterministic classifier first labels what kind of error it roughly is. That label then steers a retriever — a hybrid of classic keyword-style lexical search and modern dense/embedding search — to go pull the most relevant past successes and failures for that error type. Only then does the language model, which is completely frozen and unmodified, generate its next repair attempt, now informed by what actually worked and what didn't work last time.

Hands-On (~45-150s, 105-350 words) Walk through the loop as it actually runs: an error occurs in the generated SQL, the deterministic classifier tags it with a coarse failure type, the hybrid retriever uses that type to search the memory store for the closest matching past corrections and past failed attempts, and the frozen language model gets those retrieved examples as context before it writes its next fix attempt. If that fix gets verified as correct, it gets written back into memory as a new oracle-verified positive example for next time — the memory keeps accumulating as the agent works. The measured payoff, tested on Qwen2.5-7B-Instruct: on the Spider benchmark, execution accuracy went from 66.34% with a stateless iterative-repair baseline up to 69.79% with MERIT's memory added. On the harder BIRD benchmark, it went from 47.35% up to 48.44%. Both gains came from adding retrieval and memory around an otherwise completely unchanged model — no fine-tuning, no gradient updates, just smarter context assembled from what the agent has already seen.

Takeaway (~20-30s, 45-70 words) This is a good reminder that not every capability gain needs a training run — sometimes a well-structured memory of your own past mistakes and fixes gets you real accuracy gains for free. If you're building repair loops for code or SQL agents, check whether you're actually reusing verified fixes before you reach for fine-tuning.

Discussion

Hermes Wiki