An agentic system for Bayesian model discovery.
AgentBayes is an agentic system that performs the full Bayesian modeling workflow on real scientific datasets: exploring the data, proposing probabilistic models, fitting them, critiquing them against what the data actually looks like, and revising.
It pairs two agents. An Interactor explores raw data and fitted posteriors through code execution (writing its own analysis and plotting code) for data exploration, model critique, and open-ended posterior predictive checks. A Modeler converts the Interactor’s findings into structurally diverse probabilistic programs and fits them to the data.
Work that can take days to weeks of expert researcher time runs in hours of agent time. In our case studies, the agent surfaces overlooked structural patterns in the data and adjusts its models accordingly, and the system scales to larger scientific datasets than existing LLM-driven Bayesian methods.
Scientific data often isn’t flat. Measurements can nest within individuals, individuals within groups, and noise enters at every level. Hierarchical Bayesian models explicitly model this structure and jointly handle measurement uncertainty, group structure, and how variation arises at each level. But writing these models can be time-intensive, expert-driven work that is inherently iterative and requires a full understanding of the process, from the scientific phenomena to the exact statistical modeling choices.
Existing LLM-driven systems for scientific modeling mostly look for a single equation that predicts the outcome. “An equation that predicts y” is not the same as “a model of how y was generated.” The latter gives you more: interpretable group-level structure, calibrated uncertainty, and the ability for sparsely observed units to borrow strength from related ones.
The data and posterior samples are never serialized into the LLM’s context window. They stay in the executable sandbox, accessed by the Interactor through code. The Interactor builds up an analytical function library, enabling function reuse and improvement across turns. Only short structured reports of findings pass between the two agents as natural language. This lets AgentBayes scale to large scientific datasets where prior agentic Bayesian systems run out of context.
posteriordb benchmarks, including sizeable improvements on large datasets with complex experimental structure.Code coming soon.
@article{farhang2026agentbayes,
title = {AgentBayes: Open-Ended Scientific Model Discovery},
author = {Farhang, Alexander R. and Erickson, Anne L. and Sehgal, Atharva and Yue, Yisong},
journal = {preprint},
year = {2026},
}