Linguistically-Informed Transformations (LIT): A Method forAutomatically Generating Contrast Sets

Chuanrong Li, Lin Shengshuo, Zeyu Leo Liu, Xinyi Wu, Xuhui Zhou, Shane Steinert-Threlkeld

Abstract

Although large-scale pretrained language models, such as BERT and RoBERTa, have achieved superhuman performance on in-distribution test sets, their performance suffers on out-of-distribution test sets (e.g., on contrast sets). Building contrast sets often requires human-expert annotation, which is expensive and hard to create on a large scale. In this work, we propose a Linguistically-Informed Transformation (LIT) method to automatically generate contrast sets, which enables practitioners to explore linguistic phenomena of interests as well as compose different phenomena. Experimenting with our method on SNLI and MNLI shows that current pretrained language models, although being claimed to contain sufficient linguistic knowledge, struggle on our automatically generated contrast sets. Furthermore, we improve models' performance on the contrast sets by applying LIT to augment the training data, without affecting performance on the original data.

Introduction

Large language models (LLMs) frequently achieve "superhuman" scores on standard NLP benchmarks, but they often do so by exploiting statistical shortcuts rather than demonstrating true linguistic understanding. When these models encounter contrast sets—examples where a minor, meaningful change is made to the input—their performance often collapses.

An example of a LIT-generated contrast set where a change in tense leads to a model misprediction.

A major bottleneck in evaluating model robustness is that creating these contrast sets usually requires human experts, making them expensive and difficult to scale. The Linguistically-Informed Transformations (LIT) framework addresses this by automating the creation of targeted perturbations that challenge a model's reasoning.

Methodology

LIT moves beyond simple word-swapping by utilizing deep linguistic theory to manipulate sentence meaning precisely. The pipeline consists of several key stages:

  1. Parsing: LIT uses the English Resource Grammar (ERG) and the ACE parser to convert a sentence into a semantic representation called Minimal Recursion Semantics (MRS). This acts as a logical map of the sentence.
  2. Transformation: Rules are applied to this logic map to modify specific features. For example, a rule might change the tense from past to future or insert a modality predicate like "may."
  3. Generation: The modified map is fed back into the ERG generator to produce a new, grammatically correct sentence.
  4. Selection: Since the grammar can produce multiple valid sentences, GPT-2 is used to rank the outputs by perplexity, selecting the most natural-sounding version.
A snippet of the Minimal Recursion Semantics (MRS) representation showing the 'TENSE' feature used for transformations.

Experimental Evaluation

The researchers evaluated LIT on two major Natural Language Inference (NLI) benchmarks: SNLI and MNLI. They generated transformed versions focusing on seven linguistic phenomena: polar questions, it-clefts, tense/aspect, modality, negation, passives, and subject-object swapping.

Key Results and Insights

  • Fragility of SOTA Models: Models like RoBERTa-large, which score ~90% on standard sets, plummeted to near 0% accuracy on specific transformed sets. For instance, on MNLI, accuracy dropped from 93.21% to 5.43% on certain tense-shifted sets.
  • Consistency as a Metric: The authors emphasize consistency—whether a model gives the same answer for a sentence and its label-preserving transformation. Models were found to be highly inconsistent, relying on surface patterns rather than meaning.
  • Robustness through Augmentation: By including LIT-generated examples in the training data, models "learned" the underlying linguistic phenomena. Accuracy on difficult contrast sets jumped from 5.43% to 99.10% without losing accuracy on original benchmarks.
  • Compositional Generalization: Models trained on simple LIT transformations showed a surprising ability to generalize to composed transformations (e.g., combining passive voice and future tense) even if they hadn't seen that specific combination during training.

Limitations and Future Work

While powerful, LIT relies on the English Resource Grammar (ERG), which is specific to English and requires significant expert labor to develop for other languages. Additionally, LIT currently transforms about 20% of sentences in SNLI/MNLI because the ERG is a "precision grammar" that may fail on messy or informal text. Future work involves improving automated labeling and expanding grammar coverage.

Summary updated

Abstract

Although large-scale pretrained language models, such as BERT and RoBERTa, have achieved superhuman performance on in-distribution test sets, their performance suffers on out-of-distribution test sets (e.g., on contrast sets). Building contrast sets often re-quires human-expert annotation, which is expensive and hard to create on a large scale. In this work, we propose a Linguistically-Informed Transformation (LIT) method to automatically generate contrast sets, which enables practitioners to explore linguistic phenomena of interests as well as compose different phenomena. Experimenting with our method on SNLI and MNLI shows that current pretrained language models, although being claimed to contain sufficient linguistic knowledge, struggle on our automatically generated contrast sets. Furthermore, we improve models' performance on the contrast sets by apply-ing LIT to augment the training data, without affecting performance on the original data.
BibTeX
@inproceedings{li2020linguistically,
  author = {Chuanrong Li and Lin Shengshuo and Zeyu Leo Liu and Xinyi Wu and Xuhui Zhou and Shane Steinert-Threlkeld},
  title = {{Linguistically-Informed Transformations (LIT): A Method forAutomatically Generating Contrast Sets}},
  booktitle = {BlackboxNLP @ EMNLP},
  year = {2020},
  url = {https://openreview.net/forum?id=8VKAqTMOVmj},
}
Figure