跳到正文
arXiv cs.CL· Zhenghan Song, Yulong Liu, Cheng Wan, Chenjun Li, Lingfu Liu, Yunyi Li, Congcong Yuan·· 5 天前精选AI 评分76

LLM 生成的模拟代码可能解决错误物理问题:验证代码编码的方程

Your Simulation Runs but Solves the Wrong Physics: Verifying What LLM-Generated Simulation Code Encodes

AI 导读

研究团队发布 MooseBench 多物理场基准,评估 LLM 生成的 MOOSE 模拟输入是否真正实现预期物理问题。三种 LLM 生成的可运行输入中有 41%–60% 违反专家参考,研究者据此开发无需运行求解器或 LLM 评审的验证器,从代码中的弱形式项读取 PDE 并与目标方程比较。该验证器接受全部 962 个保持物理性质的改写,并标记 1,313 个物理变化突变中的 1,286 个。

推荐理由

论文将可运行与物理正确区分开来,并用基准数据展示代码级方程验证对科学模拟的实际价值。

正文 · 原文

View PDF HTML (experimental)

Abstract:Code generated by large language models (LLMs) is commonly accepted once it runs. We show that, for scientific simulation, this acceptance is unsafe. Running the single-shot outputs of three LLMs on MooseBench, a 220-case multiphysics benchmark that we release, we find that 41-60% of the MOOSE inputs that run, and 39-56% of those that run to completion, violate the expert reference: they run while solving a different problem. The gap persists in newer models such as GPT-6 Sol (68% of its runnable inputs), even when the model first writes down the specification it intends to implement. These violations usually change the solution: on a 98-case subset, 56 of 63 comparable violating outputs deviate from the reference solution by more than 1%, against 6 of 48 outputs that satisfy every check. Such failures are invisible to execution but checkable from the code. In MOOSE, each Kernel and boundary-condition object adds a known weak-form term, so our verifier reads the encoded PDE off the input and compares it with the intended one, with no solver run and no LLM judge. It accepts all 962 physics-preserving rewrites of the expert references and flags 1,286 of 1,313 physics-changing mutations without accepting any. As repair feedback, its report helps as much as the specification is right: checked against a model's own reading of the request, it can carry that reading's errors into the code; as they are corrected, it turns from worse than a self-check to better. We hope these results encourage verifying simulation code against the equations it is meant to solve, not only against whether it runs.
Comments: Preprint
Subjects: Machine Learning (cs.LG); Artificial Intelligence (cs.AI); Computation and Language (cs.CL); Software Engineering (cs.SE)
Cite as: arXiv:2605.09360 [cs.LG]
  (or arXiv:2605.09360v2 [cs.LG] for this version)
  https://doi.org/10.48550/arXiv.2605.09360

arXiv-issued DOI via DataCite

Submission history

From: Yulong Liu [view email]
[v1] Sun, 10 May 2026 06:19:47 UTC (8,783 KB)
[v2] Sun, 29 Nov 2026 15:44:38 UTC (1,043 KB)

来源:arXiv cs.CL · arxiv.org