arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.18489cs.AIcs.ETcs.ROcs.SE
收藏

LLM作为敏捷模型驱动开发中的代码生成器

LLM as a code generator in Agile Model Driven Development

Honda Research Institute Europe(本田欧洲研究机构)

Ahmed R. Sadik, Sebastian Brulin, Markus Olhofer

AI总结:

本文提出以GPT4为代码生成器的AMDD方法,结合UML、OCL与FIPA本体元模型降低歧义,并通过多智能体UVF系统验证生成Java/Python代码的行为一致性与可控复杂度。

摘要:

利用GPT4等大型语言模型(LLM)自动生成代码代表了一项重大进步,但这并非没有挑战。软件自然语言描述中固有的歧义给生成可部署的结构化制品带来了重大障碍。本研究倡导将模型驱动开发(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.

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

↑