arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.18460cs.SEcs.AI
收藏

ModiGen:基于大语言模型的多任务Modelica代码生成工作流

ModiGen: A Large Language Model-Based Workflow for Multi-Task Modelica Code Generation

Zhejiang University(浙江大学)

Jiahui Xiang, Tong Ye, Peiyu Liu, Yinan Zhang, Wenhai Wang

AI总结:

本文提出ModiGen工作流,结合监督微调、图检索增强生成和反馈优化,提升大语言模型在Modelica组件与测试用例代码生成上的准确率,pass@1最高提升0.3349。

摘要:

Modelica是一种广泛用于模拟复杂物理系统的语言,然而有效的模型创建和优化需要大量的领域专业知识。尽管大语言模型(LLMs)在代码生成方面已展现出有前景的能力,但其在建模领域的应用仍 largely 未被探索。为填补这一空白,我们专门开发了基准数据集,用于评估LLMs在生成Modelica组件模型和测试用例方面的性能。我们的评估揭示了当前LLMs存在的显著局限性,因为生成的代码往往无法成功仿真。为克服这些挑战,我们提出了一种专门的工作流,该工作流集成了监督微调、图检索增强生成和反馈优化,以提高Modelica代码生成的准确性和可靠性。评估结果显示了显著的性能提升:在组件生成任务中,pass@1的最大提升达到0.3349;在测试用例生成任务中,该提升为0.2457。本研究凸显了LLMs在推进智能建模工具方面的潜力,并为系统建模和工程应用的未来发展提供了宝贵的见解。

英文摘要:

Modelica is a widely adopted language for simulating complex physical systems, yet effective model creation and optimization require substantial domain expertise. Although large language models (LLMs) have demonstrated promising capabilities in code generation, their application to modeling remains largely unexplored. To address this gap, we have developed benchmark datasets specifically designed to evaluate the performance of LLMs in generating Modelica component models and test cases. Our evaluation reveals substantial limitations in current LLMs, as the generated code often fails to simulate successfully. To overcome these challenges, we propose a specialized workflow that integrates supervised fine-tuning, graph retrieval-augmented generation, and feedback optimization to improve the accuracy and reliability of Modelica code generation. The evaluation results demonstrate significant performance gains: the maximum improvement in pass@1 reached 0.3349 for the component generation task and 0.2457 for the test case generation task. This research underscores the potential of LLMs to advance intelligent modeling tools and offers valuable insights for future developments in system modeling and engineering applications.

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

↑