Pith. sign in

How is BERT surprised? Layerwise detection of linguistic anomalies

1 Pith paper cite this work. Polarity classification is still indexing.

1 Pith paper citing it
abstract

Transformer language models have shown remarkable ability in detecting when a word is anomalous in context, but likelihood scores offer no information about the cause of the anomaly. In this work, we use Gaussian models for density estimation at intermediate layers of three language models (BERT, RoBERTa, and XLNet), and evaluate our method on BLiMP, a grammaticality judgement benchmark. In lower layers, surprisal is highly correlated to low token frequency, but this correlation diminishes in upper layers. Next, we gather datasets of morphosyntactic, semantic, and commonsense anomalies from psycholinguistic studies; we find that the best performing model RoBERTa exhibits surprisal in earlier layers when the anomaly is morphosyntactic than when it is semantic, while commonsense anomalies do not exhibit surprisal at any intermediate layer. These results suggest that language models employ separate mechanisms to detect different types of linguistic anomalies.

fields

cs.CL 1

years

2025 1

verdicts

CONDITIONAL 1

representative citing papers

citing papers explorer

Showing 1 of 1 citing paper.

  • Detecting Spelling and Grammatical Anomalies in Russian Poetry Texts cs.CL · 2025-05-07 · conditional · none · ref 23 · internal anchor

    A new Russian poetry dataset and benchmark show that supervised classifiers trained on synthetic distortions detect grammatical defects (F0.5=0.86) while unsupervised and zero-shot methods perform near random.