多智能体架构显著影响代码复杂度,但复杂度高不等于更准确。
How Generation Architecture Shapes Code Complexity in Multi-Agent LLM Systems: A Paired Study on HumanEval

- 对比六种多智能体结构,发现架构设计直接影响代码复杂度。
- 复杂度最高的架构比最简架构高50%-130%,但准确率无提升。
- 分析-编码分离增加复杂度,测试环节也推高复杂度,调试器无影响。
大型语言模型代码生成已从单次提示转向多智能体协作(分析师、编码者、测试者、调试者)流程,但评价几乎仅关注功能正确性。这些架构是否影响代码结构复杂度,以及哪些环节带来负担,尚未被充分研究。本文在GPT-4o系列两个模型上,对164个HumanEval任务中的六种常见多智能体配置(Basic, AC, ACT, Debugger, AC+Debugger, ACT+Debugger)进行了对比,共生成1968个配对样本。采用五种RADON复杂度指标(SLOC、圈复杂度、Halstead体积、难度和工作量),通过配对非参数统计方法(Friedman检验、Wilcoxon符号秩检验、Holm校正、Kendall's W及匹配对秩-双列效应量),分别在全部完成项和仅通过项条件下分析。结果显示,六种架构聚为两个不可区分的复杂度群组,差距达50%-130%,两模型与两种条件均一致;其中,分析-编码分离显著增加复杂度,运行时调试器无影响,甚至在分析-编码背景下降低复杂度,而测试环节重新推高复杂度。高复杂度并未带来更高的pass@1准确率,最简洁架构在准确率上与最复杂架构持平或更优。因此,多智能体架构的复杂化应以实际收益为依据,而非默认合理。
原文摘要 · Abstract (English)
Large-language-model code generation has shifted from single-shot prompting to multi-agent orchestrations - analyst, coder, tester, and debugger pipelines - and is evaluated almost exclusively on functional correctness. Whether these architectures also affect the structural complexity of the code they produce, and which orchestration layers carry the cost, remains largely unexamined: prior work has documented prompt-level effects on code complexity, but the architecture-level question is open. We compare six widely-used multi-agent configurations (Basic, AC, ACT, Debugger, AC+Debugger, ACT+Debugger) under two models from the GPT-4o family across all 164 HumanEval tasks - 1,968 paired observations - using the five RADON complexity metrics (SLOC, cyclomatic complexity, and Halstead Volume, Difficulty, and Effort). We apply a paired non-parametric statistical pipeline (Friedman omnibus, Wilcoxon signed-rank post-hoc with Holm correction, Kendall's $W$ and matched-pairs rank-biserial effect sizes) in both all-completions and passing-only conditions. The six architectures collapse into two indistinguishable complexity clusters separated by a 50-130% gap, the same partition in both models and under both conditions; among the architectural layers, the analyst-coder split inflates complexity, the runtime debugger does not - and on the analyst-coder background actively deflates it - and the tester re-inflates it. The heavy cluster's additional complexity buys no pass@1 advantage: the leanest architectures match or beat the heaviest on accuracy. Architectural elaboration in LLM code generation should therefore be justified by measured benefit on the dimensions that matter, not assumed.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。