一句话:提出多智能体协作思维图框架,用动态图结构做任务分配与验证,实现项目级自动编程并大幅降低开销。
论文针对基于大语言模型的自动编程中存在的两个瓶颈:单个 LLM 通常只能完成函数级代码生成,而多智能体系统往往任务规划低效,缺乏结构化协调会导致级联幻觉与过高的计算成本。为此作者提出 MaCTG(多智能体协作思维图),一种以动态图结构组织 LLM 智能体的框架:它根据编程需求自主分配智能体角色,通过上下文感知的调整动态细化任务划分,并对项目级代码进行系统性验证与集成,从而抑制幻觉、提升整体正确率。框架还采用混合 LLM 部署策略,由专有模型承担复杂推理、开源模型负责常规编码与验证,以提升成本效益。在传统图像处理自动编程任务上,MaCTG 取得 94.44% 的最先进准确率,相比现有多智能体框架将运行成本降低 89.09%,体现了其效率、可扩展性与实际可用性。
With the rapid advancement of Large Language Models (LLMs), LLM-based approaches have demonstrated strong problem-solving capabilities across various domains. However, in automatic programming, a single LLM is typically limited to function-level code generation, while multi-agent systems composed of multiple LLMs often suffer from inefficient task planning. This lack of structured coordination can lead to cascading hallucinations, where accumulated errors across agents result in suboptimal workflows and excessive computational costs. To overcome these challenges, we introduce MaCTG (Multi-Agent Collaborative Thought Graph), a novel multi-agent framework that employs a dynamic graph structure to facilitate precise task allocation and controlled collaboration among LLM agents. MaCTG autonomously assigns agent roles based on programming requirements, dynamically refines task distribution through context-aware adjustments, and systematically verifies and integrates project-level code, effectively reducing hallucination errors and improving overall accuracy. MaCTG enhances cost-effectiveness by implementing a hybrid LLM deployment, where proprietary models handle complex reasoning, while open-source models are used for routine coding and validation tasks. To evaluate MaCTG’s effectiveness, we applied it to traditional image processing auto-programming tasks, achieving a state-of-the-art accuracy of 94.44%. Additionally, by leveraging its hybrid LLM configuration, MaCTG significantly reduced operational costs by 89.09% compared to existing multi-agent frameworks, demonstrating its efficiency, scalability, and real-world applicability. Our project can be found at https://github.com/MaCTG2025/MaCTG.
@inproceedings{paperbot11601,
title = {MaCTG: Multi-Agent Collaborative Thought Graph for Automatic Programming},
author = {Zixiao Zhao and Jing Sun and Zhe Hou and Zhiyuan Wei and Cheng-Hao Cai and Miao Qiao and Jin Song Dong},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3773221}
}