Hi everyone,
I wanted to share an initiative that’s just getting started and invite interested folks from the Stan community to participate.
We’re working with the ONNX ecosystem on a proposal to support probabilistic modeling and Bayesian inference as first-class workloads in ONNX. The goal is to define a standardized operator set and runtime semantics that allow probabilistic models—particularly Stan models—to be exported, executed, and optimized across frameworks and hardware in a portable, reproducible way.
Stan plays a central role in this effort. In many ways, it is the reference system for mathematically rigorous probabilistic modeling, inference algorithms (HMC/NUTS, SMC, Laplace), and numerical stability. A major goal of this work is to ensure that any ONNX-based probabilistic stack is semantically aligned with Stan, not a lowest-common-denominator abstraction.
What we’re aiming to support
Some of the concrete pieces we’re working on:
- A probabilistic operator domain in ONNX (distributions, log-probabilities, factors)
- A bijector/transform catalog aligned with Stan constraints
- A standardized, stateless and splittable RNG model for reproducible inference
- Special mathematical functions needed for Stan-style log densities
- Inference operators such as Laplace, Pathfinder, INLA, HMC, NUTS, and SMC
- Exporter pathways for probabilistic programming frameworks, with Stan → ONNX as a priority MVP
The longer-term vision is that a Stan model could be compiled to an ONNX representation that preserves its log-joint semantics and can be executed via ONNX Runtime (or other runtimes), enabling deployment across CPUs, GPUs, edge devices, and vendor accelerators—without re-implementing Stan’s math or inference logic per backend.
Why this might be interesting to the Stan community
- It creates a portable IR for Bayesian models, analogous to what ONNX did for neural networks.
- It opens the door to hardware-accelerated inference without rewriting Stan internals for each device.
- It provides a shared target for exporters from PyMC, Pyro, NumPyro, TFP, etc., while keeping Stan’s semantics as a gold standard.
- It offers a way to run or embed Stan-like inference in environments where Python or CmdStan isn’t practical.
How to get involved
We’re in the early stages and forming working groups around:
- Operator and RNG specification
- Special functions and numerical stability
- Inference algorithms (especially HMC/NUTS and SMC)
- Exporter design (Stan first, then others)
If you’re interested in contributing, reviewing specs, sanity-checking mathematical choices, or just sharing feedback on what must be preserved from Stan’s perspective, I’d love to hear from you. Feel free to reply here or reach out directly.
Thanks for reading, and I’m very open to questions, skepticism, or suggestions — especially from those with deep Stan experience.
Best,
Brian