RA-Gen:一种使用ReAct的可控代码生成框架,用于多智能体任务执行
RA-Gen: A Controllable Code Generation Framework Using ReAct for Multi-Agent Task Execution
AI总结:
提出RA-Gen,一个基于ReAct的多智能体代码生成框架,通过规划、搜索、生成和提取四类智能体协作,实现安全可控的代码生成,在SVEN数据集上达到94.8%的安全率。
摘要:
基于大型语言模型(LLM)的代码生成模型已获得广泛采用,但在确保安全性、准确性和可控性方面仍存在挑战,尤其是对于复杂任务。现有方法往往缺乏外部工具的动态集成、透明的推理过程以及用户对安全性的控制。为解决这些问题,我们提出了一种利用ReAct范式的可控代码生成框架,用于多智能体任务执行。该框架是一个多智能体系统,旨在通过LLM与外部资源之间的动态交互,实现高效、精确且可解释的代码生成。该框架采用包含四个专门智能体的协作架构:用于任务分解的规划器(Planner)、利用ReAct框架进行推理和工具集成的搜索器(Searcher)、用于精确代码生成的代码生成智能体(CodeGen),以及用于结构化数据检索的提取器(Extractor)。基于ReAct的搜索器在生成推理轨迹和执行动作之间交替进行,促进内部知识与外部工具(如搜索引擎)的无缝集成,以提高准确性和用户控制力。实验结果表明,该框架在多种语言上的有效性,在SVEN数据集上使用CodeQL实现了94.8%的安全率,优于现有方法。其透明的推理过程增强了用户信任并提高了可控性。
英文摘要:
Code generation models based on large language models (LLMs) have gained wide adoption, but challenges remain in ensuring safety, accuracy, and controllability, especially for complex tasks. Existing methods often lack dynamic integration of external tools, transparent reasoning, and user control over safety. To address these issues, we propose a controllable code generation framework utilizing the ReAct paradigm for multi-agent task execution. This framework is a multi-agent system designed to enable efficient, precise, and interpretable code generation through dynamic interactions between LLMs and external resources. The framework adopts a collaborative architecture comprising four specialized agents: a Planner for task decomposition, a Searcher that leverages the ReAct framework for reasoning and tool integration, a CodeGen agent for accurate code generation, and an Extractor for structured data retrieval. The ReAct-based Searcher alternates between generating reasoning traces and executing actions, facilitating seamless integration of internal knowledge with external tools (such as search engines) to enhance accuracy and user control. Experimental results show the framework's effectiveness across multiple languages, achieving a 94.8% security rate on the SVEN dataset with CodeQL, outperforming existing approaches. Its transparent reasoning process fosters user trust and improves controllability.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。