G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Authors: Samuel Holt
Max Ruiz Luyten
Antonin Berthon
Mihaela van der Schaar
Venue: ICML 2025 poster (2025)
Keywords: Large Language Models
Generative Simulation
World Models
Simulation-Based Inference
Gradient-Free Optimization
Likelihood-Free Inference
Hybrid Models
Causal Inference
Primary area: general_machine_learning->everything_else
TL;DR: We build trustworthy, intervenable simulators by combining a Large Language Model's ability to propose a system's structure with flexible, gradient-free calibration against real-world data.

Abstract: Constructing robust simulators is essential for asking "what if?" questions and guiding policy in critical domains like healthcare and logistics. However, existing methods often struggle, either failing to generalize beyond historical data or, when using Large Language Models (LLMs), suffering from inaccuracies and poor empirical alignment. We introduce **G-Sim**, a hybrid framework that automates simulator construction by synergizing LLM-driven structural design with rigorous empirical calibration. G-Sim employs an LLM in an iterative loop to propose and refine a simulator's core components and causal relationships, guided by domain knowledge. This structure is then grounded in reality by estimating its parameters using flexible calibration techniques. Specifically, G-Sim can leverage methods that are both **likelihood-free** and **gradient-free** with respect to the simulator, such as **gradient-free optimization** for direct parameter estimation or **simulation-based inference** for obtaining a posterior distribution over parameters. This allows it to handle non-differentiable and stochastic simulators. By integrating domain priors with empirical evidence, G-Sim produces reliable, causally-informed simulators, mitigating data-inefficiency and enabling robust system-level interventions for complex decision-making.

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Samuel Holt
Max Ruiz Luyten"
Antonin Berthon
Mihaela van der Schaar"
Abstract
uating interventions stress tests without bearing the risk, cost, or challenges of real-world experiments (Oliver, 2023).
Constructing robust simulators is essential for asking "what if?" questions and guiding pol- icy in critical domains like healthcare and logis- tics. However, existing methods often struggle, either failing to generalize beyond historical data or, when using Large Language Models (LLMs). suffering from inaccuracies and poor empirical alignment. We introduce G-Sim, hybrid frame- work that automates simulator construction by synergizing LLM-driven structural design with rigorous empirical calibration. G-Sim employs an LLM in an iterative loop to propose and refine a simulator's core components and causal relation- ships, guided by domain knowledge. This struc- ture is then grounded in reality by estimating its parameters using flexible calibration techniques. Specifically, G-Sim can leverage methods that are both likelihood-free and gradient-free with respect to the simulator, such as gradient-free optimization for direct parameter estimation or simulation-base inference for obtaining a pos- terior distribution over parameters. This allows it to handle non- non-dif difffeferenniable and stochastic simu- lators. By integrating domain priors with empiri- cal evidence, G-Sim produces reliable, causally- informed simulators, mitigating data-inefficiency and enabling robust system-level interventions for complex decision-makinn making.
Yet, manually building these simulations is often time- consuming, resource-intensive process demanding substan- tial expert knowledge. The rise of Large Language Models (LL.Ms), with their vast general knowledge and reasoning capabilities (Bommasani et al., 2021; Chen et al., 2021), coupled with the increasing availability of observational data-albeit often fragmented preseettsssssse compelling op- portunity to automate simulator construction. Yet, despite this potential, a comprehensive framework to fully realize it has remained clusive.
Existing automated approaches, often termed "world mod- els" (Ha & Schmidhuber, 2018; Tang al., 2024), typi- cally focus model-based reinforcement learning. They estimate environment transitions and rewards to improve planning (Luo et al., 2024), primarily answering questions such as, "What if the actor follows policy [X]?".
Toward General-Purpose, Intervenable Simulators. In contrast, truly general-purpose simulator must enable deeper investigations into the environment's dynamics, ad- dressing questions such as: "What if this underlying com- ponent changes?" or "Is the system robust under this struc- tural stress-test?". Answering these requires a new class of simulators supporting ficxible, (PO) System-wide Ex- perimentation. These simulators must integrate diverse data sources, handle uncertainty, and generalize effectively, To be effective, such simulators must possess several key properties:
1. Introduction
(P1) Plausible Generalization: Align with domain in- sights, even out-of dist-isitibttonn.
Simulations are essential for testing decisions, developing policies, and optimizing resource allocation in domains rang- ing from healtheare to supply-chain management (Law & Kelton, 2000; Banks, 1998; Banks et al., 2010). well- constructed simulator allows asking "what if ...?" and eval-
(P2) Empirical Alignment: Match available observa- tional data.
(P3) Data Form Consistency: Preserve the nature (con- tinuous, discrete, stochastic) real-world components, since knowing distribution can lead drastically dif- ferent conclusions than using just the mean, especially in high-stakes scenarios.
"qqual contribution 'University of Cambridge. Correspondence to: Samuel Holt <sih31 @cam.ac.uk>.
Proceedings of the ndnd International Conference Machine Learning. Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).
These properties ensure the simulator is both scientifically valid and practically useful.

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
G-Sim: A Hybrid Approach. To instantiate a simulator- builder meeting these needs, we introduce G-Sim, frame- work for automatic environment generation that uniquely merges LLM-driven structural reasoning with robust, data- driven calibration (Figure 1). G-Sim operates through an iterative loop:
3. Support submodule-level refinements and composi- tional design to facilitate targeted updates and domain adaptation (PO).
2.1. System State and Update Mechanisms
Let A' be the (potentially high-dimensional) space of system states and X' the state at time t. Let E U denote exogenous controls, actions, or policy interventions. We define a simulator M by a transition operator
1. LLM-Driven Structural Reasoning (P1, P3): An LLM, prompted with domain knowledge, proposes and refines the simulator's ' structure (submodules, causal links), injecting expert priors for plausible dynamics.
2. Flexible Parameter Calibration (P2): We cali- brate these structures against data using a choice of likelihood- frree and gradient-free techniques. This in- cludes gradient-free optimization (GFO) (Toklu al., 2023) for parameter estimation or simulation saaseaatio--baedd in- ference (SBI) for principled uncertainty quantification. 3. Iterative Refinement (P1-P3): Diagnostics (e.g., pre- dictive discrepancies) flag weaknesses, guiding the LLM via in-context learning to restructure and improve the model until satisfactory alignment is achieved.
F X x x X
with parameter space θ In discrete-time setting:
X F (xx, Ue; 0),
(I)
where E ④ encodes all parameters both structural and numerical-
how the simulator evolves. Such parametric state-transition models have a long history in control theory (Aström, 1970).
Submodule Partitioning and Composition. Complex systems often factorize into smaller sub-processes (submod- ules). Concretely, let
This eycle yields "refinement loop" where the simulator's structure and parameters co-evolve, ensuring it is causally plausible, empirically grounded, and addresses (P3)-(P3).
M M,... ...M.MM
be collection of submodules. Each Mr yields local mapping
Contributions.
Our work makes several contributions:
Fk: x + y*
We introduce novel problem framing for environment- building, centered system-level experimentation for real-world pacision-making (Section 2).
where @* c e the submodule's parameter subset and y* is an intermediate output space (e.g., partial update a rate in Markov jump process). The global transition operator F then composes these submodule outputs:
We propose G-Sim, hybrid framework combining L. LLLM-uidded structural search with flexible, data-driven calibration via a choice of GFO or SBI (Section 3).
We demonstrate G-Sim's ability to achieve plausible generalization and support new forms of system-level analysis through experiments on three diverse environ- ments (Section 5).
X++1 Fo ( Un; O*),..., pK (xt, un; 0*))
) 00)
(2)
where 0 captures cross-submodule coupling (e.g., shared constraints, resource balances). Such compositional frame- works align with agent-based models (Bonabeau, 2002), sys- tem dynamics approaches, and block-structured simulations (Law & Kelton, 2000; Banks et al., 2010). They allow asyn- chronous or continuous-time versions by replacing (1)-2) with differential equations or event-driven formulations.
2. Problem Setting
We aim build simulator M that mirrors the evolution of real-world system, enabling rigorous "what if..." exper- imentation and policy' analysis. Formally, this simulator should:
Structural vs. Numerical Parameters. We partition the simulator's 's parameter space θ as
Produce trajectories in a state space X' that corresponds directly to weal-world configurations (P3).
e = A x S
2. Encode accurate transitions under both in-distribution and novel (out-of-distribution) conditions (P1-P2).
À E A (structural params), w E Ω (numerical params).
The structural part À indicates which submodules are ac- tive (e.g., "Does this subsystem exist?") or which causal links connect them (e.g.. "Is submodule A driven by B's output?"), while the numerical part w encodes real-valued
'We italicize policy when it refers to interventions potentially more general term than typical RL policy (i.e. changes in the environment itself, such changing the physical layout of environment.).
2

---

G-Sim: Generative Simulations with Large Language Models and Gradient- Freee Calibration
Iteration
Iteration 2
Iteration 3
Iteration 16
A Description
Simul ator Description
Strui ator Descr Sption
Strulator Description
inseciio
SAmulator Description
For Libeet
D011000:: (eee))
cank, Loclutieg (wet)
Heaniin Looo 1961))
Hancint ccopanyy toeat
Say..
Zats Bayle
Timns Ags.
Feedback
+
Feodback
Feedback
Frectan top mentt
Wenton with (Bod) 24
Cale 27-4
Sim. Code
LLM Resp.
LLM Resp
Simulator Code
Best fitting simulator returned
GFO. (SBI, ES
Stmulater Code
Stmulator Code...
Vsl MASS Loes: 5.3
vol WRSS Loss: 2.1
Dustaation
Simulation Based Inference
seroccutt share ditt, Poc Gevenssr) i AAT Enteeet
Prioe
Siealir Bauuut
MM
Sinulated
Dutaset
Neural Damily
Estimeteo
Approsimate Posterir Nou 1.
raturs OUR AOC-013
Fries poir
redi
P
Obs. Dataset
"Jo acstel (arr)
D
JM
6 Evvluttionyy Strategies
petittng
Pop, of Cardilaes pl+)
Fimess Dealuttion
Selection
Optinal Parameters
sind, Aperr
& wnch cari
Variation
56 -
Sduz the box
dix ()
Cwale east ea
Figure 1. Overview of the G-Sim framework for automatic simulator generation. The process integrates LLM- structural design with empirical observational data (D) in an iterative refinement loop. (1) Propose: An LLM first generates simulator code (A) from a textual description. (2) Calibrate: This code's 's numerical parameters (w) are then calibrated against data using one of two parallel, likelihood free pathways: either Evolutionary Strategies (a form of GFO) to find optimal parameters by minimizing a fitness function, or Simulation- Based Inference (SBI) to infer full posterior distribution over parameters. (3) Refine:
The performance of the calibrated model (e.g.. validation loss) is synthesized into a natural language feedback summary. This summary, along with past models, guides the LLM to propose improved structure in the next iteration. This cycle continues until performance converges, yielding robust, empirically-grounded simulator.
or discrete parameters (e.g., rates, coefficients, or thresh- old levels). This factorization is particularly conducive to domain knowledge infusion, as experts or language models can propose plausible topologies (i.e., A) without specifying precise numerical values.
to object-oriented simulation toolkits (Shewchuk & Chang, 1991), and are also valuable for stress-testing, scenario plan- ning, and continous learning.
Policy Analysis. As done in previous work (Tang et al., 2024), the simulator can also serve as a decision-support tool by evaluating policy effects in a controlled environment, which is central to model-based RL (Sutton & Barto, 2018) and offline policy evaluation (Uehara et al., 2022).
2.2. Queries Enabled by the Simulator
ditoo--distributionn Exploration. From an initial condi- tion Xg and a sequence of inputs {u,} potentially outside historical distributions, the simulator generates:
2.3. Data and Domain Knowledge
(xi..... x = { Fxx, un: 0), F(x), uy; 0)
Observational Data with Partial Overlaps. Real sys- tems often produce fragmented data from multiple sources. Let D { [D(1) ..... D(4) }, where each dataset D) typi- cally logs partial trajectories (e.g.. some submodules but not others) or covers different time spans. Specific limitations include:
Robust extrapolation to these unseen regimes is critical for stress-testing and scenario planning (Oliver, 2023; Rosen- berger, 1993).
Submodule-level Interventions. More fundamentally, since 0 = (A, w) partitions structural and numerical pa- rameters, a user may choose to modify or replace a subset of submodules gh Such modular updates are well-matched
1. Sparse coverage: States or interventions of interest (e.g., extreme disruptions) rarely appear in observa- tional data.
3

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
2. Asynchronous logging:
Submodules might be sampled varying rates and be of different types (discrete, con- tinuous, stochastic, etc.).
entire submodules from textual guidance:
Mismatched real-world statistics: Without quantitative calibration, subtle parameter emrors can accumulate and degrade fidelity even on in-distribution settings (Lian et al., 2024; Vafa et al., 2024).
3. Privacy and partial observability: Some datasets might not be paired or crucial variables (e.g., patient data) may not be directly recorded.
Undetermined modules: No mechanism exists cal- ibrate or refine key parameters that undetermined from K.
Purely data-driven fitting often struggles here, as the disjoint or partial data coverage renders many submodules unidenti- fiable. Causal inference literature (Pearl, 2009; Peters et al., 2017) demonstrates that even when data are plentiful, lack- ing the right structural assumptions can make generalization under interventions fundamentally ill-posed.
Neither approach alone suffices for demanding tasks such as policy evaluation or out-of-distribution stress testing.
2.5. Need for a Hybrid Framework
Domain Knowledge. Alongside D, we assume access to domain knowledge K., encompassing:
Given these limitations, we advocate a hybrid solution that integrates:
LLM Guidance:
Large Language Models can incorporate extensive textual corpora and suggest plausible topolo- gies or parameter defaults. Their ability to generate semantically consistent code or functional forms has been noted in (Chen et al., 2021; Li al., 2022).
1. LLM LLi-vniven structural proposals (A) to incorporate do- main knowledge and causal heuristics, ensuring the simulator remains grounded in plausible mechanisms.
Rigorous calibration of numerical parameters (w) to observational data. This is achieved via techniques that are both likelihood-free and gradient-free w.r.t. the simulator, such as GFO for point estimation (Schnke et al., 2010) or SBI for Bayesian inference (Cranmer et al., 2020).
Textual resources: Manuals, guidelines, or domain- specific documentation of operational protocols.
Symbolic constraints or causal graphs: Hard constraints (e.g., "throughput cannot exceed capacity") or partial causal diagrams (Spirtes et al., 2001).
The challenge is to integrate IC with 'D in balanced way, ensuring that submodule structures and parameters remain consistent with known causal principles while also aligning with empirical evidence.
"What if?" (PO)
OOD gen. + D Dalign. + D form consist,
(P1)
(P2)
2.4. Failure Modes of Naive Approaches
By balancing domain -nowaine based structure with em- pirical alignment, we move beyond purely data-driven or purely knowledge-basee simulators to achieve robust policy evaluation and discovery in complex, real-world domains.
Purely Data-Driven Fitting. One might attempt to learn a single generative model A from D by maximizing a likelihood or minimizing reconstruction error. However:
Lack of structural priors: When coverage of certain inter- ventions is sparse, extrapolation is not only statistically weak but can be causally ill-posed (Pearl, 2009; Peters et al., 2017).
3. G-Sim: Hybrid Simulator Construction
We present G-Sim, a novel framework for automatic sim- ulator generation that synergizes LLM-driven structural reasoning with rigorous empirical calibration'. As de- picted Figure G-Sim operates through an iterative cycle, orchestrating three core phases: (1) proposing a simulator's architecture using an LLM, (2) grounding this structure in data by calibrating its parameters, and (3) refining the architecture based on diagnostic feedback. This section de- tails each phase, highlighting how G-Sim achieves plausible generalization (P1), empirical alignment (P2), data-form consistency (P3), and system- wide experimentation (PO). wyste
Missed cross-submodule interactions: Limited pairing or partial observability across submodules prevents co- herent joint estimation.
Rigid optimization requirements: Many generative mod- eling approaches require differentiability, hindering the inclusion of discrete or combinatorial elements (Sali- mans al., 2017).
No intervention-readiiee readiness: The black-box nature of many data-driven approaches makes it inherently hard to intervene beyond shifting their inputs (Shin et al., 2022).
*Code is available at https: / //t:::///ii ghittbb........ com/ samholt/ wwtriieessmmllatt.
and we provide a broader research group code base https://github. vanderschaarlab hwwpaaaa/ggeeaiaeeeeeeeee se-
Purely LLM-Generated Simulators. Conversely, one might rely entirely on LLMS to propose equations, code, or

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
3.1. LLM-Driven Structural Design
GFO excels navigating the complex and often non-smooth loss landscapes of realistic simulators. Full details are in Appendix E.
Proposing Compositional Structures. Real-world sys- tems often decompose into interconnected submodules, each governing specific dynamics like qucueing, resource man- agement, or disease progression (Shanthikumar & Wu, 1991; Choudhury & Basak, 2018). G-Sim leverages this by hav- ing an LLM propose a structural configuration, X. This configuration specifies which submodule templates (c.g., an SIR model (Kermack et al., 1997; Batista et al., 2020)) are active and how they are linked by coupling rules. This modular, block-structured approach (Section 2) facilitates interpretable and intervenable designs (Shewchuk & Chang, 1991), providing a strong inductive bias for causal plausibil- ity (Klinger et al., 2023; Schug et al., 2024).
Pathway 2: Bayesian Inference with Simulation- Inference (SBI). Alternativly,, when quantifying parame- uncertainty is crucial, the user can choose SBI (Cranmer et al., 2020). SBI is principled Bayesian framework for problems with intractable likelihoods but accessible simula- tors. We primarily use Neural Posterior Estimation (NPE), where a neural network (see Appendix E.3.2) is trained to approximate the posterior distribution p(w DD A). From this learned posterior, a point estimate for the parameters (e.g., the posterior mean or mode) is selected to instantiate the final simulator. This approach provides not just single set of parameters but also a full characterization of their uncertainty, which is vital for assessing model confidence.
Injecting Domain Knowledge via LLMs. We employ an LLM as a generative engine to explore the space of these structural configurations. Prompted with domain knowledge K. (textual descriptions, known constraints, see Appendix E.4), the LLM generates simulator code: À ~ PL K.). For example, given a description of hospital workflows, it might propose modules for patient arrivals, bed allocation, and discharge, linking them appropriately. This process injects domain-level causal hypotheses and expert heuristics (Pearl, 2009) directly into the simulator's s structure. fostering plausible generalization (P1) and en- suring consistency with real-world mechanisms (P3). We assume that the LLM, guided by K. and iterative feedback (see $3.3), can explore a sufficiently rich space of structures, including those closely approximating the true underlying system.
3.2.1. A KEY CAVEAT WHEN USING SBI
SBI's core strength is delivering principled uncertainty quan- tification. The learned posterior p(w D, allows for robust analysis of parameter credible intervals and correla- tions. However, it is crucial to acknowledge a fundamental assumption: SBI's theoretical guarantees hold when the sim- ulator's s structure (A) is correctly specified (Cranmer et al., 2020). In G-Sim, we are actively searching for this structure. Therefore, when we perform SBI with a candidate structure X the resulting posterior p(w DD X is conditioned on a potentially misspecified model. While this posterior invaluable for calibrating the given structure, its uncertainty estimates do not capture the struciural uncertainty of the model search itself. This highlights the synergistic, yet dis- tinct, roles of LLM-driven structural search and SBI-based parameter inference within G-Sim (Appendix B.4).
3.2. Empirical Grounding via Likelihood-Free Calibration
While the LLM defines the simulator's structure (A), its numerical parameters (w) must be aligned with empirical data (D). LLMs alone are often unreliable for precise quan- titative estimation (Vafa et al., 2024). G-Sim addresses this by treating the simulator as a black box and offering choice between two powerful calibration approaches that are both gradient-free and likelihood-free. This provides maximum flexibility, accommodating the non-differentiable, stochastic, and discrete components common in real-world systems.
3.3. Diagnostics- -Drvnn Iterative Refinement
A proposed structure, even when calibrated, might still ex- hibit inaccuracies or miss crucial dynamics. G-Sim ad- dresses this via an iterative refinement loop that identifies weaknesses and guides the LLM toward better designs.
Diagnostic Evaluation. After calibration, we evaluate the current simulator (A,w*) using a diagnostic function, Diag(A,w"). This function aggregates signals indicating mismatch, such as:
Pathway 1: Parameter Estimation with Gradient-Free Optimization (GFO). The first option to use GFO to find a single best-fit set of parameters. We use evolutionary strategies (ES), implemented via EvoTorch (Toklu et al., 2023), to find a point estimate w that minimizes a fitness function, I [we, A). This function measures the discrepancy (c.g.. MSE or MMD) between simulated trajectories and observed data D. By not requiring gradients of the simulator,
Predictive Diserepancy (Spredictive): Metrics like Wasserstein distance or MSE comparing simulated tra- jectories to held-out data (Appendices E.8 and H).
Domain Violations (ddomain): Checks for compliance with known rules (e.g.. capacity limits, conservation laws) or plausibility under stress tests (Rauba et al., 2024; Li & Yuan, 2024).
5

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
The iteration loop continues for either mn total iterations (e.g.. m 16) or until Diag is below a convergence threshold for the fitness function (see Appendix B.2).
gle with sparse or fragmented data and fail under out-of- distribution interventions (Pearl, 2009; Peters et al., 2017).
Foundation Models as World Models. Recent work ex- plores harnessing large foundation models, including LLMs, to simulate environments for decision -aaoing (Gao ct al., 2024; Hao et al., 2023; Liu al., 2024; Yang et al., 2024; Xie et al., 2024; Wang et al., 2024b; Zhou al., 2024; Cherian et al., 2024). While even partially correct mod- els can boost sample efficiency in MBRL, they frequently produce biased or inconsistent trajectories when asked to simulate real-world systems (Vafa et al., 2024). Subtle in- accuracies and noise compounds over time (Lambert et al., 2022), and their limited capacity to systematically track multi-faceted interactions undermines their reliability for complex, real-world simulations.
Textual Feedback for In-Context Learning. When re- finement is needed, G-Sim synthesizes the diagnostic find- ings into natural language summary. For example: "The simulator overestimates ICU occupancy during weekends and fails to capture the weekly seasonality present in the data. Consider adding a time-dependent factor to arrival or discharge modules." " This text is fed back into the LLM's prompt, leveraging its in-context learning capabilities to guide the proposal of a revised structure, A(*+2), This cycle of proposing, calibrating, and refining (see Algorithm 1) al- lows G-Sim to converge towards simulator that is causally plausible, empirically aligned, and robust.
LLM-Coded Simulations. Several methods use LLMs to generate environment code. OMNI-EPIC and GenSim create open-ended environments for agent learning and do not aim to mirror real systems (Faldor et al., 2024; Wang et al., 2024a). WorldCoder (Tang et al.. 2024) is notable work aimed MBRL for deterministic, discrete logic but is only partially calibrated to real-world evidence through refinement. Consequently, it lacks robust mechanisms for handling stochastic processes, partial observations, or prin- cipled numerical parameter inference.
3.4. Practical Considerations: Automation, Expertise, and Prompts
While the G-Sim loop (Figure 1, Algorithm 1) is designed for a high degree of automation, practical deployment ben- efits from a nuanced understanding of its operation. The core iterative process runs automatically once initial do- main knowledge provided. However, human expertise can be optionally integrated. Domain experts can validate LLM-proposed structures against domain insights, inter- pret complex diagnostic results, or suggest specific stress tests. This "expert-in-the-loop" approach enhances trust and robustness, particularly in high-stakes applications.
Hybrid Digital Twins. Hybrid digital twins combine mechanistic models with data-driven corrections to capture unmodeled dynamics (Holt et al., 2024b), but they often assume continuous physical processes and do not fully gen- eralize to discrete, stochastic, or heavily modular domains.
Our prompt engineering strategy aims for efficiency: we use general reusable core prompts (Appendix E.4) that outline the task and code structure, supplemented by concise and environment-specife details. This requires only moderate effort, rather than extensive, custom- designd prompt de- sign. Detailed implementation specifics and code examples can be found in Appendix E.
Comparison with Prior Work. In Table 1, we summarize how G-Sim aligns with and diverges from these approaches. G-Sim's novelty lies in merging structural priors with flexible, gradient-free calibration of discrete or stochastic modules. This combination accommo- dates fragmented data and enables robust out-of -uitt--distriuttinn stress-testing and policy interventions, bridging the gap be- tween purely data-driven and purely LLM-generated simu- lators.
www.aiinnnwwwdde--bnnnne based
4. Related Work
We position G-Sim within four major research lisamss-dtt-drrvveee world models, foundation-model- based and LLM-coded world models, and hybrid digital twins high--highlighting key limitations that G-Sim overcomes for real-world simulation aamulaiio-buulding (an extended survey is provided in Appendix A).
Table 1. Comparison of G-Sim with representative methods. X indicates missing fcature, a supported one, while 1im denotes partial fulfillment. Structural Prior refers to uncovering simulator topology from domain knowledge. Data-form Flexible indicates support for continuous, discrete, or stochastic processes. Emp. Calib. stands for data-driven parameter calibration. OOD Stress
Data-Driven World Models. A large body of model- based reinforcement learning work focuses on purely data- driven approximations of environment dynamics (Ha &
means robust performance under out-of-distribution scenarios.
Structural
D-form-
Emp.
0OD
Method
Prior
Flex.
Callb.
Stress
Schmidhuber, 2018; Hafner et al., 2019; Alonso et al., 2023;
Hybrid Digital Twins
x
WorldCoder
lim
Micheli et al., 2023; Hafner et al., 2023; Ding et al., 2024; Bruce et al., 2024). While these world models effectively predict transitions and rewards in-iistribution, they strug-
Date -riven World Model
x
lim
G-Sim (Ours)
v
v
d
6

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
5. Experiments and Evaluation
Table 2. Test Wasserstein distance (lower is hetter) three
In this section, we evaluate G-Sim to verify that it can gener- ate simulators with higher fidelity than existing discovery or data-driven world models. Our experiments use both GFO and SBI for calibration.
euvironment-eenecaiionn tasks, averaged over five random seeds (+ denotes 95% Cls). Light-blue shading highlights our method.
Test Wasserstein distance (1)
Method
COVID-19
Supply Chain
Hospital Beds
Benchmark Environments. We evaluate G-Sim on three woal-worrd-nsspired simulation tasks that together capture (1) stochastic transitions, (2) rich, discrete state updates, and (3) partially observed states. Each task provides a dataset of state-action trajectories and a textual description of the environment, sampled from carefully hand-designed sim- ulator. First, our COVID-19 epidemiological simulation extends classical compartmental frameworks (Cooper et al., 2020; AlQadi & Bani- Yaghoub, 2022) to incorporate dis- crete, stochastic transitions; it tracks populations moving across compartments (c.g., susceptible, infectious, recov- ered). Second, the Supply Chain environment is based on the well-known "beer game" (Sterman, 1989), which simulates demand fluctuations and the resulting bullwhip effect across multiple stages (retailer, wholesaler, distribu- tor, manufacturer). This environment is partially observed because orders are processed in a pipeline, causing delays and uncertainty around incoming shipments. Finally, the Hospital Bed Scheduling environment simulates patient arrivals for three different diseases into a hospital with a finite number of ICU and standard care beds (Green, 2006; Koizumi et al., 2005; Brailsford, 2007). Each disease has its own arrival rate, length-of mortality probability, leading to partial observability and discrete, stochastic transitions (e.g., admissions, discharges, and deaths). We provide a detailed discussion of these tasks and their datasets in Appendix C.
DyNODE
65.1 1: 2:21
38.3 1 0.40
231 0.14
SINDy
23.9 0.40
1
199 0.04
RNN
16.7 1.61
9.71 1
199 2.49
Transformer
3.30 + 0.15
2.29 0.06
199 0.25
Genetic Program
63.6 # 7.61
30.7
231 0.04
G-Sim-FS Abl. ZemShot
1.17 + 0.71
2.63 + 2.79
102 1.01
G-Sim-ES Abl. ZeroShotOptim
0.469 + 0, 0,107
9.89 15.3
103 :: 2.06
G-Sim SBI
0.351 1 0.094
1.22 .1 1.68
5.24 1. 2.70
G-Sim-ES ES
0.405 0,060
1.55
1.39
101 17.4
mechanistic or symbolic equations directly from data: we use SINDy (Brunton et al.. 2016) and a Genetic Program (De Rainville et al., 2012) that searches for symbolic expres- sions via evolutionary algorithms. Moreover we compare two variants of G-Sim, of G-Sim with GFO of Evolutionary Strategies (ES) (G-Sim - ES) and G-Sim with simulation based inference (SBI) (G-Sim SBI). Lastly, to isolate the contributions of G-Sim's 's iterative refinement, we in- clude two ablations: (G-Sim-ES Abl. ZeroShot) uses the LLM to generate simulator code once (with no parame- ter calibration), and (G-Sim-ES Abl. ZeroShotOptim) applies gradient-free optimization only to numerical param- eters (without adjusting the structural design). All baselines share the same training and evaluation splits, and detailed implementation and hyperparameter settings are given in Appendix D.
distribution, and daily
Evaluation Metrics. We adopt the Wasserstein distance as our primary evaluation metric. From each initial state in the held-out test set, we simulate N trajectories under both the ground-truth and comparison simulators, then compute the Wasserstein distance between these two sets of next-state samples. We repeat this for all initial states in the test set and average the distances, thereby measuring how well each simulator reproduces the ground-truth distribution. We run five independent trials with different seeds, reporting the mean and 95% confidence intervals. Further details are provided in Appendix H.
6. Main Results
We evaluated all benchmark methods across the three en- vironments, with results tabulated in Table 2. G-Sim con- sistently achieves the lowest Wasserstein distance on the held-out test data, indicating that its generated simulators model the ground-trutt system dynamics with the highest fidelity. The performance gap is particularly pronounced in the complex Hospital Bed Scheduling task, where data- driven methods struggle significantly.
We compare G-Sim against a di- verse set of approaches covering three main categories. First, data-driven world models learn environment dynamics from state-action trajectories without explicit structural priors: we employ recurrent neural network (RNN) (Rumelhart et al., 1986), a competitive causal Transformer (Melnychuk et al., 2022), and a neural ordinary differential equation with ac- tion inputs (DyNODE) (Chen et al., 2018; Alvarez et al., 2020). Second, equation discovery methods aim to uncover
Benchmark Methods.
Beyond predictive accuracy, we demonstrate G-Sim's unique capability to answer "what if?" questions involving policy or structural interventions that lie outside the train- ing data distribution. These insight experiments showcase G-Sim's 's ability to generalize to novel scenarios and inform decision decision-making in complex systems, a task for which other methods lack direct mechanism.
7

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
.5411
14
Table 3. Comparison of optimal policies for Ground Truth and G- Sim environments. We report the lockdown start day т, additional beds AB, and total cost. G-Sim identifies a policy that closely approximates the ground truth's ' optimal strategy with minimal cost deviation.
Lioklows
Soxt
Farly MoCe
Farly, Strnet
Torly
Mode.
Stnd. Shert
Suie
Method
A
Cost
Ground Truth Best
10
2500
29,274
G-Sim Best
15
2500
32,703
Figure 2. Lockdown intervention on COVID-19 SIR. We impose a temporary lockdown (grey rectangles with opacity proportional to intensity) by scaling the infection rate B + 3 for different start/end times and a E {0.05, 0.1, 0.15, 0.3]. The solid lines are ground truth; dashed lines G-Sim's predictions. G-Sim cor- rectly adapts to these unseen interventions, maintaining predictive performance.
Time
Cost
G-Sim Fav
300
Lovd Tiue
13:44
200
Load Time
200
100
100
2415
0
10
15
0
5
10
13
DebaaU
DeettC
6.1. Insight Experiments and Policy Interventions
Figure 3. Supply-chain resource optimization. Heatmaps of total cost Cost E) as function of extra capacity AC and lead time &. Left: Ground truth. Right: G-Sim. Both heatmaps exhibit similar cost landscapes, demonstrating that G-Sim effectively models the cost trade-offs.
SIR Lockdown Interventions. We first examine a COVID-19 scenario where a lockdown multiplier a E [o, 1] scales the infection rate 3 for a specified interval [fss fend]- This models the effect of a temporary lockdown by reducing the rate of new infections. We impose multiple lockdown scenarios by varying a and the lockdown duration to as- sess whether G-Sim can accurately replicate the resulting infection trajectories.
varying both AC (extra warchouse capacity) and & (lead time). Figure 3 presents heatmaps of the total cost as a function of AC and É for both the ground truth and G-Sim environments. The striking similarity in the global struc- ture of the cost landscapes indicates that G-Sim accurately captures the trade-offs between capacity expansion and ship- ping delays. Consequently, the optimal regions in the G-Sim environment align closely with those in the ground truth, af- firming G-Sim's 's reliability for strategic resource allocation.
Figure 2 compares the ground truth with G-Sim's pre- dictions under different lockdown intensities (a 0.05, 0.1, 0.15, 0.3). Despite not encountering lockdown events during training, G-Sim successfully captures the de- layed and reduced infection peaks corresponding to the imposed interventions. In contrast, the other baselines fail to incorporate this structural change, rendering them inap- plicable for such an analysis.
Varying Lead Times. In Appendix we further stress-test the supply chain simulator by introducing varying lead times f, which were not explicitly present dur- ing training, to test the simulator's 's ability to handle unseen delays.
Supply Chain:
Policy Optimization. Next, we demonstrate G-Sim's 's util- ity for policy optimization by searching over a discrete set of interventions in the Hospital Bed Scheduling task. The interventions combine capacity expansion (AB, additional beds) and lockdown scheduling (r, the start day of a fixed 20-day lockdown). The cost function to minimize is:
7. Discussion and Conclusion
Cost Overflow + 10 x AB + 20 .uckton,dduration,
We introduced G-Sim, novel framework that automates simulator construction by synergizing LLM-driven struc- tural design with rigorous empirical calibration. G-Sim's key innovation is its flexibility, offering a choice of powerful, likelihood- and gradient-free techniques: Gradient- Free Optimization for direct parameter estimation or Comulation-Basse Inference for Bayesian posterior infer- ence. This hybrid approach overcomes the critical limita- tions of purely data-driven models (poor OOD generaliza- tion) and purely LLM-generated ones (lacking empirical grounding).
where Overflow is the number of patients exceeding bed capacity.
We optimize over the grid (r, AB) 50.5....,99 95} x {0, 9500}. Table 3 shows that the best policy found using the G-Sim simulator is nearly identical to the true optimal policy, demonstrating that policies optimized with G-Sim are effective and transferable to the real envi- ronment.
Supply Chain: Resource Optimization. We explore re- source optimization in the supply chain environment by
G-Sim's 's iterative refinement loop co-evolves simulator's
8

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
structure and parameters, driven by diagnostic feedback, to achieve both causal plausibility and empirical alignment. The option to use SBI is particularly powerful for applica- tions requiring principled uncertainty quantification. How- ever, a key technical nuance must be appreciated: SBI's guarantees assume a correct model structure. Within G- Sim's search process, SBI posteriors correctly reflect pa- rameter uncertainty given proposed structure, but do not capture the overarching structural uncertainty. Modeling this structural uncertainty explicitly is vital frontier for future research.
expertise, and transparency regarding assumptions are eru- cial for responsible use, ensuring these simulators support ethical and beneficial real-world applications.
References
Alonso, E., Micheli, V., and Fleuret, F. Towards efficient world models. In Workshop on Efficient Systems for Foundation Models @ ICMI.2023, 2023.
AlQadi, H. and Bani-Yaghoub, M. Incorporating global
dynamics to improve the accuracy disease models: Ex- ample of covid-19 sir model. Plos one, 17(4):e0258815. 2022.
The practical implications of G-Sim are significant. By producing intervenable simulators with plausible generaliza- tion, G-Sim facilitates robust "what if?" analyses in critical domains like epidemic planning, supply chain management, and healthcare logistics. Our experiments demonstrate that G-Sim not only replicates observed dynamies but also ac- curately predicts system behavior under novel conditions, offering a powerful tool for policy evaluation and design.
Alvarez, V. M. M., Rosca, R., and Fälcujescu, C. G. Dyn- ode: Neural ordinary differential equations for dynam- ics modeling continuous control. arXiv preprint WXXi:2009.04228, 2020.
Åström, K. Introduction stochastic control theory, vol- ume 70 of Mathematics in science and engineering, Aca- demic Press, 1970.
Limitations remain, notably the scalability to extremely high-dimensional systems and ensuring the LLM's proposed structures are sufficiently diverse. We discuss these, along with ethical considerations and future work, in Appendix G.
Banks, J. Handbook of simulation: principles, methodology, advances, applications, and practice. John Wiley & Sons, 1998.
In conclusion, G-Sim offers flexible and robust path towards building more accurate, causally consistent, and uncertainty-awant simulations. By integrating structural rea- soning with data-driven calibration, it marks a significant step forward in automatic simulation generation, enabling deeper insights and better decisions in complex systems.
Banks, J., Carson, J., Nelson, B., and Nicol, D. Discrete- Event System Simulation. Prentice-Hall, 5 edition, 2010.
Batista, F. K., del Rey, A. M., and Queiruga-Dios. A. A Review of SEIR-D Agent- Based Model. In Distributed Computing and Artificial Intelligence, 16th International Conference, Special Sessions, pp. 133-140. Springer In- ternational Publishing. 2020.
Acknowledgements
We extend our gratitude to the anonymous reviewers, area and program chairs, and members of the van der Schaar lab for their valuable feedback and suggestions. We also thank Daniel Gedon for their insightful comments and suggestions that ultimately improved this work. SH & ML gratefully acknowledge the sponsorship and support of AstraZeneca. AB acknowledges funding from Eedi. This work was sup- ported by Azure sponsorship credits granted by Microsoft's AI for Good Research Lab and by Microsoft's 's Accelerate Foundation Models Academic Research Initiative.
Bommasani, R., Hudson, D. A., Adeli, E., Altman, R., Arora, S., von Arx, S., et al. On the opportunities and risks foundation models. arXiv preprint arXiv:2108.07255 2021.
Bonabeau, E. Agent-based modeling: Methods and tech- niques for simulating human systems. Proceedings of the National Academy of Sciences, 99:7280-7287, 2002.
Brailsford, S. C. Tutorial: Advances and challenges in healthcare simulation modeling. In 2007 Winter simula- tion conference, pp. 1448.. IEEE, 2007.
Impact Statement
Our approach (G-Sim) can enhance decision-making in fields like healthcare, logistics, and climate science by au- tomating simulator construction from sparse data and do- main knowledge, enabling safer, cost-effective "what if?" analysis. However, reliance on LL.--generted structures or calibration with biased data could risk misleading outcomes if not properly validated. Appropriate oversight, domain
Bruce, J., Dennis, M., Edwards, A., Holker,, J., Shi, Y., Hughes, E., Lai, M., Mavalankar, A., Steigerwald, R., Apps, C., Aytar, Y., Bechtle, S., Behbahani, F., Chan, S., Heess, N., Gonzalez, L., Osindero, S., Ozair, S., Reed, S., Zhang, J.,, Zolna, K., Clune, J., de Freitas, N., Singh, S., and Rocktäschel, T. Genie: Generative interactive environments, arXiv, 2024.

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Brunton, S. L.., Proctor, J. L.,, and Kutz, J. N. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the national academy of sciences, 11((15)3332-333 -937999729339-- 2016.
Gao, C., Lan, X., Li, N., Yuan, Y., Ding, Zhou, Z.,, Xu, F., and Li, Y. Large language models empowered agent- based modeling and simulation: A survey and perspec- tives. Humanities and Social Sciences Communications, 11(1):1259, 2024.
Chen, M., Tworek, J., Jun, H., Yuan, Q.. de Oliveira Pinto, H. P., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., and et al. Evaluating large language mod- els trained on code. arXiv, 2021.
Green, L. Queueing analysis in healthcare. Patient flow: reducing delay in healthcare delivery, pp. 281-307, 2006.
Gretton, A., Borgwardt, K. M., Rasch, M. J., Schölkopf, B., and Smola, A. A kernel two-sample test. Journal of Machine Learning Research, 13(25))72--73, 2012.
Chen, R. T., Rubanova, Y., Bettencourt, J., and Duvenaud, D. K. Neural ordinary differential equations. Advances in neural information processing systems, 31, 2018.
Griesemer, S., Cao, D., Cui, Z., Osorio, C., and Liu, Active sequential posterior estimation for sample-efficient simulation-basse inference. In The Thirty-eighth Annual Conference Neural Information Processing Systems, 2024. URL https: https:: wpwpreveeeeeeeeeeeeeeeeeeeeeeeee net forum? i Id=fkusetOnd
Cherian, A., Corcodel, R., Jain, S., and Romeres, D. Lim- phy: Complex physical reasoning using large language models and world models. arXiv, 2024.
Choudhury, A. and Basak, A. Statistical inference on traffic intensity in an M M/M/ queueing system. International Journal of Management Science and Engineering Man- agement, 13(4):274-27)) 279, 2018.
Ha, D. and Schmidhuber, J. World models. arXiv preprint arXiv: 1803. 1803.1012, 2018.
Hafner, D., Lillicrap, T., Fischer, I., Villegas, R., Ha, D., Lee, H., and Davidson, J. Learning latent dynamics for planning from pixels. In Proceedings of the 36th Inter- national Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 2555- 2565. PMLR, 2019.
Cooper, I., Mondal, A., and Antonopoulos, C. G. A sir model assumption for the spread of covid-19 in different communities. Chaos, Solitons Fractals, 139:1 10057, 2020.
Coumans, E. and Bai, Y. Pybullet, python module for physics simulation for games, robotics and machine learn- ing. http:/ htg.hht:t:/pyyluleete /pybulllt..... orrg 2021-2021.
Hafner, D., Pasukonis. J., Ba, J., and Lillicrap. T. Mastering diverse domains through world models. arXiv preprint 23X1v:2301.04104, 2023.
Cranmer, K., Brehmer, J., and Louppe, G. The fron- tier of simulation-based inference. Proceedings of the National Academy of Sciences, 117(48):30055- 30062, 2020, doi: 10.1073/pnas.1912889117 1912789117. URL https: /tt::://wwwwww http:/wwppp...o..///o//.. pnas. 1912789117
Hao, S., Gu, Y., Ma, H., Hong, J., Wang. Z., Wang, D. Z., and Hu, Z. Reasoning with language model is planning with world model. In The 2023 Conference on Empirical Methods in Natural Language Processing, 2023.
pnas. wwtp///g////ooooooooo// wtw///////////eeeeeeeeaeeeeaaeee 10...
Hermans, J., Delaunoy, A., Rozet, F., Wehenkel, A., Begy, V., and Louppe, G. A trust crisis in simulation basedd inference? your posterior approximations can be unfaith- ful, 2022. URL https:://///..... /ttp:////xxvvvooo abs/ 2110. 06581.
De Rainville, F.M.,, Fortin, F-A.,, Gardner, M.-A., Parizeau, M.. and Gagné, C. Deap: A python framework for evo- lutionary algorithms. In Proceedings of the 14th annual conference companion on Genetic and evolutionary com- putation, pp. 85 85-92, 2012.
Holt, S., Davehev, T., Tirumala, D., Moran, B., Lin, Y., Lau- rens, A., Iscen, A., Frey, E., Wulfmeier, M., Romano, F, al. Evolving control: Evolved high frequency control for continuous control tasks. In CoRL Workshop Safe and Robust Robot Learning for Operation in the Real World, 2024a.
Ding, J., Zhang, Y., Shang, Y., Zhang, Y., Zong, Z., Feng, J., Yuan, Y., Su, H., Li, N., Sukiennik, N., Xu, F,, and Li, Y. Understanding world or predicting future? a compre- hensive survey of world models. arXiv, 2024.
Faldor, M., Zhang, J., Cully, A., and Clune, J. Omni-epic: Open-endedness via models of human notions of inter- estingness with environments programmed code. In Intrinsically and Open- Ended Learning Work- shop@ NeurIPS2024, 2024.
Holt, S., Liu, T., and van der Schaar, M. Automatically learning hybrid digital twins of dynamical systems. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024b.
Open-Ended
10

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Holt, S., Qian, Z., Liu, T., Weatherall, J., and der Schaar, M. Data-driven discovery of dynamical systems in phar- macology using large language models. Advances in Neu- ral Information Processing Systems, 37:96325-96333 2024c.
Li, D., Sohn, S. S., Zhang, S., Chang, C.-J., and Kapadia, M. From words worlds: Transforming one-line prompts into multi-modal digital stories with IIm agents. In Pro- ceedings of the 17th ACM SIGGRAPH Conference on Motion, Interaction, and Games, pp. 1-12, 2024.
Kacprzyk, K., Holt, S., Berrevocts, J., Qian, Z., and van der Schaar, M. Ode discovery for longitudinal het- erogeneous treatment effects inference. arXiv preprint arXiv:2403.10766 2024.
Li, K. and Yuan, Y. Large language models test case generators: Performance evaluation and enhancement. arXiv, 2024.
Li, Y., Choi, D., Chung, J., Kushman, N., Schrittwieser, J., Leblond, R., Eccles, T., Keeling, J., Gimeno, F., Dal Lago, A., et al. Competition- code generation with alpha- 1092-1097,
Kantorovich, L. V. Mathematical Methods of Organizing and Planning Production. Management Science, 6(4): 366 422, 1960.
code. Science, 10966224 2022.
Lian, X., Wang, S., Ma, J., Tan, X., Liu, F., Shi, I.,, Gao, C., and Zhang, L. Imperfect code generation: Uncovering weaknesses in automatic code generation by large lan- guage models. In Proceedings of the 2024 IEEE/ACM 46th International Conference on Software Engineer- ing: Companion Proceedings, ICSE-Companion '24, pp. 422-423, 2024.
Kelly, R. P., Warne, D. J., Frazier, T., Nott, J., Gutmann, M. U., and Drovandi, C. Simulation-based bayesian inference under model misspecification, 2025. URL http::::///xxx.vxorre httprr//ab//203..333 1233.
Kermack, W. O., McKendrick. A. G., and Walker, G. T. A contribution to the mathematical theory of epidemics. Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Char- acter, 115(772):700-721, 1997.
Liu, Z., Hu, H., Zhang, S., Guo, H., Ke, S., Liu, B., and Wang, Z. Reason for future, act for now: principled architecture for autonomous IIm agents. In Proceedings of the 41st International Conference on Machine Learning, ICML 24. JMLR.org. 2024.
Khalifa, A., Bontrager, P., Earle, S., and Togelius, J. Pegrl: Procedural content generation via reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intel- ligence and Interactive Digital Entertainment, volume 16, pp. 95-101, 2020.
Loshchilov, I., Hutter, F,, et al. Fixing weight decay regu- larization in adam. arXiv preprint 2017.
5.
Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprini arXiv:1412.69000 1412.9980 2014.
Luo, F.-M, Xu, T., Lai. H., Chen, X.-H., Zhang, W., and Yu, Y. A survey on model-based reinforcement learning. Science China Information Sciences, 67(2):121101, 2024.
Klinger, T., Liu, Q., Crouse, M., Dan, S., Ram, P., and Gray, A. G. Compositional program generation for systematic generalization. In International Joint Conference on Arti- ficial Intelligence 2023 Workshop on Knowledge-Bar Based Compositional Generalization, 2023.
Melnychuk, V., Frauen, D., and Feuerriegel, S. Causal trans- former for estimating counterfactual outcomes. In Inter- national Conference Machine Learning, pp. 15293- 15329. PMLR, 2022.
Koizumi, N., Kuno, E., and Smith, T. F. Modeling patient flows using queuing network with blocking. Health cure management science, 8:49-60, 2005.
Micheli, V., Alonso, E., and Fleuret, F. Transformers are sample-efficient world models. In The Eleventh Interna- tional Conference Learning Representations, 2023.
Lambert, N., Pister, K., and Calandra, R. Investigating com- pounding prediction errors learned dynamics models. arXiv, 2022.
Nott, J., Drovandi. C., and Frazier, D. T. Bayesian Inference for Misspecified Generative Models. An- nual Review of Statisticy and Its Application, 11: 179 202, 2024. ISSN 2326-8298, 2326-831X. doi: URL
Law, A. M. and Kelton, W. D. Simulation Modeling and Analysis. McGraw-Hill 2000.
10. 141aammnessaaiiiii00000022000000
revi
org axgp/oonntet//oorrlll///..11 sanuees-ttatisiiis--0------
Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., tau Yih, W., Rocktäschel, T., Riedel, S., and Kiela, D. Retrieval- augmented generation for knowledge-intensss nlp tasks. arXiv, 2021.
Oliver, J. Scenario planning: Reflecting on cases of actionable knowledge. Futures Foresight Science, (3-4):e164, 2023.

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Pearl, Causality: Models, Reasoning and Inference. Cam- bridge University Press, 2nd edition, 2009.
Shanthikumar, J. G. and Wu, C. On the starshapeness of g/g/c queueing systems. Advances in Applied Probability, 23(2)431-435, 1991.
Peters, J., Janzing, D., and Schlkopf, B. Elements of Causal Inference: Foundations and Learning Algorithms. The MIT Press, 2017.
Shewchuk, and Chang, T.-C. An approach object- oriented discrete-event simulation of manufacturing sys- tems. In 199/ Winter Simulation Conference Proceed- ings., pp. 302-311, 1991.
Pouplin, T., Sun, H., Holt, S., and Van der Schaar, M. Retrieval-augmmnted thought process sequential de- cision making, arXiv e-prints, pp. arXiv-2402, 2024.
Shin, s., Jo, Y., Ahn, S., and Lee, N. A closer look at the intervention procedure of concept bottleneck models. In Workshop on Trustworthy and Socially Responsible Machine Learning, NeurlPS 2022, 2022.
Rauba, P., Seedat, N., Luyten, M. R., and van der Schaar, M. Context-aware testing: A new paradigm for model testing with large language models. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024.
Shlens, J. Notes on kullback-leibler divergence and likeli- hood. arXiv, 2014.
Rosenberger, J. Configural polysampling: A route to practi- cal robustness., 1993.
Spirtes, P., Glymour, C., and Scheines, R. Causation, Pre- diction, and Search. The MIT Press, 2001.
Rumelhart, D. E.,, Hinton, G. E., and Williams, R. J. Leam- ing representations by back pco-prroaggatin errors. Nature, 323(6088) 1986.
Spurio Mancini, A., Docherty, M. M., Price, M. A., and McEwen, J. D. Bayesian model comparison for simulation- inference. RAS Techniques and In- struments, 2(1):710-722, 2023. ISSN 2752-8200, doi: 10.1009/rassiirzza0551. URL https: /doi org/10. 1093
Sahoo, P., Singh, A. K., Saha, S., Jain, V., Mondal, S., and Chadha, A. A systematic survey of prompt engineering in large language models: Techniques and applications. arXiv, 2024.
Sterman, J. D. Modeling managerial behavior: Mispercep- tions of feedback in dynamic decision making experi- ment. Management science, 35(3):321-339, 1989.
Salimans, T., Ho, J., Chen, X., Sidor, S., and Sutskever, I. Evolution strategies as a scalable alternative to reinforce- ment learning. arXiv, 2017.
Sutton, R. S. and Barto, A. G. Reinforcement learning: An introduction. MIT press, 2018.
Sammut, C. and Webb, G. I. Encyclopedia of machine learning. Springer Science & Business Media, 2011.
Talts, S., Betancourt, M., Simpson, D., Vehtari, A., and
Schmitt, M., Bürkner, P.-C., Köthe, U., and Radev, T. Detecting model misspecification in amortized bayesian inference with neural networks. In Köthe, U. and Rother, C. (eds.), Pattern Recognition, pp. 541-557. Springer Nature Switzerland, 2024. ISBN 978-3-031-54605-L
Gelman, A. Validating bayesian inference algorithms with simulation-based calibration, 2020. URL https:
//arxiv. wwwp://www.w./////eee.oooooese/ /184 06788.
Tang, H.,, Key, D. Y., and Ellis, K. Worldcoder, model- based LLM agent: Building world models by writing code and interacting with the environment. In The Thirty- eighth Annual Conference on Neural Information Pro- cessing Systems, 2024.
Schug, S., Kobayashi, S., Akram, Y., Wolczyk, M., Proca, A. M., Oswald, J. V., Pascanu, R., Sacramento, J., and Steger, A. Discovering modular solutions that generalize compositionally. In The Twelfth International Conference Learning Representations, 2024.
Toklu, N. E., Atkinson, T., Micka, V., Liskowski, P., and Srivastava, R. K. Evotorch: Scalable evolutionary com- putation in python. arXiv, 2023.
Sehnke, F., Osendorfer, C., Rückstieß, T., Graves, A., Pe- ters, J., and Schmidhuber, J. Parameter-exploring policy gradients. Neural Nerworks, 23(4):551-55)) 2010.
Uehara, M., Shi, C., and Kallus, N. A review of off-policy evaluation in reinforcement learning. arXiv. 2022.
Settles, B. Active learning literature survey. University of Wisconsin-Madiisn Department of Computer Sciences, 52(55-66):11, 2009.
Vafa, K., Chen, J. Y., Rambachan, A., Kleinberg, J., and Mullainathan, S. Evaluating the world model implicit in a generative model. In The Thirty-eighth Annual Confer- ence on Neural Information Processing Systems, 2024.
Shaker, N., Togelius, J., and Nelson, M. J. Procedural content generation games. 2016.
12

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L.,, Gomez, A. N., Kaiser, t.,, and Polosukhin, I. At- tention is all you need. Advances in neural information processing systems, 30, 2017.
Wang, L., Ling, Y., Yuan, Z., Shridhar, M., Bao, C., Qin, Y., Wang, B., Xu, H., and Wang, X. Gensim: Generating robotic simulation tasks via large language models. In The Twelfth International Conference on Learning Repre- sentations, 2024a.
Wang, R., Todd, G., Xiao, Z., Yuan, X., Côté, M.-A., Clark, P., and Jansen, P. Can language models serve as text- based world simulators? arXiv, 2024b.
Wehenkel, A., Gamella, L., Sener, O., Behrmann, J., Sapiro, G., Cuturi, M., and Jacobsen, J.-H. Addressing misspecificatioo in simulation-basse inference through data-driven calibration, 2024. URL httph:ttp///oo /tttpps///riiii /arvxvv. org/abs 2t0.b///455.01155 08719.
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Xia, F., Chi, E., Le, Q. V., Zhou, D., al. Chain-of Chain-of-thought prompting elicits reasoning in large language models. Advances in neural information processing systems, 35:24824-24837, 2022.
Wei, X., Kumar, N., and Zhang, H. Addressing bias in generative AI: Challenges and research opportunities in information management. Information & Management, 62(2), 2025.
Xie, K., Yang, I., Gunerli, J., and Riedl, M. Making large language models into world models with precondition and effect knowledge. arXiv, 2024.
Yang, C., Wang, X., Jiang, J., Zhang, Q. and Huang, X. Evaluating world models with Ilm for decision making. arXiv, 2024.
Zhou, S., Zhou, T., Yang, Y., Long, G., Ye, D., Jiang, J., and Zhang, C. Wall-e: World alignment by rule learning improves world model-based Imm agents, arXiv, 2024.
13

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
Appendix
Table of Contents
Extended Related Work
16
A.1 Data-Driven World Models
16
A.2 Foundation Models World Models
A.3 LLM-Coded Simulations
16
A.4 Hybrid Digital Twins and Mcchanistic Models
A.5 Procedural Content Generation & Environment Simulation
A.6 Active Learning and Iterative Refinement
A.7 Comparison with Prior Work
17
B Additional Theoretical Considerations and Implementation Details
18
B.I LLM Coverage Assumption
B.2 Structural Identifiability
18
B.3 Prompt-Engineering for Broader LLM Coverage
20
B.4 Limitations of Simulation- -aase Inference in G-SIM
21
Benchmark Dataset Environment Details
C.I COVID-19 SIR Environment
22
C.2 Supply Chain Environment
24
C,3 Hospital Bed Scheduling Environment
25
Performing Intervention Insight Experiments
D Implementation Details for Baseline Methods
29
E
G-Sim Implementation Details
31
E.1
Overall G-Sim Framework
31
E.2
Pseudocode
................................
31
E.3
Training and Calibration Details..
32
E.4
Prompt Templates and Structural Generation
................................
33
E.5
Diagmostics Computation and Refinement
35
E.6
Implementation Notes
................................
35
E.7
Full G-Sim Workflow Summary
36
E.8
Implementation of the Diagnostic Function Diag
36 ................................
E.9
Observed Speed-Ups via Parallclization
36
E.
Handling Stochastic Simulators
36
E.11
Summary of Key Implementation Steps
36
F
Illustrative G-Sim Prompt Example
38
F Env Prompts
39
G Future work and broader impact
42
Expanding the Scope Simulation
G.2 Potential Uses Beyond Intervention Testing
43
Limitations and Future Directions
14

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Fre Free Calibration
G.4
Ethical Considerations and Mitigation Strategies
44
H Evaluation Metrics
45
Additional Experiments
46
1.1
Out-of- Distribution Generalization: Supply Chain Backlog
46
1.2
Structural Accuracy via Causal Discovery Metries
47
1.3
Parameter Calibration: GFO vs. Simulation-Bast Based Inference (SBI).
47
1.4
Computational Performance: Training Times and Parameters
48
1.5
Iterative Refinement by G-Sim: An Example
48
15

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Frree Calibration
A. Extended Related Work
Automatically building general-purper simulators has been a longstanding challenge in machine learning and simulation research. Below, we position our proposed approach (G-Sim) within several primary research streams- including data-driven world models, foundation-model model-based and LLM-coded world models, and hybrid digital twins- highlighinn how G-Sim uniquely addresses their respective limitations for real-world simulation- building. We then expand on additional threads such as equation discovery, procedural content generation, and active learning.
A.1. Data-Driven World Models
A substantial body of work in model-based reinforcement learning (MBRL) focuses learning parametric approximations of environment dynamics purely from data (Ha & Schmidhuber, 2018; Hafner et al., 2019; Alonso et al., 2023; Micheli et al., 2023; Hafner et al., 2023; Ding et al., 2024; Bruce et al., 2024). Typically referred to as world models, these methods leverage neural networks to predict transitions and rewards, often in compressed latent space, to improve sample efficiency and planning performance. However, as discussed in our main paper, such purely data-driven approaches are ill-suited to broader system-level questions such as structural interventions or scenario analyses (Pearl, 2009; Peters et al., 2017; 7; Kacprzyk et al., 2024). They also rely heavily on large and representative datasets, which are often unavailable in real-world domains that suffer from sparse fragmented data, and they tend to break down under out-of-distributie conditions.
A.2. Foundation Models as World Models
Recent work explores using large foundation models (including LLMs) as world models for decision (Gao et al., 2024; Hao et al., 2023; Liu et al., 2024; Yang et al., 2024; Xie et al., 2024; Wang et al., 2024b; Zhou al., 2024; Cherian et al., 2024). These models can plausibly "role-play" entire environments given enough textual context, sometimes boosting sample efficiency in MBRL tasks. However, they frequently produce biased or inconsistent trajectories when asked to simulate real-world systems (Vafa et al., 2024). The limited capacity of language models to systematically track multi- faceted, time-evolving interactions leads to compounding errors (Lambert et al., 2022), undermining reliability in complex settings.
A.3. LLM-Coded Simulations
Another line of research employs LLMs to generate environment code for simulation. For example, OMNI-EPIC and GenSim build open-ended Pybullet (Coumans & Bai, 2016-2021) environments by synthesizing code in physics engines (Faldor et al., 2024; Wang et al., 2024a). While effective for agent exploration, these methods rarely aim to mirror real-world systems or align with empirical data. In contrast, the recent WorldCoder approach (Tang et al., 2024) does generate environment code from textual descriptions, supporting some iterative refinement with real-world evidence. However, it remains limited to deterministic logic, lacks robust mechanisms for handling partial observability stochasticity, and cannot systematically infer quantitative parameters from real data.
A.4. Hybrid Digital Twins and Mechanistic Models
Another relevant trend involves hybrid digital twins, which combine known mechanistic or physical processes with data- driven correctors (Holt et al., 2024b;c). These approaches excel in domains where a partial physical law or differential equation is known and can be complemented by a learned residual neural module. Yet they generally require substantial domain expertise to specify the underlying differential equation or other rigid differentiable forms, and do not generalize well to systems with discrete, stochastic events or partially specified modules. Likewise, purely mechanistic gquation-disoover approaches (e.g., SINDy (Brunton et al., 2016) or PDE-based symbolic regression) can uncover closed-form ODEs from data, but they often fail when the system is highly modular, partially observed, contains discrete jumps.
A.5. Procedural Content Generation & Environment Simulation
Procedural generation techniques have long been used in game design to create diverse levels or scenarios automatically (Shaker et al., 2016; Khalifa et al., 2020). L.Le- text-to-environment pipelines (Li al., 2024) can also create interesting scenarios from narrative descriptions. However, these approaches rarely incorporate real-world evidence or aim to produce calibraal transition dynamics. By contrast, G-Sim seeks not only to produce environment code but also to calibrate parameters against real (potentially fragmented) data, resulting in an environment that is both plausible and
16

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
empirically grounded.
A.6. Active Learning and Iterative Refinement
Active learning and simulation-bars based inference methods (Cranmer et al., 2020; Settles, 2009; Pouplin et al., 2024) have been utilized reduce data requirements and improve simulator fidelity. Gradient-free optimizers such as evolutionary strategies (Schnke et al., 2010; Toklu et al., 2023; Holt et al., 2024a) can handle non-differentiable or stochastic objectives by repeatedly simulating candidate parameter sets. While effective for calibration, these methods alone assume fixed simulator structure; they do not address how to build or refine the structural design itself. G-Sim integrates LLM-based structural generation and flexible calibration in an iterative loop, allowing the simulator's 's topology to be revised whenever diagnostics indicate insufficient fidelity or domain compliance.
A.7. Comparison with Prior Work
Table I summarizes key features of G-Sim in comparison to representative approaches. Purely data-driven (or purely LLM- driven) pipelines struggle with complex, partially observed, or discrete systems; they also lack a mechanism for systematically merging domain knowledge with real data. Hybrid digital twins require continuous or well-defined mechanistic equations, while purely code code-generating approaches often do not incorporate rigorous calibration steps. In contrast, G-Sim addresses these gaps by:
1. Leveraging LLM-guided structural proposals capture domain-appropriate topologies and submodules,
2. Using a choice of flexible, likelihood-free calibration methods (GFO or SBI) to tune parameters against real data,
3. Employing iterative refinement loop that diagnoses discrepancies and re-queries the LLM for adjustments.
This hybrid, compositional approach unlocks new capabilities for real-world simulator creation, where partial observations, non-differentiable transitions, and -iitr--distriuution policy interventions present.
Key Differences and Contributions. In sum, no prior framework integrates LLM-based structural reasoning, flexible parameter inference, and an iterative refinement mechanism to produce high-fidelity, data-grounded simulators a single pipeline. By unifying domain knowledge and empirical calibration, G-Sim offers robust scenario planning, policy intervention testing, and OOD stress-testing in ways that purely data-driven purely LLM -egeereee simulators cannot. We believe this synthesis of large language models, GFO, and SBI opens promising direction toward truly aulomatic environment generation for high-stakes real-world domains.
17

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
B. Additional Theoretical Considerations and Implementation Details
This appendix provides deeper look at the theoretical assumptions, identifiability properties, and practical implementations that underpin our G-Sim framework. Section B.1 discusses the nonzero coverage assumption for the LLM's structural proposals, including potential failure modes. Section B.2 expands on structural identifiability and equivalence classes. Section B.2 provides detailed guidelines for constructing the diagnosties function Diag. Finally, Section B.3 illustrates how to ensure sufficiently rich prompts to maintain broad coverage from the LLM.
B.1. LLM Coverage Assumption In the main text, assume:
( K)) > > 0 for all À E (S)),,
where (S) S C(S) is set of feasible structural configurations that adequately represent the real-world system (up to a certain approximation). This requirement guarantees that an iterative pereedure-repeaeellly prompting the LLM for revised structures can eventually propose a structure that is "close enough" to the true environment to support accurate inference.
When Coverage Might Fail. Several practical factors can undermine this assumption:
Under-trained or Domain-Missmtthhed LLM. If both the LLM's training corpus and the explicit knowledge IC lack relevant domain knowledge or code examples (c.g., queueing systems, compartmental epidemic models), then many relevant configurations may be assigned near-zero probability.
Excessive Prompt Constraints. Overly restrictive or poorly designed prompts can steer the LLM away from generating diverse substructures.
Novel or Rarely Documented Submodules. If the true system relies custom highly specific domain processes that rarely appear in public text corpora, the LLM might not "know" how to compose those substructures.
In such cases, either prompt-engineering K. or partial fine-tuning can help restore coverage (see Appendix B.3 and Appendix E.4). Ultimately, no structural representation supp(PLLM(() K.) is even approximately valid, no LLM approach can succeed.
Approximate vs. Exact Structural Matches. In real applications, there may be no perfectly correct simulator structure. Instead, (S) can be a collection of good enough or functionally sufficient structures (e.g., ignoring minor confounders, or grouping certain processes together). one such structure is proposed by the LLM, subsequent calibration w should suffice for robust predictions.
B.2. Structural Identifiability Definition. Structural identifiability typically refers to whether the mapping
(X, w) + possible data distributions from the simulator
is injective (one-to-one) in some relevant sense. In simpler terms: if two distinct structures or parameterizations generate identical distributions over observable data, they are structurally unidentifiable from an empirical standpoint.
Why This Matters. In our context, unidentifiable simulator might mean that even perfect (infinite) data is insufficient to discriminate between different submodule configurations. One example is an environment that can be explained equally well by either an M/M/ cc (Kermack et al., 1997) queue with a certain arrival rate or a more complex arrival process with time-varying rates, as long as the overall distribution of arrival times matches. Under such conditions, the refinement loop may not converge to a unique and we might have to choose heuristic such as Occam's razor (Sammut Webb, 2011) I).
Partial Identifiability and Equivalence Classes. In practice, especially with partially observed or unpaired data, we often only identify equivalence classes of structures. That is. the set of candidate À can remain multi-modal, with multiple plausible subgraphs explaining the data. In such cases, the final output might be a distribution or set over competing submodule graphs. One can still proceed do policy evaluations forward simulations by sampling from that distribution over possible structures.
18

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
Remedies.
Two approaches mitigate structural unidentifiability:
1. Additional Domain Knowledge. Imposing explicit structural constraints (e.g.. "patient severity depends on risk factors, not staff scheduling") can prune the space of submodules and break identifiability symmetries.
2. Refined Diagnostics. Using more fine-grained checks (e.g,, dissecting arrival patterns by time-of-day or day-of-week? can help discriminate between seemingly identical structures.
Ultimately, structural identifiability in highly complex systems remains an open challenge. We thus recommend domain experts remain in the loop to verify or reject certain submodule proposals as needed.
Design of the Diagnostics Function
The refinement loop (Section 3.3) in the main text relies on a diagnostic function
Diag (A,w")
R20
to measure goodness-of-ie fit and highlight structural gaps. This function, which we denote as d, aggregates various signals indicating how well the current simulator (X, w)) matches the real system. Below, we offer more details on how to implement Diag in a way that is both flexible and tractable, followed by how realised in practice.
PREDICTIVE CHECKS (PPC)
standard tactic in statistics is compare simulated data against real data. Specifically:
1. Generate Simulated Data: For the current structure À and calibrated parameters w", forward-simulate trajectories
[(m) f(; A, ). If using SBI, one would draw posterior samples (m)) p(w () and simulate for each.
2. Compute Summary Statistics: Calculate relevant summary statistics T (x(()) (e.g., mean arrival rates, bed occupancy distributions, trajectory-wise errors).
3. Measure Diserepancy: Compare the distribution of (x:m)) T(Dreu)) using suitable distance metrics.
This predictive discrepancy, ópedicttie, can be defined using metrics like:
Wasserstein distance (W1) (Kantorovich, 1960): Measures the 'work' required to transform distribution into another.
Maximum Mean Discrepancy (MMD) (Gretton et al., 2012): kernel-based distance often used in generative modeling.
Mean Squared Error (MSE): Useful for specific component outputs.
Kullback-Leibler (KL) divergence (Shlens, 2014): Measures information loss.
One might define Opredictive WASS (I(z(())) I(Drea)). weighted sum over multiple statistics.
PARAMETER UNCERTAINTY CRITERIA (FOR SBI)
When using Simulation- Based Inference (SBI) (Cranmer et al., 2020), the posterior distribution f(w | DD itself can signal model misspecification. A very large variance multiple distinct modes might indicate that the current structure À fails "pin down" key parameters. One could define diagnostic like:
Diagvar
Σ
(Var [ws] > >T3)
where T; a threshold for the variance of each parameter Wi-
19

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frre FFee Calibration
STRESS TESTING & PLAUSIBILITY CHECKS
To assess generalization and robustness, we can check the simulator's behaviour under out-of-diitrribtiion (OOD) scenarios or against known domain constraints (e.g., unit tests (Li & Yuan, 2024)).
K
Odamain
(Simulator yields implausible outputs under scenario 13)
1 iRule & violated)
Here, each 22 is a hypothetical stress test (e.g., a sudden surge in patient arrivals), and "implausible outputs" might include negative states or constraint violations.
COMBINING DIAGNOSTICS AND SETTING THE THRESHOLD (c)
The individual diagnostic components (Opredictives òdomain: etc.) can aggregated into a single scalar score, d Diag (A, w*). common approach is a weighted sum:
Diag w") W1 predictive + W2 Oommain
with weights w/ 2 O. This score is then compared against predefined threshold e. If d > E, refinement is triggered. When refinement occurs, the specific failing components inform the generation of textual feedback, guiding the LLM's next proposal.
PRACTICAL IMPLEMENTATION G-SIM
In our implementation, the diagnostic function (d) primarily relies Posterior Predictive Checks. We calculate both the Wasserstein distance and Mean Squared Error (MSE) between simulated trajectories (generated using parameters found via calibration) and a held-out validation dataset. These metrics provide a quantitative measure of how well the simulator's outputs match empirical observations.
The Wasserstein distance is used as the primary metric (d = predictive = Wi) for ranking different simulator structures generated by the LLM within each iteration and for tracking overall progress. However, the feedback provided to the LLM for refinement is more detailed. includes not only the overall Wasserstein score but also the MSE broken down per dimension of the simulator's state space. This allows the LLM to understand which specific parts of the simulator performing poorly (e.g., underestimating 'infected' counts overestimating 'inventory' levels) and propose more targeted structural changes.
Regarding the threshold (c), our framework uses an implicit approach. We do not set a specific numerical value for c. Instead, the refinement loop terminates based on two conditions:
1. Iteration Limit: A maximum number of G-Sim iterations (or 'generations') is defined in the configuration. This sets hard limit on the computational budget.
2. Early Stopping: We monitor the best Wasserstein distance achieved in each generation. If this score does not improve for a predefined number of consecutive generations (a 'patience' parameter), the loop terminates early.
This strategy means the refinement process continues as long as it is finding significantly better simulator structures within its budget, effectively setting based on observed progress rather than fixed priori value. When the loop terminates, the simulator with the lowest achieved Wasserstein distance is selected as the final output.
B.3. Prompt-Engineering for Broader LLM Coverage
Since the LLM proposals À govern the success of the refinement loop, prompt-engineeriin (Sahoo et al., 2024) is crucial for ensuring that:
1. The LLM has enough freedom to propose submodules beyond an initial guess.
2. The domain knowledge KC is well-articulated that the LLM can access relevant structural ideas.
3. Textual feedback from the diagnostic function Diag is expressed in a sufficiently precise and instructive manner, so that the LLM can respond by refining the submodule that is problematic with reasonable probability.
20

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Concrete Prompting Steps. In Appendix E.4 we provide the prompt templates that in our experiments.
In case one wished to explore multiple structural variants, they could sample multiple completions from the LLM (by adjusting temperature or top-k sampling), score each proposed structure via Diag and retain the best structure(s) for iteration. This approach follows an evolutionary search spirit in the space of submodule graphs. In practice, controlling sampling temperature or employing specialized generation routines (e.g.. "chain-of-thought (Wei et al., 2022) prompts that systematically reason about possible modules) can yield better coverage than a single pass (Wei et al., 2022). In any case, we leave these iterations of our framework future work.
Limitations. Even with carefully engineered prompts, the LLM might produce repetitive or irrelevant suggestions. If the system remains stuck in poor local optimum (see Appendix B.I), one might want to invoke direct expert intervention, manually expanding K. providing new submodule explicitly or specifying more explicit constraints. Indeed, while the iterative refinement loop can help, it not guaranteed to find global optimum if the LLM's proposal distribution or domain constraints are too limited.
B.4. Limitations of Simulation-Based Inference in G-SIM
While Simulation-Basees Inference (SBI) provides a principled route parameter estimation and uncertainty quantification (Cranmer et al., 2020), its naive adoption inside G-SIM requires special care because several of SBI's core theoretical assumptions are violated once the model structure is itself unknown.
The Model Mismatch Problem. Classical guarantees-ea, posterior consistency, well-calibrated credible sets and successful simulation-ban based calibration (SBC)-all all rely on the simulator [(; X", ,w) being correctly specified and fixed (Cranmer et al., 2020; Talts et al., 2020). In G-SIM we deliberately explore candidate structures ( generated by an LLM; whenever (9) * X" we enter a misspecified regime. Theory shows that Bayesian posteriors can become biased or over-confident under misspecification (Nott al., 2024), and recent empirical studies demonstrate the same failure modes for neural SBI algorithms (Hermans al., 2022; Kelly al., 2025). Hence the learned posterior ( y, (()) may still converge- but not the distribution that reflects our true uncertainty under the correct model.
Observational Signatures and Future Directions. Empirically, severe misspecification often manifests excessively broad or oddly-shaped posteriors (Hermans et al., 2022). Posterior-shape diagnostics based entropy or variance can flag such cases in amortised SBI (Schmitt et al., 2024; Wehenkel et al., 2024). Integrating these metrics into the Diag function would give G-SIM an automatic "carly-warning" system for structural defects.
Looking ahead, three research directions appear particularly promising:
Bayesian Model Averaging. Maintaining weighted ensemble of plausible structures and marginalising over them tackles structural as well as parametric uncertainty (Spurio Mancini et al., 2023; Wehenkel al., 2024).
Robust Guarantees under Approximate Correctness. Extending the analysis Nott et al. (2024) to simulators, or developing divergence-bast based bounds, could yield milder but still useful uncertainty guarantees even when ( is only approximately correct (Kelly et al., 2025).
Active Learning for Structure Discovery. between rival structures can accelerate the search process (Griesemer et al., 2024).
strategies that maximise posterior divergence
Equipping G-SIM with these tools would move beyond the single-model assumption inherited from classical SBI and towards principled treatment of structural uncertainty.
21

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
C. Benchmark Dataset Environment Details
evaluate our proposed approach on suite of real-world-inspired benchmark tasks, each designed to reflect critical properties of real system dynamics such as stochastic updates, discrete state transitions, and partial observability. These benchmark environments serve as testbeds for assessing how well different simulator-building frameworks capture complex behaviors, align with empirical data, and generalize interventions that absent from the training distribution. Here, describe in detail the structure, parameters, and data generation procedures for each environment, enabling reproducibility and clarifying the unique modeling challenges each setting presents.
C.1. COVID-19 SIR Environment
Our COVID-19 19 SIR environment is inspired by the classic compartmental SIR framework and extends modern discrete-time variants (Cooper et al., 2020; AlQadi & Bani- Bani- Yaghoub, 2022) by modeling discrete, stochastic transitions of individuals among three key health states:
S (Susceptible): Number of individuals who are healthy but can become infected.
I (Infectious): Number of currently infected individuals capable of transmitting the pathogen.
(Recovered): Number of individuals who have recovered (or are otherwise removed) from the disease, and cannot become infected again.
Simulation code and parameters. Listing illustrates the core update procedure. The simulator maintains two parameters, 33 and y, which govern transition rates:
3 (base transmission rate): Higher 3 implies that infections spread more aggressively in the population.
7 (daily recovery probabilit)): Individuals the I compartment recover and transition to at a Binomial rate characterized by ?-
At each step 1, the environment receives the current state 8t = (St, Jt, R&} and an action 0ç- While classical epidemic modeling may treat non- aan---aaaacuuticll interventions (NPIs) or policy actions as external controls, this particular version does not yet incorporate any direct effect of action. However, the simulator is extensible so that future versions can incorporate lockdowns, vaccination campaigns, or other interventions by modifying the effective 3 ry in time-varying manner.
Listing 1. Core step function of the COVID-19 SIR simulator. The enviromment updates (S, L, Rt by sampling the number of new infections and new recoveries from Binomial distribution.
class StavsatorSiep
def Inir (saff):
Defoult parameters: belam0.5, 1um1--0,1
self parameters (10.5 6.11. dype=fleat)
def ciep state: : diet. action: ist) + diet:
Performs siegle -step update discrate -time SIR model.
Extract companmennc
("5")
Unpack hera
Compate total population
N = I
If da Dr retarn ("S": 0, "I" 0, "R': 0) Descacrate east
Desocministic infection ptobebility (rate) fron sesceptible to infected proh infection 1.0 up Espi-beta
prob proh.infection np. clip pro..inicction. 0.0, 1.03
prob infection) Sisomialt.. scfe.binomicll..
Update compastmente
next.5 new.infsctions
nextll iww.infactions iou_rrcoverias
eee it new recavarizs
22

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frne FFee Calibration
roture (78% nest, "Eo noxt.l TRT n8)
Discrete-time updates.
Unlike continuous-time SIR model that ordinary differential equations, adopt discrete-time approach. At each discrete time step:
sew_infections Binomial St, 1 1 e )
new_recoveries Binomial, It 7):
Si+1 St new inffections, 1++1
new.infcctions neccvecoe,,,,s, R++1 R new.recveeries
Here, N, S; + I, + R2 is the total population at time t. When the population is nonzero, the probability of infection among susceptible individuals is modeled by 1 --e -A(tNNN)) reflecting a common deterministic approximation to the force of infection.
Stochastic transitions. The model draws random samples for new infections and recoveries using Bi Binomioe all function; hence the counts new infections or recoveries vary across simulations, even with the same initial condition and parameters. This yields more realistic depiction of outbreaks compared to purely deterministic SIR.
State-action trajectories. For the experiments in the main text, we generate multiple trajectories of length T starting from diverse initial conditions (So, To, Ro). Even though the action is unused in the provided snippet, we include in the simulator's interface so that interventions (e.g., lockdowns) can be readily modeled by modifying 3 on certain steps or by implementing direct changes to (S, 1, R). This approach follows typical RL-friendly environment design (Sutton & Barto, 2018).
Sampling procedure for dataset generation.
To create training and evaluation datasets:
We sample initial conditions (So, Jo, Ro) from broad distribution (e.g.. So ~ Unif(900, 1000), to ~ Unif(1, 20), Ro 0).
We simulate for T = 60 steps (or an alternative fixed horizon).
We repeat this process for N initial seeds, thereby obtaining N state-action trajectories of length T.
We then split these trajectories into training, validation, and test (e.g., Nuain 100, Noa1 100, Nust 100). With each trajectory, store the transitions (st, 0t; 81+1) for subsequent fitting and analysis.
Parameter prior and bounds. In our experiments, we typically impose uniform prior on B E [0, reflecting broad uncertainty over transmission and recovery rates. This range can be narrowed or broadened as needed to reflect real-world epidemiological settings.
2] and [0, 1].
Key features and complexity.
Although smaller in scale than real-world COVID-19 simulators, this environment captures:
Stochastic transitions: The Binomial updates ensure randomness around infection and recovery.
Discrete-time stepping: Amenable to reinforcement learning or iterative policy simulation.
Potential policy control: Lockdowns other NPIs can be included by coupling the action with B.
This environment thereby provides a challenging testbed for building, calibrating, and evaluating simulation-base based approaches-in particular, assessing how well learned or LLM-generated model can handle partial observability and out-of-distribution interventions.
In short, our COVID-19 SIR environment is representative of a broader class of infectious disease models used in practice (Cooper et al., 2020; AlQadi & Bani- Yaghou,,,,,, 2022), while remaining computationally tractable for large-scale experimentation. Together with the additional environments discussed in the main paper, it forms a suite of complementary challenges evaluating the generalization, causal grounding, and empirical alignment of simulator- building approaches.
23

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
C.2. Supply Chain Environment
Our Supply Chain environment is loosely inspired by the well-known "beer game" (Sterman, 1989), classic exercise in operations research illustrating how stochastic demand and inventory pipelines can induce the "bullwhip effeet" across multiple echelons of supply chain (retailer, wholesaler, distributor, manufacturer). For simplicity, focus here single-stage retailer, capturing key dynamics of inventory management, backlogs (unfilled demand), and delayed shipments in transit.
State variables and partial observability. At each discrete time step f, the environment tracks:
inventory: The current on-hand stock of the retailer (nonnegative integer).
pipeline: A list of shipments in transit, each described by a tuple (quantity, time remaining)). Once time remaining reaches zero, the shipment arrives in inventory.
backlog: The unfilled demand from prior time steps.
t: The current time index (integer).
The retailer does not directly observe future or upstream supply conditions, making this environment partially observed: shipments placed now can arrive with uncertain delays, reflecting real-world supply-chain complexities.
Actions and parameters. The agent's action 0 indicates how many units to order at time t. The environment maintains four key parameters in a float array:
demandd
Cholding Ohacklogs
Lead]]
where:
Ademand is the Poisson mean for random daily demand,
Oholding: Obucklog (optional) costs associated with carrying inventory and having backlog, respectively,
Lind is a deterministic lead time indicating how many steps clapse before new orders arrive.
In many operational contexts, these parameters are only partially known or vary over time. In our experiments, we allow them to be fitted to real or synthetic data, reflecting the environment's calibration process.
Core dynamics. The pseudo-code in Listing 2 describes how the state evolves each step:
a) Demand sampling: We draw random demand D, from a Poisson distribution with mean Ademand-
b) Pipeline update: We decrement time remaining for all shipments in transit. Any shipment whose time remaining 0 is added on-hand inventory.
c) Backlog fulfillment:
there a backlog from previous steps, we fill much as the current inventory allows, reducing both inventory and backlog.
d) Current demand fulfillment: unfilled demand appended to the backlog.
We fill as much of the new demand Dj as possible from the remaining inventory; any
Placing new order: The agent's 's action a units are ordered, entering the pipeline with time remaining T
Listing Step function for the single-stage supply chain environment. Orders placed time join pipeline with lead time. Demand randomly drawn from a Poisson distribution, and partial fultillment may produce backlog.
class SimulaterSiep:
def --iii... (sclf):
ddrmad Janhds. iaveatory swvzanory.hatdiig.com shadding.coss backing.cost tiae
self parameters srray115.0, L.D. 2.0, 2 dnspestioa))
24

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Feee Free Calibration
def stepisrlt, state: diet. action: tnts regahiow) -> diet
sapply chaia covironment by one step.
paramciers
Randem domand from Poictos
demand cafe (demand lamhds)
2) Update pipeline (shipnests in treasit) sew_investory. wep.pipe htt....pdte..ippaiecseee
3) Falfill basklog first backlog.filled uaatore.iavesooy. state ("bclo"b
new,inventory = backleg.fiiled arw.backlog statel baackiigg" backleg-filled
today's inventery demand)
assiissiiddddmad new backing
femeed.filled
umastiffied demand
5) Place order (action) If action > new pipelies, saplitttpppttttatiinn load time))
6) Build the next state nekt_state
inveatary"s aes inventoryy
"pipelize": sew.pipeline,
"backing" sew.harking.
Dataset generation. generate state-action trajectories by simulating over a fixed horizon T:
Initial state: We set inventory x 20, pipe Sopelin ine empty, backlog = 0, and t 0.
Policy: For simplicity, an agent might follow simple reorder policy (e.g., (s, policy constant order) e-greedy approach. Alternatvell,, actions can be random to promote exploration.
Stochastic demand:
Each day, demand is drawn from Poisson( (Ademand). Poisson(Ademand)
After N = 100 simulated rollouts of = 60, we collect (state,, act ion,, state;41 tuples to form a dataset. We then split these data into training, validation, and test sets, as described for the other environments.
Key features and complexity.
The environment remains tractable yet exhibits hallmark properties of supply chains:
Partial observability: The retailer sees only on-hand inventory and current backlog, while future shipments remain uncertain in the pipeline.
Delayed actions: Orders only arrive after deterministic lead time Liead, echoing real-world shipping delays.
Stochastic demand: Daily demand is random, requiring dynamic adjustments of orders to avoid stockouts excessive inventory.
These elements expose strong temporal dependencies and delayed feedback loops, making it nontrivial to model or plan in. Hence, this single-stage environment is effective proving ground for evaluating how well automatic menulator-generattin methods (like G-Sim) can capture discrete transitions, uncertain arrivals, and partial observability consistent with real supply-chain operations.
C.3. Hospital Bed Scheduling Environment
Our Hospital Bed Scheduling environment simulates patient admissions for three different diseases into a hospital with separate Intensive Care Unit (ICU) and standard-care ward capacities. This captures both the stochastic and discrete operational challenges often faced in healthcare settings (Green, 2006; Koizumi et al., 2005; Brailsford, 2007). Each disease has its own daily arrival rate, average length-of-stay (LOS), and mortality profile, resulting in partial observability of future admissions and bed availability.
25

---

G-Sim: Generative Simulations with Large Language Models and Gradient- Calibration
State variables.
We model the hospital over discrete day-by-day timescale, where the state day d is dictionary
containing:
day: The current day index (integer).
i cuuoccupancy: Number of patients currently occupying ICU beds.
standard.occupancyy Number of patients in standard-care beds.
patients: A list of individual patient records, where each record includes:
di sease_id: An integer (0, 2, identifying the disease. bed_type: Either "ICU" or "Standard."
los remaining: The number of days left before discharge (if the patient survives).
is alive: boolean indicating whether the patient still alive.
day.in.hospiten How many days the patient has already spent hospitalized.
This structure allows to track heterogeneous patient journeys and resource usage in detail, while also permitting partial observability (e.g.. future arrivals are unknown).
Parameters. We store 14 parameters in single NumPy array:
rraee rate O, arrival_rate_I
rate__ 1, rate rate 22
Poisson meuns for disease arrivals
Ios mean 0, los mean 1, los mean 2.
mean lengths of stay for each disense
base .ee..probb... 0, base cesse.prob... 1, base .rc..probb.. 2, mortality probabilities per day
day factor. O, day fwctor. day factor
day hased increase mortality
icu_capacity, canpcir_..ppcity...
These parameters govern (i) the expected arrival counts for each disease via Poisson processes, (ii) how quickly patients recover or die, and (iii) how many ICU and standard beds are available once, In real-world hospitals, such quantities may be partially known dynamically changing over time.
Daily update logic. Listing 3 provides snippet of the day-to-day simulation. Each day:
a) Existing patients: For each patient, we compute daily mortality probability based on the disease's baseline (base prob i) plus day-dependent factor (day factor x day in hospital) If the patient dies, free the corresponding bed. If they survive and their LOS completes, they are discharged.
b) New arrivals: We sample arrivals for each disease from independent Poisson distributions and attempt allocate them a bed. ICU or standard-care bed assignment is disease-dependent (e.g.. discases 0/1 try ICU first, disease 2 tries standard first).
c) Capacity constraints: both the ICU and standard-care wards are full, the patient is turned away (no admission).
Increment time: The simulation day index day is incremented by 1.
Listing Core day-by-day update the Hospital Bed Scheduling environment. Each day, we update existing patients (mootaaltyydischarge) and sample new arrivals for each disease, Beds limited by ICU and standard capacity.
class SimulatorStep:
def init... (sclfy:
Example dafaulte: arrivat rates 10S mons. norrality parameters rapacities
self parameters srrayel
26

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
10. 18. 1.5, arrival.rate_001 5.0 6.6. 4.0. Inc,mese,0 11..3
0.002. 0.001. base proh 0.1.2
0.063.
day fay-ooctor.0
:cu.cepacity sssasdars.cupacci
def cnpceatff
mnghhor) dier
Afrascz the simelation by day.
Update existing paticats imorteityy. discharge).
2) Sample see arrivals (3 diseases).
3) Allempt bed allocatien.
4) Increment day cousiet.
rgg raneen, (
Unpack parameters
errarates self. parameters [0:3]
self parmmeaneeterss
probe parmmtrss((())
self in:15.0)
standard, ceapacity (n1(20.0)
D Updare existing palizats servivors
for patient in state p"ptiiattt"""" if paticat alive "]:
Calexlate daily grobability of death
disease.id patieatl" disease.id"]
p.death (haeepprote prots disesss id] day fay_facctrr(ddieeee.d patient("dry da hospital"
p.death up clip(pdeats. 0.0, 1.0)
patienr
paticotl" is. allivee
self, free bed(statee (xtdee(("eed)tpe"))
the
ratient"" Io reessiiiiii" -
patient(" "aaunc""dyy.aa.... in
if patiest ins_remaining"] b:
carvivors append(patinni)) olse:
self Frer patioat("bol.yye"]]
state"" p"patictts' II servivors
[mgg-poisson (lassen(lan)
atturatex]
Allocate hods
disease arriesls (amerate(rrr
for in raszeçazm arrivals):
los maxtl, intting mosndttes disere.idd, 1.01)
bed.type self..try saff...ty.alloe aoyallloatee disesse.id, jes.capacity, capdatd. if bod_iype is sot Nene:
palign: =
"diszase.id": disemesid. "bed.ype": bedaype, "lossiemsisies"" lo.
"le,alive" Tree "dsy.in,houpiitl"
state patients appendd
day
Dataset generation. We instantiate the simulator from an initial empty-hospital state (no patients, icu couloocupaccy standard_occupaacce 0, day 0) and run it for T days. By default, we do not explicitly include actions this environment, admissions occur automatically when a bed is available. However, can embed policy that, for instance, adjusts triage rules modifies capacity expansions. We collect the resulting day-by-day trajectories of the state and produce train/validation/tess splits for model calibration and evaluation.
Key challenges.
Stochastic discrete events: Admissions, mortalities, and discharges occur in integer, event-driven manner.
Capacity constraints: If the ICU or standard ward is full, some patients cannot be admitted, which leads censored denied admissions.
Disease heterogeneity: Each disease has unique arrival rate and mortality profile, increasing the complexity of cross-disease interactions (e.g., competition for ICU beds).
Partial observability: Future arrivals and disease trajectories are unknown, and patient-level details evolve stochastically day by day.
27

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frec Calibration
Thus, this environment approximates essential features of inpatient hospital management for multiple disease conditions, making it valuable testbed for assessing how well automatic simulators (such those generated by G-Sim) handle real-world scheduling and resource-allocation dynamics (Green, 2006; Koizumi et al., 2005; Brailsford, 2007).
C.4. Performing Intervention Insight Experiments
Our insight experiments (Section 6.1) evaluate simulator's ability to handle what if? questions, particularly those involving interventions that alter the underlying system dynamics-a key requirement for (PO) Siddem-wide Experimentation. These interventions often go beyond simply changing actions within the historical data distribution; they involve modifying the environment's parameters or structure.
How Interventions are Implemented.
To perform these experiments, we follow a two-step process:
1. Ground Truth Modification; We first identify the specific parameter component within the ground truth simulator's s code that corresponds to the desired intervention. For example, in the COVID-19 lockdown experiment, we directly access the 3 (infection rate) parameter and scale it by multiplier during the specified lockdown period. Similarly, for supply chain optimization, we modify parameters like (lead time) or add extra capacity AC.
2. G-Sim Modification: We then inspect the final simulator code generated and calibrated by G-Sim. Thanks to its LLM-driven, often modular and interpretable structure, we can identify the parameter or code section analogous the one modified in the ground truth. For instance, we locate G-Sim's 's infection rate parameter and apply the same scaling factor a.
Why Other Methods Fall Short. Performing such structural parametric interventions is generally not feasible with the other baseline methods evaluated:
Data-Driven World Models (RNN, Transformer, DyNODE):
These models learn a black-box mapping from states and actions to next states. They lack explicitly defined, interpretable parameters (like 3 E) that can be directly modified to reflect change in the environment's 's fundamental dynamics. Intervening would require retraining new data reflecting the change, which defeats the purpose of "what if" analysis on unseen scenarios.
Equation Discovery (SINDy, Genetic Program): While these methods aim to find equations, the resulting models are often monolithie and may not expose parameters that directly correspond to meaningful, real-world interventions like adding beds changing supply lead times. Their focus is on fitting observed dynamics, not creating intervenable representation.
28

---

G-Sim: Generative Simulations with Large Language Models and Gradient- FFee Calibration
D. Implementation Details for Baseline Methods
We provide below the implementation details of all baseline methods from the main paper. Unless otherwise noted, each baseline uses the same dataset splits (training, validation, test) and is trained to predict one-step-aheud transitions from (st, ae) to 8t41- We tune hyperparameters on the validation set and apply early stopping with patience of 20 epochs. Unless otherwise stated, models are trained for up 2,000 epochs using the Adam (Kingma & Ba, 2014) optimizer.
DyNODE DyNODE (Chen et al., 2018; Alvarez et al., 2020) extends neural ODEs by incorporating control actions explicitly. Specifically, we let
dz((t=
dt
where x(() is latent state encoding the environment, and u(() is the action. To implement DyNODE as a one-step predictor, solve this ODE numerically over each time interval [t, t 1]. Concretely, we use 3-layer MIP with 128 hidden units per layer and tanh activations to represent f. We initialize weights with Xavier initialization and apply the Adam optimizer with learning rate of 10-?. 2. We set a batch size of 1,000 and stop if validation loss does not improve after 20 epochs.
Transformer Transformer, from Causal Transformer (Melnychuk et al., 2022), is a modern sequence model (Vaswani et al., 2017) 17 that can handle long-range dependencies time series. We flatten the state-action pairs over time and feed them into a single Transformer encoder. Our implementation uses:
An embedding dimension of 250, learned via a linear projection from the input state-action dimension.
A single Transformer encoder block, with multi-head attention (10 heads), hidden dimension 250, and dropout probability 0.1.
A final linear layer mapping the encoder output to the next-state prediction.
We train using AdamW (Loshchilov et al., 2017) at a learning rate of 5 x 10-5 with step learning-rate scheduler (step size 1.0, gamma 0.95), gradient clipping at 0.7, and a batch size of 1,000. As with DyNODE, training continues for up to 2,000 epochs or until early stopping triggers.
RNN RNN (Rumelhart et al., 1986) is a classical recurrent neural network for autoregressive time-series modeling. We adopt a two-layer Gated Recurrent Unit (GRU) architecture, each layer having a hidden size of 250. The model takes as input the atate-action vector each time step and outputs the predicted next state. We train with the same Adam configuration as DyNODE (learning rate 10-2, batch size 1 1,000, 2,000 max epochs, early stopping patience of 20). All input and output features are normalized by statistics derived from the training split.
SINDy Sparse Identification of Nonlinear Dynamics (SINDy) (Brunton et al., 2016) attempts to discover closed- equations directly from time-series data. After estimating derivatives via finite differences, SINDy performs sparse regression over a predefined library of candidate functions (e.g.. polynomials) to identify a few terms that best explain the data. We use polynomial library of order 2, i.e. {1, , ... }. and the regularization factor a 0.5. We threshold small coefficients below 0.02 enforce sparsity for most tasks; for particularly noisy or large-scale tasks, we tune the threshold (e.g., for the COVID-19 environment). This yields a symbolic equation per dimension of the state.
Genetic Program Genetic Program is a symbolic regression approach that searches for analytical expressions describing the environment dynamics via evolutionary algorithms. We use the implementation of Deap (De Rainville et al., 2012). We maintain a population of candidate expressions, iteratively mutating and recombining them, selecting those with the lowest mean- mean- squared error on the training set. We constrain expressions a predefined set of operators (e.g., {+, X, + and elementary functions (e.g., polynomials, exponentials). We run for a maximum of 1,000 generations with population size of 500 and mutation rate of 0.
Ablations of G-Sim We also include two ablations of our proposed G-Sim pipeline, specifically for the G-Sim - ES variant:
(a) G-Sim-ES Abl. ZeroShot: Uses the LLM to generate code for the simulator structure once (without subsequent refinements) and does not optimize any parameters. This illustrates the performance of naive, uncalibrated LLM outputs.
(b) G-Sim-ES Abl. ZeroShotOptim: Uses the same ALM-generater simulator structure as (a) but applics a gradient- optimizer to tune numerical parameters only. In contrast to full G-Sim, no structural revisions are performed.
29

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frec Calibration
Shared training protocol. All methods rely on the same one-step prediction loss, typically mean-squared error. Table in the main text summarizes their performance across our benchmark environments.
30

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frne Free Calibration
E. G-Sim Implementation Details
In the following we detail the full methodology for G-Sim, including pseudocode, training procedures, prompt templates, and diagnostics-drine refinement. Our approach builds on the framework described in Section 3 of the main paper.
E.1. Overall G-Sim Framework
Recall that G-Sim comprises three main components:
LLM-Driven Structural Proposals (Section 3, $3..1),
Flexible Parameter Calibration via a choice of GFO or SBI (Section $3.2),
Diagnostics-Drive Iterative Refinement (Section $3.3).
Each iteration produces a candidate simulator with an estimated parameter set, evaluates via diagnostics, and refines Algorithm gives pseudocode for the overall loop.
E.2. Pseudocode
We provide detailed pseudocode for the G-Sim construction Algorithm 1. (1) We maintain a history of candidate simulators for reference. (2) We prompt the LLM generate (or refine) structural configuration A, including submodules and couplings. (3) We perform calibration using GFO SBI to find its numerical parameters w. (4) We compute diagnostic scores; if improvements needed, textual feedback compiled for the LLM to guide refined structural design on the next iteration. (5) We track and eventually return the best simulator found.
Algorithm 1 G-Sim: High-Level Pseudocode
Require:
Domain knowledge K. (text descriptions, constraints),
Training data D (D(1) ((())
LLM with prompt funetion (r))
Calibration engine CalibrateParams(() (either GFO or SBI),
Diagnostics function Diag(A, w; D),
Maximum iterations G. patience for early stopping.
Ensure: A fully calibrated simulator (X* (A*,w") minimizing the diagnostic score.
Initialize History + Ø
2: for to G do
3: (A) LLM structural proposal:
4: ((s) + (MmpptLL(HHsstooyy (C)
5:
(B) Parameter calibration:
6:
(()) + Calibrate PattrratttPaamm(((ee ()) // Using either GFO or SBI
7:
(C) Diagnostics:
8:
( (ia ()))
9: (D) Record current candidate:
10: History +- History U {((()) wll)) d()))}
11: (E) Refinement check:
12:
if early stopping criterion met (e.g., no improvement for p iterations) then
13:
break
else
Compile textual feedback (99) from diagnostics Append v/(9)) to prompt context for next iteration
16:
17:
end if
18:
end for
Return (X","") with best (lowest) d(9) in History.
19:
31

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Frne Free Calibration
E.3. Training and Calibration Details
Once the LLM provides a structural design A, we must calibrate its numerical parameters w. These parameters can be real-valued discrete. We employ two primary methods: Gradient-Fres Free Optimization (GFO) and Simulation-Basee Inference (SBI).
E.3.1. GRADIENT- FREE OPTIMIZATION (GFO) USING EVOLUTIONARY STRATEGIES (ES)
GFO provides a robust method for parameter fitting, especially for simulators that are non-differentiable, stochastic, or involve discrete parameters.
Fitness/Objective.
The fitness function [w, A) is the Mean Squared Error (MSE) between the simulator's predicted outputs and the ground-truth observations from D. The GFO search aims to find w arg min,, J(w, A).
Implementation with EvoTorch.
implement the GFO step using the GemeticAlgorithhm class from EvoTorch. The
process involves:
1. Initialization: A population of candidate parameter sets {wi is initialized.
2. Evaluation: Each candidate wi is evaluated by rumning the simulator F(:; A, wy) and computing its fitness (MSE).
3. Selection:
Toumnament selection chooses individuals for the next generation.
4. Variation:
SimulatedBing eimuulateeBinarryyrrrsssvee and GaussianMutats inn create new candidates.
5. Iteration: Steps 2-4 repeat across generations.
Our key EvoTorch settings are:
Population size: 200,
Number of generations: 10,
Search operators:
Siimlattdhiiaaryrrrossse with tournament size 4, crossover rate 1.0, and 8, on with standard deviation stdev=0. 03.
Gaussi
anMutat GausstanMutath
This population- baasaa approach offers resilience local minima. We also warm start calibration from the best parameters found previously when only the structure changes, balancing exploration and refinement.
E.3.2. SIMULATION CIILAIIIO--BSEDD INFERENCE (SBI)
As an alternative, we use SBI for Bayesian parameter inference. This is particularly useful when uncertainty quantification is desired.
Simulation Budget. posterior estimator.
Based on our implementation, we use simulation budget of 1,000 simulations to train the SBI
Inference and Posterior Estimation. We use the Neural Posterior Estimation (NPE) algorithm from the 'sbi' library. The simulator's output, a trajectory of states, is flattened into single vector to serve as the observation for the density estimator.
1. Simulate: We draw parameters from uniform prior defined by the simulator's 'get parameters uniform prior min max' method and run the simulator to generate pairs of parameters and observation vectors 20,
2. Train:
We train a neural density estimator (e.g., Masked Autoregressive Flow) these pairs to approximate the posterior PDw.
3. Sample and Estimate: We sample from the learned posterior to obtain distribution of plausible parameters. For evaluation and generating the final simulator, we use the mean of the posterior samples as the point estimate for wt.
This process provides not only a point estimate but also allows for the full posterior be inspected for uncertainty analysis.
32

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
E.4. Prompt Templates and Structural Generation
The LLM-based structural proposals rely on a set of prompt templates that describe the domain context, submodule templates, coupling schemes, and known constraints. Specifically, for all LLM experiments used the O1 model from OpenAL. We show the general structure below; these are typically fed as system user messages in API like OpenAl other LLM interfaces:
System Prompt
Objective: Write code to create accurate realixtiz simalziar given task Namty.
Please note that code should relly fanctionel, placeholders.
You the cad
auiput
completing task,
realistic possible.
You
You cansot visealixe graphical
within machine. The code include black hos mahii-layer percaptions required.
Use the Tonctions prosided. What calling helper fonction. only provide RFC1259 compliant ISON request (no additional text or formatinng).
Main Prompt (followed by system prompt for the COVID-19 task)
You will simslator description
fanction NurPy.
System Deseripeton:
COVID SIR environmest.
Here you most model the simulation step with the below state and action of
The envirommen: state represented by dietienary: int, "I"s "P: int
Action:
The collected trajectory lests
(dazs).
...
Modelling gosler".
The parameters of the cimuaatrr will he optimized observed traising stste -actin dataset with the ziven simulstor sinslation-bneed Inference. The observed traising dataset has lev samples, and the model most be able zeneralize unseen state axctoo data.
Requirement Specification .*.
* The code geacrated should achiere the lowest possible velidation Wassersteio loss, , of Ie-10 or less. The code generated should be interpretable. and fi: the dataset is securately is possible.
SimulatorSiop
1000. Fill the here define the paremeeters medel and mile self
def seep state: diet, action: int, ep.caaden, Generator) >> diet:
Musi inclade all the logic
reture state
def get.paranttersssell)) is up. ndarcoy:
Returas the mode! parameters as as array.
the here
parameaeerr paramciers: up. ndarray):
Updates mode
Args
pacometers addaaaacyy). Auyy of paraneters update.
1000: Fill in the sode here
def get ot..prrmeteessanntnn prronr miss +> vp. odarray:
Returnc the uniferm prior horads the parameters.
Returas:
ndurray: Array shape num, parameiers)
Fill the
Usefal know:
The generated code most include the complete 'stop" fenction body in NumPy, felly fanctional no placeholdere. You are a code cvolving machite. and you will be called 20 limes to gensraie code, snd improve the code to scsieve the loweat possible validatios Wasserstein
loss.
The model defises the possibly stochostic transition fanction taking the full state action and predictias the sext state, and will be used to fit the observed
training dataxet.
You can my parameters you vani hoveser, you have define these.. preferable decompose the systen into compatiennt pessible.
any unary
esample leg. esp power
nengy tampling
fanctios definitious. code skeletos specification.
skeletos
your code follows When defining categorical instributien that paramcierized mie it that the probabititics automatieally narmalized as they will sampled randem valuzs. L.c. nurmalize the prabubilitiex within the fusctios.
Thisk ctep- and then give the complrte. full working ents You are generating code for ineracion out of
33

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
At iteration g. we also append short textual feedback summary describing any mismatches domain rules that the previous design missed. For instance:
1) Consider including an additional parameter that scates the binonial triats variance. Ir the dataset 's traasitions hove nore or tess varizbility than pure bisomial draws, adding a dispersios parameter and sdiusting the sampling meckatiun accordinzly can improve fit.
2) Braluste usisg uore direet approncà for probability of infection ead recovery. For instanee, lastead of relviag on Mil lespt Abeta Viines I J NAA and ML Vespt- (pmma)) V. you could compuie prossbilties dirrcily or aee a saturating funetion (eigi a logitiic) if the this suggest better slignment with tim- dependent mage.
Observe that ogtintied (heta iamns values (about 4456 can allow une-tepoddei state stat--rrpadentt fadtrr (another parameter) to the infection rate partial inmusity offecis.
night not fully cattre infection freeovery process
dataset inplies
changing costact
Inclede small "immenity lost" "reinfection" parameter if the rest dats show recovered indiviazile accecusslly re-entering the infected compariment. This be done adding additiossl parameter controlling probsbility moving from back
5) If the dataset is seale is lape.. consider adding parameter for undereporting or unobtorved aymptonatic infections In effect you use a hiddea compariment from which infected are not direetly observed. adjacting the prohabilitizs in the sup finetion to betrer natc absarved trancitions.
6) Keep the prior bounds in get.patameters uniforn prior mix sufficienlyy flexible to allow expleration of ne parameters (e.a., acltiple parometers if you odd ceinfection. , underrepccting etc.). This will help ensure your isference procedure eas discever better -fitiig solutions.
refining these aspects, , you can improve sccuracy and realism and potentially lower the validation Wassenttia less further.
This crucially arises from this reflection prompt
Please reffect on how you can imprave the code, to fis the dataser as accurataty as possible and he restiaris. Think step urp-by-step Provide only actionable feedback. that has direct changes to the code. not write out the codé. oaly deseribe it cea improved. applicable ase the values of the optimized parameterss to sessen how the code cea be impioved to fit the dataset as securately as possible. This is for genercting new code sext iteration out 5.
Importantly this is appended after a prompt that includes all previous models, their losses, and their parameters optimized to the observed and validation dataset. Here is an example from the COVID-19 task.
You acasrated following code complations. which had their parameterrs optimized the traising doteset. Please reffect you improve code misinise the validation loss 6
code examples deliseated by 1ah.
Here year previnux iterations the best programe generated.
lieration o, Beit Val Loss: ('me's 1842185702399295 'mnd': 02041520000293559 "wass' is 041100221622555754) Model deseription: This cnds implements progreme
discrote SIR aotal in Nunil for cown progression. prommtarized by infeetioe rase Vhorz and recovery rate lpmmn We incorporate etochactlo transitions
via hinomial ampling. The getsse nothols allow for parameter optimizarton. wiile the ctp nathed updarss the nember of susceptists. infecred. and recovered individeals ceclistically. , By eusating a fexible range for (bets udd 'aume, ve support better fittios of the data aid misinize the Wassersteia loss. Tais approzch should enable offective simelation besed inference.
Iteration 1. Best Val Loss: ('me": 1 2661189022497111 'maa": 0 13041535009333355 "wass": 00140121129557544 Model deseription: This code inglenents COVD progression. parameienazd by infection rate Voets and recovery rate bpamm. We incorporate stnchassic transitions
discrete SIR mosel in Sunly get/act methods allow for parameter optimization waile step methed updates the nember of susceptible. , infected. binomial suppingg. rastiiiiially By ensering flasibls range (hets yonns, we suppart approach chould effective
firting
Hece oode completions that you have generated.. serted the lowest validation loss lest
Val Wasserstein Loss: 0.474 (Where the val ME less per diseession is suceptible val MSE loss: 2.12, infected val MSE loss: 4.69, recovered val MSE loss: 2.1)
Eteration: 1
ingort anngy 6s up
clace SimulatorSiep
def sait (self):
Define parameters: leets gamns oncro]
changed upon parameter toning
param ap. ([0.45,
0.01]. diypenileat)
def steptself state: diet, action: int,
madon Geserator) -> diet:
5. 1. cratz ("S). c1s statel"R"] bete. gamm, emeza self parcns (D), self. parems)) params)) 5 IISI R ir N 0:
retura ('S": S. "1"; 1, 'K': R)
prebiisfectios = L.B ap. Expl-e-- + [C1 + 1.0) / ND if >> 0 clse 0.0
preh, mm10 0, miniprob.infeclllnn , 1.0))
nee inteatit a rng. MismiallS. inos_infrcction)
proh resevary = 1.0 ap rppplmmmmm)
rrobv max16.6. niat scobery...r... : 1.0))
rew.reesveries tng. bisontiall.. prob.cocovery)
proh
sapt-omera)
min( sibiistttei...stt.io............
aew.ccafeetioos Siseniall. prob.reisfecties)
S,aext S nex_infecrions
reinfections
Lazsi nex.infectione arw.nesavrrios R.azs: nev.
reinfessiis
nest.state = ("5", Saiext, "[", Loest, 'R": R.sext] reture next state
def zel parsmeterssaellf -> ap.adasray: zelarn self parama (o
def set.parancteis(sell. parametzrs: ap. ad.adaraay). ). self pesoms paranstess.
def wnt.ee/s.iioo.o...oooooo.oo moll 2 ap. sdaraayy:
reture up ir11 0, 6.8, 0.0]. [1.0, 1.0. 0.211)
qurimizeddpprrmmeerr (0.4166133015551119 0082000524442453. -001027954111186635
Val. Wascerstein Luw: 0.414 (Where the val ME lews dimension cxcceptible val MSB lose: 2.38, infacted val MSB lose: 4.32, recovered val MSE losks 2.23) Eseration: 0
import nampy 25 mp
34

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
clace SimutatorS(pp))
(sale):
self parens array (EO.1. 0.05]. dipge=fleat)
step tiel- diet.. cction: rog: rodoon. Geserator) diet:
gamm if &
paramn[1]
(187: 5. 115 "R":
prab, infoction 1.0 new inffectfcso ing. binoniills. max00.0. aini prob wnf.iiitttiion..... 1.033)
(1 Ny 12 cise 0.0
proharesevery 1.0 ap.espp--uune gunne)
new recvveeses a ing. binomial(1. max mintgrob.recosery. 1,033)
S.ncs = 5 new infections
Lass =1 new.infections aEN.rcconcries
R.azs: R. new.rccoveries
rature ( S,a65t. "I": 1,aest. "R" R.next]
gel-parameters (xelf) ap-ndarray: retern cell- pall-paramc.crrp copy.)
pel.paramstess parameters: up. up.adarray)
set.parameters
perons
porometers..sttyecfffo
prior.mii mil..mxxtes mox(self) ap ad.adaryy::
up aray
1.0]])
optimized.ppromettae 1C. 18.44897222268927 b.8506695379225361 ade
Please reflect on how you can improve the code to Tit the dstaser as aecurately as possible and be reatistic Think step-ty-step Provide only actionable faodback thst hat direct changes to the code. the not weite our the code. only describe how it on he impooved Whee applicable so the valuns of the bossible. This is for aencrelins new code for the ses optimized parameters to sessen how the code cea be improved to fit the dataset as accurately as possible.
iterction out of 5.
This feedback helps the LLM propose refined structures in the next iteration.
E.5. Diagnostics Computation and Refinement
Diagnostic Measures.
At the end of each iteration, compute two main types of diagnostic metrics:
Predictive Discrepancy: Opredietive c.g., MSE Wasserstein distances between real and simulated trajectories
validation set.
Domain Violations: δaomain e.g., negative capacities, ignoring constraints, failing plausibility checks such as "transfers must not exceed the available capacity in the previous step."
The first is computed quantitatively, while the latter is evaluated qualitatively using reflection prompt that interprets the previously generated and optimized code structure model, along with its optimized parameters.
In our practical implementation, the quantitative predictive discrepancy is key. We compute both Mean Squared Error (MSE) and the I-Wasserstein distance (W1) between the simulated outputs and a held-out validation dataset. The W, distance serves the primary fitness score used for ranking different simulator structures and for the early stopping criterion.
However, for generating textual feedback for the LLM's reflection step, we provide more detailed breakdown. We compute the MSE for each individual output dimension of the simulator. By presenting both the overall Wi score and this per-dimension MSE breakdown to the LLM, we enable it to reason about which specific components are causing the largest errors and thus require structural refinement in the next iteration.
Based on these quantitative (MSE, W1) and qualitative (reflection prompt output) diagnostics, we compile a textual summary ((s) enumerating the major shortfalls. This textual message is appended to the next LLM prompt ($E.4), guiding the LLM to propose a revised ((++1) address these shortcomings. This iterative loop is conceptually illustrated in Figure 1.
Refinement.
E.6. Implementation Notes
Parallel vs. Iterative LLM Calls. Depending on the LLM service, we can prompt it once per iteration in a purely serial manner or maintain short conversation chain. We typically keep short conversation for each design iteration: (1) provide domain XC, (2) incorporate textual feedback from the last iteration, (3) ask the LLM for a revised structural design. This "reflective" approach is simpler to implement in practice than single mega- prompt, and it helps the LLM keep track of incremental changes.
Hyperparameters for G-Sim. In our experiments, we typically use a maximum of 5 refinement loops, a patience of 3 for early stopping, a population size of 200 in evolutionary search, 10 generations, and a mutation rate of 0.03 for parameter changes.
35

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
E.7. Full G-Sim Workflow Summary
Putting all together:
1. Initialize an empty history History.
2. LLM Proposes Structure:
(a) Use domain knowledge to propose or refine X.
(b) Incorporate textual feedback from prior attempts.
3. Calibrate Parameters w via GFO SBI:
(a) Simulate F(; A, and compare with real data D.
(b) Update w to optimize the chosen objective.
4. Compute Diagnostics:
(a) Evaluate predictive mismatch predictives
(b) Check domain constraints ddomains
(c) Combine into d(n).
5. Refine or Stop:
(a) If stopping criterion is met, stop and return the best simulator found.
(b) Otherwise, compile textual feedback (5(9) and goto Step 2.
This iterative loop typically converges to a simulator that balances (i) plausible structural forms aligned with domain knowledge, and (ii) accurate parameter estimates aligned with empirical data. In Section 5 of the main paper, show empirical examples of G-Sim performance on real-world-inspire tasks.
E.8. Implementation of the Diagnostic Function Diag
Below is more explicit representation of how combine submodule-level error terms and domain rule violations into single diagnostic score:
d(),w) Σ wk Er (D(K), Fh (1:w", A))
Here, Err measures the discrepancy for the k-th submodule's partial observation ((k), This is implemented validation MSE per output dimension to enable the LLM to reason over which component is incorrectly specified and by how much to improve upon in the next iteration.
E.9. Observed Speed-Ups via Parallelization
When G-Sim is implemented with population-basee evolutionary algorithm, the majority of computation in each iteration is devoted to the repeated simulation over population members. We found that distributed parallelization across multiple CPU or GPU workers yields near-linear speed-ups for the tasks in Section 5, thus making G-Sim practical even for more complex submodule designs.
E. Handling Stochastic Simulators
In domains like queueing or epidemiology, submodules produce random transitions. Our approach simply draws multiple sample trajectories to evaluate the expected mismatch for each candidate w. In practice, we set a small number of Monte Carlo draws (200) to keep the computational overhead manageable. The same approach extends to partial data or events (e.g., times-to-event) via likelihood-based scoring.
E.11. Summary of Key Implementation Steps
Give domain constraints and partial data coverage details to guide feasible structures.
36

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
2. Initialize parameter search using either GFO/ES SBI, parallelizing as feasible.
3. Refine structure via textual feedback if domain constraints or high predictive errors uncovered.
4. Stop when the combined diagnostic meets the threshold or the maximum iteration limit is reached.
The resulting simulator is then used to run "what if?" analyses or further submodule-level modifications as needed.
37

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
F. Illustrative G-Sim Prompt Example
Below an example prompt text we provide to the LLM to generate a supply chain simulation:
Description:
Single Beer
Here mud model the cimulation with belew ctate and action of
The environment state is reproseated by distienary:
"Iaventory "y int
Or-hand units
pipeliie"" " list of (ist, iall. shipmests: (quaatity time semsisieg) "backlog"s int.
{ uails of uafilled deuead current time step
Action: is the are order place with supplier. That creates pipeline catry with lead time sampled from discrete distribution.
reajectory
steps (days)
Modelling rodls
The parameters of the cimulator will he optimized observed traising cste-action dataset with the simulator simslatioo-bned Inference. The obsrrved traising dataset hn lev samples, and the model most be able zeneralize unseen state -xctioz dala.
Requirement Spscification:
* The code aeaciated should achiere the lowest possible velidation Wassersteia loss, , of 10 or less.
+ The code geacrated should be intospretable, . and fi: the dataset is recurately is possible.
Skeletos cods to SimslatorSiop
1000
the
Jefine paremeeters medel
def stopí
randen, Generator) diet:
Musi inclade all the logic
reture sist
def (dt-parancters(sell) = ndarray:
Returas the model parameters as as array....
the here
warapammetsss parameters: up. ndarray):
parometera (np. adarraa) Auy of parameters update.
1000 Fill in the code here
def sel-parametera www.:rr..o.ioooo..iiioo...
-> sp. odarray:
Returns the uniferm prior horads the parameters.
Returas:
up odorray: Array shape com-parameters)
bounds.
Fill
Uszfal know:
The generated code most include the complete 'step" fenction body in NunPy, felly fanctional no placehelders.
You are code exolving machire. and you will be called 20 times to genarate code, and improve the code to sesieve the towest possible validation Wasserstele
loss.
The model defises the possibly stochostic transition fanction taking the full state action and predictias the sext state, and will be used to fit the observed
iraining dataxet.
You can my parameters you vant hoveser, you have define thexe.. preferable decompose the systen into compatients possible. example leg. esp. power etc.
any unary
nenpy tampling
definitious. skeletos specification.
your follows distributiens that parametezized mike it
definiag
probabilities astomaticelly cormelized will sampled canden
valazs. narmalixe probubilitsex within the fusctios.
Think step- and then give the complete full working ents. You are generating code for iseration out of
The LLM's response typically includes:
A set of submodules (Python classes or code blocks),
Proposed couplings (i.e., how arrivals feed into the occupancy submodule),
Hard-coded initial values for w (which the calibration then refines).
If the simulator violates domain constraints, we compile feedback for the next iteration.
38

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free FFee Calibration
F.I. Env Prompts
We provide the environment prompts per environment in the previous examples. For completion we also include the Hospital Bed Scheduling prompt below.
You will get simalator description to code se'step' fanction in NumPy.
System Description:
Bosputl
hospital separate reCCUs vestandardie
from different types.s.
ad State
Represented by dictionary:
we" "ay" +[int]
The cucreat simulation day (tine step).
xe" ieu,
ieiieeccapano secupncy +(ist)+
Namber of eel beds carreatly occupied.
stsstadard_sccuup pccopppcy" stinc)
Nember - crandard (mo--IUU) heds currently oecupled.
prppatiznt illist dieic)
patieat dictioarry
"""discsse_id
latager (1,00 2,35) ideatifying disease type.
"""is_alivee"= e(boolie; Whether
still
-.-"day hhocppiiiss ((ine)::
the hax hern is the hospital.
we Actios
There no direct external "action" to take each day.
Instead:
New patients arrive
2. Tae cavitonment atterpps to wallocatess er caek sew strival to in seICLes or esstandardew bed aecordiag to predeliaed rules and eapacities.
3. If so stitable bel is available. the patient is not admitied.
Epicade Length
typicai cimulation might run for fixed sumber days, for ccampic vedie. time stepe, after which the dimulation ends.
Modellisa aoala!"..
of simulator will be optimized observed training observed traising datoset very sumples, and model
simolator sinslation based Inference.
Requirement Spscification:" >*.
The code gensrated chorld achieve the lowrs pascihle validatios Wasterstein lass, of Te-10 or less. The code gensrated chorld be interpretable. and fi: the dstaset aecurately as poscible.
Skeletor, code to fi3l is:*..
class SimulaterSien ():
--init--lasll (sllf):
parameters
Must include all the mg: ap rp.ddmoom
return nest, state
def (sll))) ndarcay
Returas the model parametere as as array.
1000 Fill in the code here
sel parameters (self, paramsters:: up. adarray):
Updates parameters.
adarray): of paramoters
100: Fill in the code here
def get www.eeters.tiforrnnnoooo mex -> up. odarrey:
Returas the uniferm prior bouads for the parameters.
Returns:
up ndbrray: Array shspe (2, nom paramierc) with nin mas bounde.
the here
Usefal
The gencrated code must include the complete 'step' fenction body in NimPy, felly fanctional, placcholdete.
You code evolving machire, and will be called times genersie cude, and code sctieve the lesest poscible validatios Wasserstein
loss.
The model defines the possibly stochastic transition fanction raking the full state action and prodicting the next state,, and will be used fit the observed
training dataset.
You can use mny parameters sou vani hoverer, you have to define these.
It preferable to decompose the systen into conpattients if pessible.
You can ay unayy fenctions for example log, exp power etc.
You can numy sampling distributions.
defieitions. only code. circomstonce oas you change stoletor specification-
your
detining categorical probubilities paramciarizad
probabitisies antomatioally
mhey campled
input step fenctios. fusciion.
action injut, explicitly follow the skeleton code function definitioss.
allowed
Thisk srep ctep-hy- and then give the complete. full working ents You are generating code for inoration out of
39

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
COVID-19
You simslator description code Fanction
System Descripeton:
COVID SIR environmett.
Here you most model the simulation step with the brlew state and action of
The environmcat state is represeated by dictienary: int. "I"s WP: int
Action: Note Nore
reajuctory
steps (days).
t..
Modellisg rocl:
The parameters of the cimulator will he optimized observed traising dtste -att-nction dataset with the given simulator sinslatioo-hneed Inference. The observed training dataset hn lev sapple,, and the model most be able zeneralixe unseen state -xctioz data.
Requitement Spscificationss
* The code aeaciated should achiere the lowest possible velidation Wassersteia loss, , of le 10 or less. The code geaerated should be intospretable, , and fi: the ditaset is vecurately is possible.
Skeletos code to SimslatorSiep
1000 Fill the
Jefine parameeters medel
der stopr self,
ragi randen, Generator) diet:
Musi inclade all the logic
reture nent.state
def (dt-parantters(eelf))) = ndarray:
Returas the mode! parameters as as array.
the here
paramammeess parameiers: up. ndarray):
parometera (np. adaarad) Atr of parameters update.
1000 Fill in the code here
def sel-parametera pri.poo -> sp. odarray:
Returns the uniferm prior horads the parameters.
Returas:
up. odorray: Array shape (2. com.parameters)
bounds.
Fill
Uszfal know:
The generated code most include the complete 'step" fenction body in NanPy, felly fanctional no placehelders.
You are code exolving machire. and you will be called 20 times to genarate coda, and improve the code to sesieve the towest possible validation Wassersteln
loss.
The model defises the possibly stochostic transition fanction taking the full state action and predictias the sext state, and will be used to fit the observed
iraining dataxet.
You can my parameters you vani hoveser, you have define thexe.. preferable to decompose the syste into compatments pessible. example leg. esp. power etc.
any unary
nenpy sampling
definitions. skeletoa specification.
your code follows distributiens that valazs. narmalixe probubilitiex within the fusctios.
definiag
mike
The probabilities astomaticclly cormelized mey will sampled canden
Think utpp. and than give the complete full working ends You are genorating code for inaration out of
Supply Chain
You
description
fanction
System Descriptoo::
Single-atage Beer Came chain raviromment.
Hero you most model the simulation step with the belew state and action of
The environmeat state is repressated by dictienary: "javentory" " iet. "pppeline" list (ixi, inl). "backlog"s int.
Oz hedd units
shipmesis: (quastity - time_remaizizgg)
usits unfilled semand
line step
placa supplizr.
pipeline eatry
campled
The collected teajectory lests
(days).
Modellisg "osle""..
* The parametars of the cimulator will be optimized to in observed training srate dtatz -actins daraset with the given simulator using sinslation-hred Inferance. The observed training darasei bat very feu camples, and the modal must be ablc to generalixe to unseen state -actine Sata.
40

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Requitement Specification
code aemerated achieve lowest possible validation Wasserstein gencrated
intespretable, the dataset accurately possible.
code fill clase SimstatorSupp))
def init (ealf):
1000 Fill in the code here Jefine the parsueeeers the medel and muke then self here.
def self state: diet. action: lnt. randen. Generator) -> diet.
Must inclade ail the logie
roture nest.siate
adl-prrmeterx((alf) =2 op. ndarray:
parameters array..
Fill
def parameters selff parameters: ndarray):
Updates modei parametare.
Arge:
pacometera top, adartay) ). Atry of parameters to apdaie.
1000 Fill in the code here
ael.parameterr.ssiffe miss...nnnnn -> sp. adarray: prior
parametars.
Returas:
odorray: Array
cun.paraneters)
bounds.
1000 Fill the code here
Usefal to know:
The generated code must include the complete 'stop" fenction body in NuuPy, felly fanctional no placehelders.
You are code exolving machire. and you will be called times to generate code, and impoove the code to aetieve the lowest possible validatios Wasserstele
loss.
possibly stochostic transition
taking state exp.
predicting the state, will
observed
decompose yyten yeu
You
You
dixtriberions.
Under circomstance cas change skelztos cods fanctios defisitions. only fill the cods.
Make sure your cods follows the exact code skeletos specification.
When defining ectegorical distributiens that parometezized mike it so that the probabilities automatieally cormelized as the will be sampled canden valaes. l.e. normalize the grobabilities within the stp fusciios.
Thist trep-hy-tiep. then give the complete working cods. generating iteration

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free FFree Calibration
G. Future work and broader impact
Multiscale or Hybrid Time Steps. While we focus on discrete-time or event-based submodules, future expansions could unify different timescales. The LLM can propose which submodules update hourly vs. daily, GFO remains applicable so long as we can run the simulation for each candidate parameter set.
Complex Domain Constraints. If domain constraints are complex (e.g. partial differential equations or advanced PDE- based physics), structural generation can remain feasible but might require specialized symbolic analysis. Alternatively, the user can provide "template code skeleton" that the LLM must only fill in, ensuring compliance with advanced physies laws.
Large Submodule Libraries. As we scale hundreds of submodule templates, the search space for À expands exponen- tially. Methods like "top-k structural proposals" or hierarchical LLM prompting may help prune unpromising structural expansions.
Diagnostics in Active Learning. One could extend the diagnostic function to query new data or domain experts to disambiguate uncertain modules. This aligns with active learning strategies in simulator design.
Overall, the G-Sim approach is flexible and can be adapted for many real-world tasks by appropriately shaping the submodule library, domain constraints, and prompt engineering.
While the discussion in Appendix A and the main text has highlighted immediate applications of G-Sim, there remain abundant opportunities to extend and enrich its capabilities, as well as substantial questions regarding its implications for society and technology. Below, we elaborate on how G-Sim could evolve in the near future, what types of contexts might be applied to, and which open research problems still need to be addressed fully realize its potential.
G.1. Expanding the Scope of Simulation
Although the above use-cases hint at specific challenging scenarios that our framework could address, next we discuss them more "abstractly".
Combining Multiple Data Sources That Cannot Be Directly Merged. One of the powerful, potential properties of G-Sim is its ability to reconcile and unify incomplete, heterogeneous datasets through the non-differentiable parameter- inference and the iterative structural refinement loop. This aligns closely with real-world situations where data is "locked" in separate silos (e.g., due to privacy constraints, mismatched time scales, or proprietary concerns). G-Sim could potentially be applied to a scenario where one dataset tracks daily admissions but omits discharge times, while another captures only average occupancy levels, and third logs policy changes intermittently. Through its flexible calibration framework, G-Sim can synthesize these partial non-overlapping datasets into cohesive simulator that is still grounded by real observations, yet remains flexible enough to propose creative structural linkages derived from domain knowledge or large language models (LLMs). Future research could focus on formalizing guarantees on consistency and convergence when combining more than two or three data sources, each with distinct observational modalities or temporal resolutions.
Continual learning. Because the environment constructed as a composition of submodules, each representing distinct components of the system (e.g., patient arrivals, disease progression, resource management), updates to individual modules can be made without disrupting the entire simulator. This modularity allows the framework to incrementally integrate new data or reflect distributional changes in specific subcomponents (e.g., new patient arrival patterns during pandemic) while preserving previously learned dynamics in other unaffected modules. Furthermore, the iterative refinement process inherently supports continual adaptation by identifying and isolating discrepancies between the simulator's 's outputs and newly observed data, prompting targeted adjustments. This ensures that the simulator evolves smoothly to accommodate gradual or abrupt distributional shifts.
Integrating Data at Multiple Time Scales. Real systems often evolve across different granularities. In public health, disease incidence may be reported weekly or monthly, while hospital admissions are tracked daily or even hourly. In supply chains, some processes (e.g.. production) update at a weekly scale, while logistics or e-commerce interactions can evolve by the hour or minute. A natural extension would allow G-Sim to handle multi-scale data more explicitly: each module can evolve at its own frequency and pass aggregated signals or constraints to modules on different time scales. In principle, the
42

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
modular calibration of G-Sim is well-suited this task, but further methodological refinement is needed ensure stable parameter inference, particularly when different submodules have drastically different update cadences.
Structured Coarse-to-Fine Validation. Because G-Sim's calibration can handle sparse aggregate-Ievel data, there arises the possibility of building a hierarchy of simulators that operate at different levels of detail. An initial coarse-grained simulator could match higher-level statistics of a system (e.g., average weekly admissions), and then subsequent layers introduce more detailed or fine- ome-grained modeling (e.g., individual patient characteristics). Iterative refinement would proceed at these nested levels, ensuring each finer simulator remains consistent with coarser macro-level aggregates. This coarse-to- fine validation could also be guided by domain knowledge or by an LLM's feedback on plausible submodule expansions, yielding significantly deeper and more scalable multi-resolution simulators.
G.2. Potential Uses Beyond Intervention Testing
Safe Reinforcement Learning and Policy Training. Although other works already enable this, G-Sim could serve as a reliable environment to train reinforcement learning (RI.) agents, particularly to assess them under distribution shifts and in domains where real-world experimentation is expensive or risky (e.g., healthcare, finance, or transportation). Agents trained in this simulator could be encouraged (through reward shaping or robust policy learning) to avoid certain regions if they might be associated with unacceptable real-world risk.
Curriculum and Continual Learning. Another way leverage G-Sim is in the spirit of OMNI-EPIC-like approaches (Faldor et al., 2024): (1) Start with simpler environment (fewer modules or constraints, denser rewards) for agent to learn basic dynamics and decision policies. (2) Gradually make the environment more complex, either by adding submodules discovered by the LLM, by shifting the distribution of parameters or by making the reward sparser or more complex. This could create a curriculum that systematically challenges and develops the agent's 's capacity for generalization.
G.3. Limitations and Future Directions
While our approach enables flexible simulator construction even under partial data and complex structural requirements, several open challenges remain.
Scalability First, scalability poses concern: gradient-free searches can become computationally expensive the number of parameters or submodules grows, especially for large or high-resolution systems. Parallelization partially addresses this but may still be infeasible for multi-scale, multi-region simulators with thousands of discrete or stochastic elements. More efficient search techniques and tailored surrogate models pooten-ltt leveraging hicrarchical or active-lcarning schemes- offeee promising ways to accommodate such complexity. Future work could also explore exploiting the causal structure hypothesized by the LLM to train sequentially the existing sub-components that might be independent of others conditioned on certain features to alleviate complexity.
Structural Coverage by the LLM Second, structural coverage by the LLM is not guaranteed when domain knowledge is sparse or highly specialized. If the language model never proposes a submodule or coupling essential for fidelity, calibration cannot recover the correct dynamics. Domain experts must still review and guide the simulator-building process, particularly in safety-criticn applications like healthcare or critical infrastructure. Iterative prompt design (Sahoo et al., 2024), retrieval-auge augmentee generation (i.e., letting the LLM consult curated references) (Lewis al., 2021), and manual injection of known constraints may further improve coverage.
Multi-Timescial Timescale and Partial Observability Third, multi-timeseen and partial observability introduce subtleties in scoring and inference. While the method theoretically should already supports heterogeneity in data type and coverage, future work could refine diagnostic criteria for simulator mismatch (e.g., across daily, weekly, and monthly scales) or more seamlessly piece together observations spanning asynchronous submodules.
Biases from Data and LLM Priors Fourth, biases from both data and LLM priors warrant careful scrutiny. When historical data reflect inequitable policies or an LLM's training corpus omits certain domain factors, the resulting simulator may embed inaccurate or unfair assumptions (Wei et al., 2025). Strengthening mechanisms that detect such sasues-perhane by incorporating faireess constraints or -omain-specific plausibility checks will be essential before deploying these simulators in sensitive real-world settings.
43

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
G.4. Ethical Considerations and Mitigation Strategies
The deployment of simulators like G-Sim, especially in sensitive domains such as healthcare, logistics, and epidemic planning, carries significant ethical responsibilities. The potential for these simulators to inform high-stakes decisions requires proactive approach to identifying and mitigating risks, particularly those related to bias and societal impact.
Potential Risks and Biases. The primary risks arise from potential biases embedded within either the foundational LLMs used for structural generation or the empirical data used for calibration. LLMs may carry biases from their vast training corpora, potentially leading to simulator structures that overlook or misrepresent certain sub-populations or dynamics. Similarly, historical datasets can reflect past inequities or contain measurement errors, which, unaddressed during calibration, could lead to simulators that perpetuate or even amplify these biases, resulting in unfair or harmful policy recommendations.
Mitigation Strategies in G-Sim, Our framework designed with several features to mitigate these risks and promote responsible
Transparency and Inspectability: G-Sim generates simulator structures as explicit, human-readable code. This transparency allows domain experts to thoroughly inspect, understand, and verify the underlying mechanisms and assumptions, facilitating accountability and trust.
Expert-intthe-Lopp We strongly emphasize the indispensable role of domain experts. G-Sim is designed to augment, not replace, human expertise. Experts are crucial for providing context, validating LLM proposals, interpreting diagnostic results, stress-testing the simulator against known edge cases, and ensuring its outputs align with established knowledge and ethical guidelines.
Iterative Diagnostics and Refinement: The framework's diagnostic loop enables rigorous evaluation against empirical data and domain-speciff constraints. This process can help identify and rectify biases or inaccuracies. Future extensions could explicitly incorporate fairness metrics or adversarial checks into these diagnostics.
Uncertainty Quantification: Integrating methods like SBI allows for approximate (albeit with challenges already discussed) quantification of uncertainty in parameter estimates. Communicating this uncertainty is vital for decision- makers to understand the confidence levels associated with simulation outcomes.
Responsible Deployment. G-Sim should be viewed as a powerful tool for exploration and decision support, not an infallible oracle. Its deployment, particularly in real-world applications with societal consequences, must be accompanied by rigorous validation, continuous oversight, and a transparent articulation of its assumptions and limitations. Ensuring that these simulators support ethical, equitable, and beneficial outcomes remains shared responsibility between developers, domain experts, and decision-makers.
44

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
H. Evaluation Metrics
To rigorously assess how closely the learned simulators align with the ground-truth generative process, we employ evaluation metrics designed to compare probability distributions. Our primary metrics are the Wasserstein distance (Kantorovich, 1960) (also known as Earth Mover's Distance) and the Maximum Mean Diserepancy (MMD) (Gretton al., 2012). These metrics particularly well-suited for our benchmark tasks, many of which exhibit stochastic discrete transitions where capturing the full distributional shape is crucial.
Concretely, for each initial state in our test set Desst (along with any corresponding actions or controls), we generate two sets next-state samples:
1. Ground-Truth Samples: We run the ground -rutth simulator N times (typically N 1000) from Xo to obtain {x],) W.W
Ji=1
2. Comparison Samples: We run the candidate simulator N times from the same Xo to get {xi,i
We then compute the Wasserstein distance and MMD between these two empirical distributions, (x(2) and (x(1)). We repeat this across all initial states in Diest and report the average distances.
The Wasserstein distance intuitively captures the minimum "cost" (or work) required to transform one distribution into the other, providing holistic comparison of their shapes. MMD measures the distance between distributions by comparing their mean embeddings in Reproducing Kernel Hilbert Space (RKHS); zero MMD implies the distributions are identical. Both offer significant advantages over simpler pointwise metrics.
Limitations of Mean Squared Error (MSE). MSE measures the average squared difference between individual pre- dictions and ground-truth values. When dealing with stochastic transitions, a simulator aiming to minimize MSE will be incentivized to predict the mean of the next-state distribution. This approach fails to capture the inherent variability and potentially multi-mon modal nature of the true process. A simulator that perfectly predicts the mean but ignores the variance or shape of the distribution would achieve low MSE but would be a poor representation of the system's 's dynamics. Therefore, prioritize Wasserstein and MMD for assessing the distributional fidelity of generated simulators.
We run each method for ten independent seeds (unless stated otherwise) and report the mean and 95% confidence intervals for each metric. All experiments and training were performed using a single Intel Core i9- 1290KK CPU @ 3.20GHz, 64GB RAM with an Nvidia RTX3090 GPU 24GB.
45

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Fres Calibration
I. Additional Experiments
To further validate the capabilitiess and robustness of G-Sim, we conducted several additional experiments. These investi- gations focused on (I) aut-of-distribution generalization the supply chain environment, (2) the structural accuracy of the generated simulators using causal discovery metrics, (3) comparison between Gradient-Free Optimization (GFO) and Simulation-Basel Inference (SBI) for parameter calibration, (4) the computational performance of G-Sim relative to baselines, and (5) an illustration of the iterative refinement process.
L1.
Generalization: Supply Chain Backlog
A critical requirement for effective simulators is their ability to generalize scenarios not during training, particularly those involving interventions or shifts in system dynamics. We tested G-Sim's 's iitoof-distribution (OOD) performance by varying the lead times in the supply-chain environment beyond the range observed during the initial training phase.
Figure displays the backlog trajectories for both the ground-truth environment and the E-Sim-generann simulator under increasing lead times. As observed:
For short lead times (L' 2, 3), consistent with or close the training data, both the true system and G-Sim maintain near-zero backlog, indicating accurate calibration in the known regime.
As the lead time increases (& = 4, 5, 6). creating a significant OOD challenge, both systems exhibit pronounced backlog spikes due delayed inventory replenishment.
Crucially, G-Sim plausibly predicts both the timing and magnitude of these spikes, even though it was not explicitly trained on these longer delays.
This strong OOD performance underscores G-Sim's ability to capture the underlying causal mechanisms of the supply chain. By leveraging the LLM propose a structurally plausible model (including inventory, pipeline, and backlog dynamics) and then calibrating its parameters, G-Sim learns a representation that is not only correlational but also reflects the system's core dynamics. This structural grounding enables it to extrapolate reliably, capability often lacking in purely data-driven models and essential for evaluating "what if" scenarios involving policy shifts or external shocks, such as supply disruptions.
True Ens
G-Sin Env
Lead Time
Lead Time
Lead Time
Backlog
Beeklog
Backlog
5
20
40
20
40
0
20
40
Time
Time
Time
Lead Time-
Lead
Lead' Time
10
Backlog
Baeklog
Backlog
5
0
20 Tine
40
0
20
40
0
20 Time
40
Time
Figure 4. Backlog vs. time in the supply-chain enviromment for varying lead times f. Blue circles and dashed lines indicate the true environment's backlog, while orange squares and dash-dot lines show the G-Sim environment. For short lead times (E = 1, 2), both maintain near-zero backlog. Longer lead times (f 5, 6) cause backlog spikes similar times, indicating G-Sim closely tracks the real system's s OOD dynamics.
46

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Table Causal Discovery Metries for G-Sim across three environments. We report Structural Hamming Distance (SHD) Fl
Score (96 1, averaged over five random seeds, with = denoting 95% confidence intervals. G-Sim demonstrates high structural accuracy,
recovering near-perfect or perfect causal graphs.
COVID-19 Value
Supply Chain Value
Hospital Beds Scheduling
Metric
Value
Fl Score (%) f
95.5 + 4.09
93.3
100.0 0.0
SHD
1.5 + 1.35
0.333 + 0.3
0 +
I.2. Structural Accuracy via Causal Discovery Metrics
core claim of G-Sim is its ability to generate simulators with causally sound structures. To quantify this, we evaluated the structural accuracy of the simulators generated by G-Sim against the known ground-truth causal graphs for each environment. We used two standard metries from causal discovery:
Structural Hamming Distance (SHD): Measures the number of edge insertions, deletions, or reversals needed to transform the predicted graph into the true graph. Lower values are better.
F1 Score: The harmonic mean of precision and recall for edge prediction, providing balanced measure of edge discovery accuracy. Higher values (up to 100%)
better.
Table 4 presents these metrics for G-Sim across the three benchmark environments. The results demonstrate that G-Sim achieves high structural accuracy:
For the Hospital Bed Scheduling environment, G-Sim achieves a perfect Fl score (100%) and zero SHD, indicating an exact match with the ground-truth causal structure.
For COVID-19 and Supply Chain, G-Sim achieves F1 scores above 90% and very low SHD values. This indicates that G-Sim reliably captures the essential causal relationships even in environments with stochasticity and partial observability.
These quantitative results support our claim that G-Sim, by combining LLM-driven structural reasoning with empirical calibration, can reliably estimate the underlying causal model, a key factor its strong OOD generalization and its suitability for policy intervention studies.
I.3. Parameter Calibration: GFO vs. Simulation-Basn Based Inference (SBI)
We integrated Simulation-Barn Inference (SBI) into G-Sim as an alternative to GFO for parameter calibration. SBI methods, like Neural Posterior Estimation (NPE), aim learn full posterior distribution over simulator parameters, p(w)D), rather than just point estimate. This offers principled uncertainty quantification, which is crucial given that the LLM might propose imperfect structures.
We compared G-Sim - ES with G-Sim - SBI on the COVID-19 SIR task, using the same LLM generated model structure for both. Table 5 summarizes the results.
Table 5. Comparison of G-Sim ES and G-Sim SBI on the COVID- 19 SIR environment. We report computation time and test set performance (MSE, MMD, Wass. distance). Lower values better. Results averaged five seeds + 95% CI.
Metric
G-Sim - ES
G-Sim SBI
Computation Time (s) $
55.7 + 0.399
63.9 + 2.49
Test MSE 1
3.11 + 0.0558
1.11e+03 + 491
Test MMD
0.0583 + 0.0197
0.07 + 0.0245
Test WASS $
0.814 + 0.0346
1.29 + 0.101
Key observations include:
47

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibration
Table 6. Training time (seconds) and number of trainable parameters for all benchmark methods.
Method
Train Time (s)
# Parameters
DyNODE
328
34,951
SINDY
3
175
RNN
33
572,507
Transformer
95
2,560,353
GeneticProgram
134
26
G- Sim-ES Abl. ZeroShot
366
4
G-Sim-ES Abl. ZeroShotOptim
426
G-Sim - ES
2,314
16
SBI has a slightly higher computational time, but both methods are comparable, operating within similar simulation budgets.
Computational Cost:
Predictive Accuracy: In these initial runs, G-Sim - ES achieved lower (better) MSE and Wasserstein distances. This may reflect the direct optimization objective of ES versus the inference objective of SBI, or potential sensitivities in the SBI implementation to model misspecification.
Uncertainty Quantification: The primary advantage of SBI is its ability provide posterior distributions, crucial feature that GFO lacks. However, discussed in Appendix B.4, interpreting these posteriors requires care when the model structure is not guaranteed to be correct.
While G-Sim ES shows edge in point-estimate accuracy in this setup, the integration of SBI significantly strengthens G-Sim by enabling uncertainty quantification, albeit with important caveats.
L.4. Computational Performance: Training Times and Parameters
To provide context the computational demands of G-Sim compared to standard baselines, measured training times and the number of trainable parameters for each method (Table 6).
G-Sim has the longest training time. This is expected as it involves multiple iterations of LLM calls, code generation, simulation runs, and calibration, rather than a single pass of gradient descent. However, G-Sim often results in simulators with significantly fewer intrinsic parameters (e.g., 16 the final model) compared to large neural network models like RNNs or Transformers. This reflects G-Sim's focus on discovering interpretable, parsimonious structures, where complexity lies in the generative search process rather than in a massive parameter count. SINDy and Genetic Programs are fast and have few parameters, but showed weaker predictive performance in our main results.
I.S. Iterative Refinement by G-Sim: An Example
The core of G-Sim's innovation lies in its iterative refinement loop, where diagmostic feedback guides the LLM to improve the simulator's s structure. To illustrate this, we provide segment of the G-Sim logs from the COVID-19 task. These logs show the LLM's 's reflections and the code changes made across iterations based performance metrics and feedback. We observe how the LLM proposes modifications, such as adding overdispersion or adjusting functional forms, to better match the observed data.
Val Wasserstoln Loss: 0.793 (Where the val ME loss per dimsension is susceptible val MSE Toss: 2.55. infected vel MSE Toss: 4.7. recovered Vel MSE Toss: 2.04) Eteration: 1
import amapy ds up
clase SimalatorSien
alphe: offect, slape, pinme: recovery. disg: overdispersionn aipha
prim, disp o.1, 1.0
uptimized 1-3.54, 4.47, 0.093, 26.45]
Ad
Val Wasseretain Loce: 0.404 (Wher the val MR. loss per diminsson is sisoeptible val MR loss: 1.49, Infreted vol MRE loss: 3.55, recovared val MST lous: 2.05)
Iteration: 0
48

---

G-Sim: Generative Simulations with Large Language Models and Gradient-Free Free Calibration
Inpori nunpy 24 up
closs SiaulatorSiep
(aeii))
aslf.
uptimized AeC
10.457, 0.079)
Please coflect on how you can improve the codo
[Assistant] D) Introduce ss overdaspersion (negative bisonial or similar) for botk infections and recoveries not jast for infections. This helps captere
variability in how individzals recover and cas reduce ceror in the infected and recevered compartaints. 2) Mi in offezt plas sloge for the recovery process (for exuuple. logistic function or a piecenise linear fuaction in 1/N rather than using fixed gamm.
This iterative process, documented in the logs, allows G-Sim to move beyond an initial, potentially flawed, structural proposal towards a simulator that is both structurally plausible and empirically aligned.
49


Reviews:
[{"review_id": "LSpa5gOzci", "reviewer": "Reviewer_jcp9", "summary": "This paper introduces G-Sim, a framework for automatically constructing simulators by combining Large Language Models (LLMs) and gradient-free optimization (GFO). The LLM is used to generate the structural components of the simulator (submodules, causal relationships), based on provided domain knowledge. GFO is then employed to calibrate the parameters of these submodules to align with empirical data. The framework includes an iterative refinement loop, where discrepancies between simulator output and real-world data trigger LLM-guided adjustments to the simulator's structure, followed by re-calibration via GFO. The paper demonstrates G-Sim on epidemic modeling (COVID-19), supply chain, and hospital bed scheduling examples, claiming improved out-of-distribution generalization compared to purely data-driven methods.\n\n## Update After Rebuttal\nThe authors provided a thorough rebuttal and engaged constructively with the feedback. I appreciate their efforts in running additional experiments during the discussion phase and, crucially, incorporating a Simulation-Based Inference (SBI) analysis into their framework and agreeing to elevate it from the appendix to a more central part of the main paper. This addition significantly strengthens the paper's potential contribution regarding uncertainty quantification.\n\nHowever, based on the SBI results presented during the rebuttal (via the provided plots), the current implementation appears to require further refinement. The results showed inconsistent parameter recovery, overly broad posterior distributions, and posterior predictive checks that indicated issues. These problems seem likely related to implementation details (e.g., embedding network architecture, summary statistics, or training procedure) rather than fundamental limitations, as SBI is generally expected to perform well on this type of problem (SIR model). Specific suggestions for diagnosing and improving these results were provided to the authors.\n\nOverall, the paper has been notably improved through the authors' responsiveness and the inclusion of the SBI analysis. While the current SBI results need further work, the commitment to incorporating this methodology addresses a key weakness identified in the initial review. Consequently, I have adapted my initial evaluation to reflect these positive developments.", "questions": "", "limitations": "", "rating": 4, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We sincerely thank Reviewer for their insightful and constructive feedback, which significantly helps strengthen our paper. Below, we address each major concern explicitly and outline concrete improvements for the camera-ready version.\n\n---\n\n**Baseline Tuning**\n\nWe appreciate the reviewer’s concern about baseline comparisons. The baselines' hyperparameters are standard, and both the baselines and hyperparameters are similar to recently published works on similar simulation tasks, coming from the Hybrid Digital Twin work (L 245).\n\n---\n\n**Structural and Causal Accuracy**\n\nThe reviewer rightly emphasized the importance of validating structural and causal accuracy. Our intervention experiments implicitly verify structural correctness; simulators that produce accurate predictions under unseen interventions strongly indicate correct causal structure.\n\nAdditionally, we now include [quantitative evaluations](https://imgur.com/a/z1sJuFD) (F1 Score and Structural Hamming Distance - SHD) against their known causal structures. Specifically, the Supply Chain environment perfectly matches ground-truth causal relationships (F1=1.0, SHD=0), while Hospital and SIR environments yield F1 scores above 90% and minimal SHD (≤1.5), demonstrating that G-Sim reliably captures causal relationships. These metrics and their analysis will be prominently featured in the updated manuscript.\n\n---\n\n**Gradient-Free Optimization (GFO) vs. Simulation-Based Inference (SBI)**\n\nThe reviewer's suggestion regarding SBI methods is highly pertinent. Initially, we adopted evolutionary-based GFO primarily for scalability reasons, given its suitability for non-differentiable, stochastic simulator components. Nonetheless, we agree that SBI's uncertainty quantification and robustness are valuable. We have since integrated SBI into G-Sim, testing it on the COVID-19 environment. [Preliminary results](https://imgur.com/a/rK4MtoO) indicate comparable performance to GFO, with added benefits of uncertainty estimation. A detailed comparison between SBI and GFO, along with explicit recommendations for future work, will be included in the revised manuscript (Sections 1 and 4.2). \n\n---\n\n**Contributions**\n\nThe reviewer correctly identifies that our primary contribution is the innovative integration of existing techniques (LLM-driven structural reasoning combined with GFO).\n\n---\n\n**Intervention Modeling**\n\nInterventions are directly modeled by explicitly modifying parameters in the transparent, human-readable code modules generated by the LLM, as described in 6.1. Our design ensures robustness under interventions outside the training distributions, providing valuable \"what-if\" analyses. We will expand on these scenarios in a dedicated appendix, explaining detailed examples to enhance clarity.\n\n---\n\n**Prompt Engineering Effort**\n\nPrompt engineering required modest domain-specific adjustments, leveraging generalizable, environment-agnostic prompts (provided in Appendix E.4) supplemented with concise, environment-specific descriptions (Appendix F). Our approach minimizes the need for extensive expert intervention. We will explicitly discuss the extent of prompt engineering required in our revision. We optimized the prompts to support and understand the tool calls and iterative workflow.\n\n---\n\n**Scalability**\n\nWe recognize scalability as an essential consideration. Scaling discovery is often an NP-hard problem, and we also find that it is difficult to scale. However, future work can exploit decomposable structures, and we can scale with the number of parameters to optimize, inheriting the same scalability as ES.\n\nWe will add an expanded discussion of scalability and practical examples detailing scalability in a new appendix.\n\n---\n\n**Ethical Considerations**\n\nWe appreciate the reviewer's concern regarding ethical implications. Our approach prioritizes transparency, allowing easy inspection, stress-testing, and expert verification of simulator outputs prior to deployment. As explicitly stated in our Impact Statement (L2182-2199), we emphasize the critical role of domain expertise, transparency in assumptions, and rigorous oversight. To further address these concerns, we will include an expanded discussion on ethical considerations, biases, and mitigation strategies in a dedicated appendix.\n\n---\n\n**Summary of Revisions:**\n\n- Clarified baseline comparisons.\n- Added explicit quantitative evaluation of causal and structural accuracy.\n- Provided a new experiment comparing GFO and SBI.\n- Enhanced explanation and examples of intervention modeling.\n- Clarified prompt engineering effort and detailed scalability strategies.\n- Included thorough discussion of ethical considerations and mitigation strategies.\n\n---\n\n*We hope that most of the reviewer’s concerns have been addressed and, if so, they would consider updating their score. We’d be happy to engage in further discussions.*", "claims_and_evidence": "The main claim is that G-Sim can generate \"robust and flexible\" simulators that are \"aligned with empirical evidence\" and capable of \"causally informed\" decision-making. While the framework is conceptually appealing, the evidence supporting these broad claims is not entirely convincing:\n\n1) Out-of-Distribution Generalization: The paper claims superior out-of-distribution generalization compared to purely data-driven methods (RNNs, Transformers). While the experiments suggest this might be the case, the comparisons are limited. It's unclear if the data-driven baselines were appropriately tuned for this task. A more comprehensive comparison, including a wider range of baselines and more challenging out-of-distribution scenarios, would be necessary to fully support this claim.\n2) Causal Structure Recovery: A key aspect of G-Sim is the LLM-guided generation of causal structure. However, the paper doesn't convincingly demonstrate that the correct causal structure is recovered. For example, in the SIR modeling example, does the LLM generate the actual SIR equations, or just a functionally similar but causally incorrect model? The paper lacks a rigorous evaluation of the structural accuracy of the generated simulators, relying primarily on predictive performance.\n3) GFO vs. SBI: The choice of gradient-free optimization (GFO) for parameter calibration is justified by the potential non-differentiability of the generated simulators. However, simulation-based inference (SBI) methods, which infer a distribution over parameters rather than a single point estimate, would likely be a more appropriate and robust choice. SBI naturally handles stochasticity in the simulator and provides uncertainty quantification, which is crucial given the potential for errors in the LLM-generated structure. GFO provides only a point estimate, lacks uncertainty estimation for predictive checks, does not provide any information about parameter interactions and potential compensation mechanisms between parameters, potentially failing to detect multi-modal solutions.", "methods_and_evaluation_criteria": "The proposed framework, combining LLMs and GFO, is a reasonable approach to the problem of automatic simulator construction. The use of real-world inspired examples (epidemic modeling, supply chains, hospital beds) is appropriate. However, the evaluation criteria primarily focus on predictive accuracy.  While important, this is insufficient to assess the overall quality of the generated simulators.  Additional criteria, specifically focusing on the structural accuracy and the causal validity of the learned models, are needed.", "theoretical_claims": "The paper does not present significant theoretical contributions, focusing primarily on the framework and its application. Therefore, I did not check any proofs.", "experimental_designs_or_analyses": "I reviewed the experimental designs. As mentioned above, the comparisons to purely\ndata-driven methods are limited, and the evaluation lacks a rigorous assessment of the\nstructural and causal accuracy of the generated simulators. The choice of GFO over SBI\nis also a concern, especially given the initial strong claim in the abstract to\nconstruct \"uncertainty-aware simulators\".", "relation_to_broader_scientific_literature": "The paper positions itself at the intersection of LLMs, simulator learning, and\noptimization. It relates to prior work on using LLMs for code generation and to the\nbroader field of system identification.  However, the connection to the simulation-based\ninference (SBI) literature, which offers powerful tools for calibrating simulators and\nquantifying uncertainty, is not adequately explored.", "essential_references_not_discussed": "No, the paper seems to discuss directly related prior thoroughly.", "other_strengths_and_weaknesses": "**Originality**: The combination of LLMs and GFO for automatic simulator construction, along\nwith the iterative refinement loop, appears to be a novel approach.\n\n**Significance**: The potential significance is high, as robust and flexible simulators are\ncrucial for many scientific and engineering domains. However, the current evidence does\nnot fully support the claimed significance.\n\n**Clarity**: The paper is generally well-written and easy to follow. The overall framework\nis clearly presented. However, some details regarding the experimental setup and the\nevaluation criteria could be clarified.", "other_comments_or_suggestions": "No", "questions_for_authors": "1) GFO vs. SBI: Why was gradient-free optimization (GFO) chosen for parameter\n   calibration instead of simulation-based inference (SBI) methods? SBI seems like a\n   more natural fit, providing a posterior distribution over parameters and inherent\n   uncertainty quantification. Could you compare the performance and scalability of GFO\n   and SBI (e.g., using Neural Posterior Estimation) in this context?\n\n2) Structural Accuracy: How do you assess the structural accuracy of the generated\n   simulators?  Do you have any mechanisms to ensure that the LLM recovers the correct\n   causal relationships, and not just a model that fits the observed data well?  How\n   would you evaluate the simulator if the true underlying structure is unknown?\n\n3) Theoretical Contributions: The paper primarily presents an engineering framework. Are\n   there any novel theoretical contributions, or is the main contribution the\n   combination of existing techniques?\n\n4) Intervention Modeling: Can you provide more details on the intervention modeling\n   capabilities? How are interventions represented and incorporated into the\n   LLM-generated simulators?  Can you provide specific examples of interventions tested\n   in the experiments?\n\n5) Limitations of the LLM prompt: Can you provide some insights on prompt engineering\n   effort? How much expert knowledge is required here?\n\n6) Scalability to complex settings: Can you comment on the expected scalability to\n   use-cases with high-dimensional parameter vectors and many (coupled) submodules?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {"ethical_review_flag": "Flag this paper for an ethics review.", "ethics_expertise_needed": ["Legal Compliance (e.g., GDPR, copyright, terms of use)"]}}, {"review_id": "RC66QiwSqz", "reviewer": "Reviewer_seMS", "summary": "This paper attempts to generate simulators via LLMs coupled with a gradient-free optimisation process to choose parameters. An LLM-guided search loop identified the simulator's structural components and a gradient-free optimisation procedure sets their parameters. The method relies on the generalisation ability of LLMs in other to generalise to OOD data. The paper can be seen as an orchestration framework for LLMs.", "questions": "", "limitations": "", "rating": 2, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We sincerely thank the Reviewer for their detailed and constructive feedback. We fully agree on the importance of clearly presenting our methodology within the manuscript itself. To comprehensively address these concerns, we will allocate the additional page in the camera-ready version specifically to enhance clarity. Below, we provide a shortened clarification of our method, explicitly referencing relevant sections and appendices, and address each of the reviewer's comments directly.\n\n**Clarification of the Proposed Method:**\n\nG-Sim automates the generation of domain-specific simulators by integrating structural proposals from Large Language Models and numerical calibration via Gradient-Free Optimization. The process involves an iterative loop between three distinct phases, outlined in Algorithm 1 and described in Section 4 and Appendix E.2:\n\n1. **Structural Proposal via LLM (Section 4.1 and Appendix E.4):**\n   - The LLM generates Python code to outline the simulator’s structural components, guided by domain-specific textual descriptions and available background knowledge.\n   - Structural proposals explicitly specify modular Python functions and classes capturing domain-relevant mechanisms, such as epidemic spread dynamics or resource distribution processes. Importantly, the LLM defines the structural templates without numerical parameters, which are left open for subsequent calibration.\n\n2. **Parameter Calibration via Gradient-Free Optimization (Section 4.2 and Appendix E.3):**\n   - Following structural generation, numerical parameters within these LLM-generated modules are independently calibrated using gradient-free methods, such as evolutionary algorithms, to align the simulation outcomes with empirical observations.\n   - This parameter optimization step is entirely decoupled from the structural proposals made by the LLM, which we hope clarifies potential confusion between the structural and numerical stages of the simulator generation process.\n\n3. **Iterative Refinement via Diagnostic Feedback (Section 4.3 and Appendix E.4):**\n   - Simulations produced by the above steps are then evaluated against the available empirical data to identify discrepancies or inadequacies.\n   - These evaluation outcomes are synthesized into textual feedback (for example, \"Simulator lacks weekly seasonality, consider incorporating periodic seasonal modules\"), guiding the LLM to refine structural proposals.\n   - This iterative loop of evaluation, feedback, and refinement proceeds automatically until the resulting simulator meets the desired levels of accuracy and domain plausibility.\n\nThe combination of the symbolic and optimization approaches ensures G-Sim remains robust, transparent and precise, as justified empirically, offering strong generalization capabilities even in out-of-distribution scenarios.\n\n**Extent of Automation:**\n- The iterative refinement loop described above is fully automated once initial contextual inputs are provided, and our experiments follow this approach. However, the framework is flexible enough to optionally accommodate human expertise for interpreting nuanced feedback or integrating additional domain-specific constraints.\n\n**Explicit References to Examples in Camera-Ready Version:**\n- Explicit examples of the generated Python code and the iterative refinement process are already detailed in Appendix I.2. We will provide clearer cross-references to these examples within the main manuscript, enabling the reader to readily access practical demonstrations of structural proposals and refinement iterations.\n- Moreover, Appendix F presents detailed prompts alongside the environment specifications provided to the LLM, illustrating the exact inputs guiding structural generation. We will reference these more explicitly in the main text to further clarify how our methodological approach leverages domain knowledge.\n\n**Committed Enhancements for Final Manuscript:**\n- A dedicated additional page in the manuscript clearly describing each component of our method: structural proposals (Appendix E.4), gradient-free parameter calibration (Appendix E.3), and diagnostic iterative refinement (Algorithm 1 in Appendix E.2).\n- Explicit references within the main text to practical illustrative examples (Appendix I.2) and to detailed LLM prompts and environment details (Appendix F).\n- Clarification on the scope of automation and the optional role of domain expertise.\n\n---\n\n*We hope that most of the reviewer’s concerns have been addressed and, if so, they would consider updating their score. We’d be happy to engage in further discussions.*", "claims_and_evidence": "The authors claim to have created a general framework for creating \"what if\" simulators across a wide variety of domains. The method description is unclear, so it is hard to understand exactly how this process works. In some ways, this seems related to a managed prompting framework. In the appendix it seems like the LLMs are generating Python code then gradient-free optimisation adjusts the prompts.", "methods_and_evaluation_criteria": "Please see my comments under \"claims and evidence\".", "theoretical_claims": "There are limited theoretical claims or proofs - this is an empirical paper.", "experimental_designs_or_analyses": "The experiment involves generating multiple simulators for data-driven problems, but it is unclear to what extent this process is actually automated.", "relation_to_broader_scientific_literature": "The method is similar to other simulator generating methods, some of which are included in their experiments, but this method does not include any guarantees of accuracy.", "essential_references_not_discussed": "N/A", "other_strengths_and_weaknesses": "N/A", "other_comments_or_suggestions": "I would be more explicit in the paper about the method. Is the LLM being prompted, generating python code and optimisation repeats this process? I would also give examples of things like \"structural proposals\" and be more explicit about the method as this is somewhat unusual construction.", "questions_for_authors": "N/A", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "9wFwOBTABW", "reviewer": "Reviewer_KPvR", "summary": "The paper proposes a G-Sim, LLM-guided simulator with expert domain knowledge with gradient-free optimization while introducing a new problem with environment building. With experiments on three environments, the paper verified the flexibility of G-Sim.", "questions": "", "limitations": "", "rating": 2, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We sincerely thank the Reviewer for the valuable and constructive feedback. Below, we address each concern and outline key improvements in the revised manuscript.\n\n---\n\n### **1. Experimental Validation and Benchmark Fairness**\n\nWe acknowledge the concerns regarding validation and benchmark selection:\n\n- **New Metrics:** We have conducted additional experiments beyond Wasserstein distance, we now include **Mean Squared Error** and **Maximum Mean Discrepancy (MMD)** metrics for a more comprehensive assessment, https://imgur.com/a/yx228xx.\n\n- **Computational Fairness:** To ensure fair comparisons, we will explicitly report training times and number of parameters for all baselines, as seen here: https://imgur.com/a/pgdvwWT.\n\n### **2. Manuscript Clarity and Presentation**\n\nWe fully agree with the suggested improvements for clarity and readability. Specifically:\n\n- **Concise Abstract:** The abstract will be shortened, succinctly summarizing existing method limitations and explicitly emphasizing our main contribution (LLM-guided, gradient-free simulator generation). Technical details will move entirely into the main text.\n\n- **Formatting Improvements:** We significantly reduce itemized/enumerated lists and paragraph breaks:\n  - Merged \"Current methods\" and \"General-purpose simulators\" into a streamlined narrative introduction.\n  - Replaced itemized \"Key properties\" and \"Contributions\" with concise narrative descriptions.\n  - Removed unnecessary paragraph breaks (\\paragraph{}) and lists on page 4.\n\n- **Method Earlier in Manuscript:** To enhance readability, we move the \"G-Sim: Hybrid Simulator Construction\" section from page 5 to page 4, preceding related work.\n\n- **Improved Fig. 1 Caption:** Revised caption for Figure 1 to be self-contained and clear:\n\n  *\"Overview of G-Sim, an automatic simulator-generation framework integrating LLM-derived domain knowledge and empirical data. G-Sim iteratively: (1) proposes simulator structure using domain-informed LLM, (2) calibrates parameters via gradient-free optimization, and (3) refines through diagnostics (predictive checks, stress-tests, LLM-reflections), enabling robust ‘what-if’ scenario analyses.\"*\n\n- **Minor Clarification:** Line 284 revised explicitly as: \"imbalances (Rauba et al., 2024).\"\n\n---\n\n### **3. Detailed Responses to Reviewer Questions**\n\n**Parameter Fitting:** \nIn Appendix E. 3, we explicitly clarify gradient-free evolutionary optimization (population initialization, mutation strategy, selection criteria, and convergence checks). We minimize MSE using EvoTorch's genetic algorithm (population 200, simulated binary crossover, Gaussian mutation, and tournament selection). Furthermore, we warm-start reusing the best parameters from the previous iteration where possible.\n\n**Score Function Clarification:** \nThe \"Score\" quantifies discrepancies between simulated and observed data in our implementation via MSE, as detailed explicitly in Appendix E.3.\n\n**Theoretical Guarantees:** \nWe acknowledge the lack of rigorous global optimality guarantees but highlight known convergence properties of evolutionary methods towards global minima under suitable conditions [1]. We will explicitly include this discussion, clearly indicating assumptions and limitations.\n\n*[1] Rudolph, G. (1994). IEEE Trans. Neural Networks, 5(1), 96-101.*\n\n**Clarifications on Section 4.3:** \n- **Diagnostic formulation ($\\\\delta$):** \n  Diagnostic discrepancies ($\\\\delta$) aggregate multiple metrics—predictive accuracy (e.g., MSE, Wasserstein distance) and domain constraints (non-negativity, cyclical patterns). Appendix B.3 explicitly details these diagnostics.\n\n- **Threshold $\\\\varepsilon$ Selection:** \n  We implicitly set $\\\\varepsilon$ via iteration limits. We will clarify this explicitly in the manuscript.\n\n- **LLM Feedback Robustness:** \n  Empirical validations (App. I.2 iterative refinement logs; App. E.4 prompt templates) show LLM feedback consistently improved accuracy, demonstrating robustness across diverse diagnostic scenarios. This evidence will be explicitly highlighted.\n\n---\n\n### **4. \"What-If\" Scenario Comparisons**\n\nBaseline methods inherently lack structured mechanisms for performing counterfactual (\"what-if\") analyses. Thus, such scenarios are uniquely suited for our generative framework, clearly distinguishing G-Sim's capabilities. We will clarify this explicitly in the revision.\n\n---\n\n### **Summary of Improvements**\n- Expanded experimental validation.\n- Streamlined abstract.\n- Improved manuscript readability.\n- Clarified parameter-fitting and diagnostics.\n- Enhanced clarity of Sec 4.3.\n- Discussion of convergence.\n\n*We hope that most of the reviewer’s concerns have been addressed and, if so, they would consider updating their score. We’d be happy to engage in further discussions.*", "claims_and_evidence": "With limited experiments and no theoretical guarantee, it is hard to conclude the the claims are verified.", "methods_and_evaluation_criteria": "There are some parts that do not make sense so I will address them in the questions.", "theoretical_claims": "There are no theoretical claims in this work.", "experimental_designs_or_analyses": "I'm not sure that the experiments are well designed. The choice of benchmark methods seems unfair and the evaluation metric is also insufficient.", "relation_to_broader_scientific_literature": "The work of a simulator can affect a huge domain of scientific and non-scientific domains since there are many use cases.", "essential_references_not_discussed": "I think the authors did most of the essential references.", "other_strengths_and_weaknesses": "**Weakness**\n- The presentation of the paper should be improved a lot.", "other_comments_or_suggestions": "- The abstract is too long so it makes it difficult to follow the key concept of the paper solely in the abstract.\n- Overall, there are too many \\paragraph, \\enumerate and \\itemize in the main text, which I think is not a good way to present a paper. \n- I understand that defining the problems and introducing the previous works are very important. However, presenting the main method at the middle of page 5 might not be the best strategy.\n- I think there should be a self-contained description of the figure on the label of Figure 1. \n- In the right column line 284, \"• Additional terms can incorporate other diagnostic criteria as needed, such as (Rauba et al., 2024) or stress-tests (Li & Yuan, 2024)\", I think the author is missing the criteria in front of \"(Rauba et al., 2024)\"?", "questions_for_authors": "- It seems like the paper lacks a lot of details of the proposed model. Can you elaborate more on the parameter fitting steps of this method? \n- What is $f$ in Section 4.2? \n- How does the formulation of Score look like?\n- Do you have any theoretical guarantees/insights that this fitting process will give you an optimal solution?\n- Can you elaborate more on Section 4.3? \n- How do you formulate $\\delta$ and what is the explanation behind it? \n- How do you choose the predefined threshold $\\epsilon$? \n- How accurate is the LLM feedback when the diag values are greater than $\\epsilon$? Have you tested different scenarios and checked whether the LLM is outputting the right feedback to the current situation?\n- I'm not sure whether the comparison with proposed benchmark methods is a fair choice. How is the training/inference time difference for different methods? or the number of parameters or computational complexity? \n- Also, do you have results for \"what if\" questions for other methods as well?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Meta-review: This paper proposes G-Sim, a framework for LLMs to construct the structural components of simulators and employs gradient-free optimization for parameter calibration. The method supports iterative refinement through diagnostic feedback, enabling the construction of modular, interpretable, and empirically aligned simulators. It is evaluated on three real-world-inspired domains (COVID-19 modeling, supply chains, hospital bed scheduling) to demonstrate the efficacy of the method's accuracy and policy intervention capabilities.

Based on the reviews, I am on the fence about this submission. I'm leaning towards acceptance given the timely and interesting topic. However, the paper may benefit from a thorough rewriting.
Decision: Accept (poster)