Compositional generalization in semantic parsing with pretrained transformers

A. Emin OrhanarXiv 2021

Abstract

Compositional generalization—the ability to understand novel combinations of known concepts—remains a significant challenge for neural networks. This study investigates how large-scale pretraining influences this capability in semantic parsing tasks. By evaluating T5 architectures across diverse pretraining domains, including natural languages, programming languages, and biological sequences, we demonstrate that while pretraining generally enhances generalization, the benefit is highly dependent on the structural similarity between the pretraining and downstream domains.

Introduction

A fundamental goal of natural language processing is achieving compositional generalization. For instance, a model that understands "jump" and "twice" should ideally interpret "jump twice" without explicit training on that specific pair. While standard neural architectures often rely on pattern memorization, large-scale pretraining has shown promise in bridging this gap. This paper explores the boundaries of this transfer, asking whether pretraining data must share a language with the task, if non-natural languages like code provide useful priors, and where the limits of cross-domain transfer lie.

Experimental Setup

We evaluate variants of the Text-to-Text Transfer Transformer (T5) at Base and 3B/XL scales. To isolate the effects of pretraining, we compare models initialized with diverse datasets against "from scratch" baselines:

  • English (T5): Pretrained on the C4 corpus.
  • Multilingual (mT5): Pretrained on 101 languages.
  • Translation (Marian): A German-to-French NMT model with no English exposure.
  • Code (CodeT5): Pretrained on various programming languages.
  • Proteins (ProtTrans/pt5): Pretrained on massive protein sequence datasets.

These models are tested on two benchmarks: SCAN (navigation instructions to action sequences) and COGS (English sentences to logical forms).

Results: The Impact of Pretraining Domain

Our results indicate that the benefits of pretraining are robust but not universal.

Language and Code Transfer

Surprisingly, models pretrained on non-English data (Marian) or multilingual data (mT5) significantly outperformed scratch baselines on English tasks. This suggests that pretraining imparts general sequence-processing capabilities that are not vocabulary-dependent. Furthermore, pretraining on programming languages (CodeT5) yielded gains comparable to natural language pretraining, likely because semantic parsing shares structural similarities with the formal logic of code.

The Protein Wall

In contrast, pretraining on protein sequences (pt5) often resulted in negative transfer. On the SCAN benchmark, the protein-pretrained model performed worse than the scratch baseline, suggesting that the structural or lexical properties of biological sequences are too divergent to provide a useful prior for linguistic tasks.

Table 1: Performance of various models on the SCAN benchmark splits.

Scale and Generalization

A notable finding is the "Big Model Paradox." Large models (3B parameters) are exceptionally fragile when trained from scratch on small datasets, often failing entirely. However, when pretrained, these models achieve the highest generalization scores. This indicates that scale acts as a multiplier for learned knowledge rather than a substitute for it.

Table 2: Average exact match accuracy on the COGS benchmark.

Conclusion

Pretraining is a powerful tool for improving compositional generalization, even across disparate domains like translation or coding. However, the failure of protein-based models highlights that transferability requires a baseline level of structural or hierarchical similarity. Future research should investigate whether these benefits stem from specific linguistic knowledge or improved numerical initialization.

Summary updated

BibTeX
@misc{orhan2021compositional,
  author = {A. Emin Orhan},
  title = {{Compositional generalization in semantic parsing with pretrained transformers}},
  year = {2021},
  eprint = {2109.15101},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.15101},
}
Figure