README.md

Bayesian Inference Reimagined for R, Python and Julia

**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.* [![Website](https://img.shields.io/badge/Website-s--sosa.com/BI-blue?style=flat&logo=google-chrome&logoColor=white)](https://s-sosa.com/BI/) [![bioRxiv](https://img.shields.io/badge/bioRxiv-10.64898%2F2026.01.19.700318v1-BD271E?style=flat&logo=biorxiv&logoColor=white)](https://www.biorxiv.org/content/10.64898/2026.01.19.700318v1) ![R](https://img.shields.io/badge/R-4.0+-276DC3?logo=r&logoColor=white) [![License: GPL (>= 3)](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

One Mental Model. Three Languages.

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.

Compare the Syntax

R Syntax Python Syntax Julia Syntax wzxhzdk:0 wzxhzdk:1 wzxhzdk:2

Built for Speed

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).

Installation & Setup

1. Install Package

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")

2. Initialize Environment

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()

3. Select Backend

Choose 'cpu', 'gpu', or 'tpu' when importing the library.

# Initialize on CPU (default) or GPU/TPU
m <- importBF(platform = 'cpu')

Features

Data Manipulation

Modeling (via NumPyro)

Diagnostics (via ArviZ)

Available Distributions

The package provides wrappers for a comprehensive set of distributions from NumPyro.

Continuous

Discrete

Multivariate

Time Series & Stochastic Processes

Mixtures & Truncated

(See package documentation for the full list)

Documentation

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.normal

Platform Support

GPU support available on compatible systems with JAX GPU installation.

Related Packages

**BFR** Based on "The Bayesian Inference library for Python, R, Julia" by [Sosa, McElreath, & Ross (2026)](https://www.biorxiv.org/content/10.64898/2026.01.19.700318v1). [Official website](https://s-sosa.com/BI/) \| [Issues](https://github.com/BGN-for-ASNA/BIR/issues) \| [Quick Start](https://s-sosa.com/BI/start/Installation.html) © 2026 Bayesian Inference Team. Released under GPL-3.0.


Try the BayesForge package in your browser

Any scripts or data that you put into this service are public.

BayesForge documentation built on June 9, 2026, 1:09 a.m.