RxInfer
RxInfer: A Julia package for reactive real-time Bayesian inference - Published in JOSS (2023)
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 12 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
4 of 29 committers (13.8%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Scientific Fields
Repository
Julia package for automated Bayesian inference on a factor graph with reactive message passing
Basic Info
- Host: GitHub
- Owner: ReactiveBayes
- License: mit
- Language: Jupyter Notebook
- Default Branch: main
- Homepage: https://rxinfer.com/
- Size: 444 MB
Statistics
- Stars: 356
- Watchers: 17
- Forks: 31
- Open Issues: 27
- Releases: 73
Topics
Metadata Files
README.md
Overview
RxInfer.jl is a Julia package for automatic Bayesian inference on a factor graph with reactive message passing.
Given a probabilistic model, RxInfer allows for an efficient message-passing based Bayesian inference. It uses the model structure to generate an algorithm that consists of a sequence of local computations on a factor graph representation of the model.
[!NOTE] RxInfer can also be used from Python through our client-server infrastructure and Python SDK.
Performance and scalability
RxInfer.jl has been designed with a focus on efficiency, scalability and maximum performance for running Bayesian inference with message passing. Below is a comparison between RxInfer.jl and Turing.jl on latent state estimation in a linear multi-variate Gaussian state-space model. Turing.jl is a state-of-the-art Julia-based general-purpose probabilistic programming package and is capable of running inference in a broader class of models. Still, RxInfer.jl executes the inference task in various models faster and more accurately. RxInfer.jl accomplishes this by taking advantage of any conjugate likelihood-prior pairings in the model, which have analytical posteriors that are known by RxInfer.jl. As a result, in models with conjugate pairings, RxInfer.jl often beats general-purpose probabilistic programming packages in terms of computational load, speed, memory and accuracy. Note, however, that RxInfer.jl also supports non-conjugate inference and is continually improving in order to support a larger class of models.
Turing comparison | Scalability performance
:-------------------------:|:-------------------------:
|
[!NOTE] See many more examples in the RxInferExamples.jl repository.
Faster inference with better results
RxInfer.jl not only beats generic-purpose Bayesian inference methods in conjugate models, executes faster, and scales better, but also provides more accurate results. Check out more examples here!
Inference with RxInfer | Inference with HMC
:-------------------------:|:-------------------------:
|
The benchmark and accuracy experiment, which generated these plots, is available in the benchmarks/ folder. Note, that the execution speed and accuracy
of the HMC estimator heavily depends on the choice of hyperparameters.
In this example, RxInfer executes exact inference consistently and does not depend on any hyperparameters.
References
- RxInfer: A Julia package for reactive real-time Bayesian inference - a reference paper for the
RxInfer.jlframwork. - Reactive Probabilistic Programming for Scalable Bayesian Inference - a PhD dissertation outlining core ideas and principles behind
RxInfer(link2, link3). - Variational Message Passing and Local Constraint Manipulation in Factor Graphs - describes theoretical aspects of the underlying Bayesian inference method.
- Reactive Message Passing for Scalable Bayesian Inference - describes implementation aspects of the Bayesian inference engine and performs benchmarks and accuracy comparison on various models.
- A Julia package for reactive variational Bayesian inference - a reference paper for the
ReactiveMP.jlpackage, the underlying inference engine.
Installation
Install RxInfer through the Julia package manager:
] add RxInfer
Optionally, use ] test RxInfer to validate the installation by running the test suite.
Documentation
For more information about RxInfer.jl please refer to the documentation.
Getting Started
[!NOTE] There are examples available to get you started in the RxInferExamples.jl repository.
Coin flip simulation
Here we show a simple example of how to use RxInfer.jl for Bayesian inference problems. In this example we want to estimate a bias of a coin in a form of a probability distribution in a coin flip simulation.
First let's setup our environment by importing all needed packages:
julia
using RxInfer, Random
We start by creating some dataset. For simplicity in this example we will use static pre-generated dataset. Each sample can be thought of as the outcome of single flip which is either heads or tails (1 or 0). We will assume that our virtual coin is biased, and lands heads up on 75% of the trials (on average).
```julia n = 500 # Number of coin flips p = 0.75 # Bias of a coin
distribution = Bernoulli(p) dataset = rand(distribution, n) ```
Model specification
In a Bayesian setting, the next step is to specify our probabilistic model. This amounts to specifying the joint probability of the random variables of the system.
Likelihood
We will assume that the outcome of each coin flip is governed by the Bernoulli distribution, i.e.
math
y_i \sim \mathrm{Bernoulli}(\theta)
where $yi = 1$ represents "heads", $yi = 0$ represents "tails". The underlying probability of the coin landing heads up for a single coin flip is $\theta \in [0,1]$.
Prior
We will choose the conjugate prior of the Bernoulli likelihood function defined above, namely the beta distribution, i.e.
math
\theta \sim Beta(a, b)
where $a$ and $b$ are the hyperparameters that encode our prior beliefs about the possible values of $\theta$. We will assign values to the hyperparameters in a later step.
Joint probability
The joint probability is given by the multiplication of the likelihood and the prior, i.e.
math
P(y_{1:N}, \theta) = P(\theta) \prod_{i=1}^N P(y_i | \theta).
Now let's see how to specify this model using GraphPPL's package syntax: ```julia
GraphPPL.jl export @model macro for model specification
It accepts a regular Julia function and builds a factor graph under the hood
@model function coin_model(y, a, b)
# We endow θ parameter of our model with some prior
θ ~ Beta(a, b)
# We assume that outcome of each coin flip
# is governed by the Bernoulli distribution
for i in eachindex(y)
y[i] ~ Bernoulli(θ)
end
end
```
In short, the @model macro converts a textual description of a probabilistic model into a corresponding Factor Graph (FG). In the example above, the $\theta \sim \mathrm{Beta}(a, b)$ expression creates latent variable $θ$ and assigns it as an output of $\mathrm{Beta}$ node in the corresponding factor graph. The ~ operation can be understood as "is modelled by". Next, we model each data point y[i] as $\mathrm{Bernoulli}$ distribution with $\theta$ as its parameter.
[!TIP] Alternatively, we could use the broadcasting operation:
julia @model function coin_model(y, a, b) θ ~ Beta(a, b) y .~ Bernoulli(θ) end
As you can see, RxInfer in combination with GraphPPL offers a model specification syntax that resembles closely to the mathematical equations defined above.
Inference specification
Once we have defined our model, the next step is to use RxInfer API to infer quantities of interests. To do this we can use a generic infer function from RxInfer.jl that supports static datasets.
julia
result = infer(
model = coin_model(a = 2.0, b = 7.0),
data = (y = dataset, )
)
Roadmap
Current Focus Q1-Q2 2025
- Refactoring of ReactiveMP.jl into Cortex.jl with improved architecture and performance
- Performance improvements in GraphPPL.jl with new graph backend based on BipartiteFactorGraphs.jl
Future Focus Q3-Q4 2025
- Performance improvements in message passing rule execution (part of Cortex.jl)
- Native support for Gaussian Processes modelling and inference
- RxInfer.jl on edge devices (e.g. Raspberry Pi/Audio/Video processing)
History
- Q1 2025: Client-server architecture (RxInferServer.jl) and SDKs (RxInferClient.py, RxInferClient.ts)
- Q3/Q4 2024: Graph structure visualization in GraphPPL.jl and Semi-automated inference with ExponentialFamilyProjection.jl
- Q1/Q2 2024: Nested models with GraphPPL.jl and Development of ExponentialFamilyProjection.jl
For a more granular view of our progress and ongoing tasks, check out our project board or join our 4-weekly public meetings.
Ecosystem
The RxInfer framework consists of four core packages developed by ReactiveBayes:
ReactiveMP.jl- the underlying message passing-based inference engineGraphPPL.jl- model and constraints specification packageExponentialFamily.jl- package for exponential family distributionsRocket.jl- reactive extensions package for Julia
NumFocus
We are very proud to be an affiliated project with NumFocus, a non-profit organization that supports the open-source scientific computing community.

Client-Server Infrastructure
[!NOTE] The development of RxInferServer has been sponsored by Lazy Dynamics. The repositories are hosted under the Lazy Dynamics organization.
RxInfer can be deployed as a RESTful API service using RxInferServer, which provides:
- OpenAPI-compliant RESTful API endpoints for RxInfer models
- Support for model instance management and inference execution
- Real-time inference capabilities
- Comprehensive API documentation at server.rxinfer.com
Client SDKs
To interact with RxInferServer, you can use one of the following SDKs:
- Python SDK:
RxInferClient.py- A Python client for interacting with RxInferServer - TypeScript SDK:
RxInferClient.ts- A TypeScript client for interacting with RxInferServer - Julia SDK: Included in the RxInferServer repository
SDKs provide a convenient interface to: - Create and manage model instances - Execute inference tasks - Monitor inference progress - Handle authentication and API keys - Process results in a native format
Where to go next?
There are a set of examples available in the RxInferExamples.jl repository that demonstrate the more advanced features of the package. Alternatively, you can head to the documentation that provides more detailed information of how to use RxInfer to specify more complex probabilistic models.
Join Our Community and Contribute to RxInfer
RxInfer is a community-driven project and we welcome all contributions! To get started: - Check out our contributing guide - Review the contributing guidelines - Browse beginner-friendly issues to find something that interests you
Active Inference Institute Collaboration
The Active Inference Institute community members are enhancing RxInfer/GraphPPL's visualization capabilities. Their work includes: - Developing advanced model visualization features ✅ (PR) - Creating summary and subgraph visualization modalities - Implementing various graph layout algorithms - Improving model inspection and understanding tools
For more details on ongoing work, see the RxInfer development project board.
Learning Resources
The community maintains educational content and tutorials on Learnable Loop, covering topics such as: - Visualizing Forney Factor Graphs - Sales forecasting with time-varying autoregressive models - Hidden Markov models with control - Applications of Active Inference across different domains
JuliaCon 2023 presentation
Additionally, checkout our video from JuliaCon 2023 for a high-level overview of the package
Our presentation at the Julia User Group Munich meetup
Also check out the recorded presentation at the Julia User Group Munich meetup for a more detailed overview of the package
Telemetry
RxInfer collects completely anonymous telemetry data regarding package usage. This information helps us understand how RxInfer is used and shapes our roadmap to prioritize features and improvements. The telemetry:
- Does not collect any code, data, or environment information, only the fact of using RxInfer once per Julia session
- Entirely anonymous
- (Opt-out) Can be disabled for a single Julia session or permanently
You can learn more about it and how to opt-out by visiting our documentation.
Session Sharing
RxInfer includes an optional session sharing feature that can help us provide better support and improve the package. When you encounter an issue, you can share your session data with us, which includes: - Model source code and metadata - Input data characteristics (no actual data) - Execution timing and success rates - Error information (if any) - Environment information (Julia version, OS, etc.)
This information is invaluable for debugging issues and improving RxInfer. Session sharing is: - Completely optional and disabled by default - Entirely anonymous - Only shared when you explicitly choose to do so - (Opt-in) Can be enabled to send reports automatically when an error occurs. When enabled, still entirely anonymous.
If you're opening a GitHub issue, we encourage you to share your session ID with us - it helps us understand your use case better and provide more accurate support. Learn more about session sharing and how to opt-in in our documentation.
License
MIT License Copyright (c) 2021-2024 BIASlab, 2024-present ReactiveBayes
Owner
- Name: ReactiveBayes
- Login: ReactiveBayes
- Kind: organization
- Location: Netherlands
- Website: https://rxinfer.ml/
- Repositories: 1
- Profile: https://github.com/ReactiveBayes
Open source software for reactive, efficient and scalable Bayesian inference
Citation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Bagaev
given-names: Dmitry
orcid: "https://orcid.org/0000-0001-9655-7986"
- family-names: Podusenko
given-names: Albert
orcid: "https://orcid.org/0000-0003-0515-0465"
- family-names: Vries
given-names: Bert
name-particle: de
orcid: "https://orcid.org/0000-0003-0839-174X"
contact:
- family-names: Bagaev
given-names: Dmitry
orcid: "https://orcid.org/0000-0001-9655-7986"
doi: 10.5281/zenodo.7774921
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Bagaev
given-names: Dmitry
orcid: "https://orcid.org/0000-0001-9655-7986"
- family-names: Podusenko
given-names: Albert
orcid: "https://orcid.org/0000-0003-0515-0465"
- family-names: Vries
given-names: Bert
name-particle: de
orcid: "https://orcid.org/0000-0003-0839-174X"
date-published: 2023-04-20
doi: 10.21105/joss.05161
issn: 2475-9066
issue: 84
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 5161
title: "RxInfer: A Julia package for reactive real-time Bayesian
inference"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.05161"
volume: 8
title: "RxInfer: A Julia package for reactive real-time Bayesian
inference"
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"license": "https://spdx.org/licenses/MIT",
"codeRepository": "https://github.com/reactivebayes/RxInfer.jl",
"contIntegration": "https://github.com/reactivebayes/RxInfer.jl/actions",
"dateCreated": "2022-06-13",
"datePublished": "2022-11-03",
"downloadUrl": "https://github.com/reactivebayes/RxInfer.jl/releases",
"issueTracker": "https://github.com/reactivebayes/RxInfer.jl/issues",
"name": "RxInfer.jl",
"version": "4.6.2",
"description": "Julia package for automated, scalable and efficient Bayesian inference on factor graphs with reactive message passing. ",
"applicationCategory": "Statistics",
"developmentStatus": "active",
"readme": "https://rxinfer.com",
"softwareVersion": "4.6.2",
"keywords": [
"Bayesian inference",
"message passing",
"factor graphs",
"probabilistic programming",
"reactive programming",
"continual inference",
"scalable inference",
"variational optimization",
"free energy",
"Bethe constraints"
],
"programmingLanguage": [
"Julia"
],
"operatingSystem": [
"Linux",
"Windows",
"MacOS"
],
"relatedLink": [
"https://rxinfer.com",
"https://docs.rxinfer.com",
"https://examples.rxinfer.com",
"https://github.com/ReactiveBayes/RxInfer.jl",
"https://app.codecov.io/gh/reactivebayes/RxInfer.jl"
],
"author": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0001-9655-7986",
"givenName": "Dmitry",
"familyName": "Bagaev",
"email": "d.v.bagaev@tue.nl",
"affiliation": {
"@type": "Organization",
"name": "Eindhoven University of Technology"
}
}
],
"maintainer": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0001-9655-7986",
"givenName": "Dmitry",
"familyName": "Bagaev",
"email": "d.v.bagaev@tue.nl",
"affiliation": {
"@type": "Organization",
"name": "Eindhoven University of Technology"
}
}
]
}
GitHub Events
Total
- Create event: 74
- Commit comment event: 38
- Release event: 18
- Issues event: 46
- Watch event: 70
- Delete event: 41
- Issue comment event: 162
- Push event: 317
- Pull request review comment event: 19
- Pull request review event: 38
- Pull request event: 98
- Fork event: 8
Last Year
- Create event: 74
- Commit comment event: 38
- Release event: 18
- Issues event: 46
- Watch event: 70
- Delete event: 41
- Issue comment event: 162
- Push event: 317
- Pull request review comment event: 19
- Pull request review event: 38
- Pull request event: 98
- Fork event: 8
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Bagaev Dmitry | b****i@g****m | 917 |
| Albert Podusenko | a****o@g****m | 95 |
| Wouter Nuijten | w****n@g****m | 74 |
| Bart van Erp | b****p@t****l | 54 |
| HoangMHNguyen | m****g@t****l | 31 |
| Mykola Lukashchuk | n****k@g****m | 14 |
| İsmail Şenöz | i****z@I****l | 12 |
| Chengfeng-Jia | c****a@t****l | 11 |
| MarcoH | m****r@g****m | 11 |
| wmkouw | w****w@g****m | 10 |
| Pietro Monticone | p****s@g****m | 8 |
| Raphael-Tresor | r****r@g****m | 7 |
| Thijs van de Laar | t****r@h****m | 6 |
| Adamiat Sepideh | a****h@g****m | 5 |
| Raaja Ganapathy Subramanian | r****n@a****m | 4 |
| İsmail Şenöz | i****z@w****l | 3 |
| vflores-io | i****t@g****m | 2 |
| magnuskoudahl | m****l@g****m | 2 |
| carbonbasedsoul | c****l@i****m | 1 |
| CompatHelper Julia | c****y@j****g | 1 |
| wmkouw | w****w@s****u | 1 |
| Pietro Monticone | 3****e | 1 |
| Malandii | t****i@g****m | 1 |
| MVerschure | 5****e | 1 |
| KronosTheLate | 6****e | 1 |
| Kobus Esterhuysen | k****8@g****m | 1 |
| John Bolt | j****t@g****m | 1 |
| Dhuige | 3****e | 1 |
| Al Asaad | a****d@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 93
- Total pull requests: 140
- Average time to close issues: 5 months
- Average time to close pull requests: 11 days
- Total issue authors: 27
- Total pull request authors: 21
- Average comments per issue: 3.6
- Average comments per pull request: 1.49
- Merged pull requests: 99
- Bot issues: 0
- Bot pull requests: 28
Past Year
- Issues: 28
- Pull requests: 90
- Average time to close issues: 30 days
- Average time to close pull requests: 4 days
- Issue authors: 14
- Pull request authors: 13
- Average comments per issue: 1.25
- Average comments per pull request: 1.2
- Merged pull requests: 59
- Bot issues: 0
- Bot pull requests: 19
Top Authors
Issue Authors
- bvdmitri (33)
- bartvanerp (19)
- albertpod (11)
- wouterwln (9)
- abpolym (6)
- svilupp (3)
- alstat (3)
- John-Boik (3)
- SupplyChef (3)
- caxelrud (2)
- acertain (2)
- ThijsvdLaar (2)
- wmkouw (2)
- ChrisRackauckas (2)
- Flawless1202 (2)
Pull Request Authors
- bvdmitri (91)
- github-actions[bot] (30)
- wouterwln (24)
- albertpod (15)
- Nimrais (12)
- bartvanerp (8)
- HoangMHNguyen (4)
- wmkouw (4)
- Raphael-Tresor (4)
- ismailsenoz (4)
- raganapa (3)
- Chengfeng-Jia (3)
- MVerschure (2)
- LearnableLoopAI (2)
- blolt (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- julia 73 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 75
juliahub.com: RxInfer
Julia package for automated Bayesian inference on a factor graph with reactive message passing
- Homepage: https://rxinfer.com/
- Documentation: https://docs.juliahub.com/General/RxInfer/stable/
- License: MIT
-
Latest release: 4.5.2
published 5 months ago
Rankings
Dependencies
- actions/cache v3 composite
- actions/checkout v2 composite
- codecov/codecov-action v2 composite
- julia-actions/cache v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite

