Mutual Exclusivity Training and Primitive Augmentation to Induce Compositionality (2022)

Abstract: Recent datasets expose the lack of the systematic generalization ability in standard sequence-to-sequence models. In this work, we analyze this behavior of seq2seq models and identify two contributing factors: a lack of mutual exclusivity bias (one target sequence can only be mapped to one source sequence), and the tendency to memorize whole examples rather than separating structures from contents. We propose two techniques to address these two issues respectively: Mutual Exclusivity Training that prevents the model from producing seen generations when facing novel examples via an unlikelihood-based loss, and prim2primX data augmentation that automatically diversifies the arguments of every syntactic function to prevent memorizing and provide a compositional inductive bias without exposing test-set data. Combining these two techniques, we show substantial empirical improvements using standard sequence-to-sequence models (LSTMs and Transformers) on two widely-used compositionality datasets: SCAN and COGS. Finally, we provide analysis characterizing the improvements as well as the remaining challenges, and provide detailed ablations of our method.

## introduction human intelligence demonstrates systematic compositionality, the algebraic capacity to understand and produce a potentially infinite number of novel combinations of known components @xcite , in comprehending and generating natural language. however, a number of recent datasets, e.g., scan @xcite , cogs (kim and linzen, 2020), etc., provide clear evidence of the lack of systematic compositionality in state-of-the-art neural networks. by analogy with what humans do in meaningful learning @xcite , methods to solve this problem can be categorized into deductive learning and inductive learning methods. in deductive learning, the learner is first introduced to a general rule and then followed by specific examples where the rule is applied @xcite , while in inductive learning, the learner is first presented with abundant examples so that the learner can automatically infer the general rule by itself. under the context of compositional generalization, deductive learning approaches directly inject useful priors @xcite @xcite to the model; while inductive learning approaches utilize data augmentation @xcite to provide more accurate examples that facilitate the learning of compositionality. in this work, we focus on designing methods that do not require any specific architectural changes, so it is applicable to standard sequenceto-sequence (seq2seq) models, and propose both deductive and inductive learning paradigms. our deductive method is derived from an observation that when facing compositionally novel examples, models have a tendency to generate old patterns seen during training, hence leading to numerous mistakes. despite being a major challenge for models, humans avoid these mistakes by exploiting the mutual exclusivity (me) bias @xcite , i.e., if a concept is already associated with one expression, humans are less likely to associate a new expression to that concept. consequently, when given an unseen test input (expression), humans have the prior that this new input should not be mapped to a seen output (concept) that is already mapped to another input expression. inspired by the me bias, we propose a novel training framework mutual exclusivity training (met). given an input-output pair, met encourages the model to assign a high probability to the output given the input, and to not generate this out-put given any other inputs. we achieve this by first creating a randomly perturbed version of the input, and then adopting the unlikelihood loss @xcite on the perturbed input to penalize the generation of the original output. finally, we train the model using a joint loss of mle on the original batch and the unlikelihood loss. additionally, we explore another variant met-meta, where we embed the unlikelihood loss as the meta generalization objective of the maml framework (visualized in fig. 1 ). this meta-learning objective will provide more regularization on the gradient updates instead of the final optimization target. on cogs and scan, we see substantial improvements from both variants of met as long as the baseline seq2seq model has acceptable performance. met improves a transformer model from 76.1% to 80.6% on cogs, and improves an lstm model from 13.5% to 38.7% on scan mcd2. the two met variants also show interesting behavior differences. for transformers, met shows advantages on cogs, and met-meta show advantages on most of the scan tasks. despite the above improvements, a transformer model equipped with met may still struggle with very poor baselines. we hypothesize that this phenomenon may partially be because that the syntactic function to be generalized has not been applied to a sufficient number of distinct arguments in the training set. for instance, in the scan jump, the function "around left" is only paired with four different lexical arguments ("walk, run, look, turn"). this lack of argument diversity makes it easier for the model to memorize all these patterns, but harder to infer the syntactic rules with deductive learning. to alleviate this memorization problem, we propose prim2primx, a data augmentation method to promote generalization by automatically generating a large set of new lexical arguments for each syntactic function. as the number of distinct arguments for each function increases, memorizing each single example independently becomes more challenging, while the difficulty of understanding the compositional structure remains the same, which makes it a more encouraging behavior. specifically, the prim2primx procedure first builds a lexicon using a dataset-agnostic, rule-based word alignment algorithm. this lexicon contains the mapping between the input and the output form of each argument (e.g., "@xmath0, while ignoring functional words (e.g., "around") that only decide the syntactic structure of the outputs. then, to enrich the set of lexicons, we mutate each primitive ("@xmath1; @xmath2, and create new examples by swapping the primitive argument (prim) with its mutated form (primx) on both sides. our experiments (see sec. 4) provide evidence that supports our claim above: with 15 new primitives (5 per original primitive) added to the scan lexicon, the accuracy on the scan jump test set reaches 63.65% from the original performance of 3.49%. on cogs, with 2 new primitives per original one, prim2primx also improves the transformer performance from 76.14% to 80.07% accuracy. furthermore, we show that combining prim2primx and met can achieve further improvement. our prim2primx+met achieves 81.1% accuracy on cogs, and prim2primx+met-meta achieves 74.0% on scan jump. finally, we also provide detailed ablations about each component in our proposed methods, and an analysis characterizing our improvements and remaining challenges. overall, our contribution is two-fold: (1) we propose met, a novel, deductive training framework to inject mutual exclusivity bias into models; and (2) we propose prim2primx, a data augmentation method that automatically creates new arguments to facilitate inductive compositionality learning. both methods and their combination show substantial empirical improvements on scan and cogs. moreover, our methods are data and modelagnostic, and do not leak any test examples, so the improvements reveal the compositional generalization potential of general seq2seq models. ## conclusion we propose two methods to improve compositional generalization: (1) met, a mutual exclusivity biasinspired method implemented with unlikelihood training; and (2) prim2primx, a data augmentation procedure automatically diversifying the arguments of syntactic functions. empirical results demonstrate the effectiveness of both methods.