Reinforcement Learning with Verifiable Physics: Post-training LLMs for PDE Solver Generation
Pengfei Cai, Utkarsh Utkarsh, Alan Edelman, Christopher Rackauckas, Rafael Gomez-Bombarelli
NeurIPS page · Open on the map
Category: LLM Agents, Evals & Benchmarks › Code Generation · Type: new method · Keywords: PDE solver generation, reinforcement learning post-training, physics verification, LLM code generation, numerical methods, scientific computing
Areas: Evaluation & Benchmarks › Language Model and Agent Benchmarks › LLM Agent Tool Use; RL for LLMs & Agents › LLM Reasoning Reinforcement Learning › Reinforcement Learning for Reasoning; AI for Science › Physics-Informed Neural Modeling › Neural PDE Solvers
Summary
RLVP is a reinforcement learning post-training framework that improves LLM generation of PDE solvers by using a hybrid verifier that combines hard program-validity checks with continuous physics rewards.
Explained to a 5-year-old
Scientists need to solve complicated math problems called PDEs to understand things like weather and fluids. They have a big computer brain (a language model) that can write code, but it needs help to write good code. They teach the brain by giving it a special checker that says if the code runs and how close it is to the right answer. After learning, the brain can write new code that solves new problems it has never seen before. This helps people make better models without needing to be experts in math.
Explained to a 5-year-old, longer
Scientists use math equations called partial differential equations to model things like water flow, heat, and air. Writing these equations into computer code that solves them is hard and takes a lot of expertise. A big language model can be used to write code for these equations, but it often makes mistakes. Instead of just asking the model to fix its mistakes each time, researchers can teach it once using a special method. This method gives the model two kinds of feedback: one says if the code runs without errors, and the other scores how accurate the solution is. The model learns from many examples of different kinds of equations, like those describing waves, heat spreading, and fluid flow. After training, the model can generate new code that solves new problems it has never seen before. It can even combine pieces of code it learned to solve bigger, more complex problems. This makes it easier for people who are not math experts to get useful simulations. The approach also works on smaller computers, so it does not need huge amounts of power. By using this learning method, the model becomes better at solving real-world scientific problems. Overall, it helps scientists get more reliable results faster.
For a technical reader
The paper describes a post-training pipeline that improves how large language models generate code for solving partial differential equations. It uses a two-part verification system: a static check ensures the generated code compiles and runs, while a continuous reward measures how closely the numerical solution matches the expected physics. The model is trained on a diverse set of PDE families, allowing it to learn reusable building blocks like stencils and time-stepping schemes. After training, the model can produce solvers for new equations without any additional prompting, often outperforming both fine-tuned and baseline models. This results in a more reliable and parameter-efficient way to obtain high-quality scientific code, reducing the need for expert-level programming.
Problem
Developing accurate and reliable numerical solvers for partial differential equations (PDEs) requires expert knowledge and is labor-intensive. Existing LLM-based code generation methods for PDE solvers rely on prompting and test-time scaling, providing only binary correctness signals rather than graded accuracy.
Method
The approach post-trains a single language model using reinforcement learning with a hybrid verifier. Hard checks ensure the generated code is syntactically valid and executable, while continuous rewards evaluate physics-based accuracy and PDE-residual consistency across multiple PDE families.
Results
The approach outperforms pre-trained and supervised baselines on PDE benchmarks and transfers zero-shot to unseen PDEs, with a smaller post-trained model beating prompting of a frontier model on in-distribution tasks.
Contributions
A hybrid verifier that combines hard program validity with continuous physics rewards for graded correctness, and a unified RL post-training framework that learns composition of numerical motifs across diverse PDE families.
Practical relevance
Enables researchers and practitioners to generate accurate PDE solvers automatically, reducing the need for expert knowledge and accelerating scientific computing workflows.
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction