A unified probabilistic programming library bridging the gap
between user-friendly R syntax and high-performance JAX
computation.
Run bespoke models on CPU, GPU, or TPU with ease.
BFR (BI) provides a unified experience across R, Python, and Julia. Whether you work in R’s formula syntax, Python’s object-oriented approach, or Julia’s mathematical elegance, the model logic remains consistent.
| R Syntax | Python Syntax | Julia Syntax |
|---|---|---|
|
|
|
Leveraging Just-In-Time (JIT) compilation, BI outperforms traditional engines on standard hardware and unlocks massive scalability on GPU clusters for large datasets.
Benchmark: Network Size 100 (Lower is Better)
| Engine | Execution Time | Relative Performance |
|---|---|---|
| STAN (CPU) | ████████████████████████████ |
Baseline |
| BI (CPU) | ████████████ |
~30x Faster |
| BI (GPU) | ██ |
~200x Faster |
> Comparison of execution time for a Social Relations Model. Source: Sosa et al. (2026).
Use devtools to pull the latest development version from
GitHub.
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")
devtools::install_github("https://github.com/BGN-for-ASNA/BIR")Run the starting test to create the Python virtual environment
managed by reticulate.
library(BayesForge)
# Run the starting test to install Python dependencies
BF_starting_test()Choose 'cpu', 'gpu', or 'tpu'
when importing the library.
# Initialize on CPU (default) or GPU/TPU
m <- importBF(platform = 'cpu')The package provides wrappers for a comprehensive set of distributions from NumPyro.
bf.dist.normal, bf.dist.uniform,
bf.dist.student_tbf.dist.cauchy, bf.dist.halfcauchy,
bf.dist.halfnormalbf.dist.gamma, bf.dist.inverse_gamma,
bf.dist.exponentialbf.dist.beta, bf.dist.beta_proportionbf.dist.laplace,
bf.dist.asymmetric_laplacebf.dist.log_normal,
bf.dist.log_uniformbf.dist.pareto, bf.dist.weibull,
bf.dist.gumbelbf.dist.chi2, bf.dist.gompertzbf.dist.bernoulli, bf.dist.bfnomialbf.dist.poisson,
bf.dist.negative_binomialbf.dist.geometric,
bf.dist.discrete_uniformbf.dist.beta_binomial,
bf.dist.zero_inflated_poissonbf.dist.multivariate_normal,
bf.dist.multivariate_student_tbf.dist.dirichlet,
bf.dist.dirichlet_multinomialbf.dist.multinomialbf.dist.lkj, bf.dist.lkj_choleskybf.dist.wishart,
bf.dist.wishart_choleskybf.dist.gaussian_random_walkbf.dist.gaussian_state_spacebf.dist.euler_maruyamabf.dist.car (Conditional AutoRegressive)bf.dist.mixture,
bf.dist.mixture_same_familybf.dist.truncated_normal,
bf.dist.truncated_cauchybf.dist.lower_truncated_power_law(See package documentation for the full list)
For full documentation of functions and parameters, you can use the built-in R help or the package helper:
# Open package documentation
bf.doc()
# Help for a specific function
?bf.dist.normalGPU support available on compatible systems with JAX GPU installation.
BFR
Based on “The Bayesian Inference library for Python, R, Julia” by Sosa,
McElreath, & Ross (2026).
Official website | Issues | Quick Start
© 2026 Bayesian Inference Team. Released under GPL-3.0.