Bayesian teaching enables probabilistic reasoning in large language models

Linlu Qiu, Fei Sha, Kelsey R. Allen, Yoon Kim, Tal Linzen, Sjoerd van Steenkiste

Abstract

Large language models (LLMs) are increasingly used as agents that interact with users and with the world. To do so successfully, LLMs must construct representations of the world and form probabilistic beliefs about them. To provide personalized recommendations, for example, the LLM needs to infer a user's preferences from their behavior over multiple interactions. The Bayesian inference framework lays out the optimal way for an agent to update its beliefs as it receives new information. We first show that LLMs fall far short of the standard defined by the Bayesian framework. We then show that by teaching LLMs to mimic the predictions of the normative Bayesian model, we can dramatically improve their ability to update their beliefs; this ability generalizes to new tasks. We conclude that LLMs can effectively learn reasoning skills from examples and generalize those skills to new domains.

Introduction

Effective interaction between AI agents and humans requires the agent to maintain and update internal models of user preferences. For instance, if a user rejects a flight option due to excessive layovers, a capable assistant should infer a preference for travel efficiency and adjust future recommendations accordingly. This process of belief updating under uncertainty is formally described by Bayesian inference.

Despite the impressive capabilities of modern Large Language Models (LLMs), research indicates they struggle with this fundamental aspect of probabilistic reasoning. Off-the-shelf models, including state-of-the-art systems like GPT-4o and Gemini 1.5 Pro, often fail to integrate evidence across multiple interaction rounds, with performance frequently plateauing after a single feedback loop. This suggests a lack of a dynamic "world model" capable of evolving with new data.

Overview of the Bayesian teaching framework where LLMs learn to mimic a normative Bayesian agent.

Methods: Bayesian Teaching

To bridge this gap, we introduce Bayesian teaching, a distillation method that transfers the reasoning logic of a symbolic mathematical model into the neural weights of an LLM.

The Teaching Framework

The approach involves three primary components:

  1. The Teacher: A symbolic "Bayesian Assistant" that utilizes Bayes' rule to maintain an explicit probability distribution over possible user preferences.
  2. Training: Medium-sized models (Gemma 2 9B, Llama 3 8B, and Qwen 2.5 7B) undergo Supervised Fine-Tuning (SFT) on interaction transcripts generated by the Bayesian Assistant.
  3. Comparison: The performance is benchmarked against "Oracle teaching," where models are trained only on ground-truth correct answers without the intermediate probabilistic reasoning steps.

Experimental Setup

The models were evaluated across diverse environments:

  • Synthetic Tasks: Flight and Hotel recommendation tasks with simulated users defined by specific reward functions (e.g., price, duration, ratings).
  • Real-World Benchmarks: The WebShop task, involving thousands of real products and natural language descriptions, served as a zero-shot transfer test.
  • Human Evaluation: Interactions with 500 human participants were used to test robustness against the "noisy" and sometimes inconsistent nature of real-world human preferences.

Results

The implementation of Bayesian teaching yielded significant improvements in reasoning capabilities across all model families.

Performance Gains and Alignment

In the flight recommendation task, the baseline Gemma 2 9B model achieved approximately 37% accuracy. Following Bayesian teaching, accuracy increased to 76% by the fifth interaction round. Furthermore, the fine-tuned models demonstrated high alignment with the normative Bayesian model, agreeing with its predictions ~80% of the time, compared to less than 40% for the original models.

Generalization and Robustness

A key finding was the superiority of Bayesian teaching over Oracle teaching. While the Oracle provides the "correct" answer, it fails to demonstrate the process of elimination under uncertainty. The Bayesian teacher, by providing "educated guesses," offers a richer signal for handling ambiguity. This resulted in superior zero-shot transfer to the WebShop task, proving that models learned a generalizable meta-skill for belief updating rather than just memorizing domain-specific patterns. Additionally, the LLMs showed greater robustness to human inconsistency than the rigid symbolic model, effectively bridging the gap between formal logic and human behavior.

Discussion and Conclusion

While Bayesian teaching significantly narrows the gap between LLMs and optimal probabilistic reasoning, a performance disparity remains. Future work should explore teaching models to explicitly verbalize their internal probability distributions and extending these methods to continuous domains and reinforcement learning frameworks.

In conclusion, treating Bayesian logic as a learnable "language" allows LLMs to develop sophisticated reasoning skills. This work provides a foundation for creating adaptive AI agents that can truly understand and evolve alongside the users they serve.

Summary updated

BibTeX
@inproceedings{qiu2026bayesian,
  author = {Linlu Qiu and Fei Sha and Kelsey R. Allen and Yoon Kim and Tal Linzen and Sjoerd van Steenkiste},
  title = {{Bayesian teaching enables probabilistic reasoning in large language models}},
  booktitle = {Nature Communications},
  year = {2026},
  doi = {10.1038/s41467-025-67998-6},
}
Figure