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

Revisiting the Compositional Generalization Abilities of Neural Sequence Models

Arkil Patel, Satwik Bhattamishra, Phil Blunsom, Navin Goyal

Introduction

Standard neural sequence models, such as Transformers and LSTMs, have long been criticized for their perceived inability to achieve "compositional generalization." This refers to the capacity to combine known components into novel structures—a feat humans perform effortlessly. For instance, if a person understands the command "jump" and the modifier "twice," they can immediately interpret "jump twice" even if they have never heard that specific combination before.

The popular SCAN benchmark was designed to test this specific ability in AI. Initial results were discouraging: models trained on "jump" in isolation and other actions in context (like "walk twice") frequently hit 0% accuracy when asked to generalize. This led to a widespread belief that standard architectures lack the necessary "inductive bias" for compositionality, prompting researchers to develop increasingly complex, specialized architectures. However, this paper suggests a different perspective: the failure may lie not in the model's architecture, but in the poverty of the training data.

Methodology: The Power of Primitive Diversity

The authors propose that standard models are "starved" for the right kind of training data. Rather than modifying the model architecture, they focused on curating the training set using a technique called "Adding More Primitives."

In the original SCAN dataset, models are exposed to only a few example words (e.g., run, walk, look) used in various compositional contexts. The authors expanded this by adding new, "meaningless" primitive words (e.g., swim, clap) that follow the same grammatical rules as the original set.

Conceptual overview of adding more primitives to the training set to enable compositional generalization.

Crucially, the "one-shot" challenge remains: the target word (e.g., jump) is still only seen once in isolation during training. However, by seeing dozens of other words used in hundreds of different compositional contexts, the model is given the opportunity to learn the underlying structural rules rather than just memorizing specific combinations.

Key Insights

The research highlights several critical findings regarding how models process compositional data:

  1. The Diversity Trigger: Models require variety to learn rules. When a model only sees three words being composed, it tends to memorize those specific instances. By increasing the number of primitives to 50 or more, the model recognizes a "slot" in the grammar where any primitive can be placed, allowing it to correctly process the isolated word (jump) in new contexts.
  2. Embedding Alignment: Analysis of the model's internal vector space reveals that as more primitives are added, the embedding of the isolated word moves closer to the embeddings of the well-known primitives. The model effectively learns that "jump" belongs to the same functional category as "walk" or "swim."
  3. The Capacity Paradox: Larger models with more parameters often performed worse on these tasks. Their high capacity allowed them to overfit by memorizing the training set, whereas smaller, more constrained models were forced to find the more efficient compositional rules.

Experimental Results

The impact of increasing primitive diversity was dramatic across multiple benchmarks, including SCAN, Colors (a low-resource mapping task), and COGS (a semantic parsing benchmark).

Accuracy of Transformer and LSTM models as a function of the number of extra primitives added to the training set.

On the SCAN "add jump" task, Transformers improved from near 0% to nearly 100% accuracy simply by increasing the number of primitives in the training set. Furthermore, the models became highly data-efficient; they could achieve high performance even when the total training set size was reduced to less than 20% of the original, provided the remaining data maintained high primitive diversity. The authors also demonstrated transferability: a model pre-trained on many primitives could learn and use a brand-new word compositionally almost instantly.

Conclusion and Future Work

This study "rehabilitates" standard neural sequence models by showing that their failure on compositional benchmarks was largely an artifact of data distribution rather than architectural flaws. When provided with sufficiently diverse examples, off-the-shelf Transformers and LSTMs can achieve near-perfect compositional generalization.

However, some limitations remain. Standard models still exhibit a "weaker" inductive bias compared to specialized architectures, as they require diverse data to succeed. Additionally, this work focuses on one-shot primitive generalization. Whether these data-centric improvements apply to "structural generalization"—handling deeper nesting or significantly longer sequences than those seen in training—remains an open question for future research.

Summary updated

BibTeX
@inproceedings{patel2022revisiting,
  author = {Arkil Patel and Satwik Bhattamishra and Phil Blunsom and Navin Goyal},
  title = {{Revisiting the Compositional Generalization Abilities of Neural Sequence Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=I3AUIM2zQ7C},
}
Figure