arXiv:2509.09936cs.LGcs.NA2025-09被引 7

让大模型写科学计算代码,自动选对求解器。

SciML Agents: Write the Solver, Not the Solution

  • 用大模型根据自然语言描述生成可运行的微分方程求解代码。
  • 在1000个任务上,新模型经提示工程后准确率超90%。
  • 适合需要自动化科学计算的科研人员和工程开发者。

近期科学机器学习研究试图直接通过神经网络预测目标值(如物理信息神经网络、神经微分方程、神经算子等),但高精度与鲁棒性仍具挑战。本文提出新思路:利用大模型编写代码,调用数十年积累的数值算法。这将任务从学习解函数转为做出领域感知的数值选择。我们探究大模型能否作为科学计算代理,在给定自然语言描述的常微分方程(ODE)时,自动生成科学合理的可运行代码,正确选择刚性/非刚性求解器,并执行稳定性检查。目前尚无评估该能力的基准。为此,我们构建两个新数据集:包含100个对抗性“误导”问题的诊断集(表面似刚性但需代数简化证明非刚性);以及涵盖刚性与非刚性区间的1000个多样化ODE任务的大规模基准。评估覆盖开源与闭源模型,对比两种提示策略(无引导 vs. 带领域知识引导)及两种版本(原生 vs. 微调)。评估指标包括代码可执行性与数值有效性(对比参考解)。结果显示,充分上下文与引导提示下,新型指令跟随模型在两项指标上均表现优异。许多新开源系统无需微调即可达到强性能,而旧或小型模型仍依赖微调。初步结果表明,精心设计的提示与微调可实现可靠求解简单ODE问题的专用大模型代理。

原文摘要 · Abstract (English)

Recent work in scientific machine learning aims to tackle scientific tasks directly by predicting target values with neural networks (e.g., physics-informed neural networks, neural ODEs, neural operators, etc.), but attaining high accuracy and robustness has been challenging. We explore an alternative view: use LLMs to write code that leverages decades of numerical algorithms. This shifts the burden from learning a solution function to making domain-aware numerical choices. We ask whether LLMs can act as SciML agents that, given a natural-language ODE description, generate runnable code that is scientifically appropriate, selecting suitable solvers (stiff vs. non-stiff), and enforcing stability checks. There is currently no benchmark to measure this kind of capability for scientific computing tasks. As such, we first introduce two new datasets: a diagnostic dataset of adversarial "misleading" problems; and a large-scale benchmark of 1,000 diverse ODE tasks. The diagnostic set contains problems whose superficial appearance suggests stiffness, and that require algebraic simplification to demonstrate non-stiffness; and the large-scale benchmark spans stiff and non-stiff ODE regimes. We evaluate open- and closed-source LLM models along two axes: (i) unguided versus guided prompting with domain-specific knowledge; and (ii) off-the-shelf versus fine-tuned variants. Our evaluation measures both executability and numerical validity against reference solutions. We find that with sufficient context and guided prompts, newer instruction-following models achieve high accuracy on both criteria. In many cases, recent open-source systems perform strongly without fine-tuning, while older or smaller models still benefit from fine-tuning. Overall, our preliminary results indicate that careful prompting and fine-tuning can yield a specialized LLM agent capable of reliably solving simple ODE problems.

科学计算大模型ODE求解代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。