Transformers versus the EM Algorithm in Multi-class Clustering

Yihan He, Hong-Yu Chen, Yuan Cao, Jianqing Fan, Han Liu
2/9/2025
stat.MLcs.LG

No confident code implementation found for this paper.

Abstract

LLMs demonstrate significant inference capacities in complicated machine learning tasks, using the Transformer model as its backbone. Motivated by the limited understanding of such models on the unsupervised learning problems, we study the learning guarantees of Transformers in performing multi-class clustering of the Gaussian Mixture Models. We develop a theory drawing strong connections between the Softmax Attention layers and the workflow of the EM algorithm on clustering the mixture of Gaussians. Our theory provides approximation bounds for the Expectation and Maximization steps by proving the universal approximation abilities of multivariate mappings by Softmax functions. In addition to the approximation guarantees, we also show that with a sufficient number of pre-training samples and an initialization, Transformers can achieve the minimax optimal rate for the problem considered. Our extensive simulations empirically verified our theory by revealing the strong learning capacities of Transformers even beyond the assumptions in the theory, shedding light on the powerful inference capacities of LLMs.

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{he2025transformers,
  title  = {Transformers versus the EM Algorithm in Multi-class Clustering},
  author = {Yihan He and Hong-Yu Chen and Yuan Cao and Jianqing Fan and Han Liu},
  year   = {2025},
  eprint = {2502.06007},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.06007v1}
}

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/2502.06007.svg)](https://codeofpaper.com/paper/2502.06007)

Discussion