Learning interpretable positional encodings in transformers depends on initialization
Not on the map. Why?
Abstract (arXiv)
In transformers, the positional encoding (PE) provides essential information that distinguishes the position and order amongst tokens in a sequence. Most prior investigations of PE effects on generalization were tailored to 1D input sequences, such as those presented in natural language, where adjacent tokens (e.g., words) are highly related. In contrast, many real world tasks involve datasets with highly non-trivial positional arrangements, such as datasets organized in multiple spatial dimensions, or datasets for which ground truth positions are not known. Here we find that the choice of initialization of a learnable PE greatly influences its ability to learn interpretable PEs that lead to enhanced generalization. We empirically demonstrate our findings in three experiments: 1) A 2D relational reasoning task; 2) A nonlinear stochastic network simulation; 3) A real world 3D neuroscience dataset, applying interpretability analyses to verify the learning of accurate PEs. Overall, we find that a learned PE initialized from a small-norm distribution can 1) uncover interpretable PEs that mirror ground truth positions in multiple dimensions, and 2) lead to improved generalization. These results illustrate the feasibility of learning identifiable and interpretable PEs for enhanced generalization.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 19 of its 41 references that are in the map. First posted on arXiv 12 Jun 2024.
Builds on
19 of 41 references.
References · 19
- 2017Attention Is All You Needcited by 59,932
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2018Neural Tangent Kernel: Convergence and Generalization in Neural Networkscited by 2,597
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2018On Lazy Training in Differentiable Programmingcited by 671
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2020Kernel and Rich Regimes in Overparametrized Modelscited by 302
- 2021The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformerscited by 117
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2021Learnable Fourier Features for Multi-Dimensional Spatial Positional Encodingcited by 93
7 more
- 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 82
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 77
- 2021Making Transformers Solve Compositional Taskscited by 72
- 2023Positional Description Matters for Transformers Arithmeticcited by 56
- 2024Contextual Position Encoding: Learning to Count What's Importantcited by 53
- 2024Get rich quick: exact solutions reveal how unbalanced initializations promote rapid feature learningcited by 41
- 2024When does compositional structure yield compositional generalization? A kernel theorycited by 19
Built on by
Citing papers per year: 2025: 1.
1 paper.