arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.07693cs.AIcs.LGcs.NEcs.SE
收藏

利用大语言模型进行迭代多智能体调试的全自主编程

Fully Autonomous Programming using Iterative Multi-Agent Debugging with Large Language Models

Simula(西穆拉(挪威科技机构));University of Oslo(奥斯陆大学);TU Eindhoven(埃因霍温理工大学);Philips Research(飞利浦研究实验室)

Anastasiia Grishina, Vadim Liventsev, Aki Härmä, Leon Moonen

AI总结:

本文提出多智能体调试框架 SEIDR,通过迭代执行、指令、调试与修复,结合不同排序和混合策略,有效克服大语言模型程序合成中的“差之毫厘综合征”,并在 PSB2 和 HumanEval-C++ 上取得显著效果。

摘要:

基于大语言模型(LLMs)的程序合成存在“差之毫厘综合征”:生成的代码与正确解法非常接近,但因微小错误而无法通过单元测试。我们提出一个名为 Synthesize, Execute, Instruct, Debug, and Repair(SEIDR)的多智能体框架来解决这一问题。将 SEIDR 有效应用于指令微调的大语言模型需要确定:(a) 适用于大语言模型的最优提示词,(b) 在调试轮次中选择最佳程序的排序算法,以及 (c) 在修复失败程序与生成新程序之间取得平衡。我们通过比较以替换为主、以修复为主和混合调试策略,对这些权衡进行了实证探索。我们还评估了 lexicase 选择和锦标赛选择在每一代中对候选程序进行排序的效果。在 Program Synthesis Benchmark 2(PSB2)上,我们的框架优于没有修复阶段的 OpenAI Codex 常规使用方法以及传统遗传编程方法。SEIDR 优于单独使用大语言模型,在 PSB2 上跨实验至少一次解决了 18 个 C++ 问题和 20 个 Python 问题。为评估泛化能力,我们在 PSB2 和 HumanEval-X 基准上使用 GPT-3.5 和 Llama 3。尽管使用这些模型的 SEIDR 在 Python 基准上并未超越当前最先进方法,但在 HumanEval-C++ 上的结果令人鼓舞。使用 Llama 3-8B 的 SEIDR 实现了 84.2% 的平均 pass@100。在所有 SEIDR 运行中,GPT-3.5 在 HumanEval-C++ 上至少一次解决了 164 个问题中的 163 个,较小的 Llama 3-8B 解决了 164 个问题中的 162 个。我们得出结论:SEIDR 有效克服了大语言模型程序合成中的差之毫厘综合征。

英文摘要:

Program synthesis with Large Language Models (LLMs) suffers from a "near-miss syndrome": the generated code closely resembles a correct solution but fails unit tests due to minor errors. We address this with a multi-agent framework called Synthesize, Execute, Instruct, Debug, and Repair (SEIDR). Effectively applying SEIDR to instruction-tuned LLMs requires determining (a) optimal prompts for LLMs, (b) what ranking algorithm selects the best programs in debugging rounds, and (c) balancing the repair of unsuccessful programs with the generation of new ones. We empirically explore these trade-offs by comparing replace-focused, repair-focused, and hybrid debug strategies. We also evaluate lexicase and tournament selection to rank candidates in each generation. On Program Synthesis Benchmark 2 (PSB2), our framework outperforms both conventional use of OpenAI Codex without a repair phase and traditional genetic programming approaches. SEIDR outperforms the use of an LLM alone, solving 18 problems in C++ and 20 in Python on PSB2 at least once across experiments. To assess generalizability, we employ GPT-3.5 and Llama 3 on the PSB2 and HumanEval-X benchmarks. Although SEIDR with these models does not surpass current state-of-the-art methods on the Python benchmarks, the results on HumanEval-C++ are promising. SEIDR with Llama 3-8B achieves an average pass@100 of 84.2%. Across all SEIDR runs, 163 of 164 problems are solved at least once with GPT-3.5 in HumanEval-C++, and 162 of 164 with the smaller Llama 3-8B. We conclude that SEIDR effectively overcomes the near-miss syndrome in program synthesis with LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑