Learning Spectral Methods by Transformers
Yihan He, Yuan Cao, Hong-Yu Chen, Dennis Wu, Jianqing Fan, Han Liu
TL;DR
The work asks whether pre-trained Transformers can perform unsupervised learning tasks by learning spectral algorithms. It provides constructive proofs showing that multi-layer Transformers can simulate the Power Method to extract left singular vectors and principal components, enabling PCA, and designs spectral algorithms for clustering a Gaussian mixture model within the Transformer framework. Theoretical results establish ERM-based guarantees and explicit Transformer constructions with depth and width bounds, alongside an auxiliary design matrix to seed iterative steps. Empirically, the authors validate eigenvalue/eigenvector prediction and GMM clustering on synthetic data and real datasets (e.g., MNIST/FMNIST), demonstrating that pre-trained Transformers can autonomously perform spectral estimation and clustering tasks. The findings highlight a principled pathway for embedding classical unsupervised spectral methods into Transformer pretraining, with implications for unsupervised learning in large-scale models and beyond.
Abstract
Transformers demonstrate significant advantages as the building block of modern LLMs. In this work, we study the capacities of Transformers in performing unsupervised learning. We show that multi-layered Transformers, given a sufficiently large set of pre-training instances, are able to learn the algorithms themselves and perform statistical estimation tasks given new instances. This learning paradigm is distinct from the in-context learning setup and is similar to the learning procedure of human brains where skills are learned through past experience. Theoretically, we prove that pre-trained Transformers can learn the spectral methods and use the classification of bi-class Gaussian mixture model as an example. Our proof is constructive using algorithmic design techniques. Our results are built upon the similarities of multi-layered Transformer architecture with the iterative recovery algorithms used in practice. Empirically, we verify the strong capacity of the multi-layered (pre-trained) Transformer on unsupervised learning through the lens of both the PCA and the Clustering tasks performed on the synthetic and real-world datasets.
