OneFlowSBI: One Model, Many Queries for Simulation-Based Inference

Mayank Nautiyal, Li Ju, Melker Ernfors, Klara Hagland, Ville Holma, Maximilian Werkö Söderholm, Andreas Hellander, Prashant SingharXiv 2026

TL;DR

OneFlowSBI is a unified framework for simulation-based inference (SBI) that models the joint distribution of parameters and observations using a single flow-matching generative model. By leveraging dynamic coordinate masking during training, this single model can flexibly answer diverse inferential queries—such as posterior sampling, likelihood estimation, and arbitrary conditional distributions—at test time without needing task-specific retraining.

What Problem Does This Paper Address?

In fields like systems biology, epidemiology, and physics, scientists use complex simulators to model real-world processes. However, these simulators often lack an analytical or computationally tractable likelihood function, making traditional Bayesian inference impossible. Simulation-Based Inference (SBI) solves this by training neural network surrogates on simulator outputs.

Most existing SBI methods are specialized tools designed to estimate just one thing: usually the posterior distribution $p(\theta|y)$. But real-world workflows are messy. Observations might be partially missing, corrupted by noise, or researchers might suddenly need the likelihood function $p(y|\theta)$ for model criticism. Learning the full joint distribution $p(\theta, y)$ would solve this, but it is notoriously difficult due to modality and dimensionality mismatch (e.g., combining a low-dimensional vector of parameters with a high-dimensional image or time-series observation). Existing joint-modeling approaches rely on heavy Transformer architectures that suffer from quadratic scaling and slow, iterative diffusion sampling.

Methods

OneFlowSBI introduces a unified joint flow-matching framework that models the joint distribution $p(\theta, y)$ using a single, lightweight architecture.

The core innovation relies on two main components:

  1. Mask-Based Conditioning: The framework introduces a binary mask $m$ over the joint state space $z = [\theta; y]$. Observed coordinates are fixed (clamped), while unobserved coordinates are smoothly transported by the flow.
  2. Linear Probability Paths: By utilizing optimal transport geometry, the model enforces straight trajectories between the base noise distribution and the target data distribution. This allows the model to selectively evolve only the masked variables while keeping boundary conditions intact.
Figure 1. OneFlowSBI architecture. The flow network operates on the joint state zt = (θt, yt), where observed and latent components are controlled by a binary mask m. Conditioned on time t, the network learns a masked velocity field, yielding a single model of the joint distribution p(θ, y).

To prevent the high-dimensional observation space from overwhelming the low-dimensional parameter space during training, the authors introduce a gradient-balancing loss weight ($\lambda_\theta = d_y / d_\theta$). The model is trained on a mixture of primary inference masks (posterior and likelihood) and random partial masks, ensuring broad generalization.

Datasets

The authors evaluated OneFlowSBI on a variety of challenging tasks:

  • SBIBM Benchmark: Ten canonical SBI problems (including Two Moons, Gaussian Mixture Model, SLCP, SIR, and Lotka-Volterra) spanning linear/nonlinear dynamics, multi-modal posteriors, and varying simulation budgets (10k, 20k, and 30k samples).
  • Bayesian Image Deblurring: A high-dimensional inverse problem using Fashion-MNIST images ($\theta, y \in \mathbb{R}^{784}$) where blurring and photon-limited noise create highly ambiguous, multi-modal posteriors.
  • Shallow Water Inverse Problem: Inferring a 100-dimensional basin depth profile from complex, spatiotemporal wave fields ($2 \times 101 \times 100$ tensors) governed by the 1-D Saint-Venant equations.

Key Insights and Ideas

  • Straight Flows Equal Extreme Efficiency: Because optimal transport flow matching creates straight trajectories, solving the ordinary differential equation (ODE) at inference time requires only 2 to 3 integration steps. This drastically cuts down the computational cost compared to score-based diffusion methods (like Simformer), which require dozens of stochastic denoising steps.
  • One Model, Infinite Queries: By simply swapping the mask at test time, the exact same trained model can seamlessly switch from drawing posteriors to evaluating likelihoods or predicting missing data fields.
Figure 3. Multi-query inference on Two Moons. Using a single OneFlowSBI model, we target diverse densities p(·|·) solely by varying the inference mask. Panels show the (a) posterior, (b) prior, (c) likelihood, and (d) evidence, alongside (e–g) arbitrary partial conditionals.
  • Robustness to Distractors: Unlike structured models that degrade when their architectural assumptions are violated, OneFlowSBI's global joint modeling remains highly robust when faced with high-dimensional noise or irrelevant "distractor" variables.

Key Results

  • State-of-the-Art Competitiveness: Across the 10 SBIBM benchmarks, OneFlowSBI closely matched or outperformed specialized posterior estimators (NPE) and generalized attention-based solvers (Simformer), particularly on complex, multi-modal distributions.
Figure 2. SBIBM benchmark results. C2ST across ten benchmark tasks and three simulation budgets (10,000; 20,000; 30,000), comparing OneFlowSBI with Simformer (Dense), Simformer (Undirected), and NPE. Lower C2ST indicates higher posterior fidelity.
  • Graceful Degradation: In ablation studies testing robustness against observation noise and missing data, OneFlowSBI maintained stable performance up to moderate corruption levels (e.g., 50% missing data dimensions) before degrading predictably.
  • Real-World Scaling: On the Shallow Water and Image Deblurring tasks, the model successfully recovered fine-grained spatial structures and provided physically plausible uncertainty maps instead of collapsing to over-smoothed point estimates.

Limitations and Future Work

While powerful, OneFlowSBI does exhibit some limitations:

  • Capacity Allocation: Because it learns the full joint distribution without an explicit attention mechanism, a significant portion of the network's capacity can be consumed by modeling irrelevant distractor noise if present in the data.
  • Concentrated Posteriors: For tasks with extremely narrow, near-deterministic posteriors (like Lotka-Volterra), the model can struggle to perfectly capture the sharp, low-variance manifolds.

Future work could explore integrating more sophisticated backbone architectures or adaptive noise-scheduling techniques to further enhance capacity allocation in heavily corrupted data regimes.

Summary updated

BibTeX
@misc{nautiyal2026oneflowsbi,
  author = {Mayank Nautiyal and Li Ju and Melker Ernfors and Klara Hagland and Ville Holma and Maximilian Werkö Söderholm and Andreas Hellander and Prashant Singh},
  title = {{OneFlowSBI: One Model, Many Queries for Simulation-Based Inference}},
  year = {2026},
  eprint = {2601.22951},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.22951},
}
Figure