通过分析代码依赖关系,智能划分多智能体任务,提升编程效率与成本效益。
When Parallelism Pays Off: Cohesion-Aware Task Partitioning for Multi-Agent Coding

- 基于代码结构构建依赖图,用社区发现算法划分任务。
- 在真实项目上实现最高14.0%的通过率提升和2.10倍加速。
- 适合高耦合度项目,为多智能体系统设计提供新思路。
多智能体大语言模型系统通过并行化和上下文隔离分解复杂任务(如编程),但实际应用中引入的跨智能体通信开销会增加成本,有时抵消效率优势。本文将多智能体编排形式化为图划分问题,权衡通信与计算开销:任务分解可缩短关键路径计算时间,但跨智能体依赖需昂贵的上下文传递。我们在仓库级软件工程场景中提出协同编码器(Co-Coder),通过静态分析构建依赖图,识别结构枢纽文件,利用社区检测进行图划分,并采用依赖感知调度器执行。在DevEval和CodeProjectEval上的28个真实任务测试中,Co-Coder优于串行和按文件并行基线,以及Claude Code with Agent Teams,在最依赖密集的项目上实现最高14.0%的通过率提升、2.10倍的墙钟速度提升,以及最高35%的API成本降低。
原文摘要 · Abstract (English)
Multi-agent Large Language Model (LLM) systems offer a way to decompose complex tasks, such as coding, through parallelization and context isolation. However, adding agents in practice introduces inter-agent communication overhead, which incurs extra cost and can sometimes offset the efficiency gains. We formalize multi-agent orchestration as a graph partitioning problem that captures the communication-to-computation trade-off: task decomposition can shorten critical-path computation, but cross-agent dependencies require costly context transfer. We instantiate this view in repository-level software engineering and present Cohesion-aware Coder (Co-Coder), which builds dependency graphs from static analysis, isolates structural hub files, partitions the graph via community detection, and executes the partition with a dependency-aware scheduler. Across 28 real-world tasks on DevEval and CodeProjectEval, Co-Coder advances the Pareto-frontier over sequential and file-based parallel baselines as well as Claude Code with Agent Teams, lifting pass rate by up to 14.0%, achieving up to a 2.10x wall-clock speedup, and reducing API cost by up to 35%, with the largest gains on the most dependency-dense projects. Co-coder demonstrates how cohesion-aware orchestration can make parallel coding agents both theoretically grounded and practically efficient, suggesting a broader design principle for multi-agent systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。