arXiv:2605.05197cs.CL2026-05ACL被引 1

语言模型隐含语法正确性判断能力,不依赖概率得分。

Implicit Representations of Grammaticality in Language Models

论文配图:Implicit Representations of Grammaticality in Language Models
图 1 · 摘自论文原文
  • 用线性探测器分析模型内部表示,识别语法正确性
  • 探测器在人工标注数据上表现优于语言模型概率
  • 跨语言通用性强,适合研究模型语法认知机制

语法正确性与句子概率是人类语言中两个不同概念。预训练语言模型虽以最大化语料库概率为目标,能生成语法正确的句子,并在严格控制的最小对比较中区分语法正确与错误句,但其字符串概率整体上无法清晰区分语法正确与错误句子。本研究探讨语言模型是否在内部表示中隐含独立于字符串概率的语法正确性区分。通过在自然语料库经扰动生成的语法正确与(合成)语法错误句子数据集上训练线性探测器,发现该探测器可泛化至人类标注的语法判断基准,且表现优于基于语言模型概率的判断。但在语义合理性基准(最小对中两句话均语法正确,仅语义合理程度不同)上,探测器表现劣于字符串概率。英语训练的探测器在多种其他语言的语法基准上也表现出非平凡的跨语言泛化能力。此外,探测分数与字符串概率相关性较弱。这些结果共同表明,语言模型在其隐藏层中确实在一定程度上习得了隐式的语法正确性区分。

原文摘要 · Abstract (English)

Grammaticality and likelihood are distinct notions in human language. Pretrained language models (LMs), which are probabilistic models of language fitted to maximize corpus likelihood, generate grammatically well-formed text and discriminate well between grammatical and ungrammatical sentences in tightly controlled minimal pairs. However, their string probabilities do not sharply discriminate between grammatical and ungrammatical sentences overall. But do LMs implicitly acquire a grammaticality distinction distinct from string probability? We explore this question through studying internal representations of LMs, by training a linear probe on a dataset of grammatical and (synthetic) ungrammatical sentences obtained by applying perturbations to a naturalistic text corpus. We find that this simple grammaticality probe generalizes to human-curated grammaticality judgment benchmarks and outperforms LM probability-based grammaticality judgments. When applied to semantic plausibility benchmarks, in which both members of a minimal pair are grammatical and differ in only plausibility, the probe however performs worse than string probability. The English-trained probe also exhibits nontrivial cross-lingual generalization, outperforming string probabilities on grammaticality benchmarks in numerous other languages. Additionally, probe scores correlate only weakly with string probabilities. These results collectively suggest that LMs acquire to some extent an implicit grammaticality distinction within their hidden layers.

语言模型语法判断内部表示线性探测

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。