PDEAgent-Bench: A Multi-Metric, Multi-Library Benchmark for PDE Solver Generation

Zhen Hang, Yushan Yashengjiang, Junhui Li, Huanshuo Dong, Yang Wei, Zhezheng Hao, Jiangtao Ma, Songlin Bai, Haozhong Kai, Xihang Yue, Gangzong Si, Dongming Jiang, Chao Yao, Zhanhua Hu, Jiangqing Zhang, Pengwei Liu, Yaomin Shen, Xingyu Ren, Lei Liu, Zikang Xu, Han Li, Qingsong Yao, Hande Dong, Hong WangarXiv 2026

TL;DR

The paper introduces PDEAgent-Bench, the first multi-metric, multi-library benchmark designed to evaluate LLMs and AI agents on generating code for partial differential equation (PDE) solvers. Unlike standard coding benchmarks that only check if code runs, this framework enforces a strict, staged evaluation checking for executability, numerical accuracy, and computational efficiency across professional finite-element method (FEM) libraries. Testing reveals that while current LLMs can write runnable code, they struggle significantly to produce numerically accurate and efficient scientific solvers.

What Problem Does This Paper Address?

Generating code for scientific computing, specifically PDE solvers, is incredibly challenging. It is not just about correct programming syntax; it requires a deep mathematical understanding to select proper discretization schemes, weak forms, boundary conditions, and solver configurations.

Existing code generation benchmarks (like HumanEval or SWE-bench) focus on general-purpose programming tasks and evaluate success via unit tests or basic execution. They fail to capture the unique constraints of numerical computing: a solver might run perfectly without throwing errors, yet yield completely inaccurate physical results or take an unacceptable amount of time to converge. PDEAgent-Bench addresses this gap by providing a standardized, rigorous testbed for PDE-to-solver code generation.

Figure 1: Overview of PDEAgent-Bench: motivation, limitations of general code benchmarks, benchmark data structure, and evaluation protocol.

Methods

The authors design a staged evaluation framework consisting of three sequential gates that a generated solver must pass:

  1. Executability: Does the code run without errors in a sandboxed Docker container and output the correct data format?
  2. Numerical Accuracy: Does the relative $L^2$ error of the generated solution fall below a case-specific threshold ($\tau_{acc}$) when compared to a high-fidelity reference solution?
  3. Computational Efficiency: Does the solver execute within a calibrated runtime budget ($\tau_{time}$)?

To ensure thresholds are fair and adaptive to the inherent difficulty of each PDE, the benchmark uses a calibration baseline solver to dynamically set accuracy and runtime targets for each specific instance.

Beyond single-shot generation, the paper explores two advanced evaluation variants:

  • Iterative Improvement: Giving the model up to three attempts by providing execution feedback (error messages or stage-level outcomes) to see if it can self-repair.
  • Template-Guided Reasoning: Providing a code scaffold (boilerplate code) to isolate pure numerical reasoning from API-specific implementation burdens.
Figure 2: PDEAgent-Bench evaluation pipeline from PDE case specification to sandboxed execution and staged assessment.

Datasets

PDEAgent-Bench consists of 645 synthetic PDE instances spanning 6 mathematical categories and 11 distinct PDE families (including Poisson, Helmholtz, Heat, Stokes, Navier-Stokes, Burgers, and Wave equations).

The dataset features 14 different geometric domain templates (such as unit squares, L-shapes, and squares with holes) to rigorously test boundary handling. Crucially, it supports three major professional Finite Element Method (FEM) libraries across both Python and C++ ecosystems:

  • DOLFINx (Primary track: full coverage with 645 instances)
  • Firedrake (Cross-library track: 510 instances)
  • deal.II (Cross-library C++ track: 313 instances)

Key Insights and Ideas

  • Runnable $\neq$ Correct: The biggest takeaway is that standard code metrics are highly deceptive for scientific computing. Models are decent at writing code that executes, but they frequently fail on the physics and math, producing unstable or highly inaccurate solutions.
  • The C++ Bottleneck: Cross-library transfer is a massive hurdle. Models perform significantly worse when forced to generate C++ code for deal.II compared to Python code for DOLFINx, highlighting a gap in handling complex, strongly-typed scientific software stacks.
  • Feedback Has Its Limits: Providing error messages helps models fix superficial syntax errors or API mismatches, but it does virtually nothing to help them correct flawed underlying numerical formulations or poor choices of function spaces (such as failing the inf-sup stability condition in Stokes flow).

Key Results

  • Top Performers: On the primary DOLFINx track, Gemini 3.1 Pro achieved the highest single-shot pass rate at 54.1%, followed by Claude 3 Opus (47.8%) and GPT-4o (46.0%).
  • The C++ Drop-off: When moving to the C++ track (deal.II), performance dropped sharply across the board, with the top-performing model (Gemini 3.1 Pro) only managing 32.3%.
  • Hardest Problems: Certain PDE families proved exceptionally difficult. For example, the Stokes equation—which involves complex saddle-point structures and pressure null-space handling—saw pass rates drop below 25% for almost all models.
  • Reasoning vs. Boilerplate: Using template-guided generation provided only modest gains (e.g., DOLFINx pass rate for Gemini increased from 54.1% to 56.3%), proving that the primary bottleneck is fundamental numerical reasoning, not just memorizing library boilerplate.
Figure 3: Single-shot pass rates (%) by PDE family on Firedrake (left) and deal.II (right). Solid lines denote base LLMs, and dashed lines denote Code/PDE agents. Unavailable family–library pairs are omitted. Full numbers are reported in Table 2 in the Appendix.

Limitations and Future Work

The benchmark relies heavily on manufactured analytical solutions or highly refined numerical references. While excellent for automated, reproducible evaluation, this setup does not fully mirror real-world industrial engineering problems. Real-world applications often involve complex multiphysics coupling (e.g., fluid-structure interaction), chaotic 3D fluid dynamics, or noisy experimental boundary conditions.

The authors note that future iterations of the benchmark should expand into these more complex, large-scale industrial scenarios to push the boundaries of scientific AI agents.

Summary updated

BibTeX
@misc{hang2026pdeagent,
  author = {Zhen Hang and Yushan Yashengjiang and Junhui Li and Huanshuo Dong and Yang Wei and Zhezheng Hao and Jiangtao Ma and Songlin Bai and Haozhong Kai and Xihang Yue and Gangzong Si and Dongming Jiang and Chao Yao and Zhanhua Hu and Jiangqing Zhang and Pengwei Liu and Yaomin Shen and Xingyu Ren and Lei Liu and Zikang Xu and Han Li and Qingsong Yao and Hande Dong and Hong Wang},
  title = {{PDEAgent-Bench: A Multi-Metric, Multi-Library Benchmark for PDE Solver Generation}},
  year = {2026},
  eprint = {2605.09636},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.09636},
}
Figure