The underlying structures of self-attention: symmetry, directionality, and emergent dynamics in Transformer training

Matteo Saponati, Pascal Sager, Pau Vilimelis Aceituno, Thilo Stadelmann, Benjamin F. Grewe
2/1/2025

No official code found. Best implementation: matteosaponati/attention-geometry (3 stars, last commit 2025-11-27).

Abstract

Self-attention is essential to Transformer architectures, yet how information is embedded in the self-attention matrices and how different objective functions impact this process remains unclear. We present a mathematical framework to analyze self-attention matrices by deriving the structures governing their weight updates. Using this framework, we demonstrate that bidirectional training induces symmetry in the weight matrices, while autoregressive training results in directionality and column dominance. Our theoretical findings are validated across multiple Transformer models - including ModernBERT, GPT, LLaMA3, and Mistral - and input modalities like text, vision, and audio. Finally, we apply these insights by showing that symmetric initialization improves the performance of encoder-only models on language tasks. This mathematical analysis offers a novel theoretical perspective on how information is embedded through self-attention, thereby improving the interpretability of Transformer models.

View on arXivView PDF

Code Implementations(1)

This is a repository for the paper: "The underlying structures of self-attention: symmetry, directionality, and emergent dynamics in Transformer training", Saponati, M., Sager, P. J., Aceituno, P. V., Stadelmann, T., Grewe, B. F. (2025). ICML 2025

30Python, Jupyter NotebookJan 11, 202410 months ago

Similar Papers

Cite this paper

@article{saponati2025underlying,
  title  = {The underlying structures of self-attention: symmetry, directionality, and emergent dynamics in Transformer training},
  author = {Matteo Saponati and Pascal Sager and Pau Vilimelis Aceituno and Thilo Stadelmann and Benjamin F. Grewe},
  year   = {2025},
  eprint = {2502.10927},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2502.10927},
  journal = {ICML 2025 2025}
}

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

Discussion