Assessing BERT's Syntactic Abilities
Written for the Research library (claude-opus-5-5) from the paper text, in our own words: the license "arXiv — non-exclusive licence to distribute" does not allow redistributing the text itself. Original — arxiv.org/pdf/1901.05287
Summary
This paper tests whether BERT handles English syntactic dependencies that earlier studies had probed in LSTMs. BERT is a Transformer built only on self-attention, with absolute position embeddings and no recurrent state, so it was not obvious that it would. Goldberg reuses three existing stimulus sets:
- naturally occurring Wikipedia agreement sentences from Linzen et al. (2016);
- nonce sentences from Gulordava et al. (2018), where content words are swapped for random words with the same part of speech and inflection, so the model can't rely on meaning;
- controlled minimal pairs from Marvin and Linzen (2018) for subject-verb agreement and reflexive anaphora.
Because BERT reads context in both directions, the focus verb is replaced with [MASK] and the rest of the sentence stays visible. The model counts as correct when it scores the right verb form above the wrong one. The pre-trained bert-base-uncased and bert-large-uncased models are used with no fine-tuning. Both get high accuracy on every test and usually beat the published LSTM numbers. The setups differ, so this comparison is only a rough guide. Still, the result goes against the expectation that attention-only models struggle with hierarchical structure, and it helped prompt later probing of syntax in pretrained Transformers.
Key points
-
Linzen et al. (2016) sentences: accuracy stays at 0.96–0.97 for both models with one to four agreement attractors. There are 24,031 sentences with one attractor and 254 with four.
-
Gulordava et al. (2018) nonce set (383 pairs): BERT Base scores 0.83 and BERT Large 0.80. The LSTM result reported in the original work is 74.1 ± 1.6.
-
Marvin and Linzen (2018) pairs, where BERT wins: BERT is far ahead on long-distance agreement. For example, across an object relative clause BERT Base scores 0.89 and the LSTM 0.50.
-
Marvin and Linzen (2018) pairs, where the LSTM wins: the LSTM is better only on sentential complements and short VP coordination. Goldberg attributes this to the LSTM overfitting those constructions. BERT Base often outperforms BERT Large.
-
Discarded stimuli: three kinds were removed.
- Negative polarity item (NPI) pairs, because they differ in two words.
- is/are cases in the naturalistic sets, because copular sentences give extra agreement cues.
- Verbs that are not single wordpieces in BERT's vocabulary. This removed 23,368 of 152,300 Marvin and Linzen pairs, 680 Linzen sentences and 28 Gulordava pairs.
Code is at github.com/yoavg/bert-syntax.
Cited by
- Unsupervised Domain Clusters in Pretrained Language Models
- On the Cross-lingual Transferability of Monolingual Representations
- Climbing towards NLU: On Meaning, Form, and Understanding in the Age of Data
- PIQA: Reasoning about Physical Commonsense in Natural Language
- Do Pretrained Contextual Language Models Distinguish between Hebrew Homograph Analyses?
- Assessing the Agreement Competence of Large Language Models
- Collocational bootstrapping: A hypothesis about the learning of subject-verb agreement in humans and neural networks
- What Does BERT Learn about the Structure of Language?
- How Can We Know What Language Models Know?
- Attention is Not Only a Weight: Analyzing Transformers with Vector Norms
- Revealing the Dark Secrets of BERT
- Can language models capture syntactic associations without surface cues? A case study of reflexive anaphor licensing in English control constructions
- Counting the Bugs in ChatGPT's Wugs: A Multilingual Investigation into the Morphological Capabilities of a Large Language Model
- Open Sesame: Getting inside BERT's Linguistic Knowledge
- Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference
- Recent Advances in Natural Language Processing via Large Pre-Trained Language Models: A Survey
- Language Models as Knowledge Bases?
- Intermediate-Task Transfer Learning with Pretrained Language Models: When and Why Does It Work?
- Pre-trained Models for Natural Language Processing: A Survey
- Null It Out: Guarding Protected Attributes by Iterative Nullspace Projection
- Probing Natural Language Inference Models through Semantic Fragments
- Masked Language Modeling and the Distributional Hypothesis: Order Word Matters Pre-training for Little
- Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models
- oLMpics -- On what Language Model Pre-training Captures
- 75 Languages, 1 Model: Parsing Universal Dependencies Universally
- Analyzing the Structure of Attention in a Transformer Language Model
- BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model
- ZeroGen: Efficient Zero-shot Learning via Dataset Generation
- TaBERT: Pretraining for Joint Understanding of Textual and Tabular Data
Cite
@misc{goldberg2019assessing,
title = {{Assessing BERT's Syntactic Abilities}},
author = {Goldberg, Yoav},
year = {2019},
doi = {10.48550/arxiv.1901.05287},
eprint = {1901.05287},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1901.05287}
}References
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jacob Devlin, Ming-Wei Chang, Ken-Jakob Uszkoreit, Llion Jones, Aidan N Gomez, ton Lee, and Kristina Toutanova. 2018. Ł ukasz Kaiser, and Illia Polosukhin. 2017. BERT: pre-training of deep bidirectional transformers for language Attention understanding. is… find
- BERT Large LSTM (M&L) Humans (M&L) \# Pairs (\# M&L Pairs) 1.00 0.86 0.86 0.97 0.85 0.85 0.85 0.81 0.99 0.82 0.94 0.99 0.90 0.61 0.57 0.56 0.50 0.52 0.84 0.71 0.96 0.93 0.82 0.82 0.85 0.88 0.85 0.82 0.78 0.79 120 (140) 1440 (1680) 720 (840) 400 (400) 19440 (22400) 9600 (11200) 19680 (22400) 19680 (224… find
- Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the ability of LSTMs to learn syntax-sensitive dependencie Transactions of the Association for Computational Linguistics, 4:521–535. find
- Rebecca Marvin and Tal Linzen. 2018. Targeted syntactic evaluation of language models. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1192–1202. find
- Gongbo Tang, Mathias Mller, Annette Rios, and Rico Sennrich. 2018. Why self-attention? a targeted evaluation of neural machine translatio In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4263–4272. find
- Ke Tran, Arianna Bisazza, and Christof Monz. 2018. The importance of being recurrent for modeling hierarchical structure In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4731–4736. find