编码智能体线束设计的实证研究

·

研究论文 · 2026/09/18

编码执行框架(harness)影响自主编码代理将模型能力转化为长周期软件工程表现的方式,但现有工作通常将执行框架作为整体系统进行评估,导致各组件有效性不明。为实现组件级比较,我们使用一个轻量级编码执行框架进行研究,其执行循环固定,而三个组件可变:规划、动作空间和上下文管理。在四个模型上,基于SWE-Bench Verified和Terminal-Bench 2.1进行评估,我们评估了176个匹配设置,涵盖五种上下文管理策略、四种上下文窗口预算,以及针对规划和动作空间的消融实验。我们发现:(1)随着上下文窗口预算收紧,上下文管理变得更有价值,其大部分收益来自防止上下文溢出失败。(2)在基于LLM的摘要之前先进行基于规则的省略,在上下文管理策略中提供了最强的整体效率,而让省略内容可恢复则增加了模型很少使用的机制,且没有带来准确率提升。(3)规划从弱模型的准确率支架转变为强模型的成本节省器,准确率变化不大。(4)预定义工具提升了bash能力较弱的模型的性能,而具备bash能力的模型可以仅使用bash接口有效运行,并实现显著更低的成本,尤其是在以命令行为中心的任务上。轨迹级分析解释了这些效应:上下文管理延长了执行轨迹而不显著改变代理行为,规划改变了轨迹停止的位置,动作空间改变了代码编写的粒度。这些发现为模型和预算感知的执行框架设计提供了信息,并为评估未来执行框架组件提供了模块化框架。

该研究首次系统性地拆解编码代理执行框架的组件,通过大规模实证揭示了上下文管理、规划和动作空间在不同模型和预算下的独立效应,为设计高效、自适应的执行框架提供了可操作的指导。

Coding harnesses shape how autonomous coding agents translate model capabilities into long-horizon software-engineering performance, yet existing work typically evaluates harnesses as monolithic systems, leaving the effectiveness of individual components unclear. To enable component-level comparisons, we study this question with a lightweight coding harness whose execution loop is fixed while three components are varied: planning, action space, and context management. Across four models evaluated on SWE-Bench Verified and Terminal-Bench 2.1, we evaluate 176 matched settings spanning five context-management strategies, four context-window budgets, and targeted ablations of planning and action space. We find that: (1) Context management becomes increasingly valuable as the context-window budget tightens, with most of its benefit coming from preventing context-overflow failures. (2) Staging rule-based elision before LLM-based summarization provides the strongest overall efficiency among the context-management strategies, whereas making elided content recoverable adds machinery that models rarely use and yields no accuracy gain. (3) Planning shifts from an accuracy scaffold for weaker models to a cost saver for stronger models, with little change in accuracy. (4) Predefined tools improve performance for models with weaker bash proficiency, whereas bash-capable models can operate effectively with a bash-only interface and achieve substantially lower cost, especially on command-line-centric tasks. Trajectory-level analysis explains these effects: context management extends execution trajectories without substantially altering agent behavior, planning changes where trajectories stop, and the action space changes the granularity at which code is written. These findings inform model- and budget-aware harness design and provide a modular framework for evaluating future harness components.

阅读原文

参与讨论