Reinforcement learning for control of partial differential equations
Authors: Nicolò Botteghi, Matteo Tomasetto, Andrea Manzoni
Organizations: MOX - Department of Mathematics, Politecnico di Milano, Milano, Italy · Department of Mechanical Engineering, Politecnico di Milano, Milano, Italy
Controlling dynamical systems governed by partial differential equations (PDEs) remains a challenging task in scientific computing, owing to high-dimensional state spaces, distributed actuation, nonlinear dynamics, and stringent real-time constraints. Reinforcement learning (RL) has emerged as a promising paradigm for synthesizing feedback controllers that adapt to varying operating conditions and can be deployed efficiently in real-time. This review provides a unified perspective on RL and PDE-constrained optimization, and surveys model-free, model-based, and multi-agent RL approaches to PDE control, with particular emphasis on sample efficiency, generalization across parametric variations, and scalability to high-dimensional problems. Two demonstrative examples, the stabilization of a chaotic system and a flow control problem, illustrate the performance and pitfalls of RL agents in practice. Finally, we discuss evaluation and benchmarking practices, current limitations, and open research directions toward reliable, data-efficient, and scalable RL for scientific computing.
Figures & tables
Figure 1: Reinforcement learning for control of partial differential equations. An agent or controller determines the control action ut relying on the observed state xt . As a result, the environment or dynamical systems evolves over time and return the subsequent state xt+1 and the reward signal rt . Multiple reinforcement learning frameworks may be considered to enhance sample efficiency and cope with high-dimensional problems, such as model-free, model-based and multi-agent reinforcement learning. Moreover, different environments may be taken into account, such as optimal navigation, flow control, shape design, plasma control, material design or swarm control.
Figure 2: Stabilization of a chaotic system . Solutions of the uncontrolled KS equation for different values of ν .
Figure 3: Stabilization of a chaotic system . Training and evaluation rewards obtained by the different competing agents over 5 different seeds.
Figure 4: Stabilization of a chaotic system . Training and evaluation rewards obtained by the different TD3 competing agents over 5 different seeds.
Figure 5: Controlled solutions of the KS equation when using SAC (first column) and PPO (second column). Each column shows the evolution of the controlled state (first row), the evolution of the predicted control actions (second row), and the discrepancy of the state and the target over time, namely the state cost ∥xt−xref∥ (third row).
Figure 6: Stabilization of a parametric chaotic system . Training and evaluation rewards obtained by the different competing agents over 5 different seeds.
Figure 7: Stabilization of a parametric chaotic system . Training and evaluation rewards obtained by the different TD3 competing agents over 5 different seeds.
Figure 8: Controlled solutions of the parametric KS equation with ν=0.216 when using SAC trained at ν=0.0 (first column) and SAC trained at different ν values (second column). Each column shows the evolution of the controlled state (first row), the evolution of the predicted control actions (second row), and the discrepancy of the state and the target over time, namely the state cost ∥xt−xref∥ (third row).
Figure 9: Active flow control . Uncontrolled flow (first column), controlled flow with SAC agent trained in the easy environment (second column) and controlled flow with SAC agent trained in the hard environment (third column) when deployed in the easy environment at t=1 (first row), t=40 (second row) and t=80 (third row). The last row shows the time evolution of drag and lift for the three different settings.
Figure 10: Active flow control . Uncontrolled flow (first column), controlled flow with SAC agent trained in the easy environment (second column) and controlled flow with SAC agent trained in the hard environment (third column) when deployed in the hard environment at t=1 (first row), t=40 (second row) and t=80 (third row). The last row shows the time evolution of drag and lift for the three different settings.
Figure 11: Active flow control . Mean evaluation rewards obtained by SAC (left panel) and PPO (right panel) over 5 different seeds when trained and zero-shot deployed in different scenarios. For each row, the best-, intermediate-, and worst-performing policies are highlighted with dark, medium, and light green backgrounds, respectively.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 12Figure 13Figure 14Figure 15
Hyperparameter
SAC
PPO
TD3
TD3 (mod)
Max episodes
1000
1000
1000
1000
Warm-up episodes
50
–
50
50
Actor type
stochastic
stochastic
deterministic
deterministic
Actor network
[256, 256]
[64, 64]
[400, 300]
[256, 256]
Critic network
[256, 256]
[64, 64]
[400, 300]
[256, 256]
Actor learning rate
3×10−4
3×10−4
1×10−4
1×10−4
Appendix
Table 1: Training hyperparameters for the algorithms
Reinforcement learning control uses reward-driven learning to make decisions in dynamic systems, from robots and vehicles to energy and infrastructure.
Reinforcement learning (RL) has recently emerged as a promising feedback control strategy for nonlinear and complex dynamical systems. However, RL algorithms are sample inefficient and require a large number of interaction with the environment to synthesize optimal control strategies. Consequently, applications of RL are typically limited to sparse sensors and actuators due to the curse of dimensionality entailed by the exploration-exploitation dilemma in high-dimensional spaces. In this work, we bridge RL and traditional optimal control for dynamical system with a novel Physics-EnhAnced Reinforcement Learning (PEARL) paradigm tailored to the control of high-dimensional and parametric dynamical systems, exploiting the differentibility of their dynamics. Specifically, PEARL employs an actor-adjoint algorithm that leverages automatic differentiation to compute policy gradients over short horizons and adjoint-based sensitivities of future returns approximated via neural networks, significantly reducing the number of environment interactions, while mitigating long-term gradient instabilities. Through two challenging parametric navigation problems in unsteady flows, we show that PEARL (i) effectively exploits differentiable environments to outperform state-of-the-art RL algorithms, (ii) is sample efficient, thanks to the physics-guided policy learning, (iii) generalizes across multiple scenarios, which is crucial when dealing with parametric systems, and (iv) enables scaling RL to high-dimensional state and action spaces, without requiring low-dimensional state representations or multi-agent strategies.
Partial differential equations (PDEs) are foundational to modeling in science and engineering, but constructing reliable numerical solvers remains labor-intensive, demanding expert knowledge of discretization schemes, stability conditions, and boundary treatments. Recent work has begun to frame PDE solving as a code-generation task for large language models (LLMs), yet existing approaches operate primarily at inference time: relying on prompting, debugging, self-refinement, and test-time scaling rather than adapting the model itself. In parallel, reinforcement learning with verifiable rewards has emerged as a post-training paradigm for code and math reasoning, but its verifiers are typically binary: a compiler runs, or a test passes. Such signals discard the graded structure of scientific correctness, where two solvers may both execute and yet differ in solution accuracy by orders of magnitude. In this work, we introduce RLVP: Reinforcement Learning with Verifiable Physics, an RL post-training framework for multi-PDE solver code generation. RLVP addresses this verifiability gap with a hybrid verifier: hard program-validity checks ensure executability, while continuous physics rewards score function-space accuracy and PDE-residual consistency. A single policy is post-trained across diverse PDE families spanning hyperbolic, parabolic, elliptic, and incompressible-flow systems. RLVP improves over both pre-trained and supervised-only baselines on PDE benchmarks, and shows zero-shot improvement transfer to held-out PDEs. We show that a smaller LLM post-trained with RLVP can outperform prompting a frontier model on in-distribution PDE solver generation. The trained policy shows evidence of compositionality in numerical motifs: it recombines stencils, time-stepping schemes, and boundary-handling primitives learned from the PDEs used in training into generated solvers for unseen PDE problems.
The application of deep learning for partial differential equation (PDE)-constrained control is gaining increasing attention. However, existing methods rarely consider safety requirements crucial in real-world applications. To address this limitation, we propose Safe Diffusion Models for PDE Control (SafeDiffCon), which introduce the uncertainty quantile as model uncertainty quantification to achieve optimal control under safety constraints through both post-training and inference phases. Firstly, our approach post-trains a pre-trained diffusion model to generate control sequences that better satisfy safety constraints while achieving improved control objectives via a reweighted diffusion loss, which incorporates the uncertainty quantile estimated using conformal prediction. Secondly, during inference, the diffusion model dynamically adjusts both its generation process and parameters through iterative guidance and fine-tuning, conditioned on control targets while simultaneously integrating the estimated uncertainty quantile. We evaluate SafeDiffCon on three control tasks: 1D Burgers' equation, 2D incompressible fluid, and controlled nuclear fusion problem. Results demonstrate that SafeDiffCon is the only method that satisfies all safety constraints, whereas other classical and deep learning baselines fail. Furthermore, while adhering to safety constraints, SafeDiffCon achieves the best control performance. The code can be found at https://github.com/AI4Science-WestlakeU/safediffcon.
Peiyan Hu, Xiaowei Qian, Wenhao Deng +8
Work done as an intern at Westlake University · Academy of Mathematics and Systems Science, Chinese Academy of Sciences, Beijing, China · School of Engineering, Westlake University, Hangzhou, China +2