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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Xiang, Jiahui, Ye, Tong, Liu, Peiyu, Zhang, Yinan, Wang, Wenhai
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917966871789568
author Xiang, Jiahui
Ye, Tong
Liu, Peiyu
Zhang, Yinan
Wang, Wenhai
author_facet Xiang, Jiahui
Ye, Tong
Liu, Peiyu
Zhang, Yinan
Wang, Wenhai
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2503_18460
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle ModiGen: A Large Language Model-Based Workflow for Multi-Task Modelica Code Generation
Xiang, Jiahui
Ye, Tong
Liu, Peiyu
Zhang, Yinan
Wang, Wenhai
Software Engineering
Artificial Intelligence
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.
title ModiGen: A Large Language Model-Based Workflow for Multi-Task Modelica Code Generation
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2503.18460