William Zhang, Pavithra Harsha, et al.
NeurIPS 2026
Transformers have in-context learning capabilities, where some known learning algorithms can be executed in the forward pass through the model. Recent work shows that transformers can exactly perform Lloyd's algorithm for -means clustering with points in dimensions with an embedding size (thus, requiring attention projection matrices of size ). In this work, we build upon this result in the following ways: First, we present an equally expressive but smaller transformer that executes Lloyd's algorithm with embedding size . Next, we train these transformers to learn the clustering algorithms given a distribution of clustering tasks, and theoretically characterize and empirically validate the factors affecting the convergence and in-distribution generalization of learning algorithms based on stochastic gradients. Finally, we probe the general clustering abilities of these learned algorithms (in the form of transformers), and try to understand situations where they succeed and fail.
William Zhang, Pavithra Harsha, et al.
NeurIPS 2026
Gaetano Rossiello, Shankar Subramaniam
ACM CAIS 2026
Benjamin Badger
NeurIPS 2026
Ryan Bahlous-boldi, Isha Puri, et al.
NeurIPS 2026