学习何时记忆:风险敏感的上下文老虎机用于具有回避意识的记忆检索的LLM编码代理
Learning When to Remember: Risk-Sensitive Contextual Bandits for Abstention-Aware Memory Retrieval in LLM-Based Coding Agents
AI总结:
本文提出RSCB-MC方法,通过风险敏感的上下文老虎机机制,解决编码代理在记忆检索中的安全性和有效性问题,实现非注入和回避作为首要安全动作。
摘要:
大型语言模型(LLM)基于的编码代理越来越多地依赖外部记忆来重用先前的调试经验、修复轨迹和本地仓库操作知识。然而,检索的记忆只有在当前故障与先前故障真实兼容时才有用;堆栈轨迹、终端错误、路径或配置症状的表面相似性可能导致不安全的记忆注入。本文将问题-记忆使用重新表述为一种选择性、风险敏感的控制问题,而非纯粹的Top-K检索问题。我们引入了RSCB-MC,一种风险敏感的上下文老虎机记忆控制器,决定代理是否应使用无记忆、注入顶部解决方案、总结多个候选、执行高精度或高召回率检索、回避或请求反馈。系统通过模式-变体-回合模式存储可重用的问题知识,并将检索证据转换为固定16特征的上下文状态,捕捉相关性、不确定性、结构兼容性、反馈历史、误报风险、延迟和令牌成本。其奖励设计对误报记忆注入的惩罚比遗漏重用更强,使非注入和回避成为首要安全动作。在确定性烟雾规模的实验中,RSCB-MC获得最强的非 oracle 离线回放成功率,62.5%,同时保持0.0%的误报率。在有限的200案例热点验证中,它达到60.5%的代理成功率,0.0%的误报率和331.466微秒p95决策延迟。结果表明,对于编码代理记忆,关键问题不仅在于哪个记忆最相似,而是任何检索的记忆是否足够安全以影响调试轨迹。
英文摘要:
Large language model (LLM)-based coding agents increasingly rely on external memory to reuse prior debugging experience, repair traces, and repository-local operational knowledge. However, retrieved memory is useful only when the current failure is genuinely compatible with a previous one; superficial similarity in stack traces, terminal errors, paths, or configuration symptoms can lead to unsafe memory injection. This paper reframes issue-memory use as a selective, risk-sensitive control problem rather than a pure top-k retrieval problem. We introduce RSCB-MC, a risk-sensitive contextual bandit memory controller that decides whether an agent should use no memory, inject the top resolution, summarize multiple candidates, perform high-precision or high-recall retrieval, abstain, or ask for feedback. The system stores reusable issue knowledge through a pattern-variant-episode schema and converts retrieval evidence into a fixed 16-feature contextual state capturing relevance, uncertainty, structural compatibility, feedback history, false-positive risk, latency, and token cost. Its reward design penalizes false-positive memory injection more strongly than missed reuse, making non-injection and abstention first-class safety actions. In deterministic smoke-scale artifacts, RSCB-MC obtains the strongest non-oracle offline replay success rate, 62.5%, while maintaining a 0.0% false-positive rate. In a bounded 200-case hot-path validation, it reaches 60.5% proxy success with 0.0% false positives and a 331.466 microseconds p95 decision latency. The results show that, for coding-agent memory, the key question is not only which memory is most similar, but whether any retrieved memory is safe enough to influence the debugging trajectory.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。