Abstract for: Code-First System Dynamics: An LLM-Enabled Workflow for Validatable and Structurally Recoverable Modeling

Traditional system dynamics modeling relies on a diagram-first workflow that can be labor-intensive and difficult to integrate with modern data science ecosystems. While graphical tools offer accessibility, they often create a barrier to automated iteration and reproducibility. This paper explores how Generative AI and Large Language Models (LLMs) can shift the modeling paradigm toward a code-first approach without sacrificing structural integrity. The authors introduce a "code-first" methodology using Python and a newly developed Validated Model Standard (VMS). This standard uses a lightweight grammar to ensure LLM-generated code remains machine-parsable and structurally recoverable. The workflow prioritizes executable code as the primary artifact, allowing causal loops and stock-flow diagrams to be automatically derived from the logic rather than manually drawn. Evaluations of canonical models (Bathtub, SIR, and Bass Diffusion) demonstrate successful structural recoverability. The VMS framework effectively constrains LLM output to be syntactically correct and semantically transparent. Results show that complex feedback systems can be generated from natural language, validated via Abstract Syntax Tree (AST) parsing, and executed within the standard Python scientific stack (NumPy/SciPy). This methodology accelerates model development and improves version control through standard software engineering practices. By treating code as the source of truth, system dynamics can better integrate with real-time data pipelines and agentic AI workflows. It provides a bridge between the discipline's foundational structural principles and the computational flexibility of modern programming, broadening access for researchers and policy analysts. used for formatting and researching background