arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2310.04304cs.SEcs.AIcs.FLcs.MAcs.PL
收藏

设计式编码:GPT-4赋能敏捷模型驱动开发

Coding by Design: GPT-4 empowers Agile Model Driven Development

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

Ahmed R. Sadik, Sebastian Brulin, Markus Olhofer

AI总结:

针对大语言模型从自然语言生成代码存在模糊性的问题,提出结合UML、OCL和FIPA本体的敏捷MDD方法,借助GPT-4实现跨语言代码自动生成,验证了生成代码的行为一致性与结构可控性。

摘要:

使用ChatGPT等大语言模型(LLM)从自然语言生成代码看似具有突破性,但随着更广泛的应用,这种方法的局限性也逐渐显现:自然语言固有的模糊性给复杂软件设计带来了挑战。为此,本研究提出一种敏捷模型驱动开发(MDD)方法,借助OpenAI的GPT-4提升代码自动生成效果。本研究的核心贡献在于为现有MDD方法注入“敏捷性”,尤其适用于模型需要变更或需部署到不同编程语言的场景。\n我们通过一个无人车队多智能体仿真系统的案例研究展开验证。在方法的第一层和第二层,我们使用统一建模语言(Unified Model Language, UML)图构建了案例研究的文本化表示。在接下来的层级中,我们引入两组约束以降低模型的模糊性:对象约束语言(Object Constraints Language, OCL)用于细化代码构建细节,FIPA本体则用于规范通信语义与协议。最终,在最后一层借助GPT-4自动生成Java和Python两种语言的代码:Java代码部署于JADE框架中,Python代码部署于PADE框架中。\n研究最后我们对生成的代码进行了全面评估:从行为层面看,自动生成的代码与预期的UML序列图完全一致;从结构层面看,我们对比了仅受OCL约束的UML图生成的代码,与同时受OCL和FIPA本体约束的UML图生成的代码的复杂度。结果表明,受本体约束的模型生成的代码本质上更复杂,但仍处于可管理的范围,对后续测试和维护而言风险较低。

英文摘要:

Generating code from a natural language using Large Language Models (LLMs) such as ChatGPT, seems groundbreaking. Yet, with more extensive use, it's evident that this approach has its own limitations. The inherent ambiguity of natural language presents challenges for complex software designs. Accordingly, our research offers an Agile Model-Driven Development (MDD) approach that enhances code auto-generation using OpenAI's GPT-4. Our work emphasizes "Agility" as a significant contribution to the current MDD method, particularly when the model undergoes changes or needs deployment in a different programming language. Thus, we present a case-study showcasing a multi-agent simulation system of an Unmanned Vehicle Fleet. In the first and second layer of our approach, we constructed a textual representation of the case-study using Unified Model Language (UML) diagrams. In the next layer, we introduced two sets of constraints that minimize model ambiguity. Object Constraints Language (OCL) is applied to fine-tune the code constructions details, while FIPA ontology is used to shape communication semantics and protocols. Ultimately, leveraging GPT-4, our last layer auto-generates code in both Java and Python. The Java code is deployed within the JADE framework, while the Python code is deployed in PADE framework. Concluding our research, we engaged in a comprehensive evaluation of the generated code. From a behavioural standpoint, the auto-generated code aligned perfectly with the expected UML sequence diagram. Structurally, we compared the complexity of code derived from UML diagrams constrained solely by OCL to that influenced by both OCL and FIPA-ontology. Results indicate that ontology-constrained model produce inherently more intricate code, but it remains manageable and low-risk for further testing and maintenance.

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

↑