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

Compositional Generalization Requires Compositional Parsers

Pia Weißenhorn, Yuekun Yao, Lucia Donatelli, Alexander KollerarXiv 2022

Abstract

Modern sequence-to-sequence (seq2seq) models, such as BART and Transformers, demonstrate remarkable proficiency in lexical generalization but struggle significantly with structural generalization. This paper evaluates the performance of compositional parsers, specifically the Apply-Modify (AM) parser, against standard architectures on the COGS benchmark. Our analysis reveals that while seq2seq models fail on tasks involving novel syntactic structures and deep recursion, compositional parsers achieve near-perfect accuracy. These results suggest that an explicit compositional bias is a prerequisite for human-like linguistic productivity in artificial intelligence.

Introduction: The Challenge of Compositional Generalization

A hallmark of human language is "infinite productivity"—the ability to understand and generate an infinite number of novel sentences by combining a finite set of known components. In the context of Natural Language Processing (NLP), this is referred to as compositional generalization.

Current research distinguishes between two primary forms of generalization:

  1. Lexical Generalization: The ability to use a known word in a familiar syntactic structure. For example, if a model learns "The hedgehog ate," it should ideally understand "The baby liked the hedgehog" in a test setting.
  2. Structural Generalization: The ability to handle syntactic structures never encountered during training. A classic example is processing sentences with deep recursion, such as multiple nested prepositional phrases (e.g., "the dog of the man of the woman...").

While modern seq2seq models excel at lexical swaps, they often encounter a "structural wall," where performance collapses when the underlying geometry of the sentence changes. This paper investigates whether this failure is an inherent limitation of the seq2seq architecture and evaluates "compositional parsers" as a potential solution.

Structural generalization challenges: PP movement and recursion.

Methods: Seq2seq vs. Compositional Architectures

The researchers compared two distinct classes of models on a semantic parsing task:

  • Sequence-to-Sequence (Seq2seq) Models: This group includes BART (a powerful pre-trained Transformer) and standard LSTMs. These models treat semantic parsing as a translation task, mapping a string of words directly to a string of logical symbols.
  • Compositional Models: The primary focus is the AM parser (Apply-Modify parser). Unlike seq2seq models, the AM parser predicts a "graph fragment" for each word and utilizes a dependency tree to dictate how these fragments combine according to the rules of AM algebra.

To further isolate the impact of syntactic knowledge, the authors developed BART+syn, a version of the model provided with "gold" (perfect) syntactic trees as input. This allowed the researchers to test whether simply "knowing" the structure is sufficient for seq2seq models to generalize.

Example of a semantic graph target.

The COGS Benchmark

The models were evaluated using the COGS (Compositional Generalization Challenge based on Semantic Interpretation) dataset. COGS is a synthetic benchmark that maps English sentences to logic-based meaning representations. It contains 21 specific "generalization types" designed to test linguistic rules, such as the movement of a prepositional phrase from an object to a subject position.

Key Insights and Results

The Structural Wall and Recursion

The study confirms that seq2seq models are essentially "template learners." They are highly effective at filling slots in known templates but fail to extrapolate to new ones. This is most evident in tasks involving recursion. While BART's accuracy is near 100% at a recursion depth of 2, it drops to nearly 0% by depth 6. In contrast, the AM parser maintains ~100% accuracy through depth 12, demonstrating that it has learned the underlying rule of recursion rather than memorizing instances.

Syntax is Not a Panacea

Interestingly, even when BART is provided with the exact syntactic structure of a sentence (BART+syn), it still fails to generalize structurally. This suggests that the issue is not merely a lack of syntactic awareness, but rather that the internal mechanism of seq2seq models for mapping syntax to meaning is fundamentally non-compositional.

Performance Summary

  • Overall Accuracy: Compositional models (LeAR and AM+B+dist) achieved 98-99% accuracy on the COGS generalization set.
  • Seq2seq Failure: Standard BART achieved an overall accuracy of ~77%, but this figure masks a 0% success rate on critical structural tasks like "Object PP to Subject PP."
  • Lexical Success: All models performed well on lexical generalization tasks, indicating that this aspect of NLU is largely solved.

Conclusion

The findings of this paper strongly suggest that architectural structure matters more than data volume for achieving true compositional generalization. Compositional parsers like the AM parser, which incorporate explicit structural biases, are far more robust than standard seq2seq models when faced with novel sentence geometries. Future research should focus on scaling these compositional approaches to handle the inherent noise and ambiguity of real-world natural language.

Summary updated

BibTeX
@misc{weienhorn2022compositional,
  author = {Pia Weißenhorn and Yuekun Yao and Lucia Donatelli and Alexander Koller},
  title = {{Compositional Generalization Requires Compositional Parsers}},
  year = {2022},
  eprint = {2202.11937},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.11937},
}
Figure