mlsanityData to 14 Oct 2026

Transformers are Bayesian Networks

arXiv 2603.17063 ↗First posted 17 Mar 2026cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

Transformers are the dominant architecture in AI, yet why they work remains poorly understood. This paper offers a precise answer: a transformer is a Bayesian network. We establish this in five ways. First, we prove that every sigmoid transformer with any weights implements weighted loopy belief propagation on its implicit factor graph. One layer is one round of BP. This holds for any weights -- trained, random, or constructed. Formally verified against standard mathematical axioms. Second, we give a constructive proof that a transformer can implement exact belief propagation on any declared knowledge base. On knowledge bases without circular dependencies this yields provably correct probability estimates at every node. Formally verified against standard mathematical axioms. Third, we prove uniqueness: a sigmoid transformer that produces exact posteriors necessarily has BP weights. There is no other path through the sigmoid architecture to exact posteriors. Formally verified against standard mathematical axioms. Fourth, we delineate the AND/OR boolean structure of the transformer layer: attention is AND, the FFN is OR, and their strict alternation is Pearl's gather/update algorithm exactly. Fifth, we confirm all formal results experimentally, corroborating the Bayesian network characterization in practice. We also establish the practical viability of loopy belief propagation despite the current lack of a theoretical convergence guarantee. We further prove that verifiable inference requires a finite concept space. Any finite verification procedure can distinguish at most finitely many concepts. Without grounding, correctness is not defined. Hallucination is not a bug that scaling can fix. It is the structural consequence of operating without concepts. Formally verified against standard mathematical axioms.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 13 of its 22 references that are in the map. First posted on arXiv 17 Mar 2026.

Builds on

13 of 22 references.

References · 13

  1. 2017Attention Is All You Needcited by 60,361
  2. 2017Graph Attention Networkscited by 8,923
  3. 2017Neural Message Passing for Quantum Chemistrycited by 3,487
  4. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  5. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  6. 2022Transformers learn in-context by gradient descentcited by 732
  7. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  8. 2023Looped Transformers as Programmable Computerscited by 237
  9. 2013Loopy Belief Propagation for Approximate Inference: An Empirical Studycited by 76
  10. 2018Inference in Probabilistic Graphical Models by Graph Neural Networkscited by 38
  11. 2025Transformers are Graph Neural Networkscited by 29
  12. 2024The Quantified Boolean Bayesian Network: Theory and Experiments with a Logical Graphical Modelcited by 2
1 more
  1. 2026Statistical Parsing for Logical Information Retrievalcited by 1

Built on by

Not cited yet.