用大模型把流体系统图示自动转成可运行代码,提升设计效率。
Simulation Code Generation for Fluid Systems using Large Language Models: Benchmarking Models and Prompting Strategies

- 用自然语言描述的流体系统图,转换为Python和Modelica代码。
- 最佳配置下代码语法正确率高,但模拟结果与真实场景仍有差距。
- 适合想自动化建模的工程师和研究人员参考。
大型语言模型(LLM)在从自然语言规范生成语法正确的代码方面表现出强大能力。本研究探索如何利用LLM将流体系统模型的中性图表示自动转换为两个广泛使用的仿真环境——Python库WNTR和Modelica标准库——的可执行代码。我们系统比较了十种前沿LLM和六种不同的提示策略,这些策略在提供的上下文信息(如代码或文档)上有所不同。针对每种配置,我们使用一系列软件质量指标评估生成代码,并通过重现基准流体系统场景验证仿真模型的功能保真度。研究结果为希望将基于LLM的代码生成集成到基于模型的设计流程中的研究人员和工程师提供了具体指导。尽管表现最佳的配置在语法质量上达到可接受水平,但仿真保真度仍存在显著差距。
原文摘要 · Abstract (English)
Large language models (LLMs) have demonstrated a strong ability to generate syntactically correct code from natural-language specifications. In this study, we explore how LLMs can be harnessed to automatically translate a neutral graph representation of fluid system models into executable code for two widely adopted simulation environments: the Python library WNTR and the Modelica Standard Library. We conduct a systematic comparison of ten state-of-the-art LLMs and six prompting strategies that differ in the contextual information supplied (e.g., code or documentation). For each configuration we assess the generated code using a suite of software-quality metrics and we validate the functional fidelity of the resulting simulation models by reproducing benchmark fluid system scenarios. Our findings offer concrete guidance for researchers and engineers seeking to integrate LLM-driven code synthesis into model-based design pipelines. While the best-performing configurations achieve acceptable syntactic quality, we observe substantial gaps remain in simulation fidelity.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。