为本地大模型代码代理设计可验证的记忆与检索控制器,提升修复能力。
PYTHALAB-MERA: Validation-Grounded Memory, Retrieval, and Acceptance Control for Frozen-LLM Coding Agents

- 用外部控制器管理记忆、选择技能并验证候选代码
- 在严格验证环境下9次测试通过8次,远超基线的0次
- 适合需要高可靠性的本地化代码生成场景
基于本地大模型的代码代理在需执行反馈、持久状态和有限修复的环境中运行,单一流畅回答已不足够。静态检索、长上下文提示、自精炼、执行反馈修复及权重强化学习分别应对部分需求,但缺乏可验证的叙事记忆、自适应检索-动作选择、延迟信用分配和围绕冻结模型的结构化技能复用。本文提出PYTHALAB-MERA,一个轻量级外部控制器,用于实现验证驱动的代码生成。冻结语言模型生成完整源文件,控制器决定哪些记忆记录和基于抽象语法树(AST)的技能进入下一轮提示,通过快速失败流水线验证候选代码,将验证结果转化为有界奖励,并使用TD(lambda)风格的资格迹传播延迟信用。我们在具有严格验证门控的强化学习编码任务中评估该实现作为本地命令行工具的表现。在三个任务、三轮重复、每次最多三次尝试的硬强化学习设置中,PYTHALAB-MERA成功通过8/9次严格验证;自精炼基线和所考察的GRACE扩展均通过0/9次。这些结果支持一个谨慎结论:在此特定设置中,外部记忆与检索控制器提升了验证成功率。但未证明通用代码合成、顶尖性能、形式化程序正确性或形式化安全性。
原文摘要 · Abstract (English)
Local LLM-based coding agents increasingly work in settings where correctness is earned through execution feedback, persistent state, and bounded repair, not through a single fluent answer. Static retrieval, long-context prompting, self-refinement, execution-feedback repair, and reinforcement learning over model weights each address part of this setting, but they do not jointly provide validation-grounded episodic memory, adaptive retrieval-action selection, delayed credit assignment, and structural skill reuse around a frozen local model. We introduce PYTHALAB-MERA, a lightweight external controller for local validation-conditioned code generation. The frozen language model proposes complete source files; the controller decides which memory records and AST-derived skills should enter the next prompt, validates each candidate through a fail-fast pipeline, converts validation outcomes into bounded shaped rewards, and propagates delayed credit through TD(lambda)-style eligibility traces. We evaluate the implementation as a local CLI artifact on reinforcement-learning coding tasks with strict validation gates. In the measured hard RL setting with three tasks, three repetitions, and a three-attempt budget, PYTHALAB-MERA passed 8/9 strict validations; the self-refinement baseline and the investigated GRACE extension each passed 0/9. These results support a deliberately bounded claim: in this recorded setting, the external memory-and-retrieval controller improved validation success. They do not establish general-purpose code synthesis, state-of-the-art performance, formal program correctness, or formal safety.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。