mlsanityData to 7 Oct 2026

Uncovering hidden geometry in Transformers via disentangling position and context

arXiv 2310.04861 ↗First posted 7 Oct 2023cs.LG cs.AI stat.MLcited by 15

Not on the map. Why?

Abstract (arXiv)

Transformers are widely used to extract semantic meanings from input tokens, yet they usually operate as black-box models. In this paper, we present a simple yet informative decomposition of hidden states (or embeddings) of trained transformers into interpretable components. For any layer, embedding vectors of input sequence samples are represented by a tensor boldsymbolh ∈ ℝC × T × d. Given embedding vector boldsymbolhc,t ∈ ℝd at sequence position t ≤ T in a sequence (or context) c ≤ C, extracting the mean effects yields the decomposition [ boldsymbolhc,t = boldsymbolμ + post + ctxc + residc,t ] where boldsymbolμ is the global mean vector, post and ctxc are the mean vectors across contexts and across positions respectively, and residc,t is the residual vector. For popular transformer architectures and diverse text datasets, empirically we find pervasive mathematical structure: (1) (post)t forms a low-dimensional, continuous, and often spiral shape across layers, (2) (ctxc)c shows clear cluster structure that falls into context topics, and (3) (post)t and (ctxc)c are mutually nearly orthogonal. We argue that smoothness is pervasive and beneficial to transformers trained on languages, and our decomposition leads to improved model interpretability.

Key facts. Cited by 15 papers in the map (data through 7 Oct 2026). Builds on 34 of its 51 references that are in the map. First posted on arXiv 7 Oct 2023.

Builds on

34 of 51 references.

References · 34

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  5. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  6. 2021On the Opportunities and Risks of Foundation Modelscited by 3,961
  7. 2020Longformer: The Long-Document Transformercited by 3,362
  8. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
  9. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
  10. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
  11. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
  12. 2018Self-Attention with Relative Position Representationscited by 1,112
22 more
  1. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  2. 2022Editing Models with Task Arithmeticcited by 1,076
  3. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 994
  4. 2022In-context Learning and Induction Headscited by 930
  5. 2019How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddingscited by 770
  6. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
  7. 2019Representation Degeneration Problem in Training Natural Language Generation Modelscited by 250
  8. 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 241
  9. 2023Task Arithmetic in the Tangent Space: Improved Editing of Pre-Trained Modelscited by 218
  10. 2019Visualizing and Measuring the Geometry of BERTcited by 215
  11. 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 211
  12. 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
  13. 2023Teaching Arithmetic to Small Transformerscited by 121
  14. 2020Finding Universal Grammatical Relations in Multilingual BERTcited by 108
  15. 2018Beyond Word Importance: Contextual Decomposition to Extract Interactions from LSTMscited by 67
  16. 2020What Do Position Embeddings Learn? An Empirical Study of Pre-Trained Language Model Positional Encodingcited by 52
  17. 2023Mimetic Initialization of Self-Attention Layerscited by 52
  18. 2023Transformers learn through gradual rank increasecited by 52
  19. 2023AttentionViz: A Global View of Transformer Attentioncited by 50
  20. 2020Topic Modeling with Contextualized Word Representation Clusterscited by 41
  21. 2021The Low-Dimensional Linear Geometry of Contextualized Word Representationscited by 39
  22. 2020ScreeNOT: Exact MSE-Optimal Singular Value Thresholding in Correlated Noisecited by 15

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 1; 2024: 7; 2025: 3; 2026: 4.

15 papers.

Sort:

By area: