From Uncertain to Safe: Conformal Fine-Tuning of Diffusion Models for Safe PDE Control

Peiyan Hu, Xiaowei Qian, Wenhao Deng, Rui Wang, Haodong Feng, Ruiqi Feng, Tao Zhang, Long Wei, Yue Wang, Zhi-Ming Ma, Tailin Wu

Abstract

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.

Introduction

Controlling physical systems governed by Partial Differential Equations (PDEs)—such as fluid dynamics or plasma behavior in fusion reactors—is a high-stakes challenge. While diffusion models have shown promise in modeling these complex, high-dimensional systems, they often lack the necessary safety guarantees for real-world deployment. Most existing deep learning methods for PDE control operate offline, learning from datasets that may be suboptimal or contain examples of unsafe behavior. Consequently, these models can be overconfident, leading to catastrophic safety violations when deployed in sensitive environments.

To address these issues, we introduce SafeDiffCon, a framework designed to ensure that a controller not only achieves performance targets but also strictly adheres to predefined safety boundaries, even when trained on "dirty" or suboptimal data.

The SafeDiffCon Framework

SafeDiffCon integrates conformal prediction with diffusion-based generative modeling to provide rigorous safety guarantees. The framework operates in three distinct stages:

  1. Pre-training: A standard diffusion model is trained on available historical data to learn the underlying dynamics of the PDE system.
  2. Post-training with Reweighted Loss: To steer the model toward safer and more optimal regions, we employ a reweighted diffusion loss. This loss incorporates an "uncertainty quantile" ($Q$) estimated via Conformal Prediction. By reweighting samples based on their control performance and safety margins, the model's global distribution is shifted toward high-utility, low-risk trajectories.
  3. Inference-time Fine-tuning: During deployment, the model undergoes iterative adaptation. It adjusts its parameters and generation process using gradient-based guidance and a task-specific fine-tuning loss. This allows the model to meet specific control targets while continuously accounting for the estimated safety uncertainty.
Overview of the SafeDiffCon pipeline, illustrating the three-stage process: pre-training, post-training with reweighted loss, and inference-time fine-tuning with conformal uncertainty quantification.

The core innovation lies in treating safety as a statistical buffer rather than a fixed point. By using conformal prediction, SafeDiffCon provides a guarantee that the true safety score will fall within a calculated interval, allowing the controller to remain cautious in regions of high model uncertainty.

Experimental Evaluation

We evaluated SafeDiffCon across three increasingly complex PDE control scenarios: the 1D Burgers’ equation, 2D incompressible fluid flow, and a Tokamak fusion reactor simulation.

In the 1D Burgers' task, the objective is to reach a target state while maintaining system energy below a critical threshold. As shown in Figure 2, baseline methods often violate these safety bounds during the control process. SafeDiffCon, however, successfully navigates the state space without any violations.

Comparison of control trajectories for the 1D Burgers' equation. The top row shows a baseline violating safety bounds (red shaded area at t=5), while the bottom row shows SafeDiffCon maintaining safety throughout the trajectory.

In the more complex 2D fluid task, the model maneuvers smoke toward a target while avoiding a hazardous "red zone." In the Tokamak fusion task, it manages plasma parameters while ensuring the safety factor ($q_{95}$) remains above the disruption threshold.

Key Results

  • Zero Violations: Across all tasks, SafeDiffCon was the only method to achieve a 0% unsafe trajectory rate. Baselines, including those specifically designed for safety, failed in 4% to 14% of cases.
  • Optimal Performance: SafeDiffCon achieved the lowest control error in the Burgers' task ($J=0.0011$) and successfully avoided obstacles in the fluid task with zero Safety Violation Magnitude (SVM).
  • Robustness: The framework proved robust to variations in calibration data split ratios and coverage probabilities, indicating its readiness for practical engineering applications.

Conclusion

SafeDiffCon demonstrates that integrating conformal prediction into the diffusion modeling pipeline can bridge the gap between high-performance deep learning and strict safety requirements in physical systems. Future work will explore extending this framework to other generative architectures and testing its robustness on physical hardware, where distribution shifts may be even more pronounced.

Summary updated

Abstract

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.
BibTeX
@inproceedings{hu2025from,
  author = {Peiyan Hu and Xiaowei Qian and Wenhao Deng and Rui Wang and Haodong Feng and Ruiqi Feng and Tao Zhang and Long Wei and Yue Wang and Zhi-Ming Ma and Tailin Wu},
  title = {{From Uncertain to Safe: Conformal Fine-Tuning of Diffusion Models for Safe PDE Control}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=XGJ33p4qwt},
}
Figure