Mechanistic Interpretability of GPT-2: Lexical and Contextual Layers in Sentiment Analysis
- URL: http://arxiv.org/abs/2512.06681v1
- Date: Sun, 07 Dec 2025 06:36:35 GMT
- Title: Mechanistic Interpretability of GPT-2: Lexical and Contextual Layers in Sentiment Analysis
- Abstract summary: We test the hypothesized two-stage sentiment architecture comprising early lexical detection and mid-layer contextual integration.<n>Our experiments confirm that early layers (0-3) act as lexical sentiment detectors, encoding stable, position specific polarity signals that are largely independent of context.<n>Instead of mid-layer specialization, we find that contextual phenomena such as negation, sarcasm, domain shifts etc. are integrated primarily in late layers (8-11) through a unified, non-modular mechanism.
- Score: 0.0
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: We present a mechanistic interpretability study of GPT-2 that causally examines how sentiment information is processed across its transformer layers. Using systematic activation patching across all 12 layers, we test the hypothesized two-stage sentiment architecture comprising early lexical detection and mid-layer contextual integration. Our experiments confirm that early layers (0-3) act as lexical sentiment detectors, encoding stable, position specific polarity signals that are largely independent of context. However, all three contextual integration hypotheses: Middle Layer Concentration, Phenomenon Specificity, and Distributed Processing are falsified. Instead of mid-layer specialization, we find that contextual phenomena such as negation, sarcasm, domain shifts etc. are integrated primarily in late layers (8-11) through a unified, non-modular mechanism. These experimental findings provide causal evidence that GPT-2's sentiment computation differs from the predicted hierarchical pattern, highlighting the need for further empirical characterization of contextual integration in large language models.
Related papers
- Navigating the Emotion Tree: Hierarchical Hyperbolic RAG for Multimodal Emotion Recognition [56.650820426231284]
Multimodal emotion recognition aims to integrate text, audio, and video sources to understand human affective states.<n>Although large language models excel at multimodal reasoning, they typically treat emotion categories as independent labels.<n>We propose bftextHyperEmo-RAG, a retrieval-augmented generation framework that leverages a structured emotional knowledge base.
arXiv Detail & Related papers (2026-05-16T10:04:48Z) - Phase Transitions in Driven Informational Systems: A Two-Field Perspective on Learning Theory and Non-Equilibrium Chemistry [0.0]
Non-equilibrium statistical physics has identified phase transitions in driven chemical reaction networks underlying prebiotic selection.<n>We propose a perspective in which both classes of phenomena admit a common description as driven informational systems.<n>We outline the geometric structure of this framework, identify falsifiable predictions distinguishing it from single-field alternatives, and show consistency with recent empirical findings.
arXiv Detail & Related papers (2026-05-05T05:33:57Z) - Identity as Attractor: Geometric Evidence for Persistent Agent Architecture in LLM Activation Space [0.0]
Large language models map semantically related prompts to similar internal representations.<n>We ask whether the identity document of a persistent cognitive agent exhibits analogous attractor-like behavior.
arXiv Detail & Related papers (2026-04-13T20:00:42Z) - Distributional Semantics Tracing: A Framework for Explaining Hallucinations in Large Language Models [4.946483489399819]
Large Language Models (LLMs) are prone to hallucination, the generation of factually incorrect statements.<n>This work investigates the intrinsic, architectural origins of this failure mode through three primary contributions.
arXiv Detail & Related papers (2025-10-07T16:40:31Z) - Beyond Artificial Misalignment: Detecting and Grounding Semantic-Coordinated Multimodal Manipulations [56.816929931908824]
We pioneer the detection of semantically-coordinated manipulations in multimodal data.<n>We propose a Retrieval-Augmented Manipulation Detection and Grounding (RamDG) framework.<n>Our framework significantly outperforms existing methods, achieving 2.06% higher detection accuracy on SAMM compared to state-of-the-art approaches.
arXiv Detail & Related papers (2025-09-16T04:18:48Z) - LLM Assertiveness can be Mechanistically Decomposed into Emotional and Logical Components [0.17188280334580197]
Large Language Models (LLMs) often display overconfidence, presenting information with unwarranted certainty in high-stakes contexts.<n>We use open-sourced Llama 3.2 models fine-tuned on human annotated assertiveness datasets.<n>Our analysis identifies layers most sensitive to assertiveness contrasts and reveals that high-assertive representations decompose into two sub-components of emotional and logical clusters.
arXiv Detail & Related papers (2025-08-24T01:43:48Z) - Punctuation and Predicates in Language Models [0.5937476291232802]
We evaluate the necessity and sufficiency of punctuation tokens across layers in GPT-2, DeepSeek, and Gemma.<n>We investigate whether different reasoning rules are processed differently by LLMs.<n>Our findings offer new insight into the internal mechanisms of punctuation usage and reasoning in LLMs.
arXiv Detail & Related papers (2025-08-11T09:53:30Z) - How do Transformers Learn Implicit Reasoning? [67.02072851088637]
We study how implicit multi-hop reasoning emerges by training transformers from scratch in a controlled symbolic environment.<n>We find that training with atomic triples is not necessary but accelerates learning, and that second-hop generalization relies on query-level exposure to specific compositional structures.
arXiv Detail & Related papers (2025-05-29T17:02:49Z) - Disentangling Feature Structure: A Mathematically Provable Two-Stage Training Dynamics in Transformers [18.662154648423087]
This paper theoretically demonstrates how the two-stage training dynamics potentially occur in transformers.<n>To our best knowledge, this is the first rigorous result regarding a feature-level two-stage optimization process in transformers.
arXiv Detail & Related papers (2025-02-28T03:27:24Z) - Trajectories of Change: Approaches for Tracking Knowledge Evolution [0.0]
We explore local vs. global evolution of knowledge systems through the framework of socio-epistemic networks (SEN)<n>We first use information-theoretic measures based on relative entropy to detect semantic shifts, assess their significance, and identify key driving features.<n>Second, variations in document embedding reveal changes in semantic neighbourhoods, tracking how concentration of similar documents increase, remain stable, or disperse.
arXiv Detail & Related papers (2024-12-31T11:09:37Z) - Explaining Text Similarity in Transformer Models [52.571158418102584]
Recent advances in explainable AI have made it possible to mitigate limitations by leveraging improved explanations for Transformers.
We use BiLRP, an extension developed for computing second-order explanations in bilinear similarity models, to investigate which feature interactions drive similarity in NLP models.
Our findings contribute to a deeper understanding of different semantic similarity tasks and models, highlighting how novel explainable AI methods enable in-depth analyses and corpus-level insights.
arXiv Detail & Related papers (2024-05-10T17:11:31Z) - Understanding Token-level Topological Structures in Transformer-based Time Series Forecasting [52.364260925700485]
Transformer-based methods have achieved state-of-the-art performance in time series forecasting (TSF)<n>It remains unclear whether existing Transformers fully leverage the intrinsic topological structure among tokens throughout intermediate layers.<n>We propose the Topology Enhancement Method (TEM), a novel Transformer-based TSF method that explicitly and adaptively preserves token-level topology.
arXiv Detail & Related papers (2024-04-16T07:21:39Z) - How to Handle Different Types of Out-of-Distribution Scenarios in Computational Argumentation? A Comprehensive and Fine-Grained Field Study [59.13867562744973]
This work systematically assesses LMs' capabilities for out-of-distribution (OOD) scenarios.
We find that the efficacy of such learning paradigms varies with the type of OOD.
Specifically, while ICL excels for domain shifts, prompt-based fine-tuning surpasses for topic shifts.
arXiv Detail & Related papers (2023-09-15T11:15:47Z) - How Do Transformers Learn Topic Structure: Towards a Mechanistic
Understanding [56.222097640468306]
We provide mechanistic understanding of how transformers learn "semantic structure"
We show, through a combination of mathematical analysis and experiments on Wikipedia data, that the embedding layer and the self-attention layer encode the topical structure.
arXiv Detail & Related papers (2023-03-07T21:42:17Z) - Latent Topology Induction for Understanding Contextualized
Representations [84.7918739062235]
We study the representation space of contextualized embeddings and gain insight into the hidden topology of large language models.
We show there exists a network of latent states that summarize linguistic properties of contextualized representations.
arXiv Detail & Related papers (2022-06-03T11:22:48Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.