高级检索

    RD2ESC:多智能体协同的嵌入式代码智能生成框架

    RD2ESC: Multi-Agent Collaborative Framework for Intelligent Embedded Code Generation

    • 摘要: 大语言模型(LLM)在软件工程中的应用日益广泛,但目前自动化代码生成研究主要集中于通用功能代码,缺乏针对嵌入式系统特殊需求的有效解决方案。本研究提出了RD2ESC(Requirements Documents to Embedded System Code)方法,通过基于提示词的微调技术使LLM能够理解嵌入式代码与需求文档之间的复杂关系,并构建了多智能体协同的代码生成框架,能够利用需求文档和参考代码快速生成高质量的嵌入式代码。实验结果表明,RD2ESC相比GPT-4o基线模型在Pass@1指标上从0.15提升至0.71,测试通过率达到0.75,编译通过率达到0.95;敏感性分析显示该方法对参考代码质量存在一定依赖性,在10%~50%扰动条件下Pass@1从0.68降至0.47,完全无参考代码时降至0.25,但仍保持基础代码生成能力;消融实验证实了多智能体间的协同效应,完整系统相比单一组件展现出显著的性能提升。该研究为嵌入式代码自动生成提供了有效的技术框架,提升了嵌入式系统开发效率。

       

      Abstract: Large Language Models (LLM) are increasingly being applied in software engineering, but current automated code generation research primarily focuses on general-purpose functional code, lacking effective solutions for the specific requirements of embedded systems. This study proposes RD2ESC (Requirements Documents to Embedded System Code), a prompt-based fine-tuning method that enables LLMs to understand the complex relationships between embedded code and requirements documents, and constructs a multi-agent collaborative code generation framework capable of rapidly generating high-quality embedded code using requirements documents and reference code. Experimental results demonstrate that RD2ESC improves the Pass@1 metric from 0.15 to 0.71 compared to the GPT-4o baseline model, achieving a test pass rate of 0.75 and compilation pass rate of 0.96. Sensitivity analysis reveals that the method exhibits certain dependency on reference code quality, with Pass@1 declining from 0.68 to 0.47 under 10%~50% perturbation conditions and dropping to 0.25 without reference code, while still maintaining basic code generation capabilities. Ablation experiments confirm the synergistic effects among multi-agents, with the complete system demonstrating significant performance improvements compared to individual components. This research provides an effective technical framework for embedded code automatic generation, substantially enhancing embedded system development efficiency.

       

    /

    返回文章
    返回