Emergence of meta-stable clustering in mean-field transformer models

Giuseppe Bruno, Federico Pasqualotto, Andrea Agazzi
10/30/2024
cs.LGmath.AP

No official code found. Best implementation: gbruno16/transformers-metastability (2 stars, last commit 2025-02-28).

Abstract

We model the evolution of tokens within a deep stack of Transformer layers as a continuous-time flow on the unit sphere, governed by a mean-field interacting particle system, building on the framework introduced in (Geshkovski et al., 2023). Studying the corresponding mean-field Partial Differential Equation (PDE), which can be interpreted as a Wasserstein gradient flow, in this paper we provide a mathematical investigation of the long-term behavior of this system, with a particular focus on the emergence and persistence of meta-stable phases and clustering phenomena, key elements in applications like next-token prediction. More specifically, we perform a perturbative analysis of the mean-field PDE around the iid uniform initialization and prove that, in the limit of large number of tokens, the model remains close to a meta-stable manifold of solutions with a given structure (e.g., periodicity). Further, the structure characterizing the meta-stable manifold is explicitly identified, as a function of the inverse temperature parameter of the model, by the index maximizing a certain rescaling of Gegenbauer polynomials.

View on arXivView PDF

Code Implementations(1)

Code for the paper "Emergence of meta-stable clustering in mean-field transformer models"

20Jupyter NotebookFeb 27, 20251 years ago

Cite this paper

@article{bruno2024emergence,
  title  = {Emergence of meta-stable clustering in mean-field transformer models},
  author = {Giuseppe Bruno and Federico Pasqualotto and Andrea Agazzi},
  year   = {2024},
  eprint = {2410.23228},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.23228v2},
  journal = {ICLR 2024 2024}
}

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

Discussion