In Machina N400: Pinpointing Where a Causal Language Model Detects Semantic Violations

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Zacharopoulos, Christos-Nikolaos, Kyriakoglou, Revekka
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917101378207744
author Zacharopoulos, Christos-Nikolaos
Kyriakoglou, Revekka
author_facet Zacharopoulos, Christos-Nikolaos
Kyriakoglou, Revekka
contents How and where does a transformer notice that a sentence has gone semantically off the rails? To explore this question, we evaluated the causal language model (phi-2) using a carefully curated corpus, with sentences that concluded plausibly or implausibly. Our analysis focused on the hidden states sampled at each model layer. To investigate how violations are encoded, we utilized two complementary probes. First, we conducted a per-layer detection using a linear probe. Our findings revealed that a simple linear decoder struggled to distinguish between plausible and implausible endings in the lowest third of the model's layers. However, its accuracy sharply increased in the middle blocks, reaching a peak just before the top layers. Second, we examined the effective dimensionality of the encoded violation. Initially, the violation widens the representational subspace, followed by a collapse after a mid-stack bottleneck. This might indicate an exploratory phase that transitions into rapid consolidation. Taken together, these results contemplate the idea of alignment with classical psycholinguistic findings in human reading, where semantic anomalies are detected only after syntactic resolution, occurring later in the online processing sequence.
format Preprint
id arxiv_https___arxiv_org_abs_2511_19232
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle In Machina N400: Pinpointing Where a Causal Language Model Detects Semantic Violations
Zacharopoulos, Christos-Nikolaos
Kyriakoglou, Revekka
Computation and Language
Artificial Intelligence
How and where does a transformer notice that a sentence has gone semantically off the rails? To explore this question, we evaluated the causal language model (phi-2) using a carefully curated corpus, with sentences that concluded plausibly or implausibly. Our analysis focused on the hidden states sampled at each model layer. To investigate how violations are encoded, we utilized two complementary probes. First, we conducted a per-layer detection using a linear probe. Our findings revealed that a simple linear decoder struggled to distinguish between plausible and implausible endings in the lowest third of the model's layers. However, its accuracy sharply increased in the middle blocks, reaching a peak just before the top layers. Second, we examined the effective dimensionality of the encoded violation. Initially, the violation widens the representational subspace, followed by a collapse after a mid-stack bottleneck. This might indicate an exploratory phase that transitions into rapid consolidation. Taken together, these results contemplate the idea of alignment with classical psycholinguistic findings in human reading, where semantic anomalies are detected only after syntactic resolution, occurring later in the online processing sequence.
title In Machina N400: Pinpointing Where a Causal Language Model Detects Semantic Violations
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2511.19232