SimuAgent: An LLM-Based Simulink Modeling Assistant Enhanced with Reinforcement Learning
Yanchang Liang, Xiaowei Zhao
TL;DR
SimuAgent tackles the challenge of applying LLMs to graphical, hierarchical Simulink modeling by introducing a compact Python dictionary representation and a lean plan–execute workflow. It embeds three innovations—Staged Training, Abstract–Reconstruct data augmentation, and Reflection-GRPO—to address data sparsity and long-horizon reasoning, achieving fast convergence and robust generalization. On the SimuBench benchmark, the full pipeline with a 7B-Qwen model delivers higher modeling accuracy and faster learning than standard RL baselines and closely approaches GPT-4o with XML prompts, with ablations confirming the value of the two-stage curriculum and ReGRPO. The approach runs entirely on-premise, enabling privacy-preserving, cost-effective AI-assisted engineering and showing promising cross-platform transfer to Modelica and PSCAD.
Abstract
Large language models (LLMs) have revolutionized text-based code automation, but their potential in graph-oriented engineering workflows remains under-explored. We introduce SimuAgent, an LLM-powered modeling and simulation agent tailored for Simulink. SimuAgent replaces verbose XML with a concise, dictionary-style Python representation, dramatically cutting token counts, improving interpretability, and enabling fast, in-process simulation. A lightweight plan-execute architecture, trained in two stages, equips the agent with both low-level tool skills and high-level design reasoning. To tackle sparse rewards in long-horizon tasks, we propose Reflection-GRPO (ReGRPO), which augments Group Relative Policy Optimization (GRPO) with self-reflection traces that supply rich intermediate feedback, accelerating convergence and boosting robustness. Experiments on SimuBench, our newly released benchmark comprising 5300 multi-domain modeling tasks, show that a Qwen2.5-7B model fine-tuned with SimuAgent converges faster and achieves higher modeling accuracy than standard RL baselines, and even surpasses GPT-4o when evaluated with few-shot prompting on the same benchmark. Ablations confirm that the two-stage curriculum and abstract-reconstruct data augmentation further enhance generalization. SimuAgent trains and runs entirely on-premise with modest hardware, delivering a privacy-preserving, cost-effective solution for industrial model-driven engineering. SimuAgent bridges the gap between LLMs and graphical modeling environments, offering a practical solution for AI-assisted engineering design in industrial settings.
