CodePDE: An Inference Framework for LLM-driven PDE Solver Generation

Shanda Li, Tanya Marwah, Junhong Shen, Weiwei Sun, Andrej Risteski +2 more
5/13/2025
cs.LGcs.AIcs.CL

Official code: LithiumDA/CodePDE (81 stars, last commit 2026-02-12).

Abstract

Partial differential equations (PDEs) are fundamental to modeling physical systems, yet solving them remains a complex challenge. Traditional numerical solvers rely on expert knowledge to implement and are computationally expensive, while neural-network-based solvers require large training datasets and often lack interpretability. In this work, we frame PDE solving as a code generation task and introduce CodePDE, the first inference framework for generating PDE solvers using large language models (LLMs). Leveraging advanced inference-time algorithms and scaling strategies, CodePDE unlocks critical capacities of LLM for PDE solving: reasoning, debugging, selfrefinement, and test-time scaling -- all without task-specific tuning. CodePDE achieves superhuman performance across a range of representative PDE problems. We also present a systematic empirical analysis of LLM generated solvers, analyzing their accuracy, efficiency, and numerical scheme choices. Our findings highlight the promise and the current limitations of LLMs in PDE solving, offering a new perspective on solver design and opportunities for future model development. Our code is available at https://github.com/LithiumDA/CodePDE.

View on arXivView PDF

Code Implementations(1)

LithiumDA/CodePDEOfficial100%

[TMLR] CodePDE: An Inference Framework for LLM-driven PDE Solver Generation

8111PythonMay 13, 20258 months ago

Cite this paper

@article{li2025codepde,
  title  = {CodePDE: An Inference Framework for LLM-driven PDE Solver Generation},
  author = {Shanda Li and Tanya Marwah and Junhong Shen and Weiwei Sun and Andrej Risteski and Yiming Yang and Ameet Talwalkar},
  year   = {2025},
  eprint = {2505.08783},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.08783v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.08783.svg)](https://codeofpaper.com/paper/2505.08783)

Discussion