Abstract
Inspired by cognitive neuroscience studies, we introduce a novel “decoding probing” method that uses the Benchmark of Linguistic Minimal Pairs (BLiMP) to probe internal linguistic characteristics in neural language models layer by layer. By treating the language model as the brain and its representations as “neural activations”, we decode grammaticality labels of minimal pairs from the intermediate layers’ representations. This approach reveals: 1) Self-supervised language models capture abstract linguistic structures in intermediate layers that GloVe and RNN language models cannot learn. 2) Information about syntactic grammaticality is robustly captured through the first third layers of GPT-2 and also distributed in later layers. As sentence complexity increases, more layers are required for learning grammatical capabilities. 3) Morphological and semantics/syntax interface-related features are harder to capture than syntax. 4) For Transformer-based models, both embeddings and attentions capture grammatical features but show distinct patterns. Different attention heads exhibit similar tendencies toward various linguistic phenomena, but with varied contributions.
Introduction
While Large Language Models (LLMs) demonstrate remarkable linguistic capabilities, understanding how and where they process specific rules remains a significant challenge. Traditional evaluation methods typically focus on a model's final output—for instance, whether it assigns a higher probability to a grammatical sentence than an ungrammatical one. However, cognitive neuroscience suggests that the most informative representations often reside in intermediate processing stages. This paper introduces "Decoding Probing" to provide a granular, layer-by-layer analysis of how linguistic features emerge within these "black box" architectures.
Decoding Probing Methodology
The authors introduce a method inspired by how neuroscientists decode mental states from neural signals like fMRI or ECoG data.
- Activations as Neural Signals: Internal activations (hidden states) and attention matrices are extracted from every layer of models like GPT-2 XL, ELMo, and GloVe when fed minimal pairs (e.g., "The cats annoy Tim" vs. "The cats annoys Tim").
- The Classifier: For each layer, a simple binary logistic regression classifier is trained to "decode" whether the input sentence is grammatical or ungrammatical based solely on those internal activations.
- Capture Depth: This metric identifies the first layer where the classifier reaches 99% of its maximum potential performance for a specific task.
- Complexity Mapping: Syntactic tree depth is calculated for sentences to determine if structural complexity correlates with the depth required for processing.
Datasets and Scope
The study utilizes the Benchmark of Linguistic Minimal Pairs (BLiMP), which includes 67 tasks covering 12 linguistic phenomena. These are categorized into:
- Morphology: e.g., subject-verb agreement.
- Syntax: e.g., filler-gap dependencies.
- Semantics-Syntax Interface: e.g., NPI licensing.
Results and Analysis
The Hierarchy of Difficulty
Not all grammatical rules are internalized at the same rate. The researchers found a clear hierarchy: Syntax is the "easiest" for the model to grasp, followed by Morphology, with the Semantics-Syntax Interface being the most difficult, requiring the greatest model depth to achieve high decoding accuracy.
Layer-wise Emergence and Complexity
In GPT-2 XL, most syntactic information is robustly captured within the first third of the model (approximately the first 16 layers of the 48-layer model). However, there is a clear linear correlation ($r = 0.58$) between sentence complexity and capture depth. As the syntactic tree of a sentence becomes deeper, the model requires more layers to effectively internalize its grammatical correctness.
Model Comparison and Attention Patterns
GPT-2 XL significantly outperformed RNN-based ELMo and static GloVe embeddings, particularly in morphology and semantic-syntax tasks where context is critical. Interestingly, while hidden states show incremental improvement as depth increases, attention matrices exhibit more "oscillatory" behavior. A limited set of specific attention heads (notably heads No. 8 and No. 16) consistently emerge as primary contributors across various linguistic phenomena, suggesting functional specialization within the Transformer architecture.
Conclusion and Future Work
This research demonstrates that LLMs capture abstract linguistic structures in their intermediate layers in a way that simpler models cannot. While the current work focuses on structural grammaticality, the authors acknowledge that this does not necessarily equate to conceptual understanding.
Future research will apply this decoding method to abstract concepts (using datasets like COMPS), extend the study to morphologically rich languages beyond English, and directly compare these "decoded" layers to actual human brain activity to see if the model's hierarchy mirrors biological language processing.
Summary updated