Gradient Flow Polarizes Softmax Outputs towards Low-Entropy Solutions
Organizations: Theory of Machine Learning Lab, EPFL.
Abstract
Understanding the intricate non-convex training dynamics of softmax-based models is crucial for explaining the empirical success of transformers. In this article, we analyze the gradient flow dynamics of the value-softmax model, defined as , where and are a learnable value matrix and attention vector, respectively. As the matrix times softmax vector parameterization constitutes the core building block of self-attention, our analysis provides direct insight into transformer's training dynamics. We reveal that gradient flow on this structure inherently drives the optimization toward solutions characterized by low-entropy outputs. We demonstrate the universality of this polarizing effect across various objectives, including logistic and square loss. Furthermore, we discuss the practical implications of these theoretical results, offering a formal mechanism for empirical phenomena such as attention sinks and massive activations.
Figures & tables
| Name | Normalization | |
|---|---|---|
| softmax | ||
| sigmoid | ||
| elu | ||
| elu elu | ||
| mlp | ||
| linear |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Hyperparameter | Value | Hyperparameter | Value |
|---|---|---|---|
| Layers | 2 | Epochs | 10 |
| Hidden dim | 128 | Train size | 100,000 |
| Feedforward dim | 512 | Eval size | 1,000 |
| Vocab size | Sequence length | 13 | |
| Causal | true | Batch size | 256 |
| Use LayerNorm | true | Use MLP | true |
| Hyperparameter | Value | Hyperparameter | Value |
| Layers | Epochs | 10 | |
| Hidden dim | 128 | Train size | 10,000 |
| Feedforward dim | 512 | Eval size | 1,000 |
| Vocab size | Sequence length | 11 | |
| Labels | 4 | Causal | false |
| Batch size | 256 | Positional type | no |