Conditional Diffusion Models for Amortized Bayesian System Identification

Mike Hänseroth, Niklas Wahlström, Thomas B. Schön, Thomas Seel, Jan-Hendrik EweringarXiv 2026 · arXiv

TL;DR

This paper introduces an amortized Bayesian system identification framework that uses conditional diffusion models to infer hidden states and parameters of dynamical systems. By incorporating a "Markov mask" and relative time encoding into a transformer architecture, the authors create a single model that can rapidly solve multiple inference tasks (like smoothing or missing data reconstruction) on sequences of any length without retraining.

What Problem Does This Paper Address?

Bayesian system identification—the process of estimating hidden states ($x$) and static parameters ($\theta$) from noisy measurements ($y$)—is a cornerstone of control theory and robotics. Traditionally, this is solved using Monte Carlo methods like Particle Marginal Metropolis-Hastings (PMMH).

However, these classical methods have three major drawbacks:

  1. High Computational Cost: They must be rerun from scratch for every new measurement record.
  2. Task Specificity: A setup for state estimation might not work for parameter identification or filling in missing data without significant modification.
  3. Scaling Issues: The cost often grows quadratically with the length of the data record.

The authors aim to "amortize" this cost—paying a high computational price once during an offline training phase so that inference on new data becomes nearly instantaneous.

Methods

The researchers treat system identification as a Bayesian inverse problem, drawing inspiration from how diffusion models handle image inpainting and restoration. Their approach, built on a modified version of the "Simformer" architecture, includes several key innovations:

  • Conditional Diffusion Sampler: The model learns the joint distribution of states, parameters, and measurements. At inference time, it can be "conditioned" on whatever data is available to sample the unknowns.
  • The Markov Mask: Instead of a standard transformer where every data point attends to every other point ($O(T^2)$ complexity), they introduce an attention mask based on the Markov property. Each state token only "looks" at its immediate neighbors and the global parameters. This reduces complexity to $O(T)$ and matches the physical reality of dynamical systems.
  • Rotary Position Embeddings (RoPE): Unlike absolute time encodings, RoPE uses relative time differences. This allows a model trained on short sequences (e.g., 50 time steps) to be deployed on much longer ones (e.g., 250 steps) without getting "confused" by time indices it hasn't seen before.
  • Windowed Training: The model is trained on short, randomly sampled windows of simulated trajectories, making the training process efficient and scalable.

Datasets

The model was evaluated on four benchmark dynamical systems representing a mix of linear, nonlinear, and input-driven behaviors:

  1. Linear Random Walk (lrw): A basic linear system with a closed-form reference.
  2. Double Well (dw): A nonlinear system with two stable equilibrium points.
  3. Controlled Linear-Gaussian (clg): A linear system driven by external, known inputs.
  4. Lotka–Volterra (lv): The classic "predator-prey" model, representing deterministic nonlinear dynamics.

Key Insights and Ideas

  • System ID as Image Inpainting: The most intuitive leap here is viewing a missing measurement in a time series exactly like a missing pixel in an image. A single diffusion model can "fill in the blanks" for states, parameters, or measurements interchangeably.
  • Inductive Bias Matters: The "Markov Mask" isn't just a speed optimization; it acts as a crucial inductive bias. By forcing the transformer to respect the local structure of time, the authors prevented the "error explosion" that typically happens when transformers encounter sequences longer than their training data.
  • Amortization vs. Exactness: While PMMH is asymptotically exact, it is slow. This diffusion approach provides a high-fidelity approximation that is "good enough" for most engineering applications while being orders of magnitude faster.

Key Results

  • Speedup: The proposed model samples 10 to 17 times faster than PMMH.
  • Generalization: When deployed on records 5x longer than those seen during training, the model maintained its state estimation accuracy. In contrast, a standard dense-attention baseline saw its error increase tenfold.
  • Flexibility: The authors demonstrated that the exact same trained weights could perform joint state-parameter inference, state smoothing, and reconstruction of missing data simply by changing the conditioning mask at runtime.

Limitations and Future Work

  • Parameter Posterior Contraction: The authors noted that while state accuracy is excellent on long sequences, the model doesn't "contract" the parameter posterior as much as an exact Bayesian method would. It essentially only uses a "window's worth" of evidence for the parameters rather than aggregating perfectly across the entire long record.
  • High-Dimensional Scaling: While tested on classic benchmarks, the performance on extremely high-dimensional systems (e.g., complex fluid dynamics or large-scale power grids) remains an open question.
  • Evidence Aggregation: Future work will likely focus on better ways to aggregate evidence for static parameters across very long sequences without losing the benefits of windowed training.

Summary updated

Abstract

Generative diffusion models rapidly solve Bayesian inverse problems, such as image restoration and inpainting, with a single trained model and without retraining for each new observation or task. Bayesian system identification, which typically involves inferring the hidden states and parameters of a dynamical system from measurements, poses a closely related inverse problem. Yet it is often addressed with computationally heavy Monte Carlo methods that must be rerun for every new measurement record. Moreover, these methods are restricted to a single inference task, and their cost grows with the state dimension and the record length. To alleviate these restrictions, we interpret Bayesian system identification in hiddem Markov models (HMMs) as a general Bayesian inverse problem, taking advantage of conditional diffusion models. Specifically, a transformer-based diffusion model is trained once on short segments of simulated trajectories to approximate the joint posterior of states and parameters. Through an attention mask induced by the Markov property and a relative time encoding, it can then be deployed on any new measurement record of custom length. At inference time, the same model can flexibly and rapidly be conditioned for joint state and parameter inference, state smoothing, parameter inference, or reconstructing missing measurements, without retraining. We demonstrate these capabilities on four benchmark systems and examine how the length of the training segments affects state and parameter inference. On records five times longer than the training segments, the model maintains its state accuracy, whereas comparison methods either show a more than tenfold error increase or require ten times as much sampling time.
BibTeX
@misc{hanseroth2026conditional,
  author = {Mike Hänseroth and Niklas Wahlström and Thomas B. Schön and Thomas Seel and Jan-Hendrik Ewering},
  title = {{Conditional Diffusion Models for Amortized Bayesian System Identification}},
  year = {2026},
  eprint = {2611.20666},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.20666},
}
Figure