BOAD: Discovering Hierarchical Software Engineering Agents via Bandit Optimization
作者: Iris Xu, Guangtao Zeng, Zexue He, Charles Jin, Aldo Pareja, Dan Gutfreund, Chuang Gan, Zhang-Wei Hong
分类: cs.LG, cs.AI
发布日期: 2025-12-29 (更新: 2026-01-01)
🔗 代码/项目: GITHUB
💡 一句话要点
BOAD:通过Bandit优化发现分层软件工程Agent,提升复杂任务泛化性
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 软件工程Agent 分层架构 多臂老虎机 Agent优化 自动化软件开发
📋 核心要点
- 现有软件工程Agent通常采用单Agent结构,难以处理长时程和分布外的复杂任务,导致泛化能力不足。
- BOAD将软件工程Agent设计为分层结构,通过多臂老虎机优化子Agent组合,模拟人类工程师分解问题的思路。
- 实验表明,BOAD在SWE-bench-Verified和SWE-bench-Live上均优于单Agent和手动设计的多Agent系统,提升了泛化能力。
📝 摘要(中文)
大型语言模型(LLMs)在推理和编码方面表现出色,但难以泛化到长时程、分布外的真实软件工程(SWE)问题。现有系统通常依赖单个Agent处理整个工作流程,导致模型保留不相关上下文,产生虚假关联和泛化能力差。受人类工程师分解复杂问题方式的启发,我们提出将SWE Agent构建为协调专门子Agent的编排器,用于定位、编辑和验证等子任务。挑战在于自动发现有效的层级结构:随着子Agent数量增加,搜索空间呈组合式增长,难以评估团队中单个子Agent的贡献。我们通过将层级结构发现建模为多臂老虎机(MAB)问题来解决这些挑战,其中每个臂代表一个候选子Agent,奖励衡量其与他人协作时的帮助程度。该框架称为Agent设计Bandit优化(BOAD),能够在有限的评估预算下有效探索子Agent设计。在SWE-bench-Verified上,BOAD优于单Agent和手动设计的多Agent系统。在SWE-bench-Live上,我们的36B系统在评估时排名第二,超过了GPT-4和Claude等更大的模型。这些结果表明,自动发现的分层多Agent系统显著提高了在具有挑战性的长时程SWE任务上的泛化能力。
🔬 方法详解
问题定义:现有的大型语言模型在软件工程任务中,通常采用单Agent架构,即一个Agent负责理解问题、浏览代码库、实现修复等所有环节。这种单体设计使得模型需要处理大量不相关的上下文信息,容易产生虚假关联,导致在面对长时程和分布外的真实软件工程问题时,泛化能力较差。因此,如何设计更有效的Agent架构,使其能够更好地处理复杂的软件工程任务,是一个亟待解决的问题。
核心思路:论文的核心思路是借鉴人类工程师解决复杂问题的方式,将软件工程Agent设计为分层结构。在这个分层结构中,一个 orchestrator Agent 负责协调多个专门的 sub-agent,每个 sub-agent 负责特定的子任务,例如代码定位、代码编辑和代码验证。通过这种分工合作的方式,可以有效地降低每个Agent需要处理的上下文信息量,从而提高模型的泛化能力。
技术框架:BOAD 的整体框架包含以下几个主要模块:1) Sub-agent Pool:包含多个预定义的、具有不同功能的 sub-agent,例如代码定位、代码编辑和代码验证等。2) Orchestrator Agent:负责接收软件工程任务,并根据任务需求选择合适的 sub-agent 组合。3) Multi-Armed Bandit (MAB) Optimizer:使用多臂老虎机算法来优化 sub-agent 的组合。每个臂代表一个候选的 sub-agent,奖励衡量该 sub-agent 与其他 sub-agent 协作时的帮助程度。4) Evaluation Module:负责评估 sub-agent 组合的性能,并将评估结果反馈给 MAB Optimizer。
关键创新:BOAD 的关键创新在于将 Agent 的层级结构发现问题建模为一个多臂老虎机 (MAB) 问题。这种建模方式使得可以在有限的评估预算下,有效地探索不同的 sub-agent 组合,从而自动发现最优的 Agent 层级结构。与传统的单Agent架构和手动设计的多Agent系统相比,BOAD 能够更好地适应不同的软件工程任务,并提高模型的泛化能力。
关键设计:BOAD 使用 Thompson Sampling 作为 MAB 算法。奖励函数的设计至关重要,它需要能够准确地衡量每个 sub-agent 对整体任务的贡献。论文中使用了任务完成的成功率作为奖励,并采用了一种 credit assignment 机制来解决 credit attribution 问题,即如何将整体任务的成功归功于参与协作的各个 sub-agent。具体的参数设置和网络结构细节在论文中有详细描述,但摘要中未提供。
📊 实验亮点
BOAD在SWE-bench-Verified上优于单Agent和手动设计的多Agent系统。在更具挑战性的SWE-bench-Live上,BOAD的36B系统在评估时排名第二,超越了GPT-4和Claude等更大的模型。这些结果表明,BOAD能够有效提升模型在复杂软件工程任务上的泛化能力,证明了自动发现分层多Agent系统的有效性。
🎯 应用场景
BOAD具有广泛的应用前景,可用于自动化软件开发、代码修复、漏洞检测等领域。通过自动发现高效的Agent层级结构,BOAD能够显著提升软件工程任务的效率和质量,降低开发成本。未来,BOAD有望应用于更复杂的软件工程场景,例如大型软件系统的维护和升级,以及新型软件的快速开发。
📄 摘要(原文)
Large language models (LLMs) have shown strong reasoning and coding capabilities, yet they struggle to generalize to real-world software engineering (SWE) problems that are long-horizon and out of distribution. Existing systems often rely on a single agent to handle the entire workflow-interpreting issues, navigating large codebases, and implementing fixes-within one reasoning chain. Such monolithic designs force the model to retain irrelevant context, leading to spurious correlations and poor generalization. Motivated by how human engineers decompose complex problems, we propose structuring SWE agents as orchestrators coordinating specialized sub-agents for sub-tasks such as localization, editing, and validation. The challenge lies in discovering effective hierarchies automatically: as the number of sub-agents grows, the search space becomes combinatorial, and it is difficult to attribute credit to individual sub-agents within a team. We address these challenges by formulating hierarchy discovery as a multi-armed bandit (MAB) problem, where each arm represents a candidate sub-agent and the reward measures its helpfulness when collaborating with others. This framework, termed Bandit Optimization for Agent Design (BOAD), enables efficient exploration of sub-agent designs under limited evaluation budgets. On SWE-bench-Verified, BOAD outperforms single-agent and manually designed multi-agent systems. On SWE-bench-Live, featuring more recent and out-of-distribution issues, our 36B system ranks second on the leaderboard at the time of evaluation, surpassing larger models such as GPT-4 and Claude. These results demonstrate that automatically discovered hierarchical multi-agent systems significantly improve generalization on challenging long-horizon SWE tasks. Code is available at https://github.com/iamxjy/BOAD-SWE-Agent.