arXiv:2610.29331cs.AIOct 2026

Manuscript Offprint

arXiv:2610.29331

From Prompts to Posteriors: Can LLM Agents Perform Bayesian Inference in Context?

Linus Filbry, Luckeciano C. Melo, Yarin Gal

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Large language models (LLMs) are increasingly applied across the scientific discovery pipeline, from synthesizing literature to generating hypotheses to informing experimental design. A unifying principle behind these tasks is the need to continuously update beliefs as evidence accumulates, for which Bayesian inference provides a natural framework. However, existing work assumes that LLMs cannot carry out principled Bayesian belief updating in context, instead relying on simplifications and heuristics. To challenge this assumption, we present a principled evaluation of Bayesian reasoning capabilities in LLMs, analyzing both the model's internal consistency as well as its ability to recover an externally determined posterior. Specifically, we build an evaluation framework spanning qualitative epistemological examples to probe probabilistic coherence, quantitative benchmarks of Bayesian inference capabilities, and analyses of the impact of non-Bayesian updates on downstream task performance. Across different scenarios, we find that LLMs generally violate Bayes' rule when updating their beliefs in context. However, when equipped with modern reasoning abilities and code execution capabilities, their performance drastically improves, enabling even the close approximation of analytically intractable posteriors. Our evaluation shows that current LLMs with access to appropriate tools could already be used to make complex belief updates in scientific discovery, enabling rapid acceleration of the efficiency and scale of AI-powered scientific discovery.

1 INTRODUCTION

LLMs are rapidly moving from passive tools for retrieving and summarizing scientific information toward active components of the scientific workflow. Recent systems use LLMs to generate hypotheses, synthesize literature, write and execute code, design experiments, interpret results, and even assemble full research papers (Lu et al., 2024; Luo et al., 2025; Reddy & Shojaee, 2025; Zhang et al., 2025). This trend has motivated the broader vision of “AI scientists”: autonomous or semi-autonomous agents that participate in the iterative production of scientific knowledge rather than merely assisting with isolated subtasks.

A central requirement for such agents is the ability to rationally revise beliefs in light of evidence, iteratively reallocating probability to hypotheses which best explain current experimental results (Howson & Urbach, 2006; Sprenger & Hartmann, 2019). However, current AI-scientist systems typically take a significant shortcut, which strongly limits their potential performance: They evaluate hypotheses through task-specific heuristics or experimental scores, rather than by maintaining and updating probabilistic beliefs over competing hypotheses (Song et al., 2025; Zhang et al., 2025).

Bayesian inference provides a natural framework to satisfy this requirement. It enables both explicit incorporation of the extensive prior knowledge LLMs possess and information-theoretically optimal belief updates when presented with new evidence (Robert, 1994). Using non-Bayesian belief updating rules risks introducing logical incoherence and biases into the AI scientist's scientific reasoning (Howson & Urbach, 2006). This allows overreacting to noisy experimental anomalies or prematurely discarding valid hypotheses (Jaynes, 2003). An ideal AI scientist must therefore be capable of performing Bayesian inference to correctly update its beliefs when presented with complex ev-

Figure

Figure 1: Overview of our evaluation framework for In-Context Bayesian Inference We present our three axes of evaluation, using example task: "Who will win the World Cup - Brazil, France, Germany, or Italy?". Left: Probabilistic Coherence, evaluated using Dutch-Book scenarios in the same chat and across conversations to find violations of probability axioms. Middle: Posterior Fidelity, as KL divergence between LLM posterior and Bayesian oracle. Right: Downstream Task Performance, assessing how non-Bayesian updates affect success in Experimental Design.

idence. This requirement exposes a critical research question for the development of LLM-driven research agents: To what extent can LLMs perform or approximate Bayesian inference in context?

To answer this question, we evaluate LLMs along three progressive axes: probabilistic coherence of their beliefs, tested via Dutch-Book constructions (Ramsey, 1926) that expose violations of probability axioms; posterior fidelity, measured as divergence of model-generated distributions from a Bayesian oracle; and downstream task performance in adaptive experimental design, to determine whether non-Bayesian drift has practical consequences. We use two complementary environments, 20 Questions for internal consistency and our new ProteinWorld framework for recovery of externally determined posteriors, and vary model release year, reasoning, and code execution to isolate which factors drive Bayesian capabilities.

Our main contributions can be summed up as follows:

• A principled evaluation of the extent to which LLMs can approximate Bayesian inference in context, covering internal consistency and recovery of externally determined posteriors.

• ProteinWorld, a highly configurable environment that mimics scientific discovery and explicitly benchmarks iterative Bayesian inference.

• Evidence that LLMs violate Bayes’ rule without reasoning, but that modern reasoning models compute externally determined posteriors exactly, remain consistent over 10+ data points, and, with tools, correctly approximate intractable posteriors, potentially rendering current belief-updating harnesses unnecessary and enabling more capable AI scientists.

References (29)