AI
LLM-Generated Simulation Code Often Runs but Models Wrong Physics
A new benchmark reveals that code from large language models can execute successfully while solving entirely different equations than intended.
When large language models produce scientific simulation code, developers often consider it reliable once it executes without errors. New research challenges this assumption, showing that executable code frequently encodes incorrect physics despite running smoothly.
The Hidden Problem#
Researchers tested three LLMs using MooseBench, a 220-case benchmark for multiphysics simulation problems. They discovered a troubling pattern: between 41–60% of code that runs successfully, and 39–56% of code that completes execution, violates the reference specification by solving a fundamentally different problem. Even advanced models like GPT-6 Sol show the issue, with 68% of runnable outputs containing such violations. These failures proved consequential—on a 98-case subset, 56 of 63 violating outputs diverged from correct solutions by more than 1%, while only 6 of 48 compliant outputs showed comparable deviation.
Verification Without Execution#
The researchers developed a verifier that bypasses simulation runs entirely. Since MOOSE (Multiphysics Object Oriented Simulation Environment) structures each physics component as an object with a known mathematical form, the tool reads the encoded partial differential equation directly from the input file and compares it against the intended specification. This approach proved effective: it accepted all 962 physics-preserving rewrites of reference solutions and flagged 1,286 of 1,313 physics-violating mutations without false positives.
Why This Matters#
The findings underscore a critical gap in how LLM-generated scientific code is validated. Execution success—whether code runs without crashing—is an insufficient measure of correctness in domains where the underlying mathematics must match the problem being solved. Verifying code against the actual equations it represents, rather than relying on runtime behavior alone, offers a practical path forward for ensuring simulation integrity.

