# Poster 28944

- Kind: Poster
- Talk page and recording: https://iclr.cc/virtual/2025/poster/28944

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

Hello everyone, I'm Giuseppe Bruno and this is a joint work with Federico Pasqualotto and Andrea Gatti. In recent years, transformer models, particularly large language models, have transformed the landscape of machine learning. Central to their success is the attention mechanism, but our mathematical understanding still lacks behind their remarkable achievements.
Recently an interesting perspective has emerged, viewing transformers as interacting particle system. Consider a sentence split into n tokens. Each token is embedded onto a high dimensional unique sphere. We can visualize each token as a particle and these particles interact through the attention mechanism, evolving layer by layer.
each transformer layer can thus be seen as a discrete time step in this dynamical system. At the end of this evolution we obtain a new set of tokens from which the model's output is sampled. So understanding the dynamics of these particles can help explain the impressive success of transformer.
Inspired by Resonance, some previous work studied what happens when we scale the parameters and let the number of transformers layers approach infinity. This scenario is quite realistic given that modern models often have close to 100 layers. But unlike Resonance, whose limiting dynamics become a single differential question, transformers produce a system of n interacting differential equations.
One fridge token coupled through self-antenna. An interesting phenomenon emerges from studying this mathematical model. Eventually the particles collapse into a single cluster. Initially this seems problematic since it would imply a deterministic transformer output. However this complete collapse only happens after an extremely long time.
Far more interesting is the intermediate behavior observed before the collapse, which resolves this apparent paradox. Particles from several distinct clusters that persist for a long time, a phenomenon known as metastability. Previous works empirically observed this phenomenon even in the simplest case where the query, key and value matrices are identity matrices.
Yet fully understanding why and how these metastable clusters appear is still unclear, and our goal is to shed more light on this phenomenon. In a large context regime, where the number of tokens n is large and when the tokens are initially sampled uniformly at random on the sphere, we can precisely characterize this metastable clustering.
We did this by exploiting the representation of the evolution of a particular distribution as a nonlinear partial differential equation. Our numeric experiments in answering this scenario demonstrated we can accurately predict the number and positions of clusters based on the model's hyperparameters and initial conditions.
Moreover, we have established the hierarchical relationship between the model's temperature, its depth and the resulting symmetries and time scales in these metastable phase. This analysis confirms that the mathematical framework introduced in prior works opens exciting possibilities for advancing our theoretical understanding of transformers through techniques from diverse areas of mathematics.
We look forward to extending this result to more general settings and committing you at the poster session. Thank you for your attention.
