This is the official implementation for CodePDE: An Inference Framework for LLM-driven PDE Solver Generation, the first inference framework for generating PDE solvers using large language models (LLMs).
The required packages are listed in requirements.txt
, which can be installed by running pip install -r requirements.txt
.
Download the data using the data/data_download.py
script from PDEbench. Then process the data with the data/extract_data_subsets.py
script.
Set up the configurations in config
and run python main.py
.
In the repeated sampling mode, the LLM generates solvers from scratch.
In the refinement mode, the LLM uses existing solvers in the solvers
folder as "seeds" (e.g., solvers/burgers/nu_0.01/seeds
for Burgers Equation with
In the funsearch mode, the LLM uses a few solvers generated in the repeated sampling stage to warm start the program database and then generates new solvers via evolutionary search. The implementation assumes that the repeated sampling results are stored under ../archived_logs
.
May you have any questions on our work or implementation, feel free to reach out to shandal@cs.cmu.edu
!
If you find this repository useful, please consider giving a star ⭐ and cite our paper.
@article{li2025codepde,
title={CodePDE: An Inference Framework for LLM-driven PDE Solver Generation},
author={Li, Shanda and Marwah, Tanya and Shen, Junhong and Sun, Weiwei and Risteski, Andrej and Yang, Yiming and Talwalkar, Ameet},
journal={arXiv preprint arXiv:2505.08783},
year={2025}
}