Transformer Circuits Can Realize Clustering Algorithms
Kenneth Clarkson, Lior Horesh, Takuya Ito, Charlotte Park, Parikshit Ram
摘要
Although transformers are most commonly optimized as statistical sequence models, it is unclear to what extent they can implement and learn exact algorithmic computations. Here, we specify a transformer implementation from first principles that executes a fundamental and widely used method for -means clustering: Lloyd's algorithm. We theoretically prove and empirically demonstrate that this implementation of a transformer architecture, which we term the -means transformer, exactly implements Lloyd's algorithm for -means clustering using the standard circuit mechanisms of modern transformers: attention block, residual connections, and feed-forward block. In learning experiments, we find that training this base architecture on -means clustering yields a generalizable clustering algorithm that surpasses Lloyd's algorithm in terms of clustering quality. Finally, we demonstrate that interpretable alterations (e.g., inclusion of layer normalizations) to this architecture yields diverse and novel variants of clustering algorithms, including soft -means, spherical -means, trimmed -means. Overall, our results show that transformer circuit mechanisms can instantiate exact algorithmic routines for clustering, while simultaneously providing an effective learnable model.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 1 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Attention's forward pass and Frank-Wolfe 引用了 The emergence of clusters in self-attention dynamics
- Transformers Learn In-Context by Gradient Descent 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
引用它的顶会 Paper1
它引用的 Paper11
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 次引用
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
- Transformers learn to implement preconditioned gradient descent for in-context learningKwangjun Ahn, Xiang Cheng, Hadi Daneshmand, Suvrit SraNeurIPS 2023 · 324 次引用
- The Expressive Power of Transformers with Chain of ThoughtWilliam Merrill, Ashish SabharwalICLR 2024 · 243 次引用
- The emergence of clusters in self-attention dynamicsBorjan Geshkovski, Cyril Letrouit, Yury Polyanskiy, Philippe RigolletNeurIPS 2023 · 163 次引用
相关 Paper
- On the Efficiency of K-Means Clustering: Evaluation, Optimization, and Algorithm SelectionSheng Wang, Yuan Sun, Zhifeng BaoVLDB 2021 · 34 次引用
- Fast -Means via Data-Aware Grouping and Gap-Optimized Lower BoundXiaogang Huang, Dan Zhuang, Jianbao Chen, Tiefeng Ma 等ICDE 2026
- Efficient Algorithms for Sum-Of-Minimum OptimizationLisang Ding, Ziang Chen, Xinshang Wang, Wotao YinICML 2024 · 7 次引用
- End-to-end Differentiable Clustering with Associative MemoriesBishwajit Saha, Dmitry Krotov, Mohammed J. Zaki, Parikshit RamICML 2023 · 14 次引用
- Heterogeneity for the Win: One-Shot Federated ClusteringDon Kurian Dennis, Tian Li, Virginia SmithICML 2021 · 212 次引用
