Linear representations of grammaticality in neural language models

📅 2026-07-16
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study investigates whether neural language models encode grammaticality as an independent dimension in their internal representations, rather than relying solely on probabilistic or surface-level statistical cues. Employing mass-mean probing, the authors systematically analyze sentence embeddings from pretrained models to assess their capacity to distinguish grammatical from ungrammatical sentences while controlling for confounding factors such as lexical frequency and semantic plausibility. The work provides the first representational-level evidence that grammaticality exists as a distinct, identifiable feature in model representations. Results demonstrate that multiple mainstream architectures consistently separate grammatical and ungrammatical constructions, with this capability generalizing across diverse syntactic phenomena and, to some extent, across languages—thereby moving beyond traditional evaluation paradigms based solely on output probabilities.
📝 Abstract
Whether neural language models (NLMs) possess the ability to distinguish strings on the basis of their grammaticality remains a debated topic in the computational linguistics literature. Existing evidence has largely relied on probability-based measures, testing whether models assign higher probabilities to grammatical than ungrammatical strings. However, probability comparisons have been criticized as a measure for grammatical knowledge based on the assumption that grammaticality is inherently entangled with likelihood. Model-assigned probability is a function of many related sentence properties, such as lexical frequency, plausibility, and world knowledge. In this work, we move beyond probability-based evaluations and investigate whether grammaticality is encoded in the internal representations of NLMs. Using mass-mean probing, we test whether grammatical and ungrammatical sentences are systematically separated in representational space. We further examine the extent to which these representations are independent of sentence properties that are correlated with grammaticality, as well as their generalization across grammatical phenomena and languages. Our results provide evidence that grammaticality is robustly encoded in sentence representations of a wide range of pretrained NLMs, yielding clear representational separation on the dimension of grammaticality that cannot be fully explained by alternative sentence-level factors. Moreover, this encoding generalizes across a broad range of grammatical phenomena and to some degree, across languages, suggesting that grammaticality constitutes a coherent representational dimension in contemporary NLMs. These findings contribute new evidence to debates about the nature of syntactic knowledge in language models and offer a complementary framework for evaluating grammatical competence that is not dependent on string probabilities alone.
Problem

Research questions and friction points this paper is trying to address.

grammaticality
neural language models
internal representations
syntactic knowledge
sentence probability
Innovation

Methods, ideas, or system contributions that make the work stand out.

grammaticality
neural language models
representational probing
mass-mean probing
cross-lingual generalization