Abstract
Solving Partial Differential Equations (PDEs) is fundamental to scientific simulation but traditionally requires significant human expertise. While Large Language Models (LLMs) have shown promise in generating numerical solvers, existing methods rely on expensive "best-of-n" sampling. We present PDE-SHARP, a framework that leverages LLM-based mathematical analysis and iterative refinement to generate high-accuracy solvers. By replacing brute-force execution with structured "Selection-Hybridization Tournaments," PDE-SHARP achieves a 4x improvement in accuracy while reducing computational costs by 60-75%.
Introduction
The simulation of physical systems, such as fluid dynamics and weather patterns, relies on solving PDEs. Expert-level tuning for numerical stability and accuracy is time-consuming. Recent attempts to use LLMs for solver generation often employ test-time scaling, which involves generating and executing dozens of candidates to find a viable solution. This approach is computationally expensive for complex physics. PDE-SHARP addresses this by shifting the burden from expensive scientific computation to more efficient LLM inference through a structured three-stage pipeline.
Methods
The PDE-SHARP framework consists of three primary stages: Analysis, Genesis, and Synthesis.
- Analysis: The LLM performs a five-step mathematical "Chain-of-Thought" analysis. This includes PDE classification, checking for analytical solutions, identifying simplifying transformations, and performing numerical stability analysis to establish safe time-step bounds.
- Genesis: Based on the insights from the analysis phase, the LLM generates an initial set of solver candidates.
- Synthesis: This stage employs "Selection-Hybridization Tournaments." LLM "judges" evaluate candidates and iteratively refine the code. The system can hybridize solvers, combining the strengths of different versions—such as one's stability with another's accuracy—to produce a superior final solver.
Results
PDE-SHARP was evaluated on the PDEBench benchmark across tasks including Advection, Burgers, Reaction-Diffusion, Navier-Stokes, and Darcy Flow.
The framework demonstrated significant improvements over baseline methods:
- Computational Efficiency: PDE-SHARP required fewer than 13 solver evaluations on average, representing a 60-75% reduction in scientific compute compared to the 30+ evaluations required by standard "best-of-n" approaches.
- Superior Accuracy: Solver accuracy improved by 4x on average across all tested PDEs. In a specific reaction-diffusion case study, the framework achieved a 77x error reduction through a targeted refinement suggested during the synthesis phase.
- Higher Code Quality: The initial analysis stage led to more robust code, requiring 63-67% fewer debugging iterations (0.33 vs. 0.9-1.4 for baselines).
Conclusion
PDE-SHARP effectively combines mathematical reasoning with iterative code refinement to produce efficient and accurate PDE solvers. While currently focused on 1D and 2D problems on simple grids, future work will explore scaling to higher dimensions, complex geometries, and the integration of neural PDE methods.
Summary updated