做LLM记忆系统或长上下文推理的开发者,终于有了一个能自动定位记忆错误根因的工具,还能自动优化提示提升性能,值得试试这个开源方案。
MemTrace 提出了一种新框架,将大语言模型的记忆管道转化为可执行的记忆演化图,实现细粒度的操作信息流追踪。研究团队构建了 MemTraceBench 基准,涵盖长上下文、RAG、Mem0 和 EverMemOS 等代表性记忆系统,系统分析记忆失败模式。该方法通过迭代追踪操作子图自动归因错误根因,发现记忆失败源于操作级问题如信息丢失和检索错位。利用归因信号指导下游提示优化,形成闭环系统,自动修正错误并提升端任务性能最高达7.62%。代码已开源。
MemTrace: Tracing and Attributing Errors in Large Language Model Memory Systems
Memory is essential for enabling large language models to support long-horizon reasoning, yet existing memory systems remain unreliable and difficult to debug. Tracing memory's dynamic evolution is crucial to understand how information is synthesized, propagated, or corrupted over time. In this work, we study the new problem of error tracing and attribution in LLM memory systems. We propose a novel framework that transforms memory pipelines into executable memory evolution graphs, enabling fine-grained tracing of operational information flow. We then construct MemTraceBench, a benchmark collected from representative memory systems such as Long-Context, RAG, Mem0, and EverMemOS, to systematically study memory failure modes. We further introduce an automatic attribution method that iteratively traces operation subgraphs to pinpoint the root cause of any failed case. Our analysis reveals that memory failures are systematic, stemming from operation-level issues like information loss and retrieval misalignment. Crucially, we leverage these fine-grained attribution signals to guide downstream prompt optimization, establishing a closed-loop system that automatically corrects faults and boosts end-task performance by up to 7.62%. Code will be released at https://github.com/zjunlp/MemTrace.