Manifold Mixup: Learning Better Representations by Interpolating Hidden States

Deep networks often perform well on the data distribution on which they are trained , yet give incorrect ( and often very confident ) answers when evaluated on points from off of the training distribution . This is exemplified by the adversarial examples phenomenon but can also be seen in terms of model generalization and domain shift . Ideally , a model would assign lower confidence to points unlike those from the training distribution . We propose a regularizer which addresses this issue by training with interpolated hidden states and encouraging the classifier to be less confident at these points . Because the hidden states are learned , this has an important effect of encouraging the hidden states for a class to be concentrated in such a way so that interpolations within the same class or between two different classes do not intersect with the real data points from other classes . This has a major advantage in that it avoids the underfitting which can result from interpolating in the input space . We prove that the exact condition for this problem of underfitting to be avoided by Manifold Mixup is that the dimensionality of the hidden states exceeds the number of classes , which is often the case in practice . Additionally , this concentration can be seen as making the features in earlier layers more discriminative . We show that despite requiring no significant additional computation , Manifold Mixup achieves large improvements over strong baselines in supervised learning , robustness to single-step adversarial attacks , semi-supervised learning , and Negative Log-Likelihood on held out samples . 1 INTRODUCTION . Machine learning systems have been enormously successful in domains such as vision , speech , and language and are now widely used both in research and industry . Modern machine learning systems typically only perform well when evaluated on the same distribution that they were trained on . However machine learning systems are increasingly being deployed in settings where the environment is noisy , subject to domain shifts , or even adversarial attacks . In many cases , deep neural networks which perform extremely well when evaluated on points on the data manifold give incorrect answers when evaluated on points off the training distribution , and with strikingly high confidence . This manifests itself in several failure cases for deep learning . One is the problem of adversarial examples ( Szegedy et al. , 2014 ) , in which deep neural networks with nearly perfect test accuracy can produce incorrect classifications with very high confidence when evaluated on data points with small ( imperceptible to human vision ) adversarial perturbations . These adversarial examples could present serious security risks for machine learning systems . Another failure case involves the training and testing distributions differing significantly . With deep neural networks , this can often result in dramatically reduced performance . To address these problems , our Manifold Mixup approach builds on following assumptions and motivations : ( 1 ) we adopt the manifold hypothesis , that is , data is concentrated near a lower-dimensional non-linear manifold ( this is the only required assumption on the data generating distribution for Manifold Mixup to work ) ; ( 2 ) a neural net can learn to transform the data non-linearly so that the transformed data distribution now lies on a nearly flat manifold ; ( 3 ) as a consequence , linear interpolations between examples in the hidden space also correspond to valid data points , thus providing novel training examples . Manifold Mixup performs training on the convex combinations of the hidden state representations of data samples . Previous work , including the study of analogies through word embeddings ( e.g . king - man + woman ≈ queen ) , has shown that such linear interpolation between hidden states is an effective way of combining factors ( Mikolov et al. , 2013 ) . Combining such factors in the higher level representations has the advantage that it is typically lower dimensional , so a simple procedure like linear interpolation between pairs of data points explores more of the space and with more of the points having meaningful semantics . When we combine the hidden representations of training examples , we also perform the same linear interpolation in the labels ( seen as one-hot vectors or categorical distributions ) , producing new soft targets for the mixed examples . In practice , deep networks often learn representations such that there are few strong constraints on how the states can be distributed in the hidden space , because of which the states can be widely distributed through the space , ( as seen in Figure 1d ) . As well as , nearly all points in hidden space correspond to high confidence classifications even if they correspond to off-the-training distribution samples ( seen as black points in Figure 1d ) . In contrast , the consequence of our Manifold Mixup approach is that the hidden states from real examples of a particular class are concentrated in local regions and the majority of the hidden space corresponds to lower confidence classifications . This concentration of the hidden states of the examples of a particular class into a local regions enables learning more discriminative features . A low-dimensional example of this can be seen in Figure 1 and a more detailed analytical discussion for what “ concentrating into local regions ” means is in Section 3 . Our method provides the following contributions : • The introduction of a novel regularizer which outperforms competitive alternatives such as Cutout ( Devries & Taylor , 2017 ) , Mixup ( Zhang et al. , 2018 ) , AdaMix ( Guo et al. , 2016 ) , and Dropout ( Hinton et al. , 2012 ) . On CIFAR-10 , this includes a 50 % reduction in test Negative Log-Likelihood ( NLL ) from 0.1945 to 0.0957 . • Manifold Mixup achieves significant robustness to single step adversarial attacks . • A new method for semi-supervised learning which uses a Manifold Mixup based consis- tency loss . This method reduces error relative to Virtual Adversarial Training ( VAT ) ( Miyato et al. , 2018a ) by 21.86 % on CIFAR-10 , and unlike VAT does not involve any additional significant computation . • An analysis of Manifold Mixup and exact sufficient conditions for Manifold Mixup to achieve consistent interpolations . Unlike Input Mixup , this doesn ’ t require strong assumptions about the data distribution ( see the failure case of Input Mixup in Figure 1 ) : only that the number of hidden units exceeds the number of classes , which is easily satisfied in many applications . 2 MANIFOLD MIXUP . The Manifold Mixup algorithm consists of selecting a random layer ( from a set of eligible layers including the input layer ) k. We then process the batch without any mixup until reaching that layer , and we perform mixup at that hidden layer , and then continue processing the network starting from the mixed hidden state , changing the target vector according to the mixup interpolation . More formally , we can redefine our neural network function y = f ( x ) in terms of k : f ( x ) = fk ( gk ( x ) ) . Here gk is a function which runs a neural network from the input hidden state k to the output y , and hk is a function which computes the k-th hidden layer activation from the input x . For the linear interpolation between factors , we define a variable λ and we sample from p ( λ ) . Following ( Zhang et al. , 2018 ) , we always use a beta distribution p ( λ ) = Beta ( α , α ) . With α = 1.0 , this is equivalent to sampling from U ( 0 , 1 ) . We consider interpolation in the set of layers Sk and minimize the expected Manifold Mixup loss . L = E ( xi , yi ) , ( xj , yj ) ∼p ( x , y ) , λ∼p ( λ ) , k∼Sk ` ( fk ( λgk ( xi ) + ( 1− λ ) gk ( xj ) ) ) , λyi + ( 1− λ ) yj ) ( 1 ) We backpropagate gradients through the entire computational graph , including to layers before the mixup process is applied ( Section 5.1 and appendix Section B explore this issue directly ) . In the case where k = 0 is the input layer and Sk = 0 , Manifold Mixup reduces to the mixup algorithm of Zhang et al . ( 2018 ) . With α = 2.0 , about 5 % of the time λ is within 5 % of 0 or 1 , which essentially means that an ordinary example is presented . In the more general case , we can optimize the expectation in the Manifold Mixup objective by sampling a different layer to perform mixup in on each update . We could also select a new random layer as well as a new lambda for each example in the minibatch . In theory this should reduce the variance in the updates introduced by these random variables . However in practice we found that this didn ’ t have a significant effect on the results , so we decided to sample a single lambda and a randomly chosen layer per minibatch . In comparison to Input Mixup , the results in the Figure 2 demonstrate that Manifold Mixup reduces the loss calculated along hidden interpolations significantly better than Input Mixup , without significantly changing the loss calculated along visible space interpolations . 3 HOW MANIFOLD MIXUP CHANGES REPRESENTATIONS . Our goal is to show that if one does mixup in a sufficiently deep hidden layer in a deep network , then a mixup loss of zero can be achieved so long the dimensionality of that hidden layer dim ( H ) is greater than the number of classes d. More specifically the resulting representations for that class must fall onto a subspace of dimension dim ( H ) − d. Assume X and H to denote the input and representation spaces , respectively . We denote the labelset by Y and let Z , X ×Y . Also , let us denote the set of all probability measures on Z by M ( Z ) . Assume G ⊆ HX to be the set of all possible functions that can be generated by the neural network mapping input to the representation space . In this regard , each g ∈ G represents a mapping from input to the representation units . A similar definition can be made for F ⊆ YH , as the space of all possible functions from the representation space to the output . We are interested in the solution of the following problem , at least in some specific asymptotic regimes : J ( L , P ) , inf g∈G , f∈F Eλ { ∫ Z2 L ( f ◦Mixλ ( g ( X1 ) , g ( X2 ) ) , Mixλ ( y1 , y2 ) ) 2∏ i=1 dP ( Xi , yi ) } , ( 2 ) where Mixλ ( a , b ) , λa+ ( 1− λ ) b , λ ∈ [ 0 , 1 ] , ( 3 ) for any a and b defined on the same domain . We analyze the above-mentioned minimization when the probability measure P = PD is chosen as the empirical distribution over a finite dataset of size n , denoted by D = { ( Xi , yi ) } n i=1 . Let f∗ ∈ F and g∗ ∈ G be the minimizers in ( 2 ) with P = PD . In particular , we are interested in the case where G = HX , F = YH , andH is a vector space ; These conditions simply state that the two respective neural networks which map input into representation space , and representation space to the output are being extended asymptotically1 . In this regard , we show that the minimizer f∗ is a linear function from H to Y . This way , it is easy to show that the following equality holds : J ( L , PD ) = inf h1 , ... , hn∈H 1 n ( n− 1 ) n∑ i , j=1 i6=j { inf f∈F ∫ 1 0 L ( f ◦Mixλ ( hi , hj ) , Mixλ ( yi , yj ) ) dλ } , ( 4 ) where hi , g ( Xi ) is the representation of Xi . Theorem 1 . Assume H to be a vector space with dimension dim ( H ) , and let d ∈ N to represent the number of distinct classes in dataset D. Then , if dim ( H ) ≥ d − 1 , J ( L , PD ) = 0 and the minimizer function f∗ is a linear map fromH to Rd . Proof . With basic linear algebra , one can confirm that the following argument is true as long as dim ( H ) ≥ d− 1 : ∃A , H ∈ Rdim ( H ) ×d , b ∈ Rd such that ATH + b1Td = Id×d , ( 5 ) where Id×d and 1d are the d-dimensional identity matrix and all-one vector , respectively . In fact , b1Td is a rank-one matrix , while the rank of identity matrix is d. Therefore , A TH only needs to be rank d− 1 . Let f∗ ( h ) , Ah+ b , for all h ∈ H. Also , let g∗ ( Xi ) = hζi , where hi here means the ith column of matrix H , and ζi ∈ { 1 , . . . , d } is the class-index of the ith sample . We show that such selections will make the objective in ( 2 ) equal to zero ( which is the minimum possible value ) . More precisely , the following relations hold : 1 n ( n− 1 ) n∑ i , j=1 i6=j { ∫ 1 0 L ( f∗ ◦Mixλ ( g∗ ( Xi ) , g∗ ( Xj ) ) , Mixλ ( yi , yj ) ) dλ } , = 1 n ( n− 1 ) n∑ i , j=1 i6=j { ∫ 1 0 L ( AT ( λhζi + ( 1− λ ) hζj ) + b , λyζi + ( 1− λ ) yζj ) dλ } , = 1 n ( n− 1 ) n∑ i , j=1 i6=j { ∫ 1 0 L ( u ( λ ) , u ( λ ) ) dλ } = 0 . ( 6 ) 1Due to the consistency theorem that proves neural networks with nonlinear activation functions are dense in the function space The final equality is a direct result of AThζi + b = yζi for i = 1 , . . . , n. Also , it can be shown that as long as dim ( H ) > d− 1 , then data points in the representation space H have some degrees of freedom to move independently . Corollary 1 . Consider the setting in Theorem 1 , and assume dim ( H ) > d − 1 . Let g∗ ∈ G to be the true minimizer of ( 2 ) for a given dataset D. Then , data-points in the representation space , i.e . g∗ ( Xi ) , fall on a ( dim ( H ) − d+ 1 ) -dimensional subspace . Proof . In the proof of Theorem 1 , we have ATH = Id×d − b1Td . ( 7 ) The r.h.s . of ( 7 ) can become a rank- ( d− 1 ) matrix as long as vector b is chosen properly . Thus , A is free to have a null-space of dimension dim ( H ) −d+1 . This way , one can assign g∗ ( Xi ) = hζi+ei , where hj and ζi ( for j = 1 , . . . , d and i = 1 , . . . , n ) are defined in the same way as in Theorem 1 , and eis can are arbitrary vectors in the null-space of A , i.e . ei ∈ ker ( A ) for all i . This result implies that if the Manifold Mixup loss is minimized , then the representation for each class will lie on a subspace of dimension dim ( H ) −d+1 . In the most extreme case where dim ( H ) = d − 1 , each hidden state from the same class will be driven to a single point , so the change in the hidden states following any direction on the class-conditional manifold will be zero . In the more general case with a larger dim ( H ) , a majority of directions inH-space will not change as we move along the class-conditional manifold . Why are these properties desirable ? First , it can be seen as a flattening 2. of the class-conditional manifold which encourages learning effective representations earlier in the network . Second , it means that the region in hidden space occupied by data points from the true manifold has nearly zero measure . So a randomly sampled hidden state within the convex hull spanned by the data is more likely to have a classification score that is not fully confident ( non-zero entropy ) . Thus it encourages the network to learn discriminative features in all layers of the network and to also assign low-confidence classification decisions to broad regions in the hidden space ( this can be seen in Figure 1 and Figure 6 ) .

Summary: The tone of the paper is notably scientific, as the authors clearly state the assumptions and all observations, whether positive or negative. That said, the approach itself can be seen as a direct extension of the earlier advanced 'mixup' scheme. In addition to performing data augmentation solely in the input space, their method proposes to train the networks on the convex combinations of the hidden state representations by learning to map them to the convex combinations of their one-hot ground truth encodings.