acerbilab / model fitting
New PyIBS 1.5: faster, validated against exact likelihoods, and a film

Open-source tools for fitting models to data

Make every likelihood evaluation count.

Find the best-fitting parameters, the full posterior and the model evidence from a small budget of model evaluations, whether each one takes a fraction of a second or several minutes, and even when the likelihood is noisy or only available by simulation. In Python and MATLAB.

PyVBMC learning a banana-shaped posterior, drawn from a real run. Explore it

The tools

Ready to use

Fit your model

PyBADS BADS in MATLAB

Bayesian Adaptive Direct Search: fast, robust optimization for maximum-likelihood and MAP fits when the objective is rough, noisy or slow to evaluate, with up to about 20 parameters. It needs no tuning and is called like scipy.optimize.minimize. On real model-fitting problems from neuroscience and cognitive science, it did as well as or better than many common and state-of-the-art optimizers.

New in 1.5 Faster, with periodic and fixed variables, and a skill for guiding your coding agents. What's new

pip install --upgrade pybads

Acerbi & Ma, NeurIPS 2017 · Singh & Acerbi, JOSS 2024

How PyBADS works, in a 3-minute film. YouTube Download (MP4)

Get the posterior and the evidence

PyVBMC VBMC in MATLAB

Variational Bayesian Monte Carlo: an approximate posterior over your parameters and an estimate of the model evidence, for model comparison, from a small budget of likelihood evaluations, even noisy ones. Best with up to about 10 parameters. It is set up like PyBADS (plus a prior), and a PyBADS fit makes a good starting point.

New in 1.5 Faster, with PyMC models, stacking of several runs (S-VBMC), exports to Torch and ArviZ, and a skill for guiding your coding agents. What's new

pip install --upgrade pyvbmc

Acerbi, NeurIPS 2018 and NeurIPS 2020 · Huggins, Li, Tobaben, Aarnos & Acerbi, JOSS 2023

How PyVBMC works, in a 3-minute film. YouTube Download (MP4)

When you can only simulate

PyIBS IBS in MATLAB

Inverse binomial sampling: unbiased, efficient estimates of the log-likelihood of models you can simulate but not write down, for data with discrete responses. It uses the whole data set, not summary statistics, and estimates its own variance. Pass both to PyBADS or PyVBMC, which are built to handle noisy estimates.

New in 1.5 Faster, validated against exact likelihoods, ready for PyBADS and PyVBMC, and a skill for guiding your coding agents. What's new

pip install --upgrade pyibs

van Opheusden, Acerbi & Ma, PLOS Computational Biology 2020

How PyIBS works, in a 4-minute film. YouTube Download (MP4)

Next wave

Inference in a single forward pass

In active development

ACE and nanoACE

The Amortized Conditioning Engine: one transformer, trained on simulated data, that answers inference and prediction questions in a single forward pass and can take prior information at run time. It is research code in active development, and the start of our next generation of methods. nanoACE is a small, readable implementation with an in-browser playground.

Chang, Loka, Huang, Remes, Kaski & Acerbi, AISTATS 2025

In use

Fitting models across the sciences

Our tools started in cognitive science and neuroscience, where many of their users still are. They now fit models across the sciences and engineering. A few examples:

Story · Perception

One cause or two?

How does the brain decide whether a sight and a sound come from the same thing? A short film about causal inference in perception, and about a study whose models were fitted with BADS.

Community

Ask us, follow along

Questions about the tools, or how to use them for your model? Ask in our Discussions forum. New methods are on the way: follow Luigi to hear about releases and papers.

News

  • PyIBS 1.5: faster and validated against exact likelihoods, and a 4-minute film on how PyIBS works.

  • PyVBMC 1.5: faster, with PyMC models and stacking of runs (S-VBMC), and a 3-minute film on how PyVBMC works.

  • PyBADS 1.5: faster, with periodic and fixed variables, and a 3-minute film on how PyBADS works.

  • One cause or two? A short film about causal inference in perception, and about a study whose models were fitted with BADS (PLOS Computational Biology, May 2026).

  • nanoACE: a small, readable implementation of the Amortized Conditioning Engine, with an in-browser playground.