How is BERT surprised? Layerwise detection of linguistic anomalies
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 24 papers in the map (data through 14 Oct 2026). Builds on 20 of its 44 references that are in the map. First posted on arXiv 16 May 2021.
Builds on
20 of 44 references.
References · 20
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,811
- 2018A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attackscited by 1,485
- 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,059
- 2018Neural Network Acceptability Judgmentscited by 958
- 2020A Primer in BERTology: What we know about how BERT workscited by 815
- 2019BLiMP: The Benchmark of Linguistic Minimal Pairs for Englishcited by 564
- 2019What BERT is not: Lessons from a new suite of psycholinguistic diagnostics for language modelscited by 320
- 2018Colorless green recurrent networks dream hierarchicallycited by 213
- 2020A Systematic Assessment of Syntactic Generalization in Neural Language Modelscited by 165
- 2021Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detectioncited by 70
8 more
- 2018FRAGE: Frequency-Agnostic Word Representationcited by 47
- 2020Intrinsic Probing through Dimension Selectioncited by 45
- 2020A Benchmark of Medical Out of Distribution Detectioncited by 40
- 2020Do Neural Language Models Show Preferences for Syntactic Formalisms?cited by 30
- 2020Linguistic Profiling of a Neural Language Modelcited by 23
- 2020How well does surprisal explain N400 amplitude under different experimental conditions?cited by 18
- 2020A Matter of Framing: The Impact of Linguistic Formalism on Probing Resultscited by 12
- 2019Say Anything: Automatic Semantic Infelicity Detection in L2 English Indefinite Pronounscited by 2
Built on by
Citing papers per year: 2021: 3; 2022: 8; 2023: 4; 2024: 3; 2025: 3; 2026: 3.
24 papers.
Sort:
By area:
- 2023Explainability for Large Language Models: A Surveycited by 333
- 2022Outliers Dimensions that Disrupt Transformers Are Driven by Frequencycited by 55
- 2021A Closer Look at How Fine-tuning Changes BERTcited by 42
- 2023Characterizing Learning Curves During Language Model Pre-Training: Learning, Forgetting, and Stabilitycited by 35
- 2022Neural reality of argument structure constructionscited by 25
- 2022CAN-BERT do it? Controller Area Network Intrusion Detection System based on BERT Language Modelcited by 17
- 2024A Psycholinguistic Evaluation of Language Models' Sensitivity to Argument Rolescited by 14
- 2022Predicting Fine-Tuning Performance with Probingcited by 13
- 2023Investigating semantic subspaces of Transformer sentence embeddings through linear structural probingcited by 12
- 2025Linguistic Interpretability of Transformer-based Language Models: a systematic reviewcited by 7
- 2022Revisiting and Advancing Chinese Natural Language Understanding with Accelerated Heterogeneous Knowledge Pre-trainingcited by 6
- 2024Toward Informal Language Processing: Knowledge of Slang in Large Language Modelscited by 6
12 more
- 2022On the data requirements of probingcited by 4
- 2021Exploring the Capacity of a Large-scale Masked Language Model to Recognize Grammatical Errorscited by 2
- 2021Variation and generality in encoding of syntactic anomaly information in sentence embeddingscited by 2
- 2022Sentence Ambiguity, Grammaticality and Complexity Probescited by 1
- 2024Learning from Impairment: Leveraging Insights from Clinical Linguistics in Language Modelling Researchcited by 1
- 2026The Grammar of Transformers: A Systematic Review of Interpretability Research on Syntactic Knowledge in Language Modelscited by 1
- 2022Integrating Linguistic Theory and Neural Language Modelscited by 0
- 2023Make BERT-based Chinese Spelling Check Model Enhanced by Layerwise Attention and Gaussian Mixture Modelcited by 0
- 2025Detecting Spelling and Grammatical Anomalies in Russian Poetry Textscited by 0
- 2025Test-time reward-guided alignment of language models by importance sampling on pre-logit spacecited by 0
- 2026Finding Sense in Nonsense with Generated Contexts: Perspectives from Humans and Language Modelscited by 0
- 2026Do Language Models Encode Knowledge of Linguistic Constraint Violations?cited by 0
- 2026Do Language Models Encode Knowledge of Linguistic Constraint Violations?12 May 2026
- 2026Finding Sense in Nonsense with Generated Contexts: Perspectives from Humans and Language Models12 Feb 2026
- 2026The Grammar of Transformers: A Systematic Review of Interpretability Research on Syntactic Knowledge in Language Models9 Jan 2026
- 2025Test-time reward-guided alignment of language models by importance sampling on pre-logit space30 Oct 2025
- 2025Detecting Spelling and Grammatical Anomalies in Russian Poetry Texts7 May 2025
- 2025Linguistic Interpretability of Transformer-based Language Models: a systematic review9 Apr 2025
- 2024Learning from Impairment: Leveraging Insights from Clinical Linguistics in Language Modelling Research20 Dec 2024
- 2024A Psycholinguistic Evaluation of Language Models' Sensitivity to Argument Roles21 Oct 2024
- 2024Toward Informal Language Processing: Knowledge of Slang in Large Language Models2 Apr 2024
- 2023Make BERT-based Chinese Spelling Check Model Enhanced by Layerwise Attention and Gaussian Mixture Model27 Dec 2023
- 2023Investigating semantic subspaces of Transformer sentence embeddings through linear structural probing18 Oct 2023
- 2023Explainability for Large Language Models: A Survey2 Sep 2023
12 more
- 2023Characterizing Learning Curves During Language Model Pre-Training: Learning, Forgetting, and Stability29 Aug 2023
- 2022CAN-BERT do it? Controller Area Network Intrusion Detection System based on BERT Language Model17 Oct 2022
- 2022Predicting Fine-Tuning Performance with Probing13 Oct 2022
- 2022Sentence Ambiguity, Grammaticality and Complexity Probes13 Oct 2022
- 2022Revisiting and Advancing Chinese Natural Language Understanding with Accelerated Heterogeneous Knowledge Pre-training11 Oct 2022
- 2022Integrating Linguistic Theory and Neural Language Models20 Jul 2022
- 2022Outliers Dimensions that Disrupt Transformers Are Driven by Frequency23 May 2022
- 2022On the data requirements of probing25 Feb 2022
- 2022Neural reality of argument structure constructions24 Feb 2022
- 2021Variation and generality in encoding of syntactic anomaly information in sentence embeddings12 Nov 2021
- 2021Exploring the Capacity of a Large-scale Masked Language Model to Recognize Grammatical Errors27 Aug 2021
- 2021A Closer Look at How Fine-tuning Changes BERT27 Jun 2021
- 2023Explainability for Large Language Models: A Surveycited by 333
- 2022Outliers Dimensions that Disrupt Transformers Are Driven by Frequencycited by 55
- 2021A Closer Look at How Fine-tuning Changes BERTcited by 42
- 2023Characterizing Learning Curves During Language Model Pre-Training: Learning, Forgetting, and Stabilitycited by 35
- 2022Neural reality of argument structure constructionscited by 25
- 2022CAN-BERT do it? Controller Area Network Intrusion Detection System based on BERT Language Modelcited by 17
- 2024A Psycholinguistic Evaluation of Language Models' Sensitivity to Argument Rolescited by 14
- 2022Predicting Fine-Tuning Performance with Probingcited by 13
- 2023Investigating semantic subspaces of Transformer sentence embeddings through linear structural probingcited by 12
- 2022Revisiting and Advancing Chinese Natural Language Understanding with Accelerated Heterogeneous Knowledge Pre-trainingcited by 6
- 2024Toward Informal Language Processing: Knowledge of Slang in Large Language Modelscited by 6
- 2022On the data requirements of probingcited by 4
12 most cited of 22 All 22 (JSON)
- 2026Do Language Models Encode Knowledge of Linguistic Constraint Violations?12 May 2026
- 2026Finding Sense in Nonsense with Generated Contexts: Perspectives from Humans and Language Models12 Feb 2026
- 2026The Grammar of Transformers: A Systematic Review of Interpretability Research on Syntactic Knowledge in Language Models9 Jan 2026
- 2025Detecting Spelling and Grammatical Anomalies in Russian Poetry Texts7 May 2025
- 2024Learning from Impairment: Leveraging Insights from Clinical Linguistics in Language Modelling Research20 Dec 2024
- 2024A Psycholinguistic Evaluation of Language Models' Sensitivity to Argument Roles21 Oct 2024
- 2024Toward Informal Language Processing: Knowledge of Slang in Large Language Models2 Apr 2024
- 2023Make BERT-based Chinese Spelling Check Model Enhanced by Layerwise Attention and Gaussian Mixture Model27 Dec 2023
- 2023Investigating semantic subspaces of Transformer sentence embeddings through linear structural probing18 Oct 2023
- 2023Explainability for Large Language Models: A Survey2 Sep 2023
- 2023Characterizing Learning Curves During Language Model Pre-Training: Learning, Forgetting, and Stability29 Aug 2023
- 2022CAN-BERT do it? Controller Area Network Intrusion Detection System based on BERT Language Model17 Oct 2022
12 newest of 22 All 22 (JSON)