A Judge Agent Closes the Reliability Gap in AI-Generated Scientific Simulation
Organizations: NextGen PlatformAI C Corp, USA
Abstract
Large language models can generate scientific simulation code, but the generated code silently fails on most non-textbook problems. We show that classical mathematical validation -- well-posedness, convergence, and error certification -- can be fully automated by a Judge Agent, reducing the silent-failure rate from 42% to 1.5% across 134 test cases spanning 12 scientific domains. The headline result comes from a prospective benchmark: 72 blinded tasks submitted by 12 independent scientists yield an 89% success rate (95% CI: [80%, 95%]) with automated error bounds, versus 53% without the Judge. On clinical CT (the only powered experiment, n = 200), the pipeline reaches 99% of expert quality. The residual 1.5% concentrates at bifurcation points where certifiability breaks down. We formalize this boundary through the simulability class S and introduce spec.md, a structured specification format that makes any scientific computation problem machine-readable and solver-independent. Code, data, and all 72 benchmark tasks are publicly archived.
Figures & tables
| Domain | Quality | ||||
|---|---|---|---|---|---|
| Clinical CT | 12 min | 5 d | 600 | 99% | 200 |
| Seismic FWI | 45 min | 2 wk | 450 | 95% | 5 |
| Combustion (GRI-Mech) | 25 min | 5.5 d | 320 | 94% | 15 |
| Granular flow | 18 min | 1 wk | 560 | 92% | 3 |
| Helium ground state | 8 min | 4 d | 720 | 97% | 1 |
| BFS turbulent flow | 22 min | 2 wk | 916 | 91% | 3 |
| Outcome | Count | % | Redesign | Quality | Notes |
|---|---|---|---|---|---|
| Correct + bounded + quality | 58 | 80.6% | 1.4 0.8 | Pass | verified |
| Correct + bounded, quality flag | 6 | 8.3% | 2.1 1.0 | Flag | 5/6 resolved after consult |
| rejected (correct) | 3 | 4.2% | — | — | Outside (ill-posed) |
| rejected (fixable) | 2 | 2.8% | — | — | Ambiguous NL input |
| Failed (resource limit) | 2 | 2.8% | — | — | Exceeded 64 GB memory |
| Failed (wrong answer) | 1 | 1.4% | 3 | Fail | Near event horizon |
| Symbol | Primitive | Operation |
|---|---|---|
| Differentiate | Spatial/temporal derivatives (finite differences, spectral, finite elements) | |
| Integrate | Quadrature, line/surface/volume integrals (Gauss, Monte Carlo) | |
| Solve (linear) | Direct or iterative solution of (LU, CG, GMRES, multigrid) | |
| Evaluate (nonlinear) | Pointwise nonlinear function evaluation ( , reaction rates, constitutive laws) | |
| Evolve | Time integration (Euler, Runge–Kutta, BDF, symplectic, exponential integrators) | |
| Transform | Basis change (FFT, wavelet, spherical harmonics, Radon) |
| Full | No | Opus+spec | Opus raw | PINN | |||||
| Cor. | Bnd. | Cor. | Bnd. | Cor. | Bnd. | Cor. | Bnd. | Cor. | |
| CT reconstruction | ✓ | ✓ | ✓ | — | ✓ | — | ✓ | — | ✓ |
| Marmousi FWI | ✓ | ✓ | — | — | — | — | — | — | — |
| GRI-Mech ignition | ✓ | ✓ | ✓ | — | ✓ | — | — | — | — |
| Granular flow | ✓ | ✓ | — | — | — | — | — | — | — |
| He ground state | ✓ | ✓ | — | — | — | — | |||
| This work | COMSOL | FEniCS | OF a | PINNs | LLM agents | |
|---|---|---|---|---|---|---|
| NL input | ✓ | — | — | — | — | ✓ |
| Cross-domain | tested | Multi-phys. | PDE | CFD | PDE | Partial |
| Error bound | ✓ | — | A post. | — | — | — |
| -verification | ✓ | — | — | — | — | — |
| No code required | ✓ | — | — | — | — | ✓ |
| (median) | 480 | — | — | — | — | — |
| Phase | Goal | Mechanism | Milestone |
|---|---|---|---|
| I | Cross-domain validation | Three-agent pipeline, 12 primitives, S1–S4 verification, prospective benchmark | 89% on 72 held-out tasks |
| II | Additional powered validations | Extend powered experiments to 2 domains beyond CT | Powered CIs in 3 domains |
| III | Bifurcation certification | Implement continuation-based rejection, Lyapunov detection, ensemble perturbation | 1.5% 0% residual failures |
| IV | Specification portability | Adapters for FEniCS, COMSOL, OpenFOAM consuming spec.md ; independent consumers | 3 independent spec.md consumers |
| V | Domain expansion | Domain-specific Judge extensions for acoustics, particle physics, materials | 3 domains beyond imaging |
| VI | Primitive completeness | Proof that 12 primitives realize for all convergent discretizations | Coverage theorem |
| Obstruction | Condition | Fails | Example |
|---|---|---|---|
| Turing undecidability | S3 | No convergent approximation | Halting problem |
| BSS uncomputability | S3 | No finite algorithm over | Mandelbrot boundary membership |
| Quantum measurement | S2 | Solution not unique/determined | Individual photon detection |
| Infinite-precision barrier | S4 | Error bound not computable | Problems depending on Chaitin’s |
| # | Domain | Problem | Primitives | Target | Achieved | Data |
|---|---|---|---|---|---|---|
| 1 | Epidemiology | COVID-19 SEIR-D (8 counties) | 10% peak | 12.4% | R | |
| 2 | Classical Mech. | Granular flow (2D, =5000) | S | |||
| 3 | Electromagnetics | Waveguide modes (sanity) | S | |||
| 4 | Quantum Chem. | He ground state (CI) | 1 mHa | 0.4 mHa | S | |
| 5 | Fluid Dynamics | BFS turbulent ( =5100) | 5% TKE | 3.8% | R † | |
| 6 | Structural Mech. | Topology-opt. bracket | S |
| Method Family | Primitive Decomposition |
|---|---|
| Finite Difference (FD) | |
| Finite Element (FEM) | |
| Finite Volume (FVM) | |
| Spectral methods | |
| Discontinuous Galerkin (DG) | |
| Boundary Element (BEM) |
| Problem | Replicator A | Replicator B | Replicator C | Variability |
|---|---|---|---|---|
| CT reconstruction | 31.5 dB | 31.8 dB | 31.7 dB | 0.2 dB |
| Marmousi FWI | 26.2 dB | 26.5 dB | 26.4 dB | 0.2 dB |
| GRI-Mech ignition | 6.5% | 6.1% | 6.3% | 0.2% |
| Granular flow | 3% | |||
| He ground state | 0.38 mHa | 0.42 mHa | 0.40 mHa | 5% |
| BFS turbulent | 3.6% | 4.0% | 3.8% | 5% |
| Scientist | Problem Posed | Bnd. | Expert Check | ||
|---|---|---|---|---|---|
| Geophysicist | Rayleigh wave in layered soil | Yes | 380 | Correct | |
| Bioengineer | Drug diffusion through tumor | Yes | 520 | Correct | |
| Astrophysicist | Bondi accretion onto compact obj. | Yes | 450 | Correct | |
| Materials sci. | Spinodal decomp. (Cahn–Hilliard) | Yes | 600 | Correct | |
| Chemical eng. | Packed-bed reactor, mass transfer | Yes | 290 | Partial |
| Feature | This work | COMSOL | FEniCS | OpenFOAM | Wolfram |
|---|---|---|---|---|---|
| Input | NL text | GUI + equations | Python + weak form | Config files | Wolfram Lang. |
| Domain | verified | Multi-physics | PDE only | CFD only | Broad |
| Error guarantee | Formal (Prop. S5 ) | None | A posteriori only | None | None |
| -verification | Automated | None | None | None | None |
| (setup time) | 480 | — | — | — | — |
| Expertise req. | Domain only | Domain + numerical | Domain + FEM + Python | Domain + CFD | Domain + Wolfram |
| # | Model | Complexity | Framework (dB) | Expert (dB) | Ratio |
|---|---|---|---|---|---|
| 1 | Marmousi-2 | High (faulted layers) | 26.4 | 27.8 | 95% |
| 2 | Synthetic salt body | Very high (salt dome) | 23.1 | 25.2 | 92% |
| 3 | Thrust fault model | High (overturned layers) | 25.4 | 27.0 | 94% |
| 4 | Thin layers | Medium (thin beds) | 27.5 | 28.6 | 96% |
| 5 | Smooth gradient | Low (1D variation) | 28.2 | 28.9 | 98% |
| Mean s.d. |
| (K) | (atm) | Framework Error (%) | Expert Error (%) | |
|---|---|---|---|---|
| 1000 | 1 | 1.0 | 9.2 | 5.8 |
| 1000 | 10 | 1.0 | 8.7 | 5.1 |
| 1000 | 50 | 1.0 | 7.3 | 4.9 |
| 1200 | 1 | 1.0 | 6.8 | 4.2 |
| 1200 | 10 | 1.0 | 6.1 | 3.5 |
| 1200 | 50 | 1.0 | 5.9 | 3.3 |
| County | Peak Error (%) | Cum. RMSE (%) | Expert Peak Err. (%) | |
|---|---|---|---|---|
| King County (WA) | 7.3 | 11.2 | 0.91 | 5.1 |
| Maricopa (AZ) | 9.8 | 15.3 | 0.87 | 7.2 |
| Fulton County (GA) | 11.5 | 17.8 | 0.84 | 8.5 |
| Harris County (TX) | 12.1 | 18.4 | 0.82 | 9.0 |
| Los Angeles (CA) | 12.8 | 19.6 | 0.80 | 9.4 |
| Cook County (IL) | 13.4 | 20.1 | 0.79 | 9.8 |
| GPT-4 (raw) | Claude-3.5 (raw) | |||
|---|---|---|---|---|
| Problem | Correct | Bound | Correct | Bound |
| CT reconstruction | Yes | No | Yes | No |
| Marmousi FWI | No | No | No | No |
| GRI-Mech ignition | No | No | Partial | No |
| Granular flow | No | No | No | No |
| He ground state | Partial | No | Partial | No |
| Difficulty | Tasks | Correct+Bounded | Quality Pass | Med. Quality Ratio |
|---|---|---|---|---|
| Textbook (interior ) | 18 | 18 (100%) | 18 (100%) | 98% |
| Standard (interior ) | 30 | 27 (90%) | 25 (83%) | 95% |
| Frontier (near ) | 24 | 19 (79%) | 15 (63%) | 89% |
| Total | 72 | 64 (89%) | 58 (81%) | 94% |
| Configuration | Valid | Bounded | condition tested |
|---|---|---|---|
| Full (all gates + audit) | 12/12 | 12/12 | S1–S4 verified |
| Remove Gate 1 (dimensional) | 11.4/12 | 10.8/12 | S1: specifiability |
| Remove Gate 2 (BC/IC) | 11.0/12 | 10.2/12 | S2: well-posedness |
| Remove Gate 3 (well-posedness) | 8.2/12 | 7.4/12 | S2+S3: stability + approx. |
| Remove Gate 4 (classification) | 11.8/12 | 11.6/12 | S1: correct encoding |
| Remove Gate 5 (cost estimation) | 12/12 | 11.4/12 | S4: certifiability feasibility |
| # | Category | Problem Description | Outcome |
| (a) Ambiguous/incomplete NL (20 tests, targeting S1 via ) | |||
| 1 | (a) | “Solve the wave equation” (no BC, no IC, no domain) | Redesign correct |
| 2 | (a) | “ , solve diffusion” ( ambiguous: conductivity or rate?) | Redesign correct |
| 3 | (a) | “Large Reynolds number flow past cylinder” (no Re value) | Redesign correct |
| 4 | (a) | “Knudsen regime gas dynamics” (jargon misinterpreted) | Human clarification |
| 5 | (a) | “Heat transfer in a room” (no geometry or materials) | Redesign correct |
| Backbone | Correct | Bounded | Median Quality Ratio |
|---|---|---|---|
| Claude-3.5-Sonnet (default) | 12/12 | 12/12 | 94% |
| Claude-3-Opus | 12/12 | 12/12 | 93% |
| GPT-4-Turbo | 11/12 | 11/12 | 91% |
| Difficulty tier | Full pipeline | No | GPT-4+spec | PINN |
|---|---|---|---|---|
| Textbook (interior , 18) | 18/18 (100%) | 14/18 (78%) | 13/18 (72%) | 11/18 (61%) |
| Standard (interior , 30) | 27/30 (90%) | 17/30 (57%) | 13/30 (43%) | 7/30 (23%) |
| Frontier (near , 24) | 19/24 (79%) | 7/24 (29%) | 5/24 (21%) | 1/24 (4%) |
| Total | 64/72 (89%) | 38/72 (53%) | 31/72 (43%) | 19/72 (26%) |
| Configuration | Correct + Bounded | Quality Pass | cond. |
|---|---|---|---|
| Full (all gates + audit) | 64/72 (89%) | 58/72 (81%) | S1–S4 |
| Remove well-posedness gate | 50/72 (69%) | 44/72 (61%) | S2+S3 |
| Remove BC/IC compatibility | 56/72 (78%) | 48/72 (67%) | S2 |
| Remove dimensional consistency | 60/72 (83%) | 52/72 (72%) | S1 |
| Remove classification | 62/72 (86%) | 56/72 (78%) | S1 |
| Remove cost estimation | 64/72 (89%) | 54/72 (75%) | S4 feasibility |
Scientific Code Generation
Scientific code generation develops systems that turn scientific questions, papers, and workflows into executable, scientifically valid programs.
See all 52 papers