Verified Numerics from Natural Language: Teaching a Small Language Model to Write Groundwater-Flow Solvers
Abstract
Large language models (LLMs) can write simulation code, yet a solver that runs may still converge at the wrong rate or to the wrong answer. We show that a small open model learns to write correct solvers from plain-English problem statements when it is trained on cheap, programmatically generated and numerically verified data. For two-dimensional steady Darcy flow with heterogeneous and anisotropic conductivity, wells and mixed boundary conditions, a generator produces problems with second-order finite-volume solvers, and a convergence verifier runs every solver on two grids and checks its error and observed order. On 2000 correct and 1857 mutant runs the verifier rejects no correct solver and accepts 0.5% of mutants, where execution and mass-balance checks accept over 94%. Qwen3-8B fine-tuned on 2000 verified solvers passes 99.70.3% of in-distribution and 99.80.3% of held-out-combination test problems, level with GPT-6.2 Sol, in one local pass of about 1000 tokens; untuned, it writes no passing solver. Minimal pairs that change one physical fact in the wording show what the trained model still misreads: it solves both problems of 451% of pairs and writes the same source sign whether a well injects or extracts water. Replacing a quarter of the training problems by paraphrases and minimal pairs raises this to 87% with no loss of test accuracy. Corrupted training targets show which generator errors the verifier must catch: the model absorbs mixed errors in half of its targets but learns a single bug repeated in half of them.
Create a lesson
Metadata
- Categories
- cs.LG, cs.CL, physics.comp-ph
- Comments
- 15 pages, 6 figures. Code and data: https://github.com/Binyao111/right-numerics-wrong-physics
Related papers
Alignment and Convergence Analyses of Gradient Flow in Two-Layer Convolutional Neural Networks
Shared title terminologycs.LGWang Xiang, Saptarshi Chakraborty
TC-GNN-Flow: Relational Coupling Flows with Calibrated Intervals for Traffic Forecasting
Shared title terminologycs.LGYongKyung Oh
Late Activation: A Better Reward-Diversity Trade-off for RL-Tuned Flow Models
Shared title terminologycs.LGRunguo Li, Zijia Wang, Minglei Wang et al.
Looking Back to Forget: Self-Anchored Unlearning Along the Generation Trajectory of Diffusion Language Models
Shared title terminologycs.LGRuihao Pan, Suhang Wang
RIVET: Router-Informed, Verifier-Guided Expert Tailoring for MoE Self-Speculative Decoding
Shared title terminologycs.LGYunhao Wang, Hongyu Zhao, Zhenjia Mo et al.
A Sealed Benchmark for Forecasting Training-Recipe Gains at Small Scale
Shared title terminologycs.LGShengwei Zhang, Shenkang Qian, Mo Shi et al.