Transformers Simulate MLE for Sequence Generation in Bayesian Networks

Yuan Cao, Yihan He, Dennis Wu, Hong-Yu Chen, Jianqing Fan +1 more
1/5/2025
stat.MLcs.LG

No confident code implementation found for this paper.

Abstract

Transformers have achieved significant success in various fields, notably excelling in tasks involving sequential data like natural language processing. Despite these achievements, the theoretical understanding of transformers' capabilities remains limited. In this paper, we investigate the theoretical capabilities of transformers to autoregressively generate sequences in Bayesian networks based on in-context maximum likelihood estimation (MLE). Specifically, we consider a setting where a context is formed by a set of independent sequences generated according to a Bayesian network. We demonstrate that there exists a simple transformer model that can (i) estimate the conditional probabilities of the Bayesian network according to the context, and (ii) autoregressively generate a new sample according to the Bayesian network with estimated conditional probabilities. We further demonstrate in extensive experiments that such a transformer does not only exist in theory, but can also be effectively obtained through training. Our analysis highlights the potential of transformers to learn complex probabilistic models and contributes to a better understanding of large language models as a powerful class of sequence generators.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cao2025transformers,
  title  = {Transformers Simulate MLE for Sequence Generation in Bayesian Networks},
  author = {Yuan Cao and Yihan He and Dennis Wu and Hong-Yu Chen and Jianqing Fan and Han Liu},
  year   = {2025},
  eprint = {2501.02547},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.02547v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2501.02547.svg)](https://codeofpaper.com/paper/2501.02547)

Discussion