Clustering in pure-attention hardmax transformers and its role in sentiment analysis
Albert Alcalde, Giovanni Fantuzzi, Enrique Zuazua

TL;DR
This paper provides a rigorous mathematical analysis of hardmax transformer models, revealing their tendency to cluster inputs around key points, and demonstrates their application in interpretable sentiment analysis.
Contribution
It introduces a geometric dynamical systems perspective on transformers and applies this understanding to develop an interpretable sentiment analysis method.
Findings
Transformers with hardmax attention converge to clustered equilibria.
The model effectively captures context by clustering words around leader words.
The approach offers interpretability in sentiment analysis tasks.
Abstract
Transformers are extremely successful machine learning models whose mathematical properties remain poorly understood. Here, we rigorously characterize the behavior of transformers with hardmax self-attention and normalization sublayers as the number of layers tends to infinity. By viewing such transformers as discrete-time dynamical systems describing the evolution of points in a Euclidean space, and thanks to a geometric interpretation of the self-attention mechanism based on hyperplane separation, we show that the transformer inputs asymptotically converge to a clustered equilibrium determined by special points called \textit{leaders}. We then leverage this theoretical understanding to solve sentiment analysis problems from language processing using a fully interpretable transformer model, which effectively captures `context' by clustering meaningless words around leader words…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
