BayesForge: A Bayesian Inference library for Python, R, and Julia
Journal:
bioRxiv
Published Date:
Aug 14, 2026
Abstract
Bayesian modeling is a cornerstone of modern ecological and evolutionary research, offering the flexibility to account for hierarchical structures, imperfect detection, and spatial dependencies. However, as ecological datasets grow in scale and complexity---from high-resolution telemetry to phylogenomics---researchers increasingly face a "computational ceiling" where traditional CPU-bound inference becomes prohibitively slow. The current software landscape is fragmented. Researchers must often choose between high-level interfaces (e.g., brms in R) that are intuitive but sometimes rigid or slow for massive datasets, and low-level probabilistic programming languages (e.g., Stan, PyMC, JAX) that offer high performance but require specialized programming expertise. This fragmentation is compounded by an "interoperability tax," where code developed in one language (e.g., R) cannot easily leverage the hardware-accelerated backends (GPUs/TPUs) typically found in Python-centric machine learning frameworks. To address these issues, we introduce BayesForge(BF), a cross-platform software ecosystem available in Python, R, and Julia. BF provides a unified, intuitive syntax that bridges the gap between ease-of-use and high-performance computation. By leveraging JAX-based backends (NumPyro and TensorFlow Probability), BF enables seamless hardware acceleration under-the-hood. We demonstrate BF's utility through three ecological case studies: social network analysis (Social Relations Model), macroevolutionary uncertainty propagation across posterior tree sets, and latent-variable estimation for vocal repertoires. Benchmarks reveal that BF can achieve up to a 270-fold speedup over Stan implementations for large-scale networks, transforming weeks of computation into minutes and enabling more robust, uncertainty-aware ecological inference.