多智能体框架让大模型生成的后端代码更可靠,通过反复执行验证。
ExecuGraph: A Multi-Agent, Execution-Grounded Framework for Reliable Backend Code Synthesis with Large Language Models
- 六类智能体协作,以执行验证为核心,分步生成并纠错代码。
- 在HumanEval上准确率提升3.1个百分点,大模型越强效果越明显。
- 适合需要高可靠性代码的开发者或研究者,尤其关注可验证生成。
大型语言模型能生成看似合理的后端代码,但单次生成无法保证正确性或运行可靠性。我们提出ExecuGraph,一个以执行验证为核心的多智能体框架。六个专业智能体(规划、代码生成、逻辑审查、评估、优化、解释)由带类型约束的有向工作流协调,支持有限重试次数,基于LangGraph实现,使用本地部署模型(Ollama),可选检索层辅助算法技术召回。每次评估都在进程隔离的沙箱中进行,并设定了时钟超时。在自建的30题数据结构与算法套件(internal-30)、HumanEval(n=64)及APPS入门子集上评估。对比单智能体一次生成基线和单智能体执行重试基线(类似Reflexion的消融实验)。在internal-30上三组差异不显著(n=30;配对威尔科克斯检验,p=0.59 MF vs. SO,p=0.08 SR vs. SO);所有成对均值差的95%自举置信区间均包含零。在HumanEval上,多智能体全链路方案领先+3.1个百分点。最强信号来自跨模型表现:使用DeepSeekCoder V2 Lite时,图分类准确率从一次生成的57.5%提升至多智能体全链路的80.0%,提升22.5个百分点,支持一个缩放假设:多智能体分解的价值随基础模型能力增强而增大。该框架主要贡献为方法论:同一代码库通过配置可退化为一次生成、执行重试、各智能体独立消融等条件,实现对每个因素边际贡献的可控测量。报告了各智能体消融、重试预算扫描、错误类别分类及测试源审计。
原文摘要 · Abstract (English)
Large Language Models generate plausible backend code, but a single-pass paradigm provides no guarantee of correctness or runtime reliability. We present ExecuGraph, a multi-agent framework that places execution-based validation at the center of backend code synthesis. Six specialized agents (Planner, Code Generator, Logical Reviewer, Evaluator, Optimizer, and Explainer) are coordinated by a typed directed workflow with a bounded retry budget, implemented on LangGraph with locally hosted models (Ollama) and an optional retrieval layer for algorithmic technique recall. A subprocess-isolated sandbox with a wall-clock timeout guards every evaluation. We evaluate on a curated 30-problem DSA suite (internal-30), HumanEval (n=64), and an APPS-introductory subset, contrasting ExecuGraph against a single-agent one-shot baseline and a single-agent execution-retry baseline (a Reflexion-style ablation that isolates the contribution of multi-agent decomposition). On internal-30, the three conditions are statistically indistinguishable (n=30; paired Wilcoxon p=0.59 MF vs. SO, p=0.08 SR vs. SO); 95% bootstrap confidence intervals on all pairwise mean differences include zero. On HumanEval, multi-full edges ahead by +3.1 pp. The strongest signal is cross-model: with DeepSeekCoder V2 Lite, graph-category accuracy improves from 57.5% (oneshot) to 80.0% (multi-full), a +22.5 pp jump that supports a scaling hypothesis: the value of multi-agent decomposition grows with base-model capability. The framework's primary contribution is methodological: a single codebase that collapses by configuration into one-shot, execution-retry, and per-agent ablation conditions, enabling controlled measurement of each lever's marginal contribution. A per-agent ablation, retry-budget sweep, error-class taxonomy, and test-source audit are reported.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。