Grammatical Analysis of Pretrained Sentence Encoders with Acceptability Judgments

Alex Warstadt, Samuel R. BowmanarXiv 2019

Abstract

Recent work on evaluating grammatical knowledge in pretrained sentence encoders gives a fine-grained view of a small number of phenomena. We introduce a new analysis dataset that also has broad coverage of linguistic phenomena. We annotate the development set of the Corpus of Linguistic Acceptability (CoLA; Warstadt et al., 2018) for the presence of 13 classes of syntactic phenomena including various forms of argument alternations, movement, and modification. We use this analysis set to investigate the grammatical knowledge of three pretrained encoders: BERT (Devlin et al., 2018), GPT (Radford et al., 2018), and the BiLSTM baseline from Warstadt et al. We find that these models have a strong command of complex or non-canonical argument structures like ditransitives and passives. Sentences with long distance dependencies like questions challenge all models, but for these, BERT and GPT have a distinct advantage over the baseline. We conclude that recent sentence encoders, despite showing near-human performance on acceptability classification overall, still fail to make fine-grained grammaticality distinctions for many complex syntactic structures.

Introduction

Pretrained models such as BERT and GPT have fundamentally shifted the landscape of Natural Language Processing (NLP), frequently reaching or exceeding human-level performance on standard benchmarks. However, a high aggregate score on a benchmark like the Corpus of Linguistic Acceptability (CoLA) does not necessarily imply a deep, linguistically grounded understanding of grammar. It remains unclear whether these models are mastering the underlying mechanics of syntax or merely exploiting statistical regularities.

To address this, we present a fine-grained analysis of the grammatical knowledge within these "black box" encoders. By treating acceptability judgments as a probing task, we can determine where models succeed and where they fail across a diverse range of linguistic phenomena.

The CoLA Analysis Set

Our primary contribution is a new analysis set derived from the CoLA development set. We manually annotated 1,043 sentences with 13 major syntactic features and 59 minor features. These features cover a wide spectrum of English grammar, including argument types, binding, questions, and coordination.

Sample sentences from the analysis set illustrating the multi-label annotation of linguistic features.

As shown in Figure 1, each sentence can be associated with multiple linguistic phenomena. This multi-label approach allows for a nuanced evaluation of how specific syntactic complexities impact model performance.

Experimental Methodology

We evaluated three prominent sentence encoders:

  1. BERT: A bidirectional Transformer model.
  2. OpenAI GPT: A unidirectional Transformer model.
  3. BiLSTM: A standard recurrent neural network baseline.

For BERT and GPT, we followed standard fine-tuning procedures on the CoLA training set. For the BiLSTM, we trained a simple Multi-Layer Perceptron (MLP) classifier on top of frozen encoder weights. Performance was measured using the Matthews Correlation Coefficient (MCC), which accounts for class imbalances in the dataset.

Results and Analysis

The results across the 13 major syntactic categories reveal significant differences in model capabilities. BERT achieved the highest overall performance (0.582 MCC), followed by GPT (0.528 MCC), with both significantly outperforming the BiLSTM baseline (0.320 MCC).

Performance (MCC) of the CoLA Baseline, GPT, and BERT across 13 major syntactic categories compared to human performance.

Key Findings

  • Transformers and Long-Distance Dependencies: Transformers (BERT and GPT) show a clear advantage over the BiLSTM in handling long-distance dependencies, such as those found in questions and dislocated structures. This is likely due to the self-attention mechanism, which allows the model to relate distant words more effectively than the sequential processing of an RNN.
  • Success with Complex Argument Structures: All models demonstrated a relatively strong command of complex but local structures, such as passives and ditransitives.
  • The Persistence of the Human Gap: Despite their strengths, all models still lag behind human performance, which sits at approximately 0.70 MCC. The gap is most pronounced in categories like reflexive binding and complex questions.
  • Sensitivity to Sentence Length: Performance generally decreases as sentence length increases. The BiLSTM is particularly sensitive to length, showing sharp declines and inconsistent performance, whereas BERT and GPT exhibit a more gradual degradation.

Conclusion

While pretrained encoders have made remarkable strides, our fine-grained analysis shows that they have not yet achieved a human-like grasp of English syntax. They excel at local, non-canonical structures but struggle with dependencies that span the length of a sentence. This new analysis set provides a roadmap for future research, highlighting specific linguistic challenges that next-generation models must overcome to achieve true grammatical competence.

Summary updated

BibTeX
@misc{warstadt2019grammatical,
  author = {Alex Warstadt and Samuel R. Bowman},
  title = {{Grammatical Analysis of Pretrained Sentence Encoders with Acceptability Judgments}},
  year = {2019},
  eprint = {1901.03438},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1901.03438},
}
Figure