Information distance for neural network functions

1 INTRODUCTION . Deep neural networks can be trained to represent complex functions that describe sophisticated input-output relationships , such as image classification and machine translation . Because the functions are highly non-linear and are parameterized in high-dimensional spaces , there is relatively little understanding of the functions represented by deep neural networks . One could interpret deep models by linear approximations ( Ribeiro et al. , 2016 ) , or from the perspective of piece-wise linear functions , such as in ( Arora et al. , 2018 ) . If the space of functions representable by neural networks admits a distance measure , then it would be a useful tool to help analyze and gain insight about neural networks . A major difficulty is the vast number of possibilities of parameterizing a function , which makes it difficult to characterize the similarity given two networks . Measuring similarity in the parameter space is straightforward but is restricted to networks with the same structure . Measuring similarity at the output is also restricted to networks trained on the same task . Similarity of representations produced by intermediate layers of networks is proved to be more reliable and consistent ( Kornblith et al. , 2019 ) , but is not invariant to linear transformations and can fail in some situations , as shown in our experiments . In this paper , we provide a distance measure of functions based on information distance ( Bennett et al. , 1998 ) , which is independent of the parameterization of the neural network . This also removes the arbitrariness of choosing “ where ” to measure the similarity in a neural network . Information distance has mostly been used in data mining ( Cilibrasi & Vitányi , 2007 ; Zhang et al. , 2007 ) . Intuitively , information distance measures how much information is needed to transform one function to the other . We rely on prequential coding to estimate this quantity . Prequential coding can efficiently encode neural networks and datasets ( Blier & Ollivier , 2018 ) . If we regard prequential coding as a compression algorithm for neural networks , then the codelength can give an upper bound of the information quantity in a model . We propose a method for calculating an approximated version of information distance with prequential coding for arbitrary networks . In this method , we use KL-divergence in prequential training and coding , which allow us to directly estimate the expected codelength without any sampling process . Then we perform experiments to demonstrate that this information distance is invariant to the parameterization of the network while also being faithful to the intrinsic similarity of models . Using information distance , we are able to sketch a rough view into the space of deep neural networks and uncover the relationship between datasets and models . We also found that information distance can help us understand regularization techniques , measure the diversity of models , and predict a model ’ s ability to generalize . 2 METHODOLOGY . Information distance measures the difference between two objects by information quantity . The information distance between two functions fA and fB can be defined as ( Bennett et al. , 1998 ) : d ( fA , fB ) = max { K ( fA|fB ) , K ( fB |fA ) } ( 1 ) This definition makes use of Kolmogorov complexity : K ( fB |fA ) is the length of the shortest program that transforms fA into fB , and information distance d is the larger length of either direction . ( Note that this is not the only way to define information distance with Kolmogorov complexity , however we settle with this definition for its simplicity . ) Intuitively , this is the minimum number of bits we need to encode fB with the help of fA , or how much information is needed to know fB if fA is already known . Given two functions fA : X → Y and fB : X → Y ′ defined on the same input space X , each parameterized by a neural network with weights θA and θB , we want to estimate the information distance between fA and fB . The estimation of Kolmogorov complexity term is done by calculating the codelength of prequential coding , so what we get is an upper bound of d , which we denote by dp ( p for prequential coding ) . 2.1 ESTIMATING K ( fB |fA ) WITH PREQUENTIAL CODING To send fB to someone who already knows fA , we generate predictions yi from fB using input xi sampled from X . Assume that { xi } is known , we can use prequential coding to send labels { yi } . If we send enough labels , the receiver can use { xi , yi } to train a model to recover fB . If fA and fB have something in common , i.e . K ( fB |fA ) < K ( fB ) , then with the help of fA we can reduce the codelength used to transmit fB . A convenient way of doing so is to use θA as the initial model in prequential coding . The codelength of k samples is : Lpreq ( y1 : k|x1 : k ) : = − k∑ i=1 log pθ̂i ( yi|x1 : i , y1 : i−1 ) ( 2 ) where θ̂i is the parameter of the model trained on { x1 : i−1 , y1 : i−1 } , and θ̂1 = θA . With sufficient large k , the function parameterized by θ̂k would converge to fB . If both fA and fB are classification models , we can sample y from the output distribution of fB . In this case , the codelength ( 2 ) not only transmits fB , but also k specific samples we draw from fB . The information contained in these specific samples is ∑k i=1 log pθB ( yi|xi ) . Because we only care about estimating K ( fB |fA ) , using the “ bits-back protocol ” ( Hinton & van Camp , 1993 ) the information of samples can be subtracted from the codelength , resulting in an estimation of K ( fB |fA ) as Lk ( fB |fA ) : Lk ( fB |fA ) = − k∑ i=1 log pθ ( yi|x1 : i , y1 : i−1 ) + k∑ i=1 log pθB ( yi|xi ) ( 3 ) In practice , we want to use k sufficiently large such that fθ̂k can converge to fB , for example by the criterion Ex [ DKL ( fB ( x ) ||fθ̂k ( x ) ) ] ≤ ( 4 ) However , empirically we found that this often means a large k is needed , which can make the estimation using ( 3 ) unfeasible when the number of available x is small . Also the exact value of ( 3 ) depends on the specific samples used , introducing variance into the estimation . 2.2 THE PRACTICAL INFORMATION DISTANCE dp We propose to directly estimate the expectation of Lk ( fB |fA ) , which turns out to be much more efficient in the number of examples x , by leveraging infinite y samples . The expectation of codelength Ey1 : k [ Lk ] over all possible samples y1 : k from fB is : Ey1 : k∼fB ( x1 : k ) [ Lk ( fB |fA ) ] =− k∑ i=1 Ey1 : i log pθ ( yi|x1 : i , y1 : i−1 ) + k∑ i=1 Eyi log pθB ( yi|xi ) ≥− k∑ i=1 Eyi logEy1 : i−1pθ ( yi|x1 : i , y1 : i−1 ) + k∑ i=1 Eyi log pθB ( yi|xi ) = k∑ i=1 DKL ( fB ( xi ) ||Ey1 : i−1fθ̂i ( xi ) ) ( 5 ) ≈ k∑ i=1 DKL ( fB ( xi ) ||fθ̄i ( xi ) ) = : L ′ ( fB |fA ) ( 6 ) In ( 5 ) , Ey1 : i−1fθ̂i ( xi ) represents an infinite ensemble of models θ̂i estimated from all possible samples y1 : i−1 . We replace this ensemble with a single model θ̄i that is directly trained on all the samples . θ̄i is trained using KL-divergence as objective , which is equivalent to training with infinite samples ( see Appendix A for details from ( 5 ) to ( 6 ) ) . The expected codelength E [ Lk ] is related , via ( 6 ) , to the KL-divergence between the output distributions of fB and fθ̄i . Another interpretation of the above estimation is , we finetune model θA with an increasing number of outputs generated by θB , and aggregate the KL-divergence between the two models along the way . The more information fA shares with fB , the faster the KL-divergence decreases , resulting in a lower estimation of K ( fB |fA ) . Now dp is the approximation of ( 1 ) we propose in this paper : dp ( fA , fB ) = ∧ max { L′ ( fA|fB ) , L′ ( fB |fA ) } ( 7 ) 2.3 PROPERTIES OF dp The information distance d in ( 1 ) applied to functions defines a metric on the space of functions . Now we check if dp satisfy the axioms of a metric : 1. dp ( fA , fB ) = 0 ⇔ fA = fB : fA = fB if and only if they always produce the same predictions , which is equivalent to dp ( fA , fB ) = 0 2. dp ( fA , fB ) = dp ( fB , fA ) : by definition . 3. dp ( fA , fB ) ≤ dp ( fA , fC ) + dp ( fC , fB ) : whether dp keeps this property of d depends on the efficiency of prequential coding , which in turn depends on model optimization . Another important property of the information distance d is the invariancy with respect to the parameterization of function f . We found that dp is also largely invariant to parameterization of the functions . dp can be used to compare models trained differently , having different structures , or even trained on different tasks . The only condition is that both models should have sufficient expressibility to allow approximation of each other . There is also a connection between Lk ( fB |fA ) and the information transfer measure LIT ( Zhang et al. , 2020 ) : LkIT ( θn ) = L preq θ0 ( y1 : k|x1 : k ) − Lpreqθn ( y1 : k|x1 : k ) as n→∞ , θn → θB , and when yi ∼ fB ( xi ) , we have E [ LkIT ( θn ) ] =E [ L preq θA ( y1 : k|x1 : k ) ] − E [ LpreqθB ( y1 : k|x1 : k ) ] =E [ Lk ( fB |fA ) ] ( 8 ) 2.4 DATA-DEPENDENCY AND EQUIVALENT INTERPRETATIONS OF DATA . In machine learning , we often only care about the output of a model on the data distribution of the task . Neural network models are trained on input data from a specific domain , for example , image classification models take natural images in RGB format as valid input . It would be meaningless to discuss the behavior of such a model on non-RGB images . This is an important distinction between a neural network function and a function in the mathematical sense . This motivates us to take a data-dependent formulation of distance measure . In this paper , we limit our discussion to distribution-dependent information distance : dp ( fA , fB ) = max { K ( f ′A|fB ) , K ( f ′B |fA ) } ( 9 ) where f ′A = arg min f∈FA K ( f |fB ) , f ′B = arg min f∈FB K ( f |fA ) ( 10 ) are equivalencies of fA and fB in the below function family ( can be A or B ) : F = { f |Ex∼D [ DKL ( f ( x ) ||f ( x ) ) ] ≤ } ( 11 ) F is a set containing all the functions producing outputs almost indistinguishable from f , in the expected sense over x drawn from data distribution D. Because they produce almost identical outputs for x ∼ D , we call them equivalent interpretations of data in D. Intuitively , this means that instead of transmitting fB , we can transmit f ′B , which is equivalent to fB on D , if f ′ B can be transmitted in fewer bits . A quick note on why data-dependency here in the context of neural network models does not break the definition of information distance : if f is a neural network trained on dataset D , then f is fully determined by the information in D plus a random seed ( which is of negligible information ) . By introducing data-dependency , it enables us to approximate Kolmogorov complexity by coding samples drawn from data distribution D , in other words we can use the training set for coding .

Summary: This paper explores the problem of designing a distance measure in the space of the functions parameterized by neural networks. Ideally, such a measure should be independent of the parameterization of the networks. Also, the measure should support quantifying the distance between the networks with different structures and/or different underlying training tasks. The information distance meets this natural requirement. However, information distance is computational infeasible as it is defined by Kolmogorov complexity.