NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Evaluating Compositionality in Sentence Embeddings

Ishita Dasgupta, Demi Guo, Andreas Stuhlmüller, Samuel Gershman, Noah D. Goodman · OpenReview

Abstract

Modern sentence embedding models often achieve high performance on Natural Language Inference (NLI) benchmarks, yet their true understanding of linguistic structure remains a subject of debate. This paper investigates whether state-of-the-art models like InferSent truly capture compositionality—the ability to derive meaning from the arrangement of words—or if they rely on word-level heuristics. By introducing a diagnostic "Comparisons" dataset, we demonstrate that these models fail on tasks requiring structural reasoning but can be significantly improved through exposure to more diverse, structured training data.

Introduction: The Compositionality Gap

A fundamental hallmark of human intelligence is compositionality: the capacity to combine a finite set of words into an infinite variety of meanings based on their structural relationships. For instance, a human easily distinguishes between "The dog bit the man" and "The man bit the dog."

While deep learning models have reached impressive accuracy on NLI tasks—which require determining if a premise entails, contradicts, or is neutral toward a hypothesis—it is unclear if they are "reasoning" or merely exploiting statistical shortcuts. If two sentences share high word overlap, a model might default to an "entailment" prediction without processing the actual syntax. This research probes whether current models are truly relational or simply sophisticated "bag-of-words" (BOW) systems.

Methodology

To evaluate these capabilities, the researchers focused on InferSent, a prominent sentence encoder. The architecture of InferSent, as shown in Figure 1, uses a dual-encoder setup to process premise and hypothesis inputs separately before combining them into a feature vector for classification.

The InferSent architecture uses dual sentence encoders to generate vectors u and v, which are then combined via concatenation, element-wise difference, and product before passing through fully-connected layers.

The Comparisons Dataset

The authors developed a new diagnostic dataset of approximately 44,000 sentence pairs designed to break word-level heuristics. The dataset consists of three categories:

  1. Same type: Sentences use identical words in different orders (e.g., "X is more Y than Z" vs. "Z is more Y than X").
  2. More-Less type: One sentence uses "more" while the other uses "less."
  3. Not type: Introduces negations that flip the logical relationship.

Key Insights: The "Ecological Validity" of Shortcuts

The study reveals that models are not inherently incapable of reasoning; rather, they are efficient learners of the data they are provided. In the standard SNLI (Stanford Natural Language Inference) benchmark, high word overlap is a statistically reliable predictor of entailment. Consequently, models learn this "shortcut" because it works most of the time within that specific dataset.

Furthermore, the researchers identified an "Antonym Trap." In the SNLI training set, the presence of antonyms (like "more" and "less") almost always indicates a contradiction. InferSent subsequently learns to flag any pair containing these words as a contradiction, regardless of whether the word order makes them logically equivalent.

Results and Discussion

On the new Comparisons dataset, a simple Bag-of-Words (BOW) baseline performed at chance levels (~50%). Surprisingly, the state-of-the-art InferSent model performed no better, scoring between 45% and 50%.

Confusion matrices for the BOW model demonstrate a heavy bias toward predicting 'Entailment' for 'Same type' and 'Not type' pairs due to high word overlap, regardless of the true logical label.

As illustrated in Figure 3, the BOW model's failure is rooted in the Overlap Bias. For "Same type" contradictions (which have 100% word overlap), the model incorrectly labels nearly all of them as Entailment. InferSent exhibited nearly identical behavior, incorrectly labeling 97% of such pairs as Entailment.

The "Cure" for Heuristic Bias

The most significant finding is that this failure is a result of "data poverty" rather than architectural limitations. When InferSent was retrained from scratch on a combination of SNLI and the new Comparisons data, it achieved 100% accuracy on the Comparisons dataset while maintaining its high performance (~85%) on SNLI. This proves that Recurrent Neural Networks (RNNs) can learn to prioritize structure and word order if the training data necessitates it.

Conclusion and Future Work

This research highlights that state-of-the-art sentence embeddings often default to simple heuristics when the training data does not sufficiently penalize them. While the "Comparisons" dataset provides a vital diagnostic tool, it is limited to specific linguistic structures like comparative adjectives and simple negations.

Future research will focus on:

  • Developing broader diagnostic datasets covering more complex human language structures.
  • Testing the transferability of compositional logic across different tasks.
  • Evaluating whether other architectures, such as Transformers or SkipThought, share these same heuristic biases.

Summary updated

BibTeX
@misc{dasgupta2018evaluating,
  author = {Ishita Dasgupta and Demi Guo and Andreas Stuhlmüller and Samuel Gershman and Noah D. Goodman},
  title = {{Evaluating Compositionality in Sentence Embeddings}},
  year = {2018},
  eprint = {1802.04302},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.04302},
}
Figure