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 $\boldsymbol{h} \in \mathbb{R}^{C \times T \times d}$. Given embedding vector $\boldsymbol{h}_{c,t} \in \mathbb{R}^d$ at sequence position $t \le T$ in a sequence (or context) $c \le C$, extracting the mean effects yields the decomposition \[ \boldsymbol{h}_{c,t} = \boldsymbolμ + \mathbf{pos}_t + \mathbf{ctx}_c + \mathbf{resid}_{c,t} \] where $\boldsymbolμ$ is the global mean vector, $\mathbf{pos}_t$ and $\mathbf{ctx}_c$ are the mean vectors across contexts and across positions respectively, and $\mathbf{resid}_{c,t}$ is the residual vector. For popular transformer architectures and diverse text datasets, empirically we find pervasive mathematical structure: (1) $(\mathbf{pos}_t)_{t}$ forms a low-dimensional, continuous, and often spiral shape across layers, (2) $(\mathbf{ctx}_c)_c$ shows clear cluster structure that falls into context topics, and (3) $(\mathbf{pos}_t)_{t}$ and $(\mathbf{ctx}_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.
Layer by Layer: Uncovering Hidden Representations in Language Models
University of Kentucky(肯塔基大学);Mila-Quebec AI Institute(魁北克AI研究所);University of Montreal(蒙特利尔大学);New York University(纽约大学);University of California, Los Angeles(加州大学洛杉矶分校);Meta FAIR
Uncovering differential equations from data with hidden variables
Aristas S.R.L.(阿里斯塔斯有限责任公司);Instituto de Calculo-CONICET(阿根廷国家科学与技术研究理事会计算研究所);Réseau de Transport d’Electricité (RTE)(法国输电网络公司);Université de Paris(巴黎大学);Universidad Torcuato Di Tella(托尔夸托·迪·特拉大学)
Hidden in the Multiplicative Interaction: Uncovering Fragility in Multimodal Contrastive Learning
Berlin Institute of Health, Charité - Universitätsmedizin Berlin(柏林健康研究所,柏林查理医院);Intelligent Medicine Institute, Fudan University(智能医学研究院,复旦大学);Department of Mathematics and Computer Science, Freie Universität Berlin(数学与计算机科学系,柏林自由大学)
Uncovering Hidden Systematics in Neural Network Models for High Energy Physics
Bonn-Aachen Institute of Technology, University of Bonn, Germany(波恩-亚琛技术学院,波恩大学,德国);Physics Institute III A, RWTH Aachen University, Germany(亚琛工业大学物理研究所III A,德国);Institute of Physics, University of Bonn, Germany(波恩大学物理研究所,德国);Physics Institute III B, RWTH Aachen University, Germany(亚琛工业大学物理研究所III B,德国)
Hidden Heroes and Gradient Bloats: Layer-Wise Redundancy Inverts Attribution in Transformers
Department of Computer Science, Fu Foundation School of Engineering and Applied Science, Columbia University, New York, NY, USA(计算机科学系,工程与应用科学基金会学院,哥伦比亚大学,纽约,纽约州,美国)
Mercator: uncovering faithful hyperbolic embeddings of complex networks
University of Turku(图尔库大学);Université Laval(拉瓦尔大学);Universitat de Barcelona(巴塞罗那大学);Universitat de Barcelona Institute of Complex Systems (UBICS)(巴塞罗那大学复杂系统研究所(UBICS));Institució Catalana de Recerca i Estudis Avançats (ICREA)(加泰罗尼亚研究与高等研究院(ICREA))