Elamur Research
☰
home / papers / 2019 / Assessing BERT's Syntactic Abilities

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.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

Fields: Other

Cited by

261 papers of our library cite it (of the 140673 whose bibliographies we read); 29 of them have a page here, 232 not yet.

Cite

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.1901.05287 · arXiv 1901.05287

@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

6 references, 0 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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