Analyzing the Structure of Attention in a Transformer Language Model
Not on the map. Why?
Abstract (arXiv)
The Transformer is a fully attention-based alternative to recurrent networks that has achieved state-of-the-art results across a range of NLP tasks. In this paper, we analyze the structure of attention in a Transformer language model, the GPT-2 small pretrained model. We visualize attention for individual instances and analyze the interaction between attention and syntax over a large corpus. We find that attention targets different parts of speech at different layer depths within the model, and that attention aligns with dependency relations most strongly in the middle layers. We also find that the deepest layers of the model capture the most distant relationships. Finally, we extract exemplar sentences that reveal highly specific patterns targeted by particular attention heads.
Key facts. Cited by 241 papers in the map (data through 7 Oct 2026). First posted on arXiv 7 Jun 2019.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 31; 2022: 29; 2023: 44; 2024: 51; 2025: 52; 2026: 34.
241 papers.
Sort:
By area:
- 2021Knowledge Neurons in Pretrained Transformerscited by 590
- 2021Rethinking Spatial Dimensions of Vision Transformerscited by 361
- 2021FNet: Mixing Tokens with Fourier Transformscited by 343
- 2021Thinking Like Transformerscited by 182
- 2022A Review on Language Models as Knowledge Basescited by 156
- 2025Why do LLMs attend to the first token?cited by 122
- 2024Model Editing Harms General Abilities of Large Language Models: Regularization to the Rescuecited by 101
- 2021Pose Recognition with Cascade Transformerscited by 99
- 2023Language Model Behavior: A Comprehensive Surveycited by 92
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
- 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
- 2024How Large Language Models Encode Context Knowledge? A Layer-Wise Probing Studycited by 64
38 more
- 2022Measuring the Mixing of Contextual Information in the Transformercited by 63
- 2024Unveiling and Mitigating Memorization in Text-to-image Diffusion Models through Cross Attentioncited by 57
- 2024Confidence Regulation Neurons in Language Modelscited by 57
- 2022VL-InterpreT: An Interactive Visualization Tool for Interpreting Vision-Language Transformerscited by 53
- 2021Attention, please! A survey of Neural Attention Models in Deep Learningcited by 50
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2023AttentionViz: A Global View of Transformer Attentioncited by 50
- 2023Towards a Mechanistic Interpretation of Multi-Step Reasoning Capabilities of Language Modelscited by 50
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 49
- 2022On the Blind Spots of Model-Based Evaluation Metrics for Text Generationcited by 48
- 2022Investigating Explainability of Generative AI for Code through Scenario-based Designcited by 47
- 2024DeciMamba: Exploring the Length Extrapolation Potential of Mambacited by 45
- 2023Decoder-Only or Encoder-Decoder? Interpreting Language Model as a Regularized Encoder-Decodercited by 44
- 2023LasUIE: Unifying Information Extraction with Latent Adaptive Structure-aware Generative Language Modelcited by 43
- 2023The Closeness of In-Context Learning and Weight Shifting for Softmax Regressioncited by 41
- 2023Look Before You Leap: An Exploratory Study of Uncertainty Measurement for Large Language Modelscited by 40
- 2024Loss Landscape Degeneracy and Stagewise Development in Transformerscited by 39
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 39
- 2023Towards autonomous system: flexible modular production system enhanced with large language model agentscited by 38
- 2022On the Explainability of Natural Language Processing Deep Modelscited by 37
- 2024LazyDiT: Lazy Learning for the Acceleration of Diffusion Transformerscited by 35
- 2022Attention as a Guide for Simultaneous Speech Translationcited by 32
- 2023VISIT: Visualizing and Interpreting the Semantic Information Flow of Transformerscited by 32
- 2023Mitigating Over-smoothing in Transformers via Regularized Nonlocal Functionalscited by 31
- 2024On the Challenges and Opportunities in Generative AIcited by 31
- 2023Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarscited by 30
- 2021Supervising Model Attention with Human Explanations for Robust Natural Language Inferencecited by 29
- 2021How BPE Affects Memorization in Transformerscited by 29
- 2023A Mathematical Abstraction for Balancing the Trade-off Between Creativity and Reality in Large Language Modelscited by 29
- 2021Improving Transformers with Probabilistic Attention Keyscited by 28
- 2022LM-Debugger: An Interactive Tool for Inspection and Intervention in Transformer-Based Language Modelscited by 28
- 2023Dissociating language and thought in large language modelscited by 27
- 2025MUDDFormer: Breaking Residual Bottlenecks in Transformers via Multiway Dynamic Dense Connectionscited by 27
- 2021Accounting for Agreement Phenomena in Sentence Comprehension with Transformer Language Models: Effects of Similarity-based Interference on Surprisal and Attentioncited by 26
- 2021FMMformer: Efficient and Flexible Transformer via Decomposed Near-field and Far-field Attentioncited by 26
- 2022AnyMorph: Learning Transferable Polices By Inferring Agent Morphologycited by 25
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2024Pruning for Protection: Increasing Jailbreak Resistance in Aligned LLMs Without Fine-Tuningcited by 24
50 most cited of 241 All 241 (JSON)
- 2026Scaling Attention Head Analysis via Gradient-Based Attribution in Context-Aware Machine Translation23 Sep 2026
- 2026Task-Induced Riemannian Metrics for Vision Transformer Feature Spaces23 Sep 2026
- 2026Interpreting Language Model Hidden States at Scale10 Aug 2026
- 2026Combating Textual Noise and Redundancy: Entropy-Aware Dense Visual Token Pruning2 Jul 2026
- 2026Prism Transformer: Progressive Head Schedules for Hierarchical Attention Processing25 Jun 2026
- 2026Discovering Millions of Interpretable Features with Sparse Autoencoders25 Jun 2026
- 2026G-Long: Graph-Enhanced Memory Management for Efficient Long-Term Dialogue Agents11 Jun 2026
- 2026QCFuse: Query-Aware Cache Fusion via Compressed View for Efficient RAG Serving4 Jun 2026
- 2026Steered Generation via Gradient-Based Optimization on Sparse Query Features21 May 2026
- 2026Mechanics of Bias and Reasoning: Interpreting the Impact of Chain-of-Thought Prompting on Gender Bias in LLMs19 May 2026
- 2026Position: Behavioural Assurance Cannot Verify the Safety Claims Governance Now Demands14 May 2026
- 2026Compositional Sparsity as an Inductive Bias for Neural Architecture Design14 May 2026
38 more
- 2026Why Retrieval-Augmented Generation Fails: A Graph Perspective13 May 2026
- 2026Shaping Schema via Language Representation as the Next Frontier for LLM Intelligence Expanding10 May 2026
- 2026The Structural Origin of Attention Sink: Variance Discrepancy, Super Neurons, and Dimension Disparity7 May 2026
- 2026FlashRT: Towards Computationally and Memory Efficient Red-Teaming for Prompt Injection and Knowledge Corruption30 Apr 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
- 2026H-Probes: Extracting Hierarchical Structures From Latent Representations of Language Models15 Apr 2026
- 2026Reasoning Fails Where Step Flow Breaks8 Apr 2026
- 2026Entropy and Attention Dynamics in Small Language Models: A Trace-Level Structural Analysis on the TruthfulQA Benchmark4 Apr 2026
- 2026Pitfalls in Evaluating Interpretability Agents20 Mar 2026
- 2026Adaptive Activation Cancellation for Hallucination Mitigation in Large Language Models10 Mar 2026
- 2026Sparse Crosscoders for diffing MoEs and Dense models6 Mar 2026
- 2026DeAR: Fine-Grained VLM Adaptation by Decomposing Attention Head Roles1 Mar 2026
- 2026Induction Meets Biology: Mechanisms of Repeat Detection in Protein Language Models26 Feb 2026
- 2026AttentionRetriever: Attention Layers are Secretly Long Document Retrievers12 Feb 2026
- 2026MVISTA-4D: View-Consistent 4D World Model with Test-Time Action Inference for Robotic Manipulation10 Feb 2026
- 2026Beyond Activation Patterns: A Weight-Based Out-of-Context Explanation of Sparse Autoencoder Features30 Jan 2026
- 2026Beyond Conditional Computation: Retrieval-Augmented Genomic Foundation Models with Gengram29 Jan 2026
- 2026Per-parameter Task Arithmetic for Unlearning in Large Language Models29 Jan 2026
- 2026Conditional Generative Framework with Peak-Aware Attention for Robust Chemical Detection under Interferences29 Jan 2026
- 2026Scaled Dot-Product Attention implements projection of inputs onto a common surface25 Jan 2026
- 2026Why Inference in Large Models Becomes Decomposable After Training22 Jan 2026
- 2026The Grammar of Transformers: A Systematic Review of Interpretability Research on Syntactic Knowledge in Language Models9 Jan 2026
- 2025SoliReward: Mitigating Susceptibility to Reward Hacking and Annotation Noise in Video Generation Reward Models17 Dec 2025
- 2025AgentSHAP: Interpreting LLM Agent Tool Importance with Monte Carlo Shapley Value Estimation14 Dec 2025
- 2025Dynamical Properties of Tokens in Self-Attention and Effects of Positional Encoding25 Nov 2025
- 2025Order-Level Attention Similarity Across Language Models: A Latent Commonality7 Nov 2025
- 2025CAST: Compositional Analysis via Spectral Tracking for Understanding Transformer Layer Functions16 Oct 2025
- 2025CacheClip: Accelerating RAG with Effective KV Cache Reuse11 Oct 2025
- 2025GraphGhost: Tracing Structures Behind Large Language Models7 Oct 2025
- 2025There is More to Attention: Statistical Filtering Enhances Explanations in Vision Transformers7 Oct 2025
- 2025Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insight29 Sep 2025
- 2025Uncovering Graph Reasoning in Decoder-only Transformers with Circuit Tracing24 Sep 2025
- 2025From Input Perception to Predictive Insight: Modeling Model Blind Spots Before They Become Errors24 Sep 2025
- 2025Cross-Attention is Half Explanation in Speech-to-Text Models22 Sep 2025
- 2025Steering Language Models in Multi-Token Generation: A Case Study on Tense and Aspect15 Sep 2025
- 2025NeuroBreak: Unveil Internal Jailbreak Mechanisms in Large Language Models4 Sep 2025
- 2025MindGuard: Intrinsic Decision Inspection for Securing LLM Agents Against Metadata Poisoning28 Aug 2025
- 2025The Cultural Gene of Large Language Models: A Study on the Impact of Cross-Corpus Training on Model Values and Biases17 Aug 2025
50 newest of 241 All 241 (JSON)
- 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
- 2023Towards a Mechanistic Interpretation of Multi-Step Reasoning Capabilities of Language Modelscited by 50
- 2023Dissociating language and thought in large language modelscited by 27
- 2025TensorLLM: Tensorising Multi-Head Attention for Enhanced Reasoning and Compression in LLMscited by 11
- 2023Rethinking Model Selection and Decoding for Keyphrase Generation with Pre-trained Sequence-to-Sequence Modelscited by 8
- 2025Who Reasons in the Large Language Models?cited by 5
- 2025What are Models Thinking about? Understanding Large Language Model Hallucinations "Psychology" through Model Inner State Analysiscited by 2
- 2025Uncovering Graph Reasoning in Decoder-only Transformers with Circuit Tracingcited by 2
- 2026Reasoning Fails Where Step Flow Breakscited by 2
- 2024Causal Interventions on Causal Paths: Mapping GPT-2's Reasoning From Syntax to Semanticscited by 1
- 2025GraphGhost: Tracing Structures Behind Large Language Modelscited by 0
- 2026Mechanics of Bias and Reasoning: Interpreting the Impact of Chain-of-Thought Prompting on Gender Bias in LLMscited by 0
- 2026Mechanics of Bias and Reasoning: Interpreting the Impact of Chain-of-Thought Prompting on Gender Bias in LLMs19 May 2026
- 2026Reasoning Fails Where Step Flow Breaks8 Apr 2026
- 2025GraphGhost: Tracing Structures Behind Large Language Models7 Oct 2025
- 2025Uncovering Graph Reasoning in Decoder-only Transformers with Circuit Tracing24 Sep 2025
- 2025Who Reasons in the Large Language Models?27 May 2025
- 2025What are Models Thinking about? Understanding Large Language Model Hallucinations "Psychology" through Model Inner State Analysis19 Feb 2025
- 2025TensorLLM: Tensorising Multi-Head Attention for Enhanced Reasoning and Compression in LLMs26 Jan 2025
- 2024Causal Interventions on Causal Paths: Mapping GPT-2's Reasoning From Syntax to Semantics28 Oct 2024
- 2023Towards a Mechanistic Interpretation of Multi-Step Reasoning Capabilities of Language Models23 Oct 2023
- 2023Rethinking Model Selection and Decoding for Keyphrase Generation with Pre-trained Sequence-to-Sequence Models10 Oct 2023
- 2023Dissociating language and thought in large language models16 Jan 2023
- 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scale18 Dec 2022
- 2025CacheClip: Accelerating RAG with Effective KV Cache Reusecited by 14
- 2024Understanding Retrieval Robustness for Retrieval-Augmented Image Captioningcited by 9
- 2025Through the Stealth Lens: Attention-Aware Defenses Against Poisoning in RAGcited by 3
- 2026QCFuse: Query-Aware Cache Fusion via Compressed View for Efficient RAG Servingcited by 2
- 2026Beyond Conditional Computation: Retrieval-Augmented Genomic Foundation Models with Gengramcited by 1
- 2026AttentionRetriever: Attention Layers are Secretly Long Document Retrieverscited by 0
- 2026FlashRT: Towards Computationally and Memory Efficient Red-Teaming for Prompt Injection and Knowledge Corruptioncited by 0
- 2026Why Retrieval-Augmented Generation Fails: A Graph Perspectivecited by 0
- 2026QCFuse: Query-Aware Cache Fusion via Compressed View for Efficient RAG Serving4 Jun 2026
- 2026Why Retrieval-Augmented Generation Fails: A Graph Perspective13 May 2026
- 2026FlashRT: Towards Computationally and Memory Efficient Red-Teaming for Prompt Injection and Knowledge Corruption30 Apr 2026
- 2026AttentionRetriever: Attention Layers are Secretly Long Document Retrievers12 Feb 2026
- 2026Beyond Conditional Computation: Retrieval-Augmented Genomic Foundation Models with Gengram29 Jan 2026
- 2025CacheClip: Accelerating RAG with Effective KV Cache Reuse11 Oct 2025
- 2025Through the Stealth Lens: Attention-Aware Defenses Against Poisoning in RAG4 Jun 2025
- 2024Understanding Retrieval Robustness for Retrieval-Augmented Image Captioning4 Jun 2024
- 2023Towards autonomous system: flexible modular production system enhanced with large language model agentscited by 38
- 2025MindGuard: Intrinsic Decision Inspection for Securing LLM Agents Against Metadata Poisoningcited by 10
- 2026Pitfalls in Evaluating Interpretability Agentscited by 2
- 2026G-Long: Graph-Enhanced Memory Management for Efficient Long-Term Dialogue Agentscited by 1
- 2025AgentSHAP: Interpreting LLM Agent Tool Importance with Monte Carlo Shapley Value Estimationcited by 0
- 2026G-Long: Graph-Enhanced Memory Management for Efficient Long-Term Dialogue Agents11 Jun 2026
- 2026Pitfalls in Evaluating Interpretability Agents20 Mar 2026
- 2025AgentSHAP: Interpreting LLM Agent Tool Importance with Monte Carlo Shapley Value Estimation14 Dec 2025
- 2025MindGuard: Intrinsic Decision Inspection for Securing LLM Agents Against Metadata Poisoning28 Aug 2025
- 2023Towards autonomous system: flexible modular production system enhanced with large language model agents28 Apr 2023
- 2022Efficient Vision-Language Pretraining with Visual Concepts and Hierarchical Alignmentcited by 19
- 2024Images Speak Louder than Words: Understanding and Mitigating Bias in Vision-Language Model from a Causal Mediation Perspectivecited by 13
- 2025Exploring Implicit Visual Misunderstandings in Multimodal Large Language Models through Attention Analysiscited by 2
- 2026DeAR: Fine-Grained VLM Adaptation by Decomposing Attention Head Rolescited by 1
- 2025BlindSight: Harnessing Sparsity for Efficient Vision-Language Modelscited by 0
- 2026DeAR: Fine-Grained VLM Adaptation by Decomposing Attention Head Roles1 Mar 2026
- 2025BlindSight: Harnessing Sparsity for Efficient Vision-Language Models11 Jul 2025
- 2025Exploring Implicit Visual Misunderstandings in Multimodal Large Language Models through Attention Analysis15 May 2025
- 2024Images Speak Louder than Words: Understanding and Mitigating Bias in Vision-Language Model from a Causal Mediation Perspective3 Jul 2024
- 2022Efficient Vision-Language Pretraining with Visual Concepts and Hierarchical Alignment29 Aug 2022
- 2024Unveiling and Mitigating Memorization in Text-to-image Diffusion Models through Cross Attentioncited by 57
- 2024LazyDiT: Lazy Learning for the Acceleration of Diffusion Transformerscited by 35
- 2025DSV: Exploiting Dynamic Sparsity to Accelerate Large-Scale Video DiT Trainingcited by 15
- 2025Padding Tone: A Mechanistic Analysis of Padding Tokens in T2I Modelscited by 12
- 2025DSV: Exploiting Dynamic Sparsity to Accelerate Large-Scale Video DiT Training11 Feb 2025
- 2025Padding Tone: A Mechanistic Analysis of Padding Tokens in T2I Models12 Jan 2025
- 2024LazyDiT: Lazy Learning for the Acceleration of Diffusion Transformers17 Dec 2024
- 2024Unveiling and Mitigating Memorization in Text-to-image Diffusion Models through Cross Attention17 Mar 2024
- 2021Knowledge Neurons in Pretrained Transformerscited by 590
- 2021Rethinking Spatial Dimensions of Vision Transformerscited by 361
- 2021FNet: Mixing Tokens with Fourier Transformscited by 343
- 2021Thinking Like Transformerscited by 182
- 2022A Review on Language Models as Knowledge Basescited by 156
- 2025Why do LLMs attend to the first token?cited by 122
- 2024Model Editing Harms General Abilities of Large Language Models: Regularization to the Rescuecited by 101
- 2021Pose Recognition with Cascade Transformerscited by 99
- 2023Language Model Behavior: A Comprehensive Surveycited by 92
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
- 2024How Large Language Models Encode Context Knowledge? A Layer-Wise Probing Studycited by 64
- 2022Measuring the Mixing of Contextual Information in the Transformercited by 63
12 most cited of 194 All 194 (JSON)
- 2026Scaling Attention Head Analysis via Gradient-Based Attribution in Context-Aware Machine Translation23 Sep 2026
- 2026Task-Induced Riemannian Metrics for Vision Transformer Feature Spaces23 Sep 2026
- 2026Interpreting Language Model Hidden States at Scale10 Aug 2026
- 2026Prism Transformer: Progressive Head Schedules for Hierarchical Attention Processing25 Jun 2026
- 2026Discovering Millions of Interpretable Features with Sparse Autoencoders25 Jun 2026
- 2026Steered Generation via Gradient-Based Optimization on Sparse Query Features21 May 2026
- 2026Position: Behavioural Assurance Cannot Verify the Safety Claims Governance Now Demands14 May 2026
- 2026Compositional Sparsity as an Inductive Bias for Neural Architecture Design14 May 2026
- 2026Shaping Schema via Language Representation as the Next Frontier for LLM Intelligence Expanding10 May 2026
- 2026The Structural Origin of Attention Sink: Variance Discrepancy, Super Neurons, and Dimension Disparity7 May 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
- 2026H-Probes: Extracting Hierarchical Structures From Latent Representations of Language Models15 Apr 2026
12 newest of 194 All 194 (JSON)