SpecForge:基于行为规范的编码智能体递归自我改进
SpecForge: Recursive Self-Improvement for Coding Agents via Behavioral Specifications
AI总结:
本研究提出SpecForge多前沿树搜索框架,通过三种机制解决编码智能体递归自我改进中的输出耦合问题,在DevEval+上实现最优性能,且改进后的规范可迁移至跨语言翻译等任务。
摘要:
基于冻结语言模型的编码智能体可通过优化其依赖的外部上下文提升性能,无需更新模型权重。本研究探讨通过行为规范实现的递归自我改进:行为规范是描述程序实体行为、指导智能体生成正确代码的自然语言代码文档。我们构建了一个自我改进循环,其中智能体基于当前规范生成代码,通过执行验证的测试对代码进行评估,并基于观测到的失败案例优化规范;改进后的规范随后指导后续代码生成,逐步提升智能体对代码库的理解。然而,递归优化存在挑战,因为程序实体相互依赖,优化某一实体的规范可能会意外降低其他实体的正确性,我们将此现象称为输出耦合,这会产生打地鼠效应——局部改进导致其他地方出现退化,阻碍持续进步。我们提出SpecForge,这是一个多前沿树搜索框架,通过三种机制应对该挑战:(i)帕累托引导的状态选择,保留互补的规范状态,避免过早确定;(ii)依赖约束的实体选择,优先采用被调用方先于调用方的优化顺序;(iii)错误多样化扩展,利用不同的测试失败子集探索多种优化方案。在DevEval+基准测试中,SpecForge在五个骨干模型中取得最佳性能,其中Claude-4.5-Sonnet的解决率达94.9%,比最强基线平均提升5.7个百分点。改进后的规范还使智能体在循环外的任务中表现更优:它们可迁移到跨语言翻译和新功能实现任务,在这些任务中性能优于基准提供的需求文档。
英文摘要:
Coding agents based on frozen language models can improve their performance by refining the external context they rely on, without updating model weights. We study recursive self-improvement through behavioral specifications: natural-language code documentation that describes the behavior of program entities and guides agents in generating correct code. We formulate a self-improvement loop in which an agent generates code from its current specifications, evaluates it with execution-verified tests, and refines the specifications based on observed failures. The improved specifications then guide subsequent generation, progressively improving the agent's understanding of the codebase. However, recursive refinement is challenging because program entities are interdependent. Improving the specification of one entity can inadvertently degrade the correctness of others, a phenomenon we call output coupling. This creates a whack-a-mole effect in which local improvements cause regressions elsewhere, preventing consistent progress. We introduce SpecForge, a multi-frontier tree search framework that addresses this challenge with three mechanisms: (i) Pareto-guided state selection preserves complementary specification states and prevents premature commitment; (ii) dependency-constrained entity selection prioritizes callee-before-caller refinement; and (iii) error-diversified expansion explores multiple refinements using different subsets of test failures. On DevEval+, SpecForge achieves the best performance across five backbone models, including a 94.9% solve rate with Claude-4.5-Sonnet and a 5.7-percentage-point average improvement over the strongest baseline. The improved specifications also make the agent better at tasks outside the loop: they transfer to cross-language translation and to new-feature implementation, where they outperform the benchmark-provided requirement documents.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。