Papers › Uncovering hidden geometry in Transformers via disentangling position and context
Uncovering hidden geometry in Transformers via disentangling position and context
Jiajun Song, Yiqiao Zhong
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 h ∈ℝ^(C ×T ×d). Given embedding vector h_(c,t) ∈ℝᵈ at sequence position t ≤T in a sequence (or context) c ≤C, extracting the mean effects yields the decomposition h_(c,t) = μ + 𝐩𝐨𝐬ₜ + 𝐜𝐭𝐱_c + 𝐫𝐞𝐬𝐢𝐝_(c,t) where μ is the global mean vector, 𝐩𝐨𝐬ₜ and 𝐜𝐭𝐱_c are the mean vectors across contexts and across positions respectively, and 𝐫𝐞𝐬𝐢𝐝_(c,t) is the residual vector. For popular transformer architectures and diverse text datasets, empirically we find pervasive mathematical structure: (1) (𝐩𝐨𝐬ₜ)ₜ forms a low-dimensional, continuous, and often spiral shape across layers, (2) (𝐜𝐭𝐱_c)_c shows clear cluster structure that falls into context topics, and (3) (𝐩𝐨𝐬ₜ)ₜ and (𝐜𝐭𝐱_c)_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.
In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.
Code
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
Code Syntology ran Syntology
Not run by Syntology. Nothing on this page verifies that the listed code works.
Tasks
1 archive task tag without a task page not shown.
Results from the paper archive 2025-07-28
No leaderboard rows for this paper in the archive.
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections