用多智能体框架引导大模型生成复杂代码,准确率提升23.79%。
Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks
- 设计分步协作的多智能体系统,分解复杂任务
- 在HumanEval上较单次生成提升23.79%准确率
- 适合需要复杂推理的软件开发场景
大语言模型在代码生成任务中表现出色,但在处理复杂、长上下文编程问题及复合推理方面仍存在显著局限。本文提出一种新型代理式“引导式代码生成”框架,通过精细化、结构化的任务分解方式,发挥大模型作为模糊搜索和近似信息检索的优势,同时弥补其在长序列推理和长上下文理解上的不足。基于OpenAI的HumanEval基准,使用Meta的Llama 3.1 8B模型(int4精度)进行实证评估,结果显示相较直接单次生成,解决方案准确率提升了23.79%。结果表明,结构化引导方法可显著增强大模型在软件开发中的实际应用价值,有效克服其在复合推理与上下文处理方面的固有缺陷。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have shown remarkable capabilities in code generation tasks, yet they face significant limitations in handling complex, long-context programming challenges and demonstrating complex compositional reasoning abilities. This paper introduces a novel agentic framework for ``guided code generation'' that tries to address these limitations through a deliberately structured, fine-grained approach to code generation tasks. Our framework leverages LLMs' strengths as fuzzy searchers and approximate information retrievers while mitigating their weaknesses in long sequential reasoning and long-context understanding. Empirical evaluation using OpenAI's HumanEval benchmark with Meta's Llama 3.1 8B model (int4 precision) demonstrates a 23.79\% improvement in solution accuracy compared to direct one-shot generation. Our results indicate that structured, guided approaches to code generation can significantly enhance the practical utility of LLMs in software development while overcoming their inherent limitations in compositional reasoning and context handling.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。