Real-World Compositional Generalization with Disentangled Sequence-to-Sequence Learning

Hao Zheng, Mirella Lapata

Introduction

Human language is inherently compositional: an individual who understands the concepts of "red" and "ball" can immediately comprehend the phrase "red ball," even if they have never encountered that specific combination before. While this ability is fundamental to human intelligence, modern Transformer-based sequence-to-sequence models frequently struggle with it. These models tend to memorize specific training patterns, leading to failure when known components are rearranged into novel structures during testing.

Previous attempts to address this, such as the Dangle model, utilized a "re-encoding" mechanism that refreshed source text representations at every decoding step. While effective for generalization, this approach is computationally expensive, making it impractical for real-world applications involving long sequences or large-scale document translation.

The R-Dangle Architecture

To bridge the gap between compositional robustness and computational efficiency, researchers from the University of Edinburgh developed R-Dangle (Real-world Dangle). This model introduces two primary innovations:

  1. Periodic Re-encoding: Instead of re-encoding the source at every single step, R-Dangle performs this operation at fixed intervals (e.g., every 5 or 10 tokens). Between these refreshes, the model utilizes standard, efficient decoding. This significantly reduces the memory and time overhead associated with specialized representations.
  2. Disentangled Keys and Values: In standard attention mechanisms, keys (used for information retrieval) and values (the information itself) are often derived from the same underlying representation. R-Dangle separates them by encoding values once at the start while adaptively re-encoding keys at specified intervals. This forces the model to decouple the semantic content from its contextual relationship to the current decoding state.

Datasets and the ReaCT Benchmark

The study evaluates R-Dangle across several benchmarks, including CoGnition (English-Chinese translation) and SMCalFlow-CS (complex semantic parsing for calendar management).

A significant contribution of this work is the introduction of ReaCT, a REAl-world dataset for Compositional generalization in machine Translation. Unlike synthetic "toy" datasets, ReaCT is derived from naturally occurring text in the IWSLT and WMT datasets. The authors used a novel metric based on n-gram matching and uncertainty estimation to isolate test examples that represent truly novel compositions of training data.

Comparison of ReaCT with existing compositional generalization datasets, highlighting its significantly higher compositional degree and n-gram diversity.

Key Results and Efficiency

R-Dangle achieves state-of-the-art performance while maintaining practical efficiency. On the CoGnition benchmark, it reached a new best-in-class BLEU score of 63.4. In the more computationally demanding SMCalFlow-CS task, R-Dangle demonstrated a 4x speedup by utilizing a re-encoding interval of 40, while still achieving 50.3% accuracy—a substantial improvement over vanilla Transformers.

The relationship between performance gains and compositional degree (a), and the trade-off between training time and accuracy across different re-encoding intervals (b).

Analysis reveals that the benefit of R-Dangle increases as the "compositional degree" of the test example rises. This indicates that the model is particularly effective at handling the "long-tail" of rare word combinations that typically cause standard models to fail.

Discussion and Future Work

The findings suggest that language possesses a local structure where a full contextual "refresh" is not required at every token. However, the optimal interval for re-encoding appears to be task-dependent; translation tasks benefit from shorter intervals, while semantic parsing can tolerate larger ones.

Future research may explore dynamic re-encoding, where the model learns to autonomously decide when to re-read the source text based on its internal uncertainty or the complexity of the current decoding context, potentially further optimizing the balance between speed and accuracy.

Summary updated

BibTeX
@inproceedings{zheng2023real,
  author = {Hao Zheng and Mirella Lapata},
  title = {{Real-World Compositional Generalization with Disentangled Sequence-to-Sequence Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.108},
}
Figure