Learning to Recombine and Resample Data For Compositional Generalization

Ekin Akyürek, Afra Feyza Akyürek, Jacob Andreas

Researchers have developed R&R (Recombine & Resample), a learned data augmentation strategy that helps neural networks master "compositional generalization"—the ability to understand new combinations of known concepts. By training a generative model to mix and match existing training examples and filtering for rare phenomena, R&R allows standard models to learn complex new constructions from as few as eight examples.

The Challenge of Compositional Generalization

While neural sequence models (like those powering translation or voice assistants) are incredibly flexible, they are notoriously "un-systematic." If a human learns the word "dax" means to jump, they can immediately understand "dax twice" or "dax while turning left." Standard neural models usually cannot; they struggle to generalize to rare or unseen combinations of subsequences unless they have seen those exact patterns thousands of times.

Previously, researchers thought the only way to fix this was through "symbolic scaffolding"—forcing the model to use rigid grammars or logic-based rules. This paper asks a fundamental question: Can we achieve this "rule-like" behavior using only neural components by simply giving the model better, more diverse data to learn from?

Methods: Recombination and Resampling

The authors propose a two-step framework called R&R to automatically generate this diverse training data:

1. Recombination Instead of generating text from scratch, the authors train a "prototype-based" generative model that acts as a two-shot learner. It takes two existing training examples (prototypes) and learns to recombine their fragments to create a new, valid example.

The prototype-based generative model recombines fragments from two training examples using a copy mechanism to synthesize novel combinations.

For instance, it might take the structure of "walk twice" and the verb from "jump" to synthesize "jump twice." A gated copy mechanism is crucial here, allowing the model to precisely lift tokens from the prototypes rather than guessing them from a vocabulary.

2. Resampling Not all synthesized data is useful. The authors use a rejection sampling scheme to keep only the "informative" examples—specifically those that contain rare words or linguistic tags (like a rare "past tense" marker).

The R&R pipeline identifies rare tags in training data and generates augmented examples to improve test generalization on unseen combinations.

This resampling forces the final "student" model to pay more attention to the difficult, sparse parts of the data distribution. Finally, a standard, "off-the-shelf" neural model is trained on this newly augmented dataset.

Datasets and Key Results

The authors evaluated R&R on two distinct types of challenges, demonstrating significant improvements over baselines:

  • SCAN (Instruction Following): A synthetic benchmark testing compositional rules. It includes the famous "jump" split, where the verb "jump" only appears in a simple context during training but must be used in complex commands during testing. Where baseline models scored 0%, R&R achieved up to 87-100% accuracy. It also significantly outperformed previous state-of-the-art rule-based augmentation (GECA) on the "around right" split.
  • SIGMORPHON 2018 (Morphology): A natural language dataset for morphological analysis (e.g., predicting features like "3rd person, singular, past tense" from a word). Tested on Spanish, Swahili, and Turkish in "few-shot" scenarios where certain tenses were extremely rare, R&R proved highly effective. In Swahili, R&R reduced the error rate by 40% compared to the baseline and 21% compared to rule-based augmentation.

Key Insights

  • The "Distillation" Effect: Interestingly, the generative model used for augmentation isn't actually a great predictor on its own. However, by using it to generate a large volume of "noisy" but diverse examples, a standard model can "distill" the underlying rules and generalize much better than the generator could.
  • Recombination > Reweighting: The authors found that simply showing the model the rare examples more often (reweighting/resampling alone) wasn't enough. The model actually needs to see those rare tokens in new, recombined contexts to understand the underlying compositional rules.
  • Bypassing Symbols: R&R achieves performance comparable to (and sometimes better than) rule-based systems without requiring the researcher to write down manual grammars or symbolic logic.

Limitations and Future Work

While powerful, R&R has a few limitations. First is label noise: the generative model is far from perfect. In Turkish, only about 14% of the "novel" samples it generated were perfectly correct. While the student model can handle some noise, improving the generator's quality remains a priority. Second, the system currently relies on heuristic neighborhoods (like string edit distance) to pick which "prototypes" to recombine; future work could involve a learned retrieval system. Finally, training a generative model just to create data adds computational cost, though the authors note the entire process still takes less than an hour on a single GPU.

Summary updated

BibTeX
@inproceedings{akyurek2021learning,
  author = {Ekin Akyürek and Afra Feyza Akyürek and Jacob Andreas},
  title = {{Learning to Recombine and Resample Data For Compositional Generalization}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=NIlujK7lVak},
}
Figure