Transferability of Compositionality

1 INTRODUCTION . Human intelligence ( Minsky , 1986 ; Lake et al. , 2017 ) exhibits compositional generalization , the algebraic capacity to understand and produce large amount of novel combinations from known components ( Chomsky , 1957 ; Montague , 1970 ) . This capacity helps humans to recognize the world efficiently and to be imaginative . It is also beneficial to design machine learning algorithms with compositional generalization skills . Current neural network models , however , generally lack such ability . Compositional generalization is a type of out-of-distribution generalization ( Bengio , 2017 ) , where the training and test distributions are different . A sample in such a setting is a combination of several components , and the generalization is enabled by recombining the seen components of the unseen combination during inference . In the image domain , an object is a combination of many parts or properties . In the language domain , a compound word is a combination of multiple words . As an example , we consider two digits are overlapped ( Figure 1 ) . Each digit is a component , and it appears in training . A test example has a new combination of two digits . The main approach for compositional generalization is to learn compositional representations ( Bengio , 2013 ) , which contain several component representations . Each of them depends only on the underlying generative factor , and does not change when other factors change . We call this the compositionality property , and will formally introduce in Section 3 . In the digit example , this means that the representation of one digit does not change when the other digit changes . Multiple approaches have been proposed to learn compositional representations in the train distribution . However , little discussion has focused on whether the model can still extract the representations in the test distribution . We find that the extraction ability does not transfer naturally , because the extraction network suffers from the divergence of distributions ( Bengio , 2017 ; Pleiss et al. , 2020 ) , so that each extracted representation shifts away from the corresponding one in training . Our experiment on the digit example shows that the accuracy drops from 89.6 % in training to 49.3 % in test ( Table 1 in Section 5 ) . To address the problem , we hope each representation is consistent with the training one while reflecting the test sample . We use an auxiliary network , which has hidden representations as inputs , and the original input as output . For a test sample , we regularize each hidden representation in its training manifold , and optimize them to recover the original input . Then we use the optimized representations for prediction . Experimental results show that the proposed approach has more than a 20 % absolute increase in various experiments compared to baselines , and even outperforms humans on the overlapping digit task . Our contributions can be summarized as follows . • We raise and investigate the problem of transferability of compositionality to test distribution . This work is orthogonal to many efforts of learning compositionality in training distribution . • We propose to address the problem by using an auxiliary reconstruction network with regularized hidden representations as input , and optimize the representations during inference . • We empirically show that the transferability problem exists and the proposed approach has significant improvements over baselines . 2 RELATED WORK . Compositional generalization ( Chomsky , 1957 ; Montague , 1970 ) is critical in human cognition ( Minsky , 1986 ; Lake et al. , 2017 ; Johnson & et al , 2017 ; Higgins & et al , 2018 ; Lake et al. , 2019 ) . It helps humans to understand and produce large amount of novel combinations from known components . Broadly speaking , compositional generalization is a type of out-of-distribution ( o.o.d . ) transferring or generalization , which is also called domain adaptation ( Redko et al. , 2020 ) or concept drift ( Gama et al. , 2014 ) . This is different from traditional i.i.d . setting , where the training and the test distributions are identical . The transferring requires prior knowledge of how the distribution is changed , and compositional generalization has a particular form of such change , as mentioned in the later section . Compositional generalization is also a desirable property for deep neural networks . Human-level compositional learning ( Marcus , 2003 ; Lake & Baroni , 2018 ) has been an important open challenge ( Yang et al. , 2019 ; Keysers & et al , 2020 ) , although there is a long history of studying compositionality in neural networks . Classic view ( Fodor & Pylyshyn , 1988 ; Marcus , 1998 ; Fodor & Lepore , 2002 ) considers conventional neural networks lack systematic compositionality . With the breakthroughs in deep neural networks , there are more contemporary attempts to encode compositionality in deep neural networks . Compositionality in neural networks is actively explored for systematic behaviour ( Wong & Wang , 2007 ; Brakel & Frank , 2009 ) , counting ability ( Rodriguez & Wiles , 1998 ; Weiss et al. , 2018 ) and sensitivity to hierarchical structure ( Linzen et al. , 2016 ) . Researchers have also proposed multiple related tasks ( Lake & Baroni , 2018 ; Loula et al. , 2018 ; Lake et al. , 2019 ) and methods ( Lake et al. , 2017 ; Lake & Baroni , 2018 ; Loula et al. , 2018 ; Kliegl & Xu , 2018 ; Li et al. , 2019 ; Lake , 2019 ; Gorden et al. , 2020 ) for learning compositionality in training distribution . Another line of related work is independent disentangled representation learning ( Higgins et al. , 2017 ; Burgess et al. , 2018 ; Kim & Mnih , 2018 ; Chen et al. , 2018 ; Kumar et al. , 2017 ; Hsieh et al. , 2018 ; Locatello et al. , 2019 ; 2020 ) . Its main assumption is that the expected components are statistically independent in training data . This setting does not have transferring problem in test , because all combinations have positive joint probabilities in training ( please see Section 3 ) . More recently , there have been approaches for better compositional learning in NLP tasks by elaborating RNN models ( Bastings et al. , 2018 ) , by using pointer networks ( Kliegl & Xu , 2018 ) , or by using two representations of a sentence ( Russin et al. , 2019 ; Li et al. , 2019 ) . In these tasks , the input can be divided into words , which have consistent information in different distributions . However , such property is not always available , e.g . the overlapping digits . In this paper , we propose to acquire the compositional representations with optimization during inference . We will discuss more in the following sections . 3 COMPOSITIONALITY AND TRANSFERABILITY . In this section , we describe compositionality as a model property . We then argue that compositionality may not transfer to test distribution , and discuss ideas of the proposed approach . Compositionality Compositional generalization has different training and test distributions . Samples in both training and test data are combinations of K components . For example , in Figure 1 , input X has two digits X1 , X2 , and output Y has corresponding labels Y1 , Y2 . While a test sample ’ s combination does not appear in training , each component of the test sample appears in training . A key for compositional generalization is to have compositional representation , which has multiple component representations . Each component representation corresponds to an underlying input component , and it does not change when other components change . We call this property as compositionality . A compositional representation is computed from an entangled input , and the extraction network needs to output correct component representations . If the extraction network transfers to test distribution , the representations can be correctly extracted in test , so that the compositional generalization is enabled by recombining them . Transferability As mentioned above , to enable compositional generalization , there is an assumption that the property of compositionality should transfer to the test distribution . Since X1 , . . . , XK are entangled , the model has the entire X as input . However , input X has different distributions in training and test , so the extraction network suffers from the divergence of distributions ( Bengio , 2017 ; Pleiss et al. , 2020 ) . Hence , even if the model is trained to fit the compositionality property in the training distribution , the property is not guaranteed to transfer to the test distribution . We propose to obtain compositional representations not from the extractor but reversely from an auxiliary network . We extract compositional representations with optimization , and introduce regularization to make each hidden representation in the corresponding training manifold . We then use the optimized hidden representation for prediction . More details are provided in the next section . 4 APPROACH . In this section , we introduce the proposed approach from model architecture , training and inference perspectives . The architecture contains three modules , trained with routine end-to-end optimization . The inference , different from conventional procedure , includes three steps : extracts initial hidden representations ; optimizes hidden representations as module input ; predicts output . Figure 2 contains overall flowcharts , and Algorithm 1 is a summary for the approach . We describe details here . 4.1 MODEL ARCHITECTURE . The model takes a sample with input X and label Y . We have a representation extractor g with parameter φ , which takes X as input , and outputs K hidden representations H = H1 , . . . , HK : H = g ( X ; φ ) . We also have a prediction network f with parameter θ , which takes hidden representations H as input , and outputs Ŷ : Ŷ = f ( H ; θ ) . These networks can be some existing networks for compositionality learning . In addition to them , we have an auxiliary network h with parameters ψ , which takes hidden representations H as input , and combines them to output X̂ : X̂ = h ( H ; ψ ) . Algorithm 1 The proposed approach for training ( left ) and inference ( right ) . α , β , γ , η are hyper parameters . K is the number of components . M is the number of instances in memory . Training sample : X , Y 1 : H = H1 , . . . , HK = g ( X ; φ ) 2 : H ′ = H + η , ∈ N ( 0 , I ) 3 : Ŷ = f ( H ′ ; θ ) , X̂ = h ( H ′ ; ψ ) 4 : Ltrain = CE ( Y , Ŷ ) +αL2 ( X , X̂ ) + βL2 ( H ) 5 : θ̂ , φ̂ , ψ̂ = argminθ , φ , ψ Ltrain ( X , Y , θ , φ , ψ ) 6 : Memm = g ( Xm ; φ̂ ) , m = 1 , . . . , M Inference sample : X 1 : H init = g ( X ; φ̂ ) 2 : X̂ = h ( H ; ψ̂ ) 3 : Lmanf ( H ) = ∑K k=1 minm L2 ( Hk , Mem m k ) 4 : Linfer ( X , H ) = L2 ( X , X̂ ) + γLmanf ( H ) 5 : Ĥ = argminH Linfer ( X , H ) , H0 = H init 6 : Ŷ = f ( Ĥ ; θ̂ )

Summary: The paper introduces a “transferability of compositionality” problem and proposes an approach to alleviate it. The said problem may arise when one trains neural models to produce “compositional” representations of the input. In the paper “compositional representations” consist of multiple vectors which are supposed to correspond to semantically meaningful aspects of the input, for example different objects in the case of images or different parts of compound words in the case of linguistic inputs. The transferability problem arises when there is a difference between training and test distributions, namely when certain combinations of objects have different probabilities in training & testing. The proposed solution at inference time is to project object representations to the manifold of individual object representations. The manifold is estimated by saving representations of individual object representations from the training time.