arXiv:2503.18460cs.SEcs.AI2025-03被引 4

用大模型生成物理系统建模代码,提升准确率与可靠性

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

  • 结合微调与图检索增强生成,优化模型代码输出
  • 组件生成任务最高通过率提升至33.49%,测试用例达24.57%
  • 适合需要自动化建模的工程与仿真领域研究人员

Modelica 是广泛用于复杂物理系统仿真的语言,但有效建模与优化需大量专业知识。尽管大语言模型在代码生成方面表现良好,但在建模领域的应用仍不充分。为此,我们构建了专门用于评估大模型生成 Modelica 组件模型和测试用例的基准数据集。评估发现,当前大模型生成的代码常无法成功仿真。为解决该问题,我们提出一种融合监督微调、图检索增强生成与反馈优化的专用工作流,显著提升生成代码的准确性和可靠性。评估结果显示,组件生成任务的 pass@1 最高提升至 0.3349,测试用例生成任务提升至 0.2457。本研究展示了大模型在智能建模工具中的潜力,并为系统建模与工程应用的未来发展提供了重要启示。

原文摘要 · Abstract (English)

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.

大模型生成物理仿真Modelica自动化建模

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。