Self-Evolving Coding Agents via Harness-Policy Optimization
作者: Zhepei Wei, Wenlin Yao, Baolin Peng, Danqing Wang, Qianhui Wu, Hao Cheng, Yu Meng, Jianfeng Gao
分类: cs.CL, cs.AI
发布日期: 2026-10-16
💡 一句话要点
提出自我进化编码代理以解决编码任务中的优化问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 自我进化 编码代理 强化学习 策略优化 工具优化 大型语言模型 性能提升
📋 核心要点
- 现有的编码代理方法在策略和工具的优化上存在局限,单独优化一个组件无法有效应对另一个组件的变化。
- 本文提出Self-HPO框架,通过策略自我分析失败并提出新工具候选,交替进行工具和策略的优化。
- 在三个编码基准测试中,Self-HPO的表现优于传统方法,平均解决率显著提升,并且在不同设置中保持良好性能。
📝 摘要(中文)
大型语言模型(LLM)代理在编码任务中展现出良好的潜力,其性能由策略模型和调节其与环境交互的工具(harness)共同决定。现有方法中,仅优化其中一个组件往往效果不佳。为此,本文提出了自我优化框架Self-HPO,通过交替优化工具和策略,使得策略能够自我分析失败并提出新的工具候选。实验表明,Self-HPO在三个编码基准测试中均优于仅优化工具或策略的基线,平均解决率从57.8%提升至64.8%,并且在分布外设置中也表现出良好的泛化能力。
🔬 方法详解
问题定义:本文旨在解决现有编码代理在策略和工具优化中的相互依赖问题。现有方法往往只优化其中一个组件,导致性能受限,无法针对策略更新后的失败模式进行有效调整。
核心思路:Self-HPO框架通过交替优化工具和策略,使得策略能够自我分析并提出新的工具候选,从而实现自我进化。这种设计使得两个组件能够相互促进,避免了单一优化的局限性。
技术框架:Self-HPO的整体架构包括两个主要阶段:H步骤(工具候选生成)和P步骤(策略更新)。在每一轮中,当前策略首先分析自身的失败并提出新的工具候选,然后在选定的工具下进行强化学习以更新策略。
关键创新:最重要的创新在于提出了一个自我进化的框架,使得策略和工具的优化能够相互适应,形成闭环反馈机制。这一方法与传统的单一优化方法在本质上有所不同,能够更有效地应对复杂的编码任务。
关键设计:在实现中,策略的更新采用强化学习方法,工具候选的生成则基于策略的失败分析。此外,针对训练中识别的困难任务,形成下一轮工具搜索集,确保工具优化始终针对策略的演变失败模式。
🖼️ 关键图片
📊 实验亮点
实验结果显示,Self-HPO在三个编码基准测试中均优于仅优化工具或策略的基线,平均解决率从57.8%提升至64.8%。此外,优化后的组件在与基础模型结合时仍能保持性能提升,联合增益超过单独增益的总和,进一步提高了可靠性和能力边界。
🎯 应用场景
该研究的潜在应用领域包括软件开发、自动化编程和智能助手等。通过提升编码代理的性能,能够在实际编程任务中提供更高效的支持,减少人力成本,并推动智能编程工具的发展。未来,该框架还可能扩展到其他领域,如自动化测试和代码审查等。
📄 摘要(原文)
Large language model (LLM) agents have shown promising potential in coding tasks, and their performance is jointly determined by the policy model and the harness that mediates their interaction with the environment. Indeed, harness and policy are mutually reinforcing and evolving only one component is suboptimal---a harness tuned for one checkpoint may not target the failure modes of an updated policy, while policy learning remains limited to the trajectories elicited by a fixed harness. In light of this, we propose Self-HPO, a recursive self-improving framework for coding agents that alternates harness and policy optimization, using the evolving policy as its own harness proposer. Specifically, in each round, the current policy first analyzes its own failures and proposes new harness candidates (H-step). The policy is then updated through reinforcement learning (RL) under the selected harness (P-step), and hard tasks identified during training form the next harness search set, keeping harness optimization targeted to the policy's evolving failure modes. Across three coding benchmarks, Self-HPO consistently outperforms harness-only and policy-only baselines, improving Qwen3.5-35B-A3B's average resolve rate from 57.8% to 64.8%, with gains generalizing to out-of-distribution settings. Further analysis shows that both optimized components retain gains even when paired with their base counterparts, while their joint gain exceeds the sum of their individual gains. Self-HPO also improves reliability (Pass@1) and expands the capability frontier (Pass@k) over the base agent. Additionally, we show that with a stronger external model (e.g., Opus 4.8) as the harness proposer, the same framework yields a further performance boost.