# Introducing Dynestyx, a probabilistic programming library for dynamical systems

> Source: <https://www.basis.ai/blog/dynestyx/>
> Published: 2026-11-10 00:00:00+00:00

# Introducing Dynestyx, a probabilistic programming library for dynamical systems

Published: November 10, 2026

##### Article:
[Matthew Levine](https://www.basis.ai/about/people/matthew-levine/), [Dan Waxman](https://www.basis.ai/about/people/dan-waxman/), [Matthieu Darcy](https://www.basis.ai/about/people/matthieu-darcy/)

At Basis, we’re developing a platform of core modeling and reasoning technologies that researchers can build on and use across science and engineering projects. We focus on shared computational needs: a technology created to address a challenge in one field can spur progress in another. Our goal is for this platform to include models verified by experts in formal methods, giving researchers a stronger foundation for analyses they can trust.

A year ago, we set out to build one such technology, `dynestyx`, to help applied and methodological researchers, scientists, and engineers work with models and data from dynamical systems to answer key questions like:

1. **Forecasting.** What will happen next in this system?
2. **State inference.** Where has the system been?
3. **System identification.** How does the system work, and what are its rules?
4. **Counterfactual inference.** What will happen if I intervene on the system?

Good answers to these questions are paired with quantified uncertainty—that is, a measure in how confident we are in our answer. The best answers also address the meta-question: how reliable is the assessment of uncertainty?

We built `dynestyx` to solve a real gap between practice and theory: that applied researchers often use suboptimal methods to answer these questions, and methodologists commonly develop new methods without real-world challenges in mind. `dynestyx`<sup>[1](#fn:1)</sup> is a probabilistic programming<sup>[2](#fn:2)</sup> library (like [Stan](https://mc-stan.org), [NumPyro](https://num.pyro.ai/en/stable/), and [PyMC](https://www.pymc.io/)) for dynamical systems that provides a single, clean interface for trying and evaluating different methods and models. Let’s step through a few design principles of `dynestyx`.

## Choosing a method shouldn’t mean rebuilding an analysis

Answering questions about forecasting, inference, system identification, or counterfactuals requires choices: how we represent a system, which inference method we should use, and how to assess the resulting uncertainty. Researchers need to be able to revisit those choices as their data, questions, and methods evolve. This is a mathematical problem, but too often, software becomes the bottleneck. Methods developed for closely related problems live in separate packages, each with its own model definitions, assumptions, and data interfaces; trying another method can thus mean rebuilding an entire analysis. Applied researchers face a substantial cost when comparing alternatives, while methodological researchers face the same barrier in benchmarking new algorithms on real problems.

We believe researchers should be able to describe a dynamical system once, apply compatible inference methods, and examine how those choices affect their conclusions. A shared foundation would make methodological advances easier to use—and practical challenges easier to bring back into methodological research. It also makes it easier to use the best method available under a given set of assumptions, and to determine empirically what that best method actually is.

## We should work within an ecosystem

`dynestyx` gains much of its flexibility and power by leveraging already rich JAX scientific computing libraries. This creates a reinforcing ecosystem, allowing more trusted, hardened features, while improving existing libraries as a healthy ecosystem.

As a primary example, `dynestyx` is built to be fully compatible with [NumPyro](https://num.pyro.ai/)<sup>[3](#fn:3)</sup> programs. This allows for a rich probabilistic programming syntax, and reliable, optimized approximate Bayesian inference algorithms. We additionally support advanced Monte Carlo algorithms in [BlackJAX](https://github.com/blackjax-devs/blackjax),<sup>[4](#fn:4)</sup> and a wide array of state-space inference algorithms via [cuthbert](https://github.com/state-space-models/cuthbert),[5](#fn:5)[CD-Dynamax](https://github.com/hd-UQ/cd_dynamax),<sup>[6](#fn:6)</sup> and [Dynamax](https://github.com/probml/dynamax).[7](#fn:7)

[`dynestyx` GitHub](https://github.com/BasisResearch/dynestyx) · [`dynestyx` Docs](https://basisresearch.github.io/dynestyx/stable/) · [`dynestyx` Tutorials](https://basisresearch.github.io/dynestyx/stable/tutorials/gentle_intro/00_index/) · `dynestyx` Preprint

`dynestyx` integrates—and improves on—these existing packages by unifying their disparate pieces into a single interface with sensible defaults. Researchers can change their models, explore the state-of-the-art in methods, and develop new algorithms without rebuilding the surrounding analysis.
Domain scientists can build and share analyses with little implementation work. Method developers can use those same models and workflows to test, compare, and improve algorithms on real problems.

## What makes `dynestyx` so easy to use?

You describe the dynamical system once, then choose how to simulate it, learn from data, and assess the results. Eight features make this practical:

1. **A unified `DynamicalModel` class.** A`DynamicalModel` brings together an`initial_condition` for $x_0 \in \mathbb{R}^{d_x}$, a`state_evolution` describing how the state $x_t \in \mathbb{R}^{d_x}$ changes, and an`observation_model` relating measurements $y_t \in \mathbb{R}^{d_y}$ to that state. Each component can be random or deterministic, and evolution can be defined in continuous or discrete time—with scope to support hybrids in the future.
2. **Hierarchical models without the bookkeeping.**`dsx.plate` lets you define multiple, related dynamical systems with shared parameters and individual variation, much as NumPyro’s plates support hierarchical Bayesian models. You can pool information across experiments, individuals, or trajectories while allowing each system to behave differently.
3. **Compose the task you want to perform.** Handlers specify how to combine a model with data:`dsx.Filter` and`dsx.Smoother` estimate hidden states;`dsx.LatentPathBuilder` exposes state paths for inference;`dsx.Discretizer` controls how continuous dynamics are discretized;`dsx.Simulator` generates trajectories; and`dsx.Evaluation` scores predictions. These components fit together around the same model definition.
4. **NumPyro inference when you want it.**`dynestyx` models work with NumPyro’s existing parameter-inference machinery, including the No-U-Turn Sampler (NUTS) and stochastic variational inference (SVI). You can also use`dynestyx` directly for simulation, state estimation, and optimization without ever writing a NumPyro program.
5. **Swap algorithms with minimal changes.** Filters, solvers, samplers, and their settings are configurable. For compatible models, switching from a differentiable particle filter inside NUTS to an autodifferentiable ensemble Kalman filter (EnKF) with SVI can take just two lines: change the filter configuration and the parameter-inference method.
6. **Sensible defaults, with the choices explained.** Omit the handlers and`dynestyx` identifies the task from your model and inputs, selects compatible inference and numerical methods, and reports its choices. You can inspect the decisions and override them as needed.
7. **Missing data handled where it belongs.** Measurements may arrive at different times, individual sensors may go silent, or entire observations may be missing. Mark unavailable entries with`NaN` ;`dynestyx` uses statistical treatments suited to the observation model, such as marginalizing unobserved components of Gaussian measurements.
8. **Evaluation alongside inference.** A shared evaluation and diagnostics platform helps you assess prediction quality and uncertainty, compare algorithms on the same data, and judge how much to trust a particular model and numerical implementation.

`dynestyx` makes human–AI collaboration easier. Its clear interfaces and composable numerical components help AI write shorter, better code that researchers can read, verify, understand, and refine.

## What’s up next?

**1. Share some exciting discoveries**

Exploring combinations of standard algorithms in `dynestyx` led us to what we believe is a new best-in-class inference method. It substantially outperformed the alternatives we tested on many of our internal benchmarks. [Table 1 of our preprint](https://arxiv.org/abs/2606.16985) maps the compositional space; we’ll present the method and results in an upcoming preprint.

**2. A comprehensive Bayesian workflow**

We are developing a recommended workflow for iteratively refining dynamical models and their inference methods, specializing the Bayesian Workflow<sup>[9](#fn:9)</sup> to the case of dynamics. It will bring together automatic method selection, novel convergence and numerical stability checks, and evaluation of predictions and uncertainty coverage on held-out observations.

We plan to select methods suited to the model and use case: Kalman filtering for linear Gaussian systems, ensemble Kalman filtering for nonlinear systems that pass checks supporting a Gaussian approximation, and no filtering by default when the state is fully observed with high fidelity and frequency. Researchers will be able to inspect and override these choices, using diagnostics to guide further refinement.

**3. Next-gen trustworthiness in scientific software**

We plan to build formal verification into Basis’s core-technology platform, pairing scientific testing with mathematical guarantees about the code researchers and AI agents actually run. Using proof assistants such as Lean, we will connect proofs to numerical implementations and make assumptions about precision and algorithm settings explicit. We also aim to preserve those guarantees when components are combined, so that trust in individual routines extends to the larger scientific programs built from them.

1. Waxman, D., Batenkov, D., Feser, J., Zane, A., Bingham, E., Marzouk, Y., & Levine, M. E. (2026). [Dynestyx: A Probabilistic Programming Library for Dynamical Systems](https://arxiv.org/abs/2606.16985) . arXiv preprint arXiv:2606.16985.[↩︎](#fnref:1)
2. MacIver, D. R. (2025). [What is probabilistic programming?](https://drmaciver.com/notebook/2025/04/what-is-probabilistic-programming) .[↩︎](#fnref:2)
3. Phan, D., Pradhan, N., & Jankowiak, M. (2019). [Composable effects for flexible and accelerated probabilistic programming in NumPyro](https://arxiv.org/abs/1912.11554) . arXiv preprint arXiv:1912.11554.[↩︎](#fnref:3)
4. Cabezas, A., Corenflos, A., Lao, J., Louf, R., … & Zinkov, R. (2024). [BlackJAX: Composable Bayesian inference in JAX](https://arxiv.org/abs/2402.10797) . arXiv preprint arXiv:2402.10797.[↩︎](#fnref:4)
5. Duffield, S., Iqbal, S., & Corenflos, A. (2026). [cuthbert: State-space model inference with JAX](https://github.com/state-space-models/cuthbert) [Computer software].[↩︎](#fnref:5)
6. Levine, M., Waxman, D., & Urteaga, I. (2026). [CD-Dynamax: A JAX-based Python package for continuous-discrete probabilistic state space modeling and inference](https://doi.org/10.21105/joss.10778) .*Journal of Open Source Software* , 11(126), 10778.[↩︎](#fnref:6)
7. Linderman, S. W., Chang, P., Harper-Donnelly, G., Kara, A., Li, X., Duran-Martin, G., & Murphy, K. (2025). [Dynamax: A Python package for probabilistic state space modeling with JAX](https://doi.org/10.21105/joss.07069) .*Journal of Open Source Software* , 10(108), 7069.[↩︎](#fnref:7)
8. Anonymous (1978). [Influenza in a boarding school](https://pmc.ncbi.nlm.nih.gov/articles/PMC1603269/) .*British Medical Journal* , 1(6112), 587. Digitized daily counts:[`influenza_england_1978_school`, outbreaks](https://www.reconverse.org/outbreaks/reference/influenza_england_1978_school.html) .[↩︎](#fnref:8)
9. Gelman, A., Vehtari, A., McElreath, R., Simpson, D., Margossian, C. C., … & Leos Barajas, V. (2026). [*Bayesian Workflow*](https://avehtari.github.io/Bayesian-Workflow/) . Chapman & Hall.[↩︎](#fnref:9)
