This is the official implementation of Blade, a derivative-free Bayesian inversion method that leverages diffusion model priors for solving inverse problems.
Derivative-free Bayesian inversion is an important task in many science and engineering applications, particularly when computing the forward model derivative is computationally and practically challenging. Blade produces accurate and well-calibrated posteriors for Bayesian inversion using an ensemble of interacting particles. It leverages powerful data-driven priors based on diffusion models and can handle nonlinear forward models that permit only black-box access (i.e., derivative-free).
We recommend Linux with Python 3.10+ for the best compatibility. Use uv sync to install the dependencies.
This codebase uses pretrained diffusion models from InverseBench. Please download the checkpoints from InverseBench and place them in the checkpoints/ directory.
python main.py algorithm=blade \
algorithm.method.num_steps=25 \
algorithm.method.likelihood_steps=50 \
algorithm.method.guidance_scale=30.0 \
problem.model.sigma_noise=1.0scripts/ns.sh contains the commands to run Blade on Navier-Stokes.
For Navier-Stokes experiments, we extend the original InverseBench evaluation with probabilistic metrics to assess the generated posterior distribution:
| Metric | Type | Description |
|---|---|---|
| CRPS | Probabilistic | Continuous Ranked Probability Score - measures calibration and sharpness |
| SSR | Probabilistic | Spread-Skill Ratio - ideal value is 1.0 (SSR < 1: overconfident, SSR > 1: underconfident) |
# Linear Gaussian with Blade
python gaussian.py algorithm=blade_gaussian
# Gaussian Mixture with Blade
python gmm-exp.py algorithm=blade_gmmThe project uses Hydra for configuration management. Configuration files are located in configs/:
configs/config.yaml- Main configuration with defaultsconfigs/algorithm/- Algorithm-specific configs (blade.yaml, enkg.yaml, etc.)configs/pretrain/- Pretrained model configsconfigs/problem/- Problem-specific configs
Override any configuration from the command line:
python main.py algorithm=blade algorithm.method.num_steps=50 problem.model.sigma_noise=0.5If you find this code useful, please cite our paper:
@article{zheng2025blade,
title={Blade: A Derivative-free Bayesian Inversion Method using Diffusion Priors},
author={Zheng, Hongkai and Wang, Austin and Wu, Zihui and Huang, Zhengyu and Baptista, Ricardo and Yue, Yisong},
journal={arXiv preprint arXiv:2510.10968},
year={2025}
}This codebase is built upon InverseBench. We thank the authors for their excellent work and for making their code publicly available.
This project is licensed under the MIT License - see the LICENSE file for details.
