The Bag of Words Bottleneck in Text Encoders

597 concepts488 papers5 proposals

Consider two sentences: "The chef bit the dog" and "The dog bit the chef." To a human reader, the difference is stark and comical. Yet, to many state-of-the-art text encoders and vision-language models, these sentences map to nearly identical vector representations.

This phenomenon is known as syntactic blindness or the bag-of-words bottleneck. Despite the widespread adoption of advanced neural architectures like Transformers, many models continue to treat sentences as unordered collections of words rather than structured, hierarchical sequences. As a result, they struggle to capture word order, negation, and structural relationships.

The Mathematical Roots of Syntactic Blindness

To understand why this bottleneck occurs, we must look at how models compose the meaning of a phrase from individual word vectors.

Early compositional distributional semantics relied heavily on element-wise vector operations. As William Blacoe et al. demonstrated in A Comparison of Vector-based Representations for Semantic Composition, models that rely on simple addition or multiplication are inherently syntax-oblivious. Because addition and multiplication are commutative ($A + B = B + A$), any permutation of the same words yields the exact same sentence representation.

Edward Grefenstette et al. highlighted this limitation in Experimental Support for a Categorical Compositional Distributional Model of Meaning, noting that commutative operations fail to capture the directional relationships inherent in syntax, such as distinguishing between a subject and an object. When a model flattens a sentence into a simple vector sum, the structural hierarchy is permanently lost.

Commutative Composition (e.g., Addition):
"The dog" + "bit" + "the chef"  ===>  [ Vector X ]
"The chef" + "bit" + "the dog"  ===>  [ Vector X ]  (Identical Representation)

Even when models incorporate local context windows or complex recurrent layers, the pressure to compress an entire sentence into a single fixed-length vector often forces the network to prioritize broad lexical content over structural precision. Nghia The Pham et al. described this in Jointly optimizing word representations for lexical and sentential tasks with the C-PHRASE model as a bottleneck that disregards word order during inference, failing to leverage structural information when generating final sentential representations.

How Contrastive Objectives Re-introduce the Bottleneck

One might assume that modern deep models—which use explicit positional embeddings—are immune to this issue. However, the training objective can inadvertently re-introduce the bag-of-words bottleneck.

Consider contrastive vision-language models like CLIP. These models are trained to maximize the similarity between an image and its corresponding text caption within a massive batch of random negatives. Zhihong Chen et al. investigated this behavior in On the Difference of BERT-style and CLIP-style Text Encoders. They discovered that contrastive language-image pretraining prioritizes global semantic-visual alignment over grammatical structure.

Because the contrastive objective can be successfully solved by simply matching keywords (e.g., matching an image of a dog and a chef to a text containing "dog" and "chef"), the model learns to ignore fine-grained word order. This creates a trade-off: the model excels at broad cross-modal retrieval but suffers from a bag-of-words effect that limits its grammatical sensitivity.

Why Standard Benchmarks Missed the Problem

If text encoders are so insensitive to syntax, why do they perform exceptionally well on standard semantic similarity benchmarks?

The answer lies in a systemic bias within the evaluation metrics themselves. Felix Hill et al. demonstrated in Learning Distributed Representations of Sentences from Unlabelled Data that standard benchmarks overemphasize lexical overlap. Because most evaluation datasets pair sentences that share similar vocabularies, order-agnostic bag-of-words models frequently match or outperform sequence-aware architectures.

This reliance on lexical shortcuts was further exposed by Louis-Philippe Morency et al. in Visual Referring Expression Recognition: What Do Systems Actually Learn?. The authors found that removing relational terms like prepositions or verbs from input descriptions often had a negligible impact on model performance. The models were not reasoning about the structural or spatial logic of the language; they were simply treating the text as a collection of isolated keywords.

Exposing Blind Spots via Adversarial Evaluation

When models are forced to operate in environments where word order is the only differentiating factor, their performance collapses. Recent research has focused on building adversarial datasets to expose these blind spots.

In the multimodal domain, Jirayu Burapacheep et al. introduced the ColorSwap benchmark in ColorSwap: A Color and Word Order Dataset for Multimodal Evaluation. ColorSwap specifically tests color-object binding by forcing models to distinguish between pairs like "a white cat and a black vase" versus "a black cat and a white vase". State-of-the-art dual-encoder models frequently fail this test because their global similarity heuristics treat both captions as identical bags of words.

ColorSwap Adversarial Pair:
Caption A: "a white cat and a black vase"  ---\
                                               ===> CLIP treats these as nearly identical
Caption B: "a black cat and a white vase"  ---/

Similarly, in video retrieval, Avinash Madasu et al. developed an evaluation framework in ICSVR: Investigating Compositional and Syntactic Understanding in Video Retrieval Models. They discovered that current video retrieval architectures perform almost identically whether a caption is correctly ordered or completely shuffled, proving that these systems operate primarily as object-matching engines rather than syntax-aware interpreters.

This vulnerability extends to text-only dialogue evaluation. Ananya B. Sai demonstrated in Re-Evaluating ADEM: A Deeper Look at Scoring Dialogue Responses that learned evaluation metrics are easily fooled by simple adversarial attacks, such as reversing word order or jumbling sentences. Because the underlying metrics rely exclusively on semantic embeddings that lack structural awareness, nonsensical perturbations receive evaluation scores identical to coherent human responses.

Moving Beyond the Bag of Words

To overcome this structural limitation, researchers have explored alternative composition mechanisms that preserve syntax:

  • High-Rank Tensors: Instead of mapping relational words (like verbs or prepositions) to the same vector space as nouns, Edward Grefenstette et al. proposed representing them as high-rank tensors in Multi-Step Regression Learning for Compositional Distributional Semantics. In this framework, a verb acts as a function that operates on noun vectors, preserving the non-commutative, directional nature of grammar.
  • Syntax-Aware Pretraining: Jianpeng Cheng 0002 et al. introduced an architecture in Syntax-Aware Multi-Sense Word Embeddings for Deep Compositional Models of Meaning that jointly trains word embeddings and composition layers to recognize both semantic coherence and correct word order, ensuring that a word's vector representation shifts dynamically based on its grammatical position.
  • Translation-Based Objectives: Rather than relying on standard contrastive or pooling methods, Jannis Vamvas et al. leveraged neural machine translation probabilities in NMTScore: A Multilingual Analysis of Translation-based Text Similarity Measures. By evaluating text similarity through cross-likelihood translation probabilities, their approach inherently respects fine-grained syntactic details and named entity roles that standard sentence embeddings miss.

Ultimately, building models that truly understand language requires moving past simple lexical co-occurrence. True semantic comprehension relies not just on which words are present, but on how those words are structurally bound together.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 471 papers
  2. Version 1 · 2026-10-04 · 599 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_bag_of_words_limitation_bag_of_words_lim_a84107c8,
  title = {bag-of-words limitation (bag-of-words limitations)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/bag-of-words-limitation-bag-of-words-limitations/rdr_a84107c8e02d423e8c74b95dc9222f5f},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 2, frozen text):

@misc{lacuna_bag_of_words_limitation_bag_of_words_lim_a84107c8_v2,
  title = {bag-of-words limitation (bag-of-words limitations)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/bag-of-words-limitation-bag-of-words-limitations/rdr_a84107c8e02d423e8c74b95dc9222f5f/v/2},
  note = {Version 2, frozen 2026-10-04. Accessed 2026-11-20},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake