Abstract
Despite the success of Transformer architectures, the geometric properties of their learned weight matrices remain largely opaque. This research investigates how different training objectives—bidirectional versus autoregressive—shape the mathematical structure of self-attention. By analyzing the query-key product $W_{qk}$ as a bilinear form, we demonstrate that encoder-only models (e.g., BERT) naturally converge toward symmetric weight matrices, while decoder-only models (e.g., GPT) develop directional structures characterized by "attention sinks." We introduce quantitative metrics for these properties and show that "symmetric initialization" can accelerate the training of bidirectional models by up to 73%.
Introduction
The internal mechanics of Transformers, specifically the query ($W_q$) and key ($W_k$) matrices, are often treated as black boxes. While self-attention is effective, the relationship between a model's objective function and its learned weights is not well understood. This paper addresses this gap by asking how bidirectional training (filling in masked tokens) versus autoregressive training (predicting the next token) impacts the geometric properties of these matrices. Understanding these dynamics is essential for improving model interpretability and training efficiency.
Theoretical Framework: Attention as a Bilinear Form
The researchers propose a novel framework that shifts focus from individual matrices to their product, $W_{qk} = W_q W_k^\top$. This product defines a bilinear form that quantifies the relationship between token embeddings $x_i$ and $x_j$.
A key technical insight is the Rank-1 Update Derivation: implicit weight updates during training are shown to be linear combinations of rank-1 matrices formed by the outer products of token embeddings. This derivation provides a mathematical basis for why specific training objectives lead to specific geometric structures. To quantify these structures, the authors define:
- Symmetry Score ($s$): Measures the proximity of $W_{qk}$ to its transpose.
- Directionality Score ($d$): Measures the dominance of specific rows or columns, identifying "attention sinks."
Empirical Findings: Symmetry and Directionality
The study reveals a stark contrast between model types across text, vision, and audio modalities.
The "Balanced" Nature of Encoders
In bidirectional training, every token serves as both context and target. This symmetry in roles leads to symmetric weight updates. Empirically, encoder-only models like BERT consistently exhibit high symmetry scores across all parameter scales.
The "Directional" Bias of Decoders
Conversely, autoregressive models like GPT only attend to previous tokens. This directional constraint causes certain "influential" tokens—often early in the sequence or common functional words—to emerge as column outliers in the weight matrix. These "sinks" dominate the attention pattern, resulting in high directionality scores.
Practical Applications: Symmetric Initialization
Since encoder-only models naturally trend toward symmetry, the authors propose Symmetric Initialization: setting $W_k = W_q$ at the start of training. This provides a "symmetry prior" that aligns the model with its eventual convergence point from step one.
The results are significant:
- Training Speedup: A 4-layer BERT model trained on Wikipedia achieved the same loss 73% faster than standard initialization. A 24-layer version saw a 44% speedup.
- Performance: Beyond speed, symmetric initialization often leads to a lower final loss, suggesting it helps the model find better local minima.
Conclusion and Future Work
This work establishes a fundamental link between training objectives and the geometric structure of attention weights. While symmetry provides a powerful inductive bias for encoders, a major remaining challenge is identifying an equivalent "directional prior" to accelerate the training of large decoder-only models. Additionally, while these patterns hold across modalities, the specific benefits of symmetric initialization in Vision Transformers appear less pronounced, suggesting that domain-specific priors may vary in their impact.
Summary updated