Hi everyone,
I wanted to share an initiative that’s getting underway and invite feedback and participation from the PyMC community.
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 set of ONNX operators and runtime semantics that allow probabilistic models—including PyMC models—to be exported, executed, and optimized across frameworks and hardware in a portable, reproducible way.
PyMC is a key reference framework for this effort. Its modeling abstractions, distribution library, and inference algorithms (especially NUTS and variational methods) are central to how many practitioners do Bayesian modeling in Python today, and ensuring that PyMC semantics are preserved is a top priority.
What we’re aiming to support
Some of the concrete areas we’re working on:
-
A probabilistic operator domain in ONNX:
- Distributions, log-probabilities, and factors
-
A bijector / transform catalog aligned with constrained parameter handling
-
A stateless, splittable RNG model for reproducible inference across threads and devices
-
Special mathematical functions required for stable log-density evaluation
-
Inference operators such as Laplace, Pathfinder, INLA, HMC, NUTS, and SMC
-
Exporter pathways for probabilistic programming frameworks, with PyMC → ONNX as a priority MVP alongside Stan
The longer-term vision is that a PyMC model could be compiled to an ONNX representation that preserves its log-joint semantics and can be executed via ONNX Runtime (or compatible runtimes), enabling deployment across CPUs, GPUs, cloud, edge, and vendor accelerators—without reimplementing PyMC’s math or inference logic per backend.
Why this might be interesting to the PyMC community
-
A portable intermediate representation for PyMC models, similar to what ONNX provides for neural networks.
-
A path toward hardware-accelerated Bayesian inference that doesn’t require PyMC to own backend-specific kernels.
-
Easier integration of PyMC models into production ML systems already standardized on ONNX.
-
A shared probabilistic foundation across PyMC, Pyro, NumPyro, TFP, and other PPLs—while preserving PyMC’s modeling semantics.
-
Opportunities to influence how ONNX handles symbolic graphs, RNG semantics, and inference operators in ways that align with PyTensor and PyMC design.
How to get involved
We’re still early and forming working groups around:
-
Operator and RNG specification
-
Distribution, transform, and special-function alignment
-
Inference algorithms (especially NUTS, SMC, and approximations)
-
Exporter design (PyMC first, then others)
If you’re interested in contributing, reviewing specs, discussing exporter approaches (e.g., PyMC/PyTensor graph mapping), or simply sharing feedback on what must be preserved from PyMC’s perspective, I’d love to hear from you. Feel free to reply here or reach out directly.
Questions, concerns, and skepticism are very welcome—we want this to be useful to the PyMC ecosystem, not something imposed on it.
Best,
Brian