Visual Representation Learning Does Not Generalize Strongly Within the Same Domain

1 INTRODUCTION . Humans excel at learning underlying physical mechanisms or inner workings of a system from observations ( Funke et al. , 2021 ; Barrett et al. , 2018 ; Santoro et al. , 2017 ; Villalobos et al. , 2020 ; Spelke , 1990 ) , which helps them generalize quickly to new situations and to learn efficiently from little data ( Battaglia et al. , 2013 ; Dehaene , 2020 ; Lake et al. , 2017 ; Téglás et al. , 2011 ) . In contrast , machine learning systems typically require large amounts of curated data and still mostly fail to generalize to out-of-distribution ( OOD ) scenarios ( Schölkopf et al. , 2021 ; Hendrycks & Dietterich , 2019 ; Karahan et al. , 2016 ; Michaelis et al. , 2019 ; Roy et al. , 2018 ; Azulay & Weiss , 2019 ; Barbu et al. , 2019 ) . It has been hypothesized that this failure of machine learning systems is due to shortcut learning ( Kilbertus * et al. , 2018 ; Ilyas et al. , 2019 ; Geirhos et al. , 2020 ; Schölkopf et al. , 2021 ) . In essence , machines seemingly learn to solve the tasks they have been trained on using auxiliary and spurious statistical relationships in the data , rather than true mechanistic relationships . Pragmatically , models relying on statistical relationships tend to fail if tested outside their training distribution , while models relying on ( approximately ) the true underlying mechanisms tend to generalize well to novel scenarios ( Barrett et al. , 2018 ; Funke et al. , 2021 ; Wu et al. , 2019 ; Zhang et al. , 2018 ; Parascandolo et al. , 2018 ; Schölkopf et al. , 2021 ; Locatello et al. , 2020a ; b ) . To learn effective statistical relationships , the training data needs to cover most combinations of factors of variation ( like shape , size , color , viewpoint , etc. ) . Unfortunately , the number of combinations scales exponentially with the number of factors . In contrast , learning the underlying mechanisms behind the factors of variation should greatly reduce the need for training data and scale more gently with the number of factors ( Schölkopf et al. , 2021 ; Peters et al. , 2017 ; Besserve et al. , 2021 ) . Benchmark : Our goal is to quantify how well machine learning models already learn the mechanisms underlying a data generative process . To this end , we consider four image data sets where each image is described by a small number of independently controllable factors of variation such as scale , color , or size . We split the training and test data such that models that learned the underlying mechanisms should generalize to the test data . More precisely , we propose several systematic out-of-distribution ( OOD ) test splits like composition ( e.g. , train = small hearts , large squares → test = small squares , large hearts ) , interpolation ( e.g. , small hearts , large hearts → medium hearts ) and extrapolation ( e.g. , small hearts , medium hearts → large hearts ) . While the factors of variation are independently controllable ( e.g. , there may exist large and small hearts ) , the observations may exhibit spurious statistical dependencies ( e.g. , observed hearts are typically small , but size may not be predictive at test time ) . Based on this setup , we benchmark 17 representation learning approaches and study their inductive biases . The considered approaches stem from un-/weakly supervised disentanglement , supervised learning , and the transfer learning literature . Results : Our benchmark results indicate that the tested models mostly struggle to learn the underlying mechanisms regardless of supervision signal and architecture . As soon as a factor of variation is outside the training distribution , models consistently tend to predict a value in the previously observed range . On the other hand , these models can be fairly modular in the sense that predictions of in-distribution factors remain accurate , which is in part against common criticisms of deep neural networks ( Greff et al. , 2020 ; Csordás et al. , 2021 ; Marcus , 2018 ; Lake & Baroni , 2018 ) . New Dataset : Previous datasets with independent controllable factors such as dSprites , Shapes3D , and MPI3D ( Matthey et al. , 2017 ; Kim & Mnih , 2018 ; Gondal et al. , 2019 ) stem from highly structured environments . For these datasets , common factors of variations are scaling , rotation and simple geometrical shapes . We introduce a dataset derived from celebrity faces , named CelebGlow , with factors of variations such as smiling , age and hair-color . It also contains all possible factor combinations . It is based on latent traversals of a pretrained Glow network provided by Kingma et al . ( Kingma & Dhariwal , 2018 ) and the Celeb-HQ dataset ( Liu et al. , 2015 ) . We hope that this benchmark can guide future efforts to find machine learning models capable of understanding the true underlying mechanisms in the data . To this end , all data sets and evaluation scripts are released alongside a leaderboard on GitHub . 1 2 PROBLEM SETTING y1 . . . yn x s Figure 1 : Assumed graphical model connecting the factors of variations y = ( y1 , ... , yn ) to observations x = g ( y ) . The selection variable s ∈ { tr , te } leads to different train and test splits ps ( y ) , thereby inducing correlation between the FoVs . Assume that we render each observation or image x ∈ Rd using a “ computer graphic model ” which takes as input a set of independently controllable factors of variation ( FoVs ) y ∈ Rn like size or color . More formally , we assume a generative process of the form x = g ( y ) , where g : Rn 7→ Rd is an injective and smooth function . In the standard independently and identically distributed ( IID ) setting , we would generate the training and test data in the same way , i.e. , we would draw y from the same prior distribution p ( y ) and then generate the corresponding images x according to g ( · ) . Instead , we here consider an OOD setting where the prior distribution ptr ( y ) during training is different from the prior distribution pte ( y ) during testing . In fact , in all settings of our benchmark , the training and test distributions are completely disjoint , meaning that each point can only have non-zero probability mass in either ptr ( y ) or pte ( y ) . Crucially , however , the function g which maps between FoVs and observations is shared between training and testing , which is why we refer to it as an invariant mechanism . As shown in the causal graphical model in Fig . 1 , the factors of variations y are independently controllable to begin with , but the binary split variable s introduces spurious correlations between the FoVs that are different at training and test time as a result of selection bias ( Storkey , 2009 ; Bareinboim & Pearl , 2012 ) . In particular , we consider Random , Composition , Interpolation , and Extrapolation splits as illustrated in Fig . 2 . We refer to §4.2 for details on the implementation of these splits . The task for our machine learning models f is to estimate the factors of variations y that generated the sample x on both the training and test data . In other words , we want that ( ideally ) f = g−1 . The main challenge is that , during training , we only observe data from ptr but wish to generalize to pte . Hence , the learned function f should not only invert g locally on the training domain supp ( ptr ( y ) ) ⊆ Rn but ideally globally . In practice , let Dte = { ( yk , xk ) } be the test data with yk drawn from pte ( y ) and let f : Rd 7→ Rn be the model . Now , the goal is to design and optimize the 1https : //github.com/bethgelab/InDomainGeneralizationBenchmark model f on the training set Dtr such that it achieves a minimal R-squared distance between yk and f ( xk ) on the test set Dte . During training , models are allowed to sample the data from all non-zero probability regions supp ( ptr ( y ) ) in whatever way is optimal for its learning algorithm . This general formulation covers different scenarios and learning methods that could prove valuable for learning independent mechanisms . For example , supervised methods will sample an IID data set Dtr = { ( yk , xk ) } with yk ∼ ptr ( y ) , while self-supervised methods might sample a data set of unlabeled image pairs Dtr = { ( xk , x̃k ) } . We aim to understand what inductive biases help on these OOD settings and how to best leverage the training data to learn representations that generalize . 3 INDUCTIVE BIASES FOR GENERALIZATION IN VISUAL REPRESENTATION LEARNING . We now explore different types of assumptions , or inductive biases , on the representational format ( §3.1 ) , architecture ( §3.2 ) , and dataset ( §3.3 ) which have been proposed and used in the past to facilitate generalization . Inductive inference and the generalization of empirical findings is a fundamental problem of science that has a long-standing history in many disciplines . Notable examples include Occam ’ s razor , Solomonoff ’ s inductive inference ( Solomonoff , 1964 ) , Kolmogorov complexity ( Kolmogorov , 1998 ) , the bias-variance-tradeoff ( Kohavi et al. , 1996 ; Von Luxburg & Schölkopf , 2011 ) , and the no free lunch theorem ( Wolpert , 1996 ; Wolpert & Macready , 1997 ) . In the context of statistical learning , Vapnik and Chervonenkis ( Vapnik & Chervonenkis , 1982 ; Vapnik , 1995 ) showed that generalizing from a sample to its population ( i.e. , IID generalization ) requires restricting the capacity of the class of candidate functions—a type of inductive bias . Since shifts between train and test distributions violate the IID assumption , however , statistical learning theory does not directly apply to our types of OOD generalization . OOD generalization across different ( e.g. , observational and experimental ) conditions also bears connections to causal inference ( Pearl , 2009 ; Peters et al. , 2017 ; Hernán & Robins , 2020 ) . Typically , a causal graph encodes assumptions about the relation between different distributions and is used to decide how to “ transport ” a learned model ( Pearl & Bareinboim , 2011 ; Pearl et al. , 2014 ; Bareinboim & Pearl , 2016 ; von Kügelgen et al. , 2019 ) . Other approaches aim to learn a model which leads to invariant prediction across multiple environments ( Schölkopf et al. , 2012 ; Peters et al. , 2016 ; HeinzeDeml et al. , 2018 ; Rojas-Carulla et al. , 2018 ; Arjovsky et al. , 2019 ; Lu et al. , 2021 ) . However , these methods either consider a small number of causally meaningful variables in combination with domain knowledge , or assume access to data from multiple environments . In our setting , on the other hand , we aim to learn from higher-dimensional observations and to generalize from a single training set to a different test environment . Our work focuses on OOD generalization in the context of visual representation learning , where deep learning has excelled over traditional learning approaches ( Krizhevsky et al. , 2012 ; LeCun et al. , 2015 ; Schmidhuber , 2015 ; Goodfellow et al. , 2016 ) . In the following , we therefore concentrate on inductive biases specific to deep neural networks ( Goyal & Bengio , 2020 ) on visual data . For details regarding specific objective functions , architectures , and training , we refer to the supplement .

Summary: This paper presents an empirical study of generalization in visual representation learning. The paper compares in-distribution (ID) generalization to out-of-distribution (OOD) generalization of three types -- interpolation, extrapolation, and composition. Datasets are constructed with several factors of variation where the training split exhibits some factors and the test split exhibits others, constructed to test the ID and OOD settings. A variety of different representation learning models with different kinds of inductive bias are tested. The main findings are that: 1) all models perform better ID than OOD, indicating that all methods fail to find the true underlying generative mechanisms that created the data, 2) when some factors are ID and others are OOD the ID factors are modeled well despite that the OOD factors may be modeled poorly, demonstrating a kind of modularity between the learning of different factors. The paper will be accompanied by a benchmark for others to improve on this task.