The promise of AI in science often hinges on Large Language Models (LLMs) acting as "agents" that can write, debug, and interpret scientific code. However, a major hurdle remains: a simulator can be syntactically perfect and execute without errors while being physically "hallucinated."
In their paper, "Solver to System: LLM Reasoning Across Representations and Execution in Scientific Simulation," researchers from NYU investigate whether LLMs truly understand the underlying physics of the code they handle or if they are simply pattern-matching their way through scientific tasks.
TL;DR
The authors introduce Solver2System, a benchmark that tests LLMs on their ability to reconcile different representations of physical systems (code, math, text, and data). They find that while execution helps models identify physical errors, LLMs often rely on superficial lexical cues (like variable names) and frequently reach the right conclusion for the wrong physical reasons.
What Problem Does This Paper Address?
In scientific computing, a Partial Differential Equation (PDE) solver is more than just code; it’s a representation of a physical law. To work with these solvers effectively, an agent must reason across multiple layers of abstraction: the mathematical equation ($\partial_t u = \dots$), the natural language description ("heat diffusion in a rod"), the source code (the implementation), and the numerical trajectory (the resulting data).
The core challenge is that code can be "valid" in a programming sense (it runs) but "invalid" in a scientific sense (it violates conservation laws or has a sign flip that causes unphysical behavior). Current benchmarks often focus on whether code runs, but this paper asks if LLMs can detect when the physics is broken, especially when different representations of the same system disagree.
Methods
The researchers evaluated eight open-weight models (like Qwen and Nemotron) and two frontier models (Gemini 2.5 and 3.7 Flash) using two primary tasks:
- Cross-Representation Consistency: Models are shown four views of a system (Code, Math, Trajectory, Description). In some cases, one view is "corrupted" (e.g., the math says "diffusion" but the code implements "advection"). The LLM must identify if they agree and, if not, find the "outlier."
- Static and Agentic Validity Judgment: Models judge if a piece of code is physically valid. In the "agentic" version, they are given a budget of actions to modify the code, run diagnostics, and observe the output before making a final judgment.
To ensure models weren't just relying on "cheating" cues, the authors used lexical perturbations: removing comments, corrupting comments with misleading info, or obfuscating variable names (e.g., changing diffusion_coeff to foobar1).
Datasets
The authors introduced the Solver2System dataset, which consists of:
- 32 base PDE solvers covering four families: Heat, Wave, Burgers, and Navier-Stokes equations.
- A mix of human-written (textbook-style) and synthetic (LLM-generated) implementations.
- Controlled Corruptions: Physically invalid variants created by introducing small but consequential defects like sign flips or spurious terms.
- Aligned Representations: For every solver, the dataset includes the corresponding LaTeX equations, natural language descriptions, and numerical trajectories.
Key Insights and Ideas
- The Trust Hierarchy: LLMs exhibit an "implicit hierarchy" of trust. When evidence conflicts, they are much more likely to trust the mathematical equations or text descriptions over the numerical trajectories. They often "blame" the trajectory as the outlier even when it is the only correct representation.
- Lexical Crutches: Obfuscating variable names doesn't just make the code harder to read; it actually degrades the model's ability to reason about the other unchanged representations (like the math). This suggests models use variable names as a primary anchor for their physical "mental model."
- Execution is a Double-Edged Sword: While running code (agentic reasoning) significantly improves a model's ability to spot invalid physics, weaker models often find the "right" answer for the "wrong" reason. For example, a model might correctly label code as invalid because it saw a
NaN(Not a Number) error, but completely miss the actual causal defect (like a reversed sign in the flux calculation).
Key Results
- High False Alarms: Models are highly skeptical, incorrectly reporting disagreements in 47% of perfectly consistent cases.
- Detection Gaps: Corrupted code was the hardest outlier to detect (63% detection rate), whereas corrupted trajectories were the easiest (up to 88%).
- Obfuscation Impact: Removing informative variable names dropped the models' ability to identify the correct outlier by 4.0 percentage points across all corrupted items.
- Agentic Gains: Gemini 2.5 Flash saw a 9.3pp jump in accuracy when allowed to execute code, though it still struggled with "causal misdiagnosis."
Limitations and Future Work
The authors acknowledge that their corpus is relatively small (32 base solvers) and consists of "textbook-style" code rather than high-fidelity, production-grade scientific software.
Future research could expand this to more complex multi-physics simulations and explore how to better align LLMs to "trust" numerical data. The paper concludes that while LLMs are becoming powerful scientific assistants, we must remain wary of their tendency to reach correct conclusions through flawed physical reasoning—a "right for the wrong reasons" failure mode that could be dangerous in sensitive scientific applications.
Summary updated