arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.36153cs.SEcs.AI
收藏

Stratum:超越上下文窗口的编码智能体仓库内存

Stratum: Repository Memory for Coding Agents Beyond the Context Window

Brock University(布鲁克大学);University of Ottawa(渥太华大学)

Yuvraj Sehgal, Mahsa Panahandeh, Naser Ezzati-Jivan

AI总结:

该研究针对编码智能体无跨会话记忆的问题,提出Stratum分层仓库内存架构,实验显示其能显著提升根本原因识别成功率并降低令牌成本。

摘要:

上下文窗口已增长了千倍,但编码智能体每次会话仍从无过往工作记忆开始。它们会重新读取文件、重试失败的方法,还会忘记数小时前确定的根本原因。这并非上下文长度问题,而是内存架构问题。我们的假设是:编码智能体需要持久的、感知经验的仓库内存,以便知识能在会话间留存。对真实仓库的三项测量为设计提供了依据:第一,中型项目已超出最大的生产上下文窗口,将知识存储在模型的键值(KV)缓存中,其字节成本是存储为索引文本的10^4至10^5倍;第二,在752个真实的bug修复提交中,中位数修复编辑了2个文件,这些文件及其直接导入内容占仓库的比例不到10%,瓶颈在于选择而非容量;第三,即便考虑传递导入可达性和测试链接,仍有47%的共同编辑文件对在结构上不相连,选择所需的知识必须从历史和经验中挖掘。我们设计了Stratum,这是一种与仓库共存的分层内存,通过页面安全工具为其服务:每次响应都会说明返回了什么、剩余什么以及成本多少。对100万个节点的存储进行检索,中位数耗时1.7毫秒。在针对8个真实bug的多会话实验中,继承了由不同模型编写的前一会话内存的新智能体,在24次试验中识别出根本原因文件的次数为21次,而仅检索的基线为6次(Fisher检验p<10^-4),中位数令牌成本降低了4.5倍。将所有8次调查的笔记汇总到一个存储中时,成功率仍为8/8。

英文摘要:

Context windows have grown a thousand-fold, yet coding agents still start every session with no memory of their past work. They re-read files, retry failed approaches, and forget root causes they established hours earlier. This is not a context-length problem but a memory-architecture problem. Our hypothesis: coding agents need persistent, experience-aware repository memory, so that knowledge survives from one session to the next. Three measurements on real repositories motivate the design. First, mid-size projects already exceed the largest production context windows, and storing knowledge inside the model's key-value (KV) cache costs $10^4$ to $10^5$ times more bytes than storing it as indexed text. Second, across 752 real bug-fix commits, the median fix edits two files, and these files plus their direct imports amount to less than 10% of the repository; the bottleneck is selection, not capacity. Third, even with transitive import reachability and test links, 47% of co-edited file pairs remain structurally disconnected; the knowledge needed for selection must be mined from history and experience. We sketch Stratum, a tiered memory that lives with the repository and serves it through page-safe tools: every response states what was returned, what remains, and what it cost. Retrieval over a store of one million nodes takes 1.7 ms at the median. In a multi-session experiment on eight real bugs, a fresh agent that inherited a prior session's memory, written by a different model, identified the root-cause file in 21 of 24 trials versus 6 of 24 for a retrieval-only baseline (Fisher $p<10^{-4}$), at 4.5x lower median token cost. With the notes of all eight investigations pooled in one store, success remained 8/8.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑