跳转至

文章背景与核心概要

传统的检索增强生成(RAG)系统缺乏时间模型,当代码在编程会话中发生事实变更(例如重命名函数、移动端点或升级依赖项)时,它们往往表现不佳。RAG 经常检索到相似度几乎完全相同的新旧值,无法识别哪个才是当前有效的数据,最终导致提供已被淘汰的过时信息。

本文端到端地验证了 MemStrata——一种确定性的 (subject, relation, object) 替代记忆机制,并将其应用于真实的软件历史中。该方法在 707 个真实的 GitHub Issue 上进行了评估,成功消除了陈旧事实错误,同时保持了与 RAG 相当的检索延迟。


真实软件历史中的时间有效性:基于GitHub修复消除代码助手记忆中的陈旧事实错误

作者: Neeraj Yadav
提交时间: 2026年8月21日
arXiv: 2608.20685 [cs.SE]


📌 执行摘要

Traditional Retrieval-Augmented Generation (RAG) systems lack a temporal model, meaning they struggle when facts change over the course of a coding session (e.g., renamed functions, moved endpoints, or bumped dependencies). RAG frequently retrieves both old and new values with near-identical similarity, failing to identify which one is current and ultimately serving superseded data.

This paper validates MemStrata—a deterministic (subject, relation, object) supersession memory mechanism—end-to-end using real software history. Evaluated across 707 real GitHub issues, the approach successfully eliminates stale-fact errors while maintaining RAG-level retrieval latency.

传统检索增强生成(RAG)系统缺乏时间模型,这意味着当代码在编程会话期间发生事实变更(例如重命名的函数、移动的端点或升级的依赖项)时,它们往往难以应对。RAG 经常会检索到相似度几乎完全相同的新旧值,无法识别哪个是当前有效的值,最终提供的是已被替代的数据。

本文通过真实的软件历史,端到端地验证了 MemStrata(一种确定性的 (subject, relation, object) 替代记忆机制)。通过对 707 个真实的 GitHub Issue 进行评估,该方法成功消除了陈旧事实错误,同时保持了 RAG 级别的检索延迟。


🔍 核心发现与性能

  • Dataset: Extracted 130 clean atomic state transitions (fixes altering a single identifiable value from pre-fix to post-fix form) from 707 real GitHub issues (SWE-bench Lite + Verified).
  • Accuracy:
  • MemStrata: 0.91 answer accuracy.
  • Standard RAG: 0.57 – 0.59 answer accuracy.
  • Stale-Fact Error Rates:
  • Standard RAG forces the retrieval of superseded values 36% to 38% of the time.
  • Applying an LLM reranker does not help solve this issue.
  • MemStrata drives this error rate down to ~0%.
  • Latency: MemStrata operates at standard RAG retrieval latency (~2.1s), vastly outperforming LLM rerankers (~18s).
  • 数据集: 从 707 个真实的 GitHub Issue(SWE-bench Lite + Verified)中提取了 130 个干净的原子状态转换(即从修复前到修复后仅修改单个可识别值的修复)。
  • 准确率:
  • MemStrata: 0.91 的回答准确率。
  • 标准 RAG: 0.57 – 0.59 的回答准确率。
  • 陈旧事实错误率:
  • 标准 RAG 在 36% 到 38% 的情况下会强制检索已被替代的值。
  • 应用大模型重排器(LLM reranker)无法帮助解决此问题。
  • MemStrata 将此错误率降至 ~0%
  • 延迟: MemStrata 的运行延迟与标准 RAG 检索延迟相当(约 2.1 秒),远远优于大模型重排器(约 18 秒)。

🛠️ 范围与局限性

  • Scope: Approximately 18% of real software fixes consist of clean atomic transitions. This paper isolates the memory mechanism specifically for this class.
  • Future Work: Extraction coverage for the remaining complex fixes is recognized as an orthogonal problem deferred to follow-on research.
  • Robustness: During the study, a real product bug (concerning case/punctuation-insensitive value comparison) surfaced and was successfully fixed, verifying that the core "moat property" (deterministic-supersession accuracy on clean code mutations) remains preserved.
  • 研究范围: 大约 18% 的真实软件修复包含干净的原子转换。本文专门针对此类别的记忆机制进行了隔离研究。
  • 未来工作: 针对其余复杂修复的提取覆盖率被认为是一个正交问题(orthogonal problem),留待后续研究探讨。
  • 鲁棒性: 在研究期间,出现了一个真实的产研漏洞(涉及不区分大小写/标点符号的值比较)并被成功修复,这验证了核心的“护城河属性”(在干净代码变异上的确定性替代准确性)得以完美保持。

🔗 链接与资源