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
Abstract
Self-attention is essential to Transformer architectures, yet how information is embedded in the selfattention 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. We provide proof for this proposition with related remarks in Appendix S1.5.1. Note that all mathematical results derived so far rely solely on the structure of self-attention and make no assumptions about the input data. In the next section, we build on these results to link structural patterns in W qk with the specific form of the objective function. The relation between objective functions and structures in self-attention matrices In this final section, we show how to relate these properties to the specific objective function. Crucially, the number of times a token t * appears as context or as a prediction depends on the training objective. Autoregressive training implicitly introduces
Ask Lune
Ask anything. The answer quotes the paper.
Lune reads all of it and the papers around it, then shows you the passages behind every answer.
Lune answers from
the full paper · 2 top-tier papers that cite it · related work
Free to start. No credit card required.
Cited by top-tier papers2
Builds on3
- CutMix: Regularization Strategy to Train Strong Classifiers With Localizable FeaturesSangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh et al.ICCV 2019 · 5,843 citations
- BEiT: BERT Pre-Training of Image TransformersHangbo Bao, Li Dong, Songhao Piao, Furu WeiICLR 2022 · 3,632 citations
- AttentionViz: A Global View of Transformer AttentionCatherine Yeh, Yida Chen, Aoyu Wu, Cynthia Chen et al.IEEE VIS 2023 · 78 citations
Related papers
- Conditioned Initialization for AttentionHemanth Saratchandran, Simon LuceyICLR 2026
- How do Transformers Perform In-Context Autoregressive Learning ?Michael Eli Sander, Raja Giryes, Taiji Suzuki, Mathieu Blondel et al.ICML 2024 · 21 citations
- On Position Embeddings in BERTBenyou Wang, Lifeng Shang, Christina Lioma, Xin Jiang et al.ICLR 2021 · 129 citations
- The Locality and Symmetry of Positional EncodingsLihu Chen, Gaël Varoquaux, Fabian M. SuchanekEMNLP Findings 2023 · 2 citations
- SparseBERT: Rethinking the Importance Analysis in Self-attentionHan Shi, Jiahui Gao, Xiaozhe Ren, Hang Xu et al.ICML 2021 · 63 citations
