Uncovering hidden geometry in Transformers via disentangling position and context
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
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2021On the Opportunities and Risks of Foundation Modelscited by 3,961
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
- 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2018Self-Attention with Relative Position Representationscited by 1,112
22 more
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2022Editing Models with Task Arithmeticcited by 1,076
- 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 994
- 2022In-context Learning and Induction Headscited by 930
- 2019How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddingscited by 770
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2019Representation Degeneration Problem in Training Natural Language Generation Modelscited by 250
- 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 241
- 2023Task Arithmetic in the Tangent Space: Improved Editing of Pre-Trained Modelscited by 218
- 2019Visualizing and Measuring the Geometry of BERTcited by 215
- 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 211
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2023Teaching Arithmetic to Small Transformerscited by 121
- 2020Finding Universal Grammatical Relations in Multilingual BERTcited by 108
- 2018Beyond Word Importance: Contextual Decomposition to Extract Interactions from LSTMscited by 67
- 2020What Do Position Embeddings Learn? An Empirical Study of Pre-Trained Language Model Positional Encodingcited by 52
- 2023Mimetic Initialization of Self-Attention Layerscited by 52
- 2023Transformers learn through gradual rank increasecited by 52
- 2023AttentionViz: A Global View of Transformer Attentioncited by 50
- 2020Topic Modeling with Contextualized Word Representation Clusterscited by 41
- 2021The Low-Dimensional Linear Geometry of Contextualized Word Representationscited by 39
- 2020ScreeNOT: Exact MSE-Optimal Singular Value Thresholding in Correlated Noisecited by 15
Built on by
Citing papers per year: 2023: 1; 2024: 7; 2025: 3; 2026: 4.
15 papers.
Sort:
By area:
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Conv-Basis: A New Paradigm for Efficient Attention Inference and Gradient Computation in Transformerscited by 32
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 28
- 2026Manifold Steering Reveals the Shared Geometry of Neural Network Representation and Behaviorcited by 22
- 2024Exploring Context Window of Large Language Models via Decomposed Positional Vectorscited by 18
- 2025Position: Beyond Euclidean -- Foundation Models Should Embrace Non-Euclidean Geometriescited by 15
- 2023Characterizing Large Language Model Geometry Helps Solve Toxicity Detection and Generationcited by 11
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspacescited by 6
- 2024Lines of Thought in Large Language Modelscited by 5
- 2024Reasoning in Large Language Models: A Geometric Perspectivecited by 4
- 2025REMA: A Unified Reasoning Manifold Framework for Interpreting Large Language Modelcited by 4
- 2026Bi-Orthogonal Factor Decomposition for Vision Transformerscited by 4
- 2026Give it Space! Explicit Disentangling of Positional and Semantic Representations in Encoders28 May 2026
- 2026Manifold Steering Reveals the Shared Geometry of Neural Network Representation and Behavior6 May 2026
- 2026RDP LoRA: Geometry-Driven Identification for Parameter-Efficient Adaptation in Large Language Models21 Apr 2026
- 2026Bi-Orthogonal Factor Decomposition for Vision Transformers8 Jan 2026
- 2025REMA: A Unified Reasoning Manifold Framework for Interpreting Large Language Model26 Sep 2025
- 2025Position: Beyond Euclidean -- Foundation Models Should Embrace Non-Euclidean Geometries11 Apr 2025
- 2025Context-aware Biases for Length Extrapolation11 Mar 2025
- 2024Lines of Thought in Large Language Models2 Oct 2024
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformers18 Aug 2024
- 2024Reasoning in Large Language Models: A Geometric Perspective2 Jul 2024
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspaces25 Jun 2024
- 2024Exploring Context Window of Large Language Models via Decomposed Positional Vectors28 May 2024
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Conv-Basis: A New Paradigm for Efficient Attention Inference and Gradient Computation in Transformerscited by 32
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 28
- 2026Manifold Steering Reveals the Shared Geometry of Neural Network Representation and Behaviorcited by 22
- 2024Exploring Context Window of Large Language Models via Decomposed Positional Vectorscited by 18
- 2025Position: Beyond Euclidean -- Foundation Models Should Embrace Non-Euclidean Geometriescited by 15
- 2023Characterizing Large Language Model Geometry Helps Solve Toxicity Detection and Generationcited by 11
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspacescited by 6
- 2026Bi-Orthogonal Factor Decomposition for Vision Transformerscited by 4
- 2025Context-aware Biases for Length Extrapolationcited by 2
- 2026RDP LoRA: Geometry-Driven Identification for Parameter-Efficient Adaptation in Large Language Modelscited by 0
- 2026Give it Space! Explicit Disentangling of Positional and Semantic Representations in Encoderscited by 0
- 2026Give it Space! Explicit Disentangling of Positional and Semantic Representations in Encoders28 May 2026
- 2026Manifold Steering Reveals the Shared Geometry of Neural Network Representation and Behavior6 May 2026
- 2026RDP LoRA: Geometry-Driven Identification for Parameter-Efficient Adaptation in Large Language Models21 Apr 2026
- 2026Bi-Orthogonal Factor Decomposition for Vision Transformers8 Jan 2026
- 2025Position: Beyond Euclidean -- Foundation Models Should Embrace Non-Euclidean Geometries11 Apr 2025
- 2025Context-aware Biases for Length Extrapolation11 Mar 2025
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformers18 Aug 2024
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspaces25 Jun 2024
- 2024Exploring Context Window of Large Language Models via Decomposed Positional Vectors28 May 2024
- 2024Conv-Basis: A New Paradigm for Efficient Attention Inference and Gradient Computation in Transformers8 May 2024
- 2024An Information-Theoretic Analysis of In-Context Learning28 Jan 2024
- 2023Characterizing Large Language Model Geometry Helps Solve Toxicity Detection and Generation4 Dec 2023