中文标题#
LLM 作为敏捷模型驱动开发中的代码生成器
英文标题#
LLM as a code generator in Agile Model Driven Development
中文摘要#
利用大型语言模型(LLM)如 GPT4 在代码自动生成中的应用代表了重大进展,但并非没有挑战。自然语言描述软件时固有的模糊性对生成可部署的结构化成果构成了重大障碍。本研究倡导模型驱动开发(MDD)作为一种可行的策略来克服这些挑战,提出了一种采用 GPT4 作为代码生成器的敏捷模型驱动开发(AMDD)方法。这种方法提高了代码自动生成过程的灵活性和可扩展性,并提供了敏捷性,使模型或部署环境的变化能够无缝适应。我们通过使用统一建模语言(UML)对多智能体无人车辆编队(UVF)系统进行建模来说明这一点,通过集成对象约束语言(OCL)进行代码结构元建模,以及使用 FIPA 本体语言进行通信语义元建模,显著减少了模型的模糊性。应用 GPT4 的自动生成能力分别生成与 JADE 和 PADE 框架兼容的 Java 和 Python 代码。我们对自动生成的代码进行了全面评估,验证了其与预期行为的一致性,并识别了智能体交互的改进。在结构上,我们评估了仅受 OCL 元模型约束的模型所生成代码的复杂性,与同时受 OCL 和 FIPA 本体语言元模型影响的代码复杂性进行了比较。结果表明,受本体语言约束的元模型生成的代码本质上更复杂,但其循环复杂度仍处于可控水平,这表明可以加入额外的元模型约束而不会超过复杂度的高风险阈值。
英文摘要#
Leveraging Large Language Models (LLM) like GPT4 in the auto generation of code represents a significant advancement, yet it is not without its challenges. The ambiguity inherent in natural language descriptions of software poses substantial obstacles to generating deployable, structured artifacts. This research champions Model Driven Development (MDD) as a viable strategy to overcome these challenges, proposing an Agile Model Driven Development (AMDD) approach that employs GPT4 as a code generator. This approach enhances the flexibility and scalability of the code auto generation process and offers agility that allows seamless adaptation to changes in models or deployment environments. We illustrate this by modeling a multi agent Unmanned Vehicle Fleet (UVF) system using the Unified Modeling Language (UML), significantly reducing model ambiguity by integrating the Object Constraint Language (OCL) for code structure meta modeling, and the FIPA ontology language for communication semantics meta modeling. Applying GPT4 auto generation capabilities yields Java and Python code that is compatible with the JADE and PADE frameworks, respectively. Our thorough evaluation of the auto generated code verifies its alignment with expected behaviors and identifies enhancements in agent interactions. Structurally, we assessed the complexity of code derived from a model constrained solely by OCL meta models, against that influenced by both OCL and FIPA ontology meta models. The results indicate that the ontology constrained meta model produces inherently more complex code, yet its cyclomatic complexity remains within manageable levels, suggesting that additional meta model constraints can be incorporated without exceeding the high risk threshold for complexity.
PDF 获取#
抖音扫码查看更多精彩内容