A theoretically grounded characterization of feature representations 

A large body of work has explored how learned feature representations can be useful for a variety of downstream tasks . This is true even when the downstream tasks differ greatly from the actual objective used to ( pre ) train the feature representation . This observation underlies the success of , e.g. , few-shot learning , transfer learning and self-supervised learning , among others . However , very little is understood about why such transfer is successful , and more importantly , how one should choose the pre-training task . As a first step towards this understanding , we ask : what makes a feature representation good for a target task ? We present simple , intuitive measurements of the feature space that are good predictors of downstream task performance . We present theoretical results showing how these measurements can be used to bound the error of the downstream classifiers , and show empirically that these bounds correlate well with actual downstream performance . Finally , we show that our bounds are practically useful for choosing the right pre-trained representation for a target task . 1 INTRODUCTION . Since the ( re ) -discovery of neural networks for visual recognition , a plethora of work has observed that the feature representations trained on ImageNet generalize to many downstream tasks , even to new domains ( Donahue et al. , 2014 ; Kornblith et al. , 2019 ; Kolesnikov et al. , 2020 ; Wallace & Hariharan , 2020 ) . This observation , and the resulting gain in accuracy even with very limited labels , has heralded new research directions into other ways of learning representations , such as self-supervised learning ( Chen et al. , 2020 ) or meta-learning ( Snell et al. , 2017 ) . This growing field of representation learning has yielded ostensibly better and better feature representations . However , a closer look reveals many mysterious results . For example , meta-learning methods do not transfer across domains ( Guo et al. , 2020 ) and self-supervised representations struggle with fine-grained recognition ( Wallace & Hariharan , 2020 ) . These empirical results are extremely valuable , but do not provide a deeper understanding of the corresponding phenomena . On the other side of the spectrum , theoretical work on neural representations is illuminating , but often makes assumptions about models or tasks ( Du et al. , 2020 ; Arora et al. , 2019b ) . We lack a general understanding of which neural representations work well for a given task and why . In this paper , we take a first step towards such an understanding by developing lower and upper bounds on classifier accuracy based on data-driven properties of the feature space . Classical theoretical bounds focus entirely on the complexity of the classifier and ignore the feature space . In contrast , our bounds are based on two intuitive properties of the feature representation ( Figure 1 ) : ( a ) Local alignment , which is the degree to which nearby data points share labels , and ( b ) local congregation which is the degree to which data points embed close to each other . Intuitively , if the feature representation is locally aligned to the task , then any smooth classifier will be able to model the task well . If it is additionally congregated , then most test points will have nearby training instances , so the classifier will generalize well from limited data . We show that our bounds are not only intuitive and theoretically justified , but also predictive of actual performance in practical settings : on a large dataset of realistic few-shot tasks , we can use our bounds to pick the best pre-trained representation without any training . Taken together , our work is a first step towards a general , intuitive characterization of the feature space that is predictive of downstream classifier performance . 2 RELATED WORK . Analyzing transferability : The motivations of our work lie in understanding the empirical effectiveness of transferring feature representations from supervised ( Donahue et al. , 2014 ; Zhai et al. , 2019 ; Kolesnikov et al. , 2020 ) or self-supervised ( Goyal et al . ; Wallace & Hariharan , 2020 ; Chen et al. , 2020 ) tasks . With these successes on transfer , and with the availability of a large number of pretrained features trained on a wide variety of domains , there has been an increasing interest in predicting transferability , or in selecting the right features for a particular target task . The simplest approach is to train a classifier with every available pre-trained representation and pick the best performer ( Zamir et al. , 2018 ; You et al. , 2021 ) . This is both computationally expensive and requires lots of labeled data for the target task . If the pre-training task is a classification task with a known label space then the conditional distribution of targets given pre-training task labels is informative of transfer performance ( Tran et al. , 2019 ; Nguyen et al. , 2020 ) . However , this approach is difficult to apply if the pre-training task is not classification , or is inaccessible ( as with models trained on proprietary data ) . This inaccessibility of pre-training data is also a problem for approaches that match pre-training and target distributions ( Gao & Chaudhari , 2021 ) , or explicitly adapt the pre-training images or label space ( Cui et al. , 2018 ) . In contrast to these approaches , we focus on directly analyzing the pre-trained feature representation , which allows us to be agnostic to the actual task it was trained on . Our work is most similar in setup and motivation to work on measuring the alignment between feature representations and the target labels ( Huang et al. , 2021 ; Bao et al. , 2019 ) , but in addition to allowing model selection , yields intuitive and general bounds on accuracy . Our work is orthogonal to work on characterizing tasks and measuring task similarity ; this frequently requires pre-trained features in the first place ( Achille et al. , 2019 ; Wallace et al. , 2021 ; Song et al. , 2020 ; Dwivedi et al. , 2020 ; Dwivedi & Roig , 2019 ) . Analyzing feature representations : Our work is also related to research on understanding feature representations in general . Some of this work has focused on understanding invariance properties of convnet features ( Aubry & Russell , 2015 ) . Others have looked at what individual feature dimensions mean ( Agrawal et al. , 2014 ; Zeiler & Fergus , 2014 ; Szegedy et al. , 2013 ) . Still others have explored if and when features from pre-trained networks transfer well between tasks as a function of the layer chosen ( Yosinski et al. , 2014 ) or the architecture ( Kornblith et al. , 2019 ) . Recently these explorations have been extended to other representation learning techniques , notably self supervised techniques ( Wang & Isola , 2020 ; Wallace & Hariharan , 2020 ) . The insights from these explorations inspire our results . However , these explorations have been primarily empirical , and are therefore limited by the diversity of real world benchmarks that they experiment with . On the other end of the spectrum , there is prior work on theoretical analysis of transfer learning . This prior work often follows the framework proposed by Baxter ( 2000 ) , and in so doing makes assumptions about the distributions of the different tasks ( Maurer , 2009 ; Du et al. , 2020 ; Galanti et al. , 2016 ; Pentina & Lampert , 2014 ) . In contrast , our approach eschews these assumptions in lieu of data-driven measurements . Data-driven complexity measures have been explored before for analyzing neural network training dynamics and generalization . These measures include eigenvectors of the gram matrix between data points ( Arora et al. , 2019a ) , the variance and separation of class-specific manifolds ( Cohen et al. , 2020 ) , the underlying intrinsic dimensionality of the task ( Lampinen & Ganguli , 2018 ) or the mutual information between representations and the inputs or labels ( Shwartz-Ziv & Tishby , 2017 ) . The corresponding results can be used for analyzing feature representations as well . Our proposed measurements are similar , but are simpler to measure and potentially more intuitive . 3 PROBLEM SETUP . Suppose we are interested in mapping a space of inputs X to a space of targets Y . There is an underlying distribution D over X × Y . We have a feature representation φ : X → Rf which might be pre-trained on another dataset or task , which is inaccessible to us . We will assume that ‖φ ( x ) ‖ ≤ B . For ease of exposition in the paper , we focus on the task of binary classification ; the case of multiclass classification is similar . For binary classification , we write the label space as Y = { −1 , 1 } . Our classifier will use a scoring function that operates on feature space , h : Rf → R. The predicted label will then be sign ( h ( φ ( x ) ) ) , where if h ( φ ( x ) ) is 0 , we will arbitrarily assign a label of -1 . The set of possible functions h defines the hypothesis class for the classifier ; denote this byH . For most of our analysis , we primarily care about the smoothness of the functions in H. We will assume that all functions inH are Lipschitz continuous with Lipschitz constant less than W . Thus : h ( φ ( x ) ) − h ( φ ( x′ ) ) ≤W‖φ ( x ) − φ ( x′ ) ‖ ∀h ∈ H ( 1 ) We note that one such hypothesis class which is commonly used in practice is the class of linear classifiers of bounded norm : W = { v 7→ wTv ; ‖w‖ ≤W } . Because the zero-one loss , l∗ ( h ( φ ( x ) ) , y ) = I [ sign ( h ( φ ( x ) ) ) 6= y ] is difficult to analyze , we will use the following continuous upper bound which is standard in theoretical treatments ( Mohri et al. , 2018 ) l ( h ( φ ( x ) ) , y ) = min ( 1 , max ( 0 , 1− yh ( φ ( x ) ) ) ) ≥ l∗ ( h ( φ ( x ) ) , y ) ( 2 ) Our focus in this paper is to understand how the properties of the feature extractor φ affect the loss of the classifiers l ( h ( φ ( x ) ) ) . In particular , we wish to understand how φ impacts ( a ) the lowest average error that one can achieve , and ( b ) the true error when one generalizes from a small training set . We begin by first identifying the key properties of feature representations . 4 TWO PROPERTIES OF FEATURE REPRESENTATIONS . What properties should we use to characterize feature representations ? First , we should use properties that are easy to measure , potentially with limited labeled data . Second , these properties should be easy for human developers and practitioners to reason about . Third , they should correlate well with the final accuracy of downstream classifiers . In sum , we want simple , intuitive measurements of the feature space that are predictive of downstream accuracy . One kind of intuitive measurement is to look at what the feature representation considers as similar . In particular , we could look at pairs of examples that embed close to each other in feature space and ask if they are indeed similar in terms of their ground truth labels . We call this property local alignment . In particular , we make the following definition Definition 1 . Suppose α > 0 . The local alignment of the feature space φ , denoted by pφa ( α ) is the probability that two data points ( x , y ) , ( x′ , y′ ) ∼ D share a label given that they embed within a distance of α : pφa ( α ) , P ( y = y ′ ∣∣ ‖φ ( x ) − φ ( x′ ) ‖ ≤ α , ( x , y ) , ( x′ , y′ ) ∼ D ) ( 3 ) α here is a hyperparameter which governs the resolution at which we do the analysis . Note that this notion of local alignment is different from the alignment proposed by Wang & Isola ( 2020 ) : the latter looks at how often two data points that are semantically similar embed close to each other , while the former looks at how often two data points that embed close to each other are semantically similar . A feature space that is locally aligned per our definition may not actually be aligned per the definition of Wang & Isola ( 2020 ) because two very similar images may be embedded far away from each other . Local alignment alone may be meaningless if data points do not generally embed close to each other . We also need the feature space to be such that data points generally congregate : Definition 2 . Suppose α > 0 . The degree of congregation of the feature space φ , denoted by pφc , is the probability that two points x , x′ sampled from D embed within a distance of α : pφc ( α ) , P ( ‖φ ( x ) − φ ( x′ ) ‖ ≤ α|x , x′ ∼ D ) ( 4 ) We have α as a hyperparameter here too . We now use these notions of local alignment and congregation to analyze the downstream error of classifiers .

Summary: This paper proposes to study how feature representations are transferable to downstream tasks. It presents a theoretical characterization of such transfer, in terms of relatively intuitive concepts of congregation and alignment. Specifically, it presents various bounds on classifier's expected error, probability of high-error inputs, and Rademacher complexity. The paper validates these theoretical observations by experiments with transfer in visual settings, between supervised tasks, or to few-shot (+unlabeled data) transfer.