Assessing Phrasal Representation and Composition in Transformers

Lang Yu, Allyson Ettinger

Abstract

While Transformer models like BERT and RoBERTa excel at many NLP tasks, this study reveals they are surprisingly poor at "composition"—the ability to combine word meanings into nuanced phrasal meanings. By testing models on "controlled" datasets where word overlap is removed (e.g., comparing "law school" to "school law"), the authors show that high performance on standard benchmarks is largely driven by simple word-matching rather than a sophisticated understanding of phrase structure.

Introduction

In human language, the meaning of a phrase is more than just the sum of its parts. For instance, the verb "ran" takes on different nuances in "horse ran" versus "color ran." This principle of compositionality is fundamental to linguistic understanding. While Transformer-based models have revolutionized NLP by providing contextualized representations for every token, it remains unclear how effectively they combine these individual word representations into coherent phrasal meanings.

Previous research suggested these models align well with human judgments of phrase similarity. However, this paper investigates whether such performance is a result of true compositional understanding or a "lexical shortcut"—where models appear to understand phrases simply because similar phrases often share the same words.

Methodology

The authors conduct a systematic, layer-by-layer analysis of several state-of-the-art Transformers (BERT, RoBERTa, DistilBERT, XLM-RoBERTa, and XLNet). They evaluate five distinct methods for extracting phrase representations:

  • CLS/SEP: Using the special classification or separator tokens.
  • Head-Word: The embedding of the phrase's syntactic head (approximated as the last word).
  • Avg-Phrase: An element-wise average of the phrase's constituent word embeddings.
  • Avg-All: An average of all tokens in the input sequence.

Controlled Filtering

To isolate composition from lexical effects, the authors introduced filtered datasets. The core innovation is the AB-BA test, which uses phrase pairs with identical word content but different meanings (e.g., "adult female" vs. "female adult"). If a model relies solely on lexical content, it will treat these as identical.

Examples of normal phrase pairs versus controlled AB-BA pairs where word content is identical but meaning differs.

The study utilizes the BiRD (Bigram Relatedness Dataset) for similarity ratings and PPDB 2.0 for paraphrase classification, alongside specialized subsets that control for word overlap.

Results and Analysis

The Overlap Illusion

On standard datasets, models show high correlation (~0.6–0.8) with human similarity judgments. However, when word overlap is removed in the controlled AB-BA subsets, this correlation plummets to near zero or stays below 0.3. This suggests that Transformers act primarily as sophisticated "bags of words" rather than compositional engines.

Layer-wise correlation with human similarity judgments on the BiRD dataset. The top row shows the full dataset, while the bottom row shows the significant performance drop on the controlled AB-BA subset.

Layer-wise Dynamics

In most models, phrasal information quality peaks early (often at Layer 1) and declines in deeper layers. This implies that as models optimize for pre-training tasks like Masked Language Modeling, they may discard nuanced compositional information. A notable exception is DistilBERT, where the CLS token shows a consistent increase in phrasal information through its final layers.

Paraphrase and Sense Selection

Paraphrase classification accuracy dropped from ~90% to near chance (~55-60%) when word overlap was controlled. While models performed well on "landmark" tests for sense disambiguation (e.g., shifting "ran" toward "gallop" in "horse ran"), the authors argue this may still be driven by lexical associations rather than structural composition. Providing full sentence context improves performance slightly, but overall scores remain low.

Conclusion

This research highlights a significant gap in the compositional capabilities of current Transformer models. While they are powerful tools for capturing lexical context, their ability to represent the structural nuances of phrases is limited and often masked by lexical shortcuts. Future work should explore architectures or training objectives that explicitly prioritize the encoding of complex compositional meanings rather than relying on high-dimensional aggregation of lexical content.

Summary updated

BibTeX
@inproceedings{yu2020assessing,
  author = {Lang Yu and Allyson Ettinger},
  title = {{Assessing Phrasal Representation and Composition in Transformers}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  url = {https://openreview.net/forum?id=34rOWYcxMty},
}
Figure