A Minimal Model for Compositional Generalization on g SCAN (2022)

Abstract: Whether neural networks are capable of compositional generalization has been a topic of much debate. Most previous studies on this subject investigate the generalization capabilities of state-of-the-art deep learning architectures. We here take a more bottom-up approach and design a minimal model that displays generalization on a compositional benchmark, namely, the gSCAN dataset. The model is a hybrid architecture that combines layers trained with gradient descent and a selective attention mechanism optimized with an evolutionary strategy. The architecture has around 60 times fewer trainable parameters than models previously tested on gSCAN, and achieves comparable accuracies on most test splits, even when trained only on a fraction of the dataset. On adverb to verb generalization accuracy, it outperforms previous approaches by 65 to 86%. Through ablation studies, neuron pruning, and error analyses, we show that weight decay and attention mechanisms facilitate compositional generalization by encouraging sparse representations divorced from irrelevant context. We find that the model’s sample efficiency can mainly be attributed to its selective attention mechanism.

## introduction compositionality is a core aspect of human cognition. it is what allows us to produce and understand infinite combinations of known concepts, be it in the realm of language, vision, or motor skills. regarding artificial intelligence (ai) systems, compositionality holds the promise of more human-like, robust generalization on out-of-distribution data, as well as increased sample efficiency. compositionality in neural networks has thus been the subject of numerous empirical investigations -with mixed results. several studies using a variety of deep neural network architectures have found that models either failed on compositional tasks or succeeded given enough data, but could do so without relying on systematic compositional rules @xcite @xcite @xcite @xcite . others found that such architectures could reach compositional solutions without being explicitly constrained to do so, but that this ability varied dramatically across random initializations of the same model @xcite @xcite . the main focus of these studies has been on testing whether state-of-the-art deep learning architectures are able to learn compositionally. we here take a different approach, namely that of specifically building a minimal model that is able to solve a set of compositional generalization tasks, then using this model as a tool for analyzing when and how generalization occurs. our dataset of choice for this investigation is gscan, a challenge benchmark for systematic generalization in grounded language understanding. the model we use is a hybrid architecture, containing some weights that are trained with gradient descent, some that are optimized with an evolutionary strategy, and some that are initialized randomly and left frozen. a detailed justification of these design choices is given in section 4.2. the architecture has around 60 times fewer trainable parameters than models previously tested on gscan, which allows us to run extensive ablation studies and error analyses to investigate factors contributing to generalization performance. we find that our best-performing model breaks down the gscan tasks into simpler, reusable parts and combines them using only 13 neurons in its final decision layer. it achieves accuracies comparable with previously proposed models on most test splits and outperforms them on adverb to verb generalization by 65 to 86%, even when trained on as little as 2% of the full dataset. ## background our architecture makes use of an echo-state network (esn) and the covariance matrix adaptation evolution strategy (cma-es) to reduce the number of learnable parameters needed (see section 4.2). as both are not commonly used in nlp, we here provide some background on these techniques. ## discussion the core of systematic generalization, namely, the ability to flexibly compose known parts, is not something neural networks seem incapable of -as long as they receive atomic units as inputs that are separated from irrelevant context. otherwise, they may overfit and learn solutions that only perform well on in-distribution data. seen from this perspective, factors identified as helpful to generalization, both in the literature and in this study, are all mechanisms that can contribute to learning atomic input units. weight decay facilitates this by serving as a kind of inductive simplicity bias @xcite . so do soft attention mechanisms, which filter out irrelevant inputs. so does the hard attention bottleneck employed in this paper, by decoupling content, which is only rele-figure 7 : distributions of split h accuracy sampled during training, for 5 different batch sizes vant for target identification, from location, which is only relevant for navigation @xcite . ## conclusion in summary, we build on tang et al.'s neuroevolution approach to selective attention and embed it in a hybrid model. we apply this model to the task of systematic generalization in grounded instruction following and explore the effect of various design decisions on out-of-distribution performance. we find that weight decay and attention mechanisms facilitate compositional generalization by encouraging sparse representations divorced from irrelevant context, and that selective attention dramatically improves the model's sample efficiency. we also find that, even without weight decay and attention, generalization performance may improve sporadically during training independent of in-distribution accuracy, especially with smaller batch sizes. studies on out-of-distribution generalization should therefore employ a sufficiently high number of training runs to obtain a reliable estimate of a models' generalization robustness. although our architecture is specific to the dataset at hand, the factors contributing to its performance are consistent with related work on systematic generalization and likely to apply to other situations as well. however, compositional generalization encompasses a wide range of skills and even within systematic generalization, solving one task, e.g., recombining shapes and colors, may not translate to another, e.g. recombining directions. several gscan tasks remain unsolved and likely require different inductive biases than the ones presented here. we hope that this closer look at the minimal requirements for generalization on the various gscan test splits can inform future work on this benchmark going forward.