paper_name
stringlengths
11
170
text
stringlengths
8.07k
307k
summary
stringlengths
152
6.16k
paper_id
stringlengths
43
43
On the Neural Tangent Kernel of Equilibrium Models
1 INTRODUCTION Recent works empirically observe that as the depth of a weight-tied input-injected network increases , its output tends to converge to a fixed point . Motivated by this phenomenon , DEQ models were proposed to effectively represent an “ infinite depth ” network by root-finding . A natural question to ask is , what will DEQs become if their widths also go to infinity ? It is well-known that at certain random initialization , neural networks of various structures converge to Gaussian processes as their widths go to infinity ( Neal , 1996 ; Lee et al. , 2017 ; Yang , 2019 ; Matthews et al. , 2018 ; Novak et al. , 2018 ; Garriga-Alonso et al. , 2018 ) . Recent deep learning theory advances have also shown that in the infinite width limit , with proper initialization ( the NTK initialization ) , training the network fθ with gradient descent is equivalent to solving kernel regression with respect to the neural tangent kernel ( Arora et al. , 2019 ; Jacot et al. , 2018 ; Yang , 2019 ; Huang et al. , 2020 ) . However , as the depth goes to infinity , Jacot et al . ( 2019 ) showed that the NTKs of fully-connected neural networks ( FCNN ) converge either to a constant ( freeze ) , or to the Kronecker Delta ( chaos ) . In this work , we show that with input injection , the DEQ-NTKs converge to meaningful fixed points that depend on the input in a non-trivial way , thus avoiding both freeze and chaos . Furthermore , analogous to DEQ models , we can compute these kernels by solving an analogous fixed point equation , rather than simply iteratively applying the updates associated with the traditional NTK . Moreover , such derivations carry over to other structures like convolution DEQs ( CDEQ ) as well . We evaluate the approach and demonstrate that it typically matches or improves upon the performance of existing regularized NTK methods . 2 BACKGROUND AND PRELIMINARIES Bai et al . ( 2019 ) proposed the DEQ model , which is equivalent to running an infinite depth network with tied weight and input injection . These methods trace back to some of the original work in recurrent backpropagation ( Almeida , 1990 ; Pineda , 1988 ) , but with specific emphasis on : 1 ) computing the fixed point directly via root-finding rather than forward iteration ; and 2 ) incorporating the elements from modern deep networks in the single “ layer ” , such as self-attention transformers ( Bai et al. , 2019 ) , multi-scale convolutions ( Bai et al. , 2020 ) , etc . The DEQ algorithm finds the infinite depth fixed point using quasi-Newton root finding methods , and then backpropagates using implicit differentiation without storing the derivatives in the intermediate layers , thus achieving a constant memory complexity . Furthermore , although a traditional DEQ model does not always guarantee to find a stable fixed point , with careful parameterization and update method , monotone operator DEQs can ensure the existence of a unique stable fixed point ( Winston & Kolter , 2020 ) . On the side of connecting neural networks to kernel methods , Neal ( 1996 ) first discovered that a single-layered network with randomly initialized parameters becomes a Gaussian process ( GP ) in the large width limit . Such connection between neural networks and GP was later extended to multiple layers ( Lee et al. , 2017 ; Matthews et al. , 2018 ) and various other architectures ( Yang , 2019 ; Novak et al. , 2018 ; Garriga-Alonso et al. , 2018 ) . The networks studied in this line of works are randomly initialized , and one can imagine these networks as having fixed parameters throughout the training process , except for the last classification layer . Following the naming convention of Arora et al . ( 2019 ) , we call these networks weakly-trained , and networks where every layer is updated are called fully-trained . Weakly-trained nets induce the kernel Θ ( x , y ) = Eθ∼N [ f ( θ , x ) · f ( θ , y ) ] , where x , y ∈ Rd are two samples , θ represents the parameters of the network , N is the initialization distribution ( often Gaussian ) over θ , and f ( θ , · ) ∈ R is the output of the network . One related topic in studying the relation between Gaussian process kernel and depth is the meanfield theory . Poole et al . ( 2016 ) ; Schoenholz et al . ( 2016 ) showed that the correlations between all inputs on an infinitely wide weakly-trained net become either perfectly correlated ( order ) or decorrelated ( chaos ) as depth increases . This aligns with the observation in Jacot et al . ( 2019 ) . They suggested we should initialize the neural network on the “ edge-of-chaos ” to make sure that signals can propagate deep enough in the forward direction , and the gradient does not vanish or explode during backpropagation ( Raghu et al. , 2017 ; Schoenholz et al. , 2016 ) . These mean-field behaviors were later proven for various other structures like RNNs , CNNs , and NTKs as well ( Chen et al. , 2018a ; Xiao et al. , 2018 ; Gilboa et al. , 2019 ; Hayou et al. , 2019 ) . We emphasize that despite the similar appearance , our setting avoids the order vs. chaos scheme completely by adding input injection . Such structure guarantees the converged nets depend nontrivially on the inputs , as we will see later in the experiments . It can be unsatisfying that the previous results only involve weakly-trained nets . Interestingly , similar limiting behavior was proven by Jacot et al . ( 2018 ) to hold for fully-trained networks as well . They showed the kernel induced by a fully-trained infinite width network is the following : Θ ( x , y ) = Eθ∼N [ 〈 ∂f ( θ , x ) ∂θ , ∂f ( θ , y ) ∂θ 〉 ] . ( 1 ) They also gave a recursive formulation for the NTK of FCNN . Arora et al . ( 2019 ) ; Yang ( 2020 ) later provided formulation for convolution NTK and other structures . One may ask what happens if both the width and the depth go to infinity . It turns out that the vanilla FCNN does not have a meaningful convergence : either it gives constant kernels or Kronecker Delta kernels ( Jacot et al. , 2019 ) . On the bright side , this assertion is not always the case for other network structures . For example , the NTK induced by ResNet provides a meaningful fixed point in the large depth limit ( Huang et al. , 2020 ) . This may seem to give one explanation why ResNet outperforms FCNN , but unfortunately they also show that the ResNet NTK with infinite depth is no different from the ResNet NTK with just depth one . This conclusion makes the significance of infinite depth questionable . 2.1 NOTATIONS Throughout the paper , we write θ as the parameters for some network fθ or equivalently , f ( θ , · ) . We write capital letter W to represent matrices or tensors , which should be clear from the context , and use [ W ] i to represent the element of W indexed by i . We write lower case letter x to represent vectors or scalars . For a ∈ Z+ , let [ a ] = { 1 , . . . , a } . Denote σ ( x ) = √ 2max ( 0 , x ) as the normalized ReLU and σ̇ its derivative ( which only need to be well-defined almost everywhere ) . The symbol σ2a with subscript is always used to denote the variance of some distribution . We write N ( µ , Σ ) as the Gaussian distribution with mean µ ∈ Rd and covariance matrix Σ ∈ Rd×d . We let Sd−1 be the unit sphere embedded in Rd . 3 DEQ-NTK OF FULLY-CONNECTED NEURAL NETWORKS In this section , we show how to derive the NTK of the fully-connected DEQ ( DEQ-NTK ) . From now on , we simplify fully-connected DEQs as DEQs . Recall that DEQs are equivalent to infinitely deep fully-connected neural nets with input injection ( FCNN-IJ ) , and one can either exactly solve the fixed point using root-finding ( up to machine epsilon and root-finding algorithm accuracy ) or approximate the DEQs by just doing finite depth forward iterations . In section 3.1 , we show the NTK of the approximated DEQ using finite depth iteration , and in section 3.2 we demonstrate how to get the exact convergence point of DEQ-NTK . The details of this section can be found in appendix A . 3.1 FINITE DEPTH ITERATION OF DEQ-NTK Let d be the input dimension , x , y ∈ Rd be a pair of inputs , Nh be the width of the hth layers where h ∈ [ L+ 1 ] . Let N0 = d and NL+1 = 1 . Define the FCNN-IJ with L hidden layers as follows : f ( h ) θ ( x ) = √ σ2W Nh W ( h ) g ( h−1 ) ( x ) + √ σ2U Nh U ( h ) x+ √ σ2b Nh b ( h ) , h ∈ [ L+ 1 ] g ( L ) ( x ) = σ ( f ( L ) θ ( x ) ) where W ( h ) ∈ RNh×Nh−1 , U ( h ) ∈ RNh×d are the internal weights , and b ( h ) ∈ RNh are the bias terms . These parameters are chosen using the NTK initialization . Let us pick σW , σU , σb ∈ R arbitrarily in this section . NTK initialization . We randomly initialize every entry of every W , U , b from N ( 0 , 1 ) . Without loss of generality ( WLOG ) we assume the width of the hidden layer Nh = N is the same across different layers . We remark the readers to distinguish FCNN-IJ from a recurrent neural network ( RNN ) : our model injects the original input to each layer , whereas a RNN has a sequence of input ( x1 , . . . , xT ) , and inject xt to the tth-layer . Here is a crucial distinction between finite width DEQs and infinite width DEQs : Remark 1 . In the finite width regime , one typically has to assume the DEQs have tied weights , that is , W ( 1 ) = . . . = W ( L+1 ) . Otherwise it is unlikely the network will converge at all . In fact , one needs to be very careful with the parametrization of the weights to guarantee the fixed point is unique and stable . This is not the case in the infinite width regime . As we shall see soon , even with distinct weights in each layer , the convergence of DEQ-NTKs only depend on σ2W , σ 2 U , σ 2 b , and the nonlinearity σ . Assuming untied weights makes the analysis easier , but the same argument can be made rigorously for tied weights as well , see Yang ( 2019 ; 2020 ) . Our main theorem is the following : Theorem 1 . Recursively define the following quantities for h ∈ [ L ] : Σ ( 0 ) ( x , y ) = x⊤y ( 2 ) Λ ( h ) ( x , y ) = ( Σ ( h−1 ) ( x , x ) Σ ( h−1 ) ( x , y ) Σ ( h−1 ) ( y , x ) Σ ( h−1 ) ( y , y ) ) ∈ R2×2 ( 3 ) Σ ( h ) ( x , y ) = σ2WE ( u , v ) ∼N ( 0 , Λ ( h ) ) [ σ ( u ) σ ( v ) ] + σ2Ux⊤y + σ2b ( 4 ) Σ̇ ( h ) ( x , y ) = σ2WE ( u , v ) ∼N ( 0 , Λ ( h ) ) [ σ̇ ( u ) σ̇ ( v ) ] ( 5 ) Then the L-depth iteration to the DEQ-NTK can be expressed as : Θ ( L ) ( x , y ) = L+1∑ h=1 ( Σ ( h−1 ) ( x , y ) ) · L+1∏ h′=h Σ̇ ( h ′ ) ( x , y ) , ( 6 ) where by convention we set Σ̇L+1 ( x , y ) = 1 for the L-depth iteration . Proof Sketch . The first step is to show that at each layer h ∈ [ L ] , the representation f ( h ) θ ( x ) is associated with a Gaussian process with kernel eq . ( 3 ) as N → ∞ . Then use the characterization in eq . ( 1 ) , calculate the NTK by : Θ ( L ) ( x , y ) = Eθ [ 〈 ∂f ( θ , x ) ∂θ , ∂f ( θ , y ) ∂θ 〉 ] =Eθ [ 〈 ∂f ( θ , x ) ∂W , ∂f ( θ , y ) ∂W 〉 ] ︸ ︷︷ ︸ 1 +Eθ [ 〈 ∂f ( θ , x ) ∂U , ∂f ( θ , y ) ∂U 〉 ] ︸ ︷︷ ︸ 2 +Eθ [ 〈 ∂f ( θ , x ) ∂b , ∂f ( θ , y ) ∂b 〉 ] ︸ ︷︷ ︸ 3 . Calculating each term using the chain rule , we get eq . ( 6 ) . 3.2 FIXED POINT OF DEQ-NTK Based on eq . ( 6 ) , we are now ready to answer what the fixed point of Θ ( L ) is . By convention , we assume the two samples x , y ∈ Sd−1 , and we require the parameters σ2W , σ2U , σ2b obey the DEQNTK initialization . DEQ-NTK initialization . Let every entry of every W , U , b follows the NTK initialization described in section 3.1 , as well as the additional requirement σ2W + σ 2 U + σ 2 b = 1 . Let the nonlinear activation function σ be the normalized ReLU : σ ( x ) = √ 2max ( 0 , x ) . Definition 3.1 ( Normalized activation ) . We call an activation function σ : R → R normalized if Ex∼N ( 0,1 ) [ σ ( x ) 2 ] = 1 . Using normalized activations along with DEQ-NTK initialization , we can derive the main convergence theorem : Theorem 2 . Use same notations and settings in theorem 1 . With input data x , y ∈ Sd−1 , parameters σ2W , σ 2 U , σ 2 b follow the DEQ-NTK initialization , the fixed point of DEQ-NTK is Θ∗ ( x , y ) ≜ lim L→∞ Θ ( L ) ( x , y ) = Σ∗ ( x , y ) 1− Σ̇∗ ( x , y ) , ( 7 ) where Σ∗ ( x , y ) ≜ ρ∗ is the root of : Rσ ( ρ ) − ρ , where Rσ ( ρ ) ≜ σ2W ( √ 1− ρ2 + ( π − cos−1 ρ ) ρ π ) + σ2Ux ⊤y + σ2b , ( 8 ) and Σ̇∗ ( x , y ) ≜ lim h→∞ Σ̇ ( h ) ( x , y ) = σ2W ( π − cos−1 ( ρ∗ ) π ) . ( 9 ) Proof . Due to the fact that x ∈ Sd−1 , σ being a normalized activation , and DEQ-NTK initialization , one can easily calculate by induction that for all h ∈ [ L ] : Σ ( h ) ( x , x ) = σ2W E u∼N ( 0,1 ) [ σ ( u ) 2 ] + σ2V x ⊤x+ σ2b = 1 This indicates that in eq . ( 3 ) , the covariance matrix has a special structure Λ ( h ) ( x , y ) = ( 1 ρ ρ 1 ) , where ρ = Σ ( h−1 ) ( x , y ) depends on h , x , y . For simplicity we omit the h , x , y in Λ ( h ) ( x , y ) . As shown in Daniely et al . ( 2016 ) : E ( u , v ) ∼N ( 0 , Λ ) [ σ ( u ) σ ( v ) ] = √ 1− ρ2 + ( π − cos−1 ( ρ ) ) ρ π ( 10 ) E ( u , v ) ∼N ( 0 , Λ ) [ σ̇ ( u ) σ̇ ( v ) ] = π − cos−1 ( ρ ) π ( 11 ) Adding input injection and bias , we derive eq . ( 8 ) from eq . ( 10 ) , and similarly , eq . ( 9 ) from eq . ( 11 ) . Notice that iterating eqs . ( 2 ) to ( 4 ) to solve for Σ ( h ) ( x , y ) is equivalent to iterating ( Rσ ◦ · · ·◦Rσ ) ( ρ ) with initial input ρ = x⊤y . Take the derivative ∣∣∣∣ dRσ ( ρ ) dρ ∣∣∣∣ = ∣∣∣∣∣∣ σ2W ( 1− cos −1 ( ρ ) π ) ∣∣∣∣∣∣ < 1 , if σ2W < 1 and −1 ≤ ρ < 1 . For x ∕= y we have −1 ≤ ρ < c < 1 for some c ( this is because we only have finite number of inputs x , y ) and by DEQ-NTK initialization we have σ2W < 1 , so the above inequality hold . Hence Rσ ( ρ ) is a contraction on [ 0 , c ] , and we conclude that the fixed point ρ∗ is attractive . By lemma 1 , if σ2W < 1 , then the limit of eq . ( 6 ) exists , so we can rewrite the summation form in eq . ( 6 ) in a recursive form : Θ ( 0 ) ( x , y ) = Σ ( 0 ) ( x , y ) Θ ( L+1 ) ( x , y ) = Σ̇ ( L+1 ) ( x , y ) ·Θ ( L ) ( x , y ) + Σ ( L+1 ) ( x , y ) , and directly solve the fixed point iteration : lim L→∞ Θ ( L+1 ) ( x , y ) = lim L→∞ ( Σ̇ ( L+1 ) ( x , y ) ·Θ ( L ) ( x , y ) + Σ ( L+1 ) ( x , y ) ) =⇒ lim L→∞ Θ ( L+1 ) ( x , y ) = Σ̇∗ ( x , y ) · lim L→∞ Θ ( L ) ( x , y ) + Σ∗ ( x , y ) =⇒ lim L→∞ Θ ( L ) ( x , y ) = Σ̇∗ ( x , y ) · lim L→∞ Θ ( L ) ( x , y ) + Σ∗ ( x , y ) . ( 12 ) Solving for limL→∞ Θ ( L ) ( x , y ) we get Θ∗ ( x , y ) = Σ∗ ( x , y ) 1−Σ̇∗ ( x , y ) . Remark 2 . Note our Σ∗ ( x , y ) always depends on the inputs x and y , so the information between two inputs is always preserved , even if the depth goes to infinity . On the contrary as pointed out by Jacot et al . ( 2019 ) , without input injection , Σ ( h ) ( x , y ) always converges to 1 as h → ∞ , even if x ∕= y . 4 DEQ WITH CONVOLUTION LAYERS In this section we show how to derive the NTKs for convolution DEQs ( CDEQ ) . Although in this paper only the CDEQ with vanilla convolution structure is considered in experiments , we remark that our derivation is general enough for other CDEQ structure as well , for instance , CDEQ with global pooling layer . The details of this section can be found in appendix B . Unlike the FCNN-IJ , whose intermediate NTK representation is a real number . For convolution neural networks ( CNN ) , the intermediate NTK representation is a four-way tensor . In the following , we will present the notations , CNN with input injection ( CNN-IJ ) formulation , the CDEQ-NTK initialization , and our main theorem . Notation . We adopt the notations from Arora et al . ( 2019 ) . Let x , y ∈ RP×Q be a pair of inputs , let q ∈ Z+ be the filter size ( WLOG assume it is odd as well ) . By convention , we always pad the representation ( both the input layer and hidden layer ) with 0 ’ s . Denote the convolution operation as following : [ w ∗ x ] ij = q−1 2∑ a=− q−12 q−1 2∑ b=− q−12 [ w ] a+ q+12 , b+ q+1 2 [ x ] a+i , b+j for i ∈ [ P ] , j ∈ [ Q ] . Denote Dij , i′j′ = { ( i+ a , j + b , i′ + a′ , j′ + b′ ) ∈ [ P ] × [ Q ] × [ P ] × [ Q ] : − ( q − 1 ) /2 ≤ a , b , a′ , b′ ≤ ( q − 1 ) /2 } . Intuitively , Dij , i′j′ is a q × q × q × q set of indices centered at ( ij , i′j′ ) . For any tensor T ∈ RP×Q×P×Q , let [ T ] Dij , i′j′ be the natural sub-tensor and let Tr ( T ) = ∑ i , j Tij , ij . Formulation of CNN-IJ . Define the CNN-IJ as follows : • Let the input x ( 0 ) = x ∈ RP×Q×C0 , where C0 is the number of input channels , and Ch is the number of channels in layer h. Assume WLOG that Ch = C for all h ∈ [ L ] • For h = 1 , . . . , L , let the inner representation x̃ ( h ) ( β ) = Ch−1∑ α=1 √ σ2W Ch W ( h ) ( α ) , ( β ) ∗ x ( h−1 ) ( α ) + C0∑ α=1 √ σ2U Ch U ( h ) ( α ) , ( β ) ∗ x ( 0 ) ( α ) ( 13 ) [ x ( h ) ( β ) ] ij = 1 [ S ] ij [ σ ( x̃ ( h ) ( β ) ) ] ij , for i ∈ [ P ] , j ∈ [ Q ] ( 14 ) where W ( h ) ( α ) , ( β ) ∈ R q×q represent the convolution operator from the αth channel in layer h − 1 to the βth channel in layer h. Similarly , U ( h ) ( α ) , ( β ) ∈ R q×q injects the input in each convolution window . S ∈ RP×Q is a normalization matrix . Let W , U , S , σ2U , σ2W be chosen by the CDEQ-NTK initialization described later . Notice here we assume WLOG that the number of channels in the hidden layers is the same . • The final output is defined to be fθ ( x ) = ∑CL α=1 〈 W ( L+1 ) ( α ) , x ( L ) ( α ) 〉 , where W ( L+1 ) ( α ) ∈ RP×Q is sampled from standard Gaussian distribution . CDEQ-NTK initialization . Let 1q ∈ Rq×q , X ∈ RP×Q be two all-one matrices . Let X̃ ∈ R ( P+2 ) × ( Q+2 ) be the output of zero-padding X . We index the rows of X̃ by { 0 , 1 , . . . , P + 1 } and columns by { 0 , 1 , . . . , Q + 1 } . For position i ∈ [ P ] , j ∈ [ Q ] , let ( [ S ] ij ) 2 = [ 1q ∗ X̃ ] ij in eq . ( 14 ) . Let every entry of every W , U be sampled from N ( 0 , 1 ) and σ2W + σ2U = 1 . Using the above defined notations , we now state the CDEQ-NTK . Theorem 3 . Let x , y ∈ RP×Q×C0 be s.t ‖xij‖2 = ‖yij‖2 = 1 for i ∈ [ P ] , j ∈ [ Q ] . Define the following expressions recursively ( some x , y are omitted in the notations ) , for ( i , j , i′ , j′ ) ∈ [ P ] × [ Q ] × [ P ] × [ Q ] , h ∈ [ L ] K ( 0 ) ij , i′j′ ( x , y ) = ∑ α∈ [ C0 ] x ( α ) ⊗ y ( α ) ij , i′j′ ( 15 ) [ Σ ( 0 ) ( x , y ) ] ij , i′j′ = 1 [ S ] ij [ S ] i′j′ C0∑ α=1 Tr ( [ K ( 0 ) ( α ) ( x , y ) ] Dij , i′j′ ) ( 16 ) Λ ( h ) ij , i′j′ ( x , y ) = [ Σ ( h−1 ) ( x , x ) ] ij , ij [ Σ ( h−1 ) ( x , y ) ] ij , i′j′ [ Σ ( h−1 ) ( y , x ) ] i′j′ , ij [ Σ ( h−1 ) ( y , y ) ] i′j′ , i′j′ ∈ R2×2 ( 17 ) [ K ( h ) ( x , y ) ] ij , i′j′ = σ2W [ S ] ij · [ S ] i′j′ E ( u , v ) ∼N ( 0 , Λ ( h ) ij , i′j′ ) [ σ ( u ) σ ( v ) ] + σ2U [ S ] ij · [ S ] i′j′ [ K ( 0 ) ] ij , i′j′ ( 18 ) [ K̇ ( h ) ( x , y ) ] ij , i′j′ = σ2W [ S ] ij · [ S ] i′j′ E ( u , v ) ∼N ( 0 , Λ ( h ) ij , i′j′ ) [ σ̇ ( u ) σ̇ ( v ) ] ( 19 ) [ Σ ( h ) ( x , y ) ] ij , i′j′ = Tr ( [ K ( h ) ( x , y ) ] Dij , i′j′ ) ( 20 ) Define the linear operator L : RP×Q×P×Q → RP×Q×P×Q via [ L ( M ) ] ij , i′j′ = Tr ( [ M ] Dij , i′j′ ) . Then the CDEQ-NTK can be found solving the following linear system : Θ∗ ( x , y ) = K̇∗ ( x , y ) ⊙ L ( Θ∗ ( x , y ) ) +K∗ ( x , y ) , ( 21 ) where K∗ ( x , y ) = limL→∞ K ( L ) ( x , y ) , K̇∗ ( x , y ) = limL→∞ K̇ ( L ) ( x , y ) . The limit exists if σ2W < 1 . 5 EXPERIMENTS In this section , we evaluate the performance of DEQ-NTK and CDEQ-NTK on both MNIST and CIFAR-10 datasets . We also compare the performance of finite depth NTK and finite depth iteration of DEQ-NTK . Implementation . For DEQ-NTK , aligned with the theory , we normalize the dataset such that each data point has unit length . The fixed point Σ∗ ( x , y ) is solved by using the modified Powell hybrid method ( Powell , 1970 ) . Notice these root finding problems are one-dimensional , hence can be quickily solved . For CDEQ-NTK , the input data x has dimension P × Q × C0 , and we normalize x s.t ‖xij‖2 = 1 for any i ∈ [ P ] , j ∈ [ Q ] . We set q = 3 and stride 1 . The fixed point Σ∗ ( x , y ) ∈ RP×Q×P×Q is approximated by running 20 iterations of eq . ( 17 ) , eq . ( 18 ) , and eq . ( 20 ) . The actual CDEQ-NTK Θ ( x , y ) is then calculated by solving the sparse linear system eq . ( 21 ) . After obtaining the NTK matrix , we apply kernel regressions ( without regularization unless stated otherwise ) . For any label y ∈ { 1 , . . . , n } , denote its one-hot encoding by ey . Let 1 ∈ Rn be an all-1 vector , we train on the new encoding −0.1 · 1 + ey . That is , we change the “ 1 ” to 0.9 , and the “ 0 ” to −0.1 , as suggested by Novak et al . ( 2018 ) . Result . On MNIST data , we test the performance of DEQ-NTK with σ2W = 0.25 , σ2U = 0.25 , σ2b = 0.5 and achieve 98.6 % test accuracy . The results are listed in table 1 . On CIFAR-10 , we trained DEQ-NTK with three different sets of random initializations . These initializations are not fine-tuned , yet we can still see they are comparable , or even superior , to the finite-depth NTK with carefully chosen regularization . For CDEQ-NTK , we compute the kernel matrix on 2000 training data and tested on 10000 samples . See the results in table 2 .
This paper studies the neural tangent kernel (NTK) of fully-connected neural networks with input injection (defined in the first set of display in Section 3.1), and the infinite depth limit of the NTK. The calculations are further carried out for the convolution neural networks with input injection (defined at the beginning of page 6). Those kernels are empirically evaluated on MNIST and CIFAR-10 datasets, and are compared with the usual NTKs without input injection.
SP:3bd9aeb125e33dd92db4510d3c2c26e782576ab8
On the Neural Tangent Kernel of Equilibrium Models
1 INTRODUCTION Recent works empirically observe that as the depth of a weight-tied input-injected network increases , its output tends to converge to a fixed point . Motivated by this phenomenon , DEQ models were proposed to effectively represent an “ infinite depth ” network by root-finding . A natural question to ask is , what will DEQs become if their widths also go to infinity ? It is well-known that at certain random initialization , neural networks of various structures converge to Gaussian processes as their widths go to infinity ( Neal , 1996 ; Lee et al. , 2017 ; Yang , 2019 ; Matthews et al. , 2018 ; Novak et al. , 2018 ; Garriga-Alonso et al. , 2018 ) . Recent deep learning theory advances have also shown that in the infinite width limit , with proper initialization ( the NTK initialization ) , training the network fθ with gradient descent is equivalent to solving kernel regression with respect to the neural tangent kernel ( Arora et al. , 2019 ; Jacot et al. , 2018 ; Yang , 2019 ; Huang et al. , 2020 ) . However , as the depth goes to infinity , Jacot et al . ( 2019 ) showed that the NTKs of fully-connected neural networks ( FCNN ) converge either to a constant ( freeze ) , or to the Kronecker Delta ( chaos ) . In this work , we show that with input injection , the DEQ-NTKs converge to meaningful fixed points that depend on the input in a non-trivial way , thus avoiding both freeze and chaos . Furthermore , analogous to DEQ models , we can compute these kernels by solving an analogous fixed point equation , rather than simply iteratively applying the updates associated with the traditional NTK . Moreover , such derivations carry over to other structures like convolution DEQs ( CDEQ ) as well . We evaluate the approach and demonstrate that it typically matches or improves upon the performance of existing regularized NTK methods . 2 BACKGROUND AND PRELIMINARIES Bai et al . ( 2019 ) proposed the DEQ model , which is equivalent to running an infinite depth network with tied weight and input injection . These methods trace back to some of the original work in recurrent backpropagation ( Almeida , 1990 ; Pineda , 1988 ) , but with specific emphasis on : 1 ) computing the fixed point directly via root-finding rather than forward iteration ; and 2 ) incorporating the elements from modern deep networks in the single “ layer ” , such as self-attention transformers ( Bai et al. , 2019 ) , multi-scale convolutions ( Bai et al. , 2020 ) , etc . The DEQ algorithm finds the infinite depth fixed point using quasi-Newton root finding methods , and then backpropagates using implicit differentiation without storing the derivatives in the intermediate layers , thus achieving a constant memory complexity . Furthermore , although a traditional DEQ model does not always guarantee to find a stable fixed point , with careful parameterization and update method , monotone operator DEQs can ensure the existence of a unique stable fixed point ( Winston & Kolter , 2020 ) . On the side of connecting neural networks to kernel methods , Neal ( 1996 ) first discovered that a single-layered network with randomly initialized parameters becomes a Gaussian process ( GP ) in the large width limit . Such connection between neural networks and GP was later extended to multiple layers ( Lee et al. , 2017 ; Matthews et al. , 2018 ) and various other architectures ( Yang , 2019 ; Novak et al. , 2018 ; Garriga-Alonso et al. , 2018 ) . The networks studied in this line of works are randomly initialized , and one can imagine these networks as having fixed parameters throughout the training process , except for the last classification layer . Following the naming convention of Arora et al . ( 2019 ) , we call these networks weakly-trained , and networks where every layer is updated are called fully-trained . Weakly-trained nets induce the kernel Θ ( x , y ) = Eθ∼N [ f ( θ , x ) · f ( θ , y ) ] , where x , y ∈ Rd are two samples , θ represents the parameters of the network , N is the initialization distribution ( often Gaussian ) over θ , and f ( θ , · ) ∈ R is the output of the network . One related topic in studying the relation between Gaussian process kernel and depth is the meanfield theory . Poole et al . ( 2016 ) ; Schoenholz et al . ( 2016 ) showed that the correlations between all inputs on an infinitely wide weakly-trained net become either perfectly correlated ( order ) or decorrelated ( chaos ) as depth increases . This aligns with the observation in Jacot et al . ( 2019 ) . They suggested we should initialize the neural network on the “ edge-of-chaos ” to make sure that signals can propagate deep enough in the forward direction , and the gradient does not vanish or explode during backpropagation ( Raghu et al. , 2017 ; Schoenholz et al. , 2016 ) . These mean-field behaviors were later proven for various other structures like RNNs , CNNs , and NTKs as well ( Chen et al. , 2018a ; Xiao et al. , 2018 ; Gilboa et al. , 2019 ; Hayou et al. , 2019 ) . We emphasize that despite the similar appearance , our setting avoids the order vs. chaos scheme completely by adding input injection . Such structure guarantees the converged nets depend nontrivially on the inputs , as we will see later in the experiments . It can be unsatisfying that the previous results only involve weakly-trained nets . Interestingly , similar limiting behavior was proven by Jacot et al . ( 2018 ) to hold for fully-trained networks as well . They showed the kernel induced by a fully-trained infinite width network is the following : Θ ( x , y ) = Eθ∼N [ 〈 ∂f ( θ , x ) ∂θ , ∂f ( θ , y ) ∂θ 〉 ] . ( 1 ) They also gave a recursive formulation for the NTK of FCNN . Arora et al . ( 2019 ) ; Yang ( 2020 ) later provided formulation for convolution NTK and other structures . One may ask what happens if both the width and the depth go to infinity . It turns out that the vanilla FCNN does not have a meaningful convergence : either it gives constant kernels or Kronecker Delta kernels ( Jacot et al. , 2019 ) . On the bright side , this assertion is not always the case for other network structures . For example , the NTK induced by ResNet provides a meaningful fixed point in the large depth limit ( Huang et al. , 2020 ) . This may seem to give one explanation why ResNet outperforms FCNN , but unfortunately they also show that the ResNet NTK with infinite depth is no different from the ResNet NTK with just depth one . This conclusion makes the significance of infinite depth questionable . 2.1 NOTATIONS Throughout the paper , we write θ as the parameters for some network fθ or equivalently , f ( θ , · ) . We write capital letter W to represent matrices or tensors , which should be clear from the context , and use [ W ] i to represent the element of W indexed by i . We write lower case letter x to represent vectors or scalars . For a ∈ Z+ , let [ a ] = { 1 , . . . , a } . Denote σ ( x ) = √ 2max ( 0 , x ) as the normalized ReLU and σ̇ its derivative ( which only need to be well-defined almost everywhere ) . The symbol σ2a with subscript is always used to denote the variance of some distribution . We write N ( µ , Σ ) as the Gaussian distribution with mean µ ∈ Rd and covariance matrix Σ ∈ Rd×d . We let Sd−1 be the unit sphere embedded in Rd . 3 DEQ-NTK OF FULLY-CONNECTED NEURAL NETWORKS In this section , we show how to derive the NTK of the fully-connected DEQ ( DEQ-NTK ) . From now on , we simplify fully-connected DEQs as DEQs . Recall that DEQs are equivalent to infinitely deep fully-connected neural nets with input injection ( FCNN-IJ ) , and one can either exactly solve the fixed point using root-finding ( up to machine epsilon and root-finding algorithm accuracy ) or approximate the DEQs by just doing finite depth forward iterations . In section 3.1 , we show the NTK of the approximated DEQ using finite depth iteration , and in section 3.2 we demonstrate how to get the exact convergence point of DEQ-NTK . The details of this section can be found in appendix A . 3.1 FINITE DEPTH ITERATION OF DEQ-NTK Let d be the input dimension , x , y ∈ Rd be a pair of inputs , Nh be the width of the hth layers where h ∈ [ L+ 1 ] . Let N0 = d and NL+1 = 1 . Define the FCNN-IJ with L hidden layers as follows : f ( h ) θ ( x ) = √ σ2W Nh W ( h ) g ( h−1 ) ( x ) + √ σ2U Nh U ( h ) x+ √ σ2b Nh b ( h ) , h ∈ [ L+ 1 ] g ( L ) ( x ) = σ ( f ( L ) θ ( x ) ) where W ( h ) ∈ RNh×Nh−1 , U ( h ) ∈ RNh×d are the internal weights , and b ( h ) ∈ RNh are the bias terms . These parameters are chosen using the NTK initialization . Let us pick σW , σU , σb ∈ R arbitrarily in this section . NTK initialization . We randomly initialize every entry of every W , U , b from N ( 0 , 1 ) . Without loss of generality ( WLOG ) we assume the width of the hidden layer Nh = N is the same across different layers . We remark the readers to distinguish FCNN-IJ from a recurrent neural network ( RNN ) : our model injects the original input to each layer , whereas a RNN has a sequence of input ( x1 , . . . , xT ) , and inject xt to the tth-layer . Here is a crucial distinction between finite width DEQs and infinite width DEQs : Remark 1 . In the finite width regime , one typically has to assume the DEQs have tied weights , that is , W ( 1 ) = . . . = W ( L+1 ) . Otherwise it is unlikely the network will converge at all . In fact , one needs to be very careful with the parametrization of the weights to guarantee the fixed point is unique and stable . This is not the case in the infinite width regime . As we shall see soon , even with distinct weights in each layer , the convergence of DEQ-NTKs only depend on σ2W , σ 2 U , σ 2 b , and the nonlinearity σ . Assuming untied weights makes the analysis easier , but the same argument can be made rigorously for tied weights as well , see Yang ( 2019 ; 2020 ) . Our main theorem is the following : Theorem 1 . Recursively define the following quantities for h ∈ [ L ] : Σ ( 0 ) ( x , y ) = x⊤y ( 2 ) Λ ( h ) ( x , y ) = ( Σ ( h−1 ) ( x , x ) Σ ( h−1 ) ( x , y ) Σ ( h−1 ) ( y , x ) Σ ( h−1 ) ( y , y ) ) ∈ R2×2 ( 3 ) Σ ( h ) ( x , y ) = σ2WE ( u , v ) ∼N ( 0 , Λ ( h ) ) [ σ ( u ) σ ( v ) ] + σ2Ux⊤y + σ2b ( 4 ) Σ̇ ( h ) ( x , y ) = σ2WE ( u , v ) ∼N ( 0 , Λ ( h ) ) [ σ̇ ( u ) σ̇ ( v ) ] ( 5 ) Then the L-depth iteration to the DEQ-NTK can be expressed as : Θ ( L ) ( x , y ) = L+1∑ h=1 ( Σ ( h−1 ) ( x , y ) ) · L+1∏ h′=h Σ̇ ( h ′ ) ( x , y ) , ( 6 ) where by convention we set Σ̇L+1 ( x , y ) = 1 for the L-depth iteration . Proof Sketch . The first step is to show that at each layer h ∈ [ L ] , the representation f ( h ) θ ( x ) is associated with a Gaussian process with kernel eq . ( 3 ) as N → ∞ . Then use the characterization in eq . ( 1 ) , calculate the NTK by : Θ ( L ) ( x , y ) = Eθ [ 〈 ∂f ( θ , x ) ∂θ , ∂f ( θ , y ) ∂θ 〉 ] =Eθ [ 〈 ∂f ( θ , x ) ∂W , ∂f ( θ , y ) ∂W 〉 ] ︸ ︷︷ ︸ 1 +Eθ [ 〈 ∂f ( θ , x ) ∂U , ∂f ( θ , y ) ∂U 〉 ] ︸ ︷︷ ︸ 2 +Eθ [ 〈 ∂f ( θ , x ) ∂b , ∂f ( θ , y ) ∂b 〉 ] ︸ ︷︷ ︸ 3 . Calculating each term using the chain rule , we get eq . ( 6 ) . 3.2 FIXED POINT OF DEQ-NTK Based on eq . ( 6 ) , we are now ready to answer what the fixed point of Θ ( L ) is . By convention , we assume the two samples x , y ∈ Sd−1 , and we require the parameters σ2W , σ2U , σ2b obey the DEQNTK initialization . DEQ-NTK initialization . Let every entry of every W , U , b follows the NTK initialization described in section 3.1 , as well as the additional requirement σ2W + σ 2 U + σ 2 b = 1 . Let the nonlinear activation function σ be the normalized ReLU : σ ( x ) = √ 2max ( 0 , x ) . Definition 3.1 ( Normalized activation ) . We call an activation function σ : R → R normalized if Ex∼N ( 0,1 ) [ σ ( x ) 2 ] = 1 . Using normalized activations along with DEQ-NTK initialization , we can derive the main convergence theorem : Theorem 2 . Use same notations and settings in theorem 1 . With input data x , y ∈ Sd−1 , parameters σ2W , σ 2 U , σ 2 b follow the DEQ-NTK initialization , the fixed point of DEQ-NTK is Θ∗ ( x , y ) ≜ lim L→∞ Θ ( L ) ( x , y ) = Σ∗ ( x , y ) 1− Σ̇∗ ( x , y ) , ( 7 ) where Σ∗ ( x , y ) ≜ ρ∗ is the root of : Rσ ( ρ ) − ρ , where Rσ ( ρ ) ≜ σ2W ( √ 1− ρ2 + ( π − cos−1 ρ ) ρ π ) + σ2Ux ⊤y + σ2b , ( 8 ) and Σ̇∗ ( x , y ) ≜ lim h→∞ Σ̇ ( h ) ( x , y ) = σ2W ( π − cos−1 ( ρ∗ ) π ) . ( 9 ) Proof . Due to the fact that x ∈ Sd−1 , σ being a normalized activation , and DEQ-NTK initialization , one can easily calculate by induction that for all h ∈ [ L ] : Σ ( h ) ( x , x ) = σ2W E u∼N ( 0,1 ) [ σ ( u ) 2 ] + σ2V x ⊤x+ σ2b = 1 This indicates that in eq . ( 3 ) , the covariance matrix has a special structure Λ ( h ) ( x , y ) = ( 1 ρ ρ 1 ) , where ρ = Σ ( h−1 ) ( x , y ) depends on h , x , y . For simplicity we omit the h , x , y in Λ ( h ) ( x , y ) . As shown in Daniely et al . ( 2016 ) : E ( u , v ) ∼N ( 0 , Λ ) [ σ ( u ) σ ( v ) ] = √ 1− ρ2 + ( π − cos−1 ( ρ ) ) ρ π ( 10 ) E ( u , v ) ∼N ( 0 , Λ ) [ σ̇ ( u ) σ̇ ( v ) ] = π − cos−1 ( ρ ) π ( 11 ) Adding input injection and bias , we derive eq . ( 8 ) from eq . ( 10 ) , and similarly , eq . ( 9 ) from eq . ( 11 ) . Notice that iterating eqs . ( 2 ) to ( 4 ) to solve for Σ ( h ) ( x , y ) is equivalent to iterating ( Rσ ◦ · · ·◦Rσ ) ( ρ ) with initial input ρ = x⊤y . Take the derivative ∣∣∣∣ dRσ ( ρ ) dρ ∣∣∣∣ = ∣∣∣∣∣∣ σ2W ( 1− cos −1 ( ρ ) π ) ∣∣∣∣∣∣ < 1 , if σ2W < 1 and −1 ≤ ρ < 1 . For x ∕= y we have −1 ≤ ρ < c < 1 for some c ( this is because we only have finite number of inputs x , y ) and by DEQ-NTK initialization we have σ2W < 1 , so the above inequality hold . Hence Rσ ( ρ ) is a contraction on [ 0 , c ] , and we conclude that the fixed point ρ∗ is attractive . By lemma 1 , if σ2W < 1 , then the limit of eq . ( 6 ) exists , so we can rewrite the summation form in eq . ( 6 ) in a recursive form : Θ ( 0 ) ( x , y ) = Σ ( 0 ) ( x , y ) Θ ( L+1 ) ( x , y ) = Σ̇ ( L+1 ) ( x , y ) ·Θ ( L ) ( x , y ) + Σ ( L+1 ) ( x , y ) , and directly solve the fixed point iteration : lim L→∞ Θ ( L+1 ) ( x , y ) = lim L→∞ ( Σ̇ ( L+1 ) ( x , y ) ·Θ ( L ) ( x , y ) + Σ ( L+1 ) ( x , y ) ) =⇒ lim L→∞ Θ ( L+1 ) ( x , y ) = Σ̇∗ ( x , y ) · lim L→∞ Θ ( L ) ( x , y ) + Σ∗ ( x , y ) =⇒ lim L→∞ Θ ( L ) ( x , y ) = Σ̇∗ ( x , y ) · lim L→∞ Θ ( L ) ( x , y ) + Σ∗ ( x , y ) . ( 12 ) Solving for limL→∞ Θ ( L ) ( x , y ) we get Θ∗ ( x , y ) = Σ∗ ( x , y ) 1−Σ̇∗ ( x , y ) . Remark 2 . Note our Σ∗ ( x , y ) always depends on the inputs x and y , so the information between two inputs is always preserved , even if the depth goes to infinity . On the contrary as pointed out by Jacot et al . ( 2019 ) , without input injection , Σ ( h ) ( x , y ) always converges to 1 as h → ∞ , even if x ∕= y . 4 DEQ WITH CONVOLUTION LAYERS In this section we show how to derive the NTKs for convolution DEQs ( CDEQ ) . Although in this paper only the CDEQ with vanilla convolution structure is considered in experiments , we remark that our derivation is general enough for other CDEQ structure as well , for instance , CDEQ with global pooling layer . The details of this section can be found in appendix B . Unlike the FCNN-IJ , whose intermediate NTK representation is a real number . For convolution neural networks ( CNN ) , the intermediate NTK representation is a four-way tensor . In the following , we will present the notations , CNN with input injection ( CNN-IJ ) formulation , the CDEQ-NTK initialization , and our main theorem . Notation . We adopt the notations from Arora et al . ( 2019 ) . Let x , y ∈ RP×Q be a pair of inputs , let q ∈ Z+ be the filter size ( WLOG assume it is odd as well ) . By convention , we always pad the representation ( both the input layer and hidden layer ) with 0 ’ s . Denote the convolution operation as following : [ w ∗ x ] ij = q−1 2∑ a=− q−12 q−1 2∑ b=− q−12 [ w ] a+ q+12 , b+ q+1 2 [ x ] a+i , b+j for i ∈ [ P ] , j ∈ [ Q ] . Denote Dij , i′j′ = { ( i+ a , j + b , i′ + a′ , j′ + b′ ) ∈ [ P ] × [ Q ] × [ P ] × [ Q ] : − ( q − 1 ) /2 ≤ a , b , a′ , b′ ≤ ( q − 1 ) /2 } . Intuitively , Dij , i′j′ is a q × q × q × q set of indices centered at ( ij , i′j′ ) . For any tensor T ∈ RP×Q×P×Q , let [ T ] Dij , i′j′ be the natural sub-tensor and let Tr ( T ) = ∑ i , j Tij , ij . Formulation of CNN-IJ . Define the CNN-IJ as follows : • Let the input x ( 0 ) = x ∈ RP×Q×C0 , where C0 is the number of input channels , and Ch is the number of channels in layer h. Assume WLOG that Ch = C for all h ∈ [ L ] • For h = 1 , . . . , L , let the inner representation x̃ ( h ) ( β ) = Ch−1∑ α=1 √ σ2W Ch W ( h ) ( α ) , ( β ) ∗ x ( h−1 ) ( α ) + C0∑ α=1 √ σ2U Ch U ( h ) ( α ) , ( β ) ∗ x ( 0 ) ( α ) ( 13 ) [ x ( h ) ( β ) ] ij = 1 [ S ] ij [ σ ( x̃ ( h ) ( β ) ) ] ij , for i ∈ [ P ] , j ∈ [ Q ] ( 14 ) where W ( h ) ( α ) , ( β ) ∈ R q×q represent the convolution operator from the αth channel in layer h − 1 to the βth channel in layer h. Similarly , U ( h ) ( α ) , ( β ) ∈ R q×q injects the input in each convolution window . S ∈ RP×Q is a normalization matrix . Let W , U , S , σ2U , σ2W be chosen by the CDEQ-NTK initialization described later . Notice here we assume WLOG that the number of channels in the hidden layers is the same . • The final output is defined to be fθ ( x ) = ∑CL α=1 〈 W ( L+1 ) ( α ) , x ( L ) ( α ) 〉 , where W ( L+1 ) ( α ) ∈ RP×Q is sampled from standard Gaussian distribution . CDEQ-NTK initialization . Let 1q ∈ Rq×q , X ∈ RP×Q be two all-one matrices . Let X̃ ∈ R ( P+2 ) × ( Q+2 ) be the output of zero-padding X . We index the rows of X̃ by { 0 , 1 , . . . , P + 1 } and columns by { 0 , 1 , . . . , Q + 1 } . For position i ∈ [ P ] , j ∈ [ Q ] , let ( [ S ] ij ) 2 = [ 1q ∗ X̃ ] ij in eq . ( 14 ) . Let every entry of every W , U be sampled from N ( 0 , 1 ) and σ2W + σ2U = 1 . Using the above defined notations , we now state the CDEQ-NTK . Theorem 3 . Let x , y ∈ RP×Q×C0 be s.t ‖xij‖2 = ‖yij‖2 = 1 for i ∈ [ P ] , j ∈ [ Q ] . Define the following expressions recursively ( some x , y are omitted in the notations ) , for ( i , j , i′ , j′ ) ∈ [ P ] × [ Q ] × [ P ] × [ Q ] , h ∈ [ L ] K ( 0 ) ij , i′j′ ( x , y ) = ∑ α∈ [ C0 ] x ( α ) ⊗ y ( α ) ij , i′j′ ( 15 ) [ Σ ( 0 ) ( x , y ) ] ij , i′j′ = 1 [ S ] ij [ S ] i′j′ C0∑ α=1 Tr ( [ K ( 0 ) ( α ) ( x , y ) ] Dij , i′j′ ) ( 16 ) Λ ( h ) ij , i′j′ ( x , y ) = [ Σ ( h−1 ) ( x , x ) ] ij , ij [ Σ ( h−1 ) ( x , y ) ] ij , i′j′ [ Σ ( h−1 ) ( y , x ) ] i′j′ , ij [ Σ ( h−1 ) ( y , y ) ] i′j′ , i′j′ ∈ R2×2 ( 17 ) [ K ( h ) ( x , y ) ] ij , i′j′ = σ2W [ S ] ij · [ S ] i′j′ E ( u , v ) ∼N ( 0 , Λ ( h ) ij , i′j′ ) [ σ ( u ) σ ( v ) ] + σ2U [ S ] ij · [ S ] i′j′ [ K ( 0 ) ] ij , i′j′ ( 18 ) [ K̇ ( h ) ( x , y ) ] ij , i′j′ = σ2W [ S ] ij · [ S ] i′j′ E ( u , v ) ∼N ( 0 , Λ ( h ) ij , i′j′ ) [ σ̇ ( u ) σ̇ ( v ) ] ( 19 ) [ Σ ( h ) ( x , y ) ] ij , i′j′ = Tr ( [ K ( h ) ( x , y ) ] Dij , i′j′ ) ( 20 ) Define the linear operator L : RP×Q×P×Q → RP×Q×P×Q via [ L ( M ) ] ij , i′j′ = Tr ( [ M ] Dij , i′j′ ) . Then the CDEQ-NTK can be found solving the following linear system : Θ∗ ( x , y ) = K̇∗ ( x , y ) ⊙ L ( Θ∗ ( x , y ) ) +K∗ ( x , y ) , ( 21 ) where K∗ ( x , y ) = limL→∞ K ( L ) ( x , y ) , K̇∗ ( x , y ) = limL→∞ K̇ ( L ) ( x , y ) . The limit exists if σ2W < 1 . 5 EXPERIMENTS In this section , we evaluate the performance of DEQ-NTK and CDEQ-NTK on both MNIST and CIFAR-10 datasets . We also compare the performance of finite depth NTK and finite depth iteration of DEQ-NTK . Implementation . For DEQ-NTK , aligned with the theory , we normalize the dataset such that each data point has unit length . The fixed point Σ∗ ( x , y ) is solved by using the modified Powell hybrid method ( Powell , 1970 ) . Notice these root finding problems are one-dimensional , hence can be quickily solved . For CDEQ-NTK , the input data x has dimension P × Q × C0 , and we normalize x s.t ‖xij‖2 = 1 for any i ∈ [ P ] , j ∈ [ Q ] . We set q = 3 and stride 1 . The fixed point Σ∗ ( x , y ) ∈ RP×Q×P×Q is approximated by running 20 iterations of eq . ( 17 ) , eq . ( 18 ) , and eq . ( 20 ) . The actual CDEQ-NTK Θ ( x , y ) is then calculated by solving the sparse linear system eq . ( 21 ) . After obtaining the NTK matrix , we apply kernel regressions ( without regularization unless stated otherwise ) . For any label y ∈ { 1 , . . . , n } , denote its one-hot encoding by ey . Let 1 ∈ Rn be an all-1 vector , we train on the new encoding −0.1 · 1 + ey . That is , we change the “ 1 ” to 0.9 , and the “ 0 ” to −0.1 , as suggested by Novak et al . ( 2018 ) . Result . On MNIST data , we test the performance of DEQ-NTK with σ2W = 0.25 , σ2U = 0.25 , σ2b = 0.5 and achieve 98.6 % test accuracy . The results are listed in table 1 . On CIFAR-10 , we trained DEQ-NTK with three different sets of random initializations . These initializations are not fine-tuned , yet we can still see they are comparable , or even superior , to the finite-depth NTK with carefully chosen regularization . For CDEQ-NTK , we compute the kernel matrix on 2000 training data and tested on 10000 samples . See the results in table 2 .
The paper shows the deep equilibrium model has non-degenerate neural tangent kernel in the infinite depth setting. The neural tangent kernel can be computed by a similar root-finding problem as that in the deep equilibrium problem itself. Some experiments have been performed to compare the performance of deep equilibrium neural tangent kernel with that of finite depth neural tangent kernel.
SP:3bd9aeb125e33dd92db4510d3c2c26e782576ab8
Equivariant Normalizing Flows for Point Processes and Sets
A point process describes how random sets of exchangeable points are generated . The points usually influence the positions of each other via attractive and repulsive forces . To model this behavior , it is enough to transform the samples from the uniform process with a sufficiently complex equivariant function . However , learning the parameters of the resulting process is challenging since the likelihood is hard to estimate and often intractable . This leads us to our proposed model – CONFET . Based on continuous normalizing flows , it allows arbitrary interactions between points while having tractable likelihood . Experiments on various real and synthetic datasets show the improved performance of our new scalable approach . 1 INTRODUCTION . Many domains contain unordered data with a variable number of elements . The lack of ordering , also known as exchangeability , can be found in locations of cellular stations , locations of trees in a forest , point clouds , items in a shopping cart etc . This kind of data is represented with sets that are randomly generated from some underlying process that we wish to uncover . We choose to model this with spatial point processes , generative models whose realizations are sets of points . Perhaps the simplest non-trivial model is an inhomogeneous Poisson process . The locations of the points are assumed to be generated i.i.d . from some density ( Chiu et al. , 2013 ) . By simply modeling this density we can evaluate the likelihood and draw samples . We can do this easily with normalizing flows ( Germain et al. , 2015 ) . The process is then defined with a transformation of samples from a simple distribution to samples in the target distribution . However , the i.i.d . property is often wrong because the presence of one object will influence the distribution of the others . For example , short trees grow near each other , but are inhibited by taller trees ( Ogata & Tanemura , 1985 ) . As an example we can generate points on the interval ( 0 , 1 ) in the following way : we first flip a coin to decide whether to sample inside or outside of the interval ( 1/4 , 3/4 ) ; then sample two points x1 , x2 uniformly on the chosen subset . Although the marginals p ( x1 ) and p ( x2 ) are uniformly distributed , knowing the position of one point gives us information about the other . Therefore , we should not model this process as if the points are independent , but model the joint distribution p ( x1 , x2 ) , with a constraint that p is symmetric to permutations ( Figure 1 ) . Unfortunately , when we include interactions between the points , the problem becomes significantly harder because the likelihood is intractable ( Besag , 1975 ) . In this work , we present a way to solve this issue by using continuous normalizing flows that allow unrestricted transformations of points , with interactions between them . This way , a very hard problem of likelihood estimation suddenly becomes tractable . Our approach transforms simple processes into complex ones , by transforming their samples with expressive functions ( Figure 1 ) . Our main contributions are the following : • We reinterpret and unify existing techniques for modeling point processes and exchangeable data with normalizing flows . • We propose a new generative model ( CONFET ) that allows interactions between points and can be trained with maximum likelihood . The extensive experiments show that it outperforms other approaches , while remaining efficient and scalable . 2 POINT PROCESSES AND RANDOM SETS . Realizations of a finite point process on a bounded region B ⊂ Rd are finite sets of points X = { x1 , . . . , xn } , xi ∈ B . A point process is simple if no two points fall at exactly the same place . In practice , point processes are usually both finite and simple . One way to construct a general point process is by defining a discrete distribution p ( n ) for the number of points and a symmetric probability density p ( X ) on Bn for their locations ( Daley & Vere-Jones , 2007 ) . The symmetry requirement comes from the fact that the probability of a sequence ( xπ ( 1 ) , . . . , xπ ( n ) ) is the same for any permutation of the elements π — the points are exchangeable . Not knowing the order of the points can be solved trivially by averaging any density over all n ! permutations . Another approach is to impose a canonical order , e.g . sorting the points by one of the dimensions . Then the probability of observing a set of exchangeable elements is defined w.r.t . the joint probability of an order statistic x ( 1 ) < · · · < x ( n ) ( Casella & Berger , 2002 ) : p ( X ) = 1 n ! p ( x ( 1 ) , . . . , x ( n ) ) . ( 1 ) A traditional way to define a point process is with an intensity function that assigns a non-negative value to every subset of B , corresponding to a number of points we expect to see there ( Møller & Waagepetersen , 2003 ) . An example is a homogeneous Poisson process with constant intensity λ . To generate a new realization , we first sample n ∼ Pois ( λ ) , and then sample n points uniformly on B . If we define the intensity as a function of position λ ( x ) , we get an inhomogeneous Poisson process which is equivalent to defining the un-normalized probability density function on B . Now n follows Pois ( Λ ) , where Λ is the total intensity ∫ λ ( x ) dx . We get the density at a location x by normalizing the intensity p ( x ) = λ ( x ) /Λ . Combining the distribution of the number of points with the distribution of their locations gives us a well known formula for the likelihood of an inhomogeneous Poisson process ( Daley & Vere-Jones , 2007 , eq . 7.1.2 ) : L ( X ) = ( ∏ xi∈X λ ( xi ) ) exp ( − ∫ B λ ( x ) dx ) . ( 2 ) Instead of modeling λ ( x ) , we can model p ( x ) directly to avoid estimating the integral , without losing generality ( Yuan et al. , 2020 ) . This shift in the perspective from intensity to probability density function allows us to utilize rich existing methods from density estimation . An extension of an inhomogeneous process that allows interactions between points defines the conditional intensity λ ( xi|X ) ( Papangelou , 1974 ) . This may be interpreted as the conditional probability of having a point at xi given the rest of the process coincides with X . The likelihood is not tractable anymore so previous works used pseudolikelihood instead , replacing λ ( x ) with λ ( x|X ) in Eq . 2 ( Besag , 1975 ; Baddeley & Turner , 2000 ) . One example of such a process is a clustering process ( Neyman & Scott , 1958 ) that generates the points in two steps . First , we sample the cluster centers from a Poisson process , then we sample the final points from normal distributions centered around cluster positions . In contrast , a repulsion process ( Matérn , 2013 ) generates initial points from a uniform process and removes those that have neighbors inside radius R. A different perspective on point processes is viewing them as random sets ( Baddeley et al. , 2006 ) . Recent approaches for modeling sets ( Korshunova et al. , 2018 ; Bender et al. , 2020 ) invoke de Finetti ’ s theorem ( De Finetti , 1937 ) which states that the probability of an infinite exchangeable sequence is a mixture of i.i.d . processes : p ( X ) = ∫ p ( z ) ∏ xi∈X p ( xi|z ) dz , ( 3 ) here written for a finite subset ( O ’ Neill , 2009 , Theorem 1 ) . We can use Eq . 3 to construct a latent variable model where points are independent of each other given z . Since the integral is intractable , we will have to resort to approximate inference . Equations 1 , 2 and 3 give us different ways to obtain the parameters θ of a point process by maximizing the likelihood pθ ( X ) . However , the approaches that arise from them are equivalent in the sense they all model the same symmetric density . Therefore , omitting terms related to cardinality ( Vo et al. , 2018 ) , like p ( n ) , does not matter when comparing them . Further discussion is in Appendix A.1 . Our goal is to have a generative model defined with θ that can produce sets as realizations . One way to generate realizations of different point processes is to transform the points drawn from a uniform Poisson process with an invertible function . The only requirement is that the process remains locally finite ( Baddeley et al. , 2006 , Section 1.7 ) . To keep track of the likelihood we will use the change of variables formula from the normalizing flow framework . 3 UNIFYING POINT PROCESS MODELS WITH NORMALIZING FLOWS . In the following section we review the models for point processes and random sets that use likelihoods listed in Section 2 . These models can be found fully or partially in the literature on point processes and modeling exchangeable data . We unify them here under the common umbrella of normalizing flows . Their limitations form the foundation for our proposed solution in Section 4 . A normalizing flow is a generative model that defines a complex distribution as a series of invertible smooth transformations of the initial random variable ( Germain et al. , 2015 ) . That means , if we apply a function f : Rd → Rd to the random variable z ∼ q ( z ) , where f is invertible and differentiable , we can get the log-density of x = f ( z ) by calculating the change of variables formula : log p ( x ) = log q ( z ) − log ∣∣∣∣det ∂f ( z ) ∂z ∣∣∣∣ = log q ( f−1 ( x ) ) + log ∣∣∣∣det ∂f−1 ( x ) ∂x ∣∣∣∣ . ( 4 ) To sample from p ( x ) we first sample z from q ( z ) , then apply the forward transformation z 7→ x . To estimate density p ( x ) for a given sample , we apply the inverse transformation x 7→ z and use the above formula . We can also use a composition of functions f ( x ) = ( f1 ◦ · · · ◦ fk ) ( z ) to define more complex distributions , using Eq . 4 at every step . The main challenge of normalizing flow models is defining the function f . First , we want to have a way to efficiently calculate the inverse f−1 . Second , calculating the determinant of the Jacobian becomes prohibitively expensive as the dimension d grows . We often use f with a special Jacobian form , e.g . the determinant of a lower triangular matrix is simply the product of its diagonal entries . In all of our models we parametrize f−1 : Bn → Bn that transforms the input set X to a set Z , with its corresponding base density . To make sure p ( X ) is symmetric we have to satisfy two conditions . The base density q ( Z ) should be permutation invariant . The mapping f−1 should be permutation equivariant , meaning any permutation of the input permutes the output in the same way ( Papamakarios et al. , 2019 , Section 5.6 , Lemma 1 ) . We will see different ways to enforce this , along with how to handle varying input size n. A detailed implementation description is in Appendix B.1 . Inhomogeneous Poisson process . Given an observed set X we would like to use Eq . 2 for maximum likelihood training . Since the model assumes the independence between points we can define a normalizing flow on B , transform each point independently and get p ( X ) = ∏ i p ( xi ) with Eq . 4 . Invariance is achieved trivially . In the experiments , the flow is parametrized with coupling layers ( Dinh et al. , 2017 ) that have tractable inverse and determinant . Inside of coupling layers , elementwise functions are used , in particular splines with K knots ( Durkan et al. , 2019 ) . Autoregressive model with canonical ordering . The idea to order the points by some arbitrary dimension allows us to use Eq . 1 for training . The flow acts on densities over Bn . Since the ordering of the elements is known , a common approach is to use an autoregressive transformations that mimic the conditional probability formula by conditioning each element on all the previous , zi = f −1 θ ( xi|x1 , . . . , xi−1 ) ( Kingma et al. , 2016 ) . The ordered sequence of points ( x1 , . . . , xn ) is passed to f−1θ , parametrized with a recurrent neural network . This scales to different set sizes n. Stacking multiple such layers together with set coupling gives a model like in Bender et al . ( 2020 ) . Variational autoencoder and exchangeability . Another way to ensure exchangeability is to introduce a latent variable z such that the points xi are conditionally independent given z . Further , we want to maximize the log-likelihood log p ( X ) = log ∫ p ( X , z ) dz ( Eq . 3 ) ( Yuan et al. , 2020 ) . However , the true posterior p ( z|X ) is intractable so we approximate it with a variational distribution q ( z|X ) . We can now maximize the likelihood by maximizing the evidence lower bound : log p ( X ) ≥ Eq [ log p ( X|z ) ] −DKL [ q ( z|X ) ||p ( z|X ) ] . ( 5 ) Using amortized inference , parameters of q ( z|X ) are defined as a function of X , and taking gradients w.r.t . the samples is enabled with the reparametrization trick ( Kingma & Welling , 2014 ) . We use a standard posterior approximation — a factorized normal distributionN ( µ ( X ) , σ ( X ) ) . To ensure the functions µ and σ are permutation invariant , we use deep sets ( Zaheer et al. , 2017 ) , or set transformers ( Lee et al. , 2019 ) . The last thing we still need to calculate is log p ( X|z ) . Each point xi ∈ X is conditionally independent given z . In practice , this means we have an inhomogeneous Poisson process , but conditioned on a latent variable , i.e . a normalizing flow whose parameters are a function of z . To get a new realization we first sample z , then sample xi from a normalizing flow conditioned on z . To make a fair comparison with other methods we implement an importance weighted autoencoder with a tighter likelihood lower bound ( Burda et al. , 2015 ) .
This paper provides a novel method of learning density models for sets of points by modelling the sets as samples from a point process, approximated with normalizing flows. A point process gives a probability to a set of points, not assuming that the points are independent of one another. The authors describe the CONFET method, which uses continuous normalizing flows to map from a uniform point process with a learned transformation. The authors describe a method to tractably compute the exact trace of their transformation, allowing it to scale to high dimensions and numbers of points. Experiments show state-of-the-art performance on benchmarks.
SP:e7de4f8c7d34e0371297b60ef316a6bdd343b2c3
Equivariant Normalizing Flows for Point Processes and Sets
A point process describes how random sets of exchangeable points are generated . The points usually influence the positions of each other via attractive and repulsive forces . To model this behavior , it is enough to transform the samples from the uniform process with a sufficiently complex equivariant function . However , learning the parameters of the resulting process is challenging since the likelihood is hard to estimate and often intractable . This leads us to our proposed model – CONFET . Based on continuous normalizing flows , it allows arbitrary interactions between points while having tractable likelihood . Experiments on various real and synthetic datasets show the improved performance of our new scalable approach . 1 INTRODUCTION . Many domains contain unordered data with a variable number of elements . The lack of ordering , also known as exchangeability , can be found in locations of cellular stations , locations of trees in a forest , point clouds , items in a shopping cart etc . This kind of data is represented with sets that are randomly generated from some underlying process that we wish to uncover . We choose to model this with spatial point processes , generative models whose realizations are sets of points . Perhaps the simplest non-trivial model is an inhomogeneous Poisson process . The locations of the points are assumed to be generated i.i.d . from some density ( Chiu et al. , 2013 ) . By simply modeling this density we can evaluate the likelihood and draw samples . We can do this easily with normalizing flows ( Germain et al. , 2015 ) . The process is then defined with a transformation of samples from a simple distribution to samples in the target distribution . However , the i.i.d . property is often wrong because the presence of one object will influence the distribution of the others . For example , short trees grow near each other , but are inhibited by taller trees ( Ogata & Tanemura , 1985 ) . As an example we can generate points on the interval ( 0 , 1 ) in the following way : we first flip a coin to decide whether to sample inside or outside of the interval ( 1/4 , 3/4 ) ; then sample two points x1 , x2 uniformly on the chosen subset . Although the marginals p ( x1 ) and p ( x2 ) are uniformly distributed , knowing the position of one point gives us information about the other . Therefore , we should not model this process as if the points are independent , but model the joint distribution p ( x1 , x2 ) , with a constraint that p is symmetric to permutations ( Figure 1 ) . Unfortunately , when we include interactions between the points , the problem becomes significantly harder because the likelihood is intractable ( Besag , 1975 ) . In this work , we present a way to solve this issue by using continuous normalizing flows that allow unrestricted transformations of points , with interactions between them . This way , a very hard problem of likelihood estimation suddenly becomes tractable . Our approach transforms simple processes into complex ones , by transforming their samples with expressive functions ( Figure 1 ) . Our main contributions are the following : • We reinterpret and unify existing techniques for modeling point processes and exchangeable data with normalizing flows . • We propose a new generative model ( CONFET ) that allows interactions between points and can be trained with maximum likelihood . The extensive experiments show that it outperforms other approaches , while remaining efficient and scalable . 2 POINT PROCESSES AND RANDOM SETS . Realizations of a finite point process on a bounded region B ⊂ Rd are finite sets of points X = { x1 , . . . , xn } , xi ∈ B . A point process is simple if no two points fall at exactly the same place . In practice , point processes are usually both finite and simple . One way to construct a general point process is by defining a discrete distribution p ( n ) for the number of points and a symmetric probability density p ( X ) on Bn for their locations ( Daley & Vere-Jones , 2007 ) . The symmetry requirement comes from the fact that the probability of a sequence ( xπ ( 1 ) , . . . , xπ ( n ) ) is the same for any permutation of the elements π — the points are exchangeable . Not knowing the order of the points can be solved trivially by averaging any density over all n ! permutations . Another approach is to impose a canonical order , e.g . sorting the points by one of the dimensions . Then the probability of observing a set of exchangeable elements is defined w.r.t . the joint probability of an order statistic x ( 1 ) < · · · < x ( n ) ( Casella & Berger , 2002 ) : p ( X ) = 1 n ! p ( x ( 1 ) , . . . , x ( n ) ) . ( 1 ) A traditional way to define a point process is with an intensity function that assigns a non-negative value to every subset of B , corresponding to a number of points we expect to see there ( Møller & Waagepetersen , 2003 ) . An example is a homogeneous Poisson process with constant intensity λ . To generate a new realization , we first sample n ∼ Pois ( λ ) , and then sample n points uniformly on B . If we define the intensity as a function of position λ ( x ) , we get an inhomogeneous Poisson process which is equivalent to defining the un-normalized probability density function on B . Now n follows Pois ( Λ ) , where Λ is the total intensity ∫ λ ( x ) dx . We get the density at a location x by normalizing the intensity p ( x ) = λ ( x ) /Λ . Combining the distribution of the number of points with the distribution of their locations gives us a well known formula for the likelihood of an inhomogeneous Poisson process ( Daley & Vere-Jones , 2007 , eq . 7.1.2 ) : L ( X ) = ( ∏ xi∈X λ ( xi ) ) exp ( − ∫ B λ ( x ) dx ) . ( 2 ) Instead of modeling λ ( x ) , we can model p ( x ) directly to avoid estimating the integral , without losing generality ( Yuan et al. , 2020 ) . This shift in the perspective from intensity to probability density function allows us to utilize rich existing methods from density estimation . An extension of an inhomogeneous process that allows interactions between points defines the conditional intensity λ ( xi|X ) ( Papangelou , 1974 ) . This may be interpreted as the conditional probability of having a point at xi given the rest of the process coincides with X . The likelihood is not tractable anymore so previous works used pseudolikelihood instead , replacing λ ( x ) with λ ( x|X ) in Eq . 2 ( Besag , 1975 ; Baddeley & Turner , 2000 ) . One example of such a process is a clustering process ( Neyman & Scott , 1958 ) that generates the points in two steps . First , we sample the cluster centers from a Poisson process , then we sample the final points from normal distributions centered around cluster positions . In contrast , a repulsion process ( Matérn , 2013 ) generates initial points from a uniform process and removes those that have neighbors inside radius R. A different perspective on point processes is viewing them as random sets ( Baddeley et al. , 2006 ) . Recent approaches for modeling sets ( Korshunova et al. , 2018 ; Bender et al. , 2020 ) invoke de Finetti ’ s theorem ( De Finetti , 1937 ) which states that the probability of an infinite exchangeable sequence is a mixture of i.i.d . processes : p ( X ) = ∫ p ( z ) ∏ xi∈X p ( xi|z ) dz , ( 3 ) here written for a finite subset ( O ’ Neill , 2009 , Theorem 1 ) . We can use Eq . 3 to construct a latent variable model where points are independent of each other given z . Since the integral is intractable , we will have to resort to approximate inference . Equations 1 , 2 and 3 give us different ways to obtain the parameters θ of a point process by maximizing the likelihood pθ ( X ) . However , the approaches that arise from them are equivalent in the sense they all model the same symmetric density . Therefore , omitting terms related to cardinality ( Vo et al. , 2018 ) , like p ( n ) , does not matter when comparing them . Further discussion is in Appendix A.1 . Our goal is to have a generative model defined with θ that can produce sets as realizations . One way to generate realizations of different point processes is to transform the points drawn from a uniform Poisson process with an invertible function . The only requirement is that the process remains locally finite ( Baddeley et al. , 2006 , Section 1.7 ) . To keep track of the likelihood we will use the change of variables formula from the normalizing flow framework . 3 UNIFYING POINT PROCESS MODELS WITH NORMALIZING FLOWS . In the following section we review the models for point processes and random sets that use likelihoods listed in Section 2 . These models can be found fully or partially in the literature on point processes and modeling exchangeable data . We unify them here under the common umbrella of normalizing flows . Their limitations form the foundation for our proposed solution in Section 4 . A normalizing flow is a generative model that defines a complex distribution as a series of invertible smooth transformations of the initial random variable ( Germain et al. , 2015 ) . That means , if we apply a function f : Rd → Rd to the random variable z ∼ q ( z ) , where f is invertible and differentiable , we can get the log-density of x = f ( z ) by calculating the change of variables formula : log p ( x ) = log q ( z ) − log ∣∣∣∣det ∂f ( z ) ∂z ∣∣∣∣ = log q ( f−1 ( x ) ) + log ∣∣∣∣det ∂f−1 ( x ) ∂x ∣∣∣∣ . ( 4 ) To sample from p ( x ) we first sample z from q ( z ) , then apply the forward transformation z 7→ x . To estimate density p ( x ) for a given sample , we apply the inverse transformation x 7→ z and use the above formula . We can also use a composition of functions f ( x ) = ( f1 ◦ · · · ◦ fk ) ( z ) to define more complex distributions , using Eq . 4 at every step . The main challenge of normalizing flow models is defining the function f . First , we want to have a way to efficiently calculate the inverse f−1 . Second , calculating the determinant of the Jacobian becomes prohibitively expensive as the dimension d grows . We often use f with a special Jacobian form , e.g . the determinant of a lower triangular matrix is simply the product of its diagonal entries . In all of our models we parametrize f−1 : Bn → Bn that transforms the input set X to a set Z , with its corresponding base density . To make sure p ( X ) is symmetric we have to satisfy two conditions . The base density q ( Z ) should be permutation invariant . The mapping f−1 should be permutation equivariant , meaning any permutation of the input permutes the output in the same way ( Papamakarios et al. , 2019 , Section 5.6 , Lemma 1 ) . We will see different ways to enforce this , along with how to handle varying input size n. A detailed implementation description is in Appendix B.1 . Inhomogeneous Poisson process . Given an observed set X we would like to use Eq . 2 for maximum likelihood training . Since the model assumes the independence between points we can define a normalizing flow on B , transform each point independently and get p ( X ) = ∏ i p ( xi ) with Eq . 4 . Invariance is achieved trivially . In the experiments , the flow is parametrized with coupling layers ( Dinh et al. , 2017 ) that have tractable inverse and determinant . Inside of coupling layers , elementwise functions are used , in particular splines with K knots ( Durkan et al. , 2019 ) . Autoregressive model with canonical ordering . The idea to order the points by some arbitrary dimension allows us to use Eq . 1 for training . The flow acts on densities over Bn . Since the ordering of the elements is known , a common approach is to use an autoregressive transformations that mimic the conditional probability formula by conditioning each element on all the previous , zi = f −1 θ ( xi|x1 , . . . , xi−1 ) ( Kingma et al. , 2016 ) . The ordered sequence of points ( x1 , . . . , xn ) is passed to f−1θ , parametrized with a recurrent neural network . This scales to different set sizes n. Stacking multiple such layers together with set coupling gives a model like in Bender et al . ( 2020 ) . Variational autoencoder and exchangeability . Another way to ensure exchangeability is to introduce a latent variable z such that the points xi are conditionally independent given z . Further , we want to maximize the log-likelihood log p ( X ) = log ∫ p ( X , z ) dz ( Eq . 3 ) ( Yuan et al. , 2020 ) . However , the true posterior p ( z|X ) is intractable so we approximate it with a variational distribution q ( z|X ) . We can now maximize the likelihood by maximizing the evidence lower bound : log p ( X ) ≥ Eq [ log p ( X|z ) ] −DKL [ q ( z|X ) ||p ( z|X ) ] . ( 5 ) Using amortized inference , parameters of q ( z|X ) are defined as a function of X , and taking gradients w.r.t . the samples is enabled with the reparametrization trick ( Kingma & Welling , 2014 ) . We use a standard posterior approximation — a factorized normal distributionN ( µ ( X ) , σ ( X ) ) . To ensure the functions µ and σ are permutation invariant , we use deep sets ( Zaheer et al. , 2017 ) , or set transformers ( Lee et al. , 2019 ) . The last thing we still need to calculate is log p ( X|z ) . Each point xi ∈ X is conditionally independent given z . In practice , this means we have an inhomogeneous Poisson process , but conditioned on a latent variable , i.e . a normalizing flow whose parameters are a function of z . To get a new realization we first sample z , then sample xi from a normalizing flow conditioned on z . To make a fair comparison with other methods we implement an importance weighted autoencoder with a tighter likelihood lower bound ( Burda et al. , 2015 ) .
This paper proposes a method based on continuous normalizing flows that can model random sets of exchangeable points. The advantages of the method are as follows: (1) it can handle a complex density function of sets and (2) it is designed so that model learning can be performed based on tractable likelihood while considering dependencies between samples. The effectiveness of the proposed method is shown in the experiments using synthetic and real-world datasets.
SP:e7de4f8c7d34e0371297b60ef316a6bdd343b2c3
Equivariant Normalizing Flows for Point Processes and Sets
A point process describes how random sets of exchangeable points are generated . The points usually influence the positions of each other via attractive and repulsive forces . To model this behavior , it is enough to transform the samples from the uniform process with a sufficiently complex equivariant function . However , learning the parameters of the resulting process is challenging since the likelihood is hard to estimate and often intractable . This leads us to our proposed model – CONFET . Based on continuous normalizing flows , it allows arbitrary interactions between points while having tractable likelihood . Experiments on various real and synthetic datasets show the improved performance of our new scalable approach . 1 INTRODUCTION . Many domains contain unordered data with a variable number of elements . The lack of ordering , also known as exchangeability , can be found in locations of cellular stations , locations of trees in a forest , point clouds , items in a shopping cart etc . This kind of data is represented with sets that are randomly generated from some underlying process that we wish to uncover . We choose to model this with spatial point processes , generative models whose realizations are sets of points . Perhaps the simplest non-trivial model is an inhomogeneous Poisson process . The locations of the points are assumed to be generated i.i.d . from some density ( Chiu et al. , 2013 ) . By simply modeling this density we can evaluate the likelihood and draw samples . We can do this easily with normalizing flows ( Germain et al. , 2015 ) . The process is then defined with a transformation of samples from a simple distribution to samples in the target distribution . However , the i.i.d . property is often wrong because the presence of one object will influence the distribution of the others . For example , short trees grow near each other , but are inhibited by taller trees ( Ogata & Tanemura , 1985 ) . As an example we can generate points on the interval ( 0 , 1 ) in the following way : we first flip a coin to decide whether to sample inside or outside of the interval ( 1/4 , 3/4 ) ; then sample two points x1 , x2 uniformly on the chosen subset . Although the marginals p ( x1 ) and p ( x2 ) are uniformly distributed , knowing the position of one point gives us information about the other . Therefore , we should not model this process as if the points are independent , but model the joint distribution p ( x1 , x2 ) , with a constraint that p is symmetric to permutations ( Figure 1 ) . Unfortunately , when we include interactions between the points , the problem becomes significantly harder because the likelihood is intractable ( Besag , 1975 ) . In this work , we present a way to solve this issue by using continuous normalizing flows that allow unrestricted transformations of points , with interactions between them . This way , a very hard problem of likelihood estimation suddenly becomes tractable . Our approach transforms simple processes into complex ones , by transforming their samples with expressive functions ( Figure 1 ) . Our main contributions are the following : • We reinterpret and unify existing techniques for modeling point processes and exchangeable data with normalizing flows . • We propose a new generative model ( CONFET ) that allows interactions between points and can be trained with maximum likelihood . The extensive experiments show that it outperforms other approaches , while remaining efficient and scalable . 2 POINT PROCESSES AND RANDOM SETS . Realizations of a finite point process on a bounded region B ⊂ Rd are finite sets of points X = { x1 , . . . , xn } , xi ∈ B . A point process is simple if no two points fall at exactly the same place . In practice , point processes are usually both finite and simple . One way to construct a general point process is by defining a discrete distribution p ( n ) for the number of points and a symmetric probability density p ( X ) on Bn for their locations ( Daley & Vere-Jones , 2007 ) . The symmetry requirement comes from the fact that the probability of a sequence ( xπ ( 1 ) , . . . , xπ ( n ) ) is the same for any permutation of the elements π — the points are exchangeable . Not knowing the order of the points can be solved trivially by averaging any density over all n ! permutations . Another approach is to impose a canonical order , e.g . sorting the points by one of the dimensions . Then the probability of observing a set of exchangeable elements is defined w.r.t . the joint probability of an order statistic x ( 1 ) < · · · < x ( n ) ( Casella & Berger , 2002 ) : p ( X ) = 1 n ! p ( x ( 1 ) , . . . , x ( n ) ) . ( 1 ) A traditional way to define a point process is with an intensity function that assigns a non-negative value to every subset of B , corresponding to a number of points we expect to see there ( Møller & Waagepetersen , 2003 ) . An example is a homogeneous Poisson process with constant intensity λ . To generate a new realization , we first sample n ∼ Pois ( λ ) , and then sample n points uniformly on B . If we define the intensity as a function of position λ ( x ) , we get an inhomogeneous Poisson process which is equivalent to defining the un-normalized probability density function on B . Now n follows Pois ( Λ ) , where Λ is the total intensity ∫ λ ( x ) dx . We get the density at a location x by normalizing the intensity p ( x ) = λ ( x ) /Λ . Combining the distribution of the number of points with the distribution of their locations gives us a well known formula for the likelihood of an inhomogeneous Poisson process ( Daley & Vere-Jones , 2007 , eq . 7.1.2 ) : L ( X ) = ( ∏ xi∈X λ ( xi ) ) exp ( − ∫ B λ ( x ) dx ) . ( 2 ) Instead of modeling λ ( x ) , we can model p ( x ) directly to avoid estimating the integral , without losing generality ( Yuan et al. , 2020 ) . This shift in the perspective from intensity to probability density function allows us to utilize rich existing methods from density estimation . An extension of an inhomogeneous process that allows interactions between points defines the conditional intensity λ ( xi|X ) ( Papangelou , 1974 ) . This may be interpreted as the conditional probability of having a point at xi given the rest of the process coincides with X . The likelihood is not tractable anymore so previous works used pseudolikelihood instead , replacing λ ( x ) with λ ( x|X ) in Eq . 2 ( Besag , 1975 ; Baddeley & Turner , 2000 ) . One example of such a process is a clustering process ( Neyman & Scott , 1958 ) that generates the points in two steps . First , we sample the cluster centers from a Poisson process , then we sample the final points from normal distributions centered around cluster positions . In contrast , a repulsion process ( Matérn , 2013 ) generates initial points from a uniform process and removes those that have neighbors inside radius R. A different perspective on point processes is viewing them as random sets ( Baddeley et al. , 2006 ) . Recent approaches for modeling sets ( Korshunova et al. , 2018 ; Bender et al. , 2020 ) invoke de Finetti ’ s theorem ( De Finetti , 1937 ) which states that the probability of an infinite exchangeable sequence is a mixture of i.i.d . processes : p ( X ) = ∫ p ( z ) ∏ xi∈X p ( xi|z ) dz , ( 3 ) here written for a finite subset ( O ’ Neill , 2009 , Theorem 1 ) . We can use Eq . 3 to construct a latent variable model where points are independent of each other given z . Since the integral is intractable , we will have to resort to approximate inference . Equations 1 , 2 and 3 give us different ways to obtain the parameters θ of a point process by maximizing the likelihood pθ ( X ) . However , the approaches that arise from them are equivalent in the sense they all model the same symmetric density . Therefore , omitting terms related to cardinality ( Vo et al. , 2018 ) , like p ( n ) , does not matter when comparing them . Further discussion is in Appendix A.1 . Our goal is to have a generative model defined with θ that can produce sets as realizations . One way to generate realizations of different point processes is to transform the points drawn from a uniform Poisson process with an invertible function . The only requirement is that the process remains locally finite ( Baddeley et al. , 2006 , Section 1.7 ) . To keep track of the likelihood we will use the change of variables formula from the normalizing flow framework . 3 UNIFYING POINT PROCESS MODELS WITH NORMALIZING FLOWS . In the following section we review the models for point processes and random sets that use likelihoods listed in Section 2 . These models can be found fully or partially in the literature on point processes and modeling exchangeable data . We unify them here under the common umbrella of normalizing flows . Their limitations form the foundation for our proposed solution in Section 4 . A normalizing flow is a generative model that defines a complex distribution as a series of invertible smooth transformations of the initial random variable ( Germain et al. , 2015 ) . That means , if we apply a function f : Rd → Rd to the random variable z ∼ q ( z ) , where f is invertible and differentiable , we can get the log-density of x = f ( z ) by calculating the change of variables formula : log p ( x ) = log q ( z ) − log ∣∣∣∣det ∂f ( z ) ∂z ∣∣∣∣ = log q ( f−1 ( x ) ) + log ∣∣∣∣det ∂f−1 ( x ) ∂x ∣∣∣∣ . ( 4 ) To sample from p ( x ) we first sample z from q ( z ) , then apply the forward transformation z 7→ x . To estimate density p ( x ) for a given sample , we apply the inverse transformation x 7→ z and use the above formula . We can also use a composition of functions f ( x ) = ( f1 ◦ · · · ◦ fk ) ( z ) to define more complex distributions , using Eq . 4 at every step . The main challenge of normalizing flow models is defining the function f . First , we want to have a way to efficiently calculate the inverse f−1 . Second , calculating the determinant of the Jacobian becomes prohibitively expensive as the dimension d grows . We often use f with a special Jacobian form , e.g . the determinant of a lower triangular matrix is simply the product of its diagonal entries . In all of our models we parametrize f−1 : Bn → Bn that transforms the input set X to a set Z , with its corresponding base density . To make sure p ( X ) is symmetric we have to satisfy two conditions . The base density q ( Z ) should be permutation invariant . The mapping f−1 should be permutation equivariant , meaning any permutation of the input permutes the output in the same way ( Papamakarios et al. , 2019 , Section 5.6 , Lemma 1 ) . We will see different ways to enforce this , along with how to handle varying input size n. A detailed implementation description is in Appendix B.1 . Inhomogeneous Poisson process . Given an observed set X we would like to use Eq . 2 for maximum likelihood training . Since the model assumes the independence between points we can define a normalizing flow on B , transform each point independently and get p ( X ) = ∏ i p ( xi ) with Eq . 4 . Invariance is achieved trivially . In the experiments , the flow is parametrized with coupling layers ( Dinh et al. , 2017 ) that have tractable inverse and determinant . Inside of coupling layers , elementwise functions are used , in particular splines with K knots ( Durkan et al. , 2019 ) . Autoregressive model with canonical ordering . The idea to order the points by some arbitrary dimension allows us to use Eq . 1 for training . The flow acts on densities over Bn . Since the ordering of the elements is known , a common approach is to use an autoregressive transformations that mimic the conditional probability formula by conditioning each element on all the previous , zi = f −1 θ ( xi|x1 , . . . , xi−1 ) ( Kingma et al. , 2016 ) . The ordered sequence of points ( x1 , . . . , xn ) is passed to f−1θ , parametrized with a recurrent neural network . This scales to different set sizes n. Stacking multiple such layers together with set coupling gives a model like in Bender et al . ( 2020 ) . Variational autoencoder and exchangeability . Another way to ensure exchangeability is to introduce a latent variable z such that the points xi are conditionally independent given z . Further , we want to maximize the log-likelihood log p ( X ) = log ∫ p ( X , z ) dz ( Eq . 3 ) ( Yuan et al. , 2020 ) . However , the true posterior p ( z|X ) is intractable so we approximate it with a variational distribution q ( z|X ) . We can now maximize the likelihood by maximizing the evidence lower bound : log p ( X ) ≥ Eq [ log p ( X|z ) ] −DKL [ q ( z|X ) ||p ( z|X ) ] . ( 5 ) Using amortized inference , parameters of q ( z|X ) are defined as a function of X , and taking gradients w.r.t . the samples is enabled with the reparametrization trick ( Kingma & Welling , 2014 ) . We use a standard posterior approximation — a factorized normal distributionN ( µ ( X ) , σ ( X ) ) . To ensure the functions µ and σ are permutation invariant , we use deep sets ( Zaheer et al. , 2017 ) , or set transformers ( Lee et al. , 2019 ) . The last thing we still need to calculate is log p ( X|z ) . Each point xi ∈ X is conditionally independent given z . In practice , this means we have an inhomogeneous Poisson process , but conditioned on a latent variable , i.e . a normalizing flow whose parameters are a function of z . To get a new realization we first sample z , then sample xi from a normalizing flow conditioned on z . To make a fair comparison with other methods we implement an importance weighted autoencoder with a tighter likelihood lower bound ( Burda et al. , 2015 ) .
This paper proposes a method for modeling exchangeable sets of data, or point processes. Specifically, the paper is interested in applying normalizing flow methods to these point processes. The paper proposes a method using continuous normalizing flows, and compares the performance of their proposed method, Confet, to baselines on simulated and real data. The paper finds that Confet outperforms the other methods in terms of test loss.
SP:e7de4f8c7d34e0371297b60ef316a6bdd343b2c3
Integrating Categorical Semantics into Unsupervised Domain Translation
1 INTRODUCTION . Domain translation has sparked a lot of interest in the computer vision community following the work of Isola et al . ( 2016 ) on image-to-image translation . This was done by learning a conditional GAN ( Mirza & Osindero , 2014 ) , in a supervised manner , using paired samples from the source and target domains . CycleGAN ( Zhu et al. , 2017a ) considered the task of unpaired and unsupervised image-to-image translation , showing that such a translation was possible by simply learning a mapping and its inverse under a cycle-consistency constraint , with GAN losses for each domain . But , as has been noted , despite the cycle-consistency constraint , the proposed translation problem is fundamentally ill-posed and can consequently result in arbitrary mappings ( Benaim et al. , 2018 ; Galanti et al. , 2018 ; de Bézenac et al. , 2019 ) . Nevertheless , CycleGAN and its derivatives have shown impressive empirical results on a variety of image translation tasks . Galanti et al . ( 2018 ) and de Bézenac et al . ( 2019 ) argue that CycleGAN ’ s success is owed , for the most part , to architectural choices that induce implicit biases toward minimal complexity mappings . That being said , CycleGAN , and follow-up works on unsupervised domain translation , have commonly been applied on domains in which a translation entails little geometric changes and the style of the generated sample is independent of the semantic content in the source sample . Commonly showcased examples include translating edges $ shoes and horses $ zebras . While these approaches are not without applications , we demonstrate two situations where unsupervised domain translation methods are currently lacking . The first one , which we call SemanticPreserving Unsupervised Domain Translation ( SPUDT ) , is defined as translating , without supervision , between domains that share common semantic attributes . Such attributes may be a non-trivial composition of features obfuscated by domain-dependent spurious features , making it hard for the current methods to translate the samples while preserving the shared semantics despite the implicit bias . Translating between MNIST $ SVHN is an example of translation where the shared semantics , the digit identity , is obfuscated by many spurious features , such as colours and background distractors , in the SVHN domains . In section 4.1 , we take this specific example and demonstrate that using domain invariant categorical semantics improves the digit preservation in UDT . The second situation that we consider is Style-Heterogeneous Domain Translation ( SHDT ) . SHDT refers to a translation in which the target domain includes many semantic categories , with a distinct ⇤Correspondence to : samuel.lavoie.m @ gmail.com . †CIFAR fellow 1The public code can be found : https : //github.com/lavoiems/Cats-UDT . style per semantic category . We demonstrate that , in this situation , the style encoder must be conditioned on the shared semantics to generate a style consistent with the semantics of the given source image . In Section 4.2 , we consider an example of this problem where we translate an ensemble of sketches , with different objects among them , to real images . In this paper , we explore both the SPUDT and SHDT settings . In particular , we demonstrate how domain invariant categorical semantics can improve translation in these settings . Existing works ( Hoffman et al. , 2018 ; Bousmalis et al. , 2017 ) have considered semi-supervised variants by training a classifier with labels on the source domain . But , differently from them , we show that it is possible to perform well at both kinds of tasks without any supervision , simply with access to unlabelled samples from the two domains . This additional constraint may further enable applications of domain translation in situations where labelled data is absent or scarce . To tackle these problems , we propose a method which we refer to as Categorical Semantics Unsupervised Domain Translation ( CatS-UDT ) . CatS-UDT consists of two steps : ( 1 ) learning an inference model of the shared categorical semantics across the domains of interest without supervision and ( 2 ) using a domain translation model in which we condition the style generation by inferring the learned semantics of the source sample using the model learned at the previous step . We depict the first step in Figure 1b and the second in Figure 2 . More specifically , the contributions of this work are the following : • Novel framework for learning invariant categorical semantics across domains ( Section 3.1 ) . • Introduction of a method of semantic style modulation to make SHDT generations more consistent ( Section 3.2 ) . • Comparison with UDT baselines on SPUDT and SHDT highlighting their existing challenges and demonstrating the relevance of our incorporating semantics into UDT ( Section 4 ) . 2 RELATED WORKS . Domain translation is concerned with translating samples from a source domain to a target domain . In general , we categorize a translation that uses pairing or supervision through labels as supervised domain translation and a translation that does not use pairing or labels as unsupervised domain translation . Supervised domain translation methods have generally achieved success through either the use of pairing or the use of supervised labels . Methods that leverage the use of category labels include Taigman et al . ( 2017 ) ; Hoffman et al . ( 2018 ) ; Bousmalis et al . ( 2017 ) . The differences between these approaches lie in particular architectural choices and auxiliary objectives for training the translation network . Alternatively , Isola et al . ( 2016 ) ; Gonzalez-Garcia et al . ( 2018 ) ; Wang et al . ( 2018 ; 2019 ) ; Zhang et al . ( 2020 ) leverage paired samples as a signal to guide the translation . Also , some works propose to leverage a segmentation mask ( Tomei et al. , 2019 ; Roy et al. , 2019 ; Mo et al. , 2019 ) . Another strategy is to use the representation of a pre-trained network as semantic information ( Ma et al. , 2019 ; Wang et al. , 2019 ; Wu et al. , 2019 ; Zhang et al. , 2020 ) . Such a representation typically comes from the intermediate layer of a VGG ( Liu & Deng , 2015 ) network pre-trained with labelled ImageNET ( Deng et al. , 2009 ) . Conversely to our work , ( Murez et al. , 2018 ) propose to use image-to-image translation to regularize domain adaptation . Unsupervised domain translation considers the task of domain translation without any supervision , whether through labels or pairing of images across domains . CycleGAN ( Zhu et al. , 2017a ) proposed to learn a mapping and its inverse constrained with a cycle-consistency loss . The authors demonstrated that CycleGAN works surprisingly well for some translation problems . Later works have improved this class of models ( Liu et al. , 2017 ; Kim et al. , 2017 ; Almahairi et al. , 2018 ; Huang et al. , 2018 ; Choi et al. , 2017 ; 2019 ; Press et al. , 2019 ) , enabling multi-modal and more diverse generations . But , as shown in Galanti et al . ( 2018 ) , the success of these methods is mostly due to architectural constraints and regularizers that implicitly bias the translation toward mappings with minimum complexity . We recognize the usefulness of this inductive bias for preserving low-level features like the pose of the source image . This observation motivates the method proposed in Section 3.2 for conditioning the style using the semantics . 3 CATEGORICAL SEMANTICS UNSUPERVISED DOMAIN TRANSLATION . In this section , we present our two main technical contributions . First , we discuss an unsupervised approach for learning categorical semantics that is invariant across domains . Next , we incorporate the learned categorical semantics into the domain translation pipeline by conditioning the style generation on the learned categorical-code . 3.1 UNSUPERVISED LEARNING OF DOMAIN INVARIANT CATEGORICAL SEMANTICS . The framework for learning the domain invariant categorical representation , summarized in Figure 1b , is composed of three constituents : unsupervised representation learning , clustering and domain adaptation . First , embed the data of the source and target domains into a representation that lends itself to clustering . This step can be ignored if the raw data is already in a form that can easily be clustered . Second , cluster the embedding of one of the domains . Third , use the learned clusters as the ground truth label in an unsupervised domain adaptation method . We provide a background of each of the constituents in Appendix A and concrete examples in Section 4 . Here , we motivate their utilities and describe how they are used in the present framework . Representation learning . Pre-trained supervised representations have been used in many instances as a way to preserve alignment in domain translation ( Ma et al. , 2019 ; Wang et al. , 2019 ) . In contrast to prior works that use models trained with supervision , we use models trained with selfsupervision ( van den Oord et al. , 2018a ; Hjelm et al. , 2019 ; He et al. , 2020 ; Chen et al. , 2020a ) . Self-supervision defines objectives that depends only on the intrinsic information within data . This allows for the use of unlabelled data , which in turn could enable the applicability of domain translation to modalities or domains where labelled data is scarce . In this work , we consider the noise contrastive estimation ( van den Oord et al. , 2018b ) which minimizes the distance in a normalized representation space between an anchor sample and its transformation and maximizes the distance between the same anchor sample and another sample in the data distribution . Formally , we learn the embedding function d : X ! RD of samples x 2 X as follows : argmin d Exi⇠X log exp ( d ( xi ) · d ( x0i ) /⌧ ) PK j=0 exp ( d ( xi ) · d ( xj ) /⌧ ) , ( 1 ) where ⌧ > 0 is a hyper-parameter , xi is the anchor sample with its transformation x0i = t ( xi ) and t : X ! X defines the set of transformations that we want our embedding space to be invariant to . While other works use the learned representation directly in the domain translation model , we propose to use it as a leverage to obtain a categorical and domain invariant embedding as described next . In some instances , the data representation is already amenable to clustering . In those cases , this step of representation learning can be ignored . Clustering allows us to learn a categorical representation of our data without supervision . Some advantages of using such a representation are as follows : • A categorical representation provides a way to select exemplars without supervision by simply selecting an exemplar from the same categorical distribution of the source sample . • The representation is straightforward to evaluate and to interpret . Samples with the same semantic attributes should have the same cluster . In practice , we cluster one domain because , as we see in Figure 1a , the continuous embedding of each domain obtained from a learned model may be disjoint when they are sufficiently different . Therefore , a clustering algorithm would segregate each domain into its own clusters . Also , the domain used to determine the initial clusters is important as some domains may be more amenable to clustering than others . Deciding which domain to cluster depends on the data and the choice should be made after evaluation of the clusters or inspection of the data . More formally , consider X0 ⇢ RN be the domain chosen to be clustered . Assume a given embedding function d : X0 ! RD that can be learned using self-supervision . If X0 is already cluster-able , d can be the identity function . Let c : RD ! C be a mapping from the embedding of X0 to the space of clusters C. We propose to cluster the embedding representation of the data : argmin c C ( c , d ( X0 ) ) , ( 2 ) where C is a clustering objective . The framework is agnostic to the clustering algorithm used . In our experiments ( Section 4 ) , we considered IMSAT ( Hu et al. , 2017 ) for clustering MNIST and Spectral Clustering ( Donath & Hoffman , 1973 ) for clustering the learned embedding of our real images . We give a more thorough background of IMSAT in Appendix B.3 and refer to Luxburg ( 2007 ) for a background of Spectral clustering . Unsupervised domain adaptation . Given clusters learned using samples from a domain X0 , it is unlikely that such clusters will generalize to samples from a different domain with a considerable shift . This can be observed in Figure 1a where , if we clustered the samples of the real images , it is not clear that the samples from the Sketches domain would semantically cluster as we expect . That is , samples with the same semantic category may not be grouped in the same cluster . Unsupervised domain adaptation ( Ben-David et al. , 2010 ) tries to solve this problem where one has one supervised domain . However , rather than using labels obtained through supervision from a source domain , we propose to use the learned clusters as ground-truth labels on the source domain . This modification allows us to adapt and make the clusters learned on one domain invariant to the other domain . More formally , given two spaces X0 2 RN , X1 2 RN representing the data space of domains 0 and 1 respectively , given a C-way one-hot mapping of the embedding of domain 0 to clusters , c : d ( X0 ) ! C ( C ⇢ { 0 , 1 } C ) , we propose to learn an adapted clustering h : X0 [ X1 ! C. We do so by optimizing : argmin h Ex0⇠X0c ( d ( x0 ) ) log h ( x0 ) + ⌦ ( h , X0 , X1 ) . ( 3 ) ⌦ represents the regularizers used in unsupervised domain adaptation . The framework is also agnostic to the regularizers used in practice . In our experiments , the regularizers comprised of gradient reversal ( Ganin et al. , 2016 ) , VADA ( Shu et al. , 2018 ) and VMT ( Mao et al. , 2019 ) . We describe those regularizers in more detail in Appendix B.5 .
This paper presents unsupervised domain translation (UDT), considering two scenarios: Semantic Preserving Unsupervised Domain Translation (SPUDT) and is Style-Heterogeneous Domain Translation (SHDT). This study uses MNIST and SVHN datasets for demonstrating SPUDT and Sketches and Reals samples from the DomainNet dataset for demonstrating SHDT. Although the method uses different components depending on the scenario (or dataset), the presented architecture is essentially the same.
SP:17a9ff5184de391ff498d72f69ec884c2d5927a8
Integrating Categorical Semantics into Unsupervised Domain Translation
1 INTRODUCTION . Domain translation has sparked a lot of interest in the computer vision community following the work of Isola et al . ( 2016 ) on image-to-image translation . This was done by learning a conditional GAN ( Mirza & Osindero , 2014 ) , in a supervised manner , using paired samples from the source and target domains . CycleGAN ( Zhu et al. , 2017a ) considered the task of unpaired and unsupervised image-to-image translation , showing that such a translation was possible by simply learning a mapping and its inverse under a cycle-consistency constraint , with GAN losses for each domain . But , as has been noted , despite the cycle-consistency constraint , the proposed translation problem is fundamentally ill-posed and can consequently result in arbitrary mappings ( Benaim et al. , 2018 ; Galanti et al. , 2018 ; de Bézenac et al. , 2019 ) . Nevertheless , CycleGAN and its derivatives have shown impressive empirical results on a variety of image translation tasks . Galanti et al . ( 2018 ) and de Bézenac et al . ( 2019 ) argue that CycleGAN ’ s success is owed , for the most part , to architectural choices that induce implicit biases toward minimal complexity mappings . That being said , CycleGAN , and follow-up works on unsupervised domain translation , have commonly been applied on domains in which a translation entails little geometric changes and the style of the generated sample is independent of the semantic content in the source sample . Commonly showcased examples include translating edges $ shoes and horses $ zebras . While these approaches are not without applications , we demonstrate two situations where unsupervised domain translation methods are currently lacking . The first one , which we call SemanticPreserving Unsupervised Domain Translation ( SPUDT ) , is defined as translating , without supervision , between domains that share common semantic attributes . Such attributes may be a non-trivial composition of features obfuscated by domain-dependent spurious features , making it hard for the current methods to translate the samples while preserving the shared semantics despite the implicit bias . Translating between MNIST $ SVHN is an example of translation where the shared semantics , the digit identity , is obfuscated by many spurious features , such as colours and background distractors , in the SVHN domains . In section 4.1 , we take this specific example and demonstrate that using domain invariant categorical semantics improves the digit preservation in UDT . The second situation that we consider is Style-Heterogeneous Domain Translation ( SHDT ) . SHDT refers to a translation in which the target domain includes many semantic categories , with a distinct ⇤Correspondence to : samuel.lavoie.m @ gmail.com . †CIFAR fellow 1The public code can be found : https : //github.com/lavoiems/Cats-UDT . style per semantic category . We demonstrate that , in this situation , the style encoder must be conditioned on the shared semantics to generate a style consistent with the semantics of the given source image . In Section 4.2 , we consider an example of this problem where we translate an ensemble of sketches , with different objects among them , to real images . In this paper , we explore both the SPUDT and SHDT settings . In particular , we demonstrate how domain invariant categorical semantics can improve translation in these settings . Existing works ( Hoffman et al. , 2018 ; Bousmalis et al. , 2017 ) have considered semi-supervised variants by training a classifier with labels on the source domain . But , differently from them , we show that it is possible to perform well at both kinds of tasks without any supervision , simply with access to unlabelled samples from the two domains . This additional constraint may further enable applications of domain translation in situations where labelled data is absent or scarce . To tackle these problems , we propose a method which we refer to as Categorical Semantics Unsupervised Domain Translation ( CatS-UDT ) . CatS-UDT consists of two steps : ( 1 ) learning an inference model of the shared categorical semantics across the domains of interest without supervision and ( 2 ) using a domain translation model in which we condition the style generation by inferring the learned semantics of the source sample using the model learned at the previous step . We depict the first step in Figure 1b and the second in Figure 2 . More specifically , the contributions of this work are the following : • Novel framework for learning invariant categorical semantics across domains ( Section 3.1 ) . • Introduction of a method of semantic style modulation to make SHDT generations more consistent ( Section 3.2 ) . • Comparison with UDT baselines on SPUDT and SHDT highlighting their existing challenges and demonstrating the relevance of our incorporating semantics into UDT ( Section 4 ) . 2 RELATED WORKS . Domain translation is concerned with translating samples from a source domain to a target domain . In general , we categorize a translation that uses pairing or supervision through labels as supervised domain translation and a translation that does not use pairing or labels as unsupervised domain translation . Supervised domain translation methods have generally achieved success through either the use of pairing or the use of supervised labels . Methods that leverage the use of category labels include Taigman et al . ( 2017 ) ; Hoffman et al . ( 2018 ) ; Bousmalis et al . ( 2017 ) . The differences between these approaches lie in particular architectural choices and auxiliary objectives for training the translation network . Alternatively , Isola et al . ( 2016 ) ; Gonzalez-Garcia et al . ( 2018 ) ; Wang et al . ( 2018 ; 2019 ) ; Zhang et al . ( 2020 ) leverage paired samples as a signal to guide the translation . Also , some works propose to leverage a segmentation mask ( Tomei et al. , 2019 ; Roy et al. , 2019 ; Mo et al. , 2019 ) . Another strategy is to use the representation of a pre-trained network as semantic information ( Ma et al. , 2019 ; Wang et al. , 2019 ; Wu et al. , 2019 ; Zhang et al. , 2020 ) . Such a representation typically comes from the intermediate layer of a VGG ( Liu & Deng , 2015 ) network pre-trained with labelled ImageNET ( Deng et al. , 2009 ) . Conversely to our work , ( Murez et al. , 2018 ) propose to use image-to-image translation to regularize domain adaptation . Unsupervised domain translation considers the task of domain translation without any supervision , whether through labels or pairing of images across domains . CycleGAN ( Zhu et al. , 2017a ) proposed to learn a mapping and its inverse constrained with a cycle-consistency loss . The authors demonstrated that CycleGAN works surprisingly well for some translation problems . Later works have improved this class of models ( Liu et al. , 2017 ; Kim et al. , 2017 ; Almahairi et al. , 2018 ; Huang et al. , 2018 ; Choi et al. , 2017 ; 2019 ; Press et al. , 2019 ) , enabling multi-modal and more diverse generations . But , as shown in Galanti et al . ( 2018 ) , the success of these methods is mostly due to architectural constraints and regularizers that implicitly bias the translation toward mappings with minimum complexity . We recognize the usefulness of this inductive bias for preserving low-level features like the pose of the source image . This observation motivates the method proposed in Section 3.2 for conditioning the style using the semantics . 3 CATEGORICAL SEMANTICS UNSUPERVISED DOMAIN TRANSLATION . In this section , we present our two main technical contributions . First , we discuss an unsupervised approach for learning categorical semantics that is invariant across domains . Next , we incorporate the learned categorical semantics into the domain translation pipeline by conditioning the style generation on the learned categorical-code . 3.1 UNSUPERVISED LEARNING OF DOMAIN INVARIANT CATEGORICAL SEMANTICS . The framework for learning the domain invariant categorical representation , summarized in Figure 1b , is composed of three constituents : unsupervised representation learning , clustering and domain adaptation . First , embed the data of the source and target domains into a representation that lends itself to clustering . This step can be ignored if the raw data is already in a form that can easily be clustered . Second , cluster the embedding of one of the domains . Third , use the learned clusters as the ground truth label in an unsupervised domain adaptation method . We provide a background of each of the constituents in Appendix A and concrete examples in Section 4 . Here , we motivate their utilities and describe how they are used in the present framework . Representation learning . Pre-trained supervised representations have been used in many instances as a way to preserve alignment in domain translation ( Ma et al. , 2019 ; Wang et al. , 2019 ) . In contrast to prior works that use models trained with supervision , we use models trained with selfsupervision ( van den Oord et al. , 2018a ; Hjelm et al. , 2019 ; He et al. , 2020 ; Chen et al. , 2020a ) . Self-supervision defines objectives that depends only on the intrinsic information within data . This allows for the use of unlabelled data , which in turn could enable the applicability of domain translation to modalities or domains where labelled data is scarce . In this work , we consider the noise contrastive estimation ( van den Oord et al. , 2018b ) which minimizes the distance in a normalized representation space between an anchor sample and its transformation and maximizes the distance between the same anchor sample and another sample in the data distribution . Formally , we learn the embedding function d : X ! RD of samples x 2 X as follows : argmin d Exi⇠X log exp ( d ( xi ) · d ( x0i ) /⌧ ) PK j=0 exp ( d ( xi ) · d ( xj ) /⌧ ) , ( 1 ) where ⌧ > 0 is a hyper-parameter , xi is the anchor sample with its transformation x0i = t ( xi ) and t : X ! X defines the set of transformations that we want our embedding space to be invariant to . While other works use the learned representation directly in the domain translation model , we propose to use it as a leverage to obtain a categorical and domain invariant embedding as described next . In some instances , the data representation is already amenable to clustering . In those cases , this step of representation learning can be ignored . Clustering allows us to learn a categorical representation of our data without supervision . Some advantages of using such a representation are as follows : • A categorical representation provides a way to select exemplars without supervision by simply selecting an exemplar from the same categorical distribution of the source sample . • The representation is straightforward to evaluate and to interpret . Samples with the same semantic attributes should have the same cluster . In practice , we cluster one domain because , as we see in Figure 1a , the continuous embedding of each domain obtained from a learned model may be disjoint when they are sufficiently different . Therefore , a clustering algorithm would segregate each domain into its own clusters . Also , the domain used to determine the initial clusters is important as some domains may be more amenable to clustering than others . Deciding which domain to cluster depends on the data and the choice should be made after evaluation of the clusters or inspection of the data . More formally , consider X0 ⇢ RN be the domain chosen to be clustered . Assume a given embedding function d : X0 ! RD that can be learned using self-supervision . If X0 is already cluster-able , d can be the identity function . Let c : RD ! C be a mapping from the embedding of X0 to the space of clusters C. We propose to cluster the embedding representation of the data : argmin c C ( c , d ( X0 ) ) , ( 2 ) where C is a clustering objective . The framework is agnostic to the clustering algorithm used . In our experiments ( Section 4 ) , we considered IMSAT ( Hu et al. , 2017 ) for clustering MNIST and Spectral Clustering ( Donath & Hoffman , 1973 ) for clustering the learned embedding of our real images . We give a more thorough background of IMSAT in Appendix B.3 and refer to Luxburg ( 2007 ) for a background of Spectral clustering . Unsupervised domain adaptation . Given clusters learned using samples from a domain X0 , it is unlikely that such clusters will generalize to samples from a different domain with a considerable shift . This can be observed in Figure 1a where , if we clustered the samples of the real images , it is not clear that the samples from the Sketches domain would semantically cluster as we expect . That is , samples with the same semantic category may not be grouped in the same cluster . Unsupervised domain adaptation ( Ben-David et al. , 2010 ) tries to solve this problem where one has one supervised domain . However , rather than using labels obtained through supervision from a source domain , we propose to use the learned clusters as ground-truth labels on the source domain . This modification allows us to adapt and make the clusters learned on one domain invariant to the other domain . More formally , given two spaces X0 2 RN , X1 2 RN representing the data space of domains 0 and 1 respectively , given a C-way one-hot mapping of the embedding of domain 0 to clusters , c : d ( X0 ) ! C ( C ⇢ { 0 , 1 } C ) , we propose to learn an adapted clustering h : X0 [ X1 ! C. We do so by optimizing : argmin h Ex0⇠X0c ( d ( x0 ) ) log h ( x0 ) + ⌦ ( h , X0 , X1 ) . ( 3 ) ⌦ represents the regularizers used in unsupervised domain adaptation . The framework is also agnostic to the regularizers used in practice . In our experiments , the regularizers comprised of gradient reversal ( Ganin et al. , 2016 ) , VADA ( Shu et al. , 2018 ) and VMT ( Mao et al. , 2019 ) . We describe those regularizers in more detail in Appendix B.5 .
The paper addresses the domain translation problem and proposes a novel approach to translate images between domains in an unsupervised manner, by integrating unsupervised learning of domain-invariant semantic features between the two domains. The paper is well-written with a clear standing point and motivation, along with well-described contributions. The paper has an inclusive and sound theoretical comparison to related work. Evaluation is well-designed and includes previous work in the same context.
SP:17a9ff5184de391ff498d72f69ec884c2d5927a8
Integrating Categorical Semantics into Unsupervised Domain Translation
1 INTRODUCTION . Domain translation has sparked a lot of interest in the computer vision community following the work of Isola et al . ( 2016 ) on image-to-image translation . This was done by learning a conditional GAN ( Mirza & Osindero , 2014 ) , in a supervised manner , using paired samples from the source and target domains . CycleGAN ( Zhu et al. , 2017a ) considered the task of unpaired and unsupervised image-to-image translation , showing that such a translation was possible by simply learning a mapping and its inverse under a cycle-consistency constraint , with GAN losses for each domain . But , as has been noted , despite the cycle-consistency constraint , the proposed translation problem is fundamentally ill-posed and can consequently result in arbitrary mappings ( Benaim et al. , 2018 ; Galanti et al. , 2018 ; de Bézenac et al. , 2019 ) . Nevertheless , CycleGAN and its derivatives have shown impressive empirical results on a variety of image translation tasks . Galanti et al . ( 2018 ) and de Bézenac et al . ( 2019 ) argue that CycleGAN ’ s success is owed , for the most part , to architectural choices that induce implicit biases toward minimal complexity mappings . That being said , CycleGAN , and follow-up works on unsupervised domain translation , have commonly been applied on domains in which a translation entails little geometric changes and the style of the generated sample is independent of the semantic content in the source sample . Commonly showcased examples include translating edges $ shoes and horses $ zebras . While these approaches are not without applications , we demonstrate two situations where unsupervised domain translation methods are currently lacking . The first one , which we call SemanticPreserving Unsupervised Domain Translation ( SPUDT ) , is defined as translating , without supervision , between domains that share common semantic attributes . Such attributes may be a non-trivial composition of features obfuscated by domain-dependent spurious features , making it hard for the current methods to translate the samples while preserving the shared semantics despite the implicit bias . Translating between MNIST $ SVHN is an example of translation where the shared semantics , the digit identity , is obfuscated by many spurious features , such as colours and background distractors , in the SVHN domains . In section 4.1 , we take this specific example and demonstrate that using domain invariant categorical semantics improves the digit preservation in UDT . The second situation that we consider is Style-Heterogeneous Domain Translation ( SHDT ) . SHDT refers to a translation in which the target domain includes many semantic categories , with a distinct ⇤Correspondence to : samuel.lavoie.m @ gmail.com . †CIFAR fellow 1The public code can be found : https : //github.com/lavoiems/Cats-UDT . style per semantic category . We demonstrate that , in this situation , the style encoder must be conditioned on the shared semantics to generate a style consistent with the semantics of the given source image . In Section 4.2 , we consider an example of this problem where we translate an ensemble of sketches , with different objects among them , to real images . In this paper , we explore both the SPUDT and SHDT settings . In particular , we demonstrate how domain invariant categorical semantics can improve translation in these settings . Existing works ( Hoffman et al. , 2018 ; Bousmalis et al. , 2017 ) have considered semi-supervised variants by training a classifier with labels on the source domain . But , differently from them , we show that it is possible to perform well at both kinds of tasks without any supervision , simply with access to unlabelled samples from the two domains . This additional constraint may further enable applications of domain translation in situations where labelled data is absent or scarce . To tackle these problems , we propose a method which we refer to as Categorical Semantics Unsupervised Domain Translation ( CatS-UDT ) . CatS-UDT consists of two steps : ( 1 ) learning an inference model of the shared categorical semantics across the domains of interest without supervision and ( 2 ) using a domain translation model in which we condition the style generation by inferring the learned semantics of the source sample using the model learned at the previous step . We depict the first step in Figure 1b and the second in Figure 2 . More specifically , the contributions of this work are the following : • Novel framework for learning invariant categorical semantics across domains ( Section 3.1 ) . • Introduction of a method of semantic style modulation to make SHDT generations more consistent ( Section 3.2 ) . • Comparison with UDT baselines on SPUDT and SHDT highlighting their existing challenges and demonstrating the relevance of our incorporating semantics into UDT ( Section 4 ) . 2 RELATED WORKS . Domain translation is concerned with translating samples from a source domain to a target domain . In general , we categorize a translation that uses pairing or supervision through labels as supervised domain translation and a translation that does not use pairing or labels as unsupervised domain translation . Supervised domain translation methods have generally achieved success through either the use of pairing or the use of supervised labels . Methods that leverage the use of category labels include Taigman et al . ( 2017 ) ; Hoffman et al . ( 2018 ) ; Bousmalis et al . ( 2017 ) . The differences between these approaches lie in particular architectural choices and auxiliary objectives for training the translation network . Alternatively , Isola et al . ( 2016 ) ; Gonzalez-Garcia et al . ( 2018 ) ; Wang et al . ( 2018 ; 2019 ) ; Zhang et al . ( 2020 ) leverage paired samples as a signal to guide the translation . Also , some works propose to leverage a segmentation mask ( Tomei et al. , 2019 ; Roy et al. , 2019 ; Mo et al. , 2019 ) . Another strategy is to use the representation of a pre-trained network as semantic information ( Ma et al. , 2019 ; Wang et al. , 2019 ; Wu et al. , 2019 ; Zhang et al. , 2020 ) . Such a representation typically comes from the intermediate layer of a VGG ( Liu & Deng , 2015 ) network pre-trained with labelled ImageNET ( Deng et al. , 2009 ) . Conversely to our work , ( Murez et al. , 2018 ) propose to use image-to-image translation to regularize domain adaptation . Unsupervised domain translation considers the task of domain translation without any supervision , whether through labels or pairing of images across domains . CycleGAN ( Zhu et al. , 2017a ) proposed to learn a mapping and its inverse constrained with a cycle-consistency loss . The authors demonstrated that CycleGAN works surprisingly well for some translation problems . Later works have improved this class of models ( Liu et al. , 2017 ; Kim et al. , 2017 ; Almahairi et al. , 2018 ; Huang et al. , 2018 ; Choi et al. , 2017 ; 2019 ; Press et al. , 2019 ) , enabling multi-modal and more diverse generations . But , as shown in Galanti et al . ( 2018 ) , the success of these methods is mostly due to architectural constraints and regularizers that implicitly bias the translation toward mappings with minimum complexity . We recognize the usefulness of this inductive bias for preserving low-level features like the pose of the source image . This observation motivates the method proposed in Section 3.2 for conditioning the style using the semantics . 3 CATEGORICAL SEMANTICS UNSUPERVISED DOMAIN TRANSLATION . In this section , we present our two main technical contributions . First , we discuss an unsupervised approach for learning categorical semantics that is invariant across domains . Next , we incorporate the learned categorical semantics into the domain translation pipeline by conditioning the style generation on the learned categorical-code . 3.1 UNSUPERVISED LEARNING OF DOMAIN INVARIANT CATEGORICAL SEMANTICS . The framework for learning the domain invariant categorical representation , summarized in Figure 1b , is composed of three constituents : unsupervised representation learning , clustering and domain adaptation . First , embed the data of the source and target domains into a representation that lends itself to clustering . This step can be ignored if the raw data is already in a form that can easily be clustered . Second , cluster the embedding of one of the domains . Third , use the learned clusters as the ground truth label in an unsupervised domain adaptation method . We provide a background of each of the constituents in Appendix A and concrete examples in Section 4 . Here , we motivate their utilities and describe how they are used in the present framework . Representation learning . Pre-trained supervised representations have been used in many instances as a way to preserve alignment in domain translation ( Ma et al. , 2019 ; Wang et al. , 2019 ) . In contrast to prior works that use models trained with supervision , we use models trained with selfsupervision ( van den Oord et al. , 2018a ; Hjelm et al. , 2019 ; He et al. , 2020 ; Chen et al. , 2020a ) . Self-supervision defines objectives that depends only on the intrinsic information within data . This allows for the use of unlabelled data , which in turn could enable the applicability of domain translation to modalities or domains where labelled data is scarce . In this work , we consider the noise contrastive estimation ( van den Oord et al. , 2018b ) which minimizes the distance in a normalized representation space between an anchor sample and its transformation and maximizes the distance between the same anchor sample and another sample in the data distribution . Formally , we learn the embedding function d : X ! RD of samples x 2 X as follows : argmin d Exi⇠X log exp ( d ( xi ) · d ( x0i ) /⌧ ) PK j=0 exp ( d ( xi ) · d ( xj ) /⌧ ) , ( 1 ) where ⌧ > 0 is a hyper-parameter , xi is the anchor sample with its transformation x0i = t ( xi ) and t : X ! X defines the set of transformations that we want our embedding space to be invariant to . While other works use the learned representation directly in the domain translation model , we propose to use it as a leverage to obtain a categorical and domain invariant embedding as described next . In some instances , the data representation is already amenable to clustering . In those cases , this step of representation learning can be ignored . Clustering allows us to learn a categorical representation of our data without supervision . Some advantages of using such a representation are as follows : • A categorical representation provides a way to select exemplars without supervision by simply selecting an exemplar from the same categorical distribution of the source sample . • The representation is straightforward to evaluate and to interpret . Samples with the same semantic attributes should have the same cluster . In practice , we cluster one domain because , as we see in Figure 1a , the continuous embedding of each domain obtained from a learned model may be disjoint when they are sufficiently different . Therefore , a clustering algorithm would segregate each domain into its own clusters . Also , the domain used to determine the initial clusters is important as some domains may be more amenable to clustering than others . Deciding which domain to cluster depends on the data and the choice should be made after evaluation of the clusters or inspection of the data . More formally , consider X0 ⇢ RN be the domain chosen to be clustered . Assume a given embedding function d : X0 ! RD that can be learned using self-supervision . If X0 is already cluster-able , d can be the identity function . Let c : RD ! C be a mapping from the embedding of X0 to the space of clusters C. We propose to cluster the embedding representation of the data : argmin c C ( c , d ( X0 ) ) , ( 2 ) where C is a clustering objective . The framework is agnostic to the clustering algorithm used . In our experiments ( Section 4 ) , we considered IMSAT ( Hu et al. , 2017 ) for clustering MNIST and Spectral Clustering ( Donath & Hoffman , 1973 ) for clustering the learned embedding of our real images . We give a more thorough background of IMSAT in Appendix B.3 and refer to Luxburg ( 2007 ) for a background of Spectral clustering . Unsupervised domain adaptation . Given clusters learned using samples from a domain X0 , it is unlikely that such clusters will generalize to samples from a different domain with a considerable shift . This can be observed in Figure 1a where , if we clustered the samples of the real images , it is not clear that the samples from the Sketches domain would semantically cluster as we expect . That is , samples with the same semantic category may not be grouped in the same cluster . Unsupervised domain adaptation ( Ben-David et al. , 2010 ) tries to solve this problem where one has one supervised domain . However , rather than using labels obtained through supervision from a source domain , we propose to use the learned clusters as ground-truth labels on the source domain . This modification allows us to adapt and make the clusters learned on one domain invariant to the other domain . More formally , given two spaces X0 2 RN , X1 2 RN representing the data space of domains 0 and 1 respectively , given a C-way one-hot mapping of the embedding of domain 0 to clusters , c : d ( X0 ) ! C ( C ⇢ { 0 , 1 } C ) , we propose to learn an adapted clustering h : X0 [ X1 ! C. We do so by optimizing : argmin h Ex0⇠X0c ( d ( x0 ) ) log h ( x0 ) + ⌦ ( h , X0 , X1 ) . ( 3 ) ⌦ represents the regularizers used in unsupervised domain adaptation . The framework is also agnostic to the regularizers used in practice . In our experiments , the regularizers comprised of gradient reversal ( Ganin et al. , 2016 ) , VADA ( Shu et al. , 2018 ) and VMT ( Mao et al. , 2019 ) . We describe those regularizers in more detail in Appendix B.5 .
The authors use Domain Invariant Categorical Semantics to improve unsupervised domain translation (UDT). They learn these semantics in an unsupervised manner. They show how this can improve results on Semantic Preserving Unsupervised Domain Translation and Style Heterogeneous Domain Translation by doing experiments on MNIST<->SVHN (features traditionally learned are very different but digit identity could be the same) and Sketches->Reals (distinct styles) respectively.
SP:17a9ff5184de391ff498d72f69ec884c2d5927a8
Multi-Source Unsupervised Hyperparameter Optimization
1 INTRODUCTION . Hyperparameter optimization ( HPO ) has been a pivotal part of machine learning ( ML ) and contributed to achieving a good performance in a wide range of tasks ( Feurer & Hutter , 2019 ) . It is widely acknowledged that the performance of deep neural networks depends greatly on the configuration of the hyperparameters ( Dacrema et al. , 2019 ; Henderson et al. , 2018 ; Lucic et al. , 2018 ) . HPO is formulated as a special case of a black-box function optimization problem , where the input is a set of hyperparameters , and the output is a validation score . Among the black-box optimization methods , adaptive algorithms , such as Bayesian optimization ( BO ) ( Brochu et al. , 2010 ; Shahriari et al. , 2015 ; Frazier , 2018 ) have shown superior empirical performance compared with traditional algorithms , such as grid search or random search ( Bergstra & Bengio , 2012 ) . One critical assumption in HPO is the availability of an accurate validation score . However , in reality , there are many cases where we can not access the ground-truth of the task of interest ( referred to as target task hereinafter ) . For example , in display advertising , predicting the effectiveness of each advertisement , i.e. , click-through rates ( CTR ) , is important for showing relevant advertisements ( ads ) to users . Therefore , it is necessary to conduct HPO before a new ad campaign starts . However , for new ads that have not yet been displayed to users , one can not use labeled data to conduct HPO . In this case , the standard HPO procedure is infeasible , as one can not utilize the labeled target task data and the true validation score of the ML model under consideration . In this work , we address the infeasibility issue of HPO when the labels of the target task are unavailable . To formulate this situation , we introduce a novel HPO setting called multi-source unsupervised hyperparameter optimization ( MSU-HPO ) . In MSU-HPO , it is assumed that we do not have the labeled data for a target task . However , we do have the data for some source tasks with a different distribution from the target task . It is natural to assume that we have access to multiple source tasks in most practical settings . In the display advertising example , several labeled datasets of old ads that have already been deployed are often available , which we can use as labeled source task datasets . To the best of our knowledge , no HPO approach that can address a situation without labeled target task data exists despite its significance and possibility for applications . A problem with MSU-HPO is that the ground-truth is inaccessible , and one can not directly apply the standard HPO procedure . Thus , it is essential to accurately approximate it using only available data . For this purpose , we propose two estimators , enabling the evaluation of the ML models without the labeled target task data . Our estimators are general and can be used in combination with any common black-box optimization methods , such as Gaussian process-based BO ( Srinivas et al. , 2010 ; Snoek et al. , 2012 ; Hennig & Schuler , 2012 ; Contal et al. , 2014 ; Hernández-Lobato et al. , 2014 ; Wang & Jegelka , 2017 ) and the tree-structured Parzen estimator ( Bergstra et al. , 2011 ; 2013 ) . In addition , we show that the proposed estimators can unbiasedly approximate the target task objective , one of which achieves a desirable variance property by selecting useful source tasks based on a task divergence measure . We also present a general and computationally inexpensive HPO procedure for MSU-HPO building on our estimators . Finally , we demonstrate that our estimators work properly through numerical experiments with synthetic and real-world datasets . Related Work . A typical HPO setting is to find a better set of hyperparameters using a labeled target task of interest . As faster convergence is an essential performance metric of the HPO methods , the research community is moving on to the multi-source or transfer settings for which there are some previously solved related source tasks . By combining the additional source task information and the labeled target task dataset , it has been shown that one can improve the hyperparameter search efficiency , and thus reach a better solution with fewer evaluations ( Bonilla et al. , 2008 ; Bardenet et al. , 2013 ; Swersky et al. , 2013 ; Yogatama & Mann , 2014 ; Ramachandran et al. , 2018 ; Springenberg et al. , 2016 ; Poloczek et al. , 2017 ; Wistuba et al. , 2018 ; Feurer et al. , 2018 ; Perrone et al. , 2018 ; 2019 ; Salinas et al. , 2019 ) . A critical difference between the multi-source HPOs and our MSU-HPO settings is the existence of labels for the target task . Previous studies usually assume that analysts can utilize labeled target data . However , as discussed above , this is often unavailable , and thus , most of these methods are infeasible . One possible solution to address the unavailablity of labeled target data is to use warm starting methods ( Vanschoren , 2019 ) , which aims to find good initial hyperparameters for the target task . Learning Initialization ( LI ) finds promising hyperparameters by minimizing a sum of a loss function surrogated by a Gaussian process on each source task ( Wistuba et al. , 2015 ) . While LI is effective when the source and target tasks are quite similar , it is hard to achieve a reasonable performance otherwise . In contrast , DistBO learns the similarity between the source and target tasks with a joint Gaussian process model on hyperparameters and data representations ( Law et al. , 2019 ) . However , many transfer methods including DistBO need abundant hyperparameter evaluations for the source tasks to surrogate objective function for each task well , which will be confirmed in our experiments . Another related field is model evaluation in covariate shift , whose objective is to evaluate the performance of the ML models of the target task using only a relevant single source dataset ( Sugiyama et al. , 2007 ; You et al. , 2019 ; Zhong et al. , 2010 ) . These studies build on the importance sampling ( IS ) method ( Elvira et al. , 2015 ; Sugiyama et al. , 2007 ) to obtain an unbiased estimate of ground-truth model performances . While our proposed methods are also based on IS , a major difference is that we assume that there are multiple source datasets with different distributions . We demonstrate that with the multi-source setting , the previous IS method can fail , and propose an estimator satisfying the optimal variance property . Moreover , as these methods are specific to model evaluation , the connection between the IS-based estimation techniques and the automated HPO methods has not yet been explored despite their possible , broad applications . Consequently , we are the first to empirically evaluate the possible combination of the IS-based unbiased estimation and adaptive HPO . Contributions . The contributions of this work can be summarized as follows : ( i ) : We formulate a novel and highly practical HPO setting , MSU-HPO . ( ii ) : We propose two unbiased estimators for the ground-truth validation score calculable with the available data . Additionally , we demonstrate that one of them achieves optimal finite variance among a reasonable class of unbiased estimators . ( iii ) : We describe a flexible and computationally tractable HPO procedure building on the proposed estimators . ( iv ) : We empirically demonstrate that the proposed procedure works favorably in MSU-HPO setting . Furthermore , our empirical results suggest a new possible connection between the adaptive HPO and IS-based unbiased estimation techniques . 2 PROBLEM SETTING . In this section , we formulate MSU-HPO . Let X ⊆ Rd be the d-dimensional input space and Y ⊆ R be the real-valued output space . We use pT ( x , y ) to denote the joint probability density function of the input and output variables X ∈ X and Y ∈ Y of the target task . The objective of this work is to find the best set of hyperparameters θ with respect to the target distribution : θopt = arg min θ∈Θ fT ( θ ) ( 1 ) where Θ is a pre-defined hyperparameter search space and fT ( θ ) is the target task objective , which is defined as the generalization error over the target distribution : fT ( θ ) = E ( X , Y ) ∼PT [ L ( hθ ( X ) , Y ) ] ( 2 ) where L : Y × Y → R≥0 is a bounded loss function such as the zero-one loss . hθ : X → Y is an arbitrary machine learning model that predicts the output values using the input vectors with a set of hyperparameters θ ∈ Θ . In a standard hyperparameter optimization setting ( Bergstra et al. , 2011 ; Feurer & Hutter , 2019 ; Snoek et al. , 2012 ) , labeled i.i.d . validation samples { xi , yi } nTi=1 ∼ pT are available , and one can easily estimate the target objective in Eq . ( 2 ) by the following empirical mean : f̂T ( θ ; DlabeledT ) = 1 nT nT∑ i=1 L ( hθ ( xi ) , yi ) ( 3 ) where DlabeledT is any size nT of the i.i.d . labeled samples from the target task distribution . Then , a hyperparameter optimization is conducted directly using the estimated target function in Eq . ( 3 ) as a reasonable replacement for the ground-truth target objective fT ( θ ) in Eq . ( 2 ) . In contrast , under the MSU-HPO setting , labels of the target task are assumed to be unobservable ; we can use only unlabeled target validation samples denoted as DT = { xi } nTi=1 hereinafter . Instead , we assume the availability of the multiple source task datasets which is denoted as { DSj } NSj=1 where j is a source task index and NS denotes the number of source tasks . Each source task data is defined as the i.i.d . labeled samples : DSj = { xji , y j i } nSj i=1 ∼ pSj where pSj ( x , y ) is a joint probability density function that characterizes the source task j . Note here that marginal input distributions of the target and source tasks are different , i.e. , pT ( x ) 6= pSj ( x ) , ∀j ∈ { 1 , . . . , NS } . Regarding the target and source distributions , we make the following assumptions . Assumption 1 . Source tasks have support for the target task , i.e. , pT ( x ) > 0⇒ pSj ( x ) > 0 , ∀x ∈ X , ∀j ∈ { 1 , . . . , NS } . Assumption 2 . Conditional output distributions remain the same between the target and all of the source tasks , i.e. , pT ( y|x ) = pSj ( y|x ) , ∀j ∈ { 1 , . . . , NS } . The above assumptions are common in the covariate shift literature Shimodaira ( 2000 ) and suggest that the input-output relation is the same , but the input distributions are different for the target and source task distributions . 1 One critical difficulty of the MSU-HPO setting is that the simple approximation using the empirical mean is infeasible , as the labeled target dataset is unavailable . It is thus essential to accurately estimate the target task objective using only an unlabeled target dataset and labeled multiple source datasets .
In the situation where a given objective is computed with samples from a distribution, e.g. loss on validation data in hyperparameter optimization, this paper proposes a method to construct a surrogate objective using objectives computed on sets of samples each of which is from a different distribution. Basic idea is to use a linear combination of importance sampling estimators. Moreover, the optimal linear combination coefficients are identified in a sense of being optimal in a certain family of convex combination coefficients. This approach has an interesting application that hyperparameters of machine learning deployed on an unseen dataset, importantly, without labels(output) can be optimized as long as the distribution of the input of the unseen dataset is samplable.
SP:76c71593430e9f257e9c2feddd5539c83f9b507f
Multi-Source Unsupervised Hyperparameter Optimization
1 INTRODUCTION . Hyperparameter optimization ( HPO ) has been a pivotal part of machine learning ( ML ) and contributed to achieving a good performance in a wide range of tasks ( Feurer & Hutter , 2019 ) . It is widely acknowledged that the performance of deep neural networks depends greatly on the configuration of the hyperparameters ( Dacrema et al. , 2019 ; Henderson et al. , 2018 ; Lucic et al. , 2018 ) . HPO is formulated as a special case of a black-box function optimization problem , where the input is a set of hyperparameters , and the output is a validation score . Among the black-box optimization methods , adaptive algorithms , such as Bayesian optimization ( BO ) ( Brochu et al. , 2010 ; Shahriari et al. , 2015 ; Frazier , 2018 ) have shown superior empirical performance compared with traditional algorithms , such as grid search or random search ( Bergstra & Bengio , 2012 ) . One critical assumption in HPO is the availability of an accurate validation score . However , in reality , there are many cases where we can not access the ground-truth of the task of interest ( referred to as target task hereinafter ) . For example , in display advertising , predicting the effectiveness of each advertisement , i.e. , click-through rates ( CTR ) , is important for showing relevant advertisements ( ads ) to users . Therefore , it is necessary to conduct HPO before a new ad campaign starts . However , for new ads that have not yet been displayed to users , one can not use labeled data to conduct HPO . In this case , the standard HPO procedure is infeasible , as one can not utilize the labeled target task data and the true validation score of the ML model under consideration . In this work , we address the infeasibility issue of HPO when the labels of the target task are unavailable . To formulate this situation , we introduce a novel HPO setting called multi-source unsupervised hyperparameter optimization ( MSU-HPO ) . In MSU-HPO , it is assumed that we do not have the labeled data for a target task . However , we do have the data for some source tasks with a different distribution from the target task . It is natural to assume that we have access to multiple source tasks in most practical settings . In the display advertising example , several labeled datasets of old ads that have already been deployed are often available , which we can use as labeled source task datasets . To the best of our knowledge , no HPO approach that can address a situation without labeled target task data exists despite its significance and possibility for applications . A problem with MSU-HPO is that the ground-truth is inaccessible , and one can not directly apply the standard HPO procedure . Thus , it is essential to accurately approximate it using only available data . For this purpose , we propose two estimators , enabling the evaluation of the ML models without the labeled target task data . Our estimators are general and can be used in combination with any common black-box optimization methods , such as Gaussian process-based BO ( Srinivas et al. , 2010 ; Snoek et al. , 2012 ; Hennig & Schuler , 2012 ; Contal et al. , 2014 ; Hernández-Lobato et al. , 2014 ; Wang & Jegelka , 2017 ) and the tree-structured Parzen estimator ( Bergstra et al. , 2011 ; 2013 ) . In addition , we show that the proposed estimators can unbiasedly approximate the target task objective , one of which achieves a desirable variance property by selecting useful source tasks based on a task divergence measure . We also present a general and computationally inexpensive HPO procedure for MSU-HPO building on our estimators . Finally , we demonstrate that our estimators work properly through numerical experiments with synthetic and real-world datasets . Related Work . A typical HPO setting is to find a better set of hyperparameters using a labeled target task of interest . As faster convergence is an essential performance metric of the HPO methods , the research community is moving on to the multi-source or transfer settings for which there are some previously solved related source tasks . By combining the additional source task information and the labeled target task dataset , it has been shown that one can improve the hyperparameter search efficiency , and thus reach a better solution with fewer evaluations ( Bonilla et al. , 2008 ; Bardenet et al. , 2013 ; Swersky et al. , 2013 ; Yogatama & Mann , 2014 ; Ramachandran et al. , 2018 ; Springenberg et al. , 2016 ; Poloczek et al. , 2017 ; Wistuba et al. , 2018 ; Feurer et al. , 2018 ; Perrone et al. , 2018 ; 2019 ; Salinas et al. , 2019 ) . A critical difference between the multi-source HPOs and our MSU-HPO settings is the existence of labels for the target task . Previous studies usually assume that analysts can utilize labeled target data . However , as discussed above , this is often unavailable , and thus , most of these methods are infeasible . One possible solution to address the unavailablity of labeled target data is to use warm starting methods ( Vanschoren , 2019 ) , which aims to find good initial hyperparameters for the target task . Learning Initialization ( LI ) finds promising hyperparameters by minimizing a sum of a loss function surrogated by a Gaussian process on each source task ( Wistuba et al. , 2015 ) . While LI is effective when the source and target tasks are quite similar , it is hard to achieve a reasonable performance otherwise . In contrast , DistBO learns the similarity between the source and target tasks with a joint Gaussian process model on hyperparameters and data representations ( Law et al. , 2019 ) . However , many transfer methods including DistBO need abundant hyperparameter evaluations for the source tasks to surrogate objective function for each task well , which will be confirmed in our experiments . Another related field is model evaluation in covariate shift , whose objective is to evaluate the performance of the ML models of the target task using only a relevant single source dataset ( Sugiyama et al. , 2007 ; You et al. , 2019 ; Zhong et al. , 2010 ) . These studies build on the importance sampling ( IS ) method ( Elvira et al. , 2015 ; Sugiyama et al. , 2007 ) to obtain an unbiased estimate of ground-truth model performances . While our proposed methods are also based on IS , a major difference is that we assume that there are multiple source datasets with different distributions . We demonstrate that with the multi-source setting , the previous IS method can fail , and propose an estimator satisfying the optimal variance property . Moreover , as these methods are specific to model evaluation , the connection between the IS-based estimation techniques and the automated HPO methods has not yet been explored despite their possible , broad applications . Consequently , we are the first to empirically evaluate the possible combination of the IS-based unbiased estimation and adaptive HPO . Contributions . The contributions of this work can be summarized as follows : ( i ) : We formulate a novel and highly practical HPO setting , MSU-HPO . ( ii ) : We propose two unbiased estimators for the ground-truth validation score calculable with the available data . Additionally , we demonstrate that one of them achieves optimal finite variance among a reasonable class of unbiased estimators . ( iii ) : We describe a flexible and computationally tractable HPO procedure building on the proposed estimators . ( iv ) : We empirically demonstrate that the proposed procedure works favorably in MSU-HPO setting . Furthermore , our empirical results suggest a new possible connection between the adaptive HPO and IS-based unbiased estimation techniques . 2 PROBLEM SETTING . In this section , we formulate MSU-HPO . Let X ⊆ Rd be the d-dimensional input space and Y ⊆ R be the real-valued output space . We use pT ( x , y ) to denote the joint probability density function of the input and output variables X ∈ X and Y ∈ Y of the target task . The objective of this work is to find the best set of hyperparameters θ with respect to the target distribution : θopt = arg min θ∈Θ fT ( θ ) ( 1 ) where Θ is a pre-defined hyperparameter search space and fT ( θ ) is the target task objective , which is defined as the generalization error over the target distribution : fT ( θ ) = E ( X , Y ) ∼PT [ L ( hθ ( X ) , Y ) ] ( 2 ) where L : Y × Y → R≥0 is a bounded loss function such as the zero-one loss . hθ : X → Y is an arbitrary machine learning model that predicts the output values using the input vectors with a set of hyperparameters θ ∈ Θ . In a standard hyperparameter optimization setting ( Bergstra et al. , 2011 ; Feurer & Hutter , 2019 ; Snoek et al. , 2012 ) , labeled i.i.d . validation samples { xi , yi } nTi=1 ∼ pT are available , and one can easily estimate the target objective in Eq . ( 2 ) by the following empirical mean : f̂T ( θ ; DlabeledT ) = 1 nT nT∑ i=1 L ( hθ ( xi ) , yi ) ( 3 ) where DlabeledT is any size nT of the i.i.d . labeled samples from the target task distribution . Then , a hyperparameter optimization is conducted directly using the estimated target function in Eq . ( 3 ) as a reasonable replacement for the ground-truth target objective fT ( θ ) in Eq . ( 2 ) . In contrast , under the MSU-HPO setting , labels of the target task are assumed to be unobservable ; we can use only unlabeled target validation samples denoted as DT = { xi } nTi=1 hereinafter . Instead , we assume the availability of the multiple source task datasets which is denoted as { DSj } NSj=1 where j is a source task index and NS denotes the number of source tasks . Each source task data is defined as the i.i.d . labeled samples : DSj = { xji , y j i } nSj i=1 ∼ pSj where pSj ( x , y ) is a joint probability density function that characterizes the source task j . Note here that marginal input distributions of the target and source tasks are different , i.e. , pT ( x ) 6= pSj ( x ) , ∀j ∈ { 1 , . . . , NS } . Regarding the target and source distributions , we make the following assumptions . Assumption 1 . Source tasks have support for the target task , i.e. , pT ( x ) > 0⇒ pSj ( x ) > 0 , ∀x ∈ X , ∀j ∈ { 1 , . . . , NS } . Assumption 2 . Conditional output distributions remain the same between the target and all of the source tasks , i.e. , pT ( y|x ) = pSj ( y|x ) , ∀j ∈ { 1 , . . . , NS } . The above assumptions are common in the covariate shift literature Shimodaira ( 2000 ) and suggest that the input-output relation is the same , but the input distributions are different for the target and source task distributions . 1 One critical difficulty of the MSU-HPO setting is that the simple approximation using the empirical mean is infeasible , as the labeled target dataset is unavailable . It is thus essential to accurately estimate the target task objective using only an unlabeled target dataset and labeled multiple source datasets .
The paper introduces multi-source unsupervised hyperparameter optimization (MSU-HPO), a novel BO framework where a range of related tasks are available but labels cannot be accessed for the target task. As ground truth on the target task is unavailable, the work introduces two estimators to approximate the target task objective. This enables HPO to be run to optimize the hyperparameters on the target task, converging faster to a good hyperparameter configuration.
SP:76c71593430e9f257e9c2feddd5539c83f9b507f
Multi-Source Unsupervised Hyperparameter Optimization
1 INTRODUCTION . Hyperparameter optimization ( HPO ) has been a pivotal part of machine learning ( ML ) and contributed to achieving a good performance in a wide range of tasks ( Feurer & Hutter , 2019 ) . It is widely acknowledged that the performance of deep neural networks depends greatly on the configuration of the hyperparameters ( Dacrema et al. , 2019 ; Henderson et al. , 2018 ; Lucic et al. , 2018 ) . HPO is formulated as a special case of a black-box function optimization problem , where the input is a set of hyperparameters , and the output is a validation score . Among the black-box optimization methods , adaptive algorithms , such as Bayesian optimization ( BO ) ( Brochu et al. , 2010 ; Shahriari et al. , 2015 ; Frazier , 2018 ) have shown superior empirical performance compared with traditional algorithms , such as grid search or random search ( Bergstra & Bengio , 2012 ) . One critical assumption in HPO is the availability of an accurate validation score . However , in reality , there are many cases where we can not access the ground-truth of the task of interest ( referred to as target task hereinafter ) . For example , in display advertising , predicting the effectiveness of each advertisement , i.e. , click-through rates ( CTR ) , is important for showing relevant advertisements ( ads ) to users . Therefore , it is necessary to conduct HPO before a new ad campaign starts . However , for new ads that have not yet been displayed to users , one can not use labeled data to conduct HPO . In this case , the standard HPO procedure is infeasible , as one can not utilize the labeled target task data and the true validation score of the ML model under consideration . In this work , we address the infeasibility issue of HPO when the labels of the target task are unavailable . To formulate this situation , we introduce a novel HPO setting called multi-source unsupervised hyperparameter optimization ( MSU-HPO ) . In MSU-HPO , it is assumed that we do not have the labeled data for a target task . However , we do have the data for some source tasks with a different distribution from the target task . It is natural to assume that we have access to multiple source tasks in most practical settings . In the display advertising example , several labeled datasets of old ads that have already been deployed are often available , which we can use as labeled source task datasets . To the best of our knowledge , no HPO approach that can address a situation without labeled target task data exists despite its significance and possibility for applications . A problem with MSU-HPO is that the ground-truth is inaccessible , and one can not directly apply the standard HPO procedure . Thus , it is essential to accurately approximate it using only available data . For this purpose , we propose two estimators , enabling the evaluation of the ML models without the labeled target task data . Our estimators are general and can be used in combination with any common black-box optimization methods , such as Gaussian process-based BO ( Srinivas et al. , 2010 ; Snoek et al. , 2012 ; Hennig & Schuler , 2012 ; Contal et al. , 2014 ; Hernández-Lobato et al. , 2014 ; Wang & Jegelka , 2017 ) and the tree-structured Parzen estimator ( Bergstra et al. , 2011 ; 2013 ) . In addition , we show that the proposed estimators can unbiasedly approximate the target task objective , one of which achieves a desirable variance property by selecting useful source tasks based on a task divergence measure . We also present a general and computationally inexpensive HPO procedure for MSU-HPO building on our estimators . Finally , we demonstrate that our estimators work properly through numerical experiments with synthetic and real-world datasets . Related Work . A typical HPO setting is to find a better set of hyperparameters using a labeled target task of interest . As faster convergence is an essential performance metric of the HPO methods , the research community is moving on to the multi-source or transfer settings for which there are some previously solved related source tasks . By combining the additional source task information and the labeled target task dataset , it has been shown that one can improve the hyperparameter search efficiency , and thus reach a better solution with fewer evaluations ( Bonilla et al. , 2008 ; Bardenet et al. , 2013 ; Swersky et al. , 2013 ; Yogatama & Mann , 2014 ; Ramachandran et al. , 2018 ; Springenberg et al. , 2016 ; Poloczek et al. , 2017 ; Wistuba et al. , 2018 ; Feurer et al. , 2018 ; Perrone et al. , 2018 ; 2019 ; Salinas et al. , 2019 ) . A critical difference between the multi-source HPOs and our MSU-HPO settings is the existence of labels for the target task . Previous studies usually assume that analysts can utilize labeled target data . However , as discussed above , this is often unavailable , and thus , most of these methods are infeasible . One possible solution to address the unavailablity of labeled target data is to use warm starting methods ( Vanschoren , 2019 ) , which aims to find good initial hyperparameters for the target task . Learning Initialization ( LI ) finds promising hyperparameters by minimizing a sum of a loss function surrogated by a Gaussian process on each source task ( Wistuba et al. , 2015 ) . While LI is effective when the source and target tasks are quite similar , it is hard to achieve a reasonable performance otherwise . In contrast , DistBO learns the similarity between the source and target tasks with a joint Gaussian process model on hyperparameters and data representations ( Law et al. , 2019 ) . However , many transfer methods including DistBO need abundant hyperparameter evaluations for the source tasks to surrogate objective function for each task well , which will be confirmed in our experiments . Another related field is model evaluation in covariate shift , whose objective is to evaluate the performance of the ML models of the target task using only a relevant single source dataset ( Sugiyama et al. , 2007 ; You et al. , 2019 ; Zhong et al. , 2010 ) . These studies build on the importance sampling ( IS ) method ( Elvira et al. , 2015 ; Sugiyama et al. , 2007 ) to obtain an unbiased estimate of ground-truth model performances . While our proposed methods are also based on IS , a major difference is that we assume that there are multiple source datasets with different distributions . We demonstrate that with the multi-source setting , the previous IS method can fail , and propose an estimator satisfying the optimal variance property . Moreover , as these methods are specific to model evaluation , the connection between the IS-based estimation techniques and the automated HPO methods has not yet been explored despite their possible , broad applications . Consequently , we are the first to empirically evaluate the possible combination of the IS-based unbiased estimation and adaptive HPO . Contributions . The contributions of this work can be summarized as follows : ( i ) : We formulate a novel and highly practical HPO setting , MSU-HPO . ( ii ) : We propose two unbiased estimators for the ground-truth validation score calculable with the available data . Additionally , we demonstrate that one of them achieves optimal finite variance among a reasonable class of unbiased estimators . ( iii ) : We describe a flexible and computationally tractable HPO procedure building on the proposed estimators . ( iv ) : We empirically demonstrate that the proposed procedure works favorably in MSU-HPO setting . Furthermore , our empirical results suggest a new possible connection between the adaptive HPO and IS-based unbiased estimation techniques . 2 PROBLEM SETTING . In this section , we formulate MSU-HPO . Let X ⊆ Rd be the d-dimensional input space and Y ⊆ R be the real-valued output space . We use pT ( x , y ) to denote the joint probability density function of the input and output variables X ∈ X and Y ∈ Y of the target task . The objective of this work is to find the best set of hyperparameters θ with respect to the target distribution : θopt = arg min θ∈Θ fT ( θ ) ( 1 ) where Θ is a pre-defined hyperparameter search space and fT ( θ ) is the target task objective , which is defined as the generalization error over the target distribution : fT ( θ ) = E ( X , Y ) ∼PT [ L ( hθ ( X ) , Y ) ] ( 2 ) where L : Y × Y → R≥0 is a bounded loss function such as the zero-one loss . hθ : X → Y is an arbitrary machine learning model that predicts the output values using the input vectors with a set of hyperparameters θ ∈ Θ . In a standard hyperparameter optimization setting ( Bergstra et al. , 2011 ; Feurer & Hutter , 2019 ; Snoek et al. , 2012 ) , labeled i.i.d . validation samples { xi , yi } nTi=1 ∼ pT are available , and one can easily estimate the target objective in Eq . ( 2 ) by the following empirical mean : f̂T ( θ ; DlabeledT ) = 1 nT nT∑ i=1 L ( hθ ( xi ) , yi ) ( 3 ) where DlabeledT is any size nT of the i.i.d . labeled samples from the target task distribution . Then , a hyperparameter optimization is conducted directly using the estimated target function in Eq . ( 3 ) as a reasonable replacement for the ground-truth target objective fT ( θ ) in Eq . ( 2 ) . In contrast , under the MSU-HPO setting , labels of the target task are assumed to be unobservable ; we can use only unlabeled target validation samples denoted as DT = { xi } nTi=1 hereinafter . Instead , we assume the availability of the multiple source task datasets which is denoted as { DSj } NSj=1 where j is a source task index and NS denotes the number of source tasks . Each source task data is defined as the i.i.d . labeled samples : DSj = { xji , y j i } nSj i=1 ∼ pSj where pSj ( x , y ) is a joint probability density function that characterizes the source task j . Note here that marginal input distributions of the target and source tasks are different , i.e. , pT ( x ) 6= pSj ( x ) , ∀j ∈ { 1 , . . . , NS } . Regarding the target and source distributions , we make the following assumptions . Assumption 1 . Source tasks have support for the target task , i.e. , pT ( x ) > 0⇒ pSj ( x ) > 0 , ∀x ∈ X , ∀j ∈ { 1 , . . . , NS } . Assumption 2 . Conditional output distributions remain the same between the target and all of the source tasks , i.e. , pT ( y|x ) = pSj ( y|x ) , ∀j ∈ { 1 , . . . , NS } . The above assumptions are common in the covariate shift literature Shimodaira ( 2000 ) and suggest that the input-output relation is the same , but the input distributions are different for the target and source task distributions . 1 One critical difficulty of the MSU-HPO setting is that the simple approximation using the empirical mean is infeasible , as the labeled target dataset is unavailable . It is thus essential to accurately estimate the target task objective using only an unlabeled target dataset and labeled multiple source datasets .
The authors describe a method for training and tuning a machine learning model for a prediction task where no labels are available, and where thus no model can be fit in the standard supervised manner. Instead labels are estimated based on related tasks that do have labels. After this a predictor can be trained on those estimated labels, and can be tuned using a standard Bayesian optimization algorithm.
SP:76c71593430e9f257e9c2feddd5539c83f9b507f
Knowledge Distillation as Semiparametric Inference
A popular approach to model compression is to train an inexpensive student model to mimic the class probabilities of a highly accurate but cumbersome teacher model . Surprisingly , this two-step knowledge distillation process often leads to higher accuracy than training the student directly on labeled data . To explain and enhance this phenomenon , we cast knowledge distillation as a semiparametric inference problem with the optimal student model as the target , the unknown Bayes class probabilities as nuisance , and the teacher probabilities as a plug-in nuisance estimate . By adapting modern semiparametric tools , we derive new guarantees for the prediction error of standard distillation and develop two enhancements—cross-fitting and loss correction—to mitigate the impact of teacher overfitting and underfitting on student performance . We validate our findings empirically on both tabular and image data and observe consistent improvements from our knowledge distillation enhancements . 1 INTRODUCTION . Knowledge distillation ( KD ) ( Craven & Shavlik , 1996 ; Breiman & Shang , 1996 ; Bucila et al. , 2006 ; Li et al. , 2014 ; Ba & Caruana , 2014 ; Hinton et al. , 2015 ) is a widely used model compression technique that enables the deployment of highly accurate predictive models on devices such as phones , watches , and virtual assistants ( Stock et al. , 2020 ) . KD operates by training a compressed student model to mimic the predicted class probabilities of an expensive , high-quality teacher model . Remarkably and across a wide variety of domains ( Hinton et al. , 2015 ; Sanh et al. , 2019 ; Jiao et al. , 2019 ; Liu et al. , 2018 ; Tan et al. , 2018 ; Fakoor et al. , 2020 ) , this two-step process often leads to higher accuracy than training the student directly on the raw labeled dataset . While the practice of KD is now well developed , a general theoretical understanding of its successes and failures is still lacking . As we detail below , a number of authors have argued that the success of KD lies in the more precise “ soft labels ” provided by the teacher ’ s predicted class probabilities . Recently , Menon et al . ( 2020 ) observed that these teacher probabilities can serve as a proxy for the Bayes probabilities ( i.e. , the true class probabilities ) and that the closer the teacher and Bayes probabilities , the better the student ’ s performance should be . Building on this observation , we cast KD as a plug-in approach to semiparametric inference ( Kosorok , 2007 ) : that is , we view KD as fitting a student model f̂ in the presence of nuisance ( the Bayes probabilities p0 ) with the teacher ’ s probabilities p̂ as a plug-in estimate of p0 . This insight allows us to adapt modern tools from semiparametric inference to analyze the error of a distilled student in Sec . 3 . Our analysis also reveals two distinct failure modes of KD : one due to teacher overfitting and data reuse and the other due to teacher underfitting from model misspecification or insufficient training . In Sec . 4 , we introduce and analyze two complementary KD enhancements that correct for these failures : cross-fitting—a popular technique from semiparametric inference ( see , e.g. , Chernozhukov et al. , 2018 ) —mitigates teacher overfitting through data partitioning while loss correction mitigates teacher underfitting by reducing the bias of the plug-in estimate p̂ . The latter enhancement was inspired by the orthogonal machine learning ( Chernozhukov et al. , 2018 ; Foster & Syrgkanis , 2019 ) approach to semiparametric inference which suggests a particular adjustment for the teacher ’ s log probabilities . We argue in Sec . 4 that this orthogonal correction minimizes the teacher bias but often at the cost of unacceptably large variance . Our proposed correction avoids this variance explosion by balancing the bias and variance terms in our generalization bounds . In Sec . 5 , we complement our theoretical analysis with a pair of experiments demonstrating the value of our enhancements on six real classification problems . On five real tabular datasets , cross-fitting and loss correction improve student performance by up to 4 % AUC over vanilla KD . Furthermore , on CIFAR-10 ( Krizhevsky & Hinton , 2009 ) , a benchmark image classification dataset , our enhancements improve vanilla KD accuracy by up to 1.5 % when the teacher model overfits . Related work . Since we can not review the vast literature on KD in its entirety , we point the interested reader to Gou et al . ( 2020 ) for a recent overview of the field . We devote this section to reviewing theoretical advances in the understanding of KD and summarize complementary empirical studies and applications of in the extended literature review in App . A . A number of papers have argued that the availability of soft class probabilities from the teacher rather than hard labels enables us to improve training of the student model . This was hypothesized in Hinton et al . ( 2015 ) with empirical justification . Phuong & Lampert ( 2019 ) consider the case in which the teacher is a fixed linear classifier and the student is either a linear model or a deep linear network . They show that the student can learn the teacher perfectly if the number of training examples exceeds the ambient dimension . Vapnik & Izmailov ( 2015 ) discuss the setting of learning with privileged information where one has additional information at training time which is not available at test time . Lopez-Paz et al . ( 2015 ) draw a connection between this and KD , arguing that KD is effective because the teacher learns a better representation allowing the student to learn at a faster rate . They hypothesize that a teacher ’ s class probabilities enable student improvement by indicating how difficult each point is to classify . Tang et al . ( 2020 ) argue using empirical evidence that label smoothing and reweighting of training examples using the teacher ’ s predictions are key to the success of KD . Mobahi et al . ( 2020 ) analyzed the case of self-distillation in which the student and teacher function classes are identical . Focusing on kernel ridge regression models , they proved that self-distillation can act as increased regularization strength . Bu et al . ( 2020 ) considers more generic model compression in a rate-distortion framework , where the rate is the size of the student model and distortion is the difference in excess risk between the teacher and the student . Menon et al . ( 2020 ) consider the case of losses such that the population risk is linear in the Bayes class probabilities . They consider distilled empirical risk and Bayes distilled empirical risk which are the risk computed using the teacher class probabilities and Bayes class probabilities respectively rather than the observed label . They show that the variance of the Bayes distilled empirical risk is lower than the empirical risk . Then using analysis from Maurer & Pontil ( 2009 ) ; Bennett ( 1962 ) , they derive the excess risk of the distilled empirical risk as a function of the ` 2 distance between the teacher ’ s class probabilities and the Bayes class probabilities . We significantly depart from Menon et al . ( 2020 ) in multiple ways : i ) our Thm . 1 allows for the common practice of data re-use , ii ) our results cover the standard KD losses SEL and ACE which are non-linear in p0 , iii ) we use localized Rademacher analysis to achieve tight fast rates for standard KD losses , and iv ) we use techniques from semiparametric inference to improve upon vanilla KD . 2 KNOWLEDGE DISTILLATION BACKGROUND . We consider a multiclass classification problem with k classes and n training datapoints zi= ( xi , yi ) sampled independently from some distribution P. Each feature vector x belongs to a setX , each label vector y∈ { e1 , ... , ek } ⊂ { 0,1 } k is a one-hot encoding of the class label , and the conditional probability of observing each label is the Bayes class probability function p0 ( x ) =E [ Y |X =x ] . Our aim is to identify a scoring rule f : X →Rk that minimizes a prediction loss on average under the distribution P. Knowledge distillation . Knowledge distillation ( KD ) is a two-step training process where one first uses a labeled dataset to train a teacher model and then trains a student model to predict the teacher ’ s predicted class probabilities . Typically the teacher model is larger and more cumbersome , while the student is smaller and more efficient . Knowledge distillation was first motivated by model compression ( Bucila et al. , 2006 ) , to find compact yet high-performing models to be deployed ( such as on mobile devices ) . In training the student to match the teacher ’ s prediction probability , there are several types of loss functions that are commonly used . Let p̂ ( x ) ∈Rk be the teacher ’ s vector of predicted class probabilities , f ( x ) ∈Rk be the student model ’ s output , and [ k ] , { 1,2 , ... , k } . The most popular distillation loss functions1 ` ( z ; f ( x ) , p̂ ( x ) ) include the squared error logit ( SEL ) loss ( Ba & Caruana , 2014 ) ` se ( z ; f ( x ) , p̂ ( x ) ) , ∑ j∈ [ k ] 1 2 ( fj ( x ) −log ( p̂j ( x ) ) ) 2 ( SEL ) and the annealed cross-entropy ( ACE ) loss ( Hinton et al. , 2015 ) ` β ( z ; f ( x ) , p̂ ( x ) ) =− ∑ j∈ [ k ] p̂j ( x ) β∑ l∈ [ k ] p̂l ( x ) β log ( exp ( βfj ( x ) ) ∑ l∈ [ k ] exp ( βfl ( x ) ) ) ( ACE ) for an inverse temperatureβ > 0 . These loss functions measure the divergence between the probabilities predicted by the teacher and the student . A student model trained with knowledge distillation often performs better than the same model trained from scratch ( Bucila et al. , 2006 ; Hinton et al. , 2015 ) . In Secs . 3 and 4 , we will adapt modern tools from semiparametric inference to understand and enhance this phenomenon . 3 DISTILLATION AS SEMIPARAMETRIC INFERENCE . In semiparametric inference ( Kosorok , 2007 ) , one aims to estimate a target parameter or function f0 , but that estimation depends on an auxiliary nuisance function p0 that is unknown and not of primary interest . We cast the knowledge distillation process as a semiparametric inference problem , by treating the unknown Bayes class probabilities p0 as nuisance and the teacher ’ s predicted probabilities as a plug-in estimate of that nuisance . This perspective allows us bound the generalization of the student in terms of the mean squared error ( MSE ) between the teacher and the Bayes probabilities . In the next section ( Sec . 4 ) we use techniques from semiparametric inference to enhance the performance of the student . The interested reader could consult Tsiatis ( 2007 ) for more details on semiparametric inference . Our analysis starts from taking the following perspective on distillation . For a given pointwise loss function ` ( z ; f ( x ) , p0 ( x ) ) , we view the goal of the student as minimizing an oracle population loss over a function classF , LD ( f , p0 ) =E [ ` ( Z ; f ( X ) , p0 ( X ) ) ] with f0 , argminf∈FLD ( f , p0 ) . The main hurdle is that this is objective depends on the unknown Bayes probabilities p0 . We view the teacher ’ s model p̂ as an approximate version of p0 and bound the distillation error of the student as a function of the teacher ’ s estimation error . Typical semiparametric inference considers cases where f0 is a finite dimensional parameter ; however recent work of Foster & Syrgkanis ( 2019 ) extends this framework to infinite dimensional models f0 and to develop statistical learning theory with a nuisance component framework . The distillation problem fits exactly into this setup . Bounds on vanilla KD As a first step we derive a vanilla bound on the error of the distilled student model without any further modifications of the distillation process , i.e. , we assume that the student is trained on the same data as the teacher and is trained by running empirical risk minimization ( ERM ) on the plug-in loss , plugging in the teacher ’ s model instead of p0 , i.e. , f̂=argminf∈FLn ( f , p̂ ) for Ln ( f , p̂ ) , En [ ` ( Z ; f ( X ) , p̂ ( X ) ) ] ( Vanilla KD ) where En [ X ] = 1n ∑n i=1Xi denotes the empirical expectation of a random variable . Technical definitions Before presenting our main theorem we introduce some technical notation . For a vector valued function f that takes as input a random variableX , we use the shorthand notation ‖f‖p , q , ‖‖f ( X ) ‖p‖Lq =E [ ‖f ( X ) ‖qp ] 1/q . Let∇φ and∇π denote the partial derivatives of ` ( z ; φ , π ) , with respect to its second and third input correspondingly and ∇φπ the Jacobian of cross partial derivatives , i.e. , [ ∇φπ ` ( z ; φ , π ) ] i , j= ∂ 2 ∂φj∂πi ` ( z ; φ , π ) . Finally , let qf , p ( x ) =E [ ∇φπ ` ( Z ; f ( X ) , p ( X ) ) |X=x ] and γf , p ( x ) =EU∼Unif ( [ 0,1 ] ) [ qf , Up+ ( 1−U ) p0 ( x ) ] . Critical radius Finally , we need to define the notion of the critical radius ( see , e.g. , Wainwright ( 2019 , 14.1.1 ) ) of a function class , which typically provides tight learning rates for statistical learning theory tasks . For any function classF we define the localized Rademacher complexity as : R ( δ ; F ) =EX1 : n , 1 : n [ supf∈F : ‖f‖2≤δ 1 n ∑n i=1 if ( Xi ) ] where i are i.i.d . random variables taking values equiprobably in { −1,1 } . The critical radius of a classF , taking values in [ −H , H ] , is the smallest positive solution δn to the inequalityR ( δ ; F ) ≤ δ 2 H . 1These loss functions do not depend on the ground-truth label y , but we use the augmented notation ` ( z ; f ( x ) , p̂ ( x ) ) to accommodate the enhanced distillation losses presented in Sec . 4 . Theorem 1 ( Vanilla KD analysis ) . Suppose f0 belongs to a convex set F satisfying the ` 2/ ` 4 ratio condition supf∈F ‖f−f0‖2,4/‖f−f0‖2,2 ≤C and that the teacher estimates p̂∈P from the same dataset used to train the student . Let δn , ζ = δn+c0 √ log ( c1/ζ ) n for universal constants c0 , c1 and δn an upper bound on the critical radius of the function class G , { z→r ( ` ( z ; f ( x ) , p ( x ) ) − ` ( z ; f0 ( x ) , p ( x ) ) ) : f ∈F , p∈P , r∈ [ 0,1 ] } . Let µ ( z ) = supφ‖∇φ ` ( z ; φ , p̂ ( x ) ) ‖2 , and assume that the loss ` ( z ; φ , π ) is σ-strongly convex in φ for each z and that each g∈G is uniformly bounded in [ −H , H ] . Then the Vanilla KD f̂ satisfies ‖f̂−f0‖22,2 = 1σ2O ( δ 2 n , ζC 2H2‖µ‖24+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) with probability at least 1−ζ . Thm . 1 , proved in App . C , shows that vanilla distillation yields an accurate student whenever the teacher generalizes well ( i.e. , ‖p̂−p0‖2,2 is small ) and the student and teacher model classesF andP are not too complex . The ` 2/ ` 4 ratio requirement can be removed at the expense of replacing ‖µ‖4 by ‖µ‖∞=supz|µ ( z ) | in the final bound . Moreover , we highlight that the strong convexity requirement for ` is satisfied by all standard distillation objectives including SEL and ACE , as it is strong convexity with respect to the output of f and not the parameters of f . Even this requirement could be removed , but this would yield slow rate bounds of the form : ‖f̂−f0‖22,2 =O ( δn , ζ+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) . Failure modes of vanilla KD Thm . 1 also hints at two distinct ways in which vanilla distillation could fail . First , since the student only learns from the teacher and does not have access to the original labels , we would expect the student to be erroneous when the teacher probabilities are inaccurate due to model misspecification , an overly restrictive teacher function class , or insufficient training . Prop . 2 , proved in App . D , confirms that , in the worst case , student error suffers from inaccuracy due to this teacher underfitting even when both the student and teacher belong to low complexity model classes . Proposition 2 ( Impact of teacher underfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =log ( p0 ) : • The teacher learns p̂ ( x ) = 1n ( 1+λ ) ∑n i=1yi for all x∈X via ridge regression with λ=Θ ( 1/n1/4 ) . • Vanilla KD with SEL loss and constant f̂ satisfies ‖f̂−f0‖22,2 ≥‖γ > f0 , p0 ( p̂−p0 ) ‖ 2 2,2 = Ω ( 1√ n ) , matching the dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =diag ( 1 p̂ ( t ) ) , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( 1n ) . Second , the critical radius in Thm . 1 depends on the complexity of the teacher model class P . If P has a large critical radius , then the student error bound suffers due to potential teacher overfitting even if the teacher generalizes well . Prop . 3 , proved in App . E , shows that , in the worst case , this teacher overfitting penalty is unavoidable and does in fact lead to increased student error . This occurs as the student only has access to the teacher ’ s training set probabilities which , due to overfitting , need not reflect its test set probabilities . Proposition 3 ( Impact of teacher overfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =E [ log ( p0 ( X ) ) ] : • The critical radius δn of the teacher-student function class G in Thm . 1 is a non-vanishing constant , due to the complexity of the teacher ’ s function class . • The Vanilla KD error ‖f̂−f0‖22,2 for constant f̂ with SEL loss is lower bounded by a non-vanishing constant , matching the δn dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =0 , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( n−4/ ( 4+d ) ) . These examples serve to lower bound student performance in the worst case by the teacher ’ s critical radius and class probability MSE , matching the upper bounds given in Thm . 1 . However , we note that in other better-case scenarios vanilla distillation can perform better than the upper-bounding Thm . 1 would imply . In the next section , we adapt and generalize techniques from semiparametric inference to mitigate the effects of teacher overfitting and underfitting in all cases .
This paper gives generalization guarantees for vanilla knowledge distillation, where it identifies a large variance issue due to the teacher’s complexity in this guarantee, and then proposes alternative approaches to eliminate this issue. The framework it uses is inspired by semi-parametric methods. The main resulting algorithm has two key components: cross-fitting and a corrective surrogate loss. An SGD variant is also presented. Experiments illustrate some of the benefits of the cross-fitting approach.
SP:d0cc938ab1814b400f9b056c172b056d6358ec21
Knowledge Distillation as Semiparametric Inference
A popular approach to model compression is to train an inexpensive student model to mimic the class probabilities of a highly accurate but cumbersome teacher model . Surprisingly , this two-step knowledge distillation process often leads to higher accuracy than training the student directly on labeled data . To explain and enhance this phenomenon , we cast knowledge distillation as a semiparametric inference problem with the optimal student model as the target , the unknown Bayes class probabilities as nuisance , and the teacher probabilities as a plug-in nuisance estimate . By adapting modern semiparametric tools , we derive new guarantees for the prediction error of standard distillation and develop two enhancements—cross-fitting and loss correction—to mitigate the impact of teacher overfitting and underfitting on student performance . We validate our findings empirically on both tabular and image data and observe consistent improvements from our knowledge distillation enhancements . 1 INTRODUCTION . Knowledge distillation ( KD ) ( Craven & Shavlik , 1996 ; Breiman & Shang , 1996 ; Bucila et al. , 2006 ; Li et al. , 2014 ; Ba & Caruana , 2014 ; Hinton et al. , 2015 ) is a widely used model compression technique that enables the deployment of highly accurate predictive models on devices such as phones , watches , and virtual assistants ( Stock et al. , 2020 ) . KD operates by training a compressed student model to mimic the predicted class probabilities of an expensive , high-quality teacher model . Remarkably and across a wide variety of domains ( Hinton et al. , 2015 ; Sanh et al. , 2019 ; Jiao et al. , 2019 ; Liu et al. , 2018 ; Tan et al. , 2018 ; Fakoor et al. , 2020 ) , this two-step process often leads to higher accuracy than training the student directly on the raw labeled dataset . While the practice of KD is now well developed , a general theoretical understanding of its successes and failures is still lacking . As we detail below , a number of authors have argued that the success of KD lies in the more precise “ soft labels ” provided by the teacher ’ s predicted class probabilities . Recently , Menon et al . ( 2020 ) observed that these teacher probabilities can serve as a proxy for the Bayes probabilities ( i.e. , the true class probabilities ) and that the closer the teacher and Bayes probabilities , the better the student ’ s performance should be . Building on this observation , we cast KD as a plug-in approach to semiparametric inference ( Kosorok , 2007 ) : that is , we view KD as fitting a student model f̂ in the presence of nuisance ( the Bayes probabilities p0 ) with the teacher ’ s probabilities p̂ as a plug-in estimate of p0 . This insight allows us to adapt modern tools from semiparametric inference to analyze the error of a distilled student in Sec . 3 . Our analysis also reveals two distinct failure modes of KD : one due to teacher overfitting and data reuse and the other due to teacher underfitting from model misspecification or insufficient training . In Sec . 4 , we introduce and analyze two complementary KD enhancements that correct for these failures : cross-fitting—a popular technique from semiparametric inference ( see , e.g. , Chernozhukov et al. , 2018 ) —mitigates teacher overfitting through data partitioning while loss correction mitigates teacher underfitting by reducing the bias of the plug-in estimate p̂ . The latter enhancement was inspired by the orthogonal machine learning ( Chernozhukov et al. , 2018 ; Foster & Syrgkanis , 2019 ) approach to semiparametric inference which suggests a particular adjustment for the teacher ’ s log probabilities . We argue in Sec . 4 that this orthogonal correction minimizes the teacher bias but often at the cost of unacceptably large variance . Our proposed correction avoids this variance explosion by balancing the bias and variance terms in our generalization bounds . In Sec . 5 , we complement our theoretical analysis with a pair of experiments demonstrating the value of our enhancements on six real classification problems . On five real tabular datasets , cross-fitting and loss correction improve student performance by up to 4 % AUC over vanilla KD . Furthermore , on CIFAR-10 ( Krizhevsky & Hinton , 2009 ) , a benchmark image classification dataset , our enhancements improve vanilla KD accuracy by up to 1.5 % when the teacher model overfits . Related work . Since we can not review the vast literature on KD in its entirety , we point the interested reader to Gou et al . ( 2020 ) for a recent overview of the field . We devote this section to reviewing theoretical advances in the understanding of KD and summarize complementary empirical studies and applications of in the extended literature review in App . A . A number of papers have argued that the availability of soft class probabilities from the teacher rather than hard labels enables us to improve training of the student model . This was hypothesized in Hinton et al . ( 2015 ) with empirical justification . Phuong & Lampert ( 2019 ) consider the case in which the teacher is a fixed linear classifier and the student is either a linear model or a deep linear network . They show that the student can learn the teacher perfectly if the number of training examples exceeds the ambient dimension . Vapnik & Izmailov ( 2015 ) discuss the setting of learning with privileged information where one has additional information at training time which is not available at test time . Lopez-Paz et al . ( 2015 ) draw a connection between this and KD , arguing that KD is effective because the teacher learns a better representation allowing the student to learn at a faster rate . They hypothesize that a teacher ’ s class probabilities enable student improvement by indicating how difficult each point is to classify . Tang et al . ( 2020 ) argue using empirical evidence that label smoothing and reweighting of training examples using the teacher ’ s predictions are key to the success of KD . Mobahi et al . ( 2020 ) analyzed the case of self-distillation in which the student and teacher function classes are identical . Focusing on kernel ridge regression models , they proved that self-distillation can act as increased regularization strength . Bu et al . ( 2020 ) considers more generic model compression in a rate-distortion framework , where the rate is the size of the student model and distortion is the difference in excess risk between the teacher and the student . Menon et al . ( 2020 ) consider the case of losses such that the population risk is linear in the Bayes class probabilities . They consider distilled empirical risk and Bayes distilled empirical risk which are the risk computed using the teacher class probabilities and Bayes class probabilities respectively rather than the observed label . They show that the variance of the Bayes distilled empirical risk is lower than the empirical risk . Then using analysis from Maurer & Pontil ( 2009 ) ; Bennett ( 1962 ) , they derive the excess risk of the distilled empirical risk as a function of the ` 2 distance between the teacher ’ s class probabilities and the Bayes class probabilities . We significantly depart from Menon et al . ( 2020 ) in multiple ways : i ) our Thm . 1 allows for the common practice of data re-use , ii ) our results cover the standard KD losses SEL and ACE which are non-linear in p0 , iii ) we use localized Rademacher analysis to achieve tight fast rates for standard KD losses , and iv ) we use techniques from semiparametric inference to improve upon vanilla KD . 2 KNOWLEDGE DISTILLATION BACKGROUND . We consider a multiclass classification problem with k classes and n training datapoints zi= ( xi , yi ) sampled independently from some distribution P. Each feature vector x belongs to a setX , each label vector y∈ { e1 , ... , ek } ⊂ { 0,1 } k is a one-hot encoding of the class label , and the conditional probability of observing each label is the Bayes class probability function p0 ( x ) =E [ Y |X =x ] . Our aim is to identify a scoring rule f : X →Rk that minimizes a prediction loss on average under the distribution P. Knowledge distillation . Knowledge distillation ( KD ) is a two-step training process where one first uses a labeled dataset to train a teacher model and then trains a student model to predict the teacher ’ s predicted class probabilities . Typically the teacher model is larger and more cumbersome , while the student is smaller and more efficient . Knowledge distillation was first motivated by model compression ( Bucila et al. , 2006 ) , to find compact yet high-performing models to be deployed ( such as on mobile devices ) . In training the student to match the teacher ’ s prediction probability , there are several types of loss functions that are commonly used . Let p̂ ( x ) ∈Rk be the teacher ’ s vector of predicted class probabilities , f ( x ) ∈Rk be the student model ’ s output , and [ k ] , { 1,2 , ... , k } . The most popular distillation loss functions1 ` ( z ; f ( x ) , p̂ ( x ) ) include the squared error logit ( SEL ) loss ( Ba & Caruana , 2014 ) ` se ( z ; f ( x ) , p̂ ( x ) ) , ∑ j∈ [ k ] 1 2 ( fj ( x ) −log ( p̂j ( x ) ) ) 2 ( SEL ) and the annealed cross-entropy ( ACE ) loss ( Hinton et al. , 2015 ) ` β ( z ; f ( x ) , p̂ ( x ) ) =− ∑ j∈ [ k ] p̂j ( x ) β∑ l∈ [ k ] p̂l ( x ) β log ( exp ( βfj ( x ) ) ∑ l∈ [ k ] exp ( βfl ( x ) ) ) ( ACE ) for an inverse temperatureβ > 0 . These loss functions measure the divergence between the probabilities predicted by the teacher and the student . A student model trained with knowledge distillation often performs better than the same model trained from scratch ( Bucila et al. , 2006 ; Hinton et al. , 2015 ) . In Secs . 3 and 4 , we will adapt modern tools from semiparametric inference to understand and enhance this phenomenon . 3 DISTILLATION AS SEMIPARAMETRIC INFERENCE . In semiparametric inference ( Kosorok , 2007 ) , one aims to estimate a target parameter or function f0 , but that estimation depends on an auxiliary nuisance function p0 that is unknown and not of primary interest . We cast the knowledge distillation process as a semiparametric inference problem , by treating the unknown Bayes class probabilities p0 as nuisance and the teacher ’ s predicted probabilities as a plug-in estimate of that nuisance . This perspective allows us bound the generalization of the student in terms of the mean squared error ( MSE ) between the teacher and the Bayes probabilities . In the next section ( Sec . 4 ) we use techniques from semiparametric inference to enhance the performance of the student . The interested reader could consult Tsiatis ( 2007 ) for more details on semiparametric inference . Our analysis starts from taking the following perspective on distillation . For a given pointwise loss function ` ( z ; f ( x ) , p0 ( x ) ) , we view the goal of the student as minimizing an oracle population loss over a function classF , LD ( f , p0 ) =E [ ` ( Z ; f ( X ) , p0 ( X ) ) ] with f0 , argminf∈FLD ( f , p0 ) . The main hurdle is that this is objective depends on the unknown Bayes probabilities p0 . We view the teacher ’ s model p̂ as an approximate version of p0 and bound the distillation error of the student as a function of the teacher ’ s estimation error . Typical semiparametric inference considers cases where f0 is a finite dimensional parameter ; however recent work of Foster & Syrgkanis ( 2019 ) extends this framework to infinite dimensional models f0 and to develop statistical learning theory with a nuisance component framework . The distillation problem fits exactly into this setup . Bounds on vanilla KD As a first step we derive a vanilla bound on the error of the distilled student model without any further modifications of the distillation process , i.e. , we assume that the student is trained on the same data as the teacher and is trained by running empirical risk minimization ( ERM ) on the plug-in loss , plugging in the teacher ’ s model instead of p0 , i.e. , f̂=argminf∈FLn ( f , p̂ ) for Ln ( f , p̂ ) , En [ ` ( Z ; f ( X ) , p̂ ( X ) ) ] ( Vanilla KD ) where En [ X ] = 1n ∑n i=1Xi denotes the empirical expectation of a random variable . Technical definitions Before presenting our main theorem we introduce some technical notation . For a vector valued function f that takes as input a random variableX , we use the shorthand notation ‖f‖p , q , ‖‖f ( X ) ‖p‖Lq =E [ ‖f ( X ) ‖qp ] 1/q . Let∇φ and∇π denote the partial derivatives of ` ( z ; φ , π ) , with respect to its second and third input correspondingly and ∇φπ the Jacobian of cross partial derivatives , i.e. , [ ∇φπ ` ( z ; φ , π ) ] i , j= ∂ 2 ∂φj∂πi ` ( z ; φ , π ) . Finally , let qf , p ( x ) =E [ ∇φπ ` ( Z ; f ( X ) , p ( X ) ) |X=x ] and γf , p ( x ) =EU∼Unif ( [ 0,1 ] ) [ qf , Up+ ( 1−U ) p0 ( x ) ] . Critical radius Finally , we need to define the notion of the critical radius ( see , e.g. , Wainwright ( 2019 , 14.1.1 ) ) of a function class , which typically provides tight learning rates for statistical learning theory tasks . For any function classF we define the localized Rademacher complexity as : R ( δ ; F ) =EX1 : n , 1 : n [ supf∈F : ‖f‖2≤δ 1 n ∑n i=1 if ( Xi ) ] where i are i.i.d . random variables taking values equiprobably in { −1,1 } . The critical radius of a classF , taking values in [ −H , H ] , is the smallest positive solution δn to the inequalityR ( δ ; F ) ≤ δ 2 H . 1These loss functions do not depend on the ground-truth label y , but we use the augmented notation ` ( z ; f ( x ) , p̂ ( x ) ) to accommodate the enhanced distillation losses presented in Sec . 4 . Theorem 1 ( Vanilla KD analysis ) . Suppose f0 belongs to a convex set F satisfying the ` 2/ ` 4 ratio condition supf∈F ‖f−f0‖2,4/‖f−f0‖2,2 ≤C and that the teacher estimates p̂∈P from the same dataset used to train the student . Let δn , ζ = δn+c0 √ log ( c1/ζ ) n for universal constants c0 , c1 and δn an upper bound on the critical radius of the function class G , { z→r ( ` ( z ; f ( x ) , p ( x ) ) − ` ( z ; f0 ( x ) , p ( x ) ) ) : f ∈F , p∈P , r∈ [ 0,1 ] } . Let µ ( z ) = supφ‖∇φ ` ( z ; φ , p̂ ( x ) ) ‖2 , and assume that the loss ` ( z ; φ , π ) is σ-strongly convex in φ for each z and that each g∈G is uniformly bounded in [ −H , H ] . Then the Vanilla KD f̂ satisfies ‖f̂−f0‖22,2 = 1σ2O ( δ 2 n , ζC 2H2‖µ‖24+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) with probability at least 1−ζ . Thm . 1 , proved in App . C , shows that vanilla distillation yields an accurate student whenever the teacher generalizes well ( i.e. , ‖p̂−p0‖2,2 is small ) and the student and teacher model classesF andP are not too complex . The ` 2/ ` 4 ratio requirement can be removed at the expense of replacing ‖µ‖4 by ‖µ‖∞=supz|µ ( z ) | in the final bound . Moreover , we highlight that the strong convexity requirement for ` is satisfied by all standard distillation objectives including SEL and ACE , as it is strong convexity with respect to the output of f and not the parameters of f . Even this requirement could be removed , but this would yield slow rate bounds of the form : ‖f̂−f0‖22,2 =O ( δn , ζ+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) . Failure modes of vanilla KD Thm . 1 also hints at two distinct ways in which vanilla distillation could fail . First , since the student only learns from the teacher and does not have access to the original labels , we would expect the student to be erroneous when the teacher probabilities are inaccurate due to model misspecification , an overly restrictive teacher function class , or insufficient training . Prop . 2 , proved in App . D , confirms that , in the worst case , student error suffers from inaccuracy due to this teacher underfitting even when both the student and teacher belong to low complexity model classes . Proposition 2 ( Impact of teacher underfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =log ( p0 ) : • The teacher learns p̂ ( x ) = 1n ( 1+λ ) ∑n i=1yi for all x∈X via ridge regression with λ=Θ ( 1/n1/4 ) . • Vanilla KD with SEL loss and constant f̂ satisfies ‖f̂−f0‖22,2 ≥‖γ > f0 , p0 ( p̂−p0 ) ‖ 2 2,2 = Ω ( 1√ n ) , matching the dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =diag ( 1 p̂ ( t ) ) , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( 1n ) . Second , the critical radius in Thm . 1 depends on the complexity of the teacher model class P . If P has a large critical radius , then the student error bound suffers due to potential teacher overfitting even if the teacher generalizes well . Prop . 3 , proved in App . E , shows that , in the worst case , this teacher overfitting penalty is unavoidable and does in fact lead to increased student error . This occurs as the student only has access to the teacher ’ s training set probabilities which , due to overfitting , need not reflect its test set probabilities . Proposition 3 ( Impact of teacher overfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =E [ log ( p0 ( X ) ) ] : • The critical radius δn of the teacher-student function class G in Thm . 1 is a non-vanishing constant , due to the complexity of the teacher ’ s function class . • The Vanilla KD error ‖f̂−f0‖22,2 for constant f̂ with SEL loss is lower bounded by a non-vanishing constant , matching the δn dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =0 , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( n−4/ ( 4+d ) ) . These examples serve to lower bound student performance in the worst case by the teacher ’ s critical radius and class probability MSE , matching the upper bounds given in Thm . 1 . However , we note that in other better-case scenarios vanilla distillation can perform better than the upper-bounding Thm . 1 would imply . In the next section , we adapt and generalize techniques from semiparametric inference to mitigate the effects of teacher overfitting and underfitting in all cases .
The knowledge distillation (KD) approach is a two-step procedure: first train the teacher model on the labeled data and then train the student model using the predicted class probabilities from the teacher model. A key theoretical question about KD is whether and how much this two-step approach can improve on the one-step approach that trains the student model directly on the labeled data. This paper casts KD as a semiparametric inference problem by treating the optimal student model as the parameter of primary interest and the true class probabilities as the nuisance parameter. Building on the semiparametric framework, the paper makes two contributions: 1) develops theoretical guarantees for the vanilla KD algorithm; 2) proposes improved KD by using a first-order bias-corrected loss and a sample splitting procedure.
SP:d0cc938ab1814b400f9b056c172b056d6358ec21
Knowledge Distillation as Semiparametric Inference
A popular approach to model compression is to train an inexpensive student model to mimic the class probabilities of a highly accurate but cumbersome teacher model . Surprisingly , this two-step knowledge distillation process often leads to higher accuracy than training the student directly on labeled data . To explain and enhance this phenomenon , we cast knowledge distillation as a semiparametric inference problem with the optimal student model as the target , the unknown Bayes class probabilities as nuisance , and the teacher probabilities as a plug-in nuisance estimate . By adapting modern semiparametric tools , we derive new guarantees for the prediction error of standard distillation and develop two enhancements—cross-fitting and loss correction—to mitigate the impact of teacher overfitting and underfitting on student performance . We validate our findings empirically on both tabular and image data and observe consistent improvements from our knowledge distillation enhancements . 1 INTRODUCTION . Knowledge distillation ( KD ) ( Craven & Shavlik , 1996 ; Breiman & Shang , 1996 ; Bucila et al. , 2006 ; Li et al. , 2014 ; Ba & Caruana , 2014 ; Hinton et al. , 2015 ) is a widely used model compression technique that enables the deployment of highly accurate predictive models on devices such as phones , watches , and virtual assistants ( Stock et al. , 2020 ) . KD operates by training a compressed student model to mimic the predicted class probabilities of an expensive , high-quality teacher model . Remarkably and across a wide variety of domains ( Hinton et al. , 2015 ; Sanh et al. , 2019 ; Jiao et al. , 2019 ; Liu et al. , 2018 ; Tan et al. , 2018 ; Fakoor et al. , 2020 ) , this two-step process often leads to higher accuracy than training the student directly on the raw labeled dataset . While the practice of KD is now well developed , a general theoretical understanding of its successes and failures is still lacking . As we detail below , a number of authors have argued that the success of KD lies in the more precise “ soft labels ” provided by the teacher ’ s predicted class probabilities . Recently , Menon et al . ( 2020 ) observed that these teacher probabilities can serve as a proxy for the Bayes probabilities ( i.e. , the true class probabilities ) and that the closer the teacher and Bayes probabilities , the better the student ’ s performance should be . Building on this observation , we cast KD as a plug-in approach to semiparametric inference ( Kosorok , 2007 ) : that is , we view KD as fitting a student model f̂ in the presence of nuisance ( the Bayes probabilities p0 ) with the teacher ’ s probabilities p̂ as a plug-in estimate of p0 . This insight allows us to adapt modern tools from semiparametric inference to analyze the error of a distilled student in Sec . 3 . Our analysis also reveals two distinct failure modes of KD : one due to teacher overfitting and data reuse and the other due to teacher underfitting from model misspecification or insufficient training . In Sec . 4 , we introduce and analyze two complementary KD enhancements that correct for these failures : cross-fitting—a popular technique from semiparametric inference ( see , e.g. , Chernozhukov et al. , 2018 ) —mitigates teacher overfitting through data partitioning while loss correction mitigates teacher underfitting by reducing the bias of the plug-in estimate p̂ . The latter enhancement was inspired by the orthogonal machine learning ( Chernozhukov et al. , 2018 ; Foster & Syrgkanis , 2019 ) approach to semiparametric inference which suggests a particular adjustment for the teacher ’ s log probabilities . We argue in Sec . 4 that this orthogonal correction minimizes the teacher bias but often at the cost of unacceptably large variance . Our proposed correction avoids this variance explosion by balancing the bias and variance terms in our generalization bounds . In Sec . 5 , we complement our theoretical analysis with a pair of experiments demonstrating the value of our enhancements on six real classification problems . On five real tabular datasets , cross-fitting and loss correction improve student performance by up to 4 % AUC over vanilla KD . Furthermore , on CIFAR-10 ( Krizhevsky & Hinton , 2009 ) , a benchmark image classification dataset , our enhancements improve vanilla KD accuracy by up to 1.5 % when the teacher model overfits . Related work . Since we can not review the vast literature on KD in its entirety , we point the interested reader to Gou et al . ( 2020 ) for a recent overview of the field . We devote this section to reviewing theoretical advances in the understanding of KD and summarize complementary empirical studies and applications of in the extended literature review in App . A . A number of papers have argued that the availability of soft class probabilities from the teacher rather than hard labels enables us to improve training of the student model . This was hypothesized in Hinton et al . ( 2015 ) with empirical justification . Phuong & Lampert ( 2019 ) consider the case in which the teacher is a fixed linear classifier and the student is either a linear model or a deep linear network . They show that the student can learn the teacher perfectly if the number of training examples exceeds the ambient dimension . Vapnik & Izmailov ( 2015 ) discuss the setting of learning with privileged information where one has additional information at training time which is not available at test time . Lopez-Paz et al . ( 2015 ) draw a connection between this and KD , arguing that KD is effective because the teacher learns a better representation allowing the student to learn at a faster rate . They hypothesize that a teacher ’ s class probabilities enable student improvement by indicating how difficult each point is to classify . Tang et al . ( 2020 ) argue using empirical evidence that label smoothing and reweighting of training examples using the teacher ’ s predictions are key to the success of KD . Mobahi et al . ( 2020 ) analyzed the case of self-distillation in which the student and teacher function classes are identical . Focusing on kernel ridge regression models , they proved that self-distillation can act as increased regularization strength . Bu et al . ( 2020 ) considers more generic model compression in a rate-distortion framework , where the rate is the size of the student model and distortion is the difference in excess risk between the teacher and the student . Menon et al . ( 2020 ) consider the case of losses such that the population risk is linear in the Bayes class probabilities . They consider distilled empirical risk and Bayes distilled empirical risk which are the risk computed using the teacher class probabilities and Bayes class probabilities respectively rather than the observed label . They show that the variance of the Bayes distilled empirical risk is lower than the empirical risk . Then using analysis from Maurer & Pontil ( 2009 ) ; Bennett ( 1962 ) , they derive the excess risk of the distilled empirical risk as a function of the ` 2 distance between the teacher ’ s class probabilities and the Bayes class probabilities . We significantly depart from Menon et al . ( 2020 ) in multiple ways : i ) our Thm . 1 allows for the common practice of data re-use , ii ) our results cover the standard KD losses SEL and ACE which are non-linear in p0 , iii ) we use localized Rademacher analysis to achieve tight fast rates for standard KD losses , and iv ) we use techniques from semiparametric inference to improve upon vanilla KD . 2 KNOWLEDGE DISTILLATION BACKGROUND . We consider a multiclass classification problem with k classes and n training datapoints zi= ( xi , yi ) sampled independently from some distribution P. Each feature vector x belongs to a setX , each label vector y∈ { e1 , ... , ek } ⊂ { 0,1 } k is a one-hot encoding of the class label , and the conditional probability of observing each label is the Bayes class probability function p0 ( x ) =E [ Y |X =x ] . Our aim is to identify a scoring rule f : X →Rk that minimizes a prediction loss on average under the distribution P. Knowledge distillation . Knowledge distillation ( KD ) is a two-step training process where one first uses a labeled dataset to train a teacher model and then trains a student model to predict the teacher ’ s predicted class probabilities . Typically the teacher model is larger and more cumbersome , while the student is smaller and more efficient . Knowledge distillation was first motivated by model compression ( Bucila et al. , 2006 ) , to find compact yet high-performing models to be deployed ( such as on mobile devices ) . In training the student to match the teacher ’ s prediction probability , there are several types of loss functions that are commonly used . Let p̂ ( x ) ∈Rk be the teacher ’ s vector of predicted class probabilities , f ( x ) ∈Rk be the student model ’ s output , and [ k ] , { 1,2 , ... , k } . The most popular distillation loss functions1 ` ( z ; f ( x ) , p̂ ( x ) ) include the squared error logit ( SEL ) loss ( Ba & Caruana , 2014 ) ` se ( z ; f ( x ) , p̂ ( x ) ) , ∑ j∈ [ k ] 1 2 ( fj ( x ) −log ( p̂j ( x ) ) ) 2 ( SEL ) and the annealed cross-entropy ( ACE ) loss ( Hinton et al. , 2015 ) ` β ( z ; f ( x ) , p̂ ( x ) ) =− ∑ j∈ [ k ] p̂j ( x ) β∑ l∈ [ k ] p̂l ( x ) β log ( exp ( βfj ( x ) ) ∑ l∈ [ k ] exp ( βfl ( x ) ) ) ( ACE ) for an inverse temperatureβ > 0 . These loss functions measure the divergence between the probabilities predicted by the teacher and the student . A student model trained with knowledge distillation often performs better than the same model trained from scratch ( Bucila et al. , 2006 ; Hinton et al. , 2015 ) . In Secs . 3 and 4 , we will adapt modern tools from semiparametric inference to understand and enhance this phenomenon . 3 DISTILLATION AS SEMIPARAMETRIC INFERENCE . In semiparametric inference ( Kosorok , 2007 ) , one aims to estimate a target parameter or function f0 , but that estimation depends on an auxiliary nuisance function p0 that is unknown and not of primary interest . We cast the knowledge distillation process as a semiparametric inference problem , by treating the unknown Bayes class probabilities p0 as nuisance and the teacher ’ s predicted probabilities as a plug-in estimate of that nuisance . This perspective allows us bound the generalization of the student in terms of the mean squared error ( MSE ) between the teacher and the Bayes probabilities . In the next section ( Sec . 4 ) we use techniques from semiparametric inference to enhance the performance of the student . The interested reader could consult Tsiatis ( 2007 ) for more details on semiparametric inference . Our analysis starts from taking the following perspective on distillation . For a given pointwise loss function ` ( z ; f ( x ) , p0 ( x ) ) , we view the goal of the student as minimizing an oracle population loss over a function classF , LD ( f , p0 ) =E [ ` ( Z ; f ( X ) , p0 ( X ) ) ] with f0 , argminf∈FLD ( f , p0 ) . The main hurdle is that this is objective depends on the unknown Bayes probabilities p0 . We view the teacher ’ s model p̂ as an approximate version of p0 and bound the distillation error of the student as a function of the teacher ’ s estimation error . Typical semiparametric inference considers cases where f0 is a finite dimensional parameter ; however recent work of Foster & Syrgkanis ( 2019 ) extends this framework to infinite dimensional models f0 and to develop statistical learning theory with a nuisance component framework . The distillation problem fits exactly into this setup . Bounds on vanilla KD As a first step we derive a vanilla bound on the error of the distilled student model without any further modifications of the distillation process , i.e. , we assume that the student is trained on the same data as the teacher and is trained by running empirical risk minimization ( ERM ) on the plug-in loss , plugging in the teacher ’ s model instead of p0 , i.e. , f̂=argminf∈FLn ( f , p̂ ) for Ln ( f , p̂ ) , En [ ` ( Z ; f ( X ) , p̂ ( X ) ) ] ( Vanilla KD ) where En [ X ] = 1n ∑n i=1Xi denotes the empirical expectation of a random variable . Technical definitions Before presenting our main theorem we introduce some technical notation . For a vector valued function f that takes as input a random variableX , we use the shorthand notation ‖f‖p , q , ‖‖f ( X ) ‖p‖Lq =E [ ‖f ( X ) ‖qp ] 1/q . Let∇φ and∇π denote the partial derivatives of ` ( z ; φ , π ) , with respect to its second and third input correspondingly and ∇φπ the Jacobian of cross partial derivatives , i.e. , [ ∇φπ ` ( z ; φ , π ) ] i , j= ∂ 2 ∂φj∂πi ` ( z ; φ , π ) . Finally , let qf , p ( x ) =E [ ∇φπ ` ( Z ; f ( X ) , p ( X ) ) |X=x ] and γf , p ( x ) =EU∼Unif ( [ 0,1 ] ) [ qf , Up+ ( 1−U ) p0 ( x ) ] . Critical radius Finally , we need to define the notion of the critical radius ( see , e.g. , Wainwright ( 2019 , 14.1.1 ) ) of a function class , which typically provides tight learning rates for statistical learning theory tasks . For any function classF we define the localized Rademacher complexity as : R ( δ ; F ) =EX1 : n , 1 : n [ supf∈F : ‖f‖2≤δ 1 n ∑n i=1 if ( Xi ) ] where i are i.i.d . random variables taking values equiprobably in { −1,1 } . The critical radius of a classF , taking values in [ −H , H ] , is the smallest positive solution δn to the inequalityR ( δ ; F ) ≤ δ 2 H . 1These loss functions do not depend on the ground-truth label y , but we use the augmented notation ` ( z ; f ( x ) , p̂ ( x ) ) to accommodate the enhanced distillation losses presented in Sec . 4 . Theorem 1 ( Vanilla KD analysis ) . Suppose f0 belongs to a convex set F satisfying the ` 2/ ` 4 ratio condition supf∈F ‖f−f0‖2,4/‖f−f0‖2,2 ≤C and that the teacher estimates p̂∈P from the same dataset used to train the student . Let δn , ζ = δn+c0 √ log ( c1/ζ ) n for universal constants c0 , c1 and δn an upper bound on the critical radius of the function class G , { z→r ( ` ( z ; f ( x ) , p ( x ) ) − ` ( z ; f0 ( x ) , p ( x ) ) ) : f ∈F , p∈P , r∈ [ 0,1 ] } . Let µ ( z ) = supφ‖∇φ ` ( z ; φ , p̂ ( x ) ) ‖2 , and assume that the loss ` ( z ; φ , π ) is σ-strongly convex in φ for each z and that each g∈G is uniformly bounded in [ −H , H ] . Then the Vanilla KD f̂ satisfies ‖f̂−f0‖22,2 = 1σ2O ( δ 2 n , ζC 2H2‖µ‖24+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) with probability at least 1−ζ . Thm . 1 , proved in App . C , shows that vanilla distillation yields an accurate student whenever the teacher generalizes well ( i.e. , ‖p̂−p0‖2,2 is small ) and the student and teacher model classesF andP are not too complex . The ` 2/ ` 4 ratio requirement can be removed at the expense of replacing ‖µ‖4 by ‖µ‖∞=supz|µ ( z ) | in the final bound . Moreover , we highlight that the strong convexity requirement for ` is satisfied by all standard distillation objectives including SEL and ACE , as it is strong convexity with respect to the output of f and not the parameters of f . Even this requirement could be removed , but this would yield slow rate bounds of the form : ‖f̂−f0‖22,2 =O ( δn , ζ+‖γ > f0 , p̂ ( p̂−p0 ) ‖ 2 2,2 ) . Failure modes of vanilla KD Thm . 1 also hints at two distinct ways in which vanilla distillation could fail . First , since the student only learns from the teacher and does not have access to the original labels , we would expect the student to be erroneous when the teacher probabilities are inaccurate due to model misspecification , an overly restrictive teacher function class , or insufficient training . Prop . 2 , proved in App . D , confirms that , in the worst case , student error suffers from inaccuracy due to this teacher underfitting even when both the student and teacher belong to low complexity model classes . Proposition 2 ( Impact of teacher underfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =log ( p0 ) : • The teacher learns p̂ ( x ) = 1n ( 1+λ ) ∑n i=1yi for all x∈X via ridge regression with λ=Θ ( 1/n1/4 ) . • Vanilla KD with SEL loss and constant f̂ satisfies ‖f̂−f0‖22,2 ≥‖γ > f0 , p0 ( p̂−p0 ) ‖ 2 2,2 = Ω ( 1√ n ) , matching the dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =diag ( 1 p̂ ( t ) ) , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( 1n ) . Second , the critical radius in Thm . 1 depends on the complexity of the teacher model class P . If P has a large critical radius , then the student error bound suffers due to potential teacher overfitting even if the teacher generalizes well . Prop . 3 , proved in App . E , shows that , in the worst case , this teacher overfitting penalty is unavoidable and does in fact lead to increased student error . This occurs as the student only has access to the teacher ’ s training set probabilities which , due to overfitting , need not reflect its test set probabilities . Proposition 3 ( Impact of teacher overfitting on vanilla KD ) . There exists a classification problem in which the following properties all hold simultaneously with high probability for f0 =E [ log ( p0 ( X ) ) ] : • The critical radius δn of the teacher-student function class G in Thm . 1 is a non-vanishing constant , due to the complexity of the teacher ’ s function class . • The Vanilla KD error ‖f̂−f0‖22,2 for constant f̂ with SEL loss is lower bounded by a non-vanishing constant , matching the δn dependence of the Thm . 1 upper bound up to a constant factor . • Enhanced KD with SEL loss , γ̂ ( t ) =0 , and constant f̂ satisfies ‖f̂−f0‖22,2 =O ( n−4/ ( 4+d ) ) . These examples serve to lower bound student performance in the worst case by the teacher ’ s critical radius and class probability MSE , matching the upper bounds given in Thm . 1 . However , we note that in other better-case scenarios vanilla distillation can perform better than the upper-bounding Thm . 1 would imply . In the next section , we adapt and generalize techniques from semiparametric inference to mitigate the effects of teacher overfitting and underfitting in all cases .
This paper formulates knowledge distillation as a semi-parametric inference problem. Then, the paper adapts techniques from semi-parametric inference to analyze the error of a student model and improve the performance of knowledge distillation. The presentation is overall of good quality and it is relatively easy for me to follow the logic flow. That being said, there is still some room of improving the clarity of the paper.
SP:d0cc938ab1814b400f9b056c172b056d6358ec21
An Unsupervised Deep Learning Approach for Real-World Image Denoising
1 INTRODUCTION . Noise always exists during the process of image acquisition and its removing is important for image recovery and vision tasks , e.g. , segmentation and recognition . Specifically , the noisy image y is modeled as y = x+ n , where x denotes the clean image , n denotes the corrupted noise and image denoising aims at recovering x from y . Over the past two decades , this problem has been extensively explored and many works have been proposed . Among these works , one typical kind of model assumes that the image is corrupted by additive white Gaussian noise ( AWGN ) , i.e. , n ∼ N ( 0 , σ2I ) where N ( 0 , 1 ) is the standard Gaussian distribution . Representative Gaussian denoising approaches include block matching and 3D filtering ( BM3D ) ( Dabov et al. , 2007b ) , non-local mean method ( NLM ) ( Buades et al. , 2005 ) , KSVD ( Aharon et al. , 2006 ) and weighted nuclear norm minimization ( WNNM ) ( Gu et al. , 2014 ) , which perform well on AWGN noise removal . However , the AWGN assumption seldom holds in practical applications as the noise is accumulated during the whole imaging process . For example , in typical CCD or CMOS cameras , the noise depends on the underlying context ( daytime or nighttime , static or dynamic , indoor or outdoor , etc . ) and the camera settings ( shutter speed , ISO , white balance , etc. ) . In Figure 1 , two real noisy images captured by Samsung Galaxy S6 Edge and Google Pixel smartphones are chosen from Smartphone Image Denoising Dataset ( SIDD ) ( Abdelhamed et al. , 2018 ) and three 40×40 patches are chosen for illustration of noisy distribution . It is clear that real noise distribution is content dependent and noise in each patch has different statistical properties which can be non-Gaussian . Due to the violation of the AWGN assumption , the performance of ∗Corresponding author . the Gaussian denoiser deteriorates significantly ( Figure 1 ( d ) ) . Thus , it is crucial to characterize the noise distribution and adapt the noise models to the denoiser in real-world image denoising . In recent years , deep learning based methods have achieved remarkable performance with careful architecture design , good training strategies , a large number of noisy and clean image pairs . However , there are two main drawbacks of these approaches from the perspective of practical applications . One is the high dependency on the quality and the size of the training dataset . Collecting such image pairs is time-consuming and requires much of human efforts , especially when the labeling needs deep domain knowledge such as medical or seismic images . The very recent deep learning methods including Noise2Noise ( N2N ) ( Lehtinen et al. , 2018 ) , Noise2Void ( N2V ) ( Krull et al. , 2019a ) and Noise2Self ( N2S ) ( Batson & Royer , 2019 ) have relaxed the dataset requirement and can be trained on organized/un-organized noisy and noisy image pairs . Nevertheless , to guarantee the performance , these networks need to be pre-trained with a large number of images to cover sufficiently many local patterns , and thus they are not cost-effective . Therefore , to reduce the dependency of the training set , single-image based image denoising approaches deserved to be studied and have both practical and scientific value . It is worth mentioning that a recent unsupervised learning work ( Ulyanov et al. , 2018 ) uses a deep image prior to the general image recovery problem but its denoising results are inferior to some typical Gaussian denoisers , e.g. , BM3D . The other drawback is the generalization ability of a trained network . When the noisy distribution is complicated and not contained in the training set , the results of the deep learning method can be deteriorated significantly , even worse than non-learning based methods . To alleviate this problem , some recent works are proposed by further consideration of noise estimation in the network design , e.g. , Guo et al . ( 2019 ) ; Yue et al . ( 2019 ) ; Zhang et al . ( 2017 ) . Despite their good performance in blind Gaussian denoising ( Guo et al. , 2019 ; Zhang et al. , 2017 ) and real-world denoising problem ( Yue et al. , 2019 ) , a large number of noisy and clean image pairs are needed and the generalization problem remains when the imaging system is complicated . Very recently , a single image based method has been proposed in ( Quan et al. , 2020 ) by developing a novel dropout technique for image denoising . Thus , unsupervised deep learning approaches with accurate noise models are important for solving real-world image denoising problems , yet current solutions are unsatisfactory . Such approach deserves to be studied and is a challenging problem as it needs a good combination of traditional methods and deep learning based methods such that the benefits of both methods are fully explored . 1.1 THE SUMMARY OF IDEAS AND CONTRIBUTIONS . Motivated by the above analysis , the goal of this paper is to propose an unsupervised deep learning method that boosts the performance of existing Gaussian denoisers when solving real-world image denoising problems . The basic idea is to find a latent image z associated with the input noisy image y such that z|x satisfies the AWGN assumption , and thus we can obtain the clean image x from z by any existing Gaussian denoiser . To find the appropriate latent representation , we propose a neural network ( NN ) based approach that builds up the mapping between the noisy image y and latent image z with an encoder-decoder structure . By applying the Gaussian denoiser in the latent space , we alternatively update the NN and the denoised image which does not need the other training samples . Figure 2 illustrates the workflow of the proposed approach . Also , this idea can be formulated under the classical maximum a posterior ( MAP ) framework which consists of a likelihood term and a prior term . Building a proper likelihood term requires an accurate estimation of the noise distribution . Although the accurate noise distribution is difficult to get , an evidence lower bound ( ELBO ) can be analytically derived for approximating the likelihood from below using variational auto-encoder ( VAE ) ( Kingma & Welling , 2013 ) . This ELBO term gives the loss function for the encoder and decoder networks that are maps between noisy image and latent image . From the above derivation , we arrive at a model min x , F , G f ( x , y , F , G ) +R ( x ) , ( 1 ) where x is the clean image , y is the input noisy image , F , G are decoder and encoder maps parameterized by NNs , f is the loss from ELBO and R ( x ) is the regularization term . Model ( 1 ) can be minimized by the alternative direction method of multiplier ( ADMM ) which alternatively updates networks and the clean image estimation x . Using Plug-and-Play technique ( Venkatakrishnan et al. , 2013 ) , updating x can be replaced by any Gaussian denoiser . Thus , by fully exploiting the benefits of deep neural networks and classic denoising schemes , the real-world image denoising can be improved by a large margin as shown in Figure 1 ( e ) . More importantly , training the proposed networks only uses the noisy image itself and does not need any pre-training . In summary , we list our main contributions as follows . • We propose an effective approach that combines the deep learning method with traditional methods for unsupervised image denoising . Thanks to the great expressive power of deep neural networks , the complex noise distribution is mapped into a latent space in which the AWGN assumption tends to hold , and thus better results are obtained by applying existing Gaussian denoiser for latent images . • Instead of a heuristic loss design , the proposed NN approximates the likelihood in the classic Bayesian framework , which gives clear interpretations of each loss term . Meanwhile , compared to many existing deep learning methods , our model is only trained on a single image , which significantly reduces the burden of data collection . • Extensive numerical experiments on real-world noisy image datasets have shown that the NN boosts the performance of the existing denoisers including NLM , BM3D and DnCNN . In particular , the results of NN+BM3D are competitive with some supervised deep learning approaches such as DnCNN+ , FFDNet+ , CBDNet . 2 RELATED WORK . There are numerous works in image denoising . Here , we review the works related to the nonlearning and learning approaches for real-world image denoising . 2.1 NON-LEARNING BASED APPROACHES . Non-learning approaches are mainly based on the MAP framework that contains a data fidelity and a regularization term . Many works have been proposed to improve the regularize term , e.g. , sparsity based methods ( Rudin et al. , 1992 ; Perona & Malik , 1990 ) , low rank prior ( Dong et al. , 2012b ; Gu et al. , 2014 ) and non-local methods ( Buades et al. , 2005 ; Dabov et al. , 2007a ) . Among these methods , BM3D ( Dabov et al. , 2007a ) is one of the top methods . There are several other works related to the construction of data fidelity by modeling the complex noise distribution , e.g. , Lebrun et al . ( 2015a ) ; Nam et al . ( 2016 ) ; Xu et al . ( 2017 ) ; Zhu et al . ( 2016 ) . The correlated Gaussian distribution ( Lebrun et al. , 2015a ) and Mixture of Gaussian ( Zhu et al. , 2016 ; Nam et al. , 2016 ) are used to approximate the unknown noise distribution . In Xu et al . ( 2017 ) , different noise statistics are estimated in different channels without the consideration of the content dependent noise . Recently , Amini et al . ( 2020 ) proposed a Gaussianization method for gray scale OCT images . However , this method is not applicable for real-world image denoising tasks as natural images are colorful and the noise distribution is much more complicated than that in OCT images . Overall , due to the complexity of real-world noise , the performance of these approaches is unsatisfactory and needs to be improved . 2.2 LEARNING BASED APPROACHES . The learning based approaches can be classified into two groups : single-image based methods and dataset based methods . Typical single-image based approaches are sparse coding methods Aharon et al . ( 2006 ) ; Bao et al . ( 2015 ) ; Xu et al . ( 2018b ) . In Xu et al . ( 2018b ) , the noise in each channel is estimated and followed by a weighted sparse coding scheme . In recent years , as the appearance of real image denoising datasets including CC ( Nam et al. , 2016 ) , PolyU ( Xu et al. , 2018a ) , DND ( Plotz & Roth , 2017 ) and SIDD ( Abdelhamed et al. , 2018 ) , deep neural networks including Guo et al . ( 2019 ) ; Yu et al . ( 2019 ) ; Zhang et al . ( 2017 ) ; Zhou et al . ( 2019 ) ; Yue et al . ( 2019 ) have shown promising results on these datasets . However , these networks require many noisy/clean training pairs which limit their practical applications especially when the labeling work needs domain experts . Recently , the deep learning approaches ( Krull et al. , 2019a ; b ; Batson & Royer , 2019 ; Laine et al. , 2019 ; Lehtinen et al. , 2018 ) are proposed and trained with organized or unorganized noisy image pairs . To guarantee a satisfactory performance , these methods still need many training pairs such that sufficiently many local patterns are covered . Compared to the above deep learning approaches , our method is a single image based method which does not need training samples or pre-training from other datasets .
The paper proposes an unsupervised approach for denoising for which works on a single noisy image. The central idea is to use a neural network to map the noisy image to a latent image space where the noisy distribution follows Gaussian (like Variance Stabliziation Transform) and then use a off-the-shelf Gaussian denoiser on this image. The paper shows good numerical results.
SP:68981cc1326c08d1ccad134c5b86a4631f31591e
An Unsupervised Deep Learning Approach for Real-World Image Denoising
1 INTRODUCTION . Noise always exists during the process of image acquisition and its removing is important for image recovery and vision tasks , e.g. , segmentation and recognition . Specifically , the noisy image y is modeled as y = x+ n , where x denotes the clean image , n denotes the corrupted noise and image denoising aims at recovering x from y . Over the past two decades , this problem has been extensively explored and many works have been proposed . Among these works , one typical kind of model assumes that the image is corrupted by additive white Gaussian noise ( AWGN ) , i.e. , n ∼ N ( 0 , σ2I ) where N ( 0 , 1 ) is the standard Gaussian distribution . Representative Gaussian denoising approaches include block matching and 3D filtering ( BM3D ) ( Dabov et al. , 2007b ) , non-local mean method ( NLM ) ( Buades et al. , 2005 ) , KSVD ( Aharon et al. , 2006 ) and weighted nuclear norm minimization ( WNNM ) ( Gu et al. , 2014 ) , which perform well on AWGN noise removal . However , the AWGN assumption seldom holds in practical applications as the noise is accumulated during the whole imaging process . For example , in typical CCD or CMOS cameras , the noise depends on the underlying context ( daytime or nighttime , static or dynamic , indoor or outdoor , etc . ) and the camera settings ( shutter speed , ISO , white balance , etc. ) . In Figure 1 , two real noisy images captured by Samsung Galaxy S6 Edge and Google Pixel smartphones are chosen from Smartphone Image Denoising Dataset ( SIDD ) ( Abdelhamed et al. , 2018 ) and three 40×40 patches are chosen for illustration of noisy distribution . It is clear that real noise distribution is content dependent and noise in each patch has different statistical properties which can be non-Gaussian . Due to the violation of the AWGN assumption , the performance of ∗Corresponding author . the Gaussian denoiser deteriorates significantly ( Figure 1 ( d ) ) . Thus , it is crucial to characterize the noise distribution and adapt the noise models to the denoiser in real-world image denoising . In recent years , deep learning based methods have achieved remarkable performance with careful architecture design , good training strategies , a large number of noisy and clean image pairs . However , there are two main drawbacks of these approaches from the perspective of practical applications . One is the high dependency on the quality and the size of the training dataset . Collecting such image pairs is time-consuming and requires much of human efforts , especially when the labeling needs deep domain knowledge such as medical or seismic images . The very recent deep learning methods including Noise2Noise ( N2N ) ( Lehtinen et al. , 2018 ) , Noise2Void ( N2V ) ( Krull et al. , 2019a ) and Noise2Self ( N2S ) ( Batson & Royer , 2019 ) have relaxed the dataset requirement and can be trained on organized/un-organized noisy and noisy image pairs . Nevertheless , to guarantee the performance , these networks need to be pre-trained with a large number of images to cover sufficiently many local patterns , and thus they are not cost-effective . Therefore , to reduce the dependency of the training set , single-image based image denoising approaches deserved to be studied and have both practical and scientific value . It is worth mentioning that a recent unsupervised learning work ( Ulyanov et al. , 2018 ) uses a deep image prior to the general image recovery problem but its denoising results are inferior to some typical Gaussian denoisers , e.g. , BM3D . The other drawback is the generalization ability of a trained network . When the noisy distribution is complicated and not contained in the training set , the results of the deep learning method can be deteriorated significantly , even worse than non-learning based methods . To alleviate this problem , some recent works are proposed by further consideration of noise estimation in the network design , e.g. , Guo et al . ( 2019 ) ; Yue et al . ( 2019 ) ; Zhang et al . ( 2017 ) . Despite their good performance in blind Gaussian denoising ( Guo et al. , 2019 ; Zhang et al. , 2017 ) and real-world denoising problem ( Yue et al. , 2019 ) , a large number of noisy and clean image pairs are needed and the generalization problem remains when the imaging system is complicated . Very recently , a single image based method has been proposed in ( Quan et al. , 2020 ) by developing a novel dropout technique for image denoising . Thus , unsupervised deep learning approaches with accurate noise models are important for solving real-world image denoising problems , yet current solutions are unsatisfactory . Such approach deserves to be studied and is a challenging problem as it needs a good combination of traditional methods and deep learning based methods such that the benefits of both methods are fully explored . 1.1 THE SUMMARY OF IDEAS AND CONTRIBUTIONS . Motivated by the above analysis , the goal of this paper is to propose an unsupervised deep learning method that boosts the performance of existing Gaussian denoisers when solving real-world image denoising problems . The basic idea is to find a latent image z associated with the input noisy image y such that z|x satisfies the AWGN assumption , and thus we can obtain the clean image x from z by any existing Gaussian denoiser . To find the appropriate latent representation , we propose a neural network ( NN ) based approach that builds up the mapping between the noisy image y and latent image z with an encoder-decoder structure . By applying the Gaussian denoiser in the latent space , we alternatively update the NN and the denoised image which does not need the other training samples . Figure 2 illustrates the workflow of the proposed approach . Also , this idea can be formulated under the classical maximum a posterior ( MAP ) framework which consists of a likelihood term and a prior term . Building a proper likelihood term requires an accurate estimation of the noise distribution . Although the accurate noise distribution is difficult to get , an evidence lower bound ( ELBO ) can be analytically derived for approximating the likelihood from below using variational auto-encoder ( VAE ) ( Kingma & Welling , 2013 ) . This ELBO term gives the loss function for the encoder and decoder networks that are maps between noisy image and latent image . From the above derivation , we arrive at a model min x , F , G f ( x , y , F , G ) +R ( x ) , ( 1 ) where x is the clean image , y is the input noisy image , F , G are decoder and encoder maps parameterized by NNs , f is the loss from ELBO and R ( x ) is the regularization term . Model ( 1 ) can be minimized by the alternative direction method of multiplier ( ADMM ) which alternatively updates networks and the clean image estimation x . Using Plug-and-Play technique ( Venkatakrishnan et al. , 2013 ) , updating x can be replaced by any Gaussian denoiser . Thus , by fully exploiting the benefits of deep neural networks and classic denoising schemes , the real-world image denoising can be improved by a large margin as shown in Figure 1 ( e ) . More importantly , training the proposed networks only uses the noisy image itself and does not need any pre-training . In summary , we list our main contributions as follows . • We propose an effective approach that combines the deep learning method with traditional methods for unsupervised image denoising . Thanks to the great expressive power of deep neural networks , the complex noise distribution is mapped into a latent space in which the AWGN assumption tends to hold , and thus better results are obtained by applying existing Gaussian denoiser for latent images . • Instead of a heuristic loss design , the proposed NN approximates the likelihood in the classic Bayesian framework , which gives clear interpretations of each loss term . Meanwhile , compared to many existing deep learning methods , our model is only trained on a single image , which significantly reduces the burden of data collection . • Extensive numerical experiments on real-world noisy image datasets have shown that the NN boosts the performance of the existing denoisers including NLM , BM3D and DnCNN . In particular , the results of NN+BM3D are competitive with some supervised deep learning approaches such as DnCNN+ , FFDNet+ , CBDNet . 2 RELATED WORK . There are numerous works in image denoising . Here , we review the works related to the nonlearning and learning approaches for real-world image denoising . 2.1 NON-LEARNING BASED APPROACHES . Non-learning approaches are mainly based on the MAP framework that contains a data fidelity and a regularization term . Many works have been proposed to improve the regularize term , e.g. , sparsity based methods ( Rudin et al. , 1992 ; Perona & Malik , 1990 ) , low rank prior ( Dong et al. , 2012b ; Gu et al. , 2014 ) and non-local methods ( Buades et al. , 2005 ; Dabov et al. , 2007a ) . Among these methods , BM3D ( Dabov et al. , 2007a ) is one of the top methods . There are several other works related to the construction of data fidelity by modeling the complex noise distribution , e.g. , Lebrun et al . ( 2015a ) ; Nam et al . ( 2016 ) ; Xu et al . ( 2017 ) ; Zhu et al . ( 2016 ) . The correlated Gaussian distribution ( Lebrun et al. , 2015a ) and Mixture of Gaussian ( Zhu et al. , 2016 ; Nam et al. , 2016 ) are used to approximate the unknown noise distribution . In Xu et al . ( 2017 ) , different noise statistics are estimated in different channels without the consideration of the content dependent noise . Recently , Amini et al . ( 2020 ) proposed a Gaussianization method for gray scale OCT images . However , this method is not applicable for real-world image denoising tasks as natural images are colorful and the noise distribution is much more complicated than that in OCT images . Overall , due to the complexity of real-world noise , the performance of these approaches is unsatisfactory and needs to be improved . 2.2 LEARNING BASED APPROACHES . The learning based approaches can be classified into two groups : single-image based methods and dataset based methods . Typical single-image based approaches are sparse coding methods Aharon et al . ( 2006 ) ; Bao et al . ( 2015 ) ; Xu et al . ( 2018b ) . In Xu et al . ( 2018b ) , the noise in each channel is estimated and followed by a weighted sparse coding scheme . In recent years , as the appearance of real image denoising datasets including CC ( Nam et al. , 2016 ) , PolyU ( Xu et al. , 2018a ) , DND ( Plotz & Roth , 2017 ) and SIDD ( Abdelhamed et al. , 2018 ) , deep neural networks including Guo et al . ( 2019 ) ; Yu et al . ( 2019 ) ; Zhang et al . ( 2017 ) ; Zhou et al . ( 2019 ) ; Yue et al . ( 2019 ) have shown promising results on these datasets . However , these networks require many noisy/clean training pairs which limit their practical applications especially when the labeling work needs domain experts . Recently , the deep learning approaches ( Krull et al. , 2019a ; b ; Batson & Royer , 2019 ; Laine et al. , 2019 ; Lehtinen et al. , 2018 ) are proposed and trained with organized or unorganized noisy image pairs . To guarantee a satisfactory performance , these methods still need many training pairs such that sufficiently many local patterns are covered . Compared to the above deep learning approaches , our method is a single image based method which does not need training samples or pre-training from other datasets .
This paper proposes a method to perform denoising using a single image. A UNet encoder is used to map the image to a space where a denoiser such as BM3D is applied. ADMM is used to update the weights by minimizing a cost function where one of the terms fits the noise image (using an additional UNet decoder trained jointly) and the other term is associated to the denoiser. The method yields promising results.
SP:68981cc1326c08d1ccad134c5b86a4631f31591e
An Unsupervised Deep Learning Approach for Real-World Image Denoising
1 INTRODUCTION . Noise always exists during the process of image acquisition and its removing is important for image recovery and vision tasks , e.g. , segmentation and recognition . Specifically , the noisy image y is modeled as y = x+ n , where x denotes the clean image , n denotes the corrupted noise and image denoising aims at recovering x from y . Over the past two decades , this problem has been extensively explored and many works have been proposed . Among these works , one typical kind of model assumes that the image is corrupted by additive white Gaussian noise ( AWGN ) , i.e. , n ∼ N ( 0 , σ2I ) where N ( 0 , 1 ) is the standard Gaussian distribution . Representative Gaussian denoising approaches include block matching and 3D filtering ( BM3D ) ( Dabov et al. , 2007b ) , non-local mean method ( NLM ) ( Buades et al. , 2005 ) , KSVD ( Aharon et al. , 2006 ) and weighted nuclear norm minimization ( WNNM ) ( Gu et al. , 2014 ) , which perform well on AWGN noise removal . However , the AWGN assumption seldom holds in practical applications as the noise is accumulated during the whole imaging process . For example , in typical CCD or CMOS cameras , the noise depends on the underlying context ( daytime or nighttime , static or dynamic , indoor or outdoor , etc . ) and the camera settings ( shutter speed , ISO , white balance , etc. ) . In Figure 1 , two real noisy images captured by Samsung Galaxy S6 Edge and Google Pixel smartphones are chosen from Smartphone Image Denoising Dataset ( SIDD ) ( Abdelhamed et al. , 2018 ) and three 40×40 patches are chosen for illustration of noisy distribution . It is clear that real noise distribution is content dependent and noise in each patch has different statistical properties which can be non-Gaussian . Due to the violation of the AWGN assumption , the performance of ∗Corresponding author . the Gaussian denoiser deteriorates significantly ( Figure 1 ( d ) ) . Thus , it is crucial to characterize the noise distribution and adapt the noise models to the denoiser in real-world image denoising . In recent years , deep learning based methods have achieved remarkable performance with careful architecture design , good training strategies , a large number of noisy and clean image pairs . However , there are two main drawbacks of these approaches from the perspective of practical applications . One is the high dependency on the quality and the size of the training dataset . Collecting such image pairs is time-consuming and requires much of human efforts , especially when the labeling needs deep domain knowledge such as medical or seismic images . The very recent deep learning methods including Noise2Noise ( N2N ) ( Lehtinen et al. , 2018 ) , Noise2Void ( N2V ) ( Krull et al. , 2019a ) and Noise2Self ( N2S ) ( Batson & Royer , 2019 ) have relaxed the dataset requirement and can be trained on organized/un-organized noisy and noisy image pairs . Nevertheless , to guarantee the performance , these networks need to be pre-trained with a large number of images to cover sufficiently many local patterns , and thus they are not cost-effective . Therefore , to reduce the dependency of the training set , single-image based image denoising approaches deserved to be studied and have both practical and scientific value . It is worth mentioning that a recent unsupervised learning work ( Ulyanov et al. , 2018 ) uses a deep image prior to the general image recovery problem but its denoising results are inferior to some typical Gaussian denoisers , e.g. , BM3D . The other drawback is the generalization ability of a trained network . When the noisy distribution is complicated and not contained in the training set , the results of the deep learning method can be deteriorated significantly , even worse than non-learning based methods . To alleviate this problem , some recent works are proposed by further consideration of noise estimation in the network design , e.g. , Guo et al . ( 2019 ) ; Yue et al . ( 2019 ) ; Zhang et al . ( 2017 ) . Despite their good performance in blind Gaussian denoising ( Guo et al. , 2019 ; Zhang et al. , 2017 ) and real-world denoising problem ( Yue et al. , 2019 ) , a large number of noisy and clean image pairs are needed and the generalization problem remains when the imaging system is complicated . Very recently , a single image based method has been proposed in ( Quan et al. , 2020 ) by developing a novel dropout technique for image denoising . Thus , unsupervised deep learning approaches with accurate noise models are important for solving real-world image denoising problems , yet current solutions are unsatisfactory . Such approach deserves to be studied and is a challenging problem as it needs a good combination of traditional methods and deep learning based methods such that the benefits of both methods are fully explored . 1.1 THE SUMMARY OF IDEAS AND CONTRIBUTIONS . Motivated by the above analysis , the goal of this paper is to propose an unsupervised deep learning method that boosts the performance of existing Gaussian denoisers when solving real-world image denoising problems . The basic idea is to find a latent image z associated with the input noisy image y such that z|x satisfies the AWGN assumption , and thus we can obtain the clean image x from z by any existing Gaussian denoiser . To find the appropriate latent representation , we propose a neural network ( NN ) based approach that builds up the mapping between the noisy image y and latent image z with an encoder-decoder structure . By applying the Gaussian denoiser in the latent space , we alternatively update the NN and the denoised image which does not need the other training samples . Figure 2 illustrates the workflow of the proposed approach . Also , this idea can be formulated under the classical maximum a posterior ( MAP ) framework which consists of a likelihood term and a prior term . Building a proper likelihood term requires an accurate estimation of the noise distribution . Although the accurate noise distribution is difficult to get , an evidence lower bound ( ELBO ) can be analytically derived for approximating the likelihood from below using variational auto-encoder ( VAE ) ( Kingma & Welling , 2013 ) . This ELBO term gives the loss function for the encoder and decoder networks that are maps between noisy image and latent image . From the above derivation , we arrive at a model min x , F , G f ( x , y , F , G ) +R ( x ) , ( 1 ) where x is the clean image , y is the input noisy image , F , G are decoder and encoder maps parameterized by NNs , f is the loss from ELBO and R ( x ) is the regularization term . Model ( 1 ) can be minimized by the alternative direction method of multiplier ( ADMM ) which alternatively updates networks and the clean image estimation x . Using Plug-and-Play technique ( Venkatakrishnan et al. , 2013 ) , updating x can be replaced by any Gaussian denoiser . Thus , by fully exploiting the benefits of deep neural networks and classic denoising schemes , the real-world image denoising can be improved by a large margin as shown in Figure 1 ( e ) . More importantly , training the proposed networks only uses the noisy image itself and does not need any pre-training . In summary , we list our main contributions as follows . • We propose an effective approach that combines the deep learning method with traditional methods for unsupervised image denoising . Thanks to the great expressive power of deep neural networks , the complex noise distribution is mapped into a latent space in which the AWGN assumption tends to hold , and thus better results are obtained by applying existing Gaussian denoiser for latent images . • Instead of a heuristic loss design , the proposed NN approximates the likelihood in the classic Bayesian framework , which gives clear interpretations of each loss term . Meanwhile , compared to many existing deep learning methods , our model is only trained on a single image , which significantly reduces the burden of data collection . • Extensive numerical experiments on real-world noisy image datasets have shown that the NN boosts the performance of the existing denoisers including NLM , BM3D and DnCNN . In particular , the results of NN+BM3D are competitive with some supervised deep learning approaches such as DnCNN+ , FFDNet+ , CBDNet . 2 RELATED WORK . There are numerous works in image denoising . Here , we review the works related to the nonlearning and learning approaches for real-world image denoising . 2.1 NON-LEARNING BASED APPROACHES . Non-learning approaches are mainly based on the MAP framework that contains a data fidelity and a regularization term . Many works have been proposed to improve the regularize term , e.g. , sparsity based methods ( Rudin et al. , 1992 ; Perona & Malik , 1990 ) , low rank prior ( Dong et al. , 2012b ; Gu et al. , 2014 ) and non-local methods ( Buades et al. , 2005 ; Dabov et al. , 2007a ) . Among these methods , BM3D ( Dabov et al. , 2007a ) is one of the top methods . There are several other works related to the construction of data fidelity by modeling the complex noise distribution , e.g. , Lebrun et al . ( 2015a ) ; Nam et al . ( 2016 ) ; Xu et al . ( 2017 ) ; Zhu et al . ( 2016 ) . The correlated Gaussian distribution ( Lebrun et al. , 2015a ) and Mixture of Gaussian ( Zhu et al. , 2016 ; Nam et al. , 2016 ) are used to approximate the unknown noise distribution . In Xu et al . ( 2017 ) , different noise statistics are estimated in different channels without the consideration of the content dependent noise . Recently , Amini et al . ( 2020 ) proposed a Gaussianization method for gray scale OCT images . However , this method is not applicable for real-world image denoising tasks as natural images are colorful and the noise distribution is much more complicated than that in OCT images . Overall , due to the complexity of real-world noise , the performance of these approaches is unsatisfactory and needs to be improved . 2.2 LEARNING BASED APPROACHES . The learning based approaches can be classified into two groups : single-image based methods and dataset based methods . Typical single-image based approaches are sparse coding methods Aharon et al . ( 2006 ) ; Bao et al . ( 2015 ) ; Xu et al . ( 2018b ) . In Xu et al . ( 2018b ) , the noise in each channel is estimated and followed by a weighted sparse coding scheme . In recent years , as the appearance of real image denoising datasets including CC ( Nam et al. , 2016 ) , PolyU ( Xu et al. , 2018a ) , DND ( Plotz & Roth , 2017 ) and SIDD ( Abdelhamed et al. , 2018 ) , deep neural networks including Guo et al . ( 2019 ) ; Yu et al . ( 2019 ) ; Zhang et al . ( 2017 ) ; Zhou et al . ( 2019 ) ; Yue et al . ( 2019 ) have shown promising results on these datasets . However , these networks require many noisy/clean training pairs which limit their practical applications especially when the labeling work needs domain experts . Recently , the deep learning approaches ( Krull et al. , 2019a ; b ; Batson & Royer , 2019 ; Laine et al. , 2019 ; Lehtinen et al. , 2018 ) are proposed and trained with organized or unorganized noisy image pairs . To guarantee a satisfactory performance , these methods still need many training pairs such that sufficiently many local patterns are covered . Compared to the above deep learning approaches , our method is a single image based method which does not need training samples or pre-training from other datasets .
The key idea of this paper is to transform a real-world noisy image into a latent image space using an encoder neural network(NN), where the noise is hopefully white Gaussian in the latent image space so that existing Gaussian denoisers can be used in the optimization steps. The proposed methods are reported to have improved performance compared to original Gaussian denoisers combined in their methods. One specific proposed combination, i.e., NN+BM3D shows better results than other unsurprised denoising approaches and is competitive with a supervised network. The idea of this paper is interesting and the presentation of the major idea is relatively clear.
SP:68981cc1326c08d1ccad134c5b86a4631f31591e
Meta-Learning with Neural Tangent Kernels
1 INTRODUCTION . Meta-learning ( Schmidhuber , 1987 ) has made tremendous progresses in the last few years . It aims to learn abstract knowledge from many related tasks so that fast adaption to new and unseen tasks becomes possible . For example , in few-shot learning , meta-learning corresponds to learning a meta-model or meta-parameters so that they can fast adapt to new tasks with a limited number of data samples . Among all existing meta-learning methods , Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) is perhaps one of the most popular and flexible ones , with a number of follow-up works such as ( Nichol et al. , 2018 ; Finn et al. , 2018 ; Yao et al. , 2019 ; Khodak et al. , 2019a ; b ; Denevi et al. , 2019 ; Fallah et al. , 2020 ; Lee et al. , 2020 ; Tripuraneni et al. , 2020 ) . MAML adopts a double-looped optimization framework , where adaptation is achieved by one or several gradientdescent steps in the inner-loop optimization . Such a framework could lead to some undesirable issues related to computational inefficiency and sub-optimal solutions . The main reasons are that 1 ) it is computationally expensive to back-propagate through a stochastic-gradient-descent chain , and 2 ) it is hard to tune the number of adaptation steps in the inner-loop as it can be different for both training and testing . Several previous works tried to address these issues , but they can only alleviate them to certain extents . For example , first order MAML ( FOMAML ) ( Finn et al. , 2017 ) ignores the high-order terms of the standard MAML , which can speed up the training but may lead to deteriorated performance ; MAML with Implicit Gradient ( iMAML ) ( Rajeswaran et al. , 2019 ) directly minimizes the objective of the outer-loop without performing the inner-loop optimization . But it still needs an iterative solver to estimate the meta-gradient . To better address these issues , we propose two algorithms that generalize meta-learning to the Reproducing Kernel Hilbert Space ( RKHS ) induced by the meta-model ’ s Neural Tangent Kernel ( NTK ) ( Jacot et al. , 2018 ) . In this RKHS , instead of using parameter adaptation , we propose to perform an implicit function adaptation . To this end , we introduce two algorithms to avoid explicit ∗The first two authors contribute equally . Correspondence to Changyou Chen ( changyou @ buffalo.edu ) . †The research of the first and fifth authors was supported in part by NSF through grants CCF-1716400 and IIS-1910492 . function adaptation : one replaces the function adaptation step in the inner-loop with a new metaobjective with a fast-adaptive regularizer inspired by MAML ; the other solves the adaptation problem analytically based on tools from NTK so that the meta-objective can be directly evaluated on samples in a closed-form . When restricting the function space to be RKHS , the solutions to the proposed two algorithms become conveniently solvable . In addition , we provide theoretical analysis on our proposed algorithms in the cases of using fully-connected neural networks and convolutional neural networks as the meta-model . Our analysis shows close connections between our methods and the existing ones . Particularly , we prove that one of our algorithms is closely related to MAML with some high-order terms ignored in the meta-objective function , thus endowing effective optimization . In summary , our main contributions are : • We re-analyze the meta-learning problem and introduce two new algorithms for metalearning in RKHS . Different from all existing meta-learning algorithms , our proposed methods can be solved efficiently without cumbersome chain-based adaptations . • We conduct theoretically analysis on the proposed algorithms , which suggests that our pro- posed algorithms are closely related to the existing MAML methods when fully-connected neural networks and convolutional neural networks are used as the meta-model . • We conduct extensive experiments to validate our algorithms . Experimental results indicate the effectiveness of our proposed methods , through standard few-shot learning , robustness to adversarial attacks and out-of-distribution adaptation . 2 PRELIMINARIES . 2.1 META-LEARNING . Meta-learning can be roughly categorized as black-box adaptation methods ( Andrychowicz et al. , 2016 ; Graves et al. , 2014 ; Mishra et al. , 2018 ) , optimization-based methods ( Finn et al. , 2017 ) , non-parametric methods ( Vinyals et al. , 2016 ; Snell et al. , 2017 ; Triantafillou et al. , 2020 ) and Bayesian meta-learning methods ( Finn et al. , 2018 ; Yoon et al. , 2018 ; Ravi & Beatson , 2019 ) . In this paper , we focus on the framework of Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) , which has two key components , meta initialization and fast adaptation . Specifically , MAML solves the meta-learning problem through a double-looped optimization procedure . In the inner-loop , MAML runs a task-specific adaptation procedure to transform a meta-parameter , θ , to a task-specific parameter , { φm } Bm=1 , for a total of B different tasks . In the outer-loop , MAML minimizes a total loss of ∑B m=1 L ( fφm ) with respect to meta-parameter θ , where fφm is the model adapted on task m that is typically represented by a deep neural network . It is worth noting that in MAML , one potential problem is to compute the meta-gradient∇θ ∑B m=1 L ( fφm ) . It requires one to differentiate through the whole inner-loop optimization path , which could be very inefficient . 2.2 GRADIENT FLOW . Our proposed method relies on the concept of gradient flow . Generally speaking , gradient flow is a continuous-time version of gradient descent . In the finite-dimensional parameter space , a gradient flow is defined by an ordinary differential equation ( ODE ) , dθt/dt = −∇θtF ( θt ) , with a starting point θ0 and function F : Rd → R. Gradient flow is also known as steepest descent curve . One can generalize gradient flows to infinite-dimensional function spaces . Specifically , given a function spaceH , a functional F : H → R , and a starting point f0 ∈ H , a gradient flow is similarly defined as the solution of df t/dt = −∇ftF ( f t ) . This is a curve in the function space H. In this paper , we use notation∇ftF ( f t ) , instead of∇HF ( f t ) , to denote the general function derivative of the energy functional F with respect to function f t ( Villani , 2008 ) . 2.3 THE NEURAL TANGENT KERNEL . Neural Tangent Kernel ( NTK ) is a recently proposed technique for characterizing the dynamics of a neural network under gradient descent ( Jacot et al. , 2018 ; Arora et al. , 2019 ; Lee et al. , 2019 ) . NTK allows one to analyze deep neural networks ( DNNs ) in RKHS induced by NTK . One immediate benefit of this is that the loss functional in the function space is often convex , even when it is highly non-convex in the parameter space ( Jacot et al. , 2018 ) ∗ . This property allows one to better understand the property of DNNs . Specifically , let fθ be a DNN parameterized by θ . The corresponding NTK Θ ∗LetH be the function space , F be the realization function for neural network defined in Section 3.2 . Note even if a functional loss ( e.g. , L2 loss ) E : H → R is convex onH , the composition E ◦ F is in general not . is defined as : Θ ( x1 , x2 ) = ∂fθ ( x1 ) ∂θ ∂fθ ( x2 ) ∂θ ᵀ , where x1 , x2 are two data points . In our paper , we will define meta-learning on an RKHS induced by such a kernel . 3 META-LEARNING IN RKHS . We first define the meta-learning problem in a general function space , and then restrict the function space to be an RKHS , where two frameworks will be proposed to make meta-learning feasible in RKHS , along with some theoretical analysis . For simplicity , in the following we will hide the superscript time t unless necessary , e.g. , when the analysis involves time-changing . 3.1 META-LEARNING IN FUNCTION SPACE . Given a function space H , a distribution of tasks P ( T ) , and a loss function L , the goal of metalearning is to find a meta function f∗ ∈ H , so that it performs well after simple adaptation on a specific task . Let Dtrm and Dtestm be the training and testing sets , respectively , sampled from a data distribution of task Tm . The meta-learning problem on function spaceH is defined as : f∗ = arg min f∈H E ( f ) , with E ( f ) = ETm [ L ( Adapt ( f , Dtrm ) , Dtestm ) ] ( 1 ) where Adapt denotes some adaptation algorithms , e.g. , several steps of gradient descent ; E : H → R is called energy functional , which is used to evaluate the model represented by the function f . In theory , solving equation 1 is equivalent to solving the gradient flow equation df t/dt = −∇ftE ( f t ) . However , solving the gradient flow equation is generally infeasible , since i ) it is hard to directly apply optimization methods in function space and ii ) the energy functional E contains an adaptation algorithm Adapt , making the functional gradient infeasible . Thus , a better way is to design a special energy functional so that it can be directly optimized without running the specific adaptation algorithm . In the following , we first specify the functional meta-learning problem in RKHS , and then propose two methods to derive efficient solutions for the problem . 3.2 META-LEARNING IN RKHS . We consider a function f that is parameterized by θ ∈ RP , denoted as fθ , with P being the number of parameters . Define a realization function F : RP → H that maps parameters to a function . With these , we can then define an energy function in the parameter space as E , E ◦ F : RP → R with ◦ being the composition operator . Consequently , with an initialized θ0 , we can define the gradient flow of E ( θt ) in parameter space as : dθt/dt = −∇θtE ( θt ) . In the following , we first establish an equivalence between the gradient flow in RKHS and the gradient flow in the parameter space . We then propose two algorithms for meta-learning in the RKHS induced by NTK . Theorem 1 Let H be an RKHS induced by the NTK Θ of fθ . With f0 = fθ0 , the gradient flow of E ( f t ) coincides with the function evolution of fθt driven by the gradient flow of E ( θt ) . The proof of Theorem 1 relies on the property of NTK ( Jacot et al. , 2018 ) , and is provided in the Appendix . Theorem 1 serves as a foundation of our proposed methods , which indicates that solving the meta-learning problem in RKHS can be done by some appropriate manipulations . In the following , we describe two different approaches termed Meta-RKHS-I and Meta-RKHS-II , respectively . 3.3 META-RKHS-I : META-LEARNING IN RKHS WITHOUT ADAPTATION . Our goal is to design an energy functional that has no adaptation component , but is capable of achieving fast adaptation . For this purpose , we first introduce two definitions : empirical loss function L ( fθ , Dm ) and expected loss function L ( fθ ) . Let Dm = { xm , i , ym , i } ni=1 be a set containing the data of a regression task Tm . The empirical loss function L ( fθ , Dm ) and the expected loss function Lm ( fθ ) can be defined as : L ( fθ , Dm ) = 1 2n n∑ i=1 ∥∥f ( xm , i ) − ym , i ∥∥2 , Lm ( fθ ) = Exm , ym [ 12∥∥f ( xm ) − ym ∥∥2 ] . Our idea is to define a regularized functional such that it endows the ability of fast adaptation in RKHS . Our solution is based on some property of the standard MAML . We start from analyzing the meta-objective of MAML with a k-step gradient-descent adaptation , i.e. , applying k gradient-descent steps in the inner-loop . The objective can be formulated as θ∗ = arg min θ ETm [ L ( fφ , Dtestm ) ] , with φ = θ − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) , where α is the learning rate of the inner-loop , θ0 = θ , and θi+1 = θi − α∇θiL ( fθi , Dtrm ) † . By Taylor expansion , we have ETm [ L ( fφ , Dtestm ) ] ≈ ETm [ L ( fθ , Dtestm ) − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) ∇θL ( fθ , Dtestm ) ᵀ ] . ( 2 ) Since Dtrm and Dtestm come from the same distribution , equation 2 is an unbiased estimator of Mk = ETm [ Lm ( fθ ) − k−1∑ i=0 βi ] , where βi = α∇θiLm ( fθi ) ∇θLm ( fθ ) ᵀ . ( 3 ) We focus on the case of k = 1 , which is M1 = ETm [ Lm ( fθ ) ] − αETm [ ‖∇θLm ( fθ ) ‖2 ] . The first term on the RHS is the traditional multi-task loss evaluated at θ for all tasks . The second term corresponds to the negative gradient norm ; minimizing it means choosing a θ with the maximum gradient norm . Intuitively , when θ is not a stationary point of a task , one should choose the steepest descent direction to reduce the loss maximally for a specific task , thus leading to fast adaptation . The above understanding suggests us to propose the following regularized energy functional , Ẽα , for meta-learning in the RKHS induced with the NTK for fast function adaptation : Ẽ ( α , fθ ) = ETm [ Lm ( fθ ) − α‖∇fθLm ( fθ ) ‖2H ] , ( 4 ) where ‖ · ‖H denotes the functional norm inH , and α is a hyper-parameter . The above objective is inspired by the Taylor expansion of the MAML objective , but is defined in the RKHS induced by the NTK . Its connection with MAML and some functional-space properties will be discussed later . Solving the Function Optimization Problem To minimize equation 4 , we first derive Theorem 2 to reduce the function optimization problem to a parameter optimization problem . Theorem 2 Let fθ be a neural network with parameter θ andH be the RKHS induced by the NTK Θ of fθ . Then , the following are equivalent Ẽ ( α , fθ ) =M1 , and ‖∇fθLm ( fθ ) ‖2H = ‖∇θLm ( fθ ) ‖2 . Theorem 2 is crucial to our approach as it indicates that solving problem equation 4 is no more difficult than the original parameter-based MAML , although it only considers one-step adaptation case . Next , we will show that multi-step adaptation in the parameter space can also be well-approximated by our objective equation 4 but with a scaled regularized parameter α . In the following , we consider the squared loss L. The case with the cross-entropy loss is discussed in the Appendix . We assume that fθ is parameterized by either fully-connected or convolutional neural networks , and only consider the impact of number of hidden layers L in our theoretical results . Theorem 3 Let fθ be a fully-connected neural network with L hidden layers and ReLU activation function , s1 , ... , sL+1 be the spectral norm of the weight matrices , s = maxh sh , andα be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , then the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . Theorem 4 Let fθ be a convolutional neural network with L − l convolutional layers and l fullyconnected layers and with ReLU activation function , and dx be the input dimension . Denote by Wh the parameter vector of the convolutional layer for h ≤ L− l , and the weight matrices of the fully connected layers for L− l + 1 ≤ h ≤ L+ 1 . ‖ · ‖2 means both the spectral norm of a matrix †For ease of our later notation , we write the gradient∇θiL ( thus the parameter as well ) as a row vector . and the Euclidean norm of a vector . Define sh = √ dx‖Wh‖2 if h = 1 , ... , L − l , and ‖Wh‖2 if L − l + 1 ≤ h ≤ L + 1 . Let s = maxh sh and α be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . The above Theorems indicate that , for a meta-model with fully-connected and convolutional layers , the proposed Meta-RKHS-I can be an efficient approximation of MAML with a bounded error . Comparisons with Reptile and MAML Similar to Reptile and MAML , the testing stage of MetaRKHS-I also requires gradient-based adaptation on meta-test tasks . By Theorem 1 , we known that gradient flow of an energy functional can be approximated by gradient descent in a parameter space . Reptile with 1-step adaptation ( Nichol et al. , 2018 ) is equivalent to the approximation of the gradient flow of Ẽ ( α , fθ ) with α = 0 , which does not include the fast-adaptation regularization as in our method . For a fairer comparison on the efficiency , we will discuss the computational complexity later . From the equivalent parameter-optimization form indicated in Theorem 2 , we know that our energy functional Ẽ ( α , fθ ) is closely related to MAML . However , with this form , our method does not need the explicit adaptation steps in training ( i.e. , the inner-loop of MAML ) , leading to a simpler optimization problem . We will show that our proposed method leads to better results .
In this paper, the authors view MAML from the lens of Reproducing Hilbert Kernel Hilbert Spaces (RKHS) by applying tools from the theory of Neural Tangent Kernels (NTKs). Based on these insights, they develop two meta-learning algorithms that avoid gradient-based inner-loop adaptation. Their algorithms are theoretically grounded and exhibit improved empirical performance.
SP:32ef828a66d08474bd68e7fb4f664b38d9f65715
Meta-Learning with Neural Tangent Kernels
1 INTRODUCTION . Meta-learning ( Schmidhuber , 1987 ) has made tremendous progresses in the last few years . It aims to learn abstract knowledge from many related tasks so that fast adaption to new and unseen tasks becomes possible . For example , in few-shot learning , meta-learning corresponds to learning a meta-model or meta-parameters so that they can fast adapt to new tasks with a limited number of data samples . Among all existing meta-learning methods , Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) is perhaps one of the most popular and flexible ones , with a number of follow-up works such as ( Nichol et al. , 2018 ; Finn et al. , 2018 ; Yao et al. , 2019 ; Khodak et al. , 2019a ; b ; Denevi et al. , 2019 ; Fallah et al. , 2020 ; Lee et al. , 2020 ; Tripuraneni et al. , 2020 ) . MAML adopts a double-looped optimization framework , where adaptation is achieved by one or several gradientdescent steps in the inner-loop optimization . Such a framework could lead to some undesirable issues related to computational inefficiency and sub-optimal solutions . The main reasons are that 1 ) it is computationally expensive to back-propagate through a stochastic-gradient-descent chain , and 2 ) it is hard to tune the number of adaptation steps in the inner-loop as it can be different for both training and testing . Several previous works tried to address these issues , but they can only alleviate them to certain extents . For example , first order MAML ( FOMAML ) ( Finn et al. , 2017 ) ignores the high-order terms of the standard MAML , which can speed up the training but may lead to deteriorated performance ; MAML with Implicit Gradient ( iMAML ) ( Rajeswaran et al. , 2019 ) directly minimizes the objective of the outer-loop without performing the inner-loop optimization . But it still needs an iterative solver to estimate the meta-gradient . To better address these issues , we propose two algorithms that generalize meta-learning to the Reproducing Kernel Hilbert Space ( RKHS ) induced by the meta-model ’ s Neural Tangent Kernel ( NTK ) ( Jacot et al. , 2018 ) . In this RKHS , instead of using parameter adaptation , we propose to perform an implicit function adaptation . To this end , we introduce two algorithms to avoid explicit ∗The first two authors contribute equally . Correspondence to Changyou Chen ( changyou @ buffalo.edu ) . †The research of the first and fifth authors was supported in part by NSF through grants CCF-1716400 and IIS-1910492 . function adaptation : one replaces the function adaptation step in the inner-loop with a new metaobjective with a fast-adaptive regularizer inspired by MAML ; the other solves the adaptation problem analytically based on tools from NTK so that the meta-objective can be directly evaluated on samples in a closed-form . When restricting the function space to be RKHS , the solutions to the proposed two algorithms become conveniently solvable . In addition , we provide theoretical analysis on our proposed algorithms in the cases of using fully-connected neural networks and convolutional neural networks as the meta-model . Our analysis shows close connections between our methods and the existing ones . Particularly , we prove that one of our algorithms is closely related to MAML with some high-order terms ignored in the meta-objective function , thus endowing effective optimization . In summary , our main contributions are : • We re-analyze the meta-learning problem and introduce two new algorithms for metalearning in RKHS . Different from all existing meta-learning algorithms , our proposed methods can be solved efficiently without cumbersome chain-based adaptations . • We conduct theoretically analysis on the proposed algorithms , which suggests that our pro- posed algorithms are closely related to the existing MAML methods when fully-connected neural networks and convolutional neural networks are used as the meta-model . • We conduct extensive experiments to validate our algorithms . Experimental results indicate the effectiveness of our proposed methods , through standard few-shot learning , robustness to adversarial attacks and out-of-distribution adaptation . 2 PRELIMINARIES . 2.1 META-LEARNING . Meta-learning can be roughly categorized as black-box adaptation methods ( Andrychowicz et al. , 2016 ; Graves et al. , 2014 ; Mishra et al. , 2018 ) , optimization-based methods ( Finn et al. , 2017 ) , non-parametric methods ( Vinyals et al. , 2016 ; Snell et al. , 2017 ; Triantafillou et al. , 2020 ) and Bayesian meta-learning methods ( Finn et al. , 2018 ; Yoon et al. , 2018 ; Ravi & Beatson , 2019 ) . In this paper , we focus on the framework of Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) , which has two key components , meta initialization and fast adaptation . Specifically , MAML solves the meta-learning problem through a double-looped optimization procedure . In the inner-loop , MAML runs a task-specific adaptation procedure to transform a meta-parameter , θ , to a task-specific parameter , { φm } Bm=1 , for a total of B different tasks . In the outer-loop , MAML minimizes a total loss of ∑B m=1 L ( fφm ) with respect to meta-parameter θ , where fφm is the model adapted on task m that is typically represented by a deep neural network . It is worth noting that in MAML , one potential problem is to compute the meta-gradient∇θ ∑B m=1 L ( fφm ) . It requires one to differentiate through the whole inner-loop optimization path , which could be very inefficient . 2.2 GRADIENT FLOW . Our proposed method relies on the concept of gradient flow . Generally speaking , gradient flow is a continuous-time version of gradient descent . In the finite-dimensional parameter space , a gradient flow is defined by an ordinary differential equation ( ODE ) , dθt/dt = −∇θtF ( θt ) , with a starting point θ0 and function F : Rd → R. Gradient flow is also known as steepest descent curve . One can generalize gradient flows to infinite-dimensional function spaces . Specifically , given a function spaceH , a functional F : H → R , and a starting point f0 ∈ H , a gradient flow is similarly defined as the solution of df t/dt = −∇ftF ( f t ) . This is a curve in the function space H. In this paper , we use notation∇ftF ( f t ) , instead of∇HF ( f t ) , to denote the general function derivative of the energy functional F with respect to function f t ( Villani , 2008 ) . 2.3 THE NEURAL TANGENT KERNEL . Neural Tangent Kernel ( NTK ) is a recently proposed technique for characterizing the dynamics of a neural network under gradient descent ( Jacot et al. , 2018 ; Arora et al. , 2019 ; Lee et al. , 2019 ) . NTK allows one to analyze deep neural networks ( DNNs ) in RKHS induced by NTK . One immediate benefit of this is that the loss functional in the function space is often convex , even when it is highly non-convex in the parameter space ( Jacot et al. , 2018 ) ∗ . This property allows one to better understand the property of DNNs . Specifically , let fθ be a DNN parameterized by θ . The corresponding NTK Θ ∗LetH be the function space , F be the realization function for neural network defined in Section 3.2 . Note even if a functional loss ( e.g. , L2 loss ) E : H → R is convex onH , the composition E ◦ F is in general not . is defined as : Θ ( x1 , x2 ) = ∂fθ ( x1 ) ∂θ ∂fθ ( x2 ) ∂θ ᵀ , where x1 , x2 are two data points . In our paper , we will define meta-learning on an RKHS induced by such a kernel . 3 META-LEARNING IN RKHS . We first define the meta-learning problem in a general function space , and then restrict the function space to be an RKHS , where two frameworks will be proposed to make meta-learning feasible in RKHS , along with some theoretical analysis . For simplicity , in the following we will hide the superscript time t unless necessary , e.g. , when the analysis involves time-changing . 3.1 META-LEARNING IN FUNCTION SPACE . Given a function space H , a distribution of tasks P ( T ) , and a loss function L , the goal of metalearning is to find a meta function f∗ ∈ H , so that it performs well after simple adaptation on a specific task . Let Dtrm and Dtestm be the training and testing sets , respectively , sampled from a data distribution of task Tm . The meta-learning problem on function spaceH is defined as : f∗ = arg min f∈H E ( f ) , with E ( f ) = ETm [ L ( Adapt ( f , Dtrm ) , Dtestm ) ] ( 1 ) where Adapt denotes some adaptation algorithms , e.g. , several steps of gradient descent ; E : H → R is called energy functional , which is used to evaluate the model represented by the function f . In theory , solving equation 1 is equivalent to solving the gradient flow equation df t/dt = −∇ftE ( f t ) . However , solving the gradient flow equation is generally infeasible , since i ) it is hard to directly apply optimization methods in function space and ii ) the energy functional E contains an adaptation algorithm Adapt , making the functional gradient infeasible . Thus , a better way is to design a special energy functional so that it can be directly optimized without running the specific adaptation algorithm . In the following , we first specify the functional meta-learning problem in RKHS , and then propose two methods to derive efficient solutions for the problem . 3.2 META-LEARNING IN RKHS . We consider a function f that is parameterized by θ ∈ RP , denoted as fθ , with P being the number of parameters . Define a realization function F : RP → H that maps parameters to a function . With these , we can then define an energy function in the parameter space as E , E ◦ F : RP → R with ◦ being the composition operator . Consequently , with an initialized θ0 , we can define the gradient flow of E ( θt ) in parameter space as : dθt/dt = −∇θtE ( θt ) . In the following , we first establish an equivalence between the gradient flow in RKHS and the gradient flow in the parameter space . We then propose two algorithms for meta-learning in the RKHS induced by NTK . Theorem 1 Let H be an RKHS induced by the NTK Θ of fθ . With f0 = fθ0 , the gradient flow of E ( f t ) coincides with the function evolution of fθt driven by the gradient flow of E ( θt ) . The proof of Theorem 1 relies on the property of NTK ( Jacot et al. , 2018 ) , and is provided in the Appendix . Theorem 1 serves as a foundation of our proposed methods , which indicates that solving the meta-learning problem in RKHS can be done by some appropriate manipulations . In the following , we describe two different approaches termed Meta-RKHS-I and Meta-RKHS-II , respectively . 3.3 META-RKHS-I : META-LEARNING IN RKHS WITHOUT ADAPTATION . Our goal is to design an energy functional that has no adaptation component , but is capable of achieving fast adaptation . For this purpose , we first introduce two definitions : empirical loss function L ( fθ , Dm ) and expected loss function L ( fθ ) . Let Dm = { xm , i , ym , i } ni=1 be a set containing the data of a regression task Tm . The empirical loss function L ( fθ , Dm ) and the expected loss function Lm ( fθ ) can be defined as : L ( fθ , Dm ) = 1 2n n∑ i=1 ∥∥f ( xm , i ) − ym , i ∥∥2 , Lm ( fθ ) = Exm , ym [ 12∥∥f ( xm ) − ym ∥∥2 ] . Our idea is to define a regularized functional such that it endows the ability of fast adaptation in RKHS . Our solution is based on some property of the standard MAML . We start from analyzing the meta-objective of MAML with a k-step gradient-descent adaptation , i.e. , applying k gradient-descent steps in the inner-loop . The objective can be formulated as θ∗ = arg min θ ETm [ L ( fφ , Dtestm ) ] , with φ = θ − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) , where α is the learning rate of the inner-loop , θ0 = θ , and θi+1 = θi − α∇θiL ( fθi , Dtrm ) † . By Taylor expansion , we have ETm [ L ( fφ , Dtestm ) ] ≈ ETm [ L ( fθ , Dtestm ) − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) ∇θL ( fθ , Dtestm ) ᵀ ] . ( 2 ) Since Dtrm and Dtestm come from the same distribution , equation 2 is an unbiased estimator of Mk = ETm [ Lm ( fθ ) − k−1∑ i=0 βi ] , where βi = α∇θiLm ( fθi ) ∇θLm ( fθ ) ᵀ . ( 3 ) We focus on the case of k = 1 , which is M1 = ETm [ Lm ( fθ ) ] − αETm [ ‖∇θLm ( fθ ) ‖2 ] . The first term on the RHS is the traditional multi-task loss evaluated at θ for all tasks . The second term corresponds to the negative gradient norm ; minimizing it means choosing a θ with the maximum gradient norm . Intuitively , when θ is not a stationary point of a task , one should choose the steepest descent direction to reduce the loss maximally for a specific task , thus leading to fast adaptation . The above understanding suggests us to propose the following regularized energy functional , Ẽα , for meta-learning in the RKHS induced with the NTK for fast function adaptation : Ẽ ( α , fθ ) = ETm [ Lm ( fθ ) − α‖∇fθLm ( fθ ) ‖2H ] , ( 4 ) where ‖ · ‖H denotes the functional norm inH , and α is a hyper-parameter . The above objective is inspired by the Taylor expansion of the MAML objective , but is defined in the RKHS induced by the NTK . Its connection with MAML and some functional-space properties will be discussed later . Solving the Function Optimization Problem To minimize equation 4 , we first derive Theorem 2 to reduce the function optimization problem to a parameter optimization problem . Theorem 2 Let fθ be a neural network with parameter θ andH be the RKHS induced by the NTK Θ of fθ . Then , the following are equivalent Ẽ ( α , fθ ) =M1 , and ‖∇fθLm ( fθ ) ‖2H = ‖∇θLm ( fθ ) ‖2 . Theorem 2 is crucial to our approach as it indicates that solving problem equation 4 is no more difficult than the original parameter-based MAML , although it only considers one-step adaptation case . Next , we will show that multi-step adaptation in the parameter space can also be well-approximated by our objective equation 4 but with a scaled regularized parameter α . In the following , we consider the squared loss L. The case with the cross-entropy loss is discussed in the Appendix . We assume that fθ is parameterized by either fully-connected or convolutional neural networks , and only consider the impact of number of hidden layers L in our theoretical results . Theorem 3 Let fθ be a fully-connected neural network with L hidden layers and ReLU activation function , s1 , ... , sL+1 be the spectral norm of the weight matrices , s = maxh sh , andα be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , then the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . Theorem 4 Let fθ be a convolutional neural network with L − l convolutional layers and l fullyconnected layers and with ReLU activation function , and dx be the input dimension . Denote by Wh the parameter vector of the convolutional layer for h ≤ L− l , and the weight matrices of the fully connected layers for L− l + 1 ≤ h ≤ L+ 1 . ‖ · ‖2 means both the spectral norm of a matrix †For ease of our later notation , we write the gradient∇θiL ( thus the parameter as well ) as a row vector . and the Euclidean norm of a vector . Define sh = √ dx‖Wh‖2 if h = 1 , ... , L − l , and ‖Wh‖2 if L − l + 1 ≤ h ≤ L + 1 . Let s = maxh sh and α be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . The above Theorems indicate that , for a meta-model with fully-connected and convolutional layers , the proposed Meta-RKHS-I can be an efficient approximation of MAML with a bounded error . Comparisons with Reptile and MAML Similar to Reptile and MAML , the testing stage of MetaRKHS-I also requires gradient-based adaptation on meta-test tasks . By Theorem 1 , we known that gradient flow of an energy functional can be approximated by gradient descent in a parameter space . Reptile with 1-step adaptation ( Nichol et al. , 2018 ) is equivalent to the approximation of the gradient flow of Ẽ ( α , fθ ) with α = 0 , which does not include the fast-adaptation regularization as in our method . For a fairer comparison on the efficiency , we will discuss the computational complexity later . From the equivalent parameter-optimization form indicated in Theorem 2 , we know that our energy functional Ẽ ( α , fθ ) is closely related to MAML . However , with this form , our method does not need the explicit adaptation steps in training ( i.e. , the inner-loop of MAML ) , leading to a simpler optimization problem . We will show that our proposed method leads to better results .
The authors propose two meta-learning algorithms in the reproducing kernel Hilbert space (RKHS) induced by the recently proposed Neural Tangent Kernels (NTK). The authors show how their algorithms obviate an explicit inner loop or task-adaptation step in the meta-learning training phase. In first algorithm, no explicit adaptation function is used, whereas in the second, a close form adaptation function which invokes the NTK is proposed - which is a simpler adaptation than that of MAML and hence, offers computational efficiency. The work is interesting and supported by theory inspired from the NTK theory, and adds to the newly expanding literature in the use of kernels in meta-learning (unlike the authors’ claim in the introduction, theirs is not the first meta-learning paradigm in the RKHS cf (Wang et al 2020, Cerviño et al 2019)). The authors perform extensive experiments on regression and classification datasets and compare their results with other MAML-type algorithms. The experimental results do not show significant gains in terms of performance over the existing MAML approaches, except in the case of out-of-distribution datasets and adversarial attacks, where it is shown to outperform the others. The performance similarity to other methods is not surprising since the proposed approaches can be seen as an efficient approximations of the MAML.
SP:32ef828a66d08474bd68e7fb4f664b38d9f65715
Meta-Learning with Neural Tangent Kernels
1 INTRODUCTION . Meta-learning ( Schmidhuber , 1987 ) has made tremendous progresses in the last few years . It aims to learn abstract knowledge from many related tasks so that fast adaption to new and unseen tasks becomes possible . For example , in few-shot learning , meta-learning corresponds to learning a meta-model or meta-parameters so that they can fast adapt to new tasks with a limited number of data samples . Among all existing meta-learning methods , Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) is perhaps one of the most popular and flexible ones , with a number of follow-up works such as ( Nichol et al. , 2018 ; Finn et al. , 2018 ; Yao et al. , 2019 ; Khodak et al. , 2019a ; b ; Denevi et al. , 2019 ; Fallah et al. , 2020 ; Lee et al. , 2020 ; Tripuraneni et al. , 2020 ) . MAML adopts a double-looped optimization framework , where adaptation is achieved by one or several gradientdescent steps in the inner-loop optimization . Such a framework could lead to some undesirable issues related to computational inefficiency and sub-optimal solutions . The main reasons are that 1 ) it is computationally expensive to back-propagate through a stochastic-gradient-descent chain , and 2 ) it is hard to tune the number of adaptation steps in the inner-loop as it can be different for both training and testing . Several previous works tried to address these issues , but they can only alleviate them to certain extents . For example , first order MAML ( FOMAML ) ( Finn et al. , 2017 ) ignores the high-order terms of the standard MAML , which can speed up the training but may lead to deteriorated performance ; MAML with Implicit Gradient ( iMAML ) ( Rajeswaran et al. , 2019 ) directly minimizes the objective of the outer-loop without performing the inner-loop optimization . But it still needs an iterative solver to estimate the meta-gradient . To better address these issues , we propose two algorithms that generalize meta-learning to the Reproducing Kernel Hilbert Space ( RKHS ) induced by the meta-model ’ s Neural Tangent Kernel ( NTK ) ( Jacot et al. , 2018 ) . In this RKHS , instead of using parameter adaptation , we propose to perform an implicit function adaptation . To this end , we introduce two algorithms to avoid explicit ∗The first two authors contribute equally . Correspondence to Changyou Chen ( changyou @ buffalo.edu ) . †The research of the first and fifth authors was supported in part by NSF through grants CCF-1716400 and IIS-1910492 . function adaptation : one replaces the function adaptation step in the inner-loop with a new metaobjective with a fast-adaptive regularizer inspired by MAML ; the other solves the adaptation problem analytically based on tools from NTK so that the meta-objective can be directly evaluated on samples in a closed-form . When restricting the function space to be RKHS , the solutions to the proposed two algorithms become conveniently solvable . In addition , we provide theoretical analysis on our proposed algorithms in the cases of using fully-connected neural networks and convolutional neural networks as the meta-model . Our analysis shows close connections between our methods and the existing ones . Particularly , we prove that one of our algorithms is closely related to MAML with some high-order terms ignored in the meta-objective function , thus endowing effective optimization . In summary , our main contributions are : • We re-analyze the meta-learning problem and introduce two new algorithms for metalearning in RKHS . Different from all existing meta-learning algorithms , our proposed methods can be solved efficiently without cumbersome chain-based adaptations . • We conduct theoretically analysis on the proposed algorithms , which suggests that our pro- posed algorithms are closely related to the existing MAML methods when fully-connected neural networks and convolutional neural networks are used as the meta-model . • We conduct extensive experiments to validate our algorithms . Experimental results indicate the effectiveness of our proposed methods , through standard few-shot learning , robustness to adversarial attacks and out-of-distribution adaptation . 2 PRELIMINARIES . 2.1 META-LEARNING . Meta-learning can be roughly categorized as black-box adaptation methods ( Andrychowicz et al. , 2016 ; Graves et al. , 2014 ; Mishra et al. , 2018 ) , optimization-based methods ( Finn et al. , 2017 ) , non-parametric methods ( Vinyals et al. , 2016 ; Snell et al. , 2017 ; Triantafillou et al. , 2020 ) and Bayesian meta-learning methods ( Finn et al. , 2018 ; Yoon et al. , 2018 ; Ravi & Beatson , 2019 ) . In this paper , we focus on the framework of Model Agnostic Meta-Learning ( MAML ) ( Finn et al. , 2017 ) , which has two key components , meta initialization and fast adaptation . Specifically , MAML solves the meta-learning problem through a double-looped optimization procedure . In the inner-loop , MAML runs a task-specific adaptation procedure to transform a meta-parameter , θ , to a task-specific parameter , { φm } Bm=1 , for a total of B different tasks . In the outer-loop , MAML minimizes a total loss of ∑B m=1 L ( fφm ) with respect to meta-parameter θ , where fφm is the model adapted on task m that is typically represented by a deep neural network . It is worth noting that in MAML , one potential problem is to compute the meta-gradient∇θ ∑B m=1 L ( fφm ) . It requires one to differentiate through the whole inner-loop optimization path , which could be very inefficient . 2.2 GRADIENT FLOW . Our proposed method relies on the concept of gradient flow . Generally speaking , gradient flow is a continuous-time version of gradient descent . In the finite-dimensional parameter space , a gradient flow is defined by an ordinary differential equation ( ODE ) , dθt/dt = −∇θtF ( θt ) , with a starting point θ0 and function F : Rd → R. Gradient flow is also known as steepest descent curve . One can generalize gradient flows to infinite-dimensional function spaces . Specifically , given a function spaceH , a functional F : H → R , and a starting point f0 ∈ H , a gradient flow is similarly defined as the solution of df t/dt = −∇ftF ( f t ) . This is a curve in the function space H. In this paper , we use notation∇ftF ( f t ) , instead of∇HF ( f t ) , to denote the general function derivative of the energy functional F with respect to function f t ( Villani , 2008 ) . 2.3 THE NEURAL TANGENT KERNEL . Neural Tangent Kernel ( NTK ) is a recently proposed technique for characterizing the dynamics of a neural network under gradient descent ( Jacot et al. , 2018 ; Arora et al. , 2019 ; Lee et al. , 2019 ) . NTK allows one to analyze deep neural networks ( DNNs ) in RKHS induced by NTK . One immediate benefit of this is that the loss functional in the function space is often convex , even when it is highly non-convex in the parameter space ( Jacot et al. , 2018 ) ∗ . This property allows one to better understand the property of DNNs . Specifically , let fθ be a DNN parameterized by θ . The corresponding NTK Θ ∗LetH be the function space , F be the realization function for neural network defined in Section 3.2 . Note even if a functional loss ( e.g. , L2 loss ) E : H → R is convex onH , the composition E ◦ F is in general not . is defined as : Θ ( x1 , x2 ) = ∂fθ ( x1 ) ∂θ ∂fθ ( x2 ) ∂θ ᵀ , where x1 , x2 are two data points . In our paper , we will define meta-learning on an RKHS induced by such a kernel . 3 META-LEARNING IN RKHS . We first define the meta-learning problem in a general function space , and then restrict the function space to be an RKHS , where two frameworks will be proposed to make meta-learning feasible in RKHS , along with some theoretical analysis . For simplicity , in the following we will hide the superscript time t unless necessary , e.g. , when the analysis involves time-changing . 3.1 META-LEARNING IN FUNCTION SPACE . Given a function space H , a distribution of tasks P ( T ) , and a loss function L , the goal of metalearning is to find a meta function f∗ ∈ H , so that it performs well after simple adaptation on a specific task . Let Dtrm and Dtestm be the training and testing sets , respectively , sampled from a data distribution of task Tm . The meta-learning problem on function spaceH is defined as : f∗ = arg min f∈H E ( f ) , with E ( f ) = ETm [ L ( Adapt ( f , Dtrm ) , Dtestm ) ] ( 1 ) where Adapt denotes some adaptation algorithms , e.g. , several steps of gradient descent ; E : H → R is called energy functional , which is used to evaluate the model represented by the function f . In theory , solving equation 1 is equivalent to solving the gradient flow equation df t/dt = −∇ftE ( f t ) . However , solving the gradient flow equation is generally infeasible , since i ) it is hard to directly apply optimization methods in function space and ii ) the energy functional E contains an adaptation algorithm Adapt , making the functional gradient infeasible . Thus , a better way is to design a special energy functional so that it can be directly optimized without running the specific adaptation algorithm . In the following , we first specify the functional meta-learning problem in RKHS , and then propose two methods to derive efficient solutions for the problem . 3.2 META-LEARNING IN RKHS . We consider a function f that is parameterized by θ ∈ RP , denoted as fθ , with P being the number of parameters . Define a realization function F : RP → H that maps parameters to a function . With these , we can then define an energy function in the parameter space as E , E ◦ F : RP → R with ◦ being the composition operator . Consequently , with an initialized θ0 , we can define the gradient flow of E ( θt ) in parameter space as : dθt/dt = −∇θtE ( θt ) . In the following , we first establish an equivalence between the gradient flow in RKHS and the gradient flow in the parameter space . We then propose two algorithms for meta-learning in the RKHS induced by NTK . Theorem 1 Let H be an RKHS induced by the NTK Θ of fθ . With f0 = fθ0 , the gradient flow of E ( f t ) coincides with the function evolution of fθt driven by the gradient flow of E ( θt ) . The proof of Theorem 1 relies on the property of NTK ( Jacot et al. , 2018 ) , and is provided in the Appendix . Theorem 1 serves as a foundation of our proposed methods , which indicates that solving the meta-learning problem in RKHS can be done by some appropriate manipulations . In the following , we describe two different approaches termed Meta-RKHS-I and Meta-RKHS-II , respectively . 3.3 META-RKHS-I : META-LEARNING IN RKHS WITHOUT ADAPTATION . Our goal is to design an energy functional that has no adaptation component , but is capable of achieving fast adaptation . For this purpose , we first introduce two definitions : empirical loss function L ( fθ , Dm ) and expected loss function L ( fθ ) . Let Dm = { xm , i , ym , i } ni=1 be a set containing the data of a regression task Tm . The empirical loss function L ( fθ , Dm ) and the expected loss function Lm ( fθ ) can be defined as : L ( fθ , Dm ) = 1 2n n∑ i=1 ∥∥f ( xm , i ) − ym , i ∥∥2 , Lm ( fθ ) = Exm , ym [ 12∥∥f ( xm ) − ym ∥∥2 ] . Our idea is to define a regularized functional such that it endows the ability of fast adaptation in RKHS . Our solution is based on some property of the standard MAML . We start from analyzing the meta-objective of MAML with a k-step gradient-descent adaptation , i.e. , applying k gradient-descent steps in the inner-loop . The objective can be formulated as θ∗ = arg min θ ETm [ L ( fφ , Dtestm ) ] , with φ = θ − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) , where α is the learning rate of the inner-loop , θ0 = θ , and θi+1 = θi − α∇θiL ( fθi , Dtrm ) † . By Taylor expansion , we have ETm [ L ( fφ , Dtestm ) ] ≈ ETm [ L ( fθ , Dtestm ) − α k−1∑ i=0 ∇θiL ( fθi , Dtrm ) ∇θL ( fθ , Dtestm ) ᵀ ] . ( 2 ) Since Dtrm and Dtestm come from the same distribution , equation 2 is an unbiased estimator of Mk = ETm [ Lm ( fθ ) − k−1∑ i=0 βi ] , where βi = α∇θiLm ( fθi ) ∇θLm ( fθ ) ᵀ . ( 3 ) We focus on the case of k = 1 , which is M1 = ETm [ Lm ( fθ ) ] − αETm [ ‖∇θLm ( fθ ) ‖2 ] . The first term on the RHS is the traditional multi-task loss evaluated at θ for all tasks . The second term corresponds to the negative gradient norm ; minimizing it means choosing a θ with the maximum gradient norm . Intuitively , when θ is not a stationary point of a task , one should choose the steepest descent direction to reduce the loss maximally for a specific task , thus leading to fast adaptation . The above understanding suggests us to propose the following regularized energy functional , Ẽα , for meta-learning in the RKHS induced with the NTK for fast function adaptation : Ẽ ( α , fθ ) = ETm [ Lm ( fθ ) − α‖∇fθLm ( fθ ) ‖2H ] , ( 4 ) where ‖ · ‖H denotes the functional norm inH , and α is a hyper-parameter . The above objective is inspired by the Taylor expansion of the MAML objective , but is defined in the RKHS induced by the NTK . Its connection with MAML and some functional-space properties will be discussed later . Solving the Function Optimization Problem To minimize equation 4 , we first derive Theorem 2 to reduce the function optimization problem to a parameter optimization problem . Theorem 2 Let fθ be a neural network with parameter θ andH be the RKHS induced by the NTK Θ of fθ . Then , the following are equivalent Ẽ ( α , fθ ) =M1 , and ‖∇fθLm ( fθ ) ‖2H = ‖∇θLm ( fθ ) ‖2 . Theorem 2 is crucial to our approach as it indicates that solving problem equation 4 is no more difficult than the original parameter-based MAML , although it only considers one-step adaptation case . Next , we will show that multi-step adaptation in the parameter space can also be well-approximated by our objective equation 4 but with a scaled regularized parameter α . In the following , we consider the squared loss L. The case with the cross-entropy loss is discussed in the Appendix . We assume that fθ is parameterized by either fully-connected or convolutional neural networks , and only consider the impact of number of hidden layers L in our theoretical results . Theorem 3 Let fθ be a fully-connected neural network with L hidden layers and ReLU activation function , s1 , ... , sL+1 be the spectral norm of the weight matrices , s = maxh sh , andα be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , then the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . Theorem 4 Let fθ be a convolutional neural network with L − l convolutional layers and l fullyconnected layers and with ReLU activation function , and dx be the input dimension . Denote by Wh the parameter vector of the convolutional layer for h ≤ L− l , and the weight matrices of the fully connected layers for L− l + 1 ≤ h ≤ L+ 1 . ‖ · ‖2 means both the spectral norm of a matrix †For ease of our later notation , we write the gradient∇θiL ( thus the parameter as well ) as a row vector . and the Euclidean norm of a vector . Define sh = √ dx‖Wh‖2 if h = 1 , ... , L − l , and ‖Wh‖2 if L − l + 1 ≤ h ≤ L + 1 . Let s = maxh sh and α be the learning rate of gradient descent . If α ≤ O ( qr ) with q = min ( 1/ ( LsL ) , L−1/ ( L+1 ) ) and r = min ( s−L , s ) , the following holds |Mk − Ẽ ( kα , fθ ) | ≤ O ( 1 L ) . The above Theorems indicate that , for a meta-model with fully-connected and convolutional layers , the proposed Meta-RKHS-I can be an efficient approximation of MAML with a bounded error . Comparisons with Reptile and MAML Similar to Reptile and MAML , the testing stage of MetaRKHS-I also requires gradient-based adaptation on meta-test tasks . By Theorem 1 , we known that gradient flow of an energy functional can be approximated by gradient descent in a parameter space . Reptile with 1-step adaptation ( Nichol et al. , 2018 ) is equivalent to the approximation of the gradient flow of Ẽ ( α , fθ ) with α = 0 , which does not include the fast-adaptation regularization as in our method . For a fairer comparison on the efficiency , we will discuss the computational complexity later . From the equivalent parameter-optimization form indicated in Theorem 2 , we know that our energy functional Ẽ ( α , fθ ) is closely related to MAML . However , with this form , our method does not need the explicit adaptation steps in training ( i.e. , the inner-loop of MAML ) , leading to a simpler optimization problem . We will show that our proposed method leads to better results .
This paper mainly deals with the computational issues of Model Agnostic Meta-Learning (MAML). Specifically, it proposes two meta-learning algorithms where the hypothesis class (i.e. the mapping function set) is defined in RKHS induced by NTK. Extensive experimental studies on many tasks (i.e. regression, few-shot image classification, robustness to adversarial attack, and out-of-distribution generalization) illustrate its superiority compared with other baselines.
SP:32ef828a66d08474bd68e7fb4f664b38d9f65715
All-You-Can-Fit 8-Bit Flexible Floating-Point Format for Accurate and Memory-Efficient Inference of Deep Neural Networks
1 INTRODUCTION . With the rapid progress of deep neural network ( DNN ) techniques , innovative applications of deep learning in various domains , such as computer vision and natural language processing ( NLP ) , are getting more mature and powerful ( Huang et al. , 2017 ; Vaswani et al. , 2017 ; Szegedy et al. , 2015 ; Howard et al. , 2017 ; He et al. , 2017 ; Krizhevsky et al. , 2012 ) . To improve the model accuracy , one of the most commonly used strategies is to add more layers into a network , which inevitably increases the number of weight parameters and activation values of a model . Today , it is typical to store weights and activations in the 32-bit IEEE single-precision floating-point format ( FP32 ) . Those 32-bit data accesses thus become an extremely heavy burden on the memory subsystem in a typical edge or AIoT device , which often has very limited memory capacity and bandwidth . Even for high-end GPU or dedicated network processing unit ( NPU ) based computing platforms , off-chip DRAM bandwidth is still a major performance bottleneck . To relieve the issue of memory bandwidth bottleneck , several attempts of various aspects have been made including ( but not limited to ) weight pruning ( Li et al. , 2017 ; Han et al. , 2016 ) , weight/activation quantization ( Courbariaux et al. , 2015 ; Hubara et al. , 2017 ) , and probably the most straightforward way : storing weights and activations in a shorter format ( Köster et al. , 2017 ) . One trivial way to do so is to adopt the 16-bit IEEE half-precision floating-point format ( FP16 ) . An FP16 number consists of 1 sign bit , 5 exponent bits , and 10 fraction bits . In addition , Google proposed another 16-bit format , named Brain Floating-Point Format ( BFP16 ) , simply by truncating the lower half of the FP32 format ( Kalamkar et al. , 2019 ) . Compared with FP16 , BFP16 allows a significantly wider dynamic value range at the cost of 3-bit precision loss . Note that the exponent bias in all of the above formats is not a free design parameter . Conventionally , the value is solely determined by the exponent size . For example , for FP16 with 5-bit exponent , the exponent bias is automatically fixed to 15 ( 25−1 − 1 ) . To make the data even shorter , 8-bit fixed-point signed/unsigned integer formats ( INT8 and UINT8 ) are also broadly adopted . However , the 8-bit fixed-point format inherently has a narrower dynamic value range so that the model accuracy loss is usually not negligible even after extra symmetric or asymmetric quantization . As a consequence , there are a number of attempts concentrating on utilizing mixed-precision or pure 8-bit floating-point numbers in deep learning applications . Various techniques have been developed for mixed-precision training ( Banner et al. , 2018 ; Micikevicius et al. , 2018 ; Das et al. , 2018 ; Zhou et al. , 2016 ) . Moreover , recent studies proposed several training frameworks that produces weights only in 8-bit floating-point formats ( Wang & Choi , 2018 ; Cambier et al. , 2020 ; Sun et al. , 2019 ) . In these studies , the underlying 8-bit floating-point numbers in training and inference are represented in the format of FP8 ( 1 , 5 , 2 ) or FP8 ( 1 , 4 , 3 ) , where the enclosed three parameters indicate the bit length of sign , exponent , and fraction , respectively . Note that 4 or 5 bits are essential for the exponent in their frameworks , or the corresponding dynamic range may not cover both weight and activation values well . Consequently , only 2 or 3 bits are available for fraction , which inevitably leads to lower accuracy . In this paper , we present an extremely flexible 8-bit floating-point ( FFP8 ) number format . In FFP8 , all parameters – the bit width of exponent/fraction , the exponent bias , and the presence of the sign bit – are configurable . Three major features of our inference methodology associated with the proposed FFP8 format are listed as follows . First , it is observed that both the maximum magnitude and the value distribution are quite dissimilar between weights and activations in most DNNs . It suggests the best exponent size and exponent bias for weights should be different from those for activations to achieve higher accuracy . Second , a large set of commonly-used activation functions always produce nonnegative outputs ( e.g. , ReLU ) . It implies that activations are actually unsigned if one of those activation functions is in use . Hence , it implies the sign bit is not required for those activations , which makes either exponent or fraction 1-bit longer . Note that even one bit can make a big impact since only 8 bits are available . Third , all aforementioned studies require their own sophisticated training frameworks to produce 8-bit floating-point models . Our flow does not . Our flow simply takes a model generated by any conventional FP32 training framework as the input . Then , it simply converts the given pre-trained FP32 model into an FFP8 model . The rest of this paper is organized as follows . Section 2 briefly introduces related work . In Section 3 , we elaborate more on the proposed FFP8 format and how to properly convert a pre-trained FP32 model into an FFP8 one . Section 4 demonstrates the experimental results on various DNN models . The system and hardware design issues for the support of FFP8 numbers are discussed in Section 5 . Finally , the concluding remarks are given in Section 6 . 2 RELATED WORK . DNNs are becoming larger and more complicated , which means they require a bigger memory space and consume more energy during inference . As a result , it is getting harder to deploy them on systems with limited memory capacity and power budget ( e.g. , edge devices ) . ( Han et al. , 2016 ; Zhao et al. , 2020 ; Horowitz , 2014 ) also demonstrated that off-chip DRAM access is responsible for a significantly big share of system power consumption . Hence , it remains an active research topic about how to reduce the memory usage for weights and activations . As mentioned in the previous section , one way to do so is to use short 8-bit floating-point number formats . Wang & Choi ( 2018 ) introduced a DNN training methodology using 8-bit floating-point numbers in FP8 ( 1 , 5 , 2 ) format . The methodology features chunk-based accumulation and stochastic rounding methods for accuracy loss minimization . Besides , to achieve a better trade-off between precision and dynamic range during model training , Sun et al . ( 2019 ) proposed an improved methodology that utilizes two different 8-bit floating-point formats – FP8 ( 1 , 4 , 3 ) for forward propagation and FP8 ( 1 , 5 , 2 ) for backward propagation . Nevertheless , both methodologies fail to make a DNN model entirely in 8-bit numbers : the first and the last layers of the given model are still in 16-bit floating-point numbers ; otherwise , the model suffers about 2 % accuracy degradation . Cambier et al . ( 2020 ) then proposed the S2FP8 format , which allows a DNN model represented in 8-bit floating point numbers completely . By adding a scaling factor and a shifting factor , data can thus be well represented in FP8 ( 1 , 5 , 2 ) after proper shifting and squeezing operations , which eliminates the need of 16-bit floating point numbers . However , the S2FP8 format still results in about 1 % accuracy drop in ResNet-50 ( He et al. , 2018 ) . 3 FLEXIBLE 8-BIT FLOATING-POINT ( FFP8 ) FORMAT . 3.1 DEFINITION OF THE FFP8 FORMAT . In this subsection , a flexible 8-bit floating-point ( FFP8 ) format , which leads to more accurate inference outcomes of deep neural networks , is presented . A typical floating-point format consists of sign ( s ) , exponent ( e ) , and fraction ( f ) fields , and the bit length of each field is specified as x , y , z , respectively . Besides , one more parameter , exponent bias ( b ) , is required to completely specify a floating-point number . Conventionally , b is always implicitly set to 2y−1 − 1 . In this paper , an n-bit floating-point format is denoted as ( x , y , z , b ) or ( x , y , z ) , where n = x + y + z . If b is missing , the default value is implicitly used . Figure 1 ( a ) illustrates one 16-bit FP16 format and two commonly used 8-bit formats : ( 1 , 5 , 2 , 15 ) and ( 1 , 4 , 3 , 7 ) . Note that there is actually only one parameter , the bit width of the exponent ( y ) , that can be freely chosen when defining a new n-bit conventional floating-point format since x is always 1 , z is always n − y − 1 , and b is always 2y−1 − 1 . The above fact motivated us to think out-of-the-box and thus develop a more flexible format , named flexible 8-bit floating-point ( FFP8 ) format and shown in Figure 1 ( b ) . In addition to the size of exponent ( y ) , the FFP8 format offers two more parameters . First , the exponent bias ( b ) is not necessarily equal to 2y−1 − 1 and can be set to any integer , which helps cover the value distributions of both weights and activations well in a shorter exponent size ( y ) . Second , the sign bit is present or not ( i.e. , x can be 0 or 1 ) . Without the sign bit ( x = 0 ) , unsigned activations can be better represented in higher precision . To be more precise , there are only two restrictions on an n-bit FFP8 format : 1 ) x + y + z = n ; 2 ) x must be 0 or 1 . Next , we are about to show how the proposed FFP8 format improves the inference accuracy . 3.2 WEIGHT DISTRIBUTION AND THE WAYS VARIOUS 8-BIT FORMATS COPE WITH IT . Overall speaking , the magnitudes of weights in most DNN models are usually small . Take a popular image classification model VGG-16 ( Simonyan & Zisserman , 2015 ) as an example , the maximum magnitude of weights in the whole model is less than 2 . Figure 2 gives the overall weight distribution ( in log scale ) of VGG-16 trained via a conventional FP32 framework . Figure 2 ( a ) illustrates how the conventional FP8 ( 1 , 4 , 3 ) copes with those weights . The rectangle in red is called the range window , which specifies the value range that FP8 ( 1 , 4 , 3 ) can represent . The purple vertical dash line further partitions the window into the norm region ( right side ) and the denorm region ( left side ) . The star marks the position where the weight of the maximum magnitude locates . Note that virtually the entire right half of the range window in Figure 2 ( a ) covers no weights , while 9.6 % of leftmost weights can not be included in the range window . In order to contain almost every weight in a range window , FP8 ( 1 , 5 , 2 ) can be selected alternatively , as shown in Figure 2 ( b ) . A bigger exponent size ( 4 to 5 ) results in a larger range window . However , there are only 4 ( 22 ) instead of 8 ( 23 ) representative values available for each x in the norm region since the fraction size decreases from 3 to 2 , which potentially results in a lower accuracy . Note that FP8 ( 1 , 4 , 3 ) and FP8 ( 1 , 5 , 2 ) are two most commonly used 8-bit floating point formats in the previous studies . With the help of the proposed FFP8 format , things can change a lot . Figure 2 ( c ) shows what happens if FFP8 ( 1 , 4 , 3 , 15 ) is in use . The range window is of the same size as that in Figure 2 ( a ) but is leftshifted by 8 positions due to the exponent bias is set to 15 instead of the default value 7 . It is obvious that FFP8 ( 1 , 4 , 3 , 15 ) can better cope with weights in VGG-16 than FP8 ( 1 , 4 , 3 ) and FP ( 1 , 5 , 2 ) . Furthermore , Figure 2 ( d ) shows what if FFP8 ( 1 , 3 , 4 , 7 ) is in use . Comparing FFP8 ( 1 , 3 , 4 , 7 ) against FFP8 ( 1 , 4 , 3 , 15 ) , weights in the norm region ( over 35 % ) are represented in 1-bit higher precision whereas 4.6 % of leftmost weights are not included in the range window . However , those out-of-the-window weights can be regarded as some sort of pruned weights . That is , more investigation should be further conducted to determine whether FFP8 ( 1 , 3 , 4 , 7 ) or FFP8 ( 1 , 4 , 3 , 15 ) is better for the weights in VGG-16 . One way or another , it is clear that the proposed FFP8 formats can achieve certain improvement that the conventional 8-bit formats can not .
The paper introduces a new floating point format FFP8 that can adaptively choose the exponent bias as well as the existence of the sign bit. FFP8 is more flexible than other 8-bit floating point formats with fixed exponent biases. The authors show how FF8 can be used to cover the dynamic range of NN weights and activations while still achieving higher precision than commonly used FP 8 formats.
SP:ff8234ea22341194724acd6110af9041d7b71a32
All-You-Can-Fit 8-Bit Flexible Floating-Point Format for Accurate and Memory-Efficient Inference of Deep Neural Networks
1 INTRODUCTION . With the rapid progress of deep neural network ( DNN ) techniques , innovative applications of deep learning in various domains , such as computer vision and natural language processing ( NLP ) , are getting more mature and powerful ( Huang et al. , 2017 ; Vaswani et al. , 2017 ; Szegedy et al. , 2015 ; Howard et al. , 2017 ; He et al. , 2017 ; Krizhevsky et al. , 2012 ) . To improve the model accuracy , one of the most commonly used strategies is to add more layers into a network , which inevitably increases the number of weight parameters and activation values of a model . Today , it is typical to store weights and activations in the 32-bit IEEE single-precision floating-point format ( FP32 ) . Those 32-bit data accesses thus become an extremely heavy burden on the memory subsystem in a typical edge or AIoT device , which often has very limited memory capacity and bandwidth . Even for high-end GPU or dedicated network processing unit ( NPU ) based computing platforms , off-chip DRAM bandwidth is still a major performance bottleneck . To relieve the issue of memory bandwidth bottleneck , several attempts of various aspects have been made including ( but not limited to ) weight pruning ( Li et al. , 2017 ; Han et al. , 2016 ) , weight/activation quantization ( Courbariaux et al. , 2015 ; Hubara et al. , 2017 ) , and probably the most straightforward way : storing weights and activations in a shorter format ( Köster et al. , 2017 ) . One trivial way to do so is to adopt the 16-bit IEEE half-precision floating-point format ( FP16 ) . An FP16 number consists of 1 sign bit , 5 exponent bits , and 10 fraction bits . In addition , Google proposed another 16-bit format , named Brain Floating-Point Format ( BFP16 ) , simply by truncating the lower half of the FP32 format ( Kalamkar et al. , 2019 ) . Compared with FP16 , BFP16 allows a significantly wider dynamic value range at the cost of 3-bit precision loss . Note that the exponent bias in all of the above formats is not a free design parameter . Conventionally , the value is solely determined by the exponent size . For example , for FP16 with 5-bit exponent , the exponent bias is automatically fixed to 15 ( 25−1 − 1 ) . To make the data even shorter , 8-bit fixed-point signed/unsigned integer formats ( INT8 and UINT8 ) are also broadly adopted . However , the 8-bit fixed-point format inherently has a narrower dynamic value range so that the model accuracy loss is usually not negligible even after extra symmetric or asymmetric quantization . As a consequence , there are a number of attempts concentrating on utilizing mixed-precision or pure 8-bit floating-point numbers in deep learning applications . Various techniques have been developed for mixed-precision training ( Banner et al. , 2018 ; Micikevicius et al. , 2018 ; Das et al. , 2018 ; Zhou et al. , 2016 ) . Moreover , recent studies proposed several training frameworks that produces weights only in 8-bit floating-point formats ( Wang & Choi , 2018 ; Cambier et al. , 2020 ; Sun et al. , 2019 ) . In these studies , the underlying 8-bit floating-point numbers in training and inference are represented in the format of FP8 ( 1 , 5 , 2 ) or FP8 ( 1 , 4 , 3 ) , where the enclosed three parameters indicate the bit length of sign , exponent , and fraction , respectively . Note that 4 or 5 bits are essential for the exponent in their frameworks , or the corresponding dynamic range may not cover both weight and activation values well . Consequently , only 2 or 3 bits are available for fraction , which inevitably leads to lower accuracy . In this paper , we present an extremely flexible 8-bit floating-point ( FFP8 ) number format . In FFP8 , all parameters – the bit width of exponent/fraction , the exponent bias , and the presence of the sign bit – are configurable . Three major features of our inference methodology associated with the proposed FFP8 format are listed as follows . First , it is observed that both the maximum magnitude and the value distribution are quite dissimilar between weights and activations in most DNNs . It suggests the best exponent size and exponent bias for weights should be different from those for activations to achieve higher accuracy . Second , a large set of commonly-used activation functions always produce nonnegative outputs ( e.g. , ReLU ) . It implies that activations are actually unsigned if one of those activation functions is in use . Hence , it implies the sign bit is not required for those activations , which makes either exponent or fraction 1-bit longer . Note that even one bit can make a big impact since only 8 bits are available . Third , all aforementioned studies require their own sophisticated training frameworks to produce 8-bit floating-point models . Our flow does not . Our flow simply takes a model generated by any conventional FP32 training framework as the input . Then , it simply converts the given pre-trained FP32 model into an FFP8 model . The rest of this paper is organized as follows . Section 2 briefly introduces related work . In Section 3 , we elaborate more on the proposed FFP8 format and how to properly convert a pre-trained FP32 model into an FFP8 one . Section 4 demonstrates the experimental results on various DNN models . The system and hardware design issues for the support of FFP8 numbers are discussed in Section 5 . Finally , the concluding remarks are given in Section 6 . 2 RELATED WORK . DNNs are becoming larger and more complicated , which means they require a bigger memory space and consume more energy during inference . As a result , it is getting harder to deploy them on systems with limited memory capacity and power budget ( e.g. , edge devices ) . ( Han et al. , 2016 ; Zhao et al. , 2020 ; Horowitz , 2014 ) also demonstrated that off-chip DRAM access is responsible for a significantly big share of system power consumption . Hence , it remains an active research topic about how to reduce the memory usage for weights and activations . As mentioned in the previous section , one way to do so is to use short 8-bit floating-point number formats . Wang & Choi ( 2018 ) introduced a DNN training methodology using 8-bit floating-point numbers in FP8 ( 1 , 5 , 2 ) format . The methodology features chunk-based accumulation and stochastic rounding methods for accuracy loss minimization . Besides , to achieve a better trade-off between precision and dynamic range during model training , Sun et al . ( 2019 ) proposed an improved methodology that utilizes two different 8-bit floating-point formats – FP8 ( 1 , 4 , 3 ) for forward propagation and FP8 ( 1 , 5 , 2 ) for backward propagation . Nevertheless , both methodologies fail to make a DNN model entirely in 8-bit numbers : the first and the last layers of the given model are still in 16-bit floating-point numbers ; otherwise , the model suffers about 2 % accuracy degradation . Cambier et al . ( 2020 ) then proposed the S2FP8 format , which allows a DNN model represented in 8-bit floating point numbers completely . By adding a scaling factor and a shifting factor , data can thus be well represented in FP8 ( 1 , 5 , 2 ) after proper shifting and squeezing operations , which eliminates the need of 16-bit floating point numbers . However , the S2FP8 format still results in about 1 % accuracy drop in ResNet-50 ( He et al. , 2018 ) . 3 FLEXIBLE 8-BIT FLOATING-POINT ( FFP8 ) FORMAT . 3.1 DEFINITION OF THE FFP8 FORMAT . In this subsection , a flexible 8-bit floating-point ( FFP8 ) format , which leads to more accurate inference outcomes of deep neural networks , is presented . A typical floating-point format consists of sign ( s ) , exponent ( e ) , and fraction ( f ) fields , and the bit length of each field is specified as x , y , z , respectively . Besides , one more parameter , exponent bias ( b ) , is required to completely specify a floating-point number . Conventionally , b is always implicitly set to 2y−1 − 1 . In this paper , an n-bit floating-point format is denoted as ( x , y , z , b ) or ( x , y , z ) , where n = x + y + z . If b is missing , the default value is implicitly used . Figure 1 ( a ) illustrates one 16-bit FP16 format and two commonly used 8-bit formats : ( 1 , 5 , 2 , 15 ) and ( 1 , 4 , 3 , 7 ) . Note that there is actually only one parameter , the bit width of the exponent ( y ) , that can be freely chosen when defining a new n-bit conventional floating-point format since x is always 1 , z is always n − y − 1 , and b is always 2y−1 − 1 . The above fact motivated us to think out-of-the-box and thus develop a more flexible format , named flexible 8-bit floating-point ( FFP8 ) format and shown in Figure 1 ( b ) . In addition to the size of exponent ( y ) , the FFP8 format offers two more parameters . First , the exponent bias ( b ) is not necessarily equal to 2y−1 − 1 and can be set to any integer , which helps cover the value distributions of both weights and activations well in a shorter exponent size ( y ) . Second , the sign bit is present or not ( i.e. , x can be 0 or 1 ) . Without the sign bit ( x = 0 ) , unsigned activations can be better represented in higher precision . To be more precise , there are only two restrictions on an n-bit FFP8 format : 1 ) x + y + z = n ; 2 ) x must be 0 or 1 . Next , we are about to show how the proposed FFP8 format improves the inference accuracy . 3.2 WEIGHT DISTRIBUTION AND THE WAYS VARIOUS 8-BIT FORMATS COPE WITH IT . Overall speaking , the magnitudes of weights in most DNN models are usually small . Take a popular image classification model VGG-16 ( Simonyan & Zisserman , 2015 ) as an example , the maximum magnitude of weights in the whole model is less than 2 . Figure 2 gives the overall weight distribution ( in log scale ) of VGG-16 trained via a conventional FP32 framework . Figure 2 ( a ) illustrates how the conventional FP8 ( 1 , 4 , 3 ) copes with those weights . The rectangle in red is called the range window , which specifies the value range that FP8 ( 1 , 4 , 3 ) can represent . The purple vertical dash line further partitions the window into the norm region ( right side ) and the denorm region ( left side ) . The star marks the position where the weight of the maximum magnitude locates . Note that virtually the entire right half of the range window in Figure 2 ( a ) covers no weights , while 9.6 % of leftmost weights can not be included in the range window . In order to contain almost every weight in a range window , FP8 ( 1 , 5 , 2 ) can be selected alternatively , as shown in Figure 2 ( b ) . A bigger exponent size ( 4 to 5 ) results in a larger range window . However , there are only 4 ( 22 ) instead of 8 ( 23 ) representative values available for each x in the norm region since the fraction size decreases from 3 to 2 , which potentially results in a lower accuracy . Note that FP8 ( 1 , 4 , 3 ) and FP8 ( 1 , 5 , 2 ) are two most commonly used 8-bit floating point formats in the previous studies . With the help of the proposed FFP8 format , things can change a lot . Figure 2 ( c ) shows what happens if FFP8 ( 1 , 4 , 3 , 15 ) is in use . The range window is of the same size as that in Figure 2 ( a ) but is leftshifted by 8 positions due to the exponent bias is set to 15 instead of the default value 7 . It is obvious that FFP8 ( 1 , 4 , 3 , 15 ) can better cope with weights in VGG-16 than FP8 ( 1 , 4 , 3 ) and FP ( 1 , 5 , 2 ) . Furthermore , Figure 2 ( d ) shows what if FFP8 ( 1 , 3 , 4 , 7 ) is in use . Comparing FFP8 ( 1 , 3 , 4 , 7 ) against FFP8 ( 1 , 4 , 3 , 15 ) , weights in the norm region ( over 35 % ) are represented in 1-bit higher precision whereas 4.6 % of leftmost weights are not included in the range window . However , those out-of-the-window weights can be regarded as some sort of pruned weights . That is , more investigation should be further conducted to determine whether FFP8 ( 1 , 3 , 4 , 7 ) or FFP8 ( 1 , 4 , 3 , 15 ) is better for the weights in VGG-16 . One way or another , it is clear that the proposed FFP8 formats can achieve certain improvement that the conventional 8-bit formats can not .
This paper explores 8-bit floating point formats for the inference of deep neural networks. The quantization is applied on the weight and activation tensors, but computation engine remains in FP32. To cover the different ranges of weight and activation tensors, the authors propose to use exponent bias. The authors did ablation studies on the impact of numerical formats, e.g. bit-width and exponent biases, on model accuracies. The experiments are performed on vision models on ImageNet, including VGG and ResNet 50/34/18.
SP:ff8234ea22341194724acd6110af9041d7b71a32
All-You-Can-Fit 8-Bit Flexible Floating-Point Format for Accurate and Memory-Efficient Inference of Deep Neural Networks
1 INTRODUCTION . With the rapid progress of deep neural network ( DNN ) techniques , innovative applications of deep learning in various domains , such as computer vision and natural language processing ( NLP ) , are getting more mature and powerful ( Huang et al. , 2017 ; Vaswani et al. , 2017 ; Szegedy et al. , 2015 ; Howard et al. , 2017 ; He et al. , 2017 ; Krizhevsky et al. , 2012 ) . To improve the model accuracy , one of the most commonly used strategies is to add more layers into a network , which inevitably increases the number of weight parameters and activation values of a model . Today , it is typical to store weights and activations in the 32-bit IEEE single-precision floating-point format ( FP32 ) . Those 32-bit data accesses thus become an extremely heavy burden on the memory subsystem in a typical edge or AIoT device , which often has very limited memory capacity and bandwidth . Even for high-end GPU or dedicated network processing unit ( NPU ) based computing platforms , off-chip DRAM bandwidth is still a major performance bottleneck . To relieve the issue of memory bandwidth bottleneck , several attempts of various aspects have been made including ( but not limited to ) weight pruning ( Li et al. , 2017 ; Han et al. , 2016 ) , weight/activation quantization ( Courbariaux et al. , 2015 ; Hubara et al. , 2017 ) , and probably the most straightforward way : storing weights and activations in a shorter format ( Köster et al. , 2017 ) . One trivial way to do so is to adopt the 16-bit IEEE half-precision floating-point format ( FP16 ) . An FP16 number consists of 1 sign bit , 5 exponent bits , and 10 fraction bits . In addition , Google proposed another 16-bit format , named Brain Floating-Point Format ( BFP16 ) , simply by truncating the lower half of the FP32 format ( Kalamkar et al. , 2019 ) . Compared with FP16 , BFP16 allows a significantly wider dynamic value range at the cost of 3-bit precision loss . Note that the exponent bias in all of the above formats is not a free design parameter . Conventionally , the value is solely determined by the exponent size . For example , for FP16 with 5-bit exponent , the exponent bias is automatically fixed to 15 ( 25−1 − 1 ) . To make the data even shorter , 8-bit fixed-point signed/unsigned integer formats ( INT8 and UINT8 ) are also broadly adopted . However , the 8-bit fixed-point format inherently has a narrower dynamic value range so that the model accuracy loss is usually not negligible even after extra symmetric or asymmetric quantization . As a consequence , there are a number of attempts concentrating on utilizing mixed-precision or pure 8-bit floating-point numbers in deep learning applications . Various techniques have been developed for mixed-precision training ( Banner et al. , 2018 ; Micikevicius et al. , 2018 ; Das et al. , 2018 ; Zhou et al. , 2016 ) . Moreover , recent studies proposed several training frameworks that produces weights only in 8-bit floating-point formats ( Wang & Choi , 2018 ; Cambier et al. , 2020 ; Sun et al. , 2019 ) . In these studies , the underlying 8-bit floating-point numbers in training and inference are represented in the format of FP8 ( 1 , 5 , 2 ) or FP8 ( 1 , 4 , 3 ) , where the enclosed three parameters indicate the bit length of sign , exponent , and fraction , respectively . Note that 4 or 5 bits are essential for the exponent in their frameworks , or the corresponding dynamic range may not cover both weight and activation values well . Consequently , only 2 or 3 bits are available for fraction , which inevitably leads to lower accuracy . In this paper , we present an extremely flexible 8-bit floating-point ( FFP8 ) number format . In FFP8 , all parameters – the bit width of exponent/fraction , the exponent bias , and the presence of the sign bit – are configurable . Three major features of our inference methodology associated with the proposed FFP8 format are listed as follows . First , it is observed that both the maximum magnitude and the value distribution are quite dissimilar between weights and activations in most DNNs . It suggests the best exponent size and exponent bias for weights should be different from those for activations to achieve higher accuracy . Second , a large set of commonly-used activation functions always produce nonnegative outputs ( e.g. , ReLU ) . It implies that activations are actually unsigned if one of those activation functions is in use . Hence , it implies the sign bit is not required for those activations , which makes either exponent or fraction 1-bit longer . Note that even one bit can make a big impact since only 8 bits are available . Third , all aforementioned studies require their own sophisticated training frameworks to produce 8-bit floating-point models . Our flow does not . Our flow simply takes a model generated by any conventional FP32 training framework as the input . Then , it simply converts the given pre-trained FP32 model into an FFP8 model . The rest of this paper is organized as follows . Section 2 briefly introduces related work . In Section 3 , we elaborate more on the proposed FFP8 format and how to properly convert a pre-trained FP32 model into an FFP8 one . Section 4 demonstrates the experimental results on various DNN models . The system and hardware design issues for the support of FFP8 numbers are discussed in Section 5 . Finally , the concluding remarks are given in Section 6 . 2 RELATED WORK . DNNs are becoming larger and more complicated , which means they require a bigger memory space and consume more energy during inference . As a result , it is getting harder to deploy them on systems with limited memory capacity and power budget ( e.g. , edge devices ) . ( Han et al. , 2016 ; Zhao et al. , 2020 ; Horowitz , 2014 ) also demonstrated that off-chip DRAM access is responsible for a significantly big share of system power consumption . Hence , it remains an active research topic about how to reduce the memory usage for weights and activations . As mentioned in the previous section , one way to do so is to use short 8-bit floating-point number formats . Wang & Choi ( 2018 ) introduced a DNN training methodology using 8-bit floating-point numbers in FP8 ( 1 , 5 , 2 ) format . The methodology features chunk-based accumulation and stochastic rounding methods for accuracy loss minimization . Besides , to achieve a better trade-off between precision and dynamic range during model training , Sun et al . ( 2019 ) proposed an improved methodology that utilizes two different 8-bit floating-point formats – FP8 ( 1 , 4 , 3 ) for forward propagation and FP8 ( 1 , 5 , 2 ) for backward propagation . Nevertheless , both methodologies fail to make a DNN model entirely in 8-bit numbers : the first and the last layers of the given model are still in 16-bit floating-point numbers ; otherwise , the model suffers about 2 % accuracy degradation . Cambier et al . ( 2020 ) then proposed the S2FP8 format , which allows a DNN model represented in 8-bit floating point numbers completely . By adding a scaling factor and a shifting factor , data can thus be well represented in FP8 ( 1 , 5 , 2 ) after proper shifting and squeezing operations , which eliminates the need of 16-bit floating point numbers . However , the S2FP8 format still results in about 1 % accuracy drop in ResNet-50 ( He et al. , 2018 ) . 3 FLEXIBLE 8-BIT FLOATING-POINT ( FFP8 ) FORMAT . 3.1 DEFINITION OF THE FFP8 FORMAT . In this subsection , a flexible 8-bit floating-point ( FFP8 ) format , which leads to more accurate inference outcomes of deep neural networks , is presented . A typical floating-point format consists of sign ( s ) , exponent ( e ) , and fraction ( f ) fields , and the bit length of each field is specified as x , y , z , respectively . Besides , one more parameter , exponent bias ( b ) , is required to completely specify a floating-point number . Conventionally , b is always implicitly set to 2y−1 − 1 . In this paper , an n-bit floating-point format is denoted as ( x , y , z , b ) or ( x , y , z ) , where n = x + y + z . If b is missing , the default value is implicitly used . Figure 1 ( a ) illustrates one 16-bit FP16 format and two commonly used 8-bit formats : ( 1 , 5 , 2 , 15 ) and ( 1 , 4 , 3 , 7 ) . Note that there is actually only one parameter , the bit width of the exponent ( y ) , that can be freely chosen when defining a new n-bit conventional floating-point format since x is always 1 , z is always n − y − 1 , and b is always 2y−1 − 1 . The above fact motivated us to think out-of-the-box and thus develop a more flexible format , named flexible 8-bit floating-point ( FFP8 ) format and shown in Figure 1 ( b ) . In addition to the size of exponent ( y ) , the FFP8 format offers two more parameters . First , the exponent bias ( b ) is not necessarily equal to 2y−1 − 1 and can be set to any integer , which helps cover the value distributions of both weights and activations well in a shorter exponent size ( y ) . Second , the sign bit is present or not ( i.e. , x can be 0 or 1 ) . Without the sign bit ( x = 0 ) , unsigned activations can be better represented in higher precision . To be more precise , there are only two restrictions on an n-bit FFP8 format : 1 ) x + y + z = n ; 2 ) x must be 0 or 1 . Next , we are about to show how the proposed FFP8 format improves the inference accuracy . 3.2 WEIGHT DISTRIBUTION AND THE WAYS VARIOUS 8-BIT FORMATS COPE WITH IT . Overall speaking , the magnitudes of weights in most DNN models are usually small . Take a popular image classification model VGG-16 ( Simonyan & Zisserman , 2015 ) as an example , the maximum magnitude of weights in the whole model is less than 2 . Figure 2 gives the overall weight distribution ( in log scale ) of VGG-16 trained via a conventional FP32 framework . Figure 2 ( a ) illustrates how the conventional FP8 ( 1 , 4 , 3 ) copes with those weights . The rectangle in red is called the range window , which specifies the value range that FP8 ( 1 , 4 , 3 ) can represent . The purple vertical dash line further partitions the window into the norm region ( right side ) and the denorm region ( left side ) . The star marks the position where the weight of the maximum magnitude locates . Note that virtually the entire right half of the range window in Figure 2 ( a ) covers no weights , while 9.6 % of leftmost weights can not be included in the range window . In order to contain almost every weight in a range window , FP8 ( 1 , 5 , 2 ) can be selected alternatively , as shown in Figure 2 ( b ) . A bigger exponent size ( 4 to 5 ) results in a larger range window . However , there are only 4 ( 22 ) instead of 8 ( 23 ) representative values available for each x in the norm region since the fraction size decreases from 3 to 2 , which potentially results in a lower accuracy . Note that FP8 ( 1 , 4 , 3 ) and FP8 ( 1 , 5 , 2 ) are two most commonly used 8-bit floating point formats in the previous studies . With the help of the proposed FFP8 format , things can change a lot . Figure 2 ( c ) shows what happens if FFP8 ( 1 , 4 , 3 , 15 ) is in use . The range window is of the same size as that in Figure 2 ( a ) but is leftshifted by 8 positions due to the exponent bias is set to 15 instead of the default value 7 . It is obvious that FFP8 ( 1 , 4 , 3 , 15 ) can better cope with weights in VGG-16 than FP8 ( 1 , 4 , 3 ) and FP ( 1 , 5 , 2 ) . Furthermore , Figure 2 ( d ) shows what if FFP8 ( 1 , 3 , 4 , 7 ) is in use . Comparing FFP8 ( 1 , 3 , 4 , 7 ) against FFP8 ( 1 , 4 , 3 , 15 ) , weights in the norm region ( over 35 % ) are represented in 1-bit higher precision whereas 4.6 % of leftmost weights are not included in the range window . However , those out-of-the-window weights can be regarded as some sort of pruned weights . That is , more investigation should be further conducted to determine whether FFP8 ( 1 , 3 , 4 , 7 ) or FFP8 ( 1 , 4 , 3 , 15 ) is better for the weights in VGG-16 . One way or another , it is clear that the proposed FFP8 formats can achieve certain improvement that the conventional 8-bit formats can not .
The paper proposes a new flexible floating point format (FFP8) on 8 bits, to help alleviate the high memory demand of deep networks inference, while preserving high accuracy. There is a large body of literature on reducing the data format, typically from 32 bits to 16, 8 and even below. There is previous work on using an 8-bit floating point FP(8), usually (1,4,3) or (1,5,2) where 1 bit is used for sign, 5 or 4 bits are used for the exponent and 3 or 2 bits are used for the fraction.
SP:ff8234ea22341194724acd6110af9041d7b71a32
The Surprising Power of Graph Neural Networks with Random Node Initialization
1 INTRODUCTION . Graph neural networks ( GNNs ) ( Scarselli et al. , 2009 ; Gori et al. , 2005 ) are neural architectures designed for learning functions over graph-structured data , and naturally encode desirable properties such as permutation invariance ( resp. , equivariance ) relative to graph nodes , and node-level computation based on message passing between these nodes . These properties provide GNNs with a strong inductive bias , enabling them to effectively learn and combine both local and global graph features ( Battaglia et al. , 2018 ) . As a result , GNNs have been applied to a multitude of tasks , ranging from protein classification ( Gilmer et al. , 2017 ) and synthesis ( You et al. , 2018 ) , protein-protein interaction ( Fout et al. , 2017 ) , and social network analysis ( Hamilton et al. , 2017 ) , to recommender systems ( Ying et al. , 2018 ) and combinatorial optimization ( Bengio et al. , 2018 ; Selsam et al. , 2019 ) . However , popular GNN architectures , primarily based on message passing ( MPNNs ) , are limited in their expressive power . In particular , MPNNs are at most as powerful as the Weisfeiler-Leman ( 1-WL ) graph isomorphism heuristic ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not discern between several families of non-isomorphic graphs , e.g. , sets of regular graphs ( Cai et al. , 1992 ) . To address this limitation , alternative GNN architectures with provably higher expressive power than MPNNs have been proposed . These models , which we refer to as higher-order GNNs , are inspired by the more powerful generalization of 1-WL to k−tuples of nodes , known as k-WL ( Grohe , 2017 ) . These models are the only GNNs with an established universality result , but these models are computationally very demanding . As a result , MPNNs , despite their limited expressiveness , remain the standard GNN model for graph learning applications . In a parallel development , MPNNs have recently achieved significant empirical improvements using random node initialization ( RNI ) , through which initial graph node embeddings are randomly set . Indeed , RNI has enabled MPNNs to distinguish instances that 1-WL can not distinguish , and is proven to enable better approximation of a class of combinatorial problems ( Sato et al. , 2020 ) . However , the effect of RNI on the expressive power of GNNs has not yet been comprehensively studied , and its impact on the inductive capacity and learning ability of GNNs remains unclear . In this paper , we thoroughly study the impact of RNI on MPNNs . First , we prove that MPNNs enhanced with RNI are universal , in the sense that they can approximate every function defined on graphs of any fixed order . This follows from a logical characterisation of the expressiveness of MPNNs ( Barceló et al. , 2020 ) combined with an argument on order-invariant definability . Our result strongly contrasts with existing 1-WL limitations for deterministic MPNNs , and provides a foundation for developing very expressive and memory-efficient MPNN models . To empirically verify our theoretical findings , we carry out a careful empirical study to quantify the practical impact of RNI . To this end , we design EXP , a synthetic dataset requiring 2-WL expressive power for models to achieve above-random performance , and run MPNNs with RNI on it , to observe how well and how easily this model can learn and generalize based on this dataset . Then , we propose CEXP , a modification of EXP with partially 1-WL distinguishable data , and evaluate the same questions in this more variable setting . Overall , the contributions of this paper are as follows : - We prove that MPNNs with RNI are universal , a significant improvement over the 1-WL limit of standard MPNNs and , to our knowledge , a first universality result for memory-efficient GNNs . - We introduce two carefully designed datasets , EXP and CEXP , based on graph pairs only distinguishable by 2-WL or higher , to rigorously evaluate the impact of RNI . - Using these datasets , we thoroughly analyze the effects of RNI on MPNN , and observe that ( i ) MPNNs with RNI can closely match the performance of higher-order GNNs , ( ii ) the improved performance of MPNNs with RNI comes at the cost of slower convergence ( compared to higherorder GNNs ) , and ( iii ) using a partial random initialization regime over node features typically improves convergence rate and the accuracy of the models . - We additionally perform the same experiments with analog , sparser datasets , with longer training , and observe similar behavior , but more volatility . 2 GRAPH NEURAL NETWORKS . Graph neural networks ( GNNs ) ( Gori et al. , 2005 ; Scarselli et al. , 2009 ) are neural architectures dedicated to learning functions over graph-structured data . In a GNN , nodes in the input graph are assigned vector representations , which are updated iteratively through series of invariant or equivariant computational layers . We recall message passing neural networks ( MPNNs ) ( Gilmer et al. , 2017 ) , a popular family of GNN models , and its expressive power in relation to the WeisfeilerLeman graph isomorphism heuristic . We discuss alternative GNN models in Section 3 ; for a broader coverage , we refer the reader to the literature ( Hamilton , 2020 ) . In MPNNs , node representations aggregate messages from their neighboring nodes , and use this information to iteratively update their representations . Formally , given a node x , its vector representation vx , t at time t , and its neighborhood N ( x ) , a message passing update can be written as : vx , t+1 = combine ( vx , t , aggregate ( { vy , t∣ y ∈ N ( x ) } ) ) , where combine and aggregate are functions , and aggregate is typically permutation-invariant . Once message passing is complete , the final node representations are then used to compute target outputs . Prominent message passing GNN architectures include graph convolutional networks ( GCNs ) ( Kipf & Welling , 2017 ) and gated graph neural networks ( GGNNs ) ( Li et al. , 2016 ) . It is well-known that standard MPNNs have the same power as the 1-dimensional Weisfeiler-Leman algorithm ( 1-WL ) ( Xu et al. , 2019 ; Morris et al. , 2019 ) . This entails that two nodes in a graph can not be distinguished if 1-WL does not distinguish them , and neither can two graphs be distinguished if 1-WL can not distinguish them . G H Figure 1 : G and H are indistinguishable by 1-WL and hence by ( 1-WL ) GNNs . Consider the graphsG andH shown in Figure 1 . 1-WL can not distinguish any two nodes of the graph G. Thus , for example , the invariant function f ∶ V ( G ) → R that maps all nodes in the 4-cycle of G to 1 and all nodes in the triangle to 0 is not expressible ( or approximable ) by a GNN . Moreover , 1-WL can not distinguish the graphs G , H , even though they are obviously non-isomorphic , so no classifier based on the node embeddings computed by an MPNN can distinguish the two graphs . A somewhat trivial limitation in the expressiveness of MPNNs is that information is only propagated along edges , and hence can never be shared between distinct connected components of a graph ( Barceló et al. , 2020 ; Xu et al. , 2019 ) . An easy way to overcome this limitation is by adding global readouts , that is , permutation-invariant functions that aggregate the current states of all nodes1 . Throughout the paper , we therefore focus on MPNNs with global readouts ( also called aggregatecombine GNNs with global readout , i.e. , ACR-GNNs ( Barceló et al. , 2020 ) ) . 3 RELATED WORK & MOTIVATION . Developing more expressive GNNs is an active research area due to the prominence of GNNs for relational learning ( Hamilton et al. , 2017 ) and combinatorial optimization ( Bengio et al. , 2018 ) . As mentioned earlier , standard GNN models are at most as expressive as 1-WL ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not distinguish between non-isomorphic input instances . In this section , we describe theoretical results quantifying the expressive power of existing GNNs . Higher-order GNNs . We recall the following families of higher-order GNN models : - Invariant ( resp. , equivariant ) graph networks : Invariant ( resp. , equivariant ) graph networks ( Maron et al. , 2019b ) represent graphs as a tensor where node adjacency is directly encoded , and implicitly pass information between nodes through invariant ( resp. , equivariant ) computational blocks . Hence , these models are themselves invariant ( resp. , equivariant ) , a desirable property for computations on graphs . Following intermediate blocks , higher-order tensors are typically returned , and the order of these tensors correlates directly with the expressive power of the overall model . Indeed , invariant networks ( Maron et al. , 2019c ) , and later equivariant networks ( Keriven & Peyré , 2019 ) , are shown to be universal , but with tensor orders of O ( ∣V ∣2 ) , where ∣V ∣ denotes the number of graph nodes . Furthermore , invariant ( resp. , equivariant ) networks with intermediate tensor order k are shown to be equivalent in power to ( k − 1 ) -WL ( Maron et al. , 2019a ) , which is strictly more expressive as k increases ( Cai et al. , 1992 ) . Therefore , such universal higher-order models require intractably-sized intermediate tensors in practice . - Higher-order MPNNs : The k−WL hierarchy has been directly emulated in GNNs , such that these models learn embeddings for tuples of nodes , and perform messaging passing between them , as opposed to individual nodes . This approach has yielded models such as k-GNNs ( Morris et al. , 2019 ) . k-GNNs have ( k−1 ) -WL expressive power,2 but need O ( ∣V ∣k ) memory to run , leading to excessive memory requirements . - Provably powerful graph networks ( PPGNs ) : PPGN is an invariant GNN ( Maron et al. , 2019a ) , based on “ blocks ” of multilayer perceptrons ( MLPs ) and matrix multiplication , which theoretically has 2-WL expressive power , and only requires memory O ( ∣V ∣2 ) ( compared to O ( ∣V ∣3 ) for 3-GNNs ) . However , PPGN theoretically requires exponentially many samples in the number of graph nodes to learn necessary functions for 2-WL expressiveness ( Puny et al. , 2020 ) . GNNs with random node initialization . MPNNs have been enhanced with random node initialization ( Sato et al. , 2020 ) , such that the model trains and runs with partially randomized initial 1In the terminology of Maron et al . ( 2019c ) , such global readouts are tensors of order 1 that are invariant under the symmetric group of the vertex set of the input graph . 2In the literature , one can find different ( though equally expressive ) versions of the Weisfeiler Leman algorithm leading to inconsistent dimension counts . For example , the ( k + 1 ) -WL and the ( k + 1 ) -GNNs of Morris et al . ( 2019 ) are equivalent in expressiveness to the k-WL of Cai et al . ( 1992 ) ; Grohe ( 2017 ) . We follow the version of Cai et al . ( 1992 ) , as it has been adopted as the standard in the literature on graph isomorphism testing . node features . These models , denoted rGNNs , are shown to near-optimally approximate solutions to specific combinatorial optimization problems , and are able to distinguish between 1-WL indistinguishable graph pairs . rGNNs can also detect characteristic sub-graphs in an input graph with high probability . Nonetheless , it remains open as to how much expressive power is exactly gained through RNI , and , in general , whether a GNN model that is universal , scalable , and structure-preserving , can be developed . Our work strongly improves the theoretical result of Sato et al . ( 2020 ) , as it shows universality of MPNNs with RNI , and thus that arbitrary real-valued functions over graphs can be learned by MPNNs with the help of RNI . On the empirical side , we highlight the power of RNI in a significantly more challenging setting than rGNN , using a target function ( SAT ) beyond their theoretical scope . Indeed , for SAT , approximation is known to be hard , and fixed local structures are not useful for prediction . Similar work to RNI has also been conducted in terms of randomly adding features from a predetermined set of colors ( Dasoulas et al. , 2020 ) to disambiguate between nodes . This model , known as CLIP , is similar in spirit to RNI , in that it introduces randomness to node representations , but explicitly makes graphs distinguishable by construction . By contrast , we study random features produced by RNI , which ( i ) are not designed a priori to distinguish nodes , ( ii ) do not explicitly introduce a fixed underlying structure , and ( iii ) yield potentially infinitely many representations for a single graph . In this more general setting , we nonetheless show that RNI adds expressive power to distinguish between nodes with high probability , leads to a universality result , and performs strongly in challenging problem settings .
The paper studies the how random initialization of node states can improve the expressivity of message passing graph neural networks. Theoretically the paper shows that RNI makes MPNNs universal approximators for invariant functions over graphs. To supplement this claim, the authors evaluate GNNs with RNI and higher-order GNNs over a carefully constructed synthetic dataset and show that RNI (even if only a fraction of the nodes are randomly initialized) are as expressive as higher order GNNs. They also highlight some drawbacks of this approach, such as slower training and sensitivity to hyperparameter tuning.
SP:7befb2bd43cebe3235a5040100023f589932ad8d
The Surprising Power of Graph Neural Networks with Random Node Initialization
1 INTRODUCTION . Graph neural networks ( GNNs ) ( Scarselli et al. , 2009 ; Gori et al. , 2005 ) are neural architectures designed for learning functions over graph-structured data , and naturally encode desirable properties such as permutation invariance ( resp. , equivariance ) relative to graph nodes , and node-level computation based on message passing between these nodes . These properties provide GNNs with a strong inductive bias , enabling them to effectively learn and combine both local and global graph features ( Battaglia et al. , 2018 ) . As a result , GNNs have been applied to a multitude of tasks , ranging from protein classification ( Gilmer et al. , 2017 ) and synthesis ( You et al. , 2018 ) , protein-protein interaction ( Fout et al. , 2017 ) , and social network analysis ( Hamilton et al. , 2017 ) , to recommender systems ( Ying et al. , 2018 ) and combinatorial optimization ( Bengio et al. , 2018 ; Selsam et al. , 2019 ) . However , popular GNN architectures , primarily based on message passing ( MPNNs ) , are limited in their expressive power . In particular , MPNNs are at most as powerful as the Weisfeiler-Leman ( 1-WL ) graph isomorphism heuristic ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not discern between several families of non-isomorphic graphs , e.g. , sets of regular graphs ( Cai et al. , 1992 ) . To address this limitation , alternative GNN architectures with provably higher expressive power than MPNNs have been proposed . These models , which we refer to as higher-order GNNs , are inspired by the more powerful generalization of 1-WL to k−tuples of nodes , known as k-WL ( Grohe , 2017 ) . These models are the only GNNs with an established universality result , but these models are computationally very demanding . As a result , MPNNs , despite their limited expressiveness , remain the standard GNN model for graph learning applications . In a parallel development , MPNNs have recently achieved significant empirical improvements using random node initialization ( RNI ) , through which initial graph node embeddings are randomly set . Indeed , RNI has enabled MPNNs to distinguish instances that 1-WL can not distinguish , and is proven to enable better approximation of a class of combinatorial problems ( Sato et al. , 2020 ) . However , the effect of RNI on the expressive power of GNNs has not yet been comprehensively studied , and its impact on the inductive capacity and learning ability of GNNs remains unclear . In this paper , we thoroughly study the impact of RNI on MPNNs . First , we prove that MPNNs enhanced with RNI are universal , in the sense that they can approximate every function defined on graphs of any fixed order . This follows from a logical characterisation of the expressiveness of MPNNs ( Barceló et al. , 2020 ) combined with an argument on order-invariant definability . Our result strongly contrasts with existing 1-WL limitations for deterministic MPNNs , and provides a foundation for developing very expressive and memory-efficient MPNN models . To empirically verify our theoretical findings , we carry out a careful empirical study to quantify the practical impact of RNI . To this end , we design EXP , a synthetic dataset requiring 2-WL expressive power for models to achieve above-random performance , and run MPNNs with RNI on it , to observe how well and how easily this model can learn and generalize based on this dataset . Then , we propose CEXP , a modification of EXP with partially 1-WL distinguishable data , and evaluate the same questions in this more variable setting . Overall , the contributions of this paper are as follows : - We prove that MPNNs with RNI are universal , a significant improvement over the 1-WL limit of standard MPNNs and , to our knowledge , a first universality result for memory-efficient GNNs . - We introduce two carefully designed datasets , EXP and CEXP , based on graph pairs only distinguishable by 2-WL or higher , to rigorously evaluate the impact of RNI . - Using these datasets , we thoroughly analyze the effects of RNI on MPNN , and observe that ( i ) MPNNs with RNI can closely match the performance of higher-order GNNs , ( ii ) the improved performance of MPNNs with RNI comes at the cost of slower convergence ( compared to higherorder GNNs ) , and ( iii ) using a partial random initialization regime over node features typically improves convergence rate and the accuracy of the models . - We additionally perform the same experiments with analog , sparser datasets , with longer training , and observe similar behavior , but more volatility . 2 GRAPH NEURAL NETWORKS . Graph neural networks ( GNNs ) ( Gori et al. , 2005 ; Scarselli et al. , 2009 ) are neural architectures dedicated to learning functions over graph-structured data . In a GNN , nodes in the input graph are assigned vector representations , which are updated iteratively through series of invariant or equivariant computational layers . We recall message passing neural networks ( MPNNs ) ( Gilmer et al. , 2017 ) , a popular family of GNN models , and its expressive power in relation to the WeisfeilerLeman graph isomorphism heuristic . We discuss alternative GNN models in Section 3 ; for a broader coverage , we refer the reader to the literature ( Hamilton , 2020 ) . In MPNNs , node representations aggregate messages from their neighboring nodes , and use this information to iteratively update their representations . Formally , given a node x , its vector representation vx , t at time t , and its neighborhood N ( x ) , a message passing update can be written as : vx , t+1 = combine ( vx , t , aggregate ( { vy , t∣ y ∈ N ( x ) } ) ) , where combine and aggregate are functions , and aggregate is typically permutation-invariant . Once message passing is complete , the final node representations are then used to compute target outputs . Prominent message passing GNN architectures include graph convolutional networks ( GCNs ) ( Kipf & Welling , 2017 ) and gated graph neural networks ( GGNNs ) ( Li et al. , 2016 ) . It is well-known that standard MPNNs have the same power as the 1-dimensional Weisfeiler-Leman algorithm ( 1-WL ) ( Xu et al. , 2019 ; Morris et al. , 2019 ) . This entails that two nodes in a graph can not be distinguished if 1-WL does not distinguish them , and neither can two graphs be distinguished if 1-WL can not distinguish them . G H Figure 1 : G and H are indistinguishable by 1-WL and hence by ( 1-WL ) GNNs . Consider the graphsG andH shown in Figure 1 . 1-WL can not distinguish any two nodes of the graph G. Thus , for example , the invariant function f ∶ V ( G ) → R that maps all nodes in the 4-cycle of G to 1 and all nodes in the triangle to 0 is not expressible ( or approximable ) by a GNN . Moreover , 1-WL can not distinguish the graphs G , H , even though they are obviously non-isomorphic , so no classifier based on the node embeddings computed by an MPNN can distinguish the two graphs . A somewhat trivial limitation in the expressiveness of MPNNs is that information is only propagated along edges , and hence can never be shared between distinct connected components of a graph ( Barceló et al. , 2020 ; Xu et al. , 2019 ) . An easy way to overcome this limitation is by adding global readouts , that is , permutation-invariant functions that aggregate the current states of all nodes1 . Throughout the paper , we therefore focus on MPNNs with global readouts ( also called aggregatecombine GNNs with global readout , i.e. , ACR-GNNs ( Barceló et al. , 2020 ) ) . 3 RELATED WORK & MOTIVATION . Developing more expressive GNNs is an active research area due to the prominence of GNNs for relational learning ( Hamilton et al. , 2017 ) and combinatorial optimization ( Bengio et al. , 2018 ) . As mentioned earlier , standard GNN models are at most as expressive as 1-WL ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not distinguish between non-isomorphic input instances . In this section , we describe theoretical results quantifying the expressive power of existing GNNs . Higher-order GNNs . We recall the following families of higher-order GNN models : - Invariant ( resp. , equivariant ) graph networks : Invariant ( resp. , equivariant ) graph networks ( Maron et al. , 2019b ) represent graphs as a tensor where node adjacency is directly encoded , and implicitly pass information between nodes through invariant ( resp. , equivariant ) computational blocks . Hence , these models are themselves invariant ( resp. , equivariant ) , a desirable property for computations on graphs . Following intermediate blocks , higher-order tensors are typically returned , and the order of these tensors correlates directly with the expressive power of the overall model . Indeed , invariant networks ( Maron et al. , 2019c ) , and later equivariant networks ( Keriven & Peyré , 2019 ) , are shown to be universal , but with tensor orders of O ( ∣V ∣2 ) , where ∣V ∣ denotes the number of graph nodes . Furthermore , invariant ( resp. , equivariant ) networks with intermediate tensor order k are shown to be equivalent in power to ( k − 1 ) -WL ( Maron et al. , 2019a ) , which is strictly more expressive as k increases ( Cai et al. , 1992 ) . Therefore , such universal higher-order models require intractably-sized intermediate tensors in practice . - Higher-order MPNNs : The k−WL hierarchy has been directly emulated in GNNs , such that these models learn embeddings for tuples of nodes , and perform messaging passing between them , as opposed to individual nodes . This approach has yielded models such as k-GNNs ( Morris et al. , 2019 ) . k-GNNs have ( k−1 ) -WL expressive power,2 but need O ( ∣V ∣k ) memory to run , leading to excessive memory requirements . - Provably powerful graph networks ( PPGNs ) : PPGN is an invariant GNN ( Maron et al. , 2019a ) , based on “ blocks ” of multilayer perceptrons ( MLPs ) and matrix multiplication , which theoretically has 2-WL expressive power , and only requires memory O ( ∣V ∣2 ) ( compared to O ( ∣V ∣3 ) for 3-GNNs ) . However , PPGN theoretically requires exponentially many samples in the number of graph nodes to learn necessary functions for 2-WL expressiveness ( Puny et al. , 2020 ) . GNNs with random node initialization . MPNNs have been enhanced with random node initialization ( Sato et al. , 2020 ) , such that the model trains and runs with partially randomized initial 1In the terminology of Maron et al . ( 2019c ) , such global readouts are tensors of order 1 that are invariant under the symmetric group of the vertex set of the input graph . 2In the literature , one can find different ( though equally expressive ) versions of the Weisfeiler Leman algorithm leading to inconsistent dimension counts . For example , the ( k + 1 ) -WL and the ( k + 1 ) -GNNs of Morris et al . ( 2019 ) are equivalent in expressiveness to the k-WL of Cai et al . ( 1992 ) ; Grohe ( 2017 ) . We follow the version of Cai et al . ( 1992 ) , as it has been adopted as the standard in the literature on graph isomorphism testing . node features . These models , denoted rGNNs , are shown to near-optimally approximate solutions to specific combinatorial optimization problems , and are able to distinguish between 1-WL indistinguishable graph pairs . rGNNs can also detect characteristic sub-graphs in an input graph with high probability . Nonetheless , it remains open as to how much expressive power is exactly gained through RNI , and , in general , whether a GNN model that is universal , scalable , and structure-preserving , can be developed . Our work strongly improves the theoretical result of Sato et al . ( 2020 ) , as it shows universality of MPNNs with RNI , and thus that arbitrary real-valued functions over graphs can be learned by MPNNs with the help of RNI . On the empirical side , we highlight the power of RNI in a significantly more challenging setting than rGNN , using a target function ( SAT ) beyond their theoretical scope . Indeed , for SAT , approximation is known to be hard , and fixed local structures are not useful for prediction . Similar work to RNI has also been conducted in terms of randomly adding features from a predetermined set of colors ( Dasoulas et al. , 2020 ) to disambiguate between nodes . This model , known as CLIP , is similar in spirit to RNI , in that it introduces randomness to node representations , but explicitly makes graphs distinguishable by construction . By contrast , we study random features produced by RNI , which ( i ) are not designed a priori to distinguish nodes , ( ii ) do not explicitly introduce a fixed underlying structure , and ( iii ) yield potentially infinitely many representations for a single graph . In this more general setting , we nonetheless show that RNI adds expressive power to distinguish between nodes with high probability , leads to a universality result , and performs strongly in challenging problem settings .
This paper studies the power of message passing neural networks (MPNNs) with random node initialization (RNI). Although the power of standard MPNNs is limited to 1-WL, the main result of the paper is to prove that RNI makes MPNNs universal. The paper also introduces two graph classification datasets where each graph is a SAT problem and the label is the satisfiability/unsatisfiability. The datasets have been created in a way that their graphs are 1-WL indistinguishable to serve as a test-bed for graph neural networks with power beyond 1-WL. The results on these two datasets show the merit of adding RNI to MPNNs.
SP:7befb2bd43cebe3235a5040100023f589932ad8d
The Surprising Power of Graph Neural Networks with Random Node Initialization
1 INTRODUCTION . Graph neural networks ( GNNs ) ( Scarselli et al. , 2009 ; Gori et al. , 2005 ) are neural architectures designed for learning functions over graph-structured data , and naturally encode desirable properties such as permutation invariance ( resp. , equivariance ) relative to graph nodes , and node-level computation based on message passing between these nodes . These properties provide GNNs with a strong inductive bias , enabling them to effectively learn and combine both local and global graph features ( Battaglia et al. , 2018 ) . As a result , GNNs have been applied to a multitude of tasks , ranging from protein classification ( Gilmer et al. , 2017 ) and synthesis ( You et al. , 2018 ) , protein-protein interaction ( Fout et al. , 2017 ) , and social network analysis ( Hamilton et al. , 2017 ) , to recommender systems ( Ying et al. , 2018 ) and combinatorial optimization ( Bengio et al. , 2018 ; Selsam et al. , 2019 ) . However , popular GNN architectures , primarily based on message passing ( MPNNs ) , are limited in their expressive power . In particular , MPNNs are at most as powerful as the Weisfeiler-Leman ( 1-WL ) graph isomorphism heuristic ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not discern between several families of non-isomorphic graphs , e.g. , sets of regular graphs ( Cai et al. , 1992 ) . To address this limitation , alternative GNN architectures with provably higher expressive power than MPNNs have been proposed . These models , which we refer to as higher-order GNNs , are inspired by the more powerful generalization of 1-WL to k−tuples of nodes , known as k-WL ( Grohe , 2017 ) . These models are the only GNNs with an established universality result , but these models are computationally very demanding . As a result , MPNNs , despite their limited expressiveness , remain the standard GNN model for graph learning applications . In a parallel development , MPNNs have recently achieved significant empirical improvements using random node initialization ( RNI ) , through which initial graph node embeddings are randomly set . Indeed , RNI has enabled MPNNs to distinguish instances that 1-WL can not distinguish , and is proven to enable better approximation of a class of combinatorial problems ( Sato et al. , 2020 ) . However , the effect of RNI on the expressive power of GNNs has not yet been comprehensively studied , and its impact on the inductive capacity and learning ability of GNNs remains unclear . In this paper , we thoroughly study the impact of RNI on MPNNs . First , we prove that MPNNs enhanced with RNI are universal , in the sense that they can approximate every function defined on graphs of any fixed order . This follows from a logical characterisation of the expressiveness of MPNNs ( Barceló et al. , 2020 ) combined with an argument on order-invariant definability . Our result strongly contrasts with existing 1-WL limitations for deterministic MPNNs , and provides a foundation for developing very expressive and memory-efficient MPNN models . To empirically verify our theoretical findings , we carry out a careful empirical study to quantify the practical impact of RNI . To this end , we design EXP , a synthetic dataset requiring 2-WL expressive power for models to achieve above-random performance , and run MPNNs with RNI on it , to observe how well and how easily this model can learn and generalize based on this dataset . Then , we propose CEXP , a modification of EXP with partially 1-WL distinguishable data , and evaluate the same questions in this more variable setting . Overall , the contributions of this paper are as follows : - We prove that MPNNs with RNI are universal , a significant improvement over the 1-WL limit of standard MPNNs and , to our knowledge , a first universality result for memory-efficient GNNs . - We introduce two carefully designed datasets , EXP and CEXP , based on graph pairs only distinguishable by 2-WL or higher , to rigorously evaluate the impact of RNI . - Using these datasets , we thoroughly analyze the effects of RNI on MPNN , and observe that ( i ) MPNNs with RNI can closely match the performance of higher-order GNNs , ( ii ) the improved performance of MPNNs with RNI comes at the cost of slower convergence ( compared to higherorder GNNs ) , and ( iii ) using a partial random initialization regime over node features typically improves convergence rate and the accuracy of the models . - We additionally perform the same experiments with analog , sparser datasets , with longer training , and observe similar behavior , but more volatility . 2 GRAPH NEURAL NETWORKS . Graph neural networks ( GNNs ) ( Gori et al. , 2005 ; Scarselli et al. , 2009 ) are neural architectures dedicated to learning functions over graph-structured data . In a GNN , nodes in the input graph are assigned vector representations , which are updated iteratively through series of invariant or equivariant computational layers . We recall message passing neural networks ( MPNNs ) ( Gilmer et al. , 2017 ) , a popular family of GNN models , and its expressive power in relation to the WeisfeilerLeman graph isomorphism heuristic . We discuss alternative GNN models in Section 3 ; for a broader coverage , we refer the reader to the literature ( Hamilton , 2020 ) . In MPNNs , node representations aggregate messages from their neighboring nodes , and use this information to iteratively update their representations . Formally , given a node x , its vector representation vx , t at time t , and its neighborhood N ( x ) , a message passing update can be written as : vx , t+1 = combine ( vx , t , aggregate ( { vy , t∣ y ∈ N ( x ) } ) ) , where combine and aggregate are functions , and aggregate is typically permutation-invariant . Once message passing is complete , the final node representations are then used to compute target outputs . Prominent message passing GNN architectures include graph convolutional networks ( GCNs ) ( Kipf & Welling , 2017 ) and gated graph neural networks ( GGNNs ) ( Li et al. , 2016 ) . It is well-known that standard MPNNs have the same power as the 1-dimensional Weisfeiler-Leman algorithm ( 1-WL ) ( Xu et al. , 2019 ; Morris et al. , 2019 ) . This entails that two nodes in a graph can not be distinguished if 1-WL does not distinguish them , and neither can two graphs be distinguished if 1-WL can not distinguish them . G H Figure 1 : G and H are indistinguishable by 1-WL and hence by ( 1-WL ) GNNs . Consider the graphsG andH shown in Figure 1 . 1-WL can not distinguish any two nodes of the graph G. Thus , for example , the invariant function f ∶ V ( G ) → R that maps all nodes in the 4-cycle of G to 1 and all nodes in the triangle to 0 is not expressible ( or approximable ) by a GNN . Moreover , 1-WL can not distinguish the graphs G , H , even though they are obviously non-isomorphic , so no classifier based on the node embeddings computed by an MPNN can distinguish the two graphs . A somewhat trivial limitation in the expressiveness of MPNNs is that information is only propagated along edges , and hence can never be shared between distinct connected components of a graph ( Barceló et al. , 2020 ; Xu et al. , 2019 ) . An easy way to overcome this limitation is by adding global readouts , that is , permutation-invariant functions that aggregate the current states of all nodes1 . Throughout the paper , we therefore focus on MPNNs with global readouts ( also called aggregatecombine GNNs with global readout , i.e. , ACR-GNNs ( Barceló et al. , 2020 ) ) . 3 RELATED WORK & MOTIVATION . Developing more expressive GNNs is an active research area due to the prominence of GNNs for relational learning ( Hamilton et al. , 2017 ) and combinatorial optimization ( Bengio et al. , 2018 ) . As mentioned earlier , standard GNN models are at most as expressive as 1-WL ( Morris et al. , 2019 ; Xu et al. , 2019 ) , and thus can not distinguish between non-isomorphic input instances . In this section , we describe theoretical results quantifying the expressive power of existing GNNs . Higher-order GNNs . We recall the following families of higher-order GNN models : - Invariant ( resp. , equivariant ) graph networks : Invariant ( resp. , equivariant ) graph networks ( Maron et al. , 2019b ) represent graphs as a tensor where node adjacency is directly encoded , and implicitly pass information between nodes through invariant ( resp. , equivariant ) computational blocks . Hence , these models are themselves invariant ( resp. , equivariant ) , a desirable property for computations on graphs . Following intermediate blocks , higher-order tensors are typically returned , and the order of these tensors correlates directly with the expressive power of the overall model . Indeed , invariant networks ( Maron et al. , 2019c ) , and later equivariant networks ( Keriven & Peyré , 2019 ) , are shown to be universal , but with tensor orders of O ( ∣V ∣2 ) , where ∣V ∣ denotes the number of graph nodes . Furthermore , invariant ( resp. , equivariant ) networks with intermediate tensor order k are shown to be equivalent in power to ( k − 1 ) -WL ( Maron et al. , 2019a ) , which is strictly more expressive as k increases ( Cai et al. , 1992 ) . Therefore , such universal higher-order models require intractably-sized intermediate tensors in practice . - Higher-order MPNNs : The k−WL hierarchy has been directly emulated in GNNs , such that these models learn embeddings for tuples of nodes , and perform messaging passing between them , as opposed to individual nodes . This approach has yielded models such as k-GNNs ( Morris et al. , 2019 ) . k-GNNs have ( k−1 ) -WL expressive power,2 but need O ( ∣V ∣k ) memory to run , leading to excessive memory requirements . - Provably powerful graph networks ( PPGNs ) : PPGN is an invariant GNN ( Maron et al. , 2019a ) , based on “ blocks ” of multilayer perceptrons ( MLPs ) and matrix multiplication , which theoretically has 2-WL expressive power , and only requires memory O ( ∣V ∣2 ) ( compared to O ( ∣V ∣3 ) for 3-GNNs ) . However , PPGN theoretically requires exponentially many samples in the number of graph nodes to learn necessary functions for 2-WL expressiveness ( Puny et al. , 2020 ) . GNNs with random node initialization . MPNNs have been enhanced with random node initialization ( Sato et al. , 2020 ) , such that the model trains and runs with partially randomized initial 1In the terminology of Maron et al . ( 2019c ) , such global readouts are tensors of order 1 that are invariant under the symmetric group of the vertex set of the input graph . 2In the literature , one can find different ( though equally expressive ) versions of the Weisfeiler Leman algorithm leading to inconsistent dimension counts . For example , the ( k + 1 ) -WL and the ( k + 1 ) -GNNs of Morris et al . ( 2019 ) are equivalent in expressiveness to the k-WL of Cai et al . ( 1992 ) ; Grohe ( 2017 ) . We follow the version of Cai et al . ( 1992 ) , as it has been adopted as the standard in the literature on graph isomorphism testing . node features . These models , denoted rGNNs , are shown to near-optimally approximate solutions to specific combinatorial optimization problems , and are able to distinguish between 1-WL indistinguishable graph pairs . rGNNs can also detect characteristic sub-graphs in an input graph with high probability . Nonetheless , it remains open as to how much expressive power is exactly gained through RNI , and , in general , whether a GNN model that is universal , scalable , and structure-preserving , can be developed . Our work strongly improves the theoretical result of Sato et al . ( 2020 ) , as it shows universality of MPNNs with RNI , and thus that arbitrary real-valued functions over graphs can be learned by MPNNs with the help of RNI . On the empirical side , we highlight the power of RNI in a significantly more challenging setting than rGNN , using a target function ( SAT ) beyond their theoretical scope . Indeed , for SAT , approximation is known to be hard , and fixed local structures are not useful for prediction . Similar work to RNI has also been conducted in terms of randomly adding features from a predetermined set of colors ( Dasoulas et al. , 2020 ) to disambiguate between nodes . This model , known as CLIP , is similar in spirit to RNI , in that it introduces randomness to node representations , but explicitly makes graphs distinguishable by construction . By contrast , we study random features produced by RNI , which ( i ) are not designed a priori to distinguish nodes , ( ii ) do not explicitly introduce a fixed underlying structure , and ( iii ) yield potentially infinitely many representations for a single graph . In this more general setting , we nonetheless show that RNI adds expressive power to distinguish between nodes with high probability , leads to a universality result , and performs strongly in challenging problem settings .
The paper study the effects of adding random features (RF) to graph neural networks (GNN). First, it is shown that, quite surprisingly, adding random features makes GNN universal approximators of invariant functions. Next, a novel dataset is defined that is aimed at evaluating the performance of models that have high expressive power. Finally, several experiments show that adding RF performs well on the proposed dataset.
SP:7befb2bd43cebe3235a5040100023f589932ad8d
Robust Learning Rate Selection for Stochastic Optimization via Splitting Diagnostic
1 INTRODUCTION . Many machine learning problems boil down to finding a minimizer ✓⇤ 2 Rd of a risk function taking the form F ( ✓ ) = E [ f ( ✓ , Z ) ] , ( 1 ) where f denotes a loss function , ✓ is the model parameter , and the random data point Z = ( X , y ) contains a feature vector X and its label y . In the case of a finite population , for example , this problem is reduced to the empirical minimization problem . The touchstone method for minimizing ( 1 ) is stochastic gradient descent ( SGD ) . Starting from an initial point ✓0 , SGD updates the iterates according to ✓t+1 = ✓t ⌘t · g ( ✓t , Zt+1 ) ( 2 ) for t 0 , where ⌘t is the learning rate , { Zt } 1t=1 are i.i.d . copies of Z and g ( ✓ , Z ) is the ( sub- ) gradient of f ( ✓ , Z ) with respect to ✓ . The noisy gradient g ( ✓ , Z ) is an unbiased estimate for the true gradient rF ( ✓ ) in the sense that E [ g ( ✓ , Z ) ] = rF ( ✓ ) for any ✓ . The convergence rate of SGD crucially depends on the learning rate—often recognized as “ the single most important hyper-parameter ” in training deep neural networks ( Bengio , 2012 ) —and , accordingly , there is a vast literature on how to decrease this fundamental tuning parameter for improved convergence performance . In the pioneering work of Robbins and Monro ( 1951 ) , the learning rate ⌘t is set to O ( 1/t ) for convex objectives . Later , it was recognized that a slowly decreasing learning rate in conjunction with iterate averaging leads to a faster rate of convergence for strongly convex and smooth objectives ( Ruppert , 1988 ; Polyak and Juditsky , 1992 ) . More recently , extensive effort has been devoted to incorporating preconditioning/Hessians into learning rate selection rules ( Duchi et al. , 2011 ; Dauphin et al. , 2015 ; Tan et al. , 2016 ) . Among numerous proposals , a simple yet widely employed approach is to repeatedly halve the learning rate after performing a pre-determined number of iterations ( see , for example , Bottou et al. , 2018 ) . In this paper , we introduce a new variant of SGD that we term SplitSGD with a novel learning rate selection rule . At a high level , our new method is motivated by the following fact : an optimal learning rate should be adaptive to the informativeness of the noisy gradient g ( ✓t , Zt+1 ) . Roughly speaking , the informativeness is higher if the true gradient rF ( ✓t ) is relatively large compared with the noise rF ( ✓t ) g ( ✓t , Zt+1 ) and vice versa . On the one hand , if the learning rate is too small with respect to the informativeness of the noisy gradient , SGD makes rather slow progress . On the other hand , the iterates would bounce around a region of an optimum of the objective if the learning rate is too large with respect to the informativeness . The latter case corresponds to a stationary phase in stochastic optimization ( Murata , 1998 ; Chee and Toulis , 2018 ) , which necessitates the reduction of the learning rate for better convergence . Specifically , let ⇡⌘ be the stationary distribution for ✓ when the learning rate is constant and set to ⌘ . From ( 2 ) one has that E✓⇠⇡⌘ [ g ( ✓ , Z ) ] = 0 , and consequently that E [ hg ( ✓ ( 1 ) , Z ( 1 ) ) , g ( ✓ ( 2 ) , Z ( 2 ) ) i ] = 0 for ✓ ( 1 ) , ✓ ( 2 ) i.i.d.⇠ ⇡⌘ , Z ( 1 ) , Z ( 2 ) i.i.d.⇠ Z ( 3 ) SplitSGD differs from other stochastic optimization procedures in its robust stationarity phase detection , which we refer to as the Splitting Diagnostic . In short , this diagnostic runs two SGD threads initialized at the same iterate using independent data points ( refers to Zt+1 in ( 2 ) ) , and then performs hypothesis testing to determine whether the learning rate leads to a stationary phase or not . The effectiveness of the Splitting Diagnostic is illustrated in Figure 1 , which reveals different patterns of dependence between the two SGD threads with difference learning rates . Loosely speaking , in the stationary phase ( in purple ) , the two SGD threads behave as if they are independent due to a large learning rate , and SplitSGD subsequently decreases the learning rate by some factor . In contrast , strong positive dependence is exhibited in the non stationary phase ( in orange ) and , thus , the learning rate remains the same after the diagnostic . In essence , the robustness of the Splitting Diagnostic is attributed to its adaptivity to the local geometry of the objec- confirmed by our experimental results in both convex and non-convex settings . In the latter , SplitSGD showed robustness with respect to the choice of the initial learning rate , and remarkable success in improving the test accuracy and avoiding overfitting compared to classic optimization procedures . 1.1 RELATED WORK . There is a long history of detecting stationarity or non-stationarity in stochastic optimization to improve convergence rates ( Yin , 1989 ; Pflug , 1990 ; Delyon and Juditsky , 1993 ; Murata , 1998 ; Pesme et al. , 2020 ) . Perhaps the most relevant work in this vein to the present paper is Chee and Toulis ( 2018 ) , which builds on top of Pflug ( 1990 ) for general convex functions . Specifically , this work uses the running sum of the inner products of successive stochastic gradients for stationarity detection . However , this approach does not take into account the strong correlation between consecutive gradients and , moreover , is not sensitive to the local curvature of the current iterates due to unwanted influence from prior gradients . In contrast , the splitting strategy , which is akin to HiGrad ( Su and Zhu , 2018 ) , allows our SplitSGD to concentrate on the current gradients and leverage the regained independence of gradients to test stationarity . Lately , Yaida ( 2019 ) and Lang et al . ( 2019 ) derive a stationarity detection rule that is based on gradients of a mini-batch to tune the learning rate in SGD with momentum . From a different angle , another related line of work is concerned with the relationship between the informativeness of gradients and the mini-batch size ( Keskar et al. , 2016 ; Yin et al. , 2017 ; Li et al. , 2017 ; Smith et al. , 2017 ) . Among others , it has been recognized that the optimal mini-batch size should be adaptive to the local geometry of the objective function and the noise level of the gradients , delivering a growing line of work that leverage the mini-batch gradient variance for learning rate selection ( Byrd et al. , 2012 ; Balles et al. , 2016 ; Balles and Hennig , 2017 ; De et al. , 2017 ; Zhang and Mitliagkas , 2017 ; McCandlish et al. , 2018 ) . 2 THE SPLITSGD ALGORITHM . In this section , we first develop the Splitting Diagnostic for stationarity detection , followed by the introduction of the SplitSGD algorithm in detail . 2.1 DIAGNOSTIC VIA SPLITTING . Intuitively , the stationarity phase occurs when two independent threads with the same starting point are no longer moving along the same direction . This intuition is the motivation for our Splitting Diagnostic , which is presented in Algorithm 1 and described in what follows . We call ✓0 the initial value , even though later it will often have a different subscript based on the number of iterations already computed before starting the diagnostic . From the starting point , we run two SGD threads , each consisting of w windows of length l. For each thread k = 1 , 2 , we define g ( k ) t = g ( ✓ ( k ) t , Z ( k ) t+1 ) and the iterates are ✓ ( k ) t+1 = ✓ ( k ) t ⌘ · g ( k ) t , ( 4 ) where t 2 { 0 , ... , wl 1 } . On every thread we compute the average noisy gradient in each window , indexed by i = 1 , ... , w , which is ḡ ( k ) i : = 1 l lX j=1 g ( k ) ( i 1 ) ·l+j = ✓ ( k ) ( i 1 ) ·l+1 ✓ ( k ) i·l+1 l · ⌘ . ( 5 ) The length l of each window has the same function as the mini-batch parameter in mini-batch SGD ( Li et al. , 2014 ) , in the sense that a larger value of l aims to capture more of the true signal by averaging out the errors . At the end of the diagnostic , we have stored two vectors , each containing the average noisy gradients in the windows in each thread . Definition 2.1 . For i = 1 , ... , w , we define the gradient coherence with respect to the starting point of the Splitting Diagnostic ✓0 , the learning rate ⌘ , and the length of each window l , as Qi ( ✓0 , ⌘ , l ) = hḡ ( 1 ) i , ḡ ( 2 ) i i . ( 6 ) We will drop the dependence from the parameters and refer to it simply as Qi . The gradient coherence expresses the relative position of the average noisy gradients , and its sign indicates whether the SGD updates have reached stationarity . In fact , if in the two threads the noisy gradients are pointing on average in the same direction , it means that the signal is stronger than the noise , and the dynamic is still in its transient phase . On the contrary , as ( 3 ) suggests , when the gradient coherence is on average very close to zero , and it also assumes negative values thanks to its stochasticity , this indicates that the noise component in the gradient is now dominant , and stationarity has been reached . Of course these values , no matter how large l is , are subject to some randomness . Our diagnostic then considers the signs of Q1 , ... , Qw and returns a result based on the proportion of negative Qi . One output is a boolean value TD , defined as follows : TD = ( S if Pw i=1 ( 1 sign ( Qi ) ) /2 q · w N if Pw i=1 ( 1 sign ( Qi ) ) /2 < q · w. ( 7 ) where TD = S indicates that stationarity has been detected , and TD = N means non-stationarity . The parameter q 2 [ 0 , 1 ] controls the tightness of this guarantee , being the smallest proportion of negative Qi required to declare stationarity . In addition to TD , we also return the average last iterate of the two threads as a starting point for following iterations . We call it ✓D : = ( ✓ ( 1 ) w·l + ✓ ( 2 ) w·l ) /2 .
This paper proposes a sign-based test to determine if a stochastic process is in its stationary state or not. Unlike Pflug test, this test uses two independent trajectories to build its test. It divides each trajectory into w parts and averages the gradients insides each part. Then measure the similarity of each average of one trajectory to the corresponding average from the other trajectory via dot product and then counting the negative signs and positive signs. When the negative signs are above a threshold then the process is its stationary station. Then it shrinks the step size of SGD for future iterations.
SP:3bec5e8e3ab7e3d9db7b34ba9268be3844f7acc2
Robust Learning Rate Selection for Stochastic Optimization via Splitting Diagnostic
1 INTRODUCTION . Many machine learning problems boil down to finding a minimizer ✓⇤ 2 Rd of a risk function taking the form F ( ✓ ) = E [ f ( ✓ , Z ) ] , ( 1 ) where f denotes a loss function , ✓ is the model parameter , and the random data point Z = ( X , y ) contains a feature vector X and its label y . In the case of a finite population , for example , this problem is reduced to the empirical minimization problem . The touchstone method for minimizing ( 1 ) is stochastic gradient descent ( SGD ) . Starting from an initial point ✓0 , SGD updates the iterates according to ✓t+1 = ✓t ⌘t · g ( ✓t , Zt+1 ) ( 2 ) for t 0 , where ⌘t is the learning rate , { Zt } 1t=1 are i.i.d . copies of Z and g ( ✓ , Z ) is the ( sub- ) gradient of f ( ✓ , Z ) with respect to ✓ . The noisy gradient g ( ✓ , Z ) is an unbiased estimate for the true gradient rF ( ✓ ) in the sense that E [ g ( ✓ , Z ) ] = rF ( ✓ ) for any ✓ . The convergence rate of SGD crucially depends on the learning rate—often recognized as “ the single most important hyper-parameter ” in training deep neural networks ( Bengio , 2012 ) —and , accordingly , there is a vast literature on how to decrease this fundamental tuning parameter for improved convergence performance . In the pioneering work of Robbins and Monro ( 1951 ) , the learning rate ⌘t is set to O ( 1/t ) for convex objectives . Later , it was recognized that a slowly decreasing learning rate in conjunction with iterate averaging leads to a faster rate of convergence for strongly convex and smooth objectives ( Ruppert , 1988 ; Polyak and Juditsky , 1992 ) . More recently , extensive effort has been devoted to incorporating preconditioning/Hessians into learning rate selection rules ( Duchi et al. , 2011 ; Dauphin et al. , 2015 ; Tan et al. , 2016 ) . Among numerous proposals , a simple yet widely employed approach is to repeatedly halve the learning rate after performing a pre-determined number of iterations ( see , for example , Bottou et al. , 2018 ) . In this paper , we introduce a new variant of SGD that we term SplitSGD with a novel learning rate selection rule . At a high level , our new method is motivated by the following fact : an optimal learning rate should be adaptive to the informativeness of the noisy gradient g ( ✓t , Zt+1 ) . Roughly speaking , the informativeness is higher if the true gradient rF ( ✓t ) is relatively large compared with the noise rF ( ✓t ) g ( ✓t , Zt+1 ) and vice versa . On the one hand , if the learning rate is too small with respect to the informativeness of the noisy gradient , SGD makes rather slow progress . On the other hand , the iterates would bounce around a region of an optimum of the objective if the learning rate is too large with respect to the informativeness . The latter case corresponds to a stationary phase in stochastic optimization ( Murata , 1998 ; Chee and Toulis , 2018 ) , which necessitates the reduction of the learning rate for better convergence . Specifically , let ⇡⌘ be the stationary distribution for ✓ when the learning rate is constant and set to ⌘ . From ( 2 ) one has that E✓⇠⇡⌘ [ g ( ✓ , Z ) ] = 0 , and consequently that E [ hg ( ✓ ( 1 ) , Z ( 1 ) ) , g ( ✓ ( 2 ) , Z ( 2 ) ) i ] = 0 for ✓ ( 1 ) , ✓ ( 2 ) i.i.d.⇠ ⇡⌘ , Z ( 1 ) , Z ( 2 ) i.i.d.⇠ Z ( 3 ) SplitSGD differs from other stochastic optimization procedures in its robust stationarity phase detection , which we refer to as the Splitting Diagnostic . In short , this diagnostic runs two SGD threads initialized at the same iterate using independent data points ( refers to Zt+1 in ( 2 ) ) , and then performs hypothesis testing to determine whether the learning rate leads to a stationary phase or not . The effectiveness of the Splitting Diagnostic is illustrated in Figure 1 , which reveals different patterns of dependence between the two SGD threads with difference learning rates . Loosely speaking , in the stationary phase ( in purple ) , the two SGD threads behave as if they are independent due to a large learning rate , and SplitSGD subsequently decreases the learning rate by some factor . In contrast , strong positive dependence is exhibited in the non stationary phase ( in orange ) and , thus , the learning rate remains the same after the diagnostic . In essence , the robustness of the Splitting Diagnostic is attributed to its adaptivity to the local geometry of the objec- confirmed by our experimental results in both convex and non-convex settings . In the latter , SplitSGD showed robustness with respect to the choice of the initial learning rate , and remarkable success in improving the test accuracy and avoiding overfitting compared to classic optimization procedures . 1.1 RELATED WORK . There is a long history of detecting stationarity or non-stationarity in stochastic optimization to improve convergence rates ( Yin , 1989 ; Pflug , 1990 ; Delyon and Juditsky , 1993 ; Murata , 1998 ; Pesme et al. , 2020 ) . Perhaps the most relevant work in this vein to the present paper is Chee and Toulis ( 2018 ) , which builds on top of Pflug ( 1990 ) for general convex functions . Specifically , this work uses the running sum of the inner products of successive stochastic gradients for stationarity detection . However , this approach does not take into account the strong correlation between consecutive gradients and , moreover , is not sensitive to the local curvature of the current iterates due to unwanted influence from prior gradients . In contrast , the splitting strategy , which is akin to HiGrad ( Su and Zhu , 2018 ) , allows our SplitSGD to concentrate on the current gradients and leverage the regained independence of gradients to test stationarity . Lately , Yaida ( 2019 ) and Lang et al . ( 2019 ) derive a stationarity detection rule that is based on gradients of a mini-batch to tune the learning rate in SGD with momentum . From a different angle , another related line of work is concerned with the relationship between the informativeness of gradients and the mini-batch size ( Keskar et al. , 2016 ; Yin et al. , 2017 ; Li et al. , 2017 ; Smith et al. , 2017 ) . Among others , it has been recognized that the optimal mini-batch size should be adaptive to the local geometry of the objective function and the noise level of the gradients , delivering a growing line of work that leverage the mini-batch gradient variance for learning rate selection ( Byrd et al. , 2012 ; Balles et al. , 2016 ; Balles and Hennig , 2017 ; De et al. , 2017 ; Zhang and Mitliagkas , 2017 ; McCandlish et al. , 2018 ) . 2 THE SPLITSGD ALGORITHM . In this section , we first develop the Splitting Diagnostic for stationarity detection , followed by the introduction of the SplitSGD algorithm in detail . 2.1 DIAGNOSTIC VIA SPLITTING . Intuitively , the stationarity phase occurs when two independent threads with the same starting point are no longer moving along the same direction . This intuition is the motivation for our Splitting Diagnostic , which is presented in Algorithm 1 and described in what follows . We call ✓0 the initial value , even though later it will often have a different subscript based on the number of iterations already computed before starting the diagnostic . From the starting point , we run two SGD threads , each consisting of w windows of length l. For each thread k = 1 , 2 , we define g ( k ) t = g ( ✓ ( k ) t , Z ( k ) t+1 ) and the iterates are ✓ ( k ) t+1 = ✓ ( k ) t ⌘ · g ( k ) t , ( 4 ) where t 2 { 0 , ... , wl 1 } . On every thread we compute the average noisy gradient in each window , indexed by i = 1 , ... , w , which is ḡ ( k ) i : = 1 l lX j=1 g ( k ) ( i 1 ) ·l+j = ✓ ( k ) ( i 1 ) ·l+1 ✓ ( k ) i·l+1 l · ⌘ . ( 5 ) The length l of each window has the same function as the mini-batch parameter in mini-batch SGD ( Li et al. , 2014 ) , in the sense that a larger value of l aims to capture more of the true signal by averaging out the errors . At the end of the diagnostic , we have stored two vectors , each containing the average noisy gradients in the windows in each thread . Definition 2.1 . For i = 1 , ... , w , we define the gradient coherence with respect to the starting point of the Splitting Diagnostic ✓0 , the learning rate ⌘ , and the length of each window l , as Qi ( ✓0 , ⌘ , l ) = hḡ ( 1 ) i , ḡ ( 2 ) i i . ( 6 ) We will drop the dependence from the parameters and refer to it simply as Qi . The gradient coherence expresses the relative position of the average noisy gradients , and its sign indicates whether the SGD updates have reached stationarity . In fact , if in the two threads the noisy gradients are pointing on average in the same direction , it means that the signal is stronger than the noise , and the dynamic is still in its transient phase . On the contrary , as ( 3 ) suggests , when the gradient coherence is on average very close to zero , and it also assumes negative values thanks to its stochasticity , this indicates that the noise component in the gradient is now dominant , and stationarity has been reached . Of course these values , no matter how large l is , are subject to some randomness . Our diagnostic then considers the signs of Q1 , ... , Qw and returns a result based on the proportion of negative Qi . One output is a boolean value TD , defined as follows : TD = ( S if Pw i=1 ( 1 sign ( Qi ) ) /2 q · w N if Pw i=1 ( 1 sign ( Qi ) ) /2 < q · w. ( 7 ) where TD = S indicates that stationarity has been detected , and TD = N means non-stationarity . The parameter q 2 [ 0 , 1 ] controls the tightness of this guarantee , being the smallest proportion of negative Qi required to declare stationarity . In addition to TD , we also return the average last iterate of the two threads as a starting point for following iterations . We call it ✓D : = ( ✓ ( 1 ) w·l + ✓ ( 2 ) w·l ) /2 .
The paper focuses on estimating when stochastic gradient dynamics have reached a stationary phase by considering the inner product of pairwise stochastic trajectories referred to as threads. The chosen approach avoids strongly correlated estimates which leads to better mixing and more reliable identification of a stationary phase than previous work for certain problems. The proposed algorithm is specifically adapted for Deep Learning problems and performs well on the presented synthetic and real world problems.
SP:3bec5e8e3ab7e3d9db7b34ba9268be3844f7acc2
Robust Learning Rate Selection for Stochastic Optimization via Splitting Diagnostic
1 INTRODUCTION . Many machine learning problems boil down to finding a minimizer ✓⇤ 2 Rd of a risk function taking the form F ( ✓ ) = E [ f ( ✓ , Z ) ] , ( 1 ) where f denotes a loss function , ✓ is the model parameter , and the random data point Z = ( X , y ) contains a feature vector X and its label y . In the case of a finite population , for example , this problem is reduced to the empirical minimization problem . The touchstone method for minimizing ( 1 ) is stochastic gradient descent ( SGD ) . Starting from an initial point ✓0 , SGD updates the iterates according to ✓t+1 = ✓t ⌘t · g ( ✓t , Zt+1 ) ( 2 ) for t 0 , where ⌘t is the learning rate , { Zt } 1t=1 are i.i.d . copies of Z and g ( ✓ , Z ) is the ( sub- ) gradient of f ( ✓ , Z ) with respect to ✓ . The noisy gradient g ( ✓ , Z ) is an unbiased estimate for the true gradient rF ( ✓ ) in the sense that E [ g ( ✓ , Z ) ] = rF ( ✓ ) for any ✓ . The convergence rate of SGD crucially depends on the learning rate—often recognized as “ the single most important hyper-parameter ” in training deep neural networks ( Bengio , 2012 ) —and , accordingly , there is a vast literature on how to decrease this fundamental tuning parameter for improved convergence performance . In the pioneering work of Robbins and Monro ( 1951 ) , the learning rate ⌘t is set to O ( 1/t ) for convex objectives . Later , it was recognized that a slowly decreasing learning rate in conjunction with iterate averaging leads to a faster rate of convergence for strongly convex and smooth objectives ( Ruppert , 1988 ; Polyak and Juditsky , 1992 ) . More recently , extensive effort has been devoted to incorporating preconditioning/Hessians into learning rate selection rules ( Duchi et al. , 2011 ; Dauphin et al. , 2015 ; Tan et al. , 2016 ) . Among numerous proposals , a simple yet widely employed approach is to repeatedly halve the learning rate after performing a pre-determined number of iterations ( see , for example , Bottou et al. , 2018 ) . In this paper , we introduce a new variant of SGD that we term SplitSGD with a novel learning rate selection rule . At a high level , our new method is motivated by the following fact : an optimal learning rate should be adaptive to the informativeness of the noisy gradient g ( ✓t , Zt+1 ) . Roughly speaking , the informativeness is higher if the true gradient rF ( ✓t ) is relatively large compared with the noise rF ( ✓t ) g ( ✓t , Zt+1 ) and vice versa . On the one hand , if the learning rate is too small with respect to the informativeness of the noisy gradient , SGD makes rather slow progress . On the other hand , the iterates would bounce around a region of an optimum of the objective if the learning rate is too large with respect to the informativeness . The latter case corresponds to a stationary phase in stochastic optimization ( Murata , 1998 ; Chee and Toulis , 2018 ) , which necessitates the reduction of the learning rate for better convergence . Specifically , let ⇡⌘ be the stationary distribution for ✓ when the learning rate is constant and set to ⌘ . From ( 2 ) one has that E✓⇠⇡⌘ [ g ( ✓ , Z ) ] = 0 , and consequently that E [ hg ( ✓ ( 1 ) , Z ( 1 ) ) , g ( ✓ ( 2 ) , Z ( 2 ) ) i ] = 0 for ✓ ( 1 ) , ✓ ( 2 ) i.i.d.⇠ ⇡⌘ , Z ( 1 ) , Z ( 2 ) i.i.d.⇠ Z ( 3 ) SplitSGD differs from other stochastic optimization procedures in its robust stationarity phase detection , which we refer to as the Splitting Diagnostic . In short , this diagnostic runs two SGD threads initialized at the same iterate using independent data points ( refers to Zt+1 in ( 2 ) ) , and then performs hypothesis testing to determine whether the learning rate leads to a stationary phase or not . The effectiveness of the Splitting Diagnostic is illustrated in Figure 1 , which reveals different patterns of dependence between the two SGD threads with difference learning rates . Loosely speaking , in the stationary phase ( in purple ) , the two SGD threads behave as if they are independent due to a large learning rate , and SplitSGD subsequently decreases the learning rate by some factor . In contrast , strong positive dependence is exhibited in the non stationary phase ( in orange ) and , thus , the learning rate remains the same after the diagnostic . In essence , the robustness of the Splitting Diagnostic is attributed to its adaptivity to the local geometry of the objec- confirmed by our experimental results in both convex and non-convex settings . In the latter , SplitSGD showed robustness with respect to the choice of the initial learning rate , and remarkable success in improving the test accuracy and avoiding overfitting compared to classic optimization procedures . 1.1 RELATED WORK . There is a long history of detecting stationarity or non-stationarity in stochastic optimization to improve convergence rates ( Yin , 1989 ; Pflug , 1990 ; Delyon and Juditsky , 1993 ; Murata , 1998 ; Pesme et al. , 2020 ) . Perhaps the most relevant work in this vein to the present paper is Chee and Toulis ( 2018 ) , which builds on top of Pflug ( 1990 ) for general convex functions . Specifically , this work uses the running sum of the inner products of successive stochastic gradients for stationarity detection . However , this approach does not take into account the strong correlation between consecutive gradients and , moreover , is not sensitive to the local curvature of the current iterates due to unwanted influence from prior gradients . In contrast , the splitting strategy , which is akin to HiGrad ( Su and Zhu , 2018 ) , allows our SplitSGD to concentrate on the current gradients and leverage the regained independence of gradients to test stationarity . Lately , Yaida ( 2019 ) and Lang et al . ( 2019 ) derive a stationarity detection rule that is based on gradients of a mini-batch to tune the learning rate in SGD with momentum . From a different angle , another related line of work is concerned with the relationship between the informativeness of gradients and the mini-batch size ( Keskar et al. , 2016 ; Yin et al. , 2017 ; Li et al. , 2017 ; Smith et al. , 2017 ) . Among others , it has been recognized that the optimal mini-batch size should be adaptive to the local geometry of the objective function and the noise level of the gradients , delivering a growing line of work that leverage the mini-batch gradient variance for learning rate selection ( Byrd et al. , 2012 ; Balles et al. , 2016 ; Balles and Hennig , 2017 ; De et al. , 2017 ; Zhang and Mitliagkas , 2017 ; McCandlish et al. , 2018 ) . 2 THE SPLITSGD ALGORITHM . In this section , we first develop the Splitting Diagnostic for stationarity detection , followed by the introduction of the SplitSGD algorithm in detail . 2.1 DIAGNOSTIC VIA SPLITTING . Intuitively , the stationarity phase occurs when two independent threads with the same starting point are no longer moving along the same direction . This intuition is the motivation for our Splitting Diagnostic , which is presented in Algorithm 1 and described in what follows . We call ✓0 the initial value , even though later it will often have a different subscript based on the number of iterations already computed before starting the diagnostic . From the starting point , we run two SGD threads , each consisting of w windows of length l. For each thread k = 1 , 2 , we define g ( k ) t = g ( ✓ ( k ) t , Z ( k ) t+1 ) and the iterates are ✓ ( k ) t+1 = ✓ ( k ) t ⌘ · g ( k ) t , ( 4 ) where t 2 { 0 , ... , wl 1 } . On every thread we compute the average noisy gradient in each window , indexed by i = 1 , ... , w , which is ḡ ( k ) i : = 1 l lX j=1 g ( k ) ( i 1 ) ·l+j = ✓ ( k ) ( i 1 ) ·l+1 ✓ ( k ) i·l+1 l · ⌘ . ( 5 ) The length l of each window has the same function as the mini-batch parameter in mini-batch SGD ( Li et al. , 2014 ) , in the sense that a larger value of l aims to capture more of the true signal by averaging out the errors . At the end of the diagnostic , we have stored two vectors , each containing the average noisy gradients in the windows in each thread . Definition 2.1 . For i = 1 , ... , w , we define the gradient coherence with respect to the starting point of the Splitting Diagnostic ✓0 , the learning rate ⌘ , and the length of each window l , as Qi ( ✓0 , ⌘ , l ) = hḡ ( 1 ) i , ḡ ( 2 ) i i . ( 6 ) We will drop the dependence from the parameters and refer to it simply as Qi . The gradient coherence expresses the relative position of the average noisy gradients , and its sign indicates whether the SGD updates have reached stationarity . In fact , if in the two threads the noisy gradients are pointing on average in the same direction , it means that the signal is stronger than the noise , and the dynamic is still in its transient phase . On the contrary , as ( 3 ) suggests , when the gradient coherence is on average very close to zero , and it also assumes negative values thanks to its stochasticity , this indicates that the noise component in the gradient is now dominant , and stationarity has been reached . Of course these values , no matter how large l is , are subject to some randomness . Our diagnostic then considers the signs of Q1 , ... , Qw and returns a result based on the proportion of negative Qi . One output is a boolean value TD , defined as follows : TD = ( S if Pw i=1 ( 1 sign ( Qi ) ) /2 q · w N if Pw i=1 ( 1 sign ( Qi ) ) /2 < q · w. ( 7 ) where TD = S indicates that stationarity has been detected , and TD = N means non-stationarity . The parameter q 2 [ 0 , 1 ] controls the tightness of this guarantee , being the smallest proportion of negative Qi required to declare stationarity . In addition to TD , we also return the average last iterate of the two threads as a starting point for following iterations . We call it ✓D : = ( ✓ ( 1 ) w·l + ✓ ( 2 ) w·l ) /2 .
The paper introduces SplitSGD method that detects the stationary phase in the stochastic optimization process and shrinks the learning rate. The SplitSGD is based on the observation that before reaching the stationary phase, two random batches of data will likely to have the gradient aligned as the noise between different batches is dominated by the shared gradient, whereas after reaching the stationary phase, two random batches should have misaligned gradient as the gradient has become mainly noise. This observation is intuitive, and some theoretical results show that (a) at the beginning, the algorithm determines non-stationary with high probability, and (b) more important, the SplitSGD algorithm is guaranteed to converge with probability tending to 1. The experiment reveals the advantage of the SplitSGD method over alternative SGD algorithms for CNN, Resnet, and LSTM.
SP:3bec5e8e3ab7e3d9db7b34ba9268be3844f7acc2
Time Series Counterfactual Inference with Hidden Confounders
1 INTRODUCTION . Decision makers want to know how to produce desired outcomes and act accordingly , which requires causal understanding of cause and effect . In this paper , we consider applications in healthcare , where time series data on past features and outcomes are now widely available . Causality in time series have been long studied in statistics ( Box et al. , 2008 ) , and allows more powerful analysis than methods on time-independent data , like instrumental variable regression ( Stock & Trebbi , 2003 ) . However , temporal causality in statistics and econometrics focuses mainly on passively discovering time lag structure ( Eichler , 2012 ) . In contrast , decision-making applications need concrete interventions , which is more amenable to an interventionist approach to causality ( Woodward , 2005 ; Pearl , 2009 ) . To give one example , electronic health records ( EHR ) in healthcare provide an accessible history of a patient ’ s disease progression over time , together with their treatment records and their results . To identify effective treatments , a doctor may want to ask counterfactual questions ( Johansson et al. , 2016 ) , like “ Would this patient have lower blood sugar had she received a different medication ? ” Through such counterfactual analysis , medical professionals may hope to discover new cures and improve existing treatments . Similar situations arise in other use cases . For example , a user interface designer may want to ask “ Would the user have clicked on this ad had it been in a different color ? ” , substantiating their answer from counterfactual inference on clickstream data or other user behaviors . Counterfactual inference in time series has studied , assuming that all possible causal variables are observed ( Soleimani et al. , 2017 ; Schulam & Saria , 2017 ; Lim , 2018 ) . In practice , however , this assumption of perfect observability is not testable and too strong for many real-world scenarios ( Bica et al. , 2020 ) . For example , there are many ways in general to treat cancer , but each patient requires their own bespoke treatment plan based on unique characteristics of each case such as drug resistance and toxic response ( Vlachostergios & Faltas , 2018 ; Kroschinsky et al. , 2017 ; Bica et al. , 2020 ) . However , these factors are also likely to be unmeasurable in practice , or otherwise not recorded in EHRs . Detecting these hidden confounding variables is therefore crucial to avoid bias in the estimation of treatment effects . The challenge introduced by confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed a two-step method that estimates confounders with latent factor models , then infers potential outcomes with bias adjustment . However , confounders in time series can have their own dynamics , and can themselves be affected by the history of interventions . Subsequently , Bica et al . ( 2020 ) introducing recurrent neural networks ( RNNs ) into the factor model to estimate the dynamics of confounders . However , this method only works in discrete time setting with a fixed time step , due to how RNNs are structured . In this paper , we consider the continuous-time setting , which is more flexible in practice and provides more insights of the underlying mechanisms ( Chen et al. , 2018 ; Rubanova et al. , 2019 ) . The continuous-time setting is particularly important for healthcare , where there are many time-varying treatments , irregularly-sampled or partially observed time series ( Soleimani et al. , 2017 ) . The classical modeling approach to dynamics uses ordinary differential equations ( ODEs ) d ( x ( t ) ) /dt = f ( x ( t ) ) , encoding domain expertise of underlying mechanisms in the explicit specification of f . In contrast , Chen et al . ( 2018 ) introduced the concept of neural ODEs by parameterizing f with neural networks , thus allowing dynamics to be described by arbitrarily complicated functions . Several extensions handle even more complicated issues like irregular sampling or switching dynamics ( Jia & Benson , 2019 ; Kidger et al. , 2020 ) . However , these methods can not be directly applied to time series counterfactual inference , as they focus on initial value problems , which can not describe interventions without explicit modification of f ( Kidger et al. , 2020 ) . Furthermore , these existing methods can only handle hidden variables by explicitly describing their dynamics and interdependency with interventions , thus limiting their utility when confounders exist . Our contributions . We propose augmented counterfactual ODEs ( ACODEs ) to predict how a continuous-time time series will evolve under a sequence of interventions . Our method augments the observed time series with additional dimensions to represent confounders . We then construct counterfactual ODEs based on the neural ODE framework to model the effects of incoming interventions . The ACODE model has three key features . First , it allows for the presence of confounders that can reduce the prediction bias . Second , the ACODE can continuously incorporate incoming interventions using neural ODEs and support irregularly-sampled time series . Third , it demonstrates state-of-the-art performance against competitive baselines for counterfactual inference in both simulation of tumor growth and real-world time series of sepsis patients treatment response . Moreover , the ACODE provides an interface between machine learning and dominant modelling paradigm described in differential equations , which allows for well-understood domain knowledge to be applied to time series counterfactual inference . To the best of our knowledge , this represents the first method for counterfactual inference with confounders in the continuous-time setting . 2 RELATED WORK . Time series counterfactual inference stems from causal inference ( Pearl , 2009 ; Eichler , 2012 ) . A large body of pioneering work in causal inference focus on causal relations such as structural causal models ( Pearl , 2019 ) and Granger causality ( Eichler , 2007 ) . Counterfactual inference , on the other hand , focus on estimating the effects of actionable interventions , which is a pervasive problem in healthcare ( Hoover , 2018 ) . In literature , the difference between the counterfactual outcomes if an intervention had been taken or not is defined as the causal effect of the intervention ( Pearl , 2009 ) . Originated from the literature on observational studies ( Shadish et al. , 2002 ) , Rubin ’ s potential outcome framework has been a popular language to formalize counterfactuals and intervention effect estimate ( Rubin , 2005 ; Imbens & Rubin , 2015 ) . The problem of hidden confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed theory for adjusting the bias introduced by the presence of hidden confounders in the observational data . They found out that the dependencies in these multiple confounders can be used to infer latent variables and act as substitutes for the hidden confounders . In this paper , we are interested in considering hidden confounders in time series setting which is much more complicated than in the static setting . Not only because the hidden confounders may evolve over time , but also because they might be affected by previous interventions . On the other hand , most existing work on time series counterfactual inference including counterfactual Gaussian processes ( CGP ) ( Schulam & Saria , 2017 ) and recurrent marginal structural networks ( RMSNs ) ( Lim , 2018 ) assume there is no hidden confounders , i.e . all variables affecting the intervention plan and the potential outcomes are observed , which is not testable in practice and not true in many cases . Recently , Bica et al . ( 2020 ) applied the idea of latent factor models from Wang & Blei ( 2019 ) to the deconfounding of time series . However , their proposed method is based on recurrent neural networks , which works only with discrete and regularly-spaced time series . Differential equations have been introduced into causal and counterfactual inference in previous studies . Rubenstein et al . ( 2018 ) showed that equilibrium states of a first-order ODE system can be described with a deterministic structural causal model , even with non-constant interventions . This line of literature is centering around casual relations , which is a different focus from this work . On the other hand , differential equations with incoming information is a well-studied mathematical problem in the field of rough analysis , which is referred as controlled differential equations or rough differential equations . These approaches directly integrate with respect to incoming processes ( Friz & Victoir , 2010 ; Lyons et al. , 2007 ) . Neural Ordinary Differential Equations Neural ODEs ( Chen et al. , 2018 ) are a family of continuous-time models . Starting from an initial state z ( t0 ) , it evolves following a neural network based differential equations . The state at any time ti is given by integrating an ODE forward in time : dz ( t ) dt = f ( z ( t ) , t ; θ ) , z ( ti ) = z ( t0 ) + ∫ ti t0 dz ( t ) dt dt ( 1 ) where f is a neural network parametrized by θ . Given the initial state , states at any desired time stamps can be evaluated with a numerical ODE solver : z0 , z1 , ... , zN = ODESolve ( fθ , z ( t0 ) , ( t0 , t1 , ... , tN ) ) ( 2 ) More importantly , Chen et al . ( 2018 ) proposed to use the adjoint method to compute the gradient with respect to the parameters θ as long as f is uniformly Lipschitz continuous in z ( t ) and continuous in t. This allows ODE solvers to be used as a black box building block in large models . 3 PROBLEM FORMULATION . Consider a multivariate time series x ( t ) and continuous-time time-dependent interventions a ( t ) . The observational data consists of multiple realizations of above mentioned time series and interventions . Given that realizations are independent to each other , we only consider one realization in following part for simplicity . In a realization up to time t , we observe N time series data points and their timestamps { xi , ti } Ni=1 along with continuous-time interventions { a ( s ) : s ≤ t } . We would like to infer the potential outcome under future interventions given all historical information for any potential intervention plan { a ( s ) : s > t } . We will abuse the notation of a > t and { a ( s ) : s > t } in following sections . Our goal is to infer the following distribution : p ( x ( a > t ) |a≤t , { xi , txi } Ni=1 ) ( 3 ) where x ( a > t ) denotes the potential outcome of future time series x under future intervention a > t . Although we can not directly model this objective distribution , we can instead fit a regression model to estimate p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) from observational data ( Rubin , 1978 ) . For cases without hidden confounders , this lead to unbiased estimation of potential outcome p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) = p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) under certain assumptions , including sequential strong ignorability ( Fitzmaurice et al. , 2008 ) : z ( a≥t ) ⊥⊥ a ( t ) |a < t , x≤t for ∀a≥t ( 4 ) This condition holds if there are no hidden confounders , which can not be tested in practice since counterfactual outcomes are never observed in practice . With the presence of hidden confounders , the above assumption is no longer valid and p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) 6= p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) ( 5 ) Consequently , existing methods which infer conditional distribution p ( x > t|a > t , a < t , { xi , txi } Ni=1 ) from observed data would result in biased estimation of potential outcome .
This paper proposed to solve an interesting problem: how do we perform counterfactual inference for time series data? The paper follows a study of the problem in the static setting: in the first step, the paper fit an augmented time series $u_t$ as additional confounders, and then perform inference based on the augmented time series. The experiments presented appear promising to the time series inference problem.
SP:338bac3f8bfe06a38ef55fc3b56d326b848e133e
Time Series Counterfactual Inference with Hidden Confounders
1 INTRODUCTION . Decision makers want to know how to produce desired outcomes and act accordingly , which requires causal understanding of cause and effect . In this paper , we consider applications in healthcare , where time series data on past features and outcomes are now widely available . Causality in time series have been long studied in statistics ( Box et al. , 2008 ) , and allows more powerful analysis than methods on time-independent data , like instrumental variable regression ( Stock & Trebbi , 2003 ) . However , temporal causality in statistics and econometrics focuses mainly on passively discovering time lag structure ( Eichler , 2012 ) . In contrast , decision-making applications need concrete interventions , which is more amenable to an interventionist approach to causality ( Woodward , 2005 ; Pearl , 2009 ) . To give one example , electronic health records ( EHR ) in healthcare provide an accessible history of a patient ’ s disease progression over time , together with their treatment records and their results . To identify effective treatments , a doctor may want to ask counterfactual questions ( Johansson et al. , 2016 ) , like “ Would this patient have lower blood sugar had she received a different medication ? ” Through such counterfactual analysis , medical professionals may hope to discover new cures and improve existing treatments . Similar situations arise in other use cases . For example , a user interface designer may want to ask “ Would the user have clicked on this ad had it been in a different color ? ” , substantiating their answer from counterfactual inference on clickstream data or other user behaviors . Counterfactual inference in time series has studied , assuming that all possible causal variables are observed ( Soleimani et al. , 2017 ; Schulam & Saria , 2017 ; Lim , 2018 ) . In practice , however , this assumption of perfect observability is not testable and too strong for many real-world scenarios ( Bica et al. , 2020 ) . For example , there are many ways in general to treat cancer , but each patient requires their own bespoke treatment plan based on unique characteristics of each case such as drug resistance and toxic response ( Vlachostergios & Faltas , 2018 ; Kroschinsky et al. , 2017 ; Bica et al. , 2020 ) . However , these factors are also likely to be unmeasurable in practice , or otherwise not recorded in EHRs . Detecting these hidden confounding variables is therefore crucial to avoid bias in the estimation of treatment effects . The challenge introduced by confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed a two-step method that estimates confounders with latent factor models , then infers potential outcomes with bias adjustment . However , confounders in time series can have their own dynamics , and can themselves be affected by the history of interventions . Subsequently , Bica et al . ( 2020 ) introducing recurrent neural networks ( RNNs ) into the factor model to estimate the dynamics of confounders . However , this method only works in discrete time setting with a fixed time step , due to how RNNs are structured . In this paper , we consider the continuous-time setting , which is more flexible in practice and provides more insights of the underlying mechanisms ( Chen et al. , 2018 ; Rubanova et al. , 2019 ) . The continuous-time setting is particularly important for healthcare , where there are many time-varying treatments , irregularly-sampled or partially observed time series ( Soleimani et al. , 2017 ) . The classical modeling approach to dynamics uses ordinary differential equations ( ODEs ) d ( x ( t ) ) /dt = f ( x ( t ) ) , encoding domain expertise of underlying mechanisms in the explicit specification of f . In contrast , Chen et al . ( 2018 ) introduced the concept of neural ODEs by parameterizing f with neural networks , thus allowing dynamics to be described by arbitrarily complicated functions . Several extensions handle even more complicated issues like irregular sampling or switching dynamics ( Jia & Benson , 2019 ; Kidger et al. , 2020 ) . However , these methods can not be directly applied to time series counterfactual inference , as they focus on initial value problems , which can not describe interventions without explicit modification of f ( Kidger et al. , 2020 ) . Furthermore , these existing methods can only handle hidden variables by explicitly describing their dynamics and interdependency with interventions , thus limiting their utility when confounders exist . Our contributions . We propose augmented counterfactual ODEs ( ACODEs ) to predict how a continuous-time time series will evolve under a sequence of interventions . Our method augments the observed time series with additional dimensions to represent confounders . We then construct counterfactual ODEs based on the neural ODE framework to model the effects of incoming interventions . The ACODE model has three key features . First , it allows for the presence of confounders that can reduce the prediction bias . Second , the ACODE can continuously incorporate incoming interventions using neural ODEs and support irregularly-sampled time series . Third , it demonstrates state-of-the-art performance against competitive baselines for counterfactual inference in both simulation of tumor growth and real-world time series of sepsis patients treatment response . Moreover , the ACODE provides an interface between machine learning and dominant modelling paradigm described in differential equations , which allows for well-understood domain knowledge to be applied to time series counterfactual inference . To the best of our knowledge , this represents the first method for counterfactual inference with confounders in the continuous-time setting . 2 RELATED WORK . Time series counterfactual inference stems from causal inference ( Pearl , 2009 ; Eichler , 2012 ) . A large body of pioneering work in causal inference focus on causal relations such as structural causal models ( Pearl , 2019 ) and Granger causality ( Eichler , 2007 ) . Counterfactual inference , on the other hand , focus on estimating the effects of actionable interventions , which is a pervasive problem in healthcare ( Hoover , 2018 ) . In literature , the difference between the counterfactual outcomes if an intervention had been taken or not is defined as the causal effect of the intervention ( Pearl , 2009 ) . Originated from the literature on observational studies ( Shadish et al. , 2002 ) , Rubin ’ s potential outcome framework has been a popular language to formalize counterfactuals and intervention effect estimate ( Rubin , 2005 ; Imbens & Rubin , 2015 ) . The problem of hidden confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed theory for adjusting the bias introduced by the presence of hidden confounders in the observational data . They found out that the dependencies in these multiple confounders can be used to infer latent variables and act as substitutes for the hidden confounders . In this paper , we are interested in considering hidden confounders in time series setting which is much more complicated than in the static setting . Not only because the hidden confounders may evolve over time , but also because they might be affected by previous interventions . On the other hand , most existing work on time series counterfactual inference including counterfactual Gaussian processes ( CGP ) ( Schulam & Saria , 2017 ) and recurrent marginal structural networks ( RMSNs ) ( Lim , 2018 ) assume there is no hidden confounders , i.e . all variables affecting the intervention plan and the potential outcomes are observed , which is not testable in practice and not true in many cases . Recently , Bica et al . ( 2020 ) applied the idea of latent factor models from Wang & Blei ( 2019 ) to the deconfounding of time series . However , their proposed method is based on recurrent neural networks , which works only with discrete and regularly-spaced time series . Differential equations have been introduced into causal and counterfactual inference in previous studies . Rubenstein et al . ( 2018 ) showed that equilibrium states of a first-order ODE system can be described with a deterministic structural causal model , even with non-constant interventions . This line of literature is centering around casual relations , which is a different focus from this work . On the other hand , differential equations with incoming information is a well-studied mathematical problem in the field of rough analysis , which is referred as controlled differential equations or rough differential equations . These approaches directly integrate with respect to incoming processes ( Friz & Victoir , 2010 ; Lyons et al. , 2007 ) . Neural Ordinary Differential Equations Neural ODEs ( Chen et al. , 2018 ) are a family of continuous-time models . Starting from an initial state z ( t0 ) , it evolves following a neural network based differential equations . The state at any time ti is given by integrating an ODE forward in time : dz ( t ) dt = f ( z ( t ) , t ; θ ) , z ( ti ) = z ( t0 ) + ∫ ti t0 dz ( t ) dt dt ( 1 ) where f is a neural network parametrized by θ . Given the initial state , states at any desired time stamps can be evaluated with a numerical ODE solver : z0 , z1 , ... , zN = ODESolve ( fθ , z ( t0 ) , ( t0 , t1 , ... , tN ) ) ( 2 ) More importantly , Chen et al . ( 2018 ) proposed to use the adjoint method to compute the gradient with respect to the parameters θ as long as f is uniformly Lipschitz continuous in z ( t ) and continuous in t. This allows ODE solvers to be used as a black box building block in large models . 3 PROBLEM FORMULATION . Consider a multivariate time series x ( t ) and continuous-time time-dependent interventions a ( t ) . The observational data consists of multiple realizations of above mentioned time series and interventions . Given that realizations are independent to each other , we only consider one realization in following part for simplicity . In a realization up to time t , we observe N time series data points and their timestamps { xi , ti } Ni=1 along with continuous-time interventions { a ( s ) : s ≤ t } . We would like to infer the potential outcome under future interventions given all historical information for any potential intervention plan { a ( s ) : s > t } . We will abuse the notation of a > t and { a ( s ) : s > t } in following sections . Our goal is to infer the following distribution : p ( x ( a > t ) |a≤t , { xi , txi } Ni=1 ) ( 3 ) where x ( a > t ) denotes the potential outcome of future time series x under future intervention a > t . Although we can not directly model this objective distribution , we can instead fit a regression model to estimate p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) from observational data ( Rubin , 1978 ) . For cases without hidden confounders , this lead to unbiased estimation of potential outcome p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) = p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) under certain assumptions , including sequential strong ignorability ( Fitzmaurice et al. , 2008 ) : z ( a≥t ) ⊥⊥ a ( t ) |a < t , x≤t for ∀a≥t ( 4 ) This condition holds if there are no hidden confounders , which can not be tested in practice since counterfactual outcomes are never observed in practice . With the presence of hidden confounders , the above assumption is no longer valid and p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) 6= p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) ( 5 ) Consequently , existing methods which infer conditional distribution p ( x > t|a > t , a < t , { xi , txi } Ni=1 ) from observed data would result in biased estimation of potential outcome .
In this manuscript, the authors propose a novel way of performing counterfactual inference in time-series in the presence of hidden confounders. For this, they employ neural ODEs as a latent time-series model, which they augment with additional latent variables. They test their approach on synthetic and real-world data and demonstrate improved performance in comparison to the state-of-the-art.
SP:338bac3f8bfe06a38ef55fc3b56d326b848e133e
Time Series Counterfactual Inference with Hidden Confounders
1 INTRODUCTION . Decision makers want to know how to produce desired outcomes and act accordingly , which requires causal understanding of cause and effect . In this paper , we consider applications in healthcare , where time series data on past features and outcomes are now widely available . Causality in time series have been long studied in statistics ( Box et al. , 2008 ) , and allows more powerful analysis than methods on time-independent data , like instrumental variable regression ( Stock & Trebbi , 2003 ) . However , temporal causality in statistics and econometrics focuses mainly on passively discovering time lag structure ( Eichler , 2012 ) . In contrast , decision-making applications need concrete interventions , which is more amenable to an interventionist approach to causality ( Woodward , 2005 ; Pearl , 2009 ) . To give one example , electronic health records ( EHR ) in healthcare provide an accessible history of a patient ’ s disease progression over time , together with their treatment records and their results . To identify effective treatments , a doctor may want to ask counterfactual questions ( Johansson et al. , 2016 ) , like “ Would this patient have lower blood sugar had she received a different medication ? ” Through such counterfactual analysis , medical professionals may hope to discover new cures and improve existing treatments . Similar situations arise in other use cases . For example , a user interface designer may want to ask “ Would the user have clicked on this ad had it been in a different color ? ” , substantiating their answer from counterfactual inference on clickstream data or other user behaviors . Counterfactual inference in time series has studied , assuming that all possible causal variables are observed ( Soleimani et al. , 2017 ; Schulam & Saria , 2017 ; Lim , 2018 ) . In practice , however , this assumption of perfect observability is not testable and too strong for many real-world scenarios ( Bica et al. , 2020 ) . For example , there are many ways in general to treat cancer , but each patient requires their own bespoke treatment plan based on unique characteristics of each case such as drug resistance and toxic response ( Vlachostergios & Faltas , 2018 ; Kroschinsky et al. , 2017 ; Bica et al. , 2020 ) . However , these factors are also likely to be unmeasurable in practice , or otherwise not recorded in EHRs . Detecting these hidden confounding variables is therefore crucial to avoid bias in the estimation of treatment effects . The challenge introduced by confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed a two-step method that estimates confounders with latent factor models , then infers potential outcomes with bias adjustment . However , confounders in time series can have their own dynamics , and can themselves be affected by the history of interventions . Subsequently , Bica et al . ( 2020 ) introducing recurrent neural networks ( RNNs ) into the factor model to estimate the dynamics of confounders . However , this method only works in discrete time setting with a fixed time step , due to how RNNs are structured . In this paper , we consider the continuous-time setting , which is more flexible in practice and provides more insights of the underlying mechanisms ( Chen et al. , 2018 ; Rubanova et al. , 2019 ) . The continuous-time setting is particularly important for healthcare , where there are many time-varying treatments , irregularly-sampled or partially observed time series ( Soleimani et al. , 2017 ) . The classical modeling approach to dynamics uses ordinary differential equations ( ODEs ) d ( x ( t ) ) /dt = f ( x ( t ) ) , encoding domain expertise of underlying mechanisms in the explicit specification of f . In contrast , Chen et al . ( 2018 ) introduced the concept of neural ODEs by parameterizing f with neural networks , thus allowing dynamics to be described by arbitrarily complicated functions . Several extensions handle even more complicated issues like irregular sampling or switching dynamics ( Jia & Benson , 2019 ; Kidger et al. , 2020 ) . However , these methods can not be directly applied to time series counterfactual inference , as they focus on initial value problems , which can not describe interventions without explicit modification of f ( Kidger et al. , 2020 ) . Furthermore , these existing methods can only handle hidden variables by explicitly describing their dynamics and interdependency with interventions , thus limiting their utility when confounders exist . Our contributions . We propose augmented counterfactual ODEs ( ACODEs ) to predict how a continuous-time time series will evolve under a sequence of interventions . Our method augments the observed time series with additional dimensions to represent confounders . We then construct counterfactual ODEs based on the neural ODE framework to model the effects of incoming interventions . The ACODE model has three key features . First , it allows for the presence of confounders that can reduce the prediction bias . Second , the ACODE can continuously incorporate incoming interventions using neural ODEs and support irregularly-sampled time series . Third , it demonstrates state-of-the-art performance against competitive baselines for counterfactual inference in both simulation of tumor growth and real-world time series of sepsis patients treatment response . Moreover , the ACODE provides an interface between machine learning and dominant modelling paradigm described in differential equations , which allows for well-understood domain knowledge to be applied to time series counterfactual inference . To the best of our knowledge , this represents the first method for counterfactual inference with confounders in the continuous-time setting . 2 RELATED WORK . Time series counterfactual inference stems from causal inference ( Pearl , 2009 ; Eichler , 2012 ) . A large body of pioneering work in causal inference focus on causal relations such as structural causal models ( Pearl , 2019 ) and Granger causality ( Eichler , 2007 ) . Counterfactual inference , on the other hand , focus on estimating the effects of actionable interventions , which is a pervasive problem in healthcare ( Hoover , 2018 ) . In literature , the difference between the counterfactual outcomes if an intervention had been taken or not is defined as the causal effect of the intervention ( Pearl , 2009 ) . Originated from the literature on observational studies ( Shadish et al. , 2002 ) , Rubin ’ s potential outcome framework has been a popular language to formalize counterfactuals and intervention effect estimate ( Rubin , 2005 ; Imbens & Rubin , 2015 ) . The problem of hidden confounders in counterfactual inference was first studied in the static setting . Wang & Blei ( 2019 ) developed theory for adjusting the bias introduced by the presence of hidden confounders in the observational data . They found out that the dependencies in these multiple confounders can be used to infer latent variables and act as substitutes for the hidden confounders . In this paper , we are interested in considering hidden confounders in time series setting which is much more complicated than in the static setting . Not only because the hidden confounders may evolve over time , but also because they might be affected by previous interventions . On the other hand , most existing work on time series counterfactual inference including counterfactual Gaussian processes ( CGP ) ( Schulam & Saria , 2017 ) and recurrent marginal structural networks ( RMSNs ) ( Lim , 2018 ) assume there is no hidden confounders , i.e . all variables affecting the intervention plan and the potential outcomes are observed , which is not testable in practice and not true in many cases . Recently , Bica et al . ( 2020 ) applied the idea of latent factor models from Wang & Blei ( 2019 ) to the deconfounding of time series . However , their proposed method is based on recurrent neural networks , which works only with discrete and regularly-spaced time series . Differential equations have been introduced into causal and counterfactual inference in previous studies . Rubenstein et al . ( 2018 ) showed that equilibrium states of a first-order ODE system can be described with a deterministic structural causal model , even with non-constant interventions . This line of literature is centering around casual relations , which is a different focus from this work . On the other hand , differential equations with incoming information is a well-studied mathematical problem in the field of rough analysis , which is referred as controlled differential equations or rough differential equations . These approaches directly integrate with respect to incoming processes ( Friz & Victoir , 2010 ; Lyons et al. , 2007 ) . Neural Ordinary Differential Equations Neural ODEs ( Chen et al. , 2018 ) are a family of continuous-time models . Starting from an initial state z ( t0 ) , it evolves following a neural network based differential equations . The state at any time ti is given by integrating an ODE forward in time : dz ( t ) dt = f ( z ( t ) , t ; θ ) , z ( ti ) = z ( t0 ) + ∫ ti t0 dz ( t ) dt dt ( 1 ) where f is a neural network parametrized by θ . Given the initial state , states at any desired time stamps can be evaluated with a numerical ODE solver : z0 , z1 , ... , zN = ODESolve ( fθ , z ( t0 ) , ( t0 , t1 , ... , tN ) ) ( 2 ) More importantly , Chen et al . ( 2018 ) proposed to use the adjoint method to compute the gradient with respect to the parameters θ as long as f is uniformly Lipschitz continuous in z ( t ) and continuous in t. This allows ODE solvers to be used as a black box building block in large models . 3 PROBLEM FORMULATION . Consider a multivariate time series x ( t ) and continuous-time time-dependent interventions a ( t ) . The observational data consists of multiple realizations of above mentioned time series and interventions . Given that realizations are independent to each other , we only consider one realization in following part for simplicity . In a realization up to time t , we observe N time series data points and their timestamps { xi , ti } Ni=1 along with continuous-time interventions { a ( s ) : s ≤ t } . We would like to infer the potential outcome under future interventions given all historical information for any potential intervention plan { a ( s ) : s > t } . We will abuse the notation of a > t and { a ( s ) : s > t } in following sections . Our goal is to infer the following distribution : p ( x ( a > t ) |a≤t , { xi , txi } Ni=1 ) ( 3 ) where x ( a > t ) denotes the potential outcome of future time series x under future intervention a > t . Although we can not directly model this objective distribution , we can instead fit a regression model to estimate p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) from observational data ( Rubin , 1978 ) . For cases without hidden confounders , this lead to unbiased estimation of potential outcome p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) = p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) under certain assumptions , including sequential strong ignorability ( Fitzmaurice et al. , 2008 ) : z ( a≥t ) ⊥⊥ a ( t ) |a < t , x≤t for ∀a≥t ( 4 ) This condition holds if there are no hidden confounders , which can not be tested in practice since counterfactual outcomes are never observed in practice . With the presence of hidden confounders , the above assumption is no longer valid and p ( x ( a > t ) |a≤t , { xi , ti } Ni=1 ) 6= p ( x > t|a > t , a≤t , { xi , ti } Ni=1 ) ( 5 ) Consequently , existing methods which infer conditional distribution p ( x > t|a > t , a < t , { xi , txi } Ni=1 ) from observed data would result in biased estimation of potential outcome .
The authors propose a new method, called augmented counterfactual ordinary differential equations (ACODs), to do counterfactual inference on time series data in healthcare. This is done by modelling interventions in continuous time with differential equations augmented by auxiliary confounding variables to reduce bias. They demonstrate the proposed method on tumor growth simulation and sepsis patient treatment response.
SP:338bac3f8bfe06a38ef55fc3b56d326b848e133e
Measuring Progress in Deep Reinforcement Learning Sample Efficiency
1 INTRODUCTION . Recent successes of deep reinforcement learning ( DRL ) in Go ( Silver et al. , 2016 ; 2017 ; 2018 ) and complex real-time strategy games ( Berner et al. , 2019 ; Vinyals et al. , 2019 ) indicate the vast potential for automating complex economically relevant tasks like assembling goods in non-standardized environments or physically assisting humans using DRL . However , sample efficiency is likely to remain an important bottleneck for the economic feasibility of real world applications of DRL . This is because samples of state transitions in the environment caused by an agent ’ s action are essential for training DRL agents but automated systems interacting with the real world are often fragile , slow or costly , which makes DRL training in the real world expensive both in terms of money and time ( Dulac-Arnold et al. , 2019 ) . As most widely used benchmarks in DRL still consist of computer games and simulations where samples can be obtained risk-free , fast and cheaply1 , progress in DRL does not necessarily translate to future real world applications unless it corresponds to progress in sample efficiency or simulation accuracy and transfer learning . This makes information about progress in sample efficiency an important input to researchers studying topics like the future of employment ( Frey & Osborne , 2017 ) , the potential for malicious uses of DRL ( Brundage et al. , 2018 ) and other potentially transformative impacts of AI systems in the future ( Gruetzemacher & Whittlestone , 2019 ) . 2 BACKGROUND AND RELATED WORK . 2.1 SAMPLE EFFICIENCY . While research on progress in the field of AI used to have a strong focus on benchmark performance metrics in AI ( Eckersley & Nasser , 2017 ) , there have been calls to pay more attention to the importance of other metrics : Martinez-Plumed et al . ( 2018 ) enumerate previously neglected dimensions of AI progress and explore the relationship between computing resources and final performance in RL . The wider implications of sample efficiency , more specifically , are explored by Tucker et al . ( 2020 ) . While their scope is broader than DRL , most of their points do apply to reinforcement learning as a 1Espeholt et al . ( 2019 ) reach up to 2.4 M FPS and 1 B frames per 25 $ on DM Lab ( Beattie et al. , 2016 ) . special case of AI technology . For example , as the authors point out , robotics is an especially important case of a data-limited domain , in which new applications are likely to be unlocked for many actors with improved sample efficiency . While some benchmark papers make explicit quantitative comparisons of sample efficiency ( or “ data efficiency ” ) to isolated previous methods ( Hessel et al. , 2018 ; Hafner et al. , 2019a ; Kaiser et al. , 2019 ; Srinivas et al. , 2020 ) , we are not aware of any more systematic investigation of sample efficiency in DRL . 2.2 COMPUTING POWER AND SCALING LAWS . While DRL and other applications of deep learning have produced many impressive results , this has gone hand in hand with an ever-increasing amount of computing power ( compute ) being devoted to model training : Compute usage for large AI projects has been in line with Moore ’ s law prior to 2012 ( Sastry et al. , 2019 ) , but saw a doubling time of 3.4-months in the 2012 to 2018 period , which is seven times faster than Moore ’ s law ( Amodei & Hernandez , 2018 ) . Compute usage would not increase if there was nothing to gain : For example , the performance of Transformer-based language models ( Vaswani et al. , 2017 ) follows a power law in the number of model parameters when differently sized models are trained on the same dataset indicating that in the current regime , Transformer language models become more sample efficient with more parameters . Data is still important , as there is another power law relating dataset size for models with the same amount of parameters to performance ( Kaplan et al. , 2020 ) . Things likely look similar for the ImageNet benchmark ( Deng et al. , 2009 ) where progress has long been accompanied by larger models using a fixed amount of data ( Sun et al. , 2017 ) while recent progress relies on additional data ( Touvron et al. , 2019 ) . 2.3 ALGORITHMIC PROGRESS AND INCREASED EFFICIENCY . As increased sample usage might make progress in DRL look faster , increased compute usage might do so for machine learning . Grace ( 2013 ) found that hardware improvements account for half of the progress for several problems in the vicinity of AI research like computer chess , computer go and physics simulations . More recently , Fichte et al . ( 2020 ) observed the same for progress in SAT solvers . In the realm of deep learning , Hernandez & Brown ( 2020 ) investigated improvements in algorithmic efficiency by holding final performance on various benchmarks constant and analyzing how the number of FLOPS needed to reach that level changed over time . They find that this amount of compute needed to reach the performance of AlexNet ( Krizhevsky et al. , 2012 ) on ImageNet went down with a halving time of 16 months over 6 years . Looking at DawnBench ( Coleman et al. , 2017 ) submissions , they also find a cost reduction in terms of dollars of 184x2 between October 2017 and September 2018 for reaching a fixed performance level on ImageNet . Another submission managed to reduce the training time by a factor of 808x from 10 days and 4 hours to 18 minutes in the same time interval while still cutting the cost by a factor of over nine . 3 METHODS . 3.1 WE MEASURE GROWTH IN SAMPLE EFFICIENCY BY HOLDING PERFORMANCE CONSTANT . As proposed by Dulac-Arnold et al . ( 2019 ) and similar to work by Hernandez & Brown ( 2020 ) on measuring algorithmic progress , we measure progress in sample efficiency by comparing the number of samples needed for systems to reach a fixed performance level over time and define the sample efficiency of an algorithm for a given task and performance level as 1/S , where S is the number of samples needed to train to the given performance level on the task : Sample Efficiency ( Task , Score , Algorithm ) = 1 Samples Algorithm needs for Score on Task Compared to the dual approach of comparing the performance of different algorithms for a fixed amount of samples , this approach has the advantage of being more comparable between different benchmarks and a lot easier to interpret : The marginal difficulty of gaining score at a given performance level could vary a lot between games , and it is unclear whether twice as much score corresponds to twice better performance in any meaningful sense ( Hernandez-Orallo , 2020 ) , while 2This might be 88x , as there is a second initial contribution which cost $ 1113 rather than $ 2323 . twice as many samples to reach the same level of performance can straightforwardly be interpreted as half the sample efficiency . 3.2 WE CONSIDER BOTH ATARI AND CONTINUOUS CONTROL . We look at sample efficiency in three areas : 1 ) for the median human-normalized score on 57 games in the Arcade Learning Environment ( ALE ) ( Bellemare et al. , 2013 ) using the no-op evaluation protocol and pixel observations ; 2 ) single task performance on continuous control tasks from the rllab-benchmark ( Duan et al. , 2016 ) using simulation states3 as input ; and 3 ) on tasks from the DeepMind Control Suite ( Tassa et al. , 2018 ) using pixel observations as input . We chose these tasks because of their popularity and the existence of some de facto standards on evaluation and reporting protocols , which yields more mutually comparable published results . The tasks ’ popularity also implies attention from the research community , which ensures that they are somewhat representative of overall progress in DRL . Another advantage is the tasks ’ moderate difficulty and the wide range of partial solutions between failing the task and solving it optimally . This allows for a meaningful comparison of a wider set of different algorithms as more algorithms reach the performance threshold , while there is still space for improvement using advanced techniques . 3.3 WE TREAT EACH PUBLICATION AS A MEASUREMENT OF THE STATE-OF-THE-ART .. For our main results on progress in sample efficiency , we treat every considered result as a measurement of the state-of-the-art at publication : For each publication , we plot the sample usage ( grey dot in figures 2 ( a ) and 3 ) and the state-of-the-art in sample efficiency at the time ( blue stars in figures 2 ( a ) and 3 ) such that results that improve on the state-of-the-art are represented by a grey dot with a blue star in the middle . Then we fit the blue stars . Compared to fitting a dataset only containing jumps in the SOTA ( grey dots with a blue star ) , this dampens the effect single outliers have on the fitted model and means that prolonged periods of stagnation are taken into account adequately . However , our way of fitting the SOTA is sensitive to the precise dates associated with results that did not improve on the SOTA . Another approach would be to graph the SOTA on a continuous-time axis and approximate the corresponding step function by an exponential . This solves the sensitivity to measurements that don ’ t affect the SOTA but comes with two drawbacks : it requires an arbitrary choice of end date that affects the estimated doubling time and leads to high sensitivity to isolated early measurements . Full results for the estimated doubling times for the different approaches can be found in appendix D. Compared to the between task/score variation , the effect of the approach is usually small , but we did observe some larger effects when there have only been few and early changes to the SOTA . In these cases , the models using only jumps predict fast doubling times despite long periods of stagnation , while both other models are more conservative . On the other hand , the continuous-time model yielded the fastest doubling times for most pixel-based MuJoCo tasks , as it puts a lot of weight on improvements relative to the early , weak D4PG ( Barth-Maron et al. , 2018 ) baseline . 3.4 OUR STUDY IS BASED ON PREVIOUSLY PUBLISHED TRAINING CURVES . Due to the difficulty and overhead associated with the independent replication of results in DRL ( Islam et al. , 2017 ; Henderson et al. , 2018 ) , we decided to base our study on training curves in published papers . To that extent , we conducted a systematic search for papers tackling the respective benchmarks and included all relevant4 identified papers which reported on the metrics under consideration in a sufficiently precise way . A more detailed description of the results we included and the search process we employed to identify them can be found in appendix B . While our approach implies multiple limitations of our study that are discussed in appendix C , such as a biased selection of results and the inability to tune hyperparameters , we believe that the limited methodology still offers substantial value in exploring trends in DRL sample efficiency . 3As the dynamics depend on the simulation state , training on the state is easier as seen in Yarats et al . ( 2019 ) . 4A single paper that reported results ( Doan et al . ( 2020 ) ) was excluded for lack of relevance .
This paper conducts a meta-analysis of the trend in sample efficiency in deep RL. The authors argue that this is an informative measure of the progress in the field, in addition to the usual metrics of reward for given tasks, as it is an important consideration when applying deep RL to real world problems. They measure sample efficiency by the number of samples from the environment that is needed to achieve some reward. The amount of time to double sample efficiency is computed for Atari and continuous control environments with state or pixel input.
SP:4715cccdb9f75396851b845cde5521d43a4029fc
Measuring Progress in Deep Reinforcement Learning Sample Efficiency
1 INTRODUCTION . Recent successes of deep reinforcement learning ( DRL ) in Go ( Silver et al. , 2016 ; 2017 ; 2018 ) and complex real-time strategy games ( Berner et al. , 2019 ; Vinyals et al. , 2019 ) indicate the vast potential for automating complex economically relevant tasks like assembling goods in non-standardized environments or physically assisting humans using DRL . However , sample efficiency is likely to remain an important bottleneck for the economic feasibility of real world applications of DRL . This is because samples of state transitions in the environment caused by an agent ’ s action are essential for training DRL agents but automated systems interacting with the real world are often fragile , slow or costly , which makes DRL training in the real world expensive both in terms of money and time ( Dulac-Arnold et al. , 2019 ) . As most widely used benchmarks in DRL still consist of computer games and simulations where samples can be obtained risk-free , fast and cheaply1 , progress in DRL does not necessarily translate to future real world applications unless it corresponds to progress in sample efficiency or simulation accuracy and transfer learning . This makes information about progress in sample efficiency an important input to researchers studying topics like the future of employment ( Frey & Osborne , 2017 ) , the potential for malicious uses of DRL ( Brundage et al. , 2018 ) and other potentially transformative impacts of AI systems in the future ( Gruetzemacher & Whittlestone , 2019 ) . 2 BACKGROUND AND RELATED WORK . 2.1 SAMPLE EFFICIENCY . While research on progress in the field of AI used to have a strong focus on benchmark performance metrics in AI ( Eckersley & Nasser , 2017 ) , there have been calls to pay more attention to the importance of other metrics : Martinez-Plumed et al . ( 2018 ) enumerate previously neglected dimensions of AI progress and explore the relationship between computing resources and final performance in RL . The wider implications of sample efficiency , more specifically , are explored by Tucker et al . ( 2020 ) . While their scope is broader than DRL , most of their points do apply to reinforcement learning as a 1Espeholt et al . ( 2019 ) reach up to 2.4 M FPS and 1 B frames per 25 $ on DM Lab ( Beattie et al. , 2016 ) . special case of AI technology . For example , as the authors point out , robotics is an especially important case of a data-limited domain , in which new applications are likely to be unlocked for many actors with improved sample efficiency . While some benchmark papers make explicit quantitative comparisons of sample efficiency ( or “ data efficiency ” ) to isolated previous methods ( Hessel et al. , 2018 ; Hafner et al. , 2019a ; Kaiser et al. , 2019 ; Srinivas et al. , 2020 ) , we are not aware of any more systematic investigation of sample efficiency in DRL . 2.2 COMPUTING POWER AND SCALING LAWS . While DRL and other applications of deep learning have produced many impressive results , this has gone hand in hand with an ever-increasing amount of computing power ( compute ) being devoted to model training : Compute usage for large AI projects has been in line with Moore ’ s law prior to 2012 ( Sastry et al. , 2019 ) , but saw a doubling time of 3.4-months in the 2012 to 2018 period , which is seven times faster than Moore ’ s law ( Amodei & Hernandez , 2018 ) . Compute usage would not increase if there was nothing to gain : For example , the performance of Transformer-based language models ( Vaswani et al. , 2017 ) follows a power law in the number of model parameters when differently sized models are trained on the same dataset indicating that in the current regime , Transformer language models become more sample efficient with more parameters . Data is still important , as there is another power law relating dataset size for models with the same amount of parameters to performance ( Kaplan et al. , 2020 ) . Things likely look similar for the ImageNet benchmark ( Deng et al. , 2009 ) where progress has long been accompanied by larger models using a fixed amount of data ( Sun et al. , 2017 ) while recent progress relies on additional data ( Touvron et al. , 2019 ) . 2.3 ALGORITHMIC PROGRESS AND INCREASED EFFICIENCY . As increased sample usage might make progress in DRL look faster , increased compute usage might do so for machine learning . Grace ( 2013 ) found that hardware improvements account for half of the progress for several problems in the vicinity of AI research like computer chess , computer go and physics simulations . More recently , Fichte et al . ( 2020 ) observed the same for progress in SAT solvers . In the realm of deep learning , Hernandez & Brown ( 2020 ) investigated improvements in algorithmic efficiency by holding final performance on various benchmarks constant and analyzing how the number of FLOPS needed to reach that level changed over time . They find that this amount of compute needed to reach the performance of AlexNet ( Krizhevsky et al. , 2012 ) on ImageNet went down with a halving time of 16 months over 6 years . Looking at DawnBench ( Coleman et al. , 2017 ) submissions , they also find a cost reduction in terms of dollars of 184x2 between October 2017 and September 2018 for reaching a fixed performance level on ImageNet . Another submission managed to reduce the training time by a factor of 808x from 10 days and 4 hours to 18 minutes in the same time interval while still cutting the cost by a factor of over nine . 3 METHODS . 3.1 WE MEASURE GROWTH IN SAMPLE EFFICIENCY BY HOLDING PERFORMANCE CONSTANT . As proposed by Dulac-Arnold et al . ( 2019 ) and similar to work by Hernandez & Brown ( 2020 ) on measuring algorithmic progress , we measure progress in sample efficiency by comparing the number of samples needed for systems to reach a fixed performance level over time and define the sample efficiency of an algorithm for a given task and performance level as 1/S , where S is the number of samples needed to train to the given performance level on the task : Sample Efficiency ( Task , Score , Algorithm ) = 1 Samples Algorithm needs for Score on Task Compared to the dual approach of comparing the performance of different algorithms for a fixed amount of samples , this approach has the advantage of being more comparable between different benchmarks and a lot easier to interpret : The marginal difficulty of gaining score at a given performance level could vary a lot between games , and it is unclear whether twice as much score corresponds to twice better performance in any meaningful sense ( Hernandez-Orallo , 2020 ) , while 2This might be 88x , as there is a second initial contribution which cost $ 1113 rather than $ 2323 . twice as many samples to reach the same level of performance can straightforwardly be interpreted as half the sample efficiency . 3.2 WE CONSIDER BOTH ATARI AND CONTINUOUS CONTROL . We look at sample efficiency in three areas : 1 ) for the median human-normalized score on 57 games in the Arcade Learning Environment ( ALE ) ( Bellemare et al. , 2013 ) using the no-op evaluation protocol and pixel observations ; 2 ) single task performance on continuous control tasks from the rllab-benchmark ( Duan et al. , 2016 ) using simulation states3 as input ; and 3 ) on tasks from the DeepMind Control Suite ( Tassa et al. , 2018 ) using pixel observations as input . We chose these tasks because of their popularity and the existence of some de facto standards on evaluation and reporting protocols , which yields more mutually comparable published results . The tasks ’ popularity also implies attention from the research community , which ensures that they are somewhat representative of overall progress in DRL . Another advantage is the tasks ’ moderate difficulty and the wide range of partial solutions between failing the task and solving it optimally . This allows for a meaningful comparison of a wider set of different algorithms as more algorithms reach the performance threshold , while there is still space for improvement using advanced techniques . 3.3 WE TREAT EACH PUBLICATION AS A MEASUREMENT OF THE STATE-OF-THE-ART .. For our main results on progress in sample efficiency , we treat every considered result as a measurement of the state-of-the-art at publication : For each publication , we plot the sample usage ( grey dot in figures 2 ( a ) and 3 ) and the state-of-the-art in sample efficiency at the time ( blue stars in figures 2 ( a ) and 3 ) such that results that improve on the state-of-the-art are represented by a grey dot with a blue star in the middle . Then we fit the blue stars . Compared to fitting a dataset only containing jumps in the SOTA ( grey dots with a blue star ) , this dampens the effect single outliers have on the fitted model and means that prolonged periods of stagnation are taken into account adequately . However , our way of fitting the SOTA is sensitive to the precise dates associated with results that did not improve on the SOTA . Another approach would be to graph the SOTA on a continuous-time axis and approximate the corresponding step function by an exponential . This solves the sensitivity to measurements that don ’ t affect the SOTA but comes with two drawbacks : it requires an arbitrary choice of end date that affects the estimated doubling time and leads to high sensitivity to isolated early measurements . Full results for the estimated doubling times for the different approaches can be found in appendix D. Compared to the between task/score variation , the effect of the approach is usually small , but we did observe some larger effects when there have only been few and early changes to the SOTA . In these cases , the models using only jumps predict fast doubling times despite long periods of stagnation , while both other models are more conservative . On the other hand , the continuous-time model yielded the fastest doubling times for most pixel-based MuJoCo tasks , as it puts a lot of weight on improvements relative to the early , weak D4PG ( Barth-Maron et al. , 2018 ) baseline . 3.4 OUR STUDY IS BASED ON PREVIOUSLY PUBLISHED TRAINING CURVES . Due to the difficulty and overhead associated with the independent replication of results in DRL ( Islam et al. , 2017 ; Henderson et al. , 2018 ) , we decided to base our study on training curves in published papers . To that extent , we conducted a systematic search for papers tackling the respective benchmarks and included all relevant4 identified papers which reported on the metrics under consideration in a sufficiently precise way . A more detailed description of the results we included and the search process we employed to identify them can be found in appendix B . While our approach implies multiple limitations of our study that are discussed in appendix C , such as a biased selection of results and the inability to tune hyperparameters , we believe that the limited methodology still offers substantial value in exploring trends in DRL sample efficiency . 3As the dynamics depend on the simulation state , training on the state is easier as seen in Yarats et al . ( 2019 ) . 4A single paper that reported results ( Doan et al . ( 2020 ) ) was excluded for lack of relevance .
The paper is trying to make extensive and systematic investigation in deep RL papers to measure the recent progress in the broad literatures. The authors look into published state-of-the-art results in Atari, state-based continuous control and pixel-based continuous control. Inferring from papers' published training curves, the authors estimated and found sample efficiency doubling time is 10-18 months for Atari, 5-24 months for continuous control and 4-9 months for pixel-based control tasks.
SP:4715cccdb9f75396851b845cde5521d43a4029fc
Measuring Progress in Deep Reinforcement Learning Sample Efficiency
1 INTRODUCTION . Recent successes of deep reinforcement learning ( DRL ) in Go ( Silver et al. , 2016 ; 2017 ; 2018 ) and complex real-time strategy games ( Berner et al. , 2019 ; Vinyals et al. , 2019 ) indicate the vast potential for automating complex economically relevant tasks like assembling goods in non-standardized environments or physically assisting humans using DRL . However , sample efficiency is likely to remain an important bottleneck for the economic feasibility of real world applications of DRL . This is because samples of state transitions in the environment caused by an agent ’ s action are essential for training DRL agents but automated systems interacting with the real world are often fragile , slow or costly , which makes DRL training in the real world expensive both in terms of money and time ( Dulac-Arnold et al. , 2019 ) . As most widely used benchmarks in DRL still consist of computer games and simulations where samples can be obtained risk-free , fast and cheaply1 , progress in DRL does not necessarily translate to future real world applications unless it corresponds to progress in sample efficiency or simulation accuracy and transfer learning . This makes information about progress in sample efficiency an important input to researchers studying topics like the future of employment ( Frey & Osborne , 2017 ) , the potential for malicious uses of DRL ( Brundage et al. , 2018 ) and other potentially transformative impacts of AI systems in the future ( Gruetzemacher & Whittlestone , 2019 ) . 2 BACKGROUND AND RELATED WORK . 2.1 SAMPLE EFFICIENCY . While research on progress in the field of AI used to have a strong focus on benchmark performance metrics in AI ( Eckersley & Nasser , 2017 ) , there have been calls to pay more attention to the importance of other metrics : Martinez-Plumed et al . ( 2018 ) enumerate previously neglected dimensions of AI progress and explore the relationship between computing resources and final performance in RL . The wider implications of sample efficiency , more specifically , are explored by Tucker et al . ( 2020 ) . While their scope is broader than DRL , most of their points do apply to reinforcement learning as a 1Espeholt et al . ( 2019 ) reach up to 2.4 M FPS and 1 B frames per 25 $ on DM Lab ( Beattie et al. , 2016 ) . special case of AI technology . For example , as the authors point out , robotics is an especially important case of a data-limited domain , in which new applications are likely to be unlocked for many actors with improved sample efficiency . While some benchmark papers make explicit quantitative comparisons of sample efficiency ( or “ data efficiency ” ) to isolated previous methods ( Hessel et al. , 2018 ; Hafner et al. , 2019a ; Kaiser et al. , 2019 ; Srinivas et al. , 2020 ) , we are not aware of any more systematic investigation of sample efficiency in DRL . 2.2 COMPUTING POWER AND SCALING LAWS . While DRL and other applications of deep learning have produced many impressive results , this has gone hand in hand with an ever-increasing amount of computing power ( compute ) being devoted to model training : Compute usage for large AI projects has been in line with Moore ’ s law prior to 2012 ( Sastry et al. , 2019 ) , but saw a doubling time of 3.4-months in the 2012 to 2018 period , which is seven times faster than Moore ’ s law ( Amodei & Hernandez , 2018 ) . Compute usage would not increase if there was nothing to gain : For example , the performance of Transformer-based language models ( Vaswani et al. , 2017 ) follows a power law in the number of model parameters when differently sized models are trained on the same dataset indicating that in the current regime , Transformer language models become more sample efficient with more parameters . Data is still important , as there is another power law relating dataset size for models with the same amount of parameters to performance ( Kaplan et al. , 2020 ) . Things likely look similar for the ImageNet benchmark ( Deng et al. , 2009 ) where progress has long been accompanied by larger models using a fixed amount of data ( Sun et al. , 2017 ) while recent progress relies on additional data ( Touvron et al. , 2019 ) . 2.3 ALGORITHMIC PROGRESS AND INCREASED EFFICIENCY . As increased sample usage might make progress in DRL look faster , increased compute usage might do so for machine learning . Grace ( 2013 ) found that hardware improvements account for half of the progress for several problems in the vicinity of AI research like computer chess , computer go and physics simulations . More recently , Fichte et al . ( 2020 ) observed the same for progress in SAT solvers . In the realm of deep learning , Hernandez & Brown ( 2020 ) investigated improvements in algorithmic efficiency by holding final performance on various benchmarks constant and analyzing how the number of FLOPS needed to reach that level changed over time . They find that this amount of compute needed to reach the performance of AlexNet ( Krizhevsky et al. , 2012 ) on ImageNet went down with a halving time of 16 months over 6 years . Looking at DawnBench ( Coleman et al. , 2017 ) submissions , they also find a cost reduction in terms of dollars of 184x2 between October 2017 and September 2018 for reaching a fixed performance level on ImageNet . Another submission managed to reduce the training time by a factor of 808x from 10 days and 4 hours to 18 minutes in the same time interval while still cutting the cost by a factor of over nine . 3 METHODS . 3.1 WE MEASURE GROWTH IN SAMPLE EFFICIENCY BY HOLDING PERFORMANCE CONSTANT . As proposed by Dulac-Arnold et al . ( 2019 ) and similar to work by Hernandez & Brown ( 2020 ) on measuring algorithmic progress , we measure progress in sample efficiency by comparing the number of samples needed for systems to reach a fixed performance level over time and define the sample efficiency of an algorithm for a given task and performance level as 1/S , where S is the number of samples needed to train to the given performance level on the task : Sample Efficiency ( Task , Score , Algorithm ) = 1 Samples Algorithm needs for Score on Task Compared to the dual approach of comparing the performance of different algorithms for a fixed amount of samples , this approach has the advantage of being more comparable between different benchmarks and a lot easier to interpret : The marginal difficulty of gaining score at a given performance level could vary a lot between games , and it is unclear whether twice as much score corresponds to twice better performance in any meaningful sense ( Hernandez-Orallo , 2020 ) , while 2This might be 88x , as there is a second initial contribution which cost $ 1113 rather than $ 2323 . twice as many samples to reach the same level of performance can straightforwardly be interpreted as half the sample efficiency . 3.2 WE CONSIDER BOTH ATARI AND CONTINUOUS CONTROL . We look at sample efficiency in three areas : 1 ) for the median human-normalized score on 57 games in the Arcade Learning Environment ( ALE ) ( Bellemare et al. , 2013 ) using the no-op evaluation protocol and pixel observations ; 2 ) single task performance on continuous control tasks from the rllab-benchmark ( Duan et al. , 2016 ) using simulation states3 as input ; and 3 ) on tasks from the DeepMind Control Suite ( Tassa et al. , 2018 ) using pixel observations as input . We chose these tasks because of their popularity and the existence of some de facto standards on evaluation and reporting protocols , which yields more mutually comparable published results . The tasks ’ popularity also implies attention from the research community , which ensures that they are somewhat representative of overall progress in DRL . Another advantage is the tasks ’ moderate difficulty and the wide range of partial solutions between failing the task and solving it optimally . This allows for a meaningful comparison of a wider set of different algorithms as more algorithms reach the performance threshold , while there is still space for improvement using advanced techniques . 3.3 WE TREAT EACH PUBLICATION AS A MEASUREMENT OF THE STATE-OF-THE-ART .. For our main results on progress in sample efficiency , we treat every considered result as a measurement of the state-of-the-art at publication : For each publication , we plot the sample usage ( grey dot in figures 2 ( a ) and 3 ) and the state-of-the-art in sample efficiency at the time ( blue stars in figures 2 ( a ) and 3 ) such that results that improve on the state-of-the-art are represented by a grey dot with a blue star in the middle . Then we fit the blue stars . Compared to fitting a dataset only containing jumps in the SOTA ( grey dots with a blue star ) , this dampens the effect single outliers have on the fitted model and means that prolonged periods of stagnation are taken into account adequately . However , our way of fitting the SOTA is sensitive to the precise dates associated with results that did not improve on the SOTA . Another approach would be to graph the SOTA on a continuous-time axis and approximate the corresponding step function by an exponential . This solves the sensitivity to measurements that don ’ t affect the SOTA but comes with two drawbacks : it requires an arbitrary choice of end date that affects the estimated doubling time and leads to high sensitivity to isolated early measurements . Full results for the estimated doubling times for the different approaches can be found in appendix D. Compared to the between task/score variation , the effect of the approach is usually small , but we did observe some larger effects when there have only been few and early changes to the SOTA . In these cases , the models using only jumps predict fast doubling times despite long periods of stagnation , while both other models are more conservative . On the other hand , the continuous-time model yielded the fastest doubling times for most pixel-based MuJoCo tasks , as it puts a lot of weight on improvements relative to the early , weak D4PG ( Barth-Maron et al. , 2018 ) baseline . 3.4 OUR STUDY IS BASED ON PREVIOUSLY PUBLISHED TRAINING CURVES . Due to the difficulty and overhead associated with the independent replication of results in DRL ( Islam et al. , 2017 ; Henderson et al. , 2018 ) , we decided to base our study on training curves in published papers . To that extent , we conducted a systematic search for papers tackling the respective benchmarks and included all relevant4 identified papers which reported on the metrics under consideration in a sufficiently precise way . A more detailed description of the results we included and the search process we employed to identify them can be found in appendix B . While our approach implies multiple limitations of our study that are discussed in appendix C , such as a biased selection of results and the inability to tune hyperparameters , we believe that the limited methodology still offers substantial value in exploring trends in DRL sample efficiency . 3As the dynamics depend on the simulation state , training on the state is easier as seen in Yarats et al . ( 2019 ) . 4A single paper that reported results ( Doan et al . ( 2020 ) ) was excluded for lack of relevance .
The paper proposes to retrospectively benchmark the sample-efficiency on widely used simulated deep RL benchmarks such as Atari and DMControl across the years. The paper shows some interesting trends with respect to how both the algorithmic improvements as well as the use of increased number of frames have driven the progress in the SoTA scores reported on the Atari HNS benchmark. The paper also shows that there has been exponential progress in the sample-efficiency on both Atari and DMControl with nice log-linear plots. This is an interesting analysis, on the lines of OpenAI's papers on Scaling Laws, but done for Deep RL.
SP:4715cccdb9f75396851b845cde5521d43a4029fc
Wide-minima Density Hypothesis and the Explore-Exploit Learning Rate Schedule
1 INTRODUCTION . One of the fascinating properties of deep neural networks ( DNNs ) is their ability to generalize well , i.e. , deliver high accuracy on the unseen test dataset . It is well-known that the learning rate ( LR ) schedules play an important role in the generalization performance ( Keskar et al. , 2016 ; Wu et al. , 2018 ; Goyal et al. , 2017 ) . In this paper , we study the question , what are the key properties of a learning rate schedule that help DNNs generalize well during training ? We start with a series of experiments training Resnet18 on Cifar-10 over 200 epochs . We vary the number of epochs trained at a high LR of 0.1 , called the explore epochs , from 0 to 100 and divide up the remaining epochs equally for training with LRs of 0.01 and 0.001 . Note that the training loss typically stagnates around 50 epochs with 0.1 LR . Despite that , we find that as the number of explore epochs increase to 100 , the average test accuracy also increases . We also find that the minima found in higher test accuracy runs are wider than the minima from lower test accuracy runs , corroborating past work on wide-minima and generalization ( Keskar et al. , 2016 ; Hochreiter & Schmidhuber , 1997 ; Jastrzebski et al. , 2017 ; Wang et al. , 2018 ) . Moreover , what was particularly surprising was that , even when using fewer explore epochs , a few runs out of many trials still resulted in high test accuracies ! Thus , we not only find that an initial exploration phase with a high learning rate is essential to the good generalization of DNNs , but that this exploration phase needs to be run for sufficient time , even if the training loss stagnates much earlier . Further , we find that , even when the exploration phase is not given sufficient time , a few runs still see high test accuracy values . To explain these observations , we hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . A large learning rate can escape narrow minima easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima , it is likely to get stuck in it ( if the ” width ” of the wide minima is large compared to the step size ) . With fewer explore epochs , a large learning rate might still get lucky occasionally in finding a wide minima but invariably finds only a narrower minima due to their higher density . As the explore duration increase , the probability of eventually landing in a wide minima also increase . Thus , a minimum duration of explore is necessary to land in a wide minimum with high probability . Heuristic-based LR decay schemes such as cosine decay ( Loshchilov & Hutter , 2016 ) implicitly maintain a higher LR for longer than schemes like linear decay . Thus , the hypothesis also explains cosine decay ’ s better generalization compared to linear decay . Moreover , the hypothesis enables a principled learning rate schedule design that explicitly accounts for the requisite explore duration . Motivated by the hypothesis , we design a novel Explore-Exploit learning rate schedule , where the initial explore phase optimizes at a high learning rate in order to arrive in the vicinity of a wide minimum . This is followed by an exploit phase which descends to the bottom of this wide minimum . We give explore phase enough time so that the probability of landing in a wide minima is high . For the exploit phase , we experimented with multiple schemes , and found a simple , parameterless , linear decay to zero to be effective . Thus , our proposed learning rate schedule optimizes at a constant high learning rate for some minimum time , followed by a linear decay to zero . We call this learning rate schedule the Knee schedule . We extensively evaluate the Knee schedule across a wide range of models and datasets , ranging from NLP ( BERT pre-training , Transformer on WMT ’ 14 ( EN-DE ) and IWSLT ’ 14 ( DE-EN ) ) to CNNs ( ImageNet on ResNet-50 , Cifar-10 on ResNet18 ) , and spanning multiple optimizers : SGD Momentum , Adam , RAdam , and LAMB . In all cases , Knee schedule improves the test accuracy of state-of-the-art hand-tuned learning rate schedules , when trained using the original training budget . The explore duration is a hyper-parameter in Knee schedule but even if we set the explore duration to a fixed 50 % fraction of total training budget , we find that it still outperforms prior schemes . We also experimented with reducing the training budget , and found that Knee schedule can achieve the same accuracy as the baseline under significantly reduced training budgets . For the BERTLARGE pretraining , WMT ’ 14 ( EN-DE ) and ImageNet experiments , we are able to train in 33 % , 57 % and 44 % less training budget , respectively , for the same test accuracy . This corresponds to significant savings in GPU compute , e.g . savings of over 1000 V100 GPU-hours for BERTLARGE pretraining . The main contributions of our work are : 1 . A hypothesis of lower density of wide minima in the DNN loss landscape , backed by extensive experiments , that explains why a high learning rate needs to be maintained for sufficient duration to achieve good generalization . 2 . The hypothesis also explains the good performance of heuristic-based schemes such as cosine decay , and promotes a principled design of learning rate decay schemes . 3 . Motivated by the hypothesis , we design an Explore-Exploit learning rate schedule called Knee schedule that outperforms prior heuristic-based learning rate schedules , including achieving state-of-the-art results in IWSLT ’ 14 ( DE-EN ) and WMT ’ 14 ( DE-EN ) datasets . 2 WIDE-MINIMA DENSITY HYPOTHESIS . Many popular learning rate ( LR ) schedules , such as the step decay schedules for image datasets , start the training with high LR , and then reduce the LR periodically . For example , consider the case of Cifar-10 on Resnet-18 , trained using a typical step LR schedule of 0.1 , 0.01 , 0.001 for 100 , 50 , 50 epochs each . In many such schedules , even though training loss stagnates after several epochs of high LR , one still needs to continue training at high LR in order to get good generalization . For example , Figure 1 shows the training loss for Cifar-10 on Resnet-18 , trained with a fixed LR of 0.1 ( orange curve ) , compared to a model trained via a step schedule with LR reduced at epoch 50 ( blue curve ) . As can be seen from the figure , the training loss stagnates after ≈ 50 epochs for the orange curve , and locally it makes sense to reduce the learning rate to decrease the loss . However , as shown in Table 1 , generalization is directly correlated with duration of training at high LR , with the highest test accuracy achieved when the high LR is used for 100 epochs , well past the point where training loss stagnates . To understand the above phenomena , we perform another experiment . We train Cifar-10 on Resnet18 for 200 epochs , using a high LR of 0.1 for only 30 epochs and then use LR of 0.01 and 0.001 for 85 epochs each . We repeat this training 50 times with different random weight initializations . On an average , as expected , this training yields a low test accuracy of 94.81 . However , in 1 of the 50 runs , we find that the test accuracy reaches 95.24 , even higher than the average accuracy of 95.1 obtained while training at high LR for 100 epochs ! Hypothesis . To explain the above observations , i.e. , using a high learning rate for short duration results in low average test accuracy with rare occurrences of high test accuracy , while using the same high learning rate for long duration achieves high average test accuracy , we introduce a new hypothesis . We hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . An intuitive explanation of why high LRs are necessary to locate wide minima then follows : a large LR can escape narrow minima “ valleys ” easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima “ valley ” , it is likely to get stuck in it ( if the “ width ” of the wide valley is large compared to the step size ) . For example , see Wu et al . ( 2018 ) for a result showing that large LRs are unstable at narrow minima and thus don ’ t converge to them . Thus the optimizer , when running at a high LR , jumps from one narrow minimum region to another , until it lands in a wide minimum region where it then gets stuck . Now , the probability of an optimization step landing in a wide minima is a direct function of the proportion of wide minima compared to that of narrow minima . Thus , if our hypothesis is true , i.e. , wide minima are much fewer than narrow minima , this probability is very low , and the optimizer needs to take a lot of steps to have a high probability of eventually landing in a wide minimum . This explains the observation in Table 1 , where the average accuracy continues to improve as we increase the number of high LR training steps . The hypothesis also explains why very few ( just 1 ) of the 50 runs trained at 0.1 LR for 30- epochs also managed to attain high accuracy – they just got lucky probabilistically and landed in a wide minimum even with a shorter duration . To validate this hypothesis further , we run experiments similar to the one in Table 1 . Specifically , we train Cifar-10 on Resnet-18 model for 200 epochs using a standard step schedule with LR of 0.1 , 0.01 , 0.001 . We vary the number of epochs trained using the high LR of 0.1 , called the explore epochs , from 30 to 100 epochs , and divide up the rest of the training equally between 0.01 and 0.001 . For each experimental setting , we conduct 50 random trials and plot the distributions of final test accuracy and the minima sharpness as defined by the metric in Keskar et al . ( 2016 ) . If our hypothesis is true , then the more you explore , the higher the probability of landing ( and getting stuck ) in a wide minima region , which should cause the distribution to tighten and move towards wider minima ( lower sharpness ) , as the number of explore steps increase . This is exactly what is observed in Figure 2 . Also since wide minima correlate with higher test accuracy , we should see the test accuracy distribution move towards higher accuracy and sharpen , as the number of explore steps increase . This is confirmed as well in Figure 3 . Finally , to verify whether explore at high LR is essential , we train Cifar-10 for 10,000 epochs at a fixed lower LR of 0.001 . The training converged but the final test accuracy was only 93.9 . Thus , even training 50x longer at low LR is not sufficient , adding more evidence to the hypothesis . Multi-scale . Given the importance of explore at high LR , a natural question that may arise is whether explore is necessary at smaller LR as well . To answer this , we train the same network for a total of 200 epochs with an initial high LR of 0.1 for 100 epochs , but now we vary the number of epochs trained with the LR of 0.01 ( we call this finer-scale explore ) , and train with LR of 0.001 for the remaining epochs . As can be seen from Table 2 , although the final training loss remains similar , we find that finer-scale explore also plays a role similar to the initial explore in determining the final test accuracy . This indicates that our hypothesis about density of wide/narrow regions indeed holds at multiple scales .
This paper did an empirical study on the learning rate (LR) schedule for deep neural networks (DNNs) training. The authors argue that the density of wide minima is lower than sharp minima and then show that this makes keeping high LR necessary. Finally, they propose a new LR schedule that maintains high LR enough long.
SP:6c53796041fb5bfa1516d9172ce23628c39f3ce3
Wide-minima Density Hypothesis and the Explore-Exploit Learning Rate Schedule
1 INTRODUCTION . One of the fascinating properties of deep neural networks ( DNNs ) is their ability to generalize well , i.e. , deliver high accuracy on the unseen test dataset . It is well-known that the learning rate ( LR ) schedules play an important role in the generalization performance ( Keskar et al. , 2016 ; Wu et al. , 2018 ; Goyal et al. , 2017 ) . In this paper , we study the question , what are the key properties of a learning rate schedule that help DNNs generalize well during training ? We start with a series of experiments training Resnet18 on Cifar-10 over 200 epochs . We vary the number of epochs trained at a high LR of 0.1 , called the explore epochs , from 0 to 100 and divide up the remaining epochs equally for training with LRs of 0.01 and 0.001 . Note that the training loss typically stagnates around 50 epochs with 0.1 LR . Despite that , we find that as the number of explore epochs increase to 100 , the average test accuracy also increases . We also find that the minima found in higher test accuracy runs are wider than the minima from lower test accuracy runs , corroborating past work on wide-minima and generalization ( Keskar et al. , 2016 ; Hochreiter & Schmidhuber , 1997 ; Jastrzebski et al. , 2017 ; Wang et al. , 2018 ) . Moreover , what was particularly surprising was that , even when using fewer explore epochs , a few runs out of many trials still resulted in high test accuracies ! Thus , we not only find that an initial exploration phase with a high learning rate is essential to the good generalization of DNNs , but that this exploration phase needs to be run for sufficient time , even if the training loss stagnates much earlier . Further , we find that , even when the exploration phase is not given sufficient time , a few runs still see high test accuracy values . To explain these observations , we hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . A large learning rate can escape narrow minima easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima , it is likely to get stuck in it ( if the ” width ” of the wide minima is large compared to the step size ) . With fewer explore epochs , a large learning rate might still get lucky occasionally in finding a wide minima but invariably finds only a narrower minima due to their higher density . As the explore duration increase , the probability of eventually landing in a wide minima also increase . Thus , a minimum duration of explore is necessary to land in a wide minimum with high probability . Heuristic-based LR decay schemes such as cosine decay ( Loshchilov & Hutter , 2016 ) implicitly maintain a higher LR for longer than schemes like linear decay . Thus , the hypothesis also explains cosine decay ’ s better generalization compared to linear decay . Moreover , the hypothesis enables a principled learning rate schedule design that explicitly accounts for the requisite explore duration . Motivated by the hypothesis , we design a novel Explore-Exploit learning rate schedule , where the initial explore phase optimizes at a high learning rate in order to arrive in the vicinity of a wide minimum . This is followed by an exploit phase which descends to the bottom of this wide minimum . We give explore phase enough time so that the probability of landing in a wide minima is high . For the exploit phase , we experimented with multiple schemes , and found a simple , parameterless , linear decay to zero to be effective . Thus , our proposed learning rate schedule optimizes at a constant high learning rate for some minimum time , followed by a linear decay to zero . We call this learning rate schedule the Knee schedule . We extensively evaluate the Knee schedule across a wide range of models and datasets , ranging from NLP ( BERT pre-training , Transformer on WMT ’ 14 ( EN-DE ) and IWSLT ’ 14 ( DE-EN ) ) to CNNs ( ImageNet on ResNet-50 , Cifar-10 on ResNet18 ) , and spanning multiple optimizers : SGD Momentum , Adam , RAdam , and LAMB . In all cases , Knee schedule improves the test accuracy of state-of-the-art hand-tuned learning rate schedules , when trained using the original training budget . The explore duration is a hyper-parameter in Knee schedule but even if we set the explore duration to a fixed 50 % fraction of total training budget , we find that it still outperforms prior schemes . We also experimented with reducing the training budget , and found that Knee schedule can achieve the same accuracy as the baseline under significantly reduced training budgets . For the BERTLARGE pretraining , WMT ’ 14 ( EN-DE ) and ImageNet experiments , we are able to train in 33 % , 57 % and 44 % less training budget , respectively , for the same test accuracy . This corresponds to significant savings in GPU compute , e.g . savings of over 1000 V100 GPU-hours for BERTLARGE pretraining . The main contributions of our work are : 1 . A hypothesis of lower density of wide minima in the DNN loss landscape , backed by extensive experiments , that explains why a high learning rate needs to be maintained for sufficient duration to achieve good generalization . 2 . The hypothesis also explains the good performance of heuristic-based schemes such as cosine decay , and promotes a principled design of learning rate decay schemes . 3 . Motivated by the hypothesis , we design an Explore-Exploit learning rate schedule called Knee schedule that outperforms prior heuristic-based learning rate schedules , including achieving state-of-the-art results in IWSLT ’ 14 ( DE-EN ) and WMT ’ 14 ( DE-EN ) datasets . 2 WIDE-MINIMA DENSITY HYPOTHESIS . Many popular learning rate ( LR ) schedules , such as the step decay schedules for image datasets , start the training with high LR , and then reduce the LR periodically . For example , consider the case of Cifar-10 on Resnet-18 , trained using a typical step LR schedule of 0.1 , 0.01 , 0.001 for 100 , 50 , 50 epochs each . In many such schedules , even though training loss stagnates after several epochs of high LR , one still needs to continue training at high LR in order to get good generalization . For example , Figure 1 shows the training loss for Cifar-10 on Resnet-18 , trained with a fixed LR of 0.1 ( orange curve ) , compared to a model trained via a step schedule with LR reduced at epoch 50 ( blue curve ) . As can be seen from the figure , the training loss stagnates after ≈ 50 epochs for the orange curve , and locally it makes sense to reduce the learning rate to decrease the loss . However , as shown in Table 1 , generalization is directly correlated with duration of training at high LR , with the highest test accuracy achieved when the high LR is used for 100 epochs , well past the point where training loss stagnates . To understand the above phenomena , we perform another experiment . We train Cifar-10 on Resnet18 for 200 epochs , using a high LR of 0.1 for only 30 epochs and then use LR of 0.01 and 0.001 for 85 epochs each . We repeat this training 50 times with different random weight initializations . On an average , as expected , this training yields a low test accuracy of 94.81 . However , in 1 of the 50 runs , we find that the test accuracy reaches 95.24 , even higher than the average accuracy of 95.1 obtained while training at high LR for 100 epochs ! Hypothesis . To explain the above observations , i.e. , using a high learning rate for short duration results in low average test accuracy with rare occurrences of high test accuracy , while using the same high learning rate for long duration achieves high average test accuracy , we introduce a new hypothesis . We hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . An intuitive explanation of why high LRs are necessary to locate wide minima then follows : a large LR can escape narrow minima “ valleys ” easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima “ valley ” , it is likely to get stuck in it ( if the “ width ” of the wide valley is large compared to the step size ) . For example , see Wu et al . ( 2018 ) for a result showing that large LRs are unstable at narrow minima and thus don ’ t converge to them . Thus the optimizer , when running at a high LR , jumps from one narrow minimum region to another , until it lands in a wide minimum region where it then gets stuck . Now , the probability of an optimization step landing in a wide minima is a direct function of the proportion of wide minima compared to that of narrow minima . Thus , if our hypothesis is true , i.e. , wide minima are much fewer than narrow minima , this probability is very low , and the optimizer needs to take a lot of steps to have a high probability of eventually landing in a wide minimum . This explains the observation in Table 1 , where the average accuracy continues to improve as we increase the number of high LR training steps . The hypothesis also explains why very few ( just 1 ) of the 50 runs trained at 0.1 LR for 30- epochs also managed to attain high accuracy – they just got lucky probabilistically and landed in a wide minimum even with a shorter duration . To validate this hypothesis further , we run experiments similar to the one in Table 1 . Specifically , we train Cifar-10 on Resnet-18 model for 200 epochs using a standard step schedule with LR of 0.1 , 0.01 , 0.001 . We vary the number of epochs trained using the high LR of 0.1 , called the explore epochs , from 30 to 100 epochs , and divide up the rest of the training equally between 0.01 and 0.001 . For each experimental setting , we conduct 50 random trials and plot the distributions of final test accuracy and the minima sharpness as defined by the metric in Keskar et al . ( 2016 ) . If our hypothesis is true , then the more you explore , the higher the probability of landing ( and getting stuck ) in a wide minima region , which should cause the distribution to tighten and move towards wider minima ( lower sharpness ) , as the number of explore steps increase . This is exactly what is observed in Figure 2 . Also since wide minima correlate with higher test accuracy , we should see the test accuracy distribution move towards higher accuracy and sharpen , as the number of explore steps increase . This is confirmed as well in Figure 3 . Finally , to verify whether explore at high LR is essential , we train Cifar-10 for 10,000 epochs at a fixed lower LR of 0.001 . The training converged but the final test accuracy was only 93.9 . Thus , even training 50x longer at low LR is not sufficient , adding more evidence to the hypothesis . Multi-scale . Given the importance of explore at high LR , a natural question that may arise is whether explore is necessary at smaller LR as well . To answer this , we train the same network for a total of 200 epochs with an initial high LR of 0.1 for 100 epochs , but now we vary the number of epochs trained with the LR of 0.01 ( we call this finer-scale explore ) , and train with LR of 0.001 for the remaining epochs . As can be seen from Table 2 , although the final training loss remains similar , we find that finer-scale explore also plays a role similar to the initial explore in determining the final test accuracy . This indicates that our hypothesis about density of wide/narrow regions indeed holds at multiple scales .
Learning rate schedule plays an important role in DL, which has a large influence over the final performance. Though there have been lots of schedules, achieving SOTA performance still requires careful hand-tuned schedule that may be case by case. Compared with previous learning rate schedules, authors first conjectured that the number of wide minima is significantly lower than the number of sharp minima, and then proposed to use a large learning rate at the initialization phase for sufficient exploration to achieve a wide minima, which may achieve better generalization performance. Extensive experiments validate the proposed learning rate schedule.
SP:6c53796041fb5bfa1516d9172ce23628c39f3ce3
Wide-minima Density Hypothesis and the Explore-Exploit Learning Rate Schedule
1 INTRODUCTION . One of the fascinating properties of deep neural networks ( DNNs ) is their ability to generalize well , i.e. , deliver high accuracy on the unseen test dataset . It is well-known that the learning rate ( LR ) schedules play an important role in the generalization performance ( Keskar et al. , 2016 ; Wu et al. , 2018 ; Goyal et al. , 2017 ) . In this paper , we study the question , what are the key properties of a learning rate schedule that help DNNs generalize well during training ? We start with a series of experiments training Resnet18 on Cifar-10 over 200 epochs . We vary the number of epochs trained at a high LR of 0.1 , called the explore epochs , from 0 to 100 and divide up the remaining epochs equally for training with LRs of 0.01 and 0.001 . Note that the training loss typically stagnates around 50 epochs with 0.1 LR . Despite that , we find that as the number of explore epochs increase to 100 , the average test accuracy also increases . We also find that the minima found in higher test accuracy runs are wider than the minima from lower test accuracy runs , corroborating past work on wide-minima and generalization ( Keskar et al. , 2016 ; Hochreiter & Schmidhuber , 1997 ; Jastrzebski et al. , 2017 ; Wang et al. , 2018 ) . Moreover , what was particularly surprising was that , even when using fewer explore epochs , a few runs out of many trials still resulted in high test accuracies ! Thus , we not only find that an initial exploration phase with a high learning rate is essential to the good generalization of DNNs , but that this exploration phase needs to be run for sufficient time , even if the training loss stagnates much earlier . Further , we find that , even when the exploration phase is not given sufficient time , a few runs still see high test accuracy values . To explain these observations , we hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . A large learning rate can escape narrow minima easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima , it is likely to get stuck in it ( if the ” width ” of the wide minima is large compared to the step size ) . With fewer explore epochs , a large learning rate might still get lucky occasionally in finding a wide minima but invariably finds only a narrower minima due to their higher density . As the explore duration increase , the probability of eventually landing in a wide minima also increase . Thus , a minimum duration of explore is necessary to land in a wide minimum with high probability . Heuristic-based LR decay schemes such as cosine decay ( Loshchilov & Hutter , 2016 ) implicitly maintain a higher LR for longer than schemes like linear decay . Thus , the hypothesis also explains cosine decay ’ s better generalization compared to linear decay . Moreover , the hypothesis enables a principled learning rate schedule design that explicitly accounts for the requisite explore duration . Motivated by the hypothesis , we design a novel Explore-Exploit learning rate schedule , where the initial explore phase optimizes at a high learning rate in order to arrive in the vicinity of a wide minimum . This is followed by an exploit phase which descends to the bottom of this wide minimum . We give explore phase enough time so that the probability of landing in a wide minima is high . For the exploit phase , we experimented with multiple schemes , and found a simple , parameterless , linear decay to zero to be effective . Thus , our proposed learning rate schedule optimizes at a constant high learning rate for some minimum time , followed by a linear decay to zero . We call this learning rate schedule the Knee schedule . We extensively evaluate the Knee schedule across a wide range of models and datasets , ranging from NLP ( BERT pre-training , Transformer on WMT ’ 14 ( EN-DE ) and IWSLT ’ 14 ( DE-EN ) ) to CNNs ( ImageNet on ResNet-50 , Cifar-10 on ResNet18 ) , and spanning multiple optimizers : SGD Momentum , Adam , RAdam , and LAMB . In all cases , Knee schedule improves the test accuracy of state-of-the-art hand-tuned learning rate schedules , when trained using the original training budget . The explore duration is a hyper-parameter in Knee schedule but even if we set the explore duration to a fixed 50 % fraction of total training budget , we find that it still outperforms prior schemes . We also experimented with reducing the training budget , and found that Knee schedule can achieve the same accuracy as the baseline under significantly reduced training budgets . For the BERTLARGE pretraining , WMT ’ 14 ( EN-DE ) and ImageNet experiments , we are able to train in 33 % , 57 % and 44 % less training budget , respectively , for the same test accuracy . This corresponds to significant savings in GPU compute , e.g . savings of over 1000 V100 GPU-hours for BERTLARGE pretraining . The main contributions of our work are : 1 . A hypothesis of lower density of wide minima in the DNN loss landscape , backed by extensive experiments , that explains why a high learning rate needs to be maintained for sufficient duration to achieve good generalization . 2 . The hypothesis also explains the good performance of heuristic-based schemes such as cosine decay , and promotes a principled design of learning rate decay schemes . 3 . Motivated by the hypothesis , we design an Explore-Exploit learning rate schedule called Knee schedule that outperforms prior heuristic-based learning rate schedules , including achieving state-of-the-art results in IWSLT ’ 14 ( DE-EN ) and WMT ’ 14 ( DE-EN ) datasets . 2 WIDE-MINIMA DENSITY HYPOTHESIS . Many popular learning rate ( LR ) schedules , such as the step decay schedules for image datasets , start the training with high LR , and then reduce the LR periodically . For example , consider the case of Cifar-10 on Resnet-18 , trained using a typical step LR schedule of 0.1 , 0.01 , 0.001 for 100 , 50 , 50 epochs each . In many such schedules , even though training loss stagnates after several epochs of high LR , one still needs to continue training at high LR in order to get good generalization . For example , Figure 1 shows the training loss for Cifar-10 on Resnet-18 , trained with a fixed LR of 0.1 ( orange curve ) , compared to a model trained via a step schedule with LR reduced at epoch 50 ( blue curve ) . As can be seen from the figure , the training loss stagnates after ≈ 50 epochs for the orange curve , and locally it makes sense to reduce the learning rate to decrease the loss . However , as shown in Table 1 , generalization is directly correlated with duration of training at high LR , with the highest test accuracy achieved when the high LR is used for 100 epochs , well past the point where training loss stagnates . To understand the above phenomena , we perform another experiment . We train Cifar-10 on Resnet18 for 200 epochs , using a high LR of 0.1 for only 30 epochs and then use LR of 0.01 and 0.001 for 85 epochs each . We repeat this training 50 times with different random weight initializations . On an average , as expected , this training yields a low test accuracy of 94.81 . However , in 1 of the 50 runs , we find that the test accuracy reaches 95.24 , even higher than the average accuracy of 95.1 obtained while training at high LR for 100 epochs ! Hypothesis . To explain the above observations , i.e. , using a high learning rate for short duration results in low average test accuracy with rare occurrences of high test accuracy , while using the same high learning rate for long duration achieves high average test accuracy , we introduce a new hypothesis . We hypothesize that , in the DNN loss landscape , the density of narrow minima is significantly higher than that of wide minima . An intuitive explanation of why high LRs are necessary to locate wide minima then follows : a large LR can escape narrow minima “ valleys ” easily ( as the optimizer can jump out of them with large steps ) . However , once it reaches a wide minima “ valley ” , it is likely to get stuck in it ( if the “ width ” of the wide valley is large compared to the step size ) . For example , see Wu et al . ( 2018 ) for a result showing that large LRs are unstable at narrow minima and thus don ’ t converge to them . Thus the optimizer , when running at a high LR , jumps from one narrow minimum region to another , until it lands in a wide minimum region where it then gets stuck . Now , the probability of an optimization step landing in a wide minima is a direct function of the proportion of wide minima compared to that of narrow minima . Thus , if our hypothesis is true , i.e. , wide minima are much fewer than narrow minima , this probability is very low , and the optimizer needs to take a lot of steps to have a high probability of eventually landing in a wide minimum . This explains the observation in Table 1 , where the average accuracy continues to improve as we increase the number of high LR training steps . The hypothesis also explains why very few ( just 1 ) of the 50 runs trained at 0.1 LR for 30- epochs also managed to attain high accuracy – they just got lucky probabilistically and landed in a wide minimum even with a shorter duration . To validate this hypothesis further , we run experiments similar to the one in Table 1 . Specifically , we train Cifar-10 on Resnet-18 model for 200 epochs using a standard step schedule with LR of 0.1 , 0.01 , 0.001 . We vary the number of epochs trained using the high LR of 0.1 , called the explore epochs , from 30 to 100 epochs , and divide up the rest of the training equally between 0.01 and 0.001 . For each experimental setting , we conduct 50 random trials and plot the distributions of final test accuracy and the minima sharpness as defined by the metric in Keskar et al . ( 2016 ) . If our hypothesis is true , then the more you explore , the higher the probability of landing ( and getting stuck ) in a wide minima region , which should cause the distribution to tighten and move towards wider minima ( lower sharpness ) , as the number of explore steps increase . This is exactly what is observed in Figure 2 . Also since wide minima correlate with higher test accuracy , we should see the test accuracy distribution move towards higher accuracy and sharpen , as the number of explore steps increase . This is confirmed as well in Figure 3 . Finally , to verify whether explore at high LR is essential , we train Cifar-10 for 10,000 epochs at a fixed lower LR of 0.001 . The training converged but the final test accuracy was only 93.9 . Thus , even training 50x longer at low LR is not sufficient , adding more evidence to the hypothesis . Multi-scale . Given the importance of explore at high LR , a natural question that may arise is whether explore is necessary at smaller LR as well . To answer this , we train the same network for a total of 200 epochs with an initial high LR of 0.1 for 100 epochs , but now we vary the number of epochs trained with the LR of 0.01 ( we call this finer-scale explore ) , and train with LR of 0.001 for the remaining epochs . As can be seen from Table 2 , although the final training loss remains similar , we find that finer-scale explore also plays a role similar to the initial explore in determining the final test accuracy . This indicates that our hypothesis about density of wide/narrow regions indeed holds at multiple scales .
This work studies the problem of how to define learning rate schedules when training deep models so that the models better generalize. To this end, the paper proposes and evaluates a learning rate schedule that consists of two stages (knee schedule). A first stage of exploration adoptes a high learning rate. This initial stage is followed by a second stage where the learning rate decreases in a linear way. Extensive experimental results, both in text and image data, show that the proposed scheme allows one to train faster or to obtain better results with a fixed computational budget. The proposed learning schedule leads to SOTA results on IWSLT’14 (DE-EN) and WMT’14 (DE-EN) datasets.
SP:6c53796041fb5bfa1516d9172ce23628c39f3ce3
SCoRe: Pre-Training for Context Representation in Conversational Semantic Parsing
1 INTRODUCTION . The goal of task-oriented dialog systems is to assist the user in completing a certain task by performing an action or retrieving relevant information ( Tur & Mori , 2011 ) . They are often built on top of a structured ontology grounded in a knowledge base , a database , or a set of API calls . This in contrast to open-domain dialog systems ( also referred to as chit-chat systems ) where the goal is to maximize engagement with users in open-ended conversations ( Jafarpour et al. , 2010 ; Ritter et al. , 2011 ) . A key component of task-oriented conversational systems is Conversational Semantic Parsing ( CSP ) , which converts each utterance in the dialog into a formal language query ( e.g. , SQL , SPARQL ) that can be executed against the structured ontology . CSP has been extensively studied in several academic and industrial research settings such as dialog systems ( e.g. , dialog state tracking in MWOZ ( Budzianowski et al. , 2018 ) ) , interacting with physical agents ( e.g. , ( Chai et al. , 2018 ) ) , context-dependent semantic parsing ( e.g. , SPARC ( Yu et al. , 2019b ) ) , SQL-grounded state tracking ( e.g. , COSQL ( Yu et al. , 2019a ) ) , and sequential question answering ( e.g. , SQA ( Iyyer et al. , 2017 ) ) . These settings differ in some respect , but they share the same overall objective and key challenge : how to jointly represent the natural language utterances and underlying structured ontology while taking into consideration the multi-turn dynamics of the dialog . Similar to many other natural language tasks , recent work in CSP has significantly benefited from advances in language model pre-training . However , existing general-purpose pre-trained language models , e.g . BERT ( Devlin et al. , 2019 ) , are pre-trained on free-form text data using language model objectives . This limits their ability in modeling the structural context or the multi-turn dynamics of the dialogs . This presents an opportunity to improve pre-trained LMs to specifically address these limitations for CSP tasks . Recent work has demonstrated the benefits of adapting pre-trained LMs Published as a conference paper at ICLR 2021 Transformer Encoder < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS < s > TCS < /s > CCS < /s > CCS < /s > CCS < /s > CCS < mask > MLM to specific domains ( Gururangan et al. , 2020 ) or tasks ( Zhang et al. , 2019b ) via a second phase of pre-training . For example , open-domain dialogue language models such as DialoGPT ( Zhang et al. , 2020 ) and ConveRT ( Henderson et al. , 2019 ) are pre-trained on the Reddit data and applied to dialog response generation and retrieval tasks . In this paper , we introduce SCORE ( Structured & Sequential Context Representation ) , a language model pre-training approach for CSP tasks . SCORE adapts general pre-trained LMs by introducing a second phase of pre-training using multiple objectives that capture both multi-turn dynamics and the structural contexts in a dialog . In contrast to open-domain dialogs , CSP datasets are usually much smaller due to the difficulty and expense of obtaining and labeling data ( mapping natural language utterances to formal language ) . Unlike most prior work on contextualized LMs which are pre-trained on free text , according to the finding where questions in CSP tasks are more compositional than other free-text since they can be mapped into formal representations , we propose to train SCORE on synthesized conversational semantic parsing data with multiple training objectives that aim to ground utterances into the schema of the underlying ontology and to model the relationship between different utterances in the multi-turn conversation . In this way , SCORE can effectively inject structural and conversational inductive biases in LMs that can translate to many CSP tasks . SCORE uses an order of magnitude smaller dataset for the second stage of pre-training , does not require changes to the pre-trained model architecture , can be used as a drop-in replacement of general pre-trained LMs with any semantic parsing model , and can be used out-of-the-box in many CSP tasks . We apply SCORE to four different CSP tasks : ( 1 ) sequential text-to-SQL ( SPARC ) , ( 2 ) conversational text-to-SQL ( COSQL ) , ( 3 ) dialog state tracking ( MWOZ ) , and ( 4 ) weakly-supervised sequential question answering ( SQA ) . The fours tasks represent different scenarios , types of ontologies , supervision signals , system responses , and domains ( see Table 1 for a detailed comparison and Figure 1 for examples ) . We demonstrate that : ( 1 ) SCORE training objectives can effectively incorporate synthesized data , ( 2 ) a single pre-trained SCORE model can be used for several CSP tasks and can be combined with many baseline systems with different model architectures and ( 3 ) SCORE significantly improve all baseline systems and achieves new state-of-the-art results on three benchmarks ( SPARC , SPARC , and MWOZ ) and comparable performance to state-of-the-art results on the fourth ( SQA ) . 2 APPROACH . The key challenge of CSP is to capture the relationship between the natural language utterance and the structured ontology in the multi-turn dialog dynamics . To this end , we inject structural and conversational inductive biases in SCORE by introducing two objective functions : Column Contextual Semantics ( CCS ) and the Turn Contextual Switch ( TCS ) . Because the size of existing semantic parsing datasets is limited , we produce synthesized data for pretraining SCORE by sampling from the context-free grammar induced from complex text-to-SQL examples in different domains . Moreover , to prevent SCORE from overfitting to the linguistic pattern of our synthesized data , we use the Masked Language Modeling ( MLM ) objective on human-generated utterances as regularization . 2.1 PRELIMINARIES . Task Definition In CSP , at each turn t , we aim to produce a formal representation qt given the current utterance ut , the interaction history ht = [ u1 , u2 , . . . , ut−1 ] , and the schema c ( table and column names , slots , etc . ) of the target database ( ontology ) d. To cover different problem variants , we consider four popular CSP tasks shown in Table 1 : SPARC ( sequential text-to-SQL ) , COSQL ( conversational text-to-SQL ) , MWOZ ( dialogue state tracking ) , and SQA ( weakly supervised sequential question answering ) . They have different target formal language and structured ontology : • For the utterance u , it is the user question for SPARC and SQA , while for COSQL and MWOZ , u is the combination of a user query and a system response . • For the database d , SPARC and COSQL use multi-table databases ; for MWOZ , the pre-defined ontology d can also be viewed as a database ; for SQA , d is a single table . • For the formal representation q , it is the SQL query for SPARC and COSQL ; in MWOZ it is the slot-value pairs that can be viewed as simple SQL queries consisting of SELECT and WHERE clauses ; and for SQA , q is the latent program . Base Architecture The base architecture of SCORE takes as input a single turn of a CSP dialog 〈ut , ht〉 jointly with the underlying database schema c. Given this contextualized conversational input Ct = 〈ut , ht , c〉 , SCORE encodes it into contextualized conversation representations ~St for each token in Ct . The encoder architecture follows RoBERTa ( Liu et al. , 2019b ) . It is then followed by a linear layer and normalized ( Ba et al. , 2016 ) to produce final representations ~ht for each token : Ct = 〈ut , ht , c〉 , ~St = ROBERTA ( Ct ) , ht , i = LayerNorm ( GELU ( W1St , i ) ) ∀St , i ∈ ~St , ( 1 ) where GELU is an activation by Hendrycks & Gimpel ( 2016 ) and W1 is a learned parameter matrix . To build Ct , we first concatenate current utterances ut and dialog history ht separated by a special token < s > , as this simple strategy has been shown effective in state-of-the-art CSP systems ( Zhang et al. , 2019c ; Wu et al. , 2019 ; Liu et al. , 2020 ; Heck et al. , 2020 ) . To incorporate the database schema , we follow Hwang et al . ( 2019 ) to concatenate all column names as a single sequence . Column names are separated by the special token < /s > and prefixed by their corresponding table name . 2.2 SCORE PRE-TRAINING . SCORE addresses the challenges of CSP by pre-training a task-oriented language model contextualized by the conversational flow and the underlying ontology . In pre-training , the SCORE model is self-supervised by two novel objectives in addition to the established Masked Language Modeling ( MLM ) objective . These objectives facilitate the accurate representation of the conversational flow between dialog turns and how this flow maps to the desired columns in the ontology . Column Contextual Semantics The first challenge of CSP is capturing the alignment between the natural language utterance and the underlying database schema . To address it , we optimize the SCORE model with the auxiliary objective of Column Contextual Semantics ( CCS ) . For each column in the database schema c , CCS targets the operations that should be performed on this column in a given conversational turn . Specifically , each formal representation q is decomposed into operations on columns and tables , e.g . GROUP BY and HAVING for SQL queries , or WHERE for the slot-value pairs . In this way , our data covers 148 column operations . We use the encoding of the special token < /s > right before each column or table name to predict its corresponding operations , and then compute the CCS loss : LCCS ( Ct ) = ∑ i∈c CrossEntropy148 ( LayerNorm ( W2 h c t , i ) , CCS ( qt ) ) ( 2 ) where hct , i is the contextualized representation of the i th column ’ s special token < /s > in the contextualized input Ct , CCS ( qt ) returns the column operation label for the current formal representation qt , CrossEntropy148 computes the 148-way cross-entropy between the column operation prediction and label , and W2 is a learned parameter matrix . Usr : Find the names of the top 3 highest sales books . Usr : Who are their authors ? Usr : Also show the names of their publishers . … ... Usr : I am looking for a cheap restaurant in the centre of the city Sys : There is a cheap chinese restaurant called Dojo Noodle Bar . Usr : Yes please , for 8 people at 18:30 on Thursday … ... Usr : I also need to book a taxi between to the restaurant at 20:30 . Sys : The taxi is booked . SELECT title FROM book ORDER BY sale_amount DESC LIMIT 3 SELECT t1.title , t1.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id ORDER BY t2.sale_amount DESC LIMIT 3 SELECT t1.title , t1.name , t3.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.id ORDER BY t2.sale_amount DESC LIMIT 3 Restaurant ( Price=cheap , area=center ) Restaurant ( Price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Restaurant ( price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Taxi ( leaveAt=20:30 , destination=Dojo Noodle Bar ) Restaurant : name | price | area | … | time … ... Taxi : leaveAt | … | destination D ia lo g st at e tra ck in g Author : id | name | ... | country Press : id | name | ... | address … ... Book : id | title | author id | … | sale_amount Transformer Encoder Dialogs DatabaseFormal Programs M ul titu rn te xt -to -S Q L < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS INS ( SELECT.column ) < s > < /s > < /s > < /s > < /s > < mask > TCS INS ( SELECT.column ) MLM the CCS ... CCS SELECT CCS ORDER BY DESC LIMIT CCS None Figure 2 : Pre-training of a SCORE encoder on a SPARC text-to-SQL example from Figure 1 . Turn Contextual Switch The second challenge of CSP is capturing the conversational context flow and how it is grounded into the formal representations . The TCS objective aims to capture this grounding of context flow . To this end , it rgets predicting the difference in formal representations between dialog turns based on the natural language utterance . Based on the context-free grammar of SQL , we identify 26 possible turn difference oper tions that a conversatio l turn could elicit . They encod changes between different turns of user queries ( the system response is not involved here ) since we assume that most turn contextual shifts are from the user . For example , INS ( WHERE ) indicates inserting a new WHERE condition and DEL ( SELECT.agg ) indicates removing an aggregate operation from a SELECT statement ( e.g . when an utterance “ Show all the ages instead. ” elicits a change SELECT MAX ( age ) ... → SELECT age ... ) . We use the encoding of the special token < /s > right before each turn to predict the context switch label between this turn and the previous history : LTCS ( Ct ) = CrossEntropy26 ( LayerNorm ( W3Hst ) , TCS ( qt , qt−1 ) ) ( 3 ) where Hst ∈ R ( t−1 ) ×d is the contextualized representation of all previous turns in Ct with hidden dimension d , TCS ( qt , qt−1 ) returns the turn difference operations from qt−1 to qt , and W3 is a learned parameter matrix . We don ’ t use this objective to pre-train SCORE for MWOZ because the context switch label between turns is relatively simple in MWOZ ( only select and where changes ) . Masked Language Modeling As in prior work on large-scale language models ( Devlin et al. , 2019 ) , we use the Masked Language Modeling ( MLM ) objective to facilitate contextual representation learning for natural language utterances . Importantly for regularization , we only apply this loss on in-domain human-annotated natural language data . Namely , it includes utterances in SPARC , COSQL , and SQA as well as nine task-oriented dialog datasets processed by Wu et al . ( 2020 ) for MWOZ ( see data statistics in Figure 4 ) . Formally , the MLM loss is given by : LMLM ( Ct ) = ∑ m CrossEntropyVocab ( LayerNorm ( W4h m t ) ) ( 4 ) where hmt are the contextualized representations of the masked 15 % of tokens in Ct , and W4 is a learned parameter matrix . Pre-Training Setup and Steps To summarize the pre-training steps , we first collect a dataset Dnat of combined human-annotated natural language questions ( without labels ) from existing CSP tasks ( as mentioned above ) , and create a large synthesized conversational data Dsyn that is generated by a grammar induced from a small set of SPARC annotated examples ( See 2.3 ) . After that , we incorporate both two datasets in pre-training . More specifically , synthetic and natural examples are randomly sampled during pre-training . The total pre-training loss is the sum of the three objectives with CCS and TCS only applied to Dsyn and MLM only to Dnat : L = ∑ Ct∈Dsyn ( LCCS ( Ct ) + LTCS ( Ct ) ) + ∑ Ct∈Dnat LMLM ( Ct ) ( 5 ) Figure 2 shows an overview of SCORE pre-training on an example SPARC dialogue from Figure 1 . We report additional implementation details for pre-training SCORE in Section 3.3 and Appendix C .
This paper proposes a pre-training approach to improve the performance in conversational semantic parsing. The idea is to use the training data to learn how to generate contextual representations by combining the now commonly used masked language modelling pretraining objective (MLM) with two additional objectives, named column contextual semantics and turn contextual switch. Furthermore, additional synthetic data was generated.
SP:bd9472600b9e7e4b407b0b2572179bc8cab7f272
SCoRe: Pre-Training for Context Representation in Conversational Semantic Parsing
1 INTRODUCTION . The goal of task-oriented dialog systems is to assist the user in completing a certain task by performing an action or retrieving relevant information ( Tur & Mori , 2011 ) . They are often built on top of a structured ontology grounded in a knowledge base , a database , or a set of API calls . This in contrast to open-domain dialog systems ( also referred to as chit-chat systems ) where the goal is to maximize engagement with users in open-ended conversations ( Jafarpour et al. , 2010 ; Ritter et al. , 2011 ) . A key component of task-oriented conversational systems is Conversational Semantic Parsing ( CSP ) , which converts each utterance in the dialog into a formal language query ( e.g. , SQL , SPARQL ) that can be executed against the structured ontology . CSP has been extensively studied in several academic and industrial research settings such as dialog systems ( e.g. , dialog state tracking in MWOZ ( Budzianowski et al. , 2018 ) ) , interacting with physical agents ( e.g. , ( Chai et al. , 2018 ) ) , context-dependent semantic parsing ( e.g. , SPARC ( Yu et al. , 2019b ) ) , SQL-grounded state tracking ( e.g. , COSQL ( Yu et al. , 2019a ) ) , and sequential question answering ( e.g. , SQA ( Iyyer et al. , 2017 ) ) . These settings differ in some respect , but they share the same overall objective and key challenge : how to jointly represent the natural language utterances and underlying structured ontology while taking into consideration the multi-turn dynamics of the dialog . Similar to many other natural language tasks , recent work in CSP has significantly benefited from advances in language model pre-training . However , existing general-purpose pre-trained language models , e.g . BERT ( Devlin et al. , 2019 ) , are pre-trained on free-form text data using language model objectives . This limits their ability in modeling the structural context or the multi-turn dynamics of the dialogs . This presents an opportunity to improve pre-trained LMs to specifically address these limitations for CSP tasks . Recent work has demonstrated the benefits of adapting pre-trained LMs Published as a conference paper at ICLR 2021 Transformer Encoder < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS < s > TCS < /s > CCS < /s > CCS < /s > CCS < /s > CCS < mask > MLM to specific domains ( Gururangan et al. , 2020 ) or tasks ( Zhang et al. , 2019b ) via a second phase of pre-training . For example , open-domain dialogue language models such as DialoGPT ( Zhang et al. , 2020 ) and ConveRT ( Henderson et al. , 2019 ) are pre-trained on the Reddit data and applied to dialog response generation and retrieval tasks . In this paper , we introduce SCORE ( Structured & Sequential Context Representation ) , a language model pre-training approach for CSP tasks . SCORE adapts general pre-trained LMs by introducing a second phase of pre-training using multiple objectives that capture both multi-turn dynamics and the structural contexts in a dialog . In contrast to open-domain dialogs , CSP datasets are usually much smaller due to the difficulty and expense of obtaining and labeling data ( mapping natural language utterances to formal language ) . Unlike most prior work on contextualized LMs which are pre-trained on free text , according to the finding where questions in CSP tasks are more compositional than other free-text since they can be mapped into formal representations , we propose to train SCORE on synthesized conversational semantic parsing data with multiple training objectives that aim to ground utterances into the schema of the underlying ontology and to model the relationship between different utterances in the multi-turn conversation . In this way , SCORE can effectively inject structural and conversational inductive biases in LMs that can translate to many CSP tasks . SCORE uses an order of magnitude smaller dataset for the second stage of pre-training , does not require changes to the pre-trained model architecture , can be used as a drop-in replacement of general pre-trained LMs with any semantic parsing model , and can be used out-of-the-box in many CSP tasks . We apply SCORE to four different CSP tasks : ( 1 ) sequential text-to-SQL ( SPARC ) , ( 2 ) conversational text-to-SQL ( COSQL ) , ( 3 ) dialog state tracking ( MWOZ ) , and ( 4 ) weakly-supervised sequential question answering ( SQA ) . The fours tasks represent different scenarios , types of ontologies , supervision signals , system responses , and domains ( see Table 1 for a detailed comparison and Figure 1 for examples ) . We demonstrate that : ( 1 ) SCORE training objectives can effectively incorporate synthesized data , ( 2 ) a single pre-trained SCORE model can be used for several CSP tasks and can be combined with many baseline systems with different model architectures and ( 3 ) SCORE significantly improve all baseline systems and achieves new state-of-the-art results on three benchmarks ( SPARC , SPARC , and MWOZ ) and comparable performance to state-of-the-art results on the fourth ( SQA ) . 2 APPROACH . The key challenge of CSP is to capture the relationship between the natural language utterance and the structured ontology in the multi-turn dialog dynamics . To this end , we inject structural and conversational inductive biases in SCORE by introducing two objective functions : Column Contextual Semantics ( CCS ) and the Turn Contextual Switch ( TCS ) . Because the size of existing semantic parsing datasets is limited , we produce synthesized data for pretraining SCORE by sampling from the context-free grammar induced from complex text-to-SQL examples in different domains . Moreover , to prevent SCORE from overfitting to the linguistic pattern of our synthesized data , we use the Masked Language Modeling ( MLM ) objective on human-generated utterances as regularization . 2.1 PRELIMINARIES . Task Definition In CSP , at each turn t , we aim to produce a formal representation qt given the current utterance ut , the interaction history ht = [ u1 , u2 , . . . , ut−1 ] , and the schema c ( table and column names , slots , etc . ) of the target database ( ontology ) d. To cover different problem variants , we consider four popular CSP tasks shown in Table 1 : SPARC ( sequential text-to-SQL ) , COSQL ( conversational text-to-SQL ) , MWOZ ( dialogue state tracking ) , and SQA ( weakly supervised sequential question answering ) . They have different target formal language and structured ontology : • For the utterance u , it is the user question for SPARC and SQA , while for COSQL and MWOZ , u is the combination of a user query and a system response . • For the database d , SPARC and COSQL use multi-table databases ; for MWOZ , the pre-defined ontology d can also be viewed as a database ; for SQA , d is a single table . • For the formal representation q , it is the SQL query for SPARC and COSQL ; in MWOZ it is the slot-value pairs that can be viewed as simple SQL queries consisting of SELECT and WHERE clauses ; and for SQA , q is the latent program . Base Architecture The base architecture of SCORE takes as input a single turn of a CSP dialog 〈ut , ht〉 jointly with the underlying database schema c. Given this contextualized conversational input Ct = 〈ut , ht , c〉 , SCORE encodes it into contextualized conversation representations ~St for each token in Ct . The encoder architecture follows RoBERTa ( Liu et al. , 2019b ) . It is then followed by a linear layer and normalized ( Ba et al. , 2016 ) to produce final representations ~ht for each token : Ct = 〈ut , ht , c〉 , ~St = ROBERTA ( Ct ) , ht , i = LayerNorm ( GELU ( W1St , i ) ) ∀St , i ∈ ~St , ( 1 ) where GELU is an activation by Hendrycks & Gimpel ( 2016 ) and W1 is a learned parameter matrix . To build Ct , we first concatenate current utterances ut and dialog history ht separated by a special token < s > , as this simple strategy has been shown effective in state-of-the-art CSP systems ( Zhang et al. , 2019c ; Wu et al. , 2019 ; Liu et al. , 2020 ; Heck et al. , 2020 ) . To incorporate the database schema , we follow Hwang et al . ( 2019 ) to concatenate all column names as a single sequence . Column names are separated by the special token < /s > and prefixed by their corresponding table name . 2.2 SCORE PRE-TRAINING . SCORE addresses the challenges of CSP by pre-training a task-oriented language model contextualized by the conversational flow and the underlying ontology . In pre-training , the SCORE model is self-supervised by two novel objectives in addition to the established Masked Language Modeling ( MLM ) objective . These objectives facilitate the accurate representation of the conversational flow between dialog turns and how this flow maps to the desired columns in the ontology . Column Contextual Semantics The first challenge of CSP is capturing the alignment between the natural language utterance and the underlying database schema . To address it , we optimize the SCORE model with the auxiliary objective of Column Contextual Semantics ( CCS ) . For each column in the database schema c , CCS targets the operations that should be performed on this column in a given conversational turn . Specifically , each formal representation q is decomposed into operations on columns and tables , e.g . GROUP BY and HAVING for SQL queries , or WHERE for the slot-value pairs . In this way , our data covers 148 column operations . We use the encoding of the special token < /s > right before each column or table name to predict its corresponding operations , and then compute the CCS loss : LCCS ( Ct ) = ∑ i∈c CrossEntropy148 ( LayerNorm ( W2 h c t , i ) , CCS ( qt ) ) ( 2 ) where hct , i is the contextualized representation of the i th column ’ s special token < /s > in the contextualized input Ct , CCS ( qt ) returns the column operation label for the current formal representation qt , CrossEntropy148 computes the 148-way cross-entropy between the column operation prediction and label , and W2 is a learned parameter matrix . Usr : Find the names of the top 3 highest sales books . Usr : Who are their authors ? Usr : Also show the names of their publishers . … ... Usr : I am looking for a cheap restaurant in the centre of the city Sys : There is a cheap chinese restaurant called Dojo Noodle Bar . Usr : Yes please , for 8 people at 18:30 on Thursday … ... Usr : I also need to book a taxi between to the restaurant at 20:30 . Sys : The taxi is booked . SELECT title FROM book ORDER BY sale_amount DESC LIMIT 3 SELECT t1.title , t1.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id ORDER BY t2.sale_amount DESC LIMIT 3 SELECT t1.title , t1.name , t3.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.id ORDER BY t2.sale_amount DESC LIMIT 3 Restaurant ( Price=cheap , area=center ) Restaurant ( Price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Restaurant ( price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Taxi ( leaveAt=20:30 , destination=Dojo Noodle Bar ) Restaurant : name | price | area | … | time … ... Taxi : leaveAt | … | destination D ia lo g st at e tra ck in g Author : id | name | ... | country Press : id | name | ... | address … ... Book : id | title | author id | … | sale_amount Transformer Encoder Dialogs DatabaseFormal Programs M ul titu rn te xt -to -S Q L < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS INS ( SELECT.column ) < s > < /s > < /s > < /s > < /s > < mask > TCS INS ( SELECT.column ) MLM the CCS ... CCS SELECT CCS ORDER BY DESC LIMIT CCS None Figure 2 : Pre-training of a SCORE encoder on a SPARC text-to-SQL example from Figure 1 . Turn Contextual Switch The second challenge of CSP is capturing the conversational context flow and how it is grounded into the formal representations . The TCS objective aims to capture this grounding of context flow . To this end , it rgets predicting the difference in formal representations between dialog turns based on the natural language utterance . Based on the context-free grammar of SQL , we identify 26 possible turn difference oper tions that a conversatio l turn could elicit . They encod changes between different turns of user queries ( the system response is not involved here ) since we assume that most turn contextual shifts are from the user . For example , INS ( WHERE ) indicates inserting a new WHERE condition and DEL ( SELECT.agg ) indicates removing an aggregate operation from a SELECT statement ( e.g . when an utterance “ Show all the ages instead. ” elicits a change SELECT MAX ( age ) ... → SELECT age ... ) . We use the encoding of the special token < /s > right before each turn to predict the context switch label between this turn and the previous history : LTCS ( Ct ) = CrossEntropy26 ( LayerNorm ( W3Hst ) , TCS ( qt , qt−1 ) ) ( 3 ) where Hst ∈ R ( t−1 ) ×d is the contextualized representation of all previous turns in Ct with hidden dimension d , TCS ( qt , qt−1 ) returns the turn difference operations from qt−1 to qt , and W3 is a learned parameter matrix . We don ’ t use this objective to pre-train SCORE for MWOZ because the context switch label between turns is relatively simple in MWOZ ( only select and where changes ) . Masked Language Modeling As in prior work on large-scale language models ( Devlin et al. , 2019 ) , we use the Masked Language Modeling ( MLM ) objective to facilitate contextual representation learning for natural language utterances . Importantly for regularization , we only apply this loss on in-domain human-annotated natural language data . Namely , it includes utterances in SPARC , COSQL , and SQA as well as nine task-oriented dialog datasets processed by Wu et al . ( 2020 ) for MWOZ ( see data statistics in Figure 4 ) . Formally , the MLM loss is given by : LMLM ( Ct ) = ∑ m CrossEntropyVocab ( LayerNorm ( W4h m t ) ) ( 4 ) where hmt are the contextualized representations of the masked 15 % of tokens in Ct , and W4 is a learned parameter matrix . Pre-Training Setup and Steps To summarize the pre-training steps , we first collect a dataset Dnat of combined human-annotated natural language questions ( without labels ) from existing CSP tasks ( as mentioned above ) , and create a large synthesized conversational data Dsyn that is generated by a grammar induced from a small set of SPARC annotated examples ( See 2.3 ) . After that , we incorporate both two datasets in pre-training . More specifically , synthetic and natural examples are randomly sampled during pre-training . The total pre-training loss is the sum of the three objectives with CCS and TCS only applied to Dsyn and MLM only to Dnat : L = ∑ Ct∈Dsyn ( LCCS ( Ct ) + LTCS ( Ct ) ) + ∑ Ct∈Dnat LMLM ( Ct ) ( 5 ) Figure 2 shows an overview of SCORE pre-training on an example SPARC dialogue from Figure 1 . We report additional implementation details for pre-training SCORE in Section 3.3 and Appendix C .
In this paper, the authors proposed a pre-training strategy for Conversational Semantic Parsing (CSP) tasks. The pre-training is run on top of any existing LM (i.e., in this work RoBERTA has been used), and uses three additional loss functions to inject the CSP inductive bias into the LM: Column Contextual Semantics (CCS), Turn Contextual Switch (TCS) and Masked Language Modeling (MLM). Moreover, the authors proposed to use synthetically generated data in the pretraining. The results are presented in four well-know datasets for CSP: SPARC, COSQL, MWOZ, and SQA.
SP:bd9472600b9e7e4b407b0b2572179bc8cab7f272
SCoRe: Pre-Training for Context Representation in Conversational Semantic Parsing
1 INTRODUCTION . The goal of task-oriented dialog systems is to assist the user in completing a certain task by performing an action or retrieving relevant information ( Tur & Mori , 2011 ) . They are often built on top of a structured ontology grounded in a knowledge base , a database , or a set of API calls . This in contrast to open-domain dialog systems ( also referred to as chit-chat systems ) where the goal is to maximize engagement with users in open-ended conversations ( Jafarpour et al. , 2010 ; Ritter et al. , 2011 ) . A key component of task-oriented conversational systems is Conversational Semantic Parsing ( CSP ) , which converts each utterance in the dialog into a formal language query ( e.g. , SQL , SPARQL ) that can be executed against the structured ontology . CSP has been extensively studied in several academic and industrial research settings such as dialog systems ( e.g. , dialog state tracking in MWOZ ( Budzianowski et al. , 2018 ) ) , interacting with physical agents ( e.g. , ( Chai et al. , 2018 ) ) , context-dependent semantic parsing ( e.g. , SPARC ( Yu et al. , 2019b ) ) , SQL-grounded state tracking ( e.g. , COSQL ( Yu et al. , 2019a ) ) , and sequential question answering ( e.g. , SQA ( Iyyer et al. , 2017 ) ) . These settings differ in some respect , but they share the same overall objective and key challenge : how to jointly represent the natural language utterances and underlying structured ontology while taking into consideration the multi-turn dynamics of the dialog . Similar to many other natural language tasks , recent work in CSP has significantly benefited from advances in language model pre-training . However , existing general-purpose pre-trained language models , e.g . BERT ( Devlin et al. , 2019 ) , are pre-trained on free-form text data using language model objectives . This limits their ability in modeling the structural context or the multi-turn dynamics of the dialogs . This presents an opportunity to improve pre-trained LMs to specifically address these limitations for CSP tasks . Recent work has demonstrated the benefits of adapting pre-trained LMs Published as a conference paper at ICLR 2021 Transformer Encoder < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS < s > TCS < /s > CCS < /s > CCS < /s > CCS < /s > CCS < mask > MLM to specific domains ( Gururangan et al. , 2020 ) or tasks ( Zhang et al. , 2019b ) via a second phase of pre-training . For example , open-domain dialogue language models such as DialoGPT ( Zhang et al. , 2020 ) and ConveRT ( Henderson et al. , 2019 ) are pre-trained on the Reddit data and applied to dialog response generation and retrieval tasks . In this paper , we introduce SCORE ( Structured & Sequential Context Representation ) , a language model pre-training approach for CSP tasks . SCORE adapts general pre-trained LMs by introducing a second phase of pre-training using multiple objectives that capture both multi-turn dynamics and the structural contexts in a dialog . In contrast to open-domain dialogs , CSP datasets are usually much smaller due to the difficulty and expense of obtaining and labeling data ( mapping natural language utterances to formal language ) . Unlike most prior work on contextualized LMs which are pre-trained on free text , according to the finding where questions in CSP tasks are more compositional than other free-text since they can be mapped into formal representations , we propose to train SCORE on synthesized conversational semantic parsing data with multiple training objectives that aim to ground utterances into the schema of the underlying ontology and to model the relationship between different utterances in the multi-turn conversation . In this way , SCORE can effectively inject structural and conversational inductive biases in LMs that can translate to many CSP tasks . SCORE uses an order of magnitude smaller dataset for the second stage of pre-training , does not require changes to the pre-trained model architecture , can be used as a drop-in replacement of general pre-trained LMs with any semantic parsing model , and can be used out-of-the-box in many CSP tasks . We apply SCORE to four different CSP tasks : ( 1 ) sequential text-to-SQL ( SPARC ) , ( 2 ) conversational text-to-SQL ( COSQL ) , ( 3 ) dialog state tracking ( MWOZ ) , and ( 4 ) weakly-supervised sequential question answering ( SQA ) . The fours tasks represent different scenarios , types of ontologies , supervision signals , system responses , and domains ( see Table 1 for a detailed comparison and Figure 1 for examples ) . We demonstrate that : ( 1 ) SCORE training objectives can effectively incorporate synthesized data , ( 2 ) a single pre-trained SCORE model can be used for several CSP tasks and can be combined with many baseline systems with different model architectures and ( 3 ) SCORE significantly improve all baseline systems and achieves new state-of-the-art results on three benchmarks ( SPARC , SPARC , and MWOZ ) and comparable performance to state-of-the-art results on the fourth ( SQA ) . 2 APPROACH . The key challenge of CSP is to capture the relationship between the natural language utterance and the structured ontology in the multi-turn dialog dynamics . To this end , we inject structural and conversational inductive biases in SCORE by introducing two objective functions : Column Contextual Semantics ( CCS ) and the Turn Contextual Switch ( TCS ) . Because the size of existing semantic parsing datasets is limited , we produce synthesized data for pretraining SCORE by sampling from the context-free grammar induced from complex text-to-SQL examples in different domains . Moreover , to prevent SCORE from overfitting to the linguistic pattern of our synthesized data , we use the Masked Language Modeling ( MLM ) objective on human-generated utterances as regularization . 2.1 PRELIMINARIES . Task Definition In CSP , at each turn t , we aim to produce a formal representation qt given the current utterance ut , the interaction history ht = [ u1 , u2 , . . . , ut−1 ] , and the schema c ( table and column names , slots , etc . ) of the target database ( ontology ) d. To cover different problem variants , we consider four popular CSP tasks shown in Table 1 : SPARC ( sequential text-to-SQL ) , COSQL ( conversational text-to-SQL ) , MWOZ ( dialogue state tracking ) , and SQA ( weakly supervised sequential question answering ) . They have different target formal language and structured ontology : • For the utterance u , it is the user question for SPARC and SQA , while for COSQL and MWOZ , u is the combination of a user query and a system response . • For the database d , SPARC and COSQL use multi-table databases ; for MWOZ , the pre-defined ontology d can also be viewed as a database ; for SQA , d is a single table . • For the formal representation q , it is the SQL query for SPARC and COSQL ; in MWOZ it is the slot-value pairs that can be viewed as simple SQL queries consisting of SELECT and WHERE clauses ; and for SQA , q is the latent program . Base Architecture The base architecture of SCORE takes as input a single turn of a CSP dialog 〈ut , ht〉 jointly with the underlying database schema c. Given this contextualized conversational input Ct = 〈ut , ht , c〉 , SCORE encodes it into contextualized conversation representations ~St for each token in Ct . The encoder architecture follows RoBERTa ( Liu et al. , 2019b ) . It is then followed by a linear layer and normalized ( Ba et al. , 2016 ) to produce final representations ~ht for each token : Ct = 〈ut , ht , c〉 , ~St = ROBERTA ( Ct ) , ht , i = LayerNorm ( GELU ( W1St , i ) ) ∀St , i ∈ ~St , ( 1 ) where GELU is an activation by Hendrycks & Gimpel ( 2016 ) and W1 is a learned parameter matrix . To build Ct , we first concatenate current utterances ut and dialog history ht separated by a special token < s > , as this simple strategy has been shown effective in state-of-the-art CSP systems ( Zhang et al. , 2019c ; Wu et al. , 2019 ; Liu et al. , 2020 ; Heck et al. , 2020 ) . To incorporate the database schema , we follow Hwang et al . ( 2019 ) to concatenate all column names as a single sequence . Column names are separated by the special token < /s > and prefixed by their corresponding table name . 2.2 SCORE PRE-TRAINING . SCORE addresses the challenges of CSP by pre-training a task-oriented language model contextualized by the conversational flow and the underlying ontology . In pre-training , the SCORE model is self-supervised by two novel objectives in addition to the established Masked Language Modeling ( MLM ) objective . These objectives facilitate the accurate representation of the conversational flow between dialog turns and how this flow maps to the desired columns in the ontology . Column Contextual Semantics The first challenge of CSP is capturing the alignment between the natural language utterance and the underlying database schema . To address it , we optimize the SCORE model with the auxiliary objective of Column Contextual Semantics ( CCS ) . For each column in the database schema c , CCS targets the operations that should be performed on this column in a given conversational turn . Specifically , each formal representation q is decomposed into operations on columns and tables , e.g . GROUP BY and HAVING for SQL queries , or WHERE for the slot-value pairs . In this way , our data covers 148 column operations . We use the encoding of the special token < /s > right before each column or table name to predict its corresponding operations , and then compute the CCS loss : LCCS ( Ct ) = ∑ i∈c CrossEntropy148 ( LayerNorm ( W2 h c t , i ) , CCS ( qt ) ) ( 2 ) where hct , i is the contextualized representation of the i th column ’ s special token < /s > in the contextualized input Ct , CCS ( qt ) returns the column operation label for the current formal representation qt , CrossEntropy148 computes the 148-way cross-entropy between the column operation prediction and label , and W2 is a learned parameter matrix . Usr : Find the names of the top 3 highest sales books . Usr : Who are their authors ? Usr : Also show the names of their publishers . … ... Usr : I am looking for a cheap restaurant in the centre of the city Sys : There is a cheap chinese restaurant called Dojo Noodle Bar . Usr : Yes please , for 8 people at 18:30 on Thursday … ... Usr : I also need to book a taxi between to the restaurant at 20:30 . Sys : The taxi is booked . SELECT title FROM book ORDER BY sale_amount DESC LIMIT 3 SELECT t1.title , t1.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id ORDER BY t2.sale_amount DESC LIMIT 3 SELECT t1.title , t1.name , t3.name FROM author AS t1 JOIN book AS t2 ON t1.id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.id ORDER BY t2.sale_amount DESC LIMIT 3 Restaurant ( Price=cheap , area=center ) Restaurant ( Price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Restaurant ( price=cheap , area=center , name=Dojo Noodle Bar , people=8 , time=18:30 , day=Thursday ) Taxi ( leaveAt=20:30 , destination=Dojo Noodle Bar ) Restaurant : name | price | area | … | time … ... Taxi : leaveAt | … | destination D ia lo g st at e tra ck in g Author : id | name | ... | country Press : id | name | ... | address … ... Book : id | title | author id | … | sale_amount Transformer Encoder Dialogs DatabaseFormal Programs M ul titu rn te xt -to -S Q L < s > also show the names of their publishers < s > who are … authors < s > find < mask > … books < /s > author id < /s > author name < /s > … ... < /s > sale amount Current Question Dialog History Database Schema < s > TCS INS ( SELECT.column ) < s > < /s > < /s > < /s > < /s > < mask > TCS INS ( SELECT.column ) MLM the CCS ... CCS SELECT CCS ORDER BY DESC LIMIT CCS None Figure 2 : Pre-training of a SCORE encoder on a SPARC text-to-SQL example from Figure 1 . Turn Contextual Switch The second challenge of CSP is capturing the conversational context flow and how it is grounded into the formal representations . The TCS objective aims to capture this grounding of context flow . To this end , it rgets predicting the difference in formal representations between dialog turns based on the natural language utterance . Based on the context-free grammar of SQL , we identify 26 possible turn difference oper tions that a conversatio l turn could elicit . They encod changes between different turns of user queries ( the system response is not involved here ) since we assume that most turn contextual shifts are from the user . For example , INS ( WHERE ) indicates inserting a new WHERE condition and DEL ( SELECT.agg ) indicates removing an aggregate operation from a SELECT statement ( e.g . when an utterance “ Show all the ages instead. ” elicits a change SELECT MAX ( age ) ... → SELECT age ... ) . We use the encoding of the special token < /s > right before each turn to predict the context switch label between this turn and the previous history : LTCS ( Ct ) = CrossEntropy26 ( LayerNorm ( W3Hst ) , TCS ( qt , qt−1 ) ) ( 3 ) where Hst ∈ R ( t−1 ) ×d is the contextualized representation of all previous turns in Ct with hidden dimension d , TCS ( qt , qt−1 ) returns the turn difference operations from qt−1 to qt , and W3 is a learned parameter matrix . We don ’ t use this objective to pre-train SCORE for MWOZ because the context switch label between turns is relatively simple in MWOZ ( only select and where changes ) . Masked Language Modeling As in prior work on large-scale language models ( Devlin et al. , 2019 ) , we use the Masked Language Modeling ( MLM ) objective to facilitate contextual representation learning for natural language utterances . Importantly for regularization , we only apply this loss on in-domain human-annotated natural language data . Namely , it includes utterances in SPARC , COSQL , and SQA as well as nine task-oriented dialog datasets processed by Wu et al . ( 2020 ) for MWOZ ( see data statistics in Figure 4 ) . Formally , the MLM loss is given by : LMLM ( Ct ) = ∑ m CrossEntropyVocab ( LayerNorm ( W4h m t ) ) ( 4 ) where hmt are the contextualized representations of the masked 15 % of tokens in Ct , and W4 is a learned parameter matrix . Pre-Training Setup and Steps To summarize the pre-training steps , we first collect a dataset Dnat of combined human-annotated natural language questions ( without labels ) from existing CSP tasks ( as mentioned above ) , and create a large synthesized conversational data Dsyn that is generated by a grammar induced from a small set of SPARC annotated examples ( See 2.3 ) . After that , we incorporate both two datasets in pre-training . More specifically , synthetic and natural examples are randomly sampled during pre-training . The total pre-training loss is the sum of the three objectives with CCS and TCS only applied to Dsyn and MLM only to Dnat : L = ∑ Ct∈Dsyn ( LCCS ( Ct ) + LTCS ( Ct ) ) + ∑ Ct∈Dnat LMLM ( Ct ) ( 5 ) Figure 2 shows an overview of SCORE pre-training on an example SPARC dialogue from Figure 1 . We report additional implementation details for pre-training SCORE in Section 3.3 and Appendix C .
The paper proposes to pretrain contextual semantic parsing models on synthesized data with two new training objectives: Column Contextual Semantics (CCS) and Turn Contextual Switch (TCS). The CCS objective predicts correct database operations based on corresponding columns in tables. The TCS aims to predict the labels of conversational turn switch patterns categorized based on differences in meaning representations between dialogue turns. The synthetic data is generated by apply two utterance-SQL generation grammars. They show that the new approach significantly outperforms te baselines on Sparc, CoSQL, and MultiWOZ.
SP:bd9472600b9e7e4b407b0b2572179bc8cab7f272
Adaptive norms for deep learning with regularized Newton methods
1 INTRODUCTION . We consider finite-sum optimization problems of the form min w∈Rd [ L ( w ) : = n∑ i=1 ` ( f ( w , xi , yi ) ) ] , ( 1 ) which typically arise in neural network training , e.g . for empirical risk minimization over a set of data points ( xi , yi ) ∈ Rin × Rout , i = 1 , . . . , n. Here , ` : Rout × Rout → R+ is a convex loss function and f : Rin × Rd → Rout represents the neural network mapping parameterized by the concatenation of the weight layers w ∈ Rd , which is non-convex due to its multiplicative nature and potentially non-linear activation functions . We assume that L is lower bounded and twice differentiable , i.e . L ∈ C2 ( Rd , R ) and consider finding a first- and second-order stationary point w̄ for which ‖∇L ( w̄ ) ‖ ≤ g and λmin ( ∇2L ( w̄ ) ) ≥ − H . In the era of deep neural networks , stochastic gradient descent ( SGD ) is one of the most widely used training algorithms ( Bottou , 2010 ) . What makes SGD so attractive is its simplicity and per-iteration cost that is independent of the size of the training set ( n ) and scale linearly in the dimensionality ( d ) . However , gradient descent is known to be inadequate to optimize functions that are ill-conditioned ( Nesterov , 2013 ; Shalev-Shwartz et al. , 2017 ) and thus adaptive gradient methods that employ dynamic , coordinate-wise learning rates based on past gradients—including Adagrad ( Duchi et al. , 2011 ) , RMSprop ( Tieleman & Hinton , 2012 ) and Adam ( Kingma & Ba , 2014 ) —have become a popular alternative , often providing significant speed-ups over SGD . From a theoretical perspective , Newton methods provide stronger convergence guarantees by appropriately transforming the gradient in ill-conditioned regions according to second-order derivatives . It is precisely this Hessian information that allows regularized Newton methods to enjoy superlinear local convergence as well as to provably escape saddle points ( Conn et al. , 2000 ) . While second-order algorithms have a long-standing history even in the realm of neural network training ( Hagan & Menhaj , 1994 ; Becker et al. , 1988 ) , they were mostly considered as too computationally and memory expensive for practical applications . Yet , the seminal work of Martens ( 2010 ) renewed interest for their use in deep learning by proposing efficient Hessian-free methods that only access second-order information via matrix-vector products which can be computed at the cost of an additional backpropagation ( Pearlmutter , 1994 ; Schraudolph , 2002 ) . Among the class of regularized Newton methods , trust region ( Conn et al. , 2000 ) and cubic regularization algorithms ( Cartis et al. , 2011 ) are the most principled approaches in the sense that they yield the strongest convergence guarantees . Recently , stochastic extensions have emerged ( Xu et al. , 2017b ; Yao et al. , 2018 ; Kohler & Lucchi , 2017 ; Gratton et al. , 2017 ) , which suggest their applicability for deep learning . We here propose a simple modification to make TR methods even more suitable for neural network training . Particularly , we build upon the following alternative view on adaptive gradient methods : While gradient descent can be interpreted as a spherically constrained first-order TR method , preconditioned gradient methods—such as Adagrad—can be seen as first-order TR methods with ellipsoidal trust region constraint . This observation is particularly interesting since spherical constraints are blind to the underlying geometry of the problem , but ellipsoids can adapt to local landscape characteristics , thereby allowing for more suitable steps in regions that are ill-conditioned . We will leverage this analogy and investigate the use of the Adagrad and RMSProp preconditioning matrices as ellipsoidal trust region shapes within a stochastic second-order TR algorithm ( Xu et al. , 2017a ; Yao et al. , 2018 ) . Since no ellipsoid fits all objective functions , our main contribution lies in the identification of adequate matrix-induced constraints that lead to provable convergence and significant practical speed-ups for the specific case of deep learning . On the whole , our contribution is threefold : • We provide a new perspective on adaptive gradient methods that contributes to a better understanding of their inner-workings . • We investigate the first application of ellipsoidal TR methods for deep learning . We show that the RMSProp matrix can directly be applied as constraint inducing norm in second-order TR algorithms while preserving all convergence guarantees ( Theorem 1 ) . • Finally , we provide an experimental benchmark across different real-world datasets and architectures ( Section 5 ) . We compare second-order methods also to adaptive gradient methods and show results in terms of backpropagations , epochs , and wall-clock time ; a comparison we were not able to find in the literature . Our main empirical results demonstrate that ellipsoidal constraints prove to be a very effective modification of the trust region method in the sense that they constantly outperform the spherical TR method , both in terms of number of backprogations and asymptotic loss value on a variety of tasks . 2 RELATED WORK . First-order methods The prototypical method for optimizing Eq . ( 1 ) is SGD ( Robbins & Monro , 1951 ) . The practical success of SGD in non-convex optimization is unquestioned and theoretical explanations of this phenomenon are starting to appear . Recent findings suggest the ability of this method to escape saddle points and reach local minima in polynomial time , but they either need to artificially add noise to the iterates ( Ge et al. , 2015 ; Lee et al. , 2016 ) or make an assumption on the inherent noise of SGD ( Daneshmand et al. , 2018 ) . For neural networks , a recent line of research proclaims the effectiveness of SGD , but the results come at the cost of strong assumptions such as heavy over-parametrization and Gaussian inputs ( Du et al. , 2017 ; Brutzkus & Globerson , 2017 ; Li & Yuan , 2017 ; Du & Lee , 2018 ; Allen-Zhu et al. , 2018 ) . Adaptive gradient methods ( Duchi et al. , 2011 ; Tieleman & Hinton , 2012 ; Kingma & Ba , 2014 ) build on the intuition that larger ( smaller ) learning rates for smaller ( larger ) gradient components balance their respective influences and thereby the methods behave as if optimizing a more isotropic surface . Such approaches have first been suggested for neural nets by LeCun et al . ( 2012 ) and convergence guarantees are starting to appear ( Ward et al. , 2018 ; Li & Orabona , 2018 ) . However , these are not superior to the O ( −2g ) worst-case complexity of standard gradient descent ( Cartis et al. , 2012b ) . Regularized Newton methods The most principled class of regularized Newton methods are trust region ( TR ) and adaptive cubic regularization algorithms ( ARC ) ( Conn et al. , 2000 ; Cartis et al. , 2011 ) , which repeatedly optimize a local Taylor model of the objective while making sure that the step does not travel too far such that the model stays accurate . While the former finds first-order stationary points within O ( −2g ) , ARC only takes at most O ( −3/2 g ) . However , simple modifications to the TR framework allow these methods to obtain the same accelerated rate ( Curtis et al. , 2017 ) . Both methods take at most O ( −3H ) iterations to find an H approximate second-order stationary point ( Cartis et al. , 2012a ) . These rates are optimal for second-order Lipschitz continuous functions ( Carmon et al. , 2017 ; Cartis et al. , 2012a ) and they can be retained even when only sub-sampled gradient and Hessian information is used ( Kohler & Lucchi , 2017 ; Yao et al. , 2018 ; Xu et al. , 2017b ; Blanchet et al. , 2016 ; Liu et al. , 2018 ) . Furthermore , the involved Hessian information can be computed solely based on Hessian-vector products , which are implementable very efficiently ( Pearlmutter , 1994 ) . This makes these methods particularly attractive for deep learning , but the empirical evidence of their applicability is rather limited . We are only aware of the works of Liu et al . ( 2018 ) and Xu et al . ( 2017a ) , which report promising first results but are by no means fully encompassing . Gauss-Newton methods An interesting line of research proposes to replace the Hessian by ( approximations of ) the generalized-Gauss-Newton matrix ( GGN ) within a Levenberg-Marquardt framework1 ( LeCun et al. , 2012 ; Martens , 2010 ; Martens & Grosse , 2015 ) . As the GGN matrix is always positive semidefinite , these methods can not leverage negative curvature to escape saddles and hence , there exist no second-order convergence guarantees . Furthermore , there are cases in neural networks where the Hessian is better conditioned than the GGN matrix ( Mizutani & Dreyfus , 2008 ) . Nevertheless , the above works report promising preliminary results , most notably Grosse & Martens ( 2016 ) find that K-FAC can be faster than SGD on a small convnet . On the other hand , recent findings report performance at best comparable to SGD on the much larger ResNet architecture ( Ma et al. , 2019 ) . Moreover , Xu et al . ( 2017a ) reports many cases where TR and GGN algorithms perform similarly . This line of work can be seen as complementary to our approach since it is straightforward to replace the Hessian in the TR framework with the GGN matrix . Furthermore , the preconditioners used in Martens ( 2010 ) and Chapelle & Erhan ( 2011 ) , namely diagonal estimates of the empirical Fisher and Fisher matrix , respectively , can directly be used as matrix norms in our ellipsoidal TR framework . 3 AN ALTERNATIVE VIEW ON ADAPTIVE GRADIENT METHODS . Adaptively preconditioned gradient methods update iterates as wt+1 = wt − ηtA−1/2t gt , where gt is a stochastic estimate of ∇L ( wt ) and At is a positive definite symmetric pre-conditioning matrix . In Adagrad , Aada , t is the un-centered second moment matrix of the past gradients computed as Aada , t : = GtG ᵀ t + I , ( 2 ) where > 0 , I is the d× d identity matrix and Gt = [ g1 , g2 , . . . , gt ] . Building up on the intuition that past gradients might become obsolete in quickly changing non-convex landscapes , RMSprop ( and Adam ) introduce an exponential weight decay leading to the preconditioning matrix Arms , t : = ( ( 1− β ) Gt diag ( βt , . . . , β0 ) Gᵀt ) + I , ( 3 ) where β ∈ ( 0 , 1 ) . In order to save computational efforts , the diagonal versions diag ( Aada ) and diag ( Arms ) are more commonly applied in practice , which in turn gives rise to coordinate-wise adaptive stepsizes that are enlarged ( reduced ) in coordinates that have seen past gradient components with a smaller ( larger ) magnitude . 3.1 ADAPTIVE PRECONDITIONING AS ELLIPSOIDAL TRUST REGION . Starting from the fact that adaptive methods employ coordinate-wise stepsizes , one can take a principled view on these methods . Namely , their update steps arise from minimizing a first-order Taylor model of the function L within an ellipsoidal search space around the current iterate wt , where the diameter of the ellipsoid along a particular coordinate is implicitly given by ηt and ‖gt‖A−1t . Correspondingly , vanilla ( S ) GD optimizes the same first-order model within a spherical constraint . Figure 1 ( top ) illustrates this effect by showing not only the iterates of GD and Adagrad but also the implicit trust regions within which the local models were optimized at each step.2 It is well known that GD struggles to progress towards the minimizer of quadratics along lowcurvature directions ( see e.g. , Goh ( 2017 ) ) . While this effect is negligible for well-conditioned objectives ( Fig . 1 , left ) , it leads to a drastic slow-down when the problem is ill-conditioned ( Fig . 1 , 1This algorithm is a simplified TR method , initially tailored for non-linear least squares problems ( Nocedal & Wright , 2006 ) 2We only plot every other trust region . Since the models are linear , the minimizer is always on the boundary . center ) . Particularly , once the method has reached the bottom of the valley , it struggles to make progress along the horizontal axis . Here is precisely where the advantage of adaptive stepsize methods comes into play . As illustrated by the dashed lines , Adagrad ’ s search space is damped along the direction of high curvature ( vertical axis ) and elongated along the low curvature direction ( horizontal axis ) . This allows the method to move further horizontally early on to enter the valley with a smaller distance to the optimizer w∗ along the low curvature direction which accelerates convergence . Let us now formally establish the result that allows us to re-interpret adaptive gradient methods from the trust region perspective introduced above . Lemma 1 ( Preconditioned gradient methods as TR ) . A preconditioned gradient step wt+1 −wt = st : = −ηtA−1t gt ( 4 ) with stepsize ηt > 0 , symmetric positive definite preconditioner At ∈ Rd×d and gt 6= 0 minimizes a first-order model around wt ∈ Rd in an ellipsoid given by At in the sense that st : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖At ≤ ηt‖gt‖A−1t . ( 5 ) Corollary 1 ( Rmsprop ) . The step srms , t : = −ηtA−1/2rms , tgt minimizes a first-order Taylor model around wt in an ellipsoid given by A 1/2 rms , t ( Eq . 3 ) in the sense that srms , t : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖ A 1/2 rms , t ≤ ηt‖gt‖A−1/2rms , t . ( 6 ) Equivalent results can be established for Adam using gadam , t : = ( 1−β ) ∑t k=0 β t−kgt as well as for Adagrad by replacing the matrix Aada into the constraint in Eq . ( 6 ) . Of course , the update procedure in Eq . ( 5 ) is merely a reinterpretation of the original preconditioned update , and thus the employed trust region radii are defined implicitly by the current gradient and stepsize .
This paper analyzes adaptive methods like Adam and AMSProp, and shows that they can be re-interpreted as first order trust region methods with an ellipsoidal trust region (Lemma 1). The authors then propose a second order trust region method with similar ellipsoidal trust regions induced by the RMSProp matrices (Eq 7). Under some assumptions, they show that this algorithm will converge in a finite number of steps (depending upon the accuracy desired). They also show some experiments to demonstrate their algorithm.
SP:07bcf06ee98f73a12e1b49851490648bc71699aa
Adaptive norms for deep learning with regularized Newton methods
1 INTRODUCTION . We consider finite-sum optimization problems of the form min w∈Rd [ L ( w ) : = n∑ i=1 ` ( f ( w , xi , yi ) ) ] , ( 1 ) which typically arise in neural network training , e.g . for empirical risk minimization over a set of data points ( xi , yi ) ∈ Rin × Rout , i = 1 , . . . , n. Here , ` : Rout × Rout → R+ is a convex loss function and f : Rin × Rd → Rout represents the neural network mapping parameterized by the concatenation of the weight layers w ∈ Rd , which is non-convex due to its multiplicative nature and potentially non-linear activation functions . We assume that L is lower bounded and twice differentiable , i.e . L ∈ C2 ( Rd , R ) and consider finding a first- and second-order stationary point w̄ for which ‖∇L ( w̄ ) ‖ ≤ g and λmin ( ∇2L ( w̄ ) ) ≥ − H . In the era of deep neural networks , stochastic gradient descent ( SGD ) is one of the most widely used training algorithms ( Bottou , 2010 ) . What makes SGD so attractive is its simplicity and per-iteration cost that is independent of the size of the training set ( n ) and scale linearly in the dimensionality ( d ) . However , gradient descent is known to be inadequate to optimize functions that are ill-conditioned ( Nesterov , 2013 ; Shalev-Shwartz et al. , 2017 ) and thus adaptive gradient methods that employ dynamic , coordinate-wise learning rates based on past gradients—including Adagrad ( Duchi et al. , 2011 ) , RMSprop ( Tieleman & Hinton , 2012 ) and Adam ( Kingma & Ba , 2014 ) —have become a popular alternative , often providing significant speed-ups over SGD . From a theoretical perspective , Newton methods provide stronger convergence guarantees by appropriately transforming the gradient in ill-conditioned regions according to second-order derivatives . It is precisely this Hessian information that allows regularized Newton methods to enjoy superlinear local convergence as well as to provably escape saddle points ( Conn et al. , 2000 ) . While second-order algorithms have a long-standing history even in the realm of neural network training ( Hagan & Menhaj , 1994 ; Becker et al. , 1988 ) , they were mostly considered as too computationally and memory expensive for practical applications . Yet , the seminal work of Martens ( 2010 ) renewed interest for their use in deep learning by proposing efficient Hessian-free methods that only access second-order information via matrix-vector products which can be computed at the cost of an additional backpropagation ( Pearlmutter , 1994 ; Schraudolph , 2002 ) . Among the class of regularized Newton methods , trust region ( Conn et al. , 2000 ) and cubic regularization algorithms ( Cartis et al. , 2011 ) are the most principled approaches in the sense that they yield the strongest convergence guarantees . Recently , stochastic extensions have emerged ( Xu et al. , 2017b ; Yao et al. , 2018 ; Kohler & Lucchi , 2017 ; Gratton et al. , 2017 ) , which suggest their applicability for deep learning . We here propose a simple modification to make TR methods even more suitable for neural network training . Particularly , we build upon the following alternative view on adaptive gradient methods : While gradient descent can be interpreted as a spherically constrained first-order TR method , preconditioned gradient methods—such as Adagrad—can be seen as first-order TR methods with ellipsoidal trust region constraint . This observation is particularly interesting since spherical constraints are blind to the underlying geometry of the problem , but ellipsoids can adapt to local landscape characteristics , thereby allowing for more suitable steps in regions that are ill-conditioned . We will leverage this analogy and investigate the use of the Adagrad and RMSProp preconditioning matrices as ellipsoidal trust region shapes within a stochastic second-order TR algorithm ( Xu et al. , 2017a ; Yao et al. , 2018 ) . Since no ellipsoid fits all objective functions , our main contribution lies in the identification of adequate matrix-induced constraints that lead to provable convergence and significant practical speed-ups for the specific case of deep learning . On the whole , our contribution is threefold : • We provide a new perspective on adaptive gradient methods that contributes to a better understanding of their inner-workings . • We investigate the first application of ellipsoidal TR methods for deep learning . We show that the RMSProp matrix can directly be applied as constraint inducing norm in second-order TR algorithms while preserving all convergence guarantees ( Theorem 1 ) . • Finally , we provide an experimental benchmark across different real-world datasets and architectures ( Section 5 ) . We compare second-order methods also to adaptive gradient methods and show results in terms of backpropagations , epochs , and wall-clock time ; a comparison we were not able to find in the literature . Our main empirical results demonstrate that ellipsoidal constraints prove to be a very effective modification of the trust region method in the sense that they constantly outperform the spherical TR method , both in terms of number of backprogations and asymptotic loss value on a variety of tasks . 2 RELATED WORK . First-order methods The prototypical method for optimizing Eq . ( 1 ) is SGD ( Robbins & Monro , 1951 ) . The practical success of SGD in non-convex optimization is unquestioned and theoretical explanations of this phenomenon are starting to appear . Recent findings suggest the ability of this method to escape saddle points and reach local minima in polynomial time , but they either need to artificially add noise to the iterates ( Ge et al. , 2015 ; Lee et al. , 2016 ) or make an assumption on the inherent noise of SGD ( Daneshmand et al. , 2018 ) . For neural networks , a recent line of research proclaims the effectiveness of SGD , but the results come at the cost of strong assumptions such as heavy over-parametrization and Gaussian inputs ( Du et al. , 2017 ; Brutzkus & Globerson , 2017 ; Li & Yuan , 2017 ; Du & Lee , 2018 ; Allen-Zhu et al. , 2018 ) . Adaptive gradient methods ( Duchi et al. , 2011 ; Tieleman & Hinton , 2012 ; Kingma & Ba , 2014 ) build on the intuition that larger ( smaller ) learning rates for smaller ( larger ) gradient components balance their respective influences and thereby the methods behave as if optimizing a more isotropic surface . Such approaches have first been suggested for neural nets by LeCun et al . ( 2012 ) and convergence guarantees are starting to appear ( Ward et al. , 2018 ; Li & Orabona , 2018 ) . However , these are not superior to the O ( −2g ) worst-case complexity of standard gradient descent ( Cartis et al. , 2012b ) . Regularized Newton methods The most principled class of regularized Newton methods are trust region ( TR ) and adaptive cubic regularization algorithms ( ARC ) ( Conn et al. , 2000 ; Cartis et al. , 2011 ) , which repeatedly optimize a local Taylor model of the objective while making sure that the step does not travel too far such that the model stays accurate . While the former finds first-order stationary points within O ( −2g ) , ARC only takes at most O ( −3/2 g ) . However , simple modifications to the TR framework allow these methods to obtain the same accelerated rate ( Curtis et al. , 2017 ) . Both methods take at most O ( −3H ) iterations to find an H approximate second-order stationary point ( Cartis et al. , 2012a ) . These rates are optimal for second-order Lipschitz continuous functions ( Carmon et al. , 2017 ; Cartis et al. , 2012a ) and they can be retained even when only sub-sampled gradient and Hessian information is used ( Kohler & Lucchi , 2017 ; Yao et al. , 2018 ; Xu et al. , 2017b ; Blanchet et al. , 2016 ; Liu et al. , 2018 ) . Furthermore , the involved Hessian information can be computed solely based on Hessian-vector products , which are implementable very efficiently ( Pearlmutter , 1994 ) . This makes these methods particularly attractive for deep learning , but the empirical evidence of their applicability is rather limited . We are only aware of the works of Liu et al . ( 2018 ) and Xu et al . ( 2017a ) , which report promising first results but are by no means fully encompassing . Gauss-Newton methods An interesting line of research proposes to replace the Hessian by ( approximations of ) the generalized-Gauss-Newton matrix ( GGN ) within a Levenberg-Marquardt framework1 ( LeCun et al. , 2012 ; Martens , 2010 ; Martens & Grosse , 2015 ) . As the GGN matrix is always positive semidefinite , these methods can not leverage negative curvature to escape saddles and hence , there exist no second-order convergence guarantees . Furthermore , there are cases in neural networks where the Hessian is better conditioned than the GGN matrix ( Mizutani & Dreyfus , 2008 ) . Nevertheless , the above works report promising preliminary results , most notably Grosse & Martens ( 2016 ) find that K-FAC can be faster than SGD on a small convnet . On the other hand , recent findings report performance at best comparable to SGD on the much larger ResNet architecture ( Ma et al. , 2019 ) . Moreover , Xu et al . ( 2017a ) reports many cases where TR and GGN algorithms perform similarly . This line of work can be seen as complementary to our approach since it is straightforward to replace the Hessian in the TR framework with the GGN matrix . Furthermore , the preconditioners used in Martens ( 2010 ) and Chapelle & Erhan ( 2011 ) , namely diagonal estimates of the empirical Fisher and Fisher matrix , respectively , can directly be used as matrix norms in our ellipsoidal TR framework . 3 AN ALTERNATIVE VIEW ON ADAPTIVE GRADIENT METHODS . Adaptively preconditioned gradient methods update iterates as wt+1 = wt − ηtA−1/2t gt , where gt is a stochastic estimate of ∇L ( wt ) and At is a positive definite symmetric pre-conditioning matrix . In Adagrad , Aada , t is the un-centered second moment matrix of the past gradients computed as Aada , t : = GtG ᵀ t + I , ( 2 ) where > 0 , I is the d× d identity matrix and Gt = [ g1 , g2 , . . . , gt ] . Building up on the intuition that past gradients might become obsolete in quickly changing non-convex landscapes , RMSprop ( and Adam ) introduce an exponential weight decay leading to the preconditioning matrix Arms , t : = ( ( 1− β ) Gt diag ( βt , . . . , β0 ) Gᵀt ) + I , ( 3 ) where β ∈ ( 0 , 1 ) . In order to save computational efforts , the diagonal versions diag ( Aada ) and diag ( Arms ) are more commonly applied in practice , which in turn gives rise to coordinate-wise adaptive stepsizes that are enlarged ( reduced ) in coordinates that have seen past gradient components with a smaller ( larger ) magnitude . 3.1 ADAPTIVE PRECONDITIONING AS ELLIPSOIDAL TRUST REGION . Starting from the fact that adaptive methods employ coordinate-wise stepsizes , one can take a principled view on these methods . Namely , their update steps arise from minimizing a first-order Taylor model of the function L within an ellipsoidal search space around the current iterate wt , where the diameter of the ellipsoid along a particular coordinate is implicitly given by ηt and ‖gt‖A−1t . Correspondingly , vanilla ( S ) GD optimizes the same first-order model within a spherical constraint . Figure 1 ( top ) illustrates this effect by showing not only the iterates of GD and Adagrad but also the implicit trust regions within which the local models were optimized at each step.2 It is well known that GD struggles to progress towards the minimizer of quadratics along lowcurvature directions ( see e.g. , Goh ( 2017 ) ) . While this effect is negligible for well-conditioned objectives ( Fig . 1 , left ) , it leads to a drastic slow-down when the problem is ill-conditioned ( Fig . 1 , 1This algorithm is a simplified TR method , initially tailored for non-linear least squares problems ( Nocedal & Wright , 2006 ) 2We only plot every other trust region . Since the models are linear , the minimizer is always on the boundary . center ) . Particularly , once the method has reached the bottom of the valley , it struggles to make progress along the horizontal axis . Here is precisely where the advantage of adaptive stepsize methods comes into play . As illustrated by the dashed lines , Adagrad ’ s search space is damped along the direction of high curvature ( vertical axis ) and elongated along the low curvature direction ( horizontal axis ) . This allows the method to move further horizontally early on to enter the valley with a smaller distance to the optimizer w∗ along the low curvature direction which accelerates convergence . Let us now formally establish the result that allows us to re-interpret adaptive gradient methods from the trust region perspective introduced above . Lemma 1 ( Preconditioned gradient methods as TR ) . A preconditioned gradient step wt+1 −wt = st : = −ηtA−1t gt ( 4 ) with stepsize ηt > 0 , symmetric positive definite preconditioner At ∈ Rd×d and gt 6= 0 minimizes a first-order model around wt ∈ Rd in an ellipsoid given by At in the sense that st : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖At ≤ ηt‖gt‖A−1t . ( 5 ) Corollary 1 ( Rmsprop ) . The step srms , t : = −ηtA−1/2rms , tgt minimizes a first-order Taylor model around wt in an ellipsoid given by A 1/2 rms , t ( Eq . 3 ) in the sense that srms , t : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖ A 1/2 rms , t ≤ ηt‖gt‖A−1/2rms , t . ( 6 ) Equivalent results can be established for Adam using gadam , t : = ( 1−β ) ∑t k=0 β t−kgt as well as for Adagrad by replacing the matrix Aada into the constraint in Eq . ( 6 ) . Of course , the update procedure in Eq . ( 5 ) is merely a reinterpretation of the original preconditioned update , and thus the employed trust region radii are defined implicitly by the current gradient and stepsize .
The paper proposes novel stochastic ellipsoidal trust-region methods inspired by adaptive gradient methods and studies the application of them with adaptive diagonal preconditioners. Theoretical convergence analysis is provided for TR with RMSProp ellipsoid, and numerical results demonstrates the superiority of ellipsoided TR over uniform TR. Interestingly, the paper shows for the first time that, adaptive gradient methods can be view as first-order TR with ellipsoidal constraints. The negative comparative results with state-of-the-art adaptive methods are appreciated, showing that the TR-type methods may not be great choices for deep network training, since the Hessians are often diagonal-dominant in deep-learning practice, and hence the benefit of second-order methods are limited.
SP:07bcf06ee98f73a12e1b49851490648bc71699aa
Adaptive norms for deep learning with regularized Newton methods
1 INTRODUCTION . We consider finite-sum optimization problems of the form min w∈Rd [ L ( w ) : = n∑ i=1 ` ( f ( w , xi , yi ) ) ] , ( 1 ) which typically arise in neural network training , e.g . for empirical risk minimization over a set of data points ( xi , yi ) ∈ Rin × Rout , i = 1 , . . . , n. Here , ` : Rout × Rout → R+ is a convex loss function and f : Rin × Rd → Rout represents the neural network mapping parameterized by the concatenation of the weight layers w ∈ Rd , which is non-convex due to its multiplicative nature and potentially non-linear activation functions . We assume that L is lower bounded and twice differentiable , i.e . L ∈ C2 ( Rd , R ) and consider finding a first- and second-order stationary point w̄ for which ‖∇L ( w̄ ) ‖ ≤ g and λmin ( ∇2L ( w̄ ) ) ≥ − H . In the era of deep neural networks , stochastic gradient descent ( SGD ) is one of the most widely used training algorithms ( Bottou , 2010 ) . What makes SGD so attractive is its simplicity and per-iteration cost that is independent of the size of the training set ( n ) and scale linearly in the dimensionality ( d ) . However , gradient descent is known to be inadequate to optimize functions that are ill-conditioned ( Nesterov , 2013 ; Shalev-Shwartz et al. , 2017 ) and thus adaptive gradient methods that employ dynamic , coordinate-wise learning rates based on past gradients—including Adagrad ( Duchi et al. , 2011 ) , RMSprop ( Tieleman & Hinton , 2012 ) and Adam ( Kingma & Ba , 2014 ) —have become a popular alternative , often providing significant speed-ups over SGD . From a theoretical perspective , Newton methods provide stronger convergence guarantees by appropriately transforming the gradient in ill-conditioned regions according to second-order derivatives . It is precisely this Hessian information that allows regularized Newton methods to enjoy superlinear local convergence as well as to provably escape saddle points ( Conn et al. , 2000 ) . While second-order algorithms have a long-standing history even in the realm of neural network training ( Hagan & Menhaj , 1994 ; Becker et al. , 1988 ) , they were mostly considered as too computationally and memory expensive for practical applications . Yet , the seminal work of Martens ( 2010 ) renewed interest for their use in deep learning by proposing efficient Hessian-free methods that only access second-order information via matrix-vector products which can be computed at the cost of an additional backpropagation ( Pearlmutter , 1994 ; Schraudolph , 2002 ) . Among the class of regularized Newton methods , trust region ( Conn et al. , 2000 ) and cubic regularization algorithms ( Cartis et al. , 2011 ) are the most principled approaches in the sense that they yield the strongest convergence guarantees . Recently , stochastic extensions have emerged ( Xu et al. , 2017b ; Yao et al. , 2018 ; Kohler & Lucchi , 2017 ; Gratton et al. , 2017 ) , which suggest their applicability for deep learning . We here propose a simple modification to make TR methods even more suitable for neural network training . Particularly , we build upon the following alternative view on adaptive gradient methods : While gradient descent can be interpreted as a spherically constrained first-order TR method , preconditioned gradient methods—such as Adagrad—can be seen as first-order TR methods with ellipsoidal trust region constraint . This observation is particularly interesting since spherical constraints are blind to the underlying geometry of the problem , but ellipsoids can adapt to local landscape characteristics , thereby allowing for more suitable steps in regions that are ill-conditioned . We will leverage this analogy and investigate the use of the Adagrad and RMSProp preconditioning matrices as ellipsoidal trust region shapes within a stochastic second-order TR algorithm ( Xu et al. , 2017a ; Yao et al. , 2018 ) . Since no ellipsoid fits all objective functions , our main contribution lies in the identification of adequate matrix-induced constraints that lead to provable convergence and significant practical speed-ups for the specific case of deep learning . On the whole , our contribution is threefold : • We provide a new perspective on adaptive gradient methods that contributes to a better understanding of their inner-workings . • We investigate the first application of ellipsoidal TR methods for deep learning . We show that the RMSProp matrix can directly be applied as constraint inducing norm in second-order TR algorithms while preserving all convergence guarantees ( Theorem 1 ) . • Finally , we provide an experimental benchmark across different real-world datasets and architectures ( Section 5 ) . We compare second-order methods also to adaptive gradient methods and show results in terms of backpropagations , epochs , and wall-clock time ; a comparison we were not able to find in the literature . Our main empirical results demonstrate that ellipsoidal constraints prove to be a very effective modification of the trust region method in the sense that they constantly outperform the spherical TR method , both in terms of number of backprogations and asymptotic loss value on a variety of tasks . 2 RELATED WORK . First-order methods The prototypical method for optimizing Eq . ( 1 ) is SGD ( Robbins & Monro , 1951 ) . The practical success of SGD in non-convex optimization is unquestioned and theoretical explanations of this phenomenon are starting to appear . Recent findings suggest the ability of this method to escape saddle points and reach local minima in polynomial time , but they either need to artificially add noise to the iterates ( Ge et al. , 2015 ; Lee et al. , 2016 ) or make an assumption on the inherent noise of SGD ( Daneshmand et al. , 2018 ) . For neural networks , a recent line of research proclaims the effectiveness of SGD , but the results come at the cost of strong assumptions such as heavy over-parametrization and Gaussian inputs ( Du et al. , 2017 ; Brutzkus & Globerson , 2017 ; Li & Yuan , 2017 ; Du & Lee , 2018 ; Allen-Zhu et al. , 2018 ) . Adaptive gradient methods ( Duchi et al. , 2011 ; Tieleman & Hinton , 2012 ; Kingma & Ba , 2014 ) build on the intuition that larger ( smaller ) learning rates for smaller ( larger ) gradient components balance their respective influences and thereby the methods behave as if optimizing a more isotropic surface . Such approaches have first been suggested for neural nets by LeCun et al . ( 2012 ) and convergence guarantees are starting to appear ( Ward et al. , 2018 ; Li & Orabona , 2018 ) . However , these are not superior to the O ( −2g ) worst-case complexity of standard gradient descent ( Cartis et al. , 2012b ) . Regularized Newton methods The most principled class of regularized Newton methods are trust region ( TR ) and adaptive cubic regularization algorithms ( ARC ) ( Conn et al. , 2000 ; Cartis et al. , 2011 ) , which repeatedly optimize a local Taylor model of the objective while making sure that the step does not travel too far such that the model stays accurate . While the former finds first-order stationary points within O ( −2g ) , ARC only takes at most O ( −3/2 g ) . However , simple modifications to the TR framework allow these methods to obtain the same accelerated rate ( Curtis et al. , 2017 ) . Both methods take at most O ( −3H ) iterations to find an H approximate second-order stationary point ( Cartis et al. , 2012a ) . These rates are optimal for second-order Lipschitz continuous functions ( Carmon et al. , 2017 ; Cartis et al. , 2012a ) and they can be retained even when only sub-sampled gradient and Hessian information is used ( Kohler & Lucchi , 2017 ; Yao et al. , 2018 ; Xu et al. , 2017b ; Blanchet et al. , 2016 ; Liu et al. , 2018 ) . Furthermore , the involved Hessian information can be computed solely based on Hessian-vector products , which are implementable very efficiently ( Pearlmutter , 1994 ) . This makes these methods particularly attractive for deep learning , but the empirical evidence of their applicability is rather limited . We are only aware of the works of Liu et al . ( 2018 ) and Xu et al . ( 2017a ) , which report promising first results but are by no means fully encompassing . Gauss-Newton methods An interesting line of research proposes to replace the Hessian by ( approximations of ) the generalized-Gauss-Newton matrix ( GGN ) within a Levenberg-Marquardt framework1 ( LeCun et al. , 2012 ; Martens , 2010 ; Martens & Grosse , 2015 ) . As the GGN matrix is always positive semidefinite , these methods can not leverage negative curvature to escape saddles and hence , there exist no second-order convergence guarantees . Furthermore , there are cases in neural networks where the Hessian is better conditioned than the GGN matrix ( Mizutani & Dreyfus , 2008 ) . Nevertheless , the above works report promising preliminary results , most notably Grosse & Martens ( 2016 ) find that K-FAC can be faster than SGD on a small convnet . On the other hand , recent findings report performance at best comparable to SGD on the much larger ResNet architecture ( Ma et al. , 2019 ) . Moreover , Xu et al . ( 2017a ) reports many cases where TR and GGN algorithms perform similarly . This line of work can be seen as complementary to our approach since it is straightforward to replace the Hessian in the TR framework with the GGN matrix . Furthermore , the preconditioners used in Martens ( 2010 ) and Chapelle & Erhan ( 2011 ) , namely diagonal estimates of the empirical Fisher and Fisher matrix , respectively , can directly be used as matrix norms in our ellipsoidal TR framework . 3 AN ALTERNATIVE VIEW ON ADAPTIVE GRADIENT METHODS . Adaptively preconditioned gradient methods update iterates as wt+1 = wt − ηtA−1/2t gt , where gt is a stochastic estimate of ∇L ( wt ) and At is a positive definite symmetric pre-conditioning matrix . In Adagrad , Aada , t is the un-centered second moment matrix of the past gradients computed as Aada , t : = GtG ᵀ t + I , ( 2 ) where > 0 , I is the d× d identity matrix and Gt = [ g1 , g2 , . . . , gt ] . Building up on the intuition that past gradients might become obsolete in quickly changing non-convex landscapes , RMSprop ( and Adam ) introduce an exponential weight decay leading to the preconditioning matrix Arms , t : = ( ( 1− β ) Gt diag ( βt , . . . , β0 ) Gᵀt ) + I , ( 3 ) where β ∈ ( 0 , 1 ) . In order to save computational efforts , the diagonal versions diag ( Aada ) and diag ( Arms ) are more commonly applied in practice , which in turn gives rise to coordinate-wise adaptive stepsizes that are enlarged ( reduced ) in coordinates that have seen past gradient components with a smaller ( larger ) magnitude . 3.1 ADAPTIVE PRECONDITIONING AS ELLIPSOIDAL TRUST REGION . Starting from the fact that adaptive methods employ coordinate-wise stepsizes , one can take a principled view on these methods . Namely , their update steps arise from minimizing a first-order Taylor model of the function L within an ellipsoidal search space around the current iterate wt , where the diameter of the ellipsoid along a particular coordinate is implicitly given by ηt and ‖gt‖A−1t . Correspondingly , vanilla ( S ) GD optimizes the same first-order model within a spherical constraint . Figure 1 ( top ) illustrates this effect by showing not only the iterates of GD and Adagrad but also the implicit trust regions within which the local models were optimized at each step.2 It is well known that GD struggles to progress towards the minimizer of quadratics along lowcurvature directions ( see e.g. , Goh ( 2017 ) ) . While this effect is negligible for well-conditioned objectives ( Fig . 1 , left ) , it leads to a drastic slow-down when the problem is ill-conditioned ( Fig . 1 , 1This algorithm is a simplified TR method , initially tailored for non-linear least squares problems ( Nocedal & Wright , 2006 ) 2We only plot every other trust region . Since the models are linear , the minimizer is always on the boundary . center ) . Particularly , once the method has reached the bottom of the valley , it struggles to make progress along the horizontal axis . Here is precisely where the advantage of adaptive stepsize methods comes into play . As illustrated by the dashed lines , Adagrad ’ s search space is damped along the direction of high curvature ( vertical axis ) and elongated along the low curvature direction ( horizontal axis ) . This allows the method to move further horizontally early on to enter the valley with a smaller distance to the optimizer w∗ along the low curvature direction which accelerates convergence . Let us now formally establish the result that allows us to re-interpret adaptive gradient methods from the trust region perspective introduced above . Lemma 1 ( Preconditioned gradient methods as TR ) . A preconditioned gradient step wt+1 −wt = st : = −ηtA−1t gt ( 4 ) with stepsize ηt > 0 , symmetric positive definite preconditioner At ∈ Rd×d and gt 6= 0 minimizes a first-order model around wt ∈ Rd in an ellipsoid given by At in the sense that st : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖At ≤ ηt‖gt‖A−1t . ( 5 ) Corollary 1 ( Rmsprop ) . The step srms , t : = −ηtA−1/2rms , tgt minimizes a first-order Taylor model around wt in an ellipsoid given by A 1/2 rms , t ( Eq . 3 ) in the sense that srms , t : = arg min s∈Rd [ m1t ( s ) = L ( wt ) + sᵀgt ] , s.t . ‖s‖ A 1/2 rms , t ≤ ηt‖gt‖A−1/2rms , t . ( 6 ) Equivalent results can be established for Adam using gadam , t : = ( 1−β ) ∑t k=0 β t−kgt as well as for Adagrad by replacing the matrix Aada into the constraint in Eq . ( 6 ) . Of course , the update procedure in Eq . ( 5 ) is merely a reinterpretation of the original preconditioned update , and thus the employed trust region radii are defined implicitly by the current gradient and stepsize .
Authors propose a new perspective on adaptive gradient methods. Main contribution is a trust region based algorithm they call "Stochastic Ellipsoidal Trust Region Method" thats flexible to include both full, and diagonal matrix as the preconditioning matrix. Authors also mention that the preconditioners are generally diagonally dominant in practice, and may only require diagonal matrix (leaves full matrix for future work).
SP:07bcf06ee98f73a12e1b49851490648bc71699aa
Efficient Robust Training via Backward Smoothing
1 INTRODUCTION . Deep neural networks are well known to be vulnerable to adversarial examples ( Szegedy et al. , 2013 ) , i.e. , a small perturbation on the original input can lead to misclassification or erroneous prediction . Many defense methods have been developed to mitigate the disturbance of adversarial examples ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ; Madry et al. , 2018 ; Zhang et al. , 2019 ) , among which robust training methods , such as adversarial training ( Madry et al. , 2018 ) and TRADES ( Zhang et al. , 2019 ) , are currently the most effective strategies . Specifically , adversarial training method ( Madry et al. , 2018 ) trains a model on adversarial examples by solving a min-max optimization problem : min θ 1 n n∑ i=1 max x′i∈B ( xi ) L ( fθ ( x ′ i ) , yi ) , ( 1.1 ) where { ( xi , yi ) } ni=1 is the training dataset , f ( · ) denotes the logits output of the neural network , B ( xi ) : = { x : ‖x− xi‖∞ ≤ } denotes the -perturbation ball , and L is the cross-entropy loss . On the other hand , instead of directly training on adversarial examples , TRADES ( Zhang et al. , 2019 ) further improves model robustness with a trade-off between natural accuracy and robust accuracy , by solving the empirical risk minimization problem with a robust regularization term : min θ 1 n n∑ i=1 [ L ( fθ ( xi ) , yi ) + β max x′i∈B ( xi ) KL ( s ( fθ ( xi ) ) , s ( fθ ( x ′ i ) ) ) ] , ( 1.2 ) where s ( · ) denotes the softmax function , and β > 0 is a regularization parameter . The goal of this robust regularization term ( i.e. , KL divergence term ) is to ensure the outputs are stable within the local neighborhood . Both adversarial training and TRADES achieve good model robustness , as shown on recent model robustness leaderboards1 ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) . 1https : //github.com/fra31/auto-attack and https : //github.com/uclaml/RayS . However , a major drawback lies in that both are highly time-consuming for training , limiting their usefulness in practice . This is largely due to the fact that both methods perform iterative adversarial attacks ( i.e. , Projected Gradient Descent ) to solve the inner maximization problem in each outer minimization step . Recently , Wong et al . ( 2020 ) shows that it is possible to use single-step adversarial attacks to solve the inner maximization problem , which previously was believed impossible . The key ingredient in their approach is adding a random initialization step before the single-step adversarial attack . This simple change leads to a reasonably robust model that outperforms other fast robust training techniques , e.g. , Shafahi et al . ( 2019 ) . However , it remains a mystery why random initialization is empirically effective . Furthermore , compared to state-of-the-art robust training models ( Madry et al. , 2018 ; Zhang et al. , 2019 ) , this approach still lags behind on model robustness . In this work , we aim to understand the role of random initialization , as well as closing the robustness gap between adversarial training and Fast Adversarial Training ( Fast AT ) ( Wong et al. , 2020 ) . We propose a new principle towards understanding Fast AT - that random initialization can be viewed as performing randomized smoothing for better optimization of the inner maximization problem . We demonstrate that the smoothing effect by random initialization is not sufficient under the adversarial perturbation constraint . By proposing a new initialization strategy , backward smoothing , which strengthens the smoothing effect within the -perturbation ball , we present a new fast robust training method based on TRADES ( Zhang et al. , 2019 ) . The resulting method significantly improves both stability and model robustness over the single-step version of TRADES ( Zhang et al. , 2019 ) , while consuming much less training time ( ∼ 3x improvement with the same training schedule ) . 2 RELATED WORK . There exists a large body of work on adversarial attacks and defenses . In this section , we only review the most relevant work to ours . Adversarial Attack The concept of adversarial examples was first proposed in Szegedy et al . ( 2013 ) . Since then , many methods have been proposed , such as Fast Gradient Sign Method ( FGSM ) ( Goodfellow et al. , 2015 ) , and Projected Gradient Descent ( PGD ) ( Kurakin et al. , 2016 ; Madry et al. , 2018 ) . Later on , various attacks ( Papernot et al. , 2016 ; Moosavi-Dezfooli et al. , 2016 ; Carlini & Wagner , 2017 ; Athalye et al. , 2018 ; Chen et al. , 2020 ; Croce & Hein , 2020a ) were also proposed for better effectiveness or efficiency . There are also many attacks focused on different attack settings . Chen et al . ( 2017 ) proposed a black-box attack where the gradient is not available , by estimating the gradient via finite-differences . Various methods ( Ilyas et al. , 2018 ; Al-Dujaili & O ’ Reilly , 2020 ; Moon et al. , 2019 ; Andriushchenko et al. , 2019 ; Tashiro et al. , 2020 ) have been developed to improve the query efficiency of Chen et al . ( 2017 ) . Other methods ( Brendel et al. , 2018 ; Cheng et al. , 2019 ; 2020 ) focused on the more challenging hard-label attack setting , where only the prediction labels are available . On the other hand , there is recent work ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) that aims to accurately evaluate the model robustness via ensemble of attacks or effective hard-label attack . Robust Training Many heuristic defenses ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ) were proposed when the concept of adversarial examples was first introduced . However , they are later shown by Athalye et al . ( 2018 ) as not truly robust . Adversarial training ( Madry et al. , 2018 ) is the first effective method towards defending against adversarial examples . In Wang et al . ( 2019 ) , a new convergence quality criterion was proposed . Zhang et al . ( 2019 ) showed the trade-off between natural accuracy and robust accuracy . Wang et al . ( 2020 ) proposed to improve model robustness by better utilizing misclassified examples . Another line of research utilizes extra information ( e.g. , pre-trained models ( Hendrycks et al. , 2019 ) or extra unlabeled data ( Carmon et al. , 2019 ; Alayrac et al. , 2019 ) ) to further improve robustness . Other work focuses on improving training efficiency , such as free adversarial training from Shafahi et al . ( 2019 ) and Fast AT from Wong et al . ( 2020 ) using single-step attack ( FGSM ) with random initialization . Li et al . ( 2020 ) proposed a hybrid approach for improving Fast AT which is orthogonal to ours . Andriushchenko & Flammarion ( 2020 ) proposed a new regularizer promoting gradient alignment . Yet , it is not focused on closing the robustness gap with state-of-the-arts . Randomized Smoothing Duchi et al . ( 2012 ) proposed the randomized smoothing technique and proved variance-based convergence rates for non-smooth optimization . Later on , this technique was applied to certified adversarial defenses ( Cohen et al. , 2019 ; Salman et al. , 2019 ) for building robust models with certified robustness guarantees . In this paper , we are not targeting certified defenses . Instead , we use the randomized smoothing concept in optimization to explain Fast AT . 3 WHY RANDOM INITIALIZATION HELPS ? . We aim to explain why random initialization in Fast AT is effective , and propose a new understanding that random initialization can be viewed as performing randomized smoothing on the inner maximization problem in adversarial training ( Madry et al. , 2018 ) . Below , we first introduce the randomized smoothing technique ( Duchi et al. , 2012 ) in optimization . It is well known from optimization theory ( Boyd et al. , 2004 ) that non-smooth objectives are generally harder to optimize compared with smooth objectives . In general , a smoother loss function allows us to use a larger step size while guaranteeing the convergence of gradient-based algorithms . Randomized smoothing technique ( Duchi et al. , 2012 ) was proposed based on the observation that random perturbation of the optimization variable can be used to transform the loss into a smoother one . Instead of using only the gradient at the original iterate , randomized smoothing proposes to randomly generate perturbed iterates and use their gradients for optimization procedure . More details are provided in Appendix A . Let us recall the inner maximization problem in adversarial training : max δ∈B ( 0 ) L ( fθ ( x+ δ ) , y ) . ( 3.1 ) Here , fθ denotes a neural network parameterized by θ . In general , neural networks are non-smooth due to ReLU activations and pooling layers . This suggests that ( 3.1 ) can be difficult to solve , and using gradient descent with large step size can lead to divergence in the maximization problem . It also explains why directly using single-step projected gradient ascent without random initialization fails ( Wong et al. , 2020 ) . Now , let us apply randomized smoothing to ( 3.1 ) : max δ∈B ( 0 ) Eξ∼U ( −1,1 ) L ( fθ ( x+ δ + ξ ) , y ) , ( 3.2 ) where ξ is the perturbation vector for randomized smoothing , and δ is the perturbation vector for later gradient update step ( initialized as zero ) . Suppose we solve ( 3.2 ) in a stochastic fashion ( i.e. , sample a random perturbation ξ instead of computing the expectation over ξ ) , and using only one step gradient update . We can see that this reduces to the Fast AT formulation . This suggests that Fast AT can be viewed as performing stochastic single-step attacks on a randomized smoothed objective function which allows using larger step size . This explains why random initialization helps Fast AT as it makes the loss objective smoother and thus easier to optimize . It is worth noting that Andriushchenko & Flammarion ( 2020 ) also provided an explanation of why Fast Adversarial Training works : random initialization reduces the magnitude of the perturbation and thus the network becomes more linear and fits better toward single-step attack . While we argue that the random initialization works as randomized smoothing for smoothing the inner maximization problem and makes it easier to solve . In fact , our argument is more general and can cover theirs , because if the loss function is approximately linear , then it will be very smooth , i.e. , the second-order term in the Taylor expansion is very small . 4 PROPOSED APPROACH . 4.1 DRAWBACKS OF THE RANDOM INITIALIZATION STRATEGY . Although Fast AT achieves much faster robust training compared with standard adversarial training ( Madry et al. , 2018 ) , it exposes several major weaknesses . For demonstration , we exclude the additional acceleration techniques introduced in Wong et al . ( 2020 ) for accelerating the training speed ( e.g. , mix-precision training , cyclic learning rate ) , and instead apply standard piecewise learning rate decay used in Madry et al . ( 2018 ) ; Zhang et al . ( 2019 ) with the decay point set at the 50-th and 75-th epochs . Performance Stability As observed in Li et al . ( 2020 ) , Fast AT can be highly unstable ( i.e. , large variance in robust performance ) when using traditional piecewise learning rate decay schedule . We argue that this is because Wong et al . ( 2020 ) utilized a drastically large attack step size ( 10/255 , even larger than the perturbation limit ) , which causes unstable training behavior . To validate this , we run Fast AT on CIFAR-10 using ResNet-18 model ( He et al. , 2016 ) for 10 times with different step sizes . Note that we adopt early-stopping and record the best-performing model among 100 epochs . As shown in Figure 1 , although the single-best robustness performance is obtained by using step size 10/255 , the variance is very high . Moreover , most trials lead to weak robust performance with a low average and median robust accuracy . On the other hand , we observe that when using step size 8/255 , model robustness is more stable and higher on average . Note that using a too small step size would by nature hurt model robustness . These observations suggest that Fast AT can not achieve the best performance on robust performance and stability simultaneously . Potential for Robustness Improvement Fast AT uses standard adversarial training ( Madry et al. , 2018 ) as the baseline , and can obtain similar robustness performance . However , later work ( Rice et al. , 2020 ) shows that adversarial training can cause the overfitting problem , while early stopping can largely improve robustness . Zhang et al . ( 2019 ) further achieves even better model robustness that is much higher than what Fast AT obtains . From Table 1 , we observe that there exists an 8 % robust accuracy gap between Fast AT ( average over 10 runs ) and the best-performing TRADES model . Even for the best out of 10 trials , there is still a 6 % gap . This indicates that Fast AT is still far from optimal , and there is still big room for further robustness improvement .
The paper proposes Backward Smoothing to close the gap in terms of robustness between standard multi-step and fast (one or two steps) adversarial training (AT). In particular, at high level, given a network $f$, a point $x$ and its logits $f(x)$ it suggests to first sample a random perturbation $\psi$ in the logits space around $f(x)$ and second computing, via one step of gradient descent, $\xi^*$ so to minimize the KL-divergence between the softmax values of $f(x) + \psi$ and $f(x + \xi^*)$. Then $x + \xi^*$ is used as starting point for one-step AT. The rationale behind the scheme is that the random step commonly added to $x$ before AT might be not sufficient to achieve a smoothing effect on the loss function and then an effective optimization.
SP:396b87ea41744461ca381150153efdf374c2222f
Efficient Robust Training via Backward Smoothing
1 INTRODUCTION . Deep neural networks are well known to be vulnerable to adversarial examples ( Szegedy et al. , 2013 ) , i.e. , a small perturbation on the original input can lead to misclassification or erroneous prediction . Many defense methods have been developed to mitigate the disturbance of adversarial examples ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ; Madry et al. , 2018 ; Zhang et al. , 2019 ) , among which robust training methods , such as adversarial training ( Madry et al. , 2018 ) and TRADES ( Zhang et al. , 2019 ) , are currently the most effective strategies . Specifically , adversarial training method ( Madry et al. , 2018 ) trains a model on adversarial examples by solving a min-max optimization problem : min θ 1 n n∑ i=1 max x′i∈B ( xi ) L ( fθ ( x ′ i ) , yi ) , ( 1.1 ) where { ( xi , yi ) } ni=1 is the training dataset , f ( · ) denotes the logits output of the neural network , B ( xi ) : = { x : ‖x− xi‖∞ ≤ } denotes the -perturbation ball , and L is the cross-entropy loss . On the other hand , instead of directly training on adversarial examples , TRADES ( Zhang et al. , 2019 ) further improves model robustness with a trade-off between natural accuracy and robust accuracy , by solving the empirical risk minimization problem with a robust regularization term : min θ 1 n n∑ i=1 [ L ( fθ ( xi ) , yi ) + β max x′i∈B ( xi ) KL ( s ( fθ ( xi ) ) , s ( fθ ( x ′ i ) ) ) ] , ( 1.2 ) where s ( · ) denotes the softmax function , and β > 0 is a regularization parameter . The goal of this robust regularization term ( i.e. , KL divergence term ) is to ensure the outputs are stable within the local neighborhood . Both adversarial training and TRADES achieve good model robustness , as shown on recent model robustness leaderboards1 ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) . 1https : //github.com/fra31/auto-attack and https : //github.com/uclaml/RayS . However , a major drawback lies in that both are highly time-consuming for training , limiting their usefulness in practice . This is largely due to the fact that both methods perform iterative adversarial attacks ( i.e. , Projected Gradient Descent ) to solve the inner maximization problem in each outer minimization step . Recently , Wong et al . ( 2020 ) shows that it is possible to use single-step adversarial attacks to solve the inner maximization problem , which previously was believed impossible . The key ingredient in their approach is adding a random initialization step before the single-step adversarial attack . This simple change leads to a reasonably robust model that outperforms other fast robust training techniques , e.g. , Shafahi et al . ( 2019 ) . However , it remains a mystery why random initialization is empirically effective . Furthermore , compared to state-of-the-art robust training models ( Madry et al. , 2018 ; Zhang et al. , 2019 ) , this approach still lags behind on model robustness . In this work , we aim to understand the role of random initialization , as well as closing the robustness gap between adversarial training and Fast Adversarial Training ( Fast AT ) ( Wong et al. , 2020 ) . We propose a new principle towards understanding Fast AT - that random initialization can be viewed as performing randomized smoothing for better optimization of the inner maximization problem . We demonstrate that the smoothing effect by random initialization is not sufficient under the adversarial perturbation constraint . By proposing a new initialization strategy , backward smoothing , which strengthens the smoothing effect within the -perturbation ball , we present a new fast robust training method based on TRADES ( Zhang et al. , 2019 ) . The resulting method significantly improves both stability and model robustness over the single-step version of TRADES ( Zhang et al. , 2019 ) , while consuming much less training time ( ∼ 3x improvement with the same training schedule ) . 2 RELATED WORK . There exists a large body of work on adversarial attacks and defenses . In this section , we only review the most relevant work to ours . Adversarial Attack The concept of adversarial examples was first proposed in Szegedy et al . ( 2013 ) . Since then , many methods have been proposed , such as Fast Gradient Sign Method ( FGSM ) ( Goodfellow et al. , 2015 ) , and Projected Gradient Descent ( PGD ) ( Kurakin et al. , 2016 ; Madry et al. , 2018 ) . Later on , various attacks ( Papernot et al. , 2016 ; Moosavi-Dezfooli et al. , 2016 ; Carlini & Wagner , 2017 ; Athalye et al. , 2018 ; Chen et al. , 2020 ; Croce & Hein , 2020a ) were also proposed for better effectiveness or efficiency . There are also many attacks focused on different attack settings . Chen et al . ( 2017 ) proposed a black-box attack where the gradient is not available , by estimating the gradient via finite-differences . Various methods ( Ilyas et al. , 2018 ; Al-Dujaili & O ’ Reilly , 2020 ; Moon et al. , 2019 ; Andriushchenko et al. , 2019 ; Tashiro et al. , 2020 ) have been developed to improve the query efficiency of Chen et al . ( 2017 ) . Other methods ( Brendel et al. , 2018 ; Cheng et al. , 2019 ; 2020 ) focused on the more challenging hard-label attack setting , where only the prediction labels are available . On the other hand , there is recent work ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) that aims to accurately evaluate the model robustness via ensemble of attacks or effective hard-label attack . Robust Training Many heuristic defenses ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ) were proposed when the concept of adversarial examples was first introduced . However , they are later shown by Athalye et al . ( 2018 ) as not truly robust . Adversarial training ( Madry et al. , 2018 ) is the first effective method towards defending against adversarial examples . In Wang et al . ( 2019 ) , a new convergence quality criterion was proposed . Zhang et al . ( 2019 ) showed the trade-off between natural accuracy and robust accuracy . Wang et al . ( 2020 ) proposed to improve model robustness by better utilizing misclassified examples . Another line of research utilizes extra information ( e.g. , pre-trained models ( Hendrycks et al. , 2019 ) or extra unlabeled data ( Carmon et al. , 2019 ; Alayrac et al. , 2019 ) ) to further improve robustness . Other work focuses on improving training efficiency , such as free adversarial training from Shafahi et al . ( 2019 ) and Fast AT from Wong et al . ( 2020 ) using single-step attack ( FGSM ) with random initialization . Li et al . ( 2020 ) proposed a hybrid approach for improving Fast AT which is orthogonal to ours . Andriushchenko & Flammarion ( 2020 ) proposed a new regularizer promoting gradient alignment . Yet , it is not focused on closing the robustness gap with state-of-the-arts . Randomized Smoothing Duchi et al . ( 2012 ) proposed the randomized smoothing technique and proved variance-based convergence rates for non-smooth optimization . Later on , this technique was applied to certified adversarial defenses ( Cohen et al. , 2019 ; Salman et al. , 2019 ) for building robust models with certified robustness guarantees . In this paper , we are not targeting certified defenses . Instead , we use the randomized smoothing concept in optimization to explain Fast AT . 3 WHY RANDOM INITIALIZATION HELPS ? . We aim to explain why random initialization in Fast AT is effective , and propose a new understanding that random initialization can be viewed as performing randomized smoothing on the inner maximization problem in adversarial training ( Madry et al. , 2018 ) . Below , we first introduce the randomized smoothing technique ( Duchi et al. , 2012 ) in optimization . It is well known from optimization theory ( Boyd et al. , 2004 ) that non-smooth objectives are generally harder to optimize compared with smooth objectives . In general , a smoother loss function allows us to use a larger step size while guaranteeing the convergence of gradient-based algorithms . Randomized smoothing technique ( Duchi et al. , 2012 ) was proposed based on the observation that random perturbation of the optimization variable can be used to transform the loss into a smoother one . Instead of using only the gradient at the original iterate , randomized smoothing proposes to randomly generate perturbed iterates and use their gradients for optimization procedure . More details are provided in Appendix A . Let us recall the inner maximization problem in adversarial training : max δ∈B ( 0 ) L ( fθ ( x+ δ ) , y ) . ( 3.1 ) Here , fθ denotes a neural network parameterized by θ . In general , neural networks are non-smooth due to ReLU activations and pooling layers . This suggests that ( 3.1 ) can be difficult to solve , and using gradient descent with large step size can lead to divergence in the maximization problem . It also explains why directly using single-step projected gradient ascent without random initialization fails ( Wong et al. , 2020 ) . Now , let us apply randomized smoothing to ( 3.1 ) : max δ∈B ( 0 ) Eξ∼U ( −1,1 ) L ( fθ ( x+ δ + ξ ) , y ) , ( 3.2 ) where ξ is the perturbation vector for randomized smoothing , and δ is the perturbation vector for later gradient update step ( initialized as zero ) . Suppose we solve ( 3.2 ) in a stochastic fashion ( i.e. , sample a random perturbation ξ instead of computing the expectation over ξ ) , and using only one step gradient update . We can see that this reduces to the Fast AT formulation . This suggests that Fast AT can be viewed as performing stochastic single-step attacks on a randomized smoothed objective function which allows using larger step size . This explains why random initialization helps Fast AT as it makes the loss objective smoother and thus easier to optimize . It is worth noting that Andriushchenko & Flammarion ( 2020 ) also provided an explanation of why Fast Adversarial Training works : random initialization reduces the magnitude of the perturbation and thus the network becomes more linear and fits better toward single-step attack . While we argue that the random initialization works as randomized smoothing for smoothing the inner maximization problem and makes it easier to solve . In fact , our argument is more general and can cover theirs , because if the loss function is approximately linear , then it will be very smooth , i.e. , the second-order term in the Taylor expansion is very small . 4 PROPOSED APPROACH . 4.1 DRAWBACKS OF THE RANDOM INITIALIZATION STRATEGY . Although Fast AT achieves much faster robust training compared with standard adversarial training ( Madry et al. , 2018 ) , it exposes several major weaknesses . For demonstration , we exclude the additional acceleration techniques introduced in Wong et al . ( 2020 ) for accelerating the training speed ( e.g. , mix-precision training , cyclic learning rate ) , and instead apply standard piecewise learning rate decay used in Madry et al . ( 2018 ) ; Zhang et al . ( 2019 ) with the decay point set at the 50-th and 75-th epochs . Performance Stability As observed in Li et al . ( 2020 ) , Fast AT can be highly unstable ( i.e. , large variance in robust performance ) when using traditional piecewise learning rate decay schedule . We argue that this is because Wong et al . ( 2020 ) utilized a drastically large attack step size ( 10/255 , even larger than the perturbation limit ) , which causes unstable training behavior . To validate this , we run Fast AT on CIFAR-10 using ResNet-18 model ( He et al. , 2016 ) for 10 times with different step sizes . Note that we adopt early-stopping and record the best-performing model among 100 epochs . As shown in Figure 1 , although the single-best robustness performance is obtained by using step size 10/255 , the variance is very high . Moreover , most trials lead to weak robust performance with a low average and median robust accuracy . On the other hand , we observe that when using step size 8/255 , model robustness is more stable and higher on average . Note that using a too small step size would by nature hurt model robustness . These observations suggest that Fast AT can not achieve the best performance on robust performance and stability simultaneously . Potential for Robustness Improvement Fast AT uses standard adversarial training ( Madry et al. , 2018 ) as the baseline , and can obtain similar robustness performance . However , later work ( Rice et al. , 2020 ) shows that adversarial training can cause the overfitting problem , while early stopping can largely improve robustness . Zhang et al . ( 2019 ) further achieves even better model robustness that is much higher than what Fast AT obtains . From Table 1 , we observe that there exists an 8 % robust accuracy gap between Fast AT ( average over 10 runs ) and the best-performing TRADES model . Even for the best out of 10 trials , there is still a 6 % gap . This indicates that Fast AT is still far from optimal , and there is still big room for further robustness improvement .
The paper proposes a new algorithm for performing fast adversarial training. The proposed algorithm consists in solving the inner maximization problem in the following way: first, one takes a step of projected gradient descent (PGD) wrt an auxiliary loss (motivated by the idea of backward smoothing), and then one takes another step of PGD wrt the original loss function which is the KL divergence as suggested by the TRADES paper. The authors argue that taking two steps of PGD wrt different losses leads (perhaps, surprisingly) to higher robustness compared to taking two steps of PGD wrt the same original loss function.
SP:396b87ea41744461ca381150153efdf374c2222f
Efficient Robust Training via Backward Smoothing
1 INTRODUCTION . Deep neural networks are well known to be vulnerable to adversarial examples ( Szegedy et al. , 2013 ) , i.e. , a small perturbation on the original input can lead to misclassification or erroneous prediction . Many defense methods have been developed to mitigate the disturbance of adversarial examples ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ; Madry et al. , 2018 ; Zhang et al. , 2019 ) , among which robust training methods , such as adversarial training ( Madry et al. , 2018 ) and TRADES ( Zhang et al. , 2019 ) , are currently the most effective strategies . Specifically , adversarial training method ( Madry et al. , 2018 ) trains a model on adversarial examples by solving a min-max optimization problem : min θ 1 n n∑ i=1 max x′i∈B ( xi ) L ( fθ ( x ′ i ) , yi ) , ( 1.1 ) where { ( xi , yi ) } ni=1 is the training dataset , f ( · ) denotes the logits output of the neural network , B ( xi ) : = { x : ‖x− xi‖∞ ≤ } denotes the -perturbation ball , and L is the cross-entropy loss . On the other hand , instead of directly training on adversarial examples , TRADES ( Zhang et al. , 2019 ) further improves model robustness with a trade-off between natural accuracy and robust accuracy , by solving the empirical risk minimization problem with a robust regularization term : min θ 1 n n∑ i=1 [ L ( fθ ( xi ) , yi ) + β max x′i∈B ( xi ) KL ( s ( fθ ( xi ) ) , s ( fθ ( x ′ i ) ) ) ] , ( 1.2 ) where s ( · ) denotes the softmax function , and β > 0 is a regularization parameter . The goal of this robust regularization term ( i.e. , KL divergence term ) is to ensure the outputs are stable within the local neighborhood . Both adversarial training and TRADES achieve good model robustness , as shown on recent model robustness leaderboards1 ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) . 1https : //github.com/fra31/auto-attack and https : //github.com/uclaml/RayS . However , a major drawback lies in that both are highly time-consuming for training , limiting their usefulness in practice . This is largely due to the fact that both methods perform iterative adversarial attacks ( i.e. , Projected Gradient Descent ) to solve the inner maximization problem in each outer minimization step . Recently , Wong et al . ( 2020 ) shows that it is possible to use single-step adversarial attacks to solve the inner maximization problem , which previously was believed impossible . The key ingredient in their approach is adding a random initialization step before the single-step adversarial attack . This simple change leads to a reasonably robust model that outperforms other fast robust training techniques , e.g. , Shafahi et al . ( 2019 ) . However , it remains a mystery why random initialization is empirically effective . Furthermore , compared to state-of-the-art robust training models ( Madry et al. , 2018 ; Zhang et al. , 2019 ) , this approach still lags behind on model robustness . In this work , we aim to understand the role of random initialization , as well as closing the robustness gap between adversarial training and Fast Adversarial Training ( Fast AT ) ( Wong et al. , 2020 ) . We propose a new principle towards understanding Fast AT - that random initialization can be viewed as performing randomized smoothing for better optimization of the inner maximization problem . We demonstrate that the smoothing effect by random initialization is not sufficient under the adversarial perturbation constraint . By proposing a new initialization strategy , backward smoothing , which strengthens the smoothing effect within the -perturbation ball , we present a new fast robust training method based on TRADES ( Zhang et al. , 2019 ) . The resulting method significantly improves both stability and model robustness over the single-step version of TRADES ( Zhang et al. , 2019 ) , while consuming much less training time ( ∼ 3x improvement with the same training schedule ) . 2 RELATED WORK . There exists a large body of work on adversarial attacks and defenses . In this section , we only review the most relevant work to ours . Adversarial Attack The concept of adversarial examples was first proposed in Szegedy et al . ( 2013 ) . Since then , many methods have been proposed , such as Fast Gradient Sign Method ( FGSM ) ( Goodfellow et al. , 2015 ) , and Projected Gradient Descent ( PGD ) ( Kurakin et al. , 2016 ; Madry et al. , 2018 ) . Later on , various attacks ( Papernot et al. , 2016 ; Moosavi-Dezfooli et al. , 2016 ; Carlini & Wagner , 2017 ; Athalye et al. , 2018 ; Chen et al. , 2020 ; Croce & Hein , 2020a ) were also proposed for better effectiveness or efficiency . There are also many attacks focused on different attack settings . Chen et al . ( 2017 ) proposed a black-box attack where the gradient is not available , by estimating the gradient via finite-differences . Various methods ( Ilyas et al. , 2018 ; Al-Dujaili & O ’ Reilly , 2020 ; Moon et al. , 2019 ; Andriushchenko et al. , 2019 ; Tashiro et al. , 2020 ) have been developed to improve the query efficiency of Chen et al . ( 2017 ) . Other methods ( Brendel et al. , 2018 ; Cheng et al. , 2019 ; 2020 ) focused on the more challenging hard-label attack setting , where only the prediction labels are available . On the other hand , there is recent work ( Croce & Hein , 2020b ; Chen & Gu , 2020 ) that aims to accurately evaluate the model robustness via ensemble of attacks or effective hard-label attack . Robust Training Many heuristic defenses ( Guo et al. , 2018 ; Xie et al. , 2018 ; Song et al. , 2018 ; Ma et al. , 2018 ; Samangouei et al. , 2018 ; Dhillon et al. , 2018 ) were proposed when the concept of adversarial examples was first introduced . However , they are later shown by Athalye et al . ( 2018 ) as not truly robust . Adversarial training ( Madry et al. , 2018 ) is the first effective method towards defending against adversarial examples . In Wang et al . ( 2019 ) , a new convergence quality criterion was proposed . Zhang et al . ( 2019 ) showed the trade-off between natural accuracy and robust accuracy . Wang et al . ( 2020 ) proposed to improve model robustness by better utilizing misclassified examples . Another line of research utilizes extra information ( e.g. , pre-trained models ( Hendrycks et al. , 2019 ) or extra unlabeled data ( Carmon et al. , 2019 ; Alayrac et al. , 2019 ) ) to further improve robustness . Other work focuses on improving training efficiency , such as free adversarial training from Shafahi et al . ( 2019 ) and Fast AT from Wong et al . ( 2020 ) using single-step attack ( FGSM ) with random initialization . Li et al . ( 2020 ) proposed a hybrid approach for improving Fast AT which is orthogonal to ours . Andriushchenko & Flammarion ( 2020 ) proposed a new regularizer promoting gradient alignment . Yet , it is not focused on closing the robustness gap with state-of-the-arts . Randomized Smoothing Duchi et al . ( 2012 ) proposed the randomized smoothing technique and proved variance-based convergence rates for non-smooth optimization . Later on , this technique was applied to certified adversarial defenses ( Cohen et al. , 2019 ; Salman et al. , 2019 ) for building robust models with certified robustness guarantees . In this paper , we are not targeting certified defenses . Instead , we use the randomized smoothing concept in optimization to explain Fast AT . 3 WHY RANDOM INITIALIZATION HELPS ? . We aim to explain why random initialization in Fast AT is effective , and propose a new understanding that random initialization can be viewed as performing randomized smoothing on the inner maximization problem in adversarial training ( Madry et al. , 2018 ) . Below , we first introduce the randomized smoothing technique ( Duchi et al. , 2012 ) in optimization . It is well known from optimization theory ( Boyd et al. , 2004 ) that non-smooth objectives are generally harder to optimize compared with smooth objectives . In general , a smoother loss function allows us to use a larger step size while guaranteeing the convergence of gradient-based algorithms . Randomized smoothing technique ( Duchi et al. , 2012 ) was proposed based on the observation that random perturbation of the optimization variable can be used to transform the loss into a smoother one . Instead of using only the gradient at the original iterate , randomized smoothing proposes to randomly generate perturbed iterates and use their gradients for optimization procedure . More details are provided in Appendix A . Let us recall the inner maximization problem in adversarial training : max δ∈B ( 0 ) L ( fθ ( x+ δ ) , y ) . ( 3.1 ) Here , fθ denotes a neural network parameterized by θ . In general , neural networks are non-smooth due to ReLU activations and pooling layers . This suggests that ( 3.1 ) can be difficult to solve , and using gradient descent with large step size can lead to divergence in the maximization problem . It also explains why directly using single-step projected gradient ascent without random initialization fails ( Wong et al. , 2020 ) . Now , let us apply randomized smoothing to ( 3.1 ) : max δ∈B ( 0 ) Eξ∼U ( −1,1 ) L ( fθ ( x+ δ + ξ ) , y ) , ( 3.2 ) where ξ is the perturbation vector for randomized smoothing , and δ is the perturbation vector for later gradient update step ( initialized as zero ) . Suppose we solve ( 3.2 ) in a stochastic fashion ( i.e. , sample a random perturbation ξ instead of computing the expectation over ξ ) , and using only one step gradient update . We can see that this reduces to the Fast AT formulation . This suggests that Fast AT can be viewed as performing stochastic single-step attacks on a randomized smoothed objective function which allows using larger step size . This explains why random initialization helps Fast AT as it makes the loss objective smoother and thus easier to optimize . It is worth noting that Andriushchenko & Flammarion ( 2020 ) also provided an explanation of why Fast Adversarial Training works : random initialization reduces the magnitude of the perturbation and thus the network becomes more linear and fits better toward single-step attack . While we argue that the random initialization works as randomized smoothing for smoothing the inner maximization problem and makes it easier to solve . In fact , our argument is more general and can cover theirs , because if the loss function is approximately linear , then it will be very smooth , i.e. , the second-order term in the Taylor expansion is very small . 4 PROPOSED APPROACH . 4.1 DRAWBACKS OF THE RANDOM INITIALIZATION STRATEGY . Although Fast AT achieves much faster robust training compared with standard adversarial training ( Madry et al. , 2018 ) , it exposes several major weaknesses . For demonstration , we exclude the additional acceleration techniques introduced in Wong et al . ( 2020 ) for accelerating the training speed ( e.g. , mix-precision training , cyclic learning rate ) , and instead apply standard piecewise learning rate decay used in Madry et al . ( 2018 ) ; Zhang et al . ( 2019 ) with the decay point set at the 50-th and 75-th epochs . Performance Stability As observed in Li et al . ( 2020 ) , Fast AT can be highly unstable ( i.e. , large variance in robust performance ) when using traditional piecewise learning rate decay schedule . We argue that this is because Wong et al . ( 2020 ) utilized a drastically large attack step size ( 10/255 , even larger than the perturbation limit ) , which causes unstable training behavior . To validate this , we run Fast AT on CIFAR-10 using ResNet-18 model ( He et al. , 2016 ) for 10 times with different step sizes . Note that we adopt early-stopping and record the best-performing model among 100 epochs . As shown in Figure 1 , although the single-best robustness performance is obtained by using step size 10/255 , the variance is very high . Moreover , most trials lead to weak robust performance with a low average and median robust accuracy . On the other hand , we observe that when using step size 8/255 , model robustness is more stable and higher on average . Note that using a too small step size would by nature hurt model robustness . These observations suggest that Fast AT can not achieve the best performance on robust performance and stability simultaneously . Potential for Robustness Improvement Fast AT uses standard adversarial training ( Madry et al. , 2018 ) as the baseline , and can obtain similar robustness performance . However , later work ( Rice et al. , 2020 ) shows that adversarial training can cause the overfitting problem , while early stopping can largely improve robustness . Zhang et al . ( 2019 ) further achieves even better model robustness that is much higher than what Fast AT obtains . From Table 1 , we observe that there exists an 8 % robust accuracy gap between Fast AT ( average over 10 runs ) and the best-performing TRADES model . Even for the best out of 10 trials , there is still a 6 % gap . This indicates that Fast AT is still far from optimal , and there is still big room for further robustness improvement .
This paper seeks to reduce the training time of TRADES adversarial training. It tries to understand fast adversarial training methods (single-step adversary methods) by viewing the random initialization of the adversarial perturbation in the PGD steps as randomized smoothing, making the inner maximization (the adversary) easier. They find empirically that this smoothing isn't enough for vanilla fast adversarial training with the TRADES objective (in the sense that it doesn't improve much beyond fast AT after switching out the objective), requiring large step sizes that bring instability to training. Then, they aim to improve fast TRADES by their proposed algorithm, "backward smoothing", which first perturbs the output of the model and then solves the inverse problem to find the corresponding input that would make this perturbation. The intuition is to make sure that the smoothing averages over a variety of output values to get a stronger smoothing effect. This seems to give similar results to TRADES while cutting down the training time significantly (only two inner PGD steps).
SP:396b87ea41744461ca381150153efdf374c2222f
IsarStep: a Benchmark for High-level Mathematical Reasoning
A well-defined benchmark is essential for measuring and accelerating research progress of machine learning models . In this paper , we present a benchmark for high-level mathematical reasoning and study the reasoning capabilities of neural sequence-to-sequence models . We build a non-synthetic dataset from the largest repository of proofs written by human experts in a theorem prover . The dataset has a broad coverage of undergraduate and research-level mathematical and computer science theorems . In our defined task , a model is required to fill in a missing intermediate proposition given surrounding proofs . This task provides a starting point for the long-term goal of having machines generate human-readable proofs automatically . Our experiments and analysis reveal that while the task is challenging , neural models can capture non-trivial mathematical reasoning . We further design a hierarchical transformer that outperforms the transformer baseline . The dataset and models are available from : https : //github.com/ Wenda302/IsarStep . 1 INTRODUCTION . Neural networks have achieved outstanding performance on a wide range of problems in natural language processing , computer vision , and speech recognition . However , research investigating their capacity of doing mathematical reasoning is still limited , with earlier attempts focusing on simple arithmetic tasks like integer addition and multiplication ( Zaremba & Sutskever , 2014 ; Kaiser & Sutskever , 2016 ; Trask et al. , 2018 ) . More recently , there has been work on solving school-level mathematical problems ( Saxton et al. , 2019 ) , logical reasoning ( Evans et al. , 2018 ) , and problems of function integration , ordinary differential equations ( Lample & Charton , 2020 ) , and properties of differential systems ( Charton et al. , 2020 ) . While these are valuable contributions to the machine learning community , they focused on generating answers to questions from a specific domain and were carried out on synthetic datasets with small vocabulary ( e.g . up to 100 unique tokens ) . In this paper , we consider general undergraduate and research-level mathematical proofs as a target for neural networks . When humans prove a theorem , a crucial step is to propose an intermediate proposition to bridge the gap between the goal and the currently known facts . This step requires complicated reasoning capabilities such as creative thinking , inference , understanding existing conditions , and symbolic manipulation of rules . For example , consider the following proof of the irrationality of √ 2 : Proof of irrationality of √ 2 . Assume √ 2 is rational . Then there exists a pair of coprime integers a and b such that √ 2 = a/b , and it follows that 2 = a2/b2 and then 2b2 = a2 . Hence a is even . Thus there exists an integer c such that a = 2c , which combined with 2b2 = a2 yields 2c2 = b2 : hence b is also even . So a and b are both even although they are coprime , contradiction . To derive ∃c ∈ Z. a = 2c from 2b2 = a2 , the intermediate proposition “ a is even ” would reduce the gap and lead to a successful proof . We would like to simulate the way humans prove theorems by proposing an intermediate proposition synthesis task — IsarStep . Instead of having primitive steps like 3 + 5 = 8 , the proof steps in IsarStep are at a higher-level , with much bigger steps as basic . Therefore it usually can not be simply solved by pattern matching and rewriting . To succeed in this task , a model is required to learn the meaning of important mathematical concepts ( e.g . determinant in linear algebra , residue in complex analysis ) , how they are related to each other through theorems , and how they are utilised in proof derivations . Solving the IsaStep task will be potentially helpful for improving the automation of theorem provers , because proposing a valid intermediate proposition will help reduce their search space significantly . It is also a first step towards the long-term goal of sketching complete human-readable proofs automatically . We have built the IsarStep dataset by mining arguably the largest publicly-hosted repository of mechanised proofs : the Achieve of Formal Proofs ( AFP ) .1 The AFP is checked by the Isabelle proof assistant ( Paulson , 1994 ) and contains 143K lemmas . Combining the AFP with the standard library of Isabelle/HOL yields a dataset of 204K formally-proved lemmas . The dataset covers a broad spectrum of subjects , including foundational logic ( e.g . Gödel ’ s incompleteness theorems ) , advanced analysis ( e.g . the Prime Number Theorem ) , computer algebra , cryptographic frameworks , and various data structures . A nice property of the mined formal proofs is that they are mostly declarative proofs , a proof style very close to human prose proofs.2 Fig . 1 illustrates the proof of irrationality of √ 2 in Isabelle . We can see that the proof is actually legible ( even to people who are not familiar with the system ) and and it captures high-level structures like those in human proofs . We further explore the reasoning capabilities of neural models . We frame the proposed task as a sequence-to-sequence ( seq2seq ) prediction problem . Beyond evaluating the existing neural seq2seq model baselines—the seq2seq with attention ( Bahdanau et al. , 2015 ) , the transformer ( Vaswani et al. , 2017 ) —we also propose a new architecture , the hierarchical transformer ( §4 ) . The architecture is motivated by the way humans reason about propositions ; it consists of a set of local transformer layers , modelling the representation of each proposition , and a set of global layers , modelling the correlation across propositions . Experiments ( §5 ) show that these neural models can solve 15–25 % of problems on the test set , and the hierarchical transformer achieves the best result . Further analysis ( §6 ) on the output of these models shows that while the proposition synthesis task is hard , the neural models can indeed capture mathematical reasoning . We find that the embeddings of closely related mathematical concepts are close in cosine space ; models can reason about the relation between set , subset , and member , and perform more complex multi-step reasoning that is even hard for humans . Our contributions are summarised as follows : 1 . We mine a large non-synthetic dataset of formal proofs and propose a task for evaluating neural models ’ mathematical reasoning abilities . The dataset contains 820K training examples with a vocabulary size of 30K . 1https : //www.isa-afp.org 2A comparison of proofs in different systems is available in Wiedijk ( 2006 ) . The declarative style proof is also available in Mizar ( Grabowski et al. , 2010 ) , where the style originates . 2 . We evaluate existing neural seq2seq models on this task . 3 . We introduce a hierarchical transformer model , which outperforms the baseline models . 4 . We provide a comprehensive analysis of what has been learned by the neural models . 5 . We provide a test suite to check the correctness of types and the validity of the generated propositions using automatic theorem provers . 2 THE ISARSTEP TASK . In this section , we define the task of intermediate proposition generation more concretely . We again take the proof of irrationality of √ 2 as an example . We will have the following derivation : 2b2 = a2︸ ︷︷ ︸ ( 1 ) ⇒ a is even︸ ︷︷ ︸ ( 2 ) ⇒ ∃c ∈ Z. a = 2c︸ ︷︷ ︸ ( 3 ) . In our proposed task , we would like to generate ( 2 ) given ( 1 ) and ( 3 ) . When humans prove a theorem , they implicitly assume certain background knowledge , as lemmas . For example , in this case we assume that we can trivially prove ( 1 ) ⇒ ( 2 ) based on the fact that the product of two numbers are even iff at least one of them is even . In Isabelle ( Paulson , 1994 ) , these relevant lemmas ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) corresponding to line 10 in Fig . 1 ) can be found automatically by its built-in automation Sledgehammer ( Blanchette et al. , 2011 ) . In our task , we optionally provide these lemmas as extra information in addition to ( 1 ) and ( 3 ) . The derivation of ( 2 ) ⇒ ( 3 ) in the proof above is a simple step , because only ( 2 ) is needed to arrive at ( 3 ) . In most cases , multiple propositions have to be used together in order to infer a proposition , for example P1 , P2 , P3 ⇒ P4 . For these more general cases , we also include the additional propositions ( e.g . P2 and P1 ) as part of the source propositions . To summarize , each example in the IsarStep dataset is formed by five parts : F.1 a target proposition ( e.g . a is even ) , F.2 a set of used local propositions to derive F.1 ( e.g . 2b2 = a2 ) , F.3 a local proposition derived from the target proposition F.1 ( ∃c ∈ Z. a = 2c ) , F.4 other local propositions and ( library ) lemmas used to justify F.3 , F.5 a set of used ( library ) lemmas to justify F.1 ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) ) . We want to synthesise F.1 given F.2 – F.4 with F.5 optional : the named lemmas in F.5 are common knowledge and can be used as additional hints . The propositions are generated as a sequence of tokens and therefore the search space is Σ∗ : search over 30K actions ( §3.3 , vocabulary size for seq2seq models ) at every timestep without a predefined maximum output length . IsarStep can be considered as single step reasoning , which can be repeated to sketch more complex proofs . Good performance on this task is a crucial step for designing models that can automatically prove theorems with minimal human assistance . 3 DATASET PREPROCESSSING AND STATISTICS . The mined raw dataset has long propositions and a large number of unique tokens . To alleviate the performance deterioration of machine learning models due to the aforementioned problems , we propose tricks to preprocess the raw dataset , including free variable normalisation and removing unnecessary parentheses . These tricks substantially reduce the sequence lengths and vocabulary size . 3.1 THE LOGIC AND TOKENS . The core logic of Isabelle/HOL is simply-typed λ-calculus with de Bruijn indices for bound variables ( Wenzel , 2020 , Chapter 2.2 ) . A local proposition or a ( library ) lemma/theorem is essentially a term in the calculus . As types can be inferred automatically , we drop types in terms ( to reduce the size of the vocabulary ) and encode a term as a sequence of tokens that include lambda term constructors : CONST , FREE , VAR , BOUND , ABS ( function abstraction ) , and $ ( function application ) . Additionally , parentheses have been used in the sequence to represent the tree structure . To give an example , we encode the proposition even a as the following sequence of tokens separated by a white space : CONST HOL.Trueprop $ ( CONST Parity.semiring_parity_class.even $ FREE < X0 > ) where CONST HOL.Trueprop is a boilerplate function that converts from type bool to prop ; CONST Parity.semiring_parity_class.even is the even predicate ; FREE < X0 > encodes the Skolem constant a in even a . Since a is a user-introduced local constant that can be arbitrary , we normalised it to the algorithmically generated name < X0 > in order to reduce the vocabulary size ( see §3.2 ) . Overall , every local proposition and library lemma/theorem is encoded as a sequence of tokens , and can be mostly decoded to the original term with type inference .
This paper presents a non-synthetic dataset generated from the Isabelle AFP, the largest mechanised proof repository for the task of filling in a missing intermediate proposition given surrounding proofs. Together with the dataset the paper presents a hierarchical transformer model (HAT). Top-10 accuracy, which is the percentage of target proposition appearing in the top 10 generated propositions, is 37.2 for their HAT model. The task this paper addresses is important for theorem proving practitioners, and synthesising propositions appears to be a more difficult challenge compared to other ML tasks in theorem proving (choosing useful lemmas or choosing tactics).
SP:cd7e181c1e4bcb07e01ddd3a1e608538fe38fa6e
IsarStep: a Benchmark for High-level Mathematical Reasoning
A well-defined benchmark is essential for measuring and accelerating research progress of machine learning models . In this paper , we present a benchmark for high-level mathematical reasoning and study the reasoning capabilities of neural sequence-to-sequence models . We build a non-synthetic dataset from the largest repository of proofs written by human experts in a theorem prover . The dataset has a broad coverage of undergraduate and research-level mathematical and computer science theorems . In our defined task , a model is required to fill in a missing intermediate proposition given surrounding proofs . This task provides a starting point for the long-term goal of having machines generate human-readable proofs automatically . Our experiments and analysis reveal that while the task is challenging , neural models can capture non-trivial mathematical reasoning . We further design a hierarchical transformer that outperforms the transformer baseline . The dataset and models are available from : https : //github.com/ Wenda302/IsarStep . 1 INTRODUCTION . Neural networks have achieved outstanding performance on a wide range of problems in natural language processing , computer vision , and speech recognition . However , research investigating their capacity of doing mathematical reasoning is still limited , with earlier attempts focusing on simple arithmetic tasks like integer addition and multiplication ( Zaremba & Sutskever , 2014 ; Kaiser & Sutskever , 2016 ; Trask et al. , 2018 ) . More recently , there has been work on solving school-level mathematical problems ( Saxton et al. , 2019 ) , logical reasoning ( Evans et al. , 2018 ) , and problems of function integration , ordinary differential equations ( Lample & Charton , 2020 ) , and properties of differential systems ( Charton et al. , 2020 ) . While these are valuable contributions to the machine learning community , they focused on generating answers to questions from a specific domain and were carried out on synthetic datasets with small vocabulary ( e.g . up to 100 unique tokens ) . In this paper , we consider general undergraduate and research-level mathematical proofs as a target for neural networks . When humans prove a theorem , a crucial step is to propose an intermediate proposition to bridge the gap between the goal and the currently known facts . This step requires complicated reasoning capabilities such as creative thinking , inference , understanding existing conditions , and symbolic manipulation of rules . For example , consider the following proof of the irrationality of √ 2 : Proof of irrationality of √ 2 . Assume √ 2 is rational . Then there exists a pair of coprime integers a and b such that √ 2 = a/b , and it follows that 2 = a2/b2 and then 2b2 = a2 . Hence a is even . Thus there exists an integer c such that a = 2c , which combined with 2b2 = a2 yields 2c2 = b2 : hence b is also even . So a and b are both even although they are coprime , contradiction . To derive ∃c ∈ Z. a = 2c from 2b2 = a2 , the intermediate proposition “ a is even ” would reduce the gap and lead to a successful proof . We would like to simulate the way humans prove theorems by proposing an intermediate proposition synthesis task — IsarStep . Instead of having primitive steps like 3 + 5 = 8 , the proof steps in IsarStep are at a higher-level , with much bigger steps as basic . Therefore it usually can not be simply solved by pattern matching and rewriting . To succeed in this task , a model is required to learn the meaning of important mathematical concepts ( e.g . determinant in linear algebra , residue in complex analysis ) , how they are related to each other through theorems , and how they are utilised in proof derivations . Solving the IsaStep task will be potentially helpful for improving the automation of theorem provers , because proposing a valid intermediate proposition will help reduce their search space significantly . It is also a first step towards the long-term goal of sketching complete human-readable proofs automatically . We have built the IsarStep dataset by mining arguably the largest publicly-hosted repository of mechanised proofs : the Achieve of Formal Proofs ( AFP ) .1 The AFP is checked by the Isabelle proof assistant ( Paulson , 1994 ) and contains 143K lemmas . Combining the AFP with the standard library of Isabelle/HOL yields a dataset of 204K formally-proved lemmas . The dataset covers a broad spectrum of subjects , including foundational logic ( e.g . Gödel ’ s incompleteness theorems ) , advanced analysis ( e.g . the Prime Number Theorem ) , computer algebra , cryptographic frameworks , and various data structures . A nice property of the mined formal proofs is that they are mostly declarative proofs , a proof style very close to human prose proofs.2 Fig . 1 illustrates the proof of irrationality of √ 2 in Isabelle . We can see that the proof is actually legible ( even to people who are not familiar with the system ) and and it captures high-level structures like those in human proofs . We further explore the reasoning capabilities of neural models . We frame the proposed task as a sequence-to-sequence ( seq2seq ) prediction problem . Beyond evaluating the existing neural seq2seq model baselines—the seq2seq with attention ( Bahdanau et al. , 2015 ) , the transformer ( Vaswani et al. , 2017 ) —we also propose a new architecture , the hierarchical transformer ( §4 ) . The architecture is motivated by the way humans reason about propositions ; it consists of a set of local transformer layers , modelling the representation of each proposition , and a set of global layers , modelling the correlation across propositions . Experiments ( §5 ) show that these neural models can solve 15–25 % of problems on the test set , and the hierarchical transformer achieves the best result . Further analysis ( §6 ) on the output of these models shows that while the proposition synthesis task is hard , the neural models can indeed capture mathematical reasoning . We find that the embeddings of closely related mathematical concepts are close in cosine space ; models can reason about the relation between set , subset , and member , and perform more complex multi-step reasoning that is even hard for humans . Our contributions are summarised as follows : 1 . We mine a large non-synthetic dataset of formal proofs and propose a task for evaluating neural models ’ mathematical reasoning abilities . The dataset contains 820K training examples with a vocabulary size of 30K . 1https : //www.isa-afp.org 2A comparison of proofs in different systems is available in Wiedijk ( 2006 ) . The declarative style proof is also available in Mizar ( Grabowski et al. , 2010 ) , where the style originates . 2 . We evaluate existing neural seq2seq models on this task . 3 . We introduce a hierarchical transformer model , which outperforms the baseline models . 4 . We provide a comprehensive analysis of what has been learned by the neural models . 5 . We provide a test suite to check the correctness of types and the validity of the generated propositions using automatic theorem provers . 2 THE ISARSTEP TASK . In this section , we define the task of intermediate proposition generation more concretely . We again take the proof of irrationality of √ 2 as an example . We will have the following derivation : 2b2 = a2︸ ︷︷ ︸ ( 1 ) ⇒ a is even︸ ︷︷ ︸ ( 2 ) ⇒ ∃c ∈ Z. a = 2c︸ ︷︷ ︸ ( 3 ) . In our proposed task , we would like to generate ( 2 ) given ( 1 ) and ( 3 ) . When humans prove a theorem , they implicitly assume certain background knowledge , as lemmas . For example , in this case we assume that we can trivially prove ( 1 ) ⇒ ( 2 ) based on the fact that the product of two numbers are even iff at least one of them is even . In Isabelle ( Paulson , 1994 ) , these relevant lemmas ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) corresponding to line 10 in Fig . 1 ) can be found automatically by its built-in automation Sledgehammer ( Blanchette et al. , 2011 ) . In our task , we optionally provide these lemmas as extra information in addition to ( 1 ) and ( 3 ) . The derivation of ( 2 ) ⇒ ( 3 ) in the proof above is a simple step , because only ( 2 ) is needed to arrive at ( 3 ) . In most cases , multiple propositions have to be used together in order to infer a proposition , for example P1 , P2 , P3 ⇒ P4 . For these more general cases , we also include the additional propositions ( e.g . P2 and P1 ) as part of the source propositions . To summarize , each example in the IsarStep dataset is formed by five parts : F.1 a target proposition ( e.g . a is even ) , F.2 a set of used local propositions to derive F.1 ( e.g . 2b2 = a2 ) , F.3 a local proposition derived from the target proposition F.1 ( ∃c ∈ Z. a = 2c ) , F.4 other local propositions and ( library ) lemmas used to justify F.3 , F.5 a set of used ( library ) lemmas to justify F.1 ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) ) . We want to synthesise F.1 given F.2 – F.4 with F.5 optional : the named lemmas in F.5 are common knowledge and can be used as additional hints . The propositions are generated as a sequence of tokens and therefore the search space is Σ∗ : search over 30K actions ( §3.3 , vocabulary size for seq2seq models ) at every timestep without a predefined maximum output length . IsarStep can be considered as single step reasoning , which can be repeated to sketch more complex proofs . Good performance on this task is a crucial step for designing models that can automatically prove theorems with minimal human assistance . 3 DATASET PREPROCESSSING AND STATISTICS . The mined raw dataset has long propositions and a large number of unique tokens . To alleviate the performance deterioration of machine learning models due to the aforementioned problems , we propose tricks to preprocess the raw dataset , including free variable normalisation and removing unnecessary parentheses . These tricks substantially reduce the sequence lengths and vocabulary size . 3.1 THE LOGIC AND TOKENS . The core logic of Isabelle/HOL is simply-typed λ-calculus with de Bruijn indices for bound variables ( Wenzel , 2020 , Chapter 2.2 ) . A local proposition or a ( library ) lemma/theorem is essentially a term in the calculus . As types can be inferred automatically , we drop types in terms ( to reduce the size of the vocabulary ) and encode a term as a sequence of tokens that include lambda term constructors : CONST , FREE , VAR , BOUND , ABS ( function abstraction ) , and $ ( function application ) . Additionally , parentheses have been used in the sequence to represent the tree structure . To give an example , we encode the proposition even a as the following sequence of tokens separated by a white space : CONST HOL.Trueprop $ ( CONST Parity.semiring_parity_class.even $ FREE < X0 > ) where CONST HOL.Trueprop is a boilerplate function that converts from type bool to prop ; CONST Parity.semiring_parity_class.even is the even predicate ; FREE < X0 > encodes the Skolem constant a in even a . Since a is a user-introduced local constant that can be arbitrary , we normalised it to the algorithmically generated name < X0 > in order to reduce the vocabulary size ( see §3.2 ) . Overall , every local proposition and library lemma/theorem is encoded as a sequence of tokens , and can be mostly decoded to the original term with type inference .
The authors propose a new benchmark task to evaluate the high-level reasoning capabilities of machine learning models (specifically sequence-to-sequence models) in the context of proof assistants. The task consists of predicting the intermediate proposition from its surrounding ones, namely its previous and its subsequent propositions. The experimental analysis provides evidence on the difficulty of the task at hand. The authors propose also a solution based on a hierarchical transformer, which is able to better capture the mathematical relations of intra- and inter-propositions compared to existing sequence-to-sequence models, as demonstrated by quantitative as well as qualitative analyses.
SP:cd7e181c1e4bcb07e01ddd3a1e608538fe38fa6e
IsarStep: a Benchmark for High-level Mathematical Reasoning
A well-defined benchmark is essential for measuring and accelerating research progress of machine learning models . In this paper , we present a benchmark for high-level mathematical reasoning and study the reasoning capabilities of neural sequence-to-sequence models . We build a non-synthetic dataset from the largest repository of proofs written by human experts in a theorem prover . The dataset has a broad coverage of undergraduate and research-level mathematical and computer science theorems . In our defined task , a model is required to fill in a missing intermediate proposition given surrounding proofs . This task provides a starting point for the long-term goal of having machines generate human-readable proofs automatically . Our experiments and analysis reveal that while the task is challenging , neural models can capture non-trivial mathematical reasoning . We further design a hierarchical transformer that outperforms the transformer baseline . The dataset and models are available from : https : //github.com/ Wenda302/IsarStep . 1 INTRODUCTION . Neural networks have achieved outstanding performance on a wide range of problems in natural language processing , computer vision , and speech recognition . However , research investigating their capacity of doing mathematical reasoning is still limited , with earlier attempts focusing on simple arithmetic tasks like integer addition and multiplication ( Zaremba & Sutskever , 2014 ; Kaiser & Sutskever , 2016 ; Trask et al. , 2018 ) . More recently , there has been work on solving school-level mathematical problems ( Saxton et al. , 2019 ) , logical reasoning ( Evans et al. , 2018 ) , and problems of function integration , ordinary differential equations ( Lample & Charton , 2020 ) , and properties of differential systems ( Charton et al. , 2020 ) . While these are valuable contributions to the machine learning community , they focused on generating answers to questions from a specific domain and were carried out on synthetic datasets with small vocabulary ( e.g . up to 100 unique tokens ) . In this paper , we consider general undergraduate and research-level mathematical proofs as a target for neural networks . When humans prove a theorem , a crucial step is to propose an intermediate proposition to bridge the gap between the goal and the currently known facts . This step requires complicated reasoning capabilities such as creative thinking , inference , understanding existing conditions , and symbolic manipulation of rules . For example , consider the following proof of the irrationality of √ 2 : Proof of irrationality of √ 2 . Assume √ 2 is rational . Then there exists a pair of coprime integers a and b such that √ 2 = a/b , and it follows that 2 = a2/b2 and then 2b2 = a2 . Hence a is even . Thus there exists an integer c such that a = 2c , which combined with 2b2 = a2 yields 2c2 = b2 : hence b is also even . So a and b are both even although they are coprime , contradiction . To derive ∃c ∈ Z. a = 2c from 2b2 = a2 , the intermediate proposition “ a is even ” would reduce the gap and lead to a successful proof . We would like to simulate the way humans prove theorems by proposing an intermediate proposition synthesis task — IsarStep . Instead of having primitive steps like 3 + 5 = 8 , the proof steps in IsarStep are at a higher-level , with much bigger steps as basic . Therefore it usually can not be simply solved by pattern matching and rewriting . To succeed in this task , a model is required to learn the meaning of important mathematical concepts ( e.g . determinant in linear algebra , residue in complex analysis ) , how they are related to each other through theorems , and how they are utilised in proof derivations . Solving the IsaStep task will be potentially helpful for improving the automation of theorem provers , because proposing a valid intermediate proposition will help reduce their search space significantly . It is also a first step towards the long-term goal of sketching complete human-readable proofs automatically . We have built the IsarStep dataset by mining arguably the largest publicly-hosted repository of mechanised proofs : the Achieve of Formal Proofs ( AFP ) .1 The AFP is checked by the Isabelle proof assistant ( Paulson , 1994 ) and contains 143K lemmas . Combining the AFP with the standard library of Isabelle/HOL yields a dataset of 204K formally-proved lemmas . The dataset covers a broad spectrum of subjects , including foundational logic ( e.g . Gödel ’ s incompleteness theorems ) , advanced analysis ( e.g . the Prime Number Theorem ) , computer algebra , cryptographic frameworks , and various data structures . A nice property of the mined formal proofs is that they are mostly declarative proofs , a proof style very close to human prose proofs.2 Fig . 1 illustrates the proof of irrationality of √ 2 in Isabelle . We can see that the proof is actually legible ( even to people who are not familiar with the system ) and and it captures high-level structures like those in human proofs . We further explore the reasoning capabilities of neural models . We frame the proposed task as a sequence-to-sequence ( seq2seq ) prediction problem . Beyond evaluating the existing neural seq2seq model baselines—the seq2seq with attention ( Bahdanau et al. , 2015 ) , the transformer ( Vaswani et al. , 2017 ) —we also propose a new architecture , the hierarchical transformer ( §4 ) . The architecture is motivated by the way humans reason about propositions ; it consists of a set of local transformer layers , modelling the representation of each proposition , and a set of global layers , modelling the correlation across propositions . Experiments ( §5 ) show that these neural models can solve 15–25 % of problems on the test set , and the hierarchical transformer achieves the best result . Further analysis ( §6 ) on the output of these models shows that while the proposition synthesis task is hard , the neural models can indeed capture mathematical reasoning . We find that the embeddings of closely related mathematical concepts are close in cosine space ; models can reason about the relation between set , subset , and member , and perform more complex multi-step reasoning that is even hard for humans . Our contributions are summarised as follows : 1 . We mine a large non-synthetic dataset of formal proofs and propose a task for evaluating neural models ’ mathematical reasoning abilities . The dataset contains 820K training examples with a vocabulary size of 30K . 1https : //www.isa-afp.org 2A comparison of proofs in different systems is available in Wiedijk ( 2006 ) . The declarative style proof is also available in Mizar ( Grabowski et al. , 2010 ) , where the style originates . 2 . We evaluate existing neural seq2seq models on this task . 3 . We introduce a hierarchical transformer model , which outperforms the baseline models . 4 . We provide a comprehensive analysis of what has been learned by the neural models . 5 . We provide a test suite to check the correctness of types and the validity of the generated propositions using automatic theorem provers . 2 THE ISARSTEP TASK . In this section , we define the task of intermediate proposition generation more concretely . We again take the proof of irrationality of √ 2 as an example . We will have the following derivation : 2b2 = a2︸ ︷︷ ︸ ( 1 ) ⇒ a is even︸ ︷︷ ︸ ( 2 ) ⇒ ∃c ∈ Z. a = 2c︸ ︷︷ ︸ ( 3 ) . In our proposed task , we would like to generate ( 2 ) given ( 1 ) and ( 3 ) . When humans prove a theorem , they implicitly assume certain background knowledge , as lemmas . For example , in this case we assume that we can trivially prove ( 1 ) ⇒ ( 2 ) based on the fact that the product of two numbers are even iff at least one of them is even . In Isabelle ( Paulson , 1994 ) , these relevant lemmas ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) corresponding to line 10 in Fig . 1 ) can be found automatically by its built-in automation Sledgehammer ( Blanchette et al. , 2011 ) . In our task , we optionally provide these lemmas as extra information in addition to ( 1 ) and ( 3 ) . The derivation of ( 2 ) ⇒ ( 3 ) in the proof above is a simple step , because only ( 2 ) is needed to arrive at ( 3 ) . In most cases , multiple propositions have to be used together in order to infer a proposition , for example P1 , P2 , P3 ⇒ P4 . For these more general cases , we also include the additional propositions ( e.g . P2 and P1 ) as part of the source propositions . To summarize , each example in the IsarStep dataset is formed by five parts : F.1 a target proposition ( e.g . a is even ) , F.2 a set of used local propositions to derive F.1 ( e.g . 2b2 = a2 ) , F.3 a local proposition derived from the target proposition F.1 ( ∃c ∈ Z. a = 2c ) , F.4 other local propositions and ( library ) lemmas used to justify F.3 , F.5 a set of used ( library ) lemmas to justify F.1 ( e.g . even_mult_iff : even ( ? a * ? b ) = ( even ? a ∨ even ? b ) ) . We want to synthesise F.1 given F.2 – F.4 with F.5 optional : the named lemmas in F.5 are common knowledge and can be used as additional hints . The propositions are generated as a sequence of tokens and therefore the search space is Σ∗ : search over 30K actions ( §3.3 , vocabulary size for seq2seq models ) at every timestep without a predefined maximum output length . IsarStep can be considered as single step reasoning , which can be repeated to sketch more complex proofs . Good performance on this task is a crucial step for designing models that can automatically prove theorems with minimal human assistance . 3 DATASET PREPROCESSSING AND STATISTICS . The mined raw dataset has long propositions and a large number of unique tokens . To alleviate the performance deterioration of machine learning models due to the aforementioned problems , we propose tricks to preprocess the raw dataset , including free variable normalisation and removing unnecessary parentheses . These tricks substantially reduce the sequence lengths and vocabulary size . 3.1 THE LOGIC AND TOKENS . The core logic of Isabelle/HOL is simply-typed λ-calculus with de Bruijn indices for bound variables ( Wenzel , 2020 , Chapter 2.2 ) . A local proposition or a ( library ) lemma/theorem is essentially a term in the calculus . As types can be inferred automatically , we drop types in terms ( to reduce the size of the vocabulary ) and encode a term as a sequence of tokens that include lambda term constructors : CONST , FREE , VAR , BOUND , ABS ( function abstraction ) , and $ ( function application ) . Additionally , parentheses have been used in the sequence to represent the tree structure . To give an example , we encode the proposition even a as the following sequence of tokens separated by a white space : CONST HOL.Trueprop $ ( CONST Parity.semiring_parity_class.even $ FREE < X0 > ) where CONST HOL.Trueprop is a boilerplate function that converts from type bool to prop ; CONST Parity.semiring_parity_class.even is the even predicate ; FREE < X0 > encodes the Skolem constant a in even a . Since a is a user-introduced local constant that can be arbitrary , we normalised it to the algorithmically generated name < X0 > in order to reduce the vocabulary size ( see §3.2 ) . Overall , every local proposition and library lemma/theorem is encoded as a sequence of tokens , and can be mostly decoded to the original term with type inference .
This paper proposes a benchmark for high-level mathematical reasoning and study the reasoning capabilities of neural sequence-to-sequence models. This is a non-synthetic dataset from the largest repository of proofs written by human experts in a theorem prover, which has a broad coverage of undergraduate and research-level mathematical and computer science theorems. Based on this dataset, the model need to fill in a missing intermediate proposition given surrounding proofs, named as IsarStep. It's a very interesting task. This task provides a starting point for the long-term goal of having machines generate human-readable proofs automatically. The experiments and analysis also reveal that neural models can capture non-trivial mathematical reasoning.
SP:cd7e181c1e4bcb07e01ddd3a1e608538fe38fa6e
Shape-Tailored Deep Neural Networks Using PDEs for Segmentation
1 INTRODUCTION . Convolutional neural networks ( CNNs ) have been used extensively for segmentation problems in computer vision He et al . ( 2017 ) ; He et al . ( 2016 ) ; Chen et al . ( 2017 ) ; Xie & Tu ( 2015 ) . CNNs provide a framework for learning descriptors that are able to discriminate different textured or semantic regions within images . Much progress has been made in segmentation with CNNs but results are still far from human performance . Also , significant engineering must be performed to adapt CNNs to segmentation problems . A basic component in the architecture for segmentation problems involves labeling or grouping dense descriptors returned by a backbone CNN . A difficulty in grouping these descriptors arises , especially near the boundaries of segmentation regions , as CNN descriptors aggregate data from fixed shape ( square neighborhoods ) at each pixel and may thus aggregate data from different regions . This makes grouping these descriptors into a unique region difficult , which often results in errors in the grouping . In segmentation problems ( e.g. , semantic segmentation ) , current methods attempt to mitigate these errors by adding post-processing layers that aim to group simultaneously the ( coarse-scale ) descriptors from the CNN backbone and the fine-level pixel data . However , the errors introduced might not always be fixed . A more natural approach to avoid this problem is to consider the coarse and fine structure together , avoiding aggregation across boundaries , to prevent errors at the outset . To avoid such errors , one could design descriptors that aggregate data only within boundaries . To this end , Khan et al . ( 2015 ) introduced “ shape-tailored ” descriptors that aggregate data within a region of interest , and used these descriptors for segmentation . However , these descriptors are hand-crafted and do not perform on-par with learned approaches . Khan & Sundaramoorthi ( 2018 ) introduced learned shape-tailored descriptors by learning a neural network operating on the input channel dimension of input hand-crafted shape-tailored descriptors for segmentation . However , these networks , though deep in the channel dimension , did not filter data spatially within layers . Since an advantage of CNNs comes from exploiting spatial filtering at each depth of the network , in this work , we design shape-tailored networks that are deep and perform shape-tailored filtering in space at each layer using solutions of the Poisson PDE . This results in shape-tailored networks that provide more discriminative descriptors than a single shape-tailored kernel . This extension requires development of techniques to back-propagate through PDEs , which we derive in this work . Our contributions are specifically : 1 . We construct and show how to train ST-DNN , deep networks that perform shape-tailored spatial filtering via the Poisson PDE at each depth so as to generalize a CNN to arbitrarily shaped regions . 2 . We show analytically and empirically that ST-DNNs are covariant to translations and rotations as they inherit this property from the Poisson PDE . In segmentation , covariance ( a.k.a. , equivariance ) to translation and rotation is a desired property : if a segment in an image is found , then the corresponding segment should be found in the translated / rotated image ( or object ) . This property is not generally present with existing CNN-based segmentation methods even when trained with augmented translated and rotated images Azulay & Weiss ( 2019 ) , and requires special consideration . 3 . We show analytically and empirically that ST-DNNs are robust to domain deformations . These result from viewpoint change or object articulation , and so they should not affect the descriptor . 4 . To demonstrate ST-DNN and the properties above , we validate them on the task of segmentation , an important problem in low-level vision Malik & Perona ( 1990 ) ; Arbelaez et al . ( 2011b ) . Because of properties of the PDE , ST-DNN also have desirable generalization properties . This is because : a ) The robustness and covariance properties are built into our descriptors and do not need to be learned from data , b ) The PDE solutions , generalizations of Gabor-like filters Olshausen & Field ( 1996 ) ; Zador ( 2019 ) , have natural image structure inherent in their solutions and so this does not need to be learned from data , and c ) Our networks have fewer parameters compared to existing networks in segmentation . This is because the PDE solutions form a basis and only linear combinations of a few basis elements are needed to learn discriminative descriptors for segmentation . In contrast , CNNs spend a lot of parameters to learn this structure . 1.1 RELATED WORK . Traditional approaches to segmentation rely on hand-crafted features , e.g. , through a filter bank Haralick & Shapiro ( 1985 ) . These features are ambiguous near the boundaries of objects . In Khan et al . ( 2015 ) hand-crafted descriptors that aggregate data within object boundaries are constructed to avoid this , but lack sufficient capacity to capture the diversity of textures or be invariant to nuisances . Deep-learning based approaches have showed state-of-the-art results in edge-based methods Xie & Tu ( 2017 ) ; He et al . ( 2019 ) ; Deng et al . ( 2018 ) . Watershed is applied on edge-maps to obtain the segmentation . The main drawback of these methods is it is often difficult to form segmentations due to extraneous or faint edges , particularly when `` textons '' in textures are large . CNNs have been applied to compute descriptors for semantic segmentation , where pixels in an image are classified into certain semantic object classes Li et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Du et al . ( 2019 ) ; Pang et al . ( 2019 ) ; Zhu et al . ( 2019 ) ; Liu et al . ( 2019 ) . Usually these classes are limited to a few object classes and do not tackle general textures , where the number of classes may be far greater , and thus such approaches are not directly applicable to texture segmentation . But semantic segmentation approaches may eventually benefit from our methodology as descriptors aggregating data only within objects or regions are also relevant to these problems . A learned shape-tailored descriptor Khan & Sundaramoorthi ( 2018 ) is constructed with a Siamese network on hand-crafted shape-tailored descriptors . However , Khan & Sundaramoorthi ( 2018 ) only does shape-tailored filtering in pre-processing as layering these requires new methods to train . We further examine covariance and robustness , not examined in Khan & Sundaramoorthi ( 2018 ) . Covariance to rotation in CNNs has been examined in recent works , e.g. , Weiler et al . ( 2018 ) ; Yin et al . ( 2019 ) ; Anderson et al . ( 2019 ) . They , however , are not shape-tailored so do not aggregate data only within shaped regions . Lack of robustness to deformation ( and translation ) in CNNs is examined in Azulay & Weiss ( 2019 ) and theoretically in Bietti & Mairal ( 2017 ) . Sifre & Mallat ( 2013 ) constructs deformation robust descriptors inspired by CNNs , but are hand-crafted . 2 CONSTRUCTION OF SHAPE-TAILORED DNN AND PROPERTIES . In this section , we design a deep neural network that outputs descriptors at each pixel within an arbitrary shaped region of interest and aggregates data only from within the region . We want the descriptors to be discriminative of different texture , yet robust to nuisances within the region ( e.g. , local photometric and geometric variability ) to be useful for segmentation . Our construction uses a Poisson PDE , which naturally smooths data only within a region of interest . Smoothing naturally yields robustness to geometric nuisances ( domain deformations ) . By taking linear combinations of derivatives of the output of the PDE , we can approximate the effect of general convolutional kernels but avoid mixing data across the boundary of region of interest . ST-DNN is also covariant to translations and rotations , inheriting it from the Poisson equation , which leads to the segmentation algorithm being covariant to such transformations . 2.1 SHAPE-TAILORED DNN DESCRIPTORS THROUGH POISSON PDE . Shape-tailored Smoothing via Poisson PDE : To construct a shape-tailored deep network , we first smooth the input to a layer using the Poisson PDE so as to aggregate data only within the region of interest , similar to what is done in Khan et al . ( 2015 ) for just the first layer . Let R ⊂ Ω ⊂ R2 be the region of interest , where Ω is the domain of the input image I : Ω→ Rk and k is the number of input channels to the layer . Let u : R → RM ( M is the number of output channels ) be the result of the smoothing ; the components u of u solve the PDE within R : { u ( x ) − α∆u ( x ) = I ( x ) x ∈ R ∇u ( x ) ·N = 0 x ∈ ∂R , ( 1 ) where I is a channel of I , ∂R is the boundary of R , N is normal to ∂R , α is the scale of smoothing and ∆/∇ are the Laplacian and the gradient respectively . It can be shown that the smoothing can be written in the form u ( x ) = ∫ R K ( x , y ) I ( y ) dy where K ( . , . ) is the Green ’ s function of the PDE , a smoothing kernel , which further shows that the PDE aggregates data only within R. Shape-tailored Deep Network : We can now generalize the operation of convolution tailored to the region of interest by taking linear combinations of partial derivatives of the output of the PDE equation 1 . This is motivated by the fact that in R = R2 , linear combinations of derivatives of Gaussians can approximate any kernel arbitrarily well . Gaussian filters are the solution of the heat equation , and the PDE equation 1 relates to the heat equation , i.e. , equation 1 is the steady state solution of a heat equation . Thus , linear combinations of derivatives of equation 1 generalize convolution to an arbitrary shape R ; in experiments , a few first order directional derivatives are sufficient for our segmentation tasks ( see Section 5 for details ) . A layer of the ST-DNN takes such linear combinations and rectifies it as follows : fi ( x ) = r ◦ Li ◦ T [ I ] ( x ) , ( 2 ) where I : R→ Rk is the input to the layer , T is an operator that outputs derivatives of the solution of the Poisson PDE equation 1 , Li ( y ) = wiy+bi is a point-wise linear function ( i.e. , a 1×1 convolution applied to combine different channels ) , r is the rectified linear function , and i indexes the layer of the network . Notice that since r and Li are pointwise operations , they preserve the property of T that it aggregates data only within the region R. We now compose layers to construct a ST-DNN as follows : F [ I ] ( x ) = s ◦ fm ◦ fm−1 ◦ fm−2 ◦ .... f0 ◦ I ( x ) , ( 3 ) where F [ I ] ( x ) is the output of the ST-DNN , f0 , ... , fm are the m+ 1 layers of the network , I is the input image , and s represents the soft-max operation ( to bound the output values ) . ST-DNN does not have a pooling layer because the PDE already aggregates data from a neighborhood by smoothing ; further , the lack of reduction in spatial dimension allows for more accurate shape estimation in our subsequent segmentation , and avoids the need for up-sampling layers . We will show that we can retain efficiency in training and inference .
The paper suggests replacing convolutional layers with ST-DNNs. ST-DNNs, in contrast to conv. layers, can natively support non-rectangular neighborhoods (regions). Similarly to conv. layers, ST-DNNs can be stacked to increase expressivity. ST-DNNs themselves correspond to solutions to the Poisson PDE. The paper describes how these layers can be trained and used for prediction. Results are reported on a texture dataset.
SP:243a41483b648f364496a705cba45968c5c02968
Shape-Tailored Deep Neural Networks Using PDEs for Segmentation
1 INTRODUCTION . Convolutional neural networks ( CNNs ) have been used extensively for segmentation problems in computer vision He et al . ( 2017 ) ; He et al . ( 2016 ) ; Chen et al . ( 2017 ) ; Xie & Tu ( 2015 ) . CNNs provide a framework for learning descriptors that are able to discriminate different textured or semantic regions within images . Much progress has been made in segmentation with CNNs but results are still far from human performance . Also , significant engineering must be performed to adapt CNNs to segmentation problems . A basic component in the architecture for segmentation problems involves labeling or grouping dense descriptors returned by a backbone CNN . A difficulty in grouping these descriptors arises , especially near the boundaries of segmentation regions , as CNN descriptors aggregate data from fixed shape ( square neighborhoods ) at each pixel and may thus aggregate data from different regions . This makes grouping these descriptors into a unique region difficult , which often results in errors in the grouping . In segmentation problems ( e.g. , semantic segmentation ) , current methods attempt to mitigate these errors by adding post-processing layers that aim to group simultaneously the ( coarse-scale ) descriptors from the CNN backbone and the fine-level pixel data . However , the errors introduced might not always be fixed . A more natural approach to avoid this problem is to consider the coarse and fine structure together , avoiding aggregation across boundaries , to prevent errors at the outset . To avoid such errors , one could design descriptors that aggregate data only within boundaries . To this end , Khan et al . ( 2015 ) introduced “ shape-tailored ” descriptors that aggregate data within a region of interest , and used these descriptors for segmentation . However , these descriptors are hand-crafted and do not perform on-par with learned approaches . Khan & Sundaramoorthi ( 2018 ) introduced learned shape-tailored descriptors by learning a neural network operating on the input channel dimension of input hand-crafted shape-tailored descriptors for segmentation . However , these networks , though deep in the channel dimension , did not filter data spatially within layers . Since an advantage of CNNs comes from exploiting spatial filtering at each depth of the network , in this work , we design shape-tailored networks that are deep and perform shape-tailored filtering in space at each layer using solutions of the Poisson PDE . This results in shape-tailored networks that provide more discriminative descriptors than a single shape-tailored kernel . This extension requires development of techniques to back-propagate through PDEs , which we derive in this work . Our contributions are specifically : 1 . We construct and show how to train ST-DNN , deep networks that perform shape-tailored spatial filtering via the Poisson PDE at each depth so as to generalize a CNN to arbitrarily shaped regions . 2 . We show analytically and empirically that ST-DNNs are covariant to translations and rotations as they inherit this property from the Poisson PDE . In segmentation , covariance ( a.k.a. , equivariance ) to translation and rotation is a desired property : if a segment in an image is found , then the corresponding segment should be found in the translated / rotated image ( or object ) . This property is not generally present with existing CNN-based segmentation methods even when trained with augmented translated and rotated images Azulay & Weiss ( 2019 ) , and requires special consideration . 3 . We show analytically and empirically that ST-DNNs are robust to domain deformations . These result from viewpoint change or object articulation , and so they should not affect the descriptor . 4 . To demonstrate ST-DNN and the properties above , we validate them on the task of segmentation , an important problem in low-level vision Malik & Perona ( 1990 ) ; Arbelaez et al . ( 2011b ) . Because of properties of the PDE , ST-DNN also have desirable generalization properties . This is because : a ) The robustness and covariance properties are built into our descriptors and do not need to be learned from data , b ) The PDE solutions , generalizations of Gabor-like filters Olshausen & Field ( 1996 ) ; Zador ( 2019 ) , have natural image structure inherent in their solutions and so this does not need to be learned from data , and c ) Our networks have fewer parameters compared to existing networks in segmentation . This is because the PDE solutions form a basis and only linear combinations of a few basis elements are needed to learn discriminative descriptors for segmentation . In contrast , CNNs spend a lot of parameters to learn this structure . 1.1 RELATED WORK . Traditional approaches to segmentation rely on hand-crafted features , e.g. , through a filter bank Haralick & Shapiro ( 1985 ) . These features are ambiguous near the boundaries of objects . In Khan et al . ( 2015 ) hand-crafted descriptors that aggregate data within object boundaries are constructed to avoid this , but lack sufficient capacity to capture the diversity of textures or be invariant to nuisances . Deep-learning based approaches have showed state-of-the-art results in edge-based methods Xie & Tu ( 2017 ) ; He et al . ( 2019 ) ; Deng et al . ( 2018 ) . Watershed is applied on edge-maps to obtain the segmentation . The main drawback of these methods is it is often difficult to form segmentations due to extraneous or faint edges , particularly when `` textons '' in textures are large . CNNs have been applied to compute descriptors for semantic segmentation , where pixels in an image are classified into certain semantic object classes Li et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Du et al . ( 2019 ) ; Pang et al . ( 2019 ) ; Zhu et al . ( 2019 ) ; Liu et al . ( 2019 ) . Usually these classes are limited to a few object classes and do not tackle general textures , where the number of classes may be far greater , and thus such approaches are not directly applicable to texture segmentation . But semantic segmentation approaches may eventually benefit from our methodology as descriptors aggregating data only within objects or regions are also relevant to these problems . A learned shape-tailored descriptor Khan & Sundaramoorthi ( 2018 ) is constructed with a Siamese network on hand-crafted shape-tailored descriptors . However , Khan & Sundaramoorthi ( 2018 ) only does shape-tailored filtering in pre-processing as layering these requires new methods to train . We further examine covariance and robustness , not examined in Khan & Sundaramoorthi ( 2018 ) . Covariance to rotation in CNNs has been examined in recent works , e.g. , Weiler et al . ( 2018 ) ; Yin et al . ( 2019 ) ; Anderson et al . ( 2019 ) . They , however , are not shape-tailored so do not aggregate data only within shaped regions . Lack of robustness to deformation ( and translation ) in CNNs is examined in Azulay & Weiss ( 2019 ) and theoretically in Bietti & Mairal ( 2017 ) . Sifre & Mallat ( 2013 ) constructs deformation robust descriptors inspired by CNNs , but are hand-crafted . 2 CONSTRUCTION OF SHAPE-TAILORED DNN AND PROPERTIES . In this section , we design a deep neural network that outputs descriptors at each pixel within an arbitrary shaped region of interest and aggregates data only from within the region . We want the descriptors to be discriminative of different texture , yet robust to nuisances within the region ( e.g. , local photometric and geometric variability ) to be useful for segmentation . Our construction uses a Poisson PDE , which naturally smooths data only within a region of interest . Smoothing naturally yields robustness to geometric nuisances ( domain deformations ) . By taking linear combinations of derivatives of the output of the PDE , we can approximate the effect of general convolutional kernels but avoid mixing data across the boundary of region of interest . ST-DNN is also covariant to translations and rotations , inheriting it from the Poisson equation , which leads to the segmentation algorithm being covariant to such transformations . 2.1 SHAPE-TAILORED DNN DESCRIPTORS THROUGH POISSON PDE . Shape-tailored Smoothing via Poisson PDE : To construct a shape-tailored deep network , we first smooth the input to a layer using the Poisson PDE so as to aggregate data only within the region of interest , similar to what is done in Khan et al . ( 2015 ) for just the first layer . Let R ⊂ Ω ⊂ R2 be the region of interest , where Ω is the domain of the input image I : Ω→ Rk and k is the number of input channels to the layer . Let u : R → RM ( M is the number of output channels ) be the result of the smoothing ; the components u of u solve the PDE within R : { u ( x ) − α∆u ( x ) = I ( x ) x ∈ R ∇u ( x ) ·N = 0 x ∈ ∂R , ( 1 ) where I is a channel of I , ∂R is the boundary of R , N is normal to ∂R , α is the scale of smoothing and ∆/∇ are the Laplacian and the gradient respectively . It can be shown that the smoothing can be written in the form u ( x ) = ∫ R K ( x , y ) I ( y ) dy where K ( . , . ) is the Green ’ s function of the PDE , a smoothing kernel , which further shows that the PDE aggregates data only within R. Shape-tailored Deep Network : We can now generalize the operation of convolution tailored to the region of interest by taking linear combinations of partial derivatives of the output of the PDE equation 1 . This is motivated by the fact that in R = R2 , linear combinations of derivatives of Gaussians can approximate any kernel arbitrarily well . Gaussian filters are the solution of the heat equation , and the PDE equation 1 relates to the heat equation , i.e. , equation 1 is the steady state solution of a heat equation . Thus , linear combinations of derivatives of equation 1 generalize convolution to an arbitrary shape R ; in experiments , a few first order directional derivatives are sufficient for our segmentation tasks ( see Section 5 for details ) . A layer of the ST-DNN takes such linear combinations and rectifies it as follows : fi ( x ) = r ◦ Li ◦ T [ I ] ( x ) , ( 2 ) where I : R→ Rk is the input to the layer , T is an operator that outputs derivatives of the solution of the Poisson PDE equation 1 , Li ( y ) = wiy+bi is a point-wise linear function ( i.e. , a 1×1 convolution applied to combine different channels ) , r is the rectified linear function , and i indexes the layer of the network . Notice that since r and Li are pointwise operations , they preserve the property of T that it aggregates data only within the region R. We now compose layers to construct a ST-DNN as follows : F [ I ] ( x ) = s ◦ fm ◦ fm−1 ◦ fm−2 ◦ .... f0 ◦ I ( x ) , ( 3 ) where F [ I ] ( x ) is the output of the ST-DNN , f0 , ... , fm are the m+ 1 layers of the network , I is the input image , and s represents the soft-max operation ( to bound the output values ) . ST-DNN does not have a pooling layer because the PDE already aggregates data from a neighborhood by smoothing ; further , the lack of reduction in spatial dimension allows for more accurate shape estimation in our subsequent segmentation , and avoids the need for up-sampling layers . We will show that we can retain efficiency in training and inference .
The paper proposed a new "shape-tailored" convolutional layer for improving the accuracy of semantic segmentation. The shape-tailored layer is inspired by the Poisson partial differential equation which aggregate features from neighboring pixels through the linear combinations of partial derivatives of the output of PDEs. The paper proves several properties of the proposed ST-DNN and demonstrated good results in comparisons with previous semantic segmentation algorithms.
SP:243a41483b648f364496a705cba45968c5c02968
Shape-Tailored Deep Neural Networks Using PDEs for Segmentation
1 INTRODUCTION . Convolutional neural networks ( CNNs ) have been used extensively for segmentation problems in computer vision He et al . ( 2017 ) ; He et al . ( 2016 ) ; Chen et al . ( 2017 ) ; Xie & Tu ( 2015 ) . CNNs provide a framework for learning descriptors that are able to discriminate different textured or semantic regions within images . Much progress has been made in segmentation with CNNs but results are still far from human performance . Also , significant engineering must be performed to adapt CNNs to segmentation problems . A basic component in the architecture for segmentation problems involves labeling or grouping dense descriptors returned by a backbone CNN . A difficulty in grouping these descriptors arises , especially near the boundaries of segmentation regions , as CNN descriptors aggregate data from fixed shape ( square neighborhoods ) at each pixel and may thus aggregate data from different regions . This makes grouping these descriptors into a unique region difficult , which often results in errors in the grouping . In segmentation problems ( e.g. , semantic segmentation ) , current methods attempt to mitigate these errors by adding post-processing layers that aim to group simultaneously the ( coarse-scale ) descriptors from the CNN backbone and the fine-level pixel data . However , the errors introduced might not always be fixed . A more natural approach to avoid this problem is to consider the coarse and fine structure together , avoiding aggregation across boundaries , to prevent errors at the outset . To avoid such errors , one could design descriptors that aggregate data only within boundaries . To this end , Khan et al . ( 2015 ) introduced “ shape-tailored ” descriptors that aggregate data within a region of interest , and used these descriptors for segmentation . However , these descriptors are hand-crafted and do not perform on-par with learned approaches . Khan & Sundaramoorthi ( 2018 ) introduced learned shape-tailored descriptors by learning a neural network operating on the input channel dimension of input hand-crafted shape-tailored descriptors for segmentation . However , these networks , though deep in the channel dimension , did not filter data spatially within layers . Since an advantage of CNNs comes from exploiting spatial filtering at each depth of the network , in this work , we design shape-tailored networks that are deep and perform shape-tailored filtering in space at each layer using solutions of the Poisson PDE . This results in shape-tailored networks that provide more discriminative descriptors than a single shape-tailored kernel . This extension requires development of techniques to back-propagate through PDEs , which we derive in this work . Our contributions are specifically : 1 . We construct and show how to train ST-DNN , deep networks that perform shape-tailored spatial filtering via the Poisson PDE at each depth so as to generalize a CNN to arbitrarily shaped regions . 2 . We show analytically and empirically that ST-DNNs are covariant to translations and rotations as they inherit this property from the Poisson PDE . In segmentation , covariance ( a.k.a. , equivariance ) to translation and rotation is a desired property : if a segment in an image is found , then the corresponding segment should be found in the translated / rotated image ( or object ) . This property is not generally present with existing CNN-based segmentation methods even when trained with augmented translated and rotated images Azulay & Weiss ( 2019 ) , and requires special consideration . 3 . We show analytically and empirically that ST-DNNs are robust to domain deformations . These result from viewpoint change or object articulation , and so they should not affect the descriptor . 4 . To demonstrate ST-DNN and the properties above , we validate them on the task of segmentation , an important problem in low-level vision Malik & Perona ( 1990 ) ; Arbelaez et al . ( 2011b ) . Because of properties of the PDE , ST-DNN also have desirable generalization properties . This is because : a ) The robustness and covariance properties are built into our descriptors and do not need to be learned from data , b ) The PDE solutions , generalizations of Gabor-like filters Olshausen & Field ( 1996 ) ; Zador ( 2019 ) , have natural image structure inherent in their solutions and so this does not need to be learned from data , and c ) Our networks have fewer parameters compared to existing networks in segmentation . This is because the PDE solutions form a basis and only linear combinations of a few basis elements are needed to learn discriminative descriptors for segmentation . In contrast , CNNs spend a lot of parameters to learn this structure . 1.1 RELATED WORK . Traditional approaches to segmentation rely on hand-crafted features , e.g. , through a filter bank Haralick & Shapiro ( 1985 ) . These features are ambiguous near the boundaries of objects . In Khan et al . ( 2015 ) hand-crafted descriptors that aggregate data within object boundaries are constructed to avoid this , but lack sufficient capacity to capture the diversity of textures or be invariant to nuisances . Deep-learning based approaches have showed state-of-the-art results in edge-based methods Xie & Tu ( 2017 ) ; He et al . ( 2019 ) ; Deng et al . ( 2018 ) . Watershed is applied on edge-maps to obtain the segmentation . The main drawback of these methods is it is often difficult to form segmentations due to extraneous or faint edges , particularly when `` textons '' in textures are large . CNNs have been applied to compute descriptors for semantic segmentation , where pixels in an image are classified into certain semantic object classes Li et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Du et al . ( 2019 ) ; Pang et al . ( 2019 ) ; Zhu et al . ( 2019 ) ; Liu et al . ( 2019 ) . Usually these classes are limited to a few object classes and do not tackle general textures , where the number of classes may be far greater , and thus such approaches are not directly applicable to texture segmentation . But semantic segmentation approaches may eventually benefit from our methodology as descriptors aggregating data only within objects or regions are also relevant to these problems . A learned shape-tailored descriptor Khan & Sundaramoorthi ( 2018 ) is constructed with a Siamese network on hand-crafted shape-tailored descriptors . However , Khan & Sundaramoorthi ( 2018 ) only does shape-tailored filtering in pre-processing as layering these requires new methods to train . We further examine covariance and robustness , not examined in Khan & Sundaramoorthi ( 2018 ) . Covariance to rotation in CNNs has been examined in recent works , e.g. , Weiler et al . ( 2018 ) ; Yin et al . ( 2019 ) ; Anderson et al . ( 2019 ) . They , however , are not shape-tailored so do not aggregate data only within shaped regions . Lack of robustness to deformation ( and translation ) in CNNs is examined in Azulay & Weiss ( 2019 ) and theoretically in Bietti & Mairal ( 2017 ) . Sifre & Mallat ( 2013 ) constructs deformation robust descriptors inspired by CNNs , but are hand-crafted . 2 CONSTRUCTION OF SHAPE-TAILORED DNN AND PROPERTIES . In this section , we design a deep neural network that outputs descriptors at each pixel within an arbitrary shaped region of interest and aggregates data only from within the region . We want the descriptors to be discriminative of different texture , yet robust to nuisances within the region ( e.g. , local photometric and geometric variability ) to be useful for segmentation . Our construction uses a Poisson PDE , which naturally smooths data only within a region of interest . Smoothing naturally yields robustness to geometric nuisances ( domain deformations ) . By taking linear combinations of derivatives of the output of the PDE , we can approximate the effect of general convolutional kernels but avoid mixing data across the boundary of region of interest . ST-DNN is also covariant to translations and rotations , inheriting it from the Poisson equation , which leads to the segmentation algorithm being covariant to such transformations . 2.1 SHAPE-TAILORED DNN DESCRIPTORS THROUGH POISSON PDE . Shape-tailored Smoothing via Poisson PDE : To construct a shape-tailored deep network , we first smooth the input to a layer using the Poisson PDE so as to aggregate data only within the region of interest , similar to what is done in Khan et al . ( 2015 ) for just the first layer . Let R ⊂ Ω ⊂ R2 be the region of interest , where Ω is the domain of the input image I : Ω→ Rk and k is the number of input channels to the layer . Let u : R → RM ( M is the number of output channels ) be the result of the smoothing ; the components u of u solve the PDE within R : { u ( x ) − α∆u ( x ) = I ( x ) x ∈ R ∇u ( x ) ·N = 0 x ∈ ∂R , ( 1 ) where I is a channel of I , ∂R is the boundary of R , N is normal to ∂R , α is the scale of smoothing and ∆/∇ are the Laplacian and the gradient respectively . It can be shown that the smoothing can be written in the form u ( x ) = ∫ R K ( x , y ) I ( y ) dy where K ( . , . ) is the Green ’ s function of the PDE , a smoothing kernel , which further shows that the PDE aggregates data only within R. Shape-tailored Deep Network : We can now generalize the operation of convolution tailored to the region of interest by taking linear combinations of partial derivatives of the output of the PDE equation 1 . This is motivated by the fact that in R = R2 , linear combinations of derivatives of Gaussians can approximate any kernel arbitrarily well . Gaussian filters are the solution of the heat equation , and the PDE equation 1 relates to the heat equation , i.e. , equation 1 is the steady state solution of a heat equation . Thus , linear combinations of derivatives of equation 1 generalize convolution to an arbitrary shape R ; in experiments , a few first order directional derivatives are sufficient for our segmentation tasks ( see Section 5 for details ) . A layer of the ST-DNN takes such linear combinations and rectifies it as follows : fi ( x ) = r ◦ Li ◦ T [ I ] ( x ) , ( 2 ) where I : R→ Rk is the input to the layer , T is an operator that outputs derivatives of the solution of the Poisson PDE equation 1 , Li ( y ) = wiy+bi is a point-wise linear function ( i.e. , a 1×1 convolution applied to combine different channels ) , r is the rectified linear function , and i indexes the layer of the network . Notice that since r and Li are pointwise operations , they preserve the property of T that it aggregates data only within the region R. We now compose layers to construct a ST-DNN as follows : F [ I ] ( x ) = s ◦ fm ◦ fm−1 ◦ fm−2 ◦ .... f0 ◦ I ( x ) , ( 3 ) where F [ I ] ( x ) is the output of the ST-DNN , f0 , ... , fm are the m+ 1 layers of the network , I is the input image , and s represents the soft-max operation ( to bound the output values ) . ST-DNN does not have a pooling layer because the PDE already aggregates data from a neighborhood by smoothing ; further , the lack of reduction in spatial dimension allows for more accurate shape estimation in our subsequent segmentation , and avoids the need for up-sampling layers . We will show that we can retain efficiency in training and inference .
This papers presents shape-tailored deep neural networks (ST-DNN) and apply to the task of texture segmentation. ST-DNN are motivated by the prior work on shape-tailored descriptors (or smoothing) that aggregate image statistics within regions of the interest, and defined as a solutions to the Poisson PDE which balances image fidelity and smoothness. This paper applies this formulation to generalize convolutions from square-shared operations to arbitrary regions, and constructs a deep neural networks by stacking this smoothness operator with 1x1 convolutions and ReLU (ST-DNN layer), repeatedly. For texture segmentation task, ST-DNN takes the input data (input images channels, together with grayscale and oriented gradients computed at 5 scales) and initial segmentation mask, and applies several layers of ST-DNN layers to produce an updated segmentation mask. The network parameters are trained using a loss that is minimized when the descriptors within a segment are homogenous, and different from descriptors in other regions.
SP:243a41483b648f364496a705cba45968c5c02968
Memory Optimization for Deep Networks
Deep learning is slowly , but steadily , hitting a memory bottleneck . While the tensor computation in top-of-the-line GPUs increased by 32× over the last five years , the total available memory only grew by 2.5× . This prevents researchers from exploring larger architectures , as training large networks requires more memory for storing intermediate outputs . In this paper , we present MONET , an automatic framework that minimizes both the memory footprint and computational overhead of deep networks . MONET jointly optimizes the checkpointing schedule and the implementation of various operators . MONET is able to outperform all prior handtuned operations as well as automated checkpointing . MONET reduces the overall memory requirement by 3× for various PyTorch models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than current state-of-the-art automated checkpointing frameworks . Our code is available at https : //github.com/utsaslab/MONeT . 1 INTRODUCTION . Deep networks are widely used in domains ranging from image classification ( Krizhevsky et al. , 2012 ; Simonyan & Zisserman , 2015 ; He et al. , 2016 ) to video recognition ( Wu et al. , 2019 ; Feichtenhofer et al. , 2019 ) or natural language processing ( Devlin et al. , 2019 ; Yang et al. , 2019 ) . However , training deep networks is resource-intensive . In particular , the amount of GPU memory bottlenecks training many deep networks ( Dong et al. , 2016 ; Kim et al. , 2016 ; Chen et al. , 2018 ; Child et al. , 2019 ) . This bottleneck requires either modifying the network architecture or scaling training to multiple nodes , incurring significant overheads . We presents MONET , an automatic framework to minimize memory footprint for deep networks . MONET jointly optimizes global compute-graph-level techniques ( such as checkpointing ) and local techniques ( such as memory-efficient implementations of individual operator ) . At the heart of MONET is a theoretical analysis that enables joint optimization and provides tight bounds on memory consumption . We analyze the memory consumption and computational cost of a general forward and backward pass under changing local operator implementations and a global checkpointing schedule . Specifically , we are able to tightly bound the peak memory consumption for network forward , backward , and recomputation stages . MONET uses these constraints to optimize for the most efficient forward and backward implementation both locally and globally under a fixed memory budget . We linearize all memory bounds , and express both implementation selection and checkpointing as a 0-1 integer program , which we solve using standard solvers . We conduct extensive experiments , demonstrating that MONET significantly outperforms existing automatic frameworks that use local or global techniques . On multiple architectures ( ResNet ( He et al. , 2016 ) , VGG ( Simonyan & Zisserman , 2015 ) , UNet ( Ronneberger et al. , 2015 ) , GoogleNet ( Szegedy et al. , 2015 ) , MobileNet-V2 ( Sandler et al. , 2018 ) ) , memory budgets ( 5-10 GB ) , and network configurations ( multiple resolutions ) , MONET consistently achieves lower memory footprints at equivalent or lower computational overhead . MONET reduces the overall memory requirement by 3× for various models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than the current state-of-the-art automated checkpointing framework . The results achieved by MONET demonstrate the power of jointly optimizing global checkpointing schedules and local operator implementations . 2 RELATED WORK . There are two broad families of approaches to reduce the memory footprint of a deep network during training : operator-level implementation changes , and global , graph-level optimizations . The novel aspect of MONET is that it is able to combine both approaches and find the optimal mix of local and global techniques for a given network . Operator-Specific Optimizations . Researchers have found creative ways to implement individual operators or groups of operators in a more memory-efficient manner . Standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) provide different implementations of certain operators that trade computation for intermediate memory use . These implementation are chosen according to local search heuristics , and are not globally optimal . Gist ( Jain et al. , 2018 ) proposes several hand-crafted optimizations such as storing only ReLU signs . RevNets ( Gomez et al. , 2017 ) redesigns a ResNet ( He et al. , 2016 ) architecture making each network block reversible , thereby eliminating the need to store intermediate activations for backpropagation . Memory-efficient DenseNets ( Pleiss et al. , 2017 ) reduce memory utilized for feature maps by recomputing all intermediate feature maps during the backward pass with a small compute overhead . In-place activated batchnorm ( Bulò et al. , 2018 ) or ReLU layers use output activations to compute their gradients , thus reusing a single memory buffer for the gradient computation in consecutive layers . Mixed precision training ( Micikevicius et al. , 2018 ) uses half precision ( FP16 ) instead of single precision ( FP32 ) for all tensors and arithmetic during training , reducing the memory by nearly half . While training at precision lower than FP16 results in loss of training quality ( Banner et al. , 2018 ) , prior work like backpropagation with approximate activations ( Chakrabarti & Moseley , 2019 ) carefully quantize certain intermediate outputs ( activations ) to 4 bits , resulting in significant memory savings . Although these hand-crafted techniques independently result in memory savings , there is no one-size-fits-all recipe , and different implementations perform best on different architectures . In contrast , MONET automatically finds the best implementation for each forward and backward operator given a memory budget . Checkpointing . Chen et al . ( 2016 ) proposed dividing a network into different segments , dropping all intermediate outputs within each segment , and recomputing them later . Chen et al . use √ n equal segments , trading memory savings for the cost of an extra forward pass . Checkmate ( Jain et al. , 2019 ) solves the problem in a more general setting , using an mixed-integer linear program solver to decide which layers to recompute for a given network . Like Checkmate , our work optimizes a checkpointing schedule , but on a different computation graph . Our computation graph allows for the optimization of an entire execution plan jointly finding a checkpointing schedule and the best implementation of each forward and backward operator . In Checkmate , changes in operator implementation induce a different computation graph , and could thus not directly be optimized . Appendix F highlights some of the difficulties of adding operator optimizations into Checkmate . In summary , while much work has been done on local optimizations ( operator implementations ) and global compute-graph-level techniques ( automated checkpointing ) , MONET is the first system to jointly optimize a given architecture using both local and global techniques . 3 PRELIMINARIES . Let the forward pass of a CNN with parameters Θ be expressed as a directed-acyclic graph ( DAG ) , where each node i ∈ { 1 , . . . , N } corresponds to an operator forwardi , and edges ( i , j ) ∈ E specify the data-flow dependencies , i.e. , the output of operator i is used as input in operator j . Without loss of generality , computational dependency ( i , j ) ∈ E implies i < j . Let Nj = { i : ( i , j ) ∈ E } be the set of all incoming edges of an operation j . We will first discuss the forward pass through a network and the basic form of a backward pass using checkpointing . The backward pass reverses all computational dependency expressed in our DAG , and induces certain dependencies on forward activations . We call these checkpoint dependencies Dk . They are either saved or recomputed depending on a schedule ( s , r ) . Checkpointing creates a trade-off between computation and memory consumption . To highlight this trade-off , we formally compute the amount of memory consumed in both forward and backward passes , which allows us to optimize for the ideal execution plan in Sec . 4 . We provide a reference to the notations introduced in this section and the next along with their explanations in Appendix A . The Forward Pass . Alg . 1 shows a general overview of the forward pass in a deep network , as implemented in standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) . The algorithm proceeds in increasing order of index i . Each operator forwardi ( · ) depends on a set of tensors L stored in local memory . These tensors include model parameters Θ , computational dependenciesNi , and tensors stored for later forward operators , i.e . skip or residual activations ( He et al. , 2016 ) . At each iteration , we add any output tensors of forwardi to the local memory L. Early deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ) strictly grew the set of local tensors L leading to an unnecessarily high memory consumption . Modern graph-based frameworks ( Paszke et al. , 2019 ; Abadi et al. , 2016 ) reduce the memory footprint by aggressively pruning local memory L and freeing any tensor that is no longer used in later computations . Some output activations xi are used in the backward pass , and have to be saved for later . We use a checkpointing schedule sN to determine which . Formally , sNi ∈ { 0 , 1 } indicates whether the activation of node i is stored during the forward pass . An activation which is not stored will be recomputed if it is needed during the backward pass . Analyzing peak memory consumption of the forward pass . Only the forwardi operator ( Alg . 1 L. 4 ) allocates memory . All other operators perform mere bookkeeping on existing tensor . It is thus sufficient to study the peak memory consumption mNi in forwardi for each node i . Let Li , S N i be the set of local tensors L and saved tensors S while calling forwardi respectively . Li includes all parameters and computational dependencies for this and later forward passes Li = Θ ∪ { xj : j ∈ Nt for any t ≥ i and j < i } . Li is constant and computed ahead of time . The schedule sN determines the set of saved tensors SNi = { xj : sNj = 1 for j < i } . In addition , each forward operator uses a certain amount of workspace memory ci to store intermediate results . The total memory consumption of a forward operator is thus mi = ci + |xi|+ |SNi ∪ Li| = ci + |xi|+ ∑ xj∈Li |xj |+ ∑ j < i : xj /∈Li |xj |sNj , ( 1 ) where | · | refers to the memory consumed by a tensor or set of tensors . Most of the memory consumption is constant and does not depend on the schedule . The Backward Pass . The backward pass proceeds in a reverse order , as summarized in Alg . 2. backwardk ( · ) of each node k depends on a set of gradient tensors L̂ and forward tensors { xi : i ∈ Dk } . Any gradients required by the current and later backward passes are stored in local memory L̂ . Dependencies Dk may either be stored in Sk or need to be recomputed from checkpoints in Sk . Recomputation involves forward computation of one or more nodes , which increases computational overhead , and allows for a new set of tensors Sk−1 to be saved . After recomputation , all dependencies Dk are kept in memory . The backward operation produces a gradient for each input tensor of the original forward operation , which is added to L̂ if required for a later backward computation . We aggressively remove tensors in L̂ that are not required . Analyzing the peak memory consumption of the backward pass . Peak memory consumption m̂k again only depends on the forwardi ( Alg . 2 L. 7 ) and backwardk ( Alg . 2 L. 12 ) operations . For the backwardk operation , let ĉk be the workspace memory , L̂k be the set of gradient tensors stored , Dk = { xi : i ∈ Dk } be the forward tensors used , and Sk−1 be the set of newly saved tensors . Here L̂k and Dk can be pre-computed . The total memory consumption for the backwardk call is m̂k = ĉk + |yk|+ |Sk−1 ∪ L̂k ∪Dk| = ĉk + |yk|+ ∑ yl∈L̂k |yl|+ ∑ xi∈Dk |xi|+ ∑ xi /∈Dk sk−1i |xi| . ( 2 ) Here again , only the last term depends on the checkpointing schedule , while the rest is a constant . Analyzing the peak memory consumption of the recomputation . Finally , the peak memory m̃ki for the forwardi call ( Alg . 2 L. 7 ) depends on the set of local tensors L , checkpoint dependencies D , saved tensors S , and gradient tensors L̂ , named Lki , Dk , S k−1 i , L̂k respectively . Following the forward pass : m̃ki = ci + |xi|+ |L̂k|+ |Sk−1i ∪ L k i ∪Dk| = ci + |xi|+ |L̂k|+ ∑ j < i : xj /∈Lki ∪Dk sk−1j |xj |+ ∑ j < i : xj∈Lki ∪Dk |xj |+ ∑ j > i skj |xj | . ( 3 ) Unlike the forward pass , Lki is no longer constant , but depends on past saved tensors and future recomputations in ( s , r ) : Lki = Θ ∪ { xj : j ∈ Nt for any t ≥ i with rkt = 1 and j < i } . In the next section , we show how to take this formalization of the forward and backward pass , and find an optimal execution plan including checkpointing schedule ( s , r ) , forwardi implementations , and backwardk implementations , under a fixed memory budget .
The paper provides a framework (MoNET) to perform automatic memory optimization targeting deep neural networks. Their technique jointly optimizes the checkpointing schedule and the choice of individual ops to find the implementation with the least possible runtime overhead under certain memory constraints. They formulate the problem as a ILP problem where the objective is to minimize runtime subject to strict memory constraints. They show that the solutions achieve 3x reduction in memory footprint compared to a pytorch implementation with minimal runtime overhead.
SP:9d73791f8959a5303d9ee3cdab9aa6d9b89f8ea7
Memory Optimization for Deep Networks
Deep learning is slowly , but steadily , hitting a memory bottleneck . While the tensor computation in top-of-the-line GPUs increased by 32× over the last five years , the total available memory only grew by 2.5× . This prevents researchers from exploring larger architectures , as training large networks requires more memory for storing intermediate outputs . In this paper , we present MONET , an automatic framework that minimizes both the memory footprint and computational overhead of deep networks . MONET jointly optimizes the checkpointing schedule and the implementation of various operators . MONET is able to outperform all prior handtuned operations as well as automated checkpointing . MONET reduces the overall memory requirement by 3× for various PyTorch models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than current state-of-the-art automated checkpointing frameworks . Our code is available at https : //github.com/utsaslab/MONeT . 1 INTRODUCTION . Deep networks are widely used in domains ranging from image classification ( Krizhevsky et al. , 2012 ; Simonyan & Zisserman , 2015 ; He et al. , 2016 ) to video recognition ( Wu et al. , 2019 ; Feichtenhofer et al. , 2019 ) or natural language processing ( Devlin et al. , 2019 ; Yang et al. , 2019 ) . However , training deep networks is resource-intensive . In particular , the amount of GPU memory bottlenecks training many deep networks ( Dong et al. , 2016 ; Kim et al. , 2016 ; Chen et al. , 2018 ; Child et al. , 2019 ) . This bottleneck requires either modifying the network architecture or scaling training to multiple nodes , incurring significant overheads . We presents MONET , an automatic framework to minimize memory footprint for deep networks . MONET jointly optimizes global compute-graph-level techniques ( such as checkpointing ) and local techniques ( such as memory-efficient implementations of individual operator ) . At the heart of MONET is a theoretical analysis that enables joint optimization and provides tight bounds on memory consumption . We analyze the memory consumption and computational cost of a general forward and backward pass under changing local operator implementations and a global checkpointing schedule . Specifically , we are able to tightly bound the peak memory consumption for network forward , backward , and recomputation stages . MONET uses these constraints to optimize for the most efficient forward and backward implementation both locally and globally under a fixed memory budget . We linearize all memory bounds , and express both implementation selection and checkpointing as a 0-1 integer program , which we solve using standard solvers . We conduct extensive experiments , demonstrating that MONET significantly outperforms existing automatic frameworks that use local or global techniques . On multiple architectures ( ResNet ( He et al. , 2016 ) , VGG ( Simonyan & Zisserman , 2015 ) , UNet ( Ronneberger et al. , 2015 ) , GoogleNet ( Szegedy et al. , 2015 ) , MobileNet-V2 ( Sandler et al. , 2018 ) ) , memory budgets ( 5-10 GB ) , and network configurations ( multiple resolutions ) , MONET consistently achieves lower memory footprints at equivalent or lower computational overhead . MONET reduces the overall memory requirement by 3× for various models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than the current state-of-the-art automated checkpointing framework . The results achieved by MONET demonstrate the power of jointly optimizing global checkpointing schedules and local operator implementations . 2 RELATED WORK . There are two broad families of approaches to reduce the memory footprint of a deep network during training : operator-level implementation changes , and global , graph-level optimizations . The novel aspect of MONET is that it is able to combine both approaches and find the optimal mix of local and global techniques for a given network . Operator-Specific Optimizations . Researchers have found creative ways to implement individual operators or groups of operators in a more memory-efficient manner . Standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) provide different implementations of certain operators that trade computation for intermediate memory use . These implementation are chosen according to local search heuristics , and are not globally optimal . Gist ( Jain et al. , 2018 ) proposes several hand-crafted optimizations such as storing only ReLU signs . RevNets ( Gomez et al. , 2017 ) redesigns a ResNet ( He et al. , 2016 ) architecture making each network block reversible , thereby eliminating the need to store intermediate activations for backpropagation . Memory-efficient DenseNets ( Pleiss et al. , 2017 ) reduce memory utilized for feature maps by recomputing all intermediate feature maps during the backward pass with a small compute overhead . In-place activated batchnorm ( Bulò et al. , 2018 ) or ReLU layers use output activations to compute their gradients , thus reusing a single memory buffer for the gradient computation in consecutive layers . Mixed precision training ( Micikevicius et al. , 2018 ) uses half precision ( FP16 ) instead of single precision ( FP32 ) for all tensors and arithmetic during training , reducing the memory by nearly half . While training at precision lower than FP16 results in loss of training quality ( Banner et al. , 2018 ) , prior work like backpropagation with approximate activations ( Chakrabarti & Moseley , 2019 ) carefully quantize certain intermediate outputs ( activations ) to 4 bits , resulting in significant memory savings . Although these hand-crafted techniques independently result in memory savings , there is no one-size-fits-all recipe , and different implementations perform best on different architectures . In contrast , MONET automatically finds the best implementation for each forward and backward operator given a memory budget . Checkpointing . Chen et al . ( 2016 ) proposed dividing a network into different segments , dropping all intermediate outputs within each segment , and recomputing them later . Chen et al . use √ n equal segments , trading memory savings for the cost of an extra forward pass . Checkmate ( Jain et al. , 2019 ) solves the problem in a more general setting , using an mixed-integer linear program solver to decide which layers to recompute for a given network . Like Checkmate , our work optimizes a checkpointing schedule , but on a different computation graph . Our computation graph allows for the optimization of an entire execution plan jointly finding a checkpointing schedule and the best implementation of each forward and backward operator . In Checkmate , changes in operator implementation induce a different computation graph , and could thus not directly be optimized . Appendix F highlights some of the difficulties of adding operator optimizations into Checkmate . In summary , while much work has been done on local optimizations ( operator implementations ) and global compute-graph-level techniques ( automated checkpointing ) , MONET is the first system to jointly optimize a given architecture using both local and global techniques . 3 PRELIMINARIES . Let the forward pass of a CNN with parameters Θ be expressed as a directed-acyclic graph ( DAG ) , where each node i ∈ { 1 , . . . , N } corresponds to an operator forwardi , and edges ( i , j ) ∈ E specify the data-flow dependencies , i.e. , the output of operator i is used as input in operator j . Without loss of generality , computational dependency ( i , j ) ∈ E implies i < j . Let Nj = { i : ( i , j ) ∈ E } be the set of all incoming edges of an operation j . We will first discuss the forward pass through a network and the basic form of a backward pass using checkpointing . The backward pass reverses all computational dependency expressed in our DAG , and induces certain dependencies on forward activations . We call these checkpoint dependencies Dk . They are either saved or recomputed depending on a schedule ( s , r ) . Checkpointing creates a trade-off between computation and memory consumption . To highlight this trade-off , we formally compute the amount of memory consumed in both forward and backward passes , which allows us to optimize for the ideal execution plan in Sec . 4 . We provide a reference to the notations introduced in this section and the next along with their explanations in Appendix A . The Forward Pass . Alg . 1 shows a general overview of the forward pass in a deep network , as implemented in standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) . The algorithm proceeds in increasing order of index i . Each operator forwardi ( · ) depends on a set of tensors L stored in local memory . These tensors include model parameters Θ , computational dependenciesNi , and tensors stored for later forward operators , i.e . skip or residual activations ( He et al. , 2016 ) . At each iteration , we add any output tensors of forwardi to the local memory L. Early deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ) strictly grew the set of local tensors L leading to an unnecessarily high memory consumption . Modern graph-based frameworks ( Paszke et al. , 2019 ; Abadi et al. , 2016 ) reduce the memory footprint by aggressively pruning local memory L and freeing any tensor that is no longer used in later computations . Some output activations xi are used in the backward pass , and have to be saved for later . We use a checkpointing schedule sN to determine which . Formally , sNi ∈ { 0 , 1 } indicates whether the activation of node i is stored during the forward pass . An activation which is not stored will be recomputed if it is needed during the backward pass . Analyzing peak memory consumption of the forward pass . Only the forwardi operator ( Alg . 1 L. 4 ) allocates memory . All other operators perform mere bookkeeping on existing tensor . It is thus sufficient to study the peak memory consumption mNi in forwardi for each node i . Let Li , S N i be the set of local tensors L and saved tensors S while calling forwardi respectively . Li includes all parameters and computational dependencies for this and later forward passes Li = Θ ∪ { xj : j ∈ Nt for any t ≥ i and j < i } . Li is constant and computed ahead of time . The schedule sN determines the set of saved tensors SNi = { xj : sNj = 1 for j < i } . In addition , each forward operator uses a certain amount of workspace memory ci to store intermediate results . The total memory consumption of a forward operator is thus mi = ci + |xi|+ |SNi ∪ Li| = ci + |xi|+ ∑ xj∈Li |xj |+ ∑ j < i : xj /∈Li |xj |sNj , ( 1 ) where | · | refers to the memory consumed by a tensor or set of tensors . Most of the memory consumption is constant and does not depend on the schedule . The Backward Pass . The backward pass proceeds in a reverse order , as summarized in Alg . 2. backwardk ( · ) of each node k depends on a set of gradient tensors L̂ and forward tensors { xi : i ∈ Dk } . Any gradients required by the current and later backward passes are stored in local memory L̂ . Dependencies Dk may either be stored in Sk or need to be recomputed from checkpoints in Sk . Recomputation involves forward computation of one or more nodes , which increases computational overhead , and allows for a new set of tensors Sk−1 to be saved . After recomputation , all dependencies Dk are kept in memory . The backward operation produces a gradient for each input tensor of the original forward operation , which is added to L̂ if required for a later backward computation . We aggressively remove tensors in L̂ that are not required . Analyzing the peak memory consumption of the backward pass . Peak memory consumption m̂k again only depends on the forwardi ( Alg . 2 L. 7 ) and backwardk ( Alg . 2 L. 12 ) operations . For the backwardk operation , let ĉk be the workspace memory , L̂k be the set of gradient tensors stored , Dk = { xi : i ∈ Dk } be the forward tensors used , and Sk−1 be the set of newly saved tensors . Here L̂k and Dk can be pre-computed . The total memory consumption for the backwardk call is m̂k = ĉk + |yk|+ |Sk−1 ∪ L̂k ∪Dk| = ĉk + |yk|+ ∑ yl∈L̂k |yl|+ ∑ xi∈Dk |xi|+ ∑ xi /∈Dk sk−1i |xi| . ( 2 ) Here again , only the last term depends on the checkpointing schedule , while the rest is a constant . Analyzing the peak memory consumption of the recomputation . Finally , the peak memory m̃ki for the forwardi call ( Alg . 2 L. 7 ) depends on the set of local tensors L , checkpoint dependencies D , saved tensors S , and gradient tensors L̂ , named Lki , Dk , S k−1 i , L̂k respectively . Following the forward pass : m̃ki = ci + |xi|+ |L̂k|+ |Sk−1i ∪ L k i ∪Dk| = ci + |xi|+ |L̂k|+ ∑ j < i : xj /∈Lki ∪Dk sk−1j |xj |+ ∑ j < i : xj∈Lki ∪Dk |xj |+ ∑ j > i skj |xj | . ( 3 ) Unlike the forward pass , Lki is no longer constant , but depends on past saved tensors and future recomputations in ( s , r ) : Lki = Θ ∪ { xj : j ∈ Nt for any t ≥ i with rkt = 1 and j < i } . In the next section , we show how to take this formalization of the forward and backward pass , and find an optimal execution plan including checkpointing schedule ( s , r ) , forwardi implementations , and backwardk implementations , under a fixed memory budget .
The authors present MONeT, an automatic approach to jointly optimize operator cost and checkpoint scheduling for deep learning on a fixed memory budget. The paper thoroughly defines the problem, relevant previous work, and the MONeT framework. Given a fixed GPU memory budget, MONeT solves an integer program in order to jointly minimize the computational overhead of checkpointing with various operator implementation. This approach is intuitive, as previous approaches, such as the recently proposed CheckMate, only optimize the checkpoint schedule. The derived integer program is also a nontrivial extension of previous work. With MONeT implemented in PyTorch, a large number of empirical results are presented, which show the superiority of MONeT compared to CheckMate, and show memory savings (versus impressively slight overhead) compared to PyTorch.
SP:9d73791f8959a5303d9ee3cdab9aa6d9b89f8ea7
Memory Optimization for Deep Networks
Deep learning is slowly , but steadily , hitting a memory bottleneck . While the tensor computation in top-of-the-line GPUs increased by 32× over the last five years , the total available memory only grew by 2.5× . This prevents researchers from exploring larger architectures , as training large networks requires more memory for storing intermediate outputs . In this paper , we present MONET , an automatic framework that minimizes both the memory footprint and computational overhead of deep networks . MONET jointly optimizes the checkpointing schedule and the implementation of various operators . MONET is able to outperform all prior handtuned operations as well as automated checkpointing . MONET reduces the overall memory requirement by 3× for various PyTorch models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than current state-of-the-art automated checkpointing frameworks . Our code is available at https : //github.com/utsaslab/MONeT . 1 INTRODUCTION . Deep networks are widely used in domains ranging from image classification ( Krizhevsky et al. , 2012 ; Simonyan & Zisserman , 2015 ; He et al. , 2016 ) to video recognition ( Wu et al. , 2019 ; Feichtenhofer et al. , 2019 ) or natural language processing ( Devlin et al. , 2019 ; Yang et al. , 2019 ) . However , training deep networks is resource-intensive . In particular , the amount of GPU memory bottlenecks training many deep networks ( Dong et al. , 2016 ; Kim et al. , 2016 ; Chen et al. , 2018 ; Child et al. , 2019 ) . This bottleneck requires either modifying the network architecture or scaling training to multiple nodes , incurring significant overheads . We presents MONET , an automatic framework to minimize memory footprint for deep networks . MONET jointly optimizes global compute-graph-level techniques ( such as checkpointing ) and local techniques ( such as memory-efficient implementations of individual operator ) . At the heart of MONET is a theoretical analysis that enables joint optimization and provides tight bounds on memory consumption . We analyze the memory consumption and computational cost of a general forward and backward pass under changing local operator implementations and a global checkpointing schedule . Specifically , we are able to tightly bound the peak memory consumption for network forward , backward , and recomputation stages . MONET uses these constraints to optimize for the most efficient forward and backward implementation both locally and globally under a fixed memory budget . We linearize all memory bounds , and express both implementation selection and checkpointing as a 0-1 integer program , which we solve using standard solvers . We conduct extensive experiments , demonstrating that MONET significantly outperforms existing automatic frameworks that use local or global techniques . On multiple architectures ( ResNet ( He et al. , 2016 ) , VGG ( Simonyan & Zisserman , 2015 ) , UNet ( Ronneberger et al. , 2015 ) , GoogleNet ( Szegedy et al. , 2015 ) , MobileNet-V2 ( Sandler et al. , 2018 ) ) , memory budgets ( 5-10 GB ) , and network configurations ( multiple resolutions ) , MONET consistently achieves lower memory footprints at equivalent or lower computational overhead . MONET reduces the overall memory requirement by 3× for various models , with a 9-16 % overhead in computation . For the same computation cost , MONET requires 1.2-1.8× less memory than the current state-of-the-art automated checkpointing framework . The results achieved by MONET demonstrate the power of jointly optimizing global checkpointing schedules and local operator implementations . 2 RELATED WORK . There are two broad families of approaches to reduce the memory footprint of a deep network during training : operator-level implementation changes , and global , graph-level optimizations . The novel aspect of MONET is that it is able to combine both approaches and find the optimal mix of local and global techniques for a given network . Operator-Specific Optimizations . Researchers have found creative ways to implement individual operators or groups of operators in a more memory-efficient manner . Standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) provide different implementations of certain operators that trade computation for intermediate memory use . These implementation are chosen according to local search heuristics , and are not globally optimal . Gist ( Jain et al. , 2018 ) proposes several hand-crafted optimizations such as storing only ReLU signs . RevNets ( Gomez et al. , 2017 ) redesigns a ResNet ( He et al. , 2016 ) architecture making each network block reversible , thereby eliminating the need to store intermediate activations for backpropagation . Memory-efficient DenseNets ( Pleiss et al. , 2017 ) reduce memory utilized for feature maps by recomputing all intermediate feature maps during the backward pass with a small compute overhead . In-place activated batchnorm ( Bulò et al. , 2018 ) or ReLU layers use output activations to compute their gradients , thus reusing a single memory buffer for the gradient computation in consecutive layers . Mixed precision training ( Micikevicius et al. , 2018 ) uses half precision ( FP16 ) instead of single precision ( FP32 ) for all tensors and arithmetic during training , reducing the memory by nearly half . While training at precision lower than FP16 results in loss of training quality ( Banner et al. , 2018 ) , prior work like backpropagation with approximate activations ( Chakrabarti & Moseley , 2019 ) carefully quantize certain intermediate outputs ( activations ) to 4 bits , resulting in significant memory savings . Although these hand-crafted techniques independently result in memory savings , there is no one-size-fits-all recipe , and different implementations perform best on different architectures . In contrast , MONET automatically finds the best implementation for each forward and backward operator given a memory budget . Checkpointing . Chen et al . ( 2016 ) proposed dividing a network into different segments , dropping all intermediate outputs within each segment , and recomputing them later . Chen et al . use √ n equal segments , trading memory savings for the cost of an extra forward pass . Checkmate ( Jain et al. , 2019 ) solves the problem in a more general setting , using an mixed-integer linear program solver to decide which layers to recompute for a given network . Like Checkmate , our work optimizes a checkpointing schedule , but on a different computation graph . Our computation graph allows for the optimization of an entire execution plan jointly finding a checkpointing schedule and the best implementation of each forward and backward operator . In Checkmate , changes in operator implementation induce a different computation graph , and could thus not directly be optimized . Appendix F highlights some of the difficulties of adding operator optimizations into Checkmate . In summary , while much work has been done on local optimizations ( operator implementations ) and global compute-graph-level techniques ( automated checkpointing ) , MONET is the first system to jointly optimize a given architecture using both local and global techniques . 3 PRELIMINARIES . Let the forward pass of a CNN with parameters Θ be expressed as a directed-acyclic graph ( DAG ) , where each node i ∈ { 1 , . . . , N } corresponds to an operator forwardi , and edges ( i , j ) ∈ E specify the data-flow dependencies , i.e. , the output of operator i is used as input in operator j . Without loss of generality , computational dependency ( i , j ) ∈ E implies i < j . Let Nj = { i : ( i , j ) ∈ E } be the set of all incoming edges of an operation j . We will first discuss the forward pass through a network and the basic form of a backward pass using checkpointing . The backward pass reverses all computational dependency expressed in our DAG , and induces certain dependencies on forward activations . We call these checkpoint dependencies Dk . They are either saved or recomputed depending on a schedule ( s , r ) . Checkpointing creates a trade-off between computation and memory consumption . To highlight this trade-off , we formally compute the amount of memory consumed in both forward and backward passes , which allows us to optimize for the ideal execution plan in Sec . 4 . We provide a reference to the notations introduced in this section and the next along with their explanations in Appendix A . The Forward Pass . Alg . 1 shows a general overview of the forward pass in a deep network , as implemented in standard deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ; Paszke et al. , 2019 ; Abadi et al. , 2016 ) . The algorithm proceeds in increasing order of index i . Each operator forwardi ( · ) depends on a set of tensors L stored in local memory . These tensors include model parameters Θ , computational dependenciesNi , and tensors stored for later forward operators , i.e . skip or residual activations ( He et al. , 2016 ) . At each iteration , we add any output tensors of forwardi to the local memory L. Early deep learning frameworks ( Jia et al. , 2014 ; Collobert et al. , 2011 ) strictly grew the set of local tensors L leading to an unnecessarily high memory consumption . Modern graph-based frameworks ( Paszke et al. , 2019 ; Abadi et al. , 2016 ) reduce the memory footprint by aggressively pruning local memory L and freeing any tensor that is no longer used in later computations . Some output activations xi are used in the backward pass , and have to be saved for later . We use a checkpointing schedule sN to determine which . Formally , sNi ∈ { 0 , 1 } indicates whether the activation of node i is stored during the forward pass . An activation which is not stored will be recomputed if it is needed during the backward pass . Analyzing peak memory consumption of the forward pass . Only the forwardi operator ( Alg . 1 L. 4 ) allocates memory . All other operators perform mere bookkeeping on existing tensor . It is thus sufficient to study the peak memory consumption mNi in forwardi for each node i . Let Li , S N i be the set of local tensors L and saved tensors S while calling forwardi respectively . Li includes all parameters and computational dependencies for this and later forward passes Li = Θ ∪ { xj : j ∈ Nt for any t ≥ i and j < i } . Li is constant and computed ahead of time . The schedule sN determines the set of saved tensors SNi = { xj : sNj = 1 for j < i } . In addition , each forward operator uses a certain amount of workspace memory ci to store intermediate results . The total memory consumption of a forward operator is thus mi = ci + |xi|+ |SNi ∪ Li| = ci + |xi|+ ∑ xj∈Li |xj |+ ∑ j < i : xj /∈Li |xj |sNj , ( 1 ) where | · | refers to the memory consumed by a tensor or set of tensors . Most of the memory consumption is constant and does not depend on the schedule . The Backward Pass . The backward pass proceeds in a reverse order , as summarized in Alg . 2. backwardk ( · ) of each node k depends on a set of gradient tensors L̂ and forward tensors { xi : i ∈ Dk } . Any gradients required by the current and later backward passes are stored in local memory L̂ . Dependencies Dk may either be stored in Sk or need to be recomputed from checkpoints in Sk . Recomputation involves forward computation of one or more nodes , which increases computational overhead , and allows for a new set of tensors Sk−1 to be saved . After recomputation , all dependencies Dk are kept in memory . The backward operation produces a gradient for each input tensor of the original forward operation , which is added to L̂ if required for a later backward computation . We aggressively remove tensors in L̂ that are not required . Analyzing the peak memory consumption of the backward pass . Peak memory consumption m̂k again only depends on the forwardi ( Alg . 2 L. 7 ) and backwardk ( Alg . 2 L. 12 ) operations . For the backwardk operation , let ĉk be the workspace memory , L̂k be the set of gradient tensors stored , Dk = { xi : i ∈ Dk } be the forward tensors used , and Sk−1 be the set of newly saved tensors . Here L̂k and Dk can be pre-computed . The total memory consumption for the backwardk call is m̂k = ĉk + |yk|+ |Sk−1 ∪ L̂k ∪Dk| = ĉk + |yk|+ ∑ yl∈L̂k |yl|+ ∑ xi∈Dk |xi|+ ∑ xi /∈Dk sk−1i |xi| . ( 2 ) Here again , only the last term depends on the checkpointing schedule , while the rest is a constant . Analyzing the peak memory consumption of the recomputation . Finally , the peak memory m̃ki for the forwardi call ( Alg . 2 L. 7 ) depends on the set of local tensors L , checkpoint dependencies D , saved tensors S , and gradient tensors L̂ , named Lki , Dk , S k−1 i , L̂k respectively . Following the forward pass : m̃ki = ci + |xi|+ |L̂k|+ |Sk−1i ∪ L k i ∪Dk| = ci + |xi|+ |L̂k|+ ∑ j < i : xj /∈Lki ∪Dk sk−1j |xj |+ ∑ j < i : xj∈Lki ∪Dk |xj |+ ∑ j > i skj |xj | . ( 3 ) Unlike the forward pass , Lki is no longer constant , but depends on past saved tensors and future recomputations in ( s , r ) : Lki = Θ ∪ { xj : j ∈ Nt for any t ≥ i with rkt = 1 and j < i } . In the next section , we show how to take this formalization of the forward and backward pass , and find an optimal execution plan including checkpointing schedule ( s , r ) , forwardi implementations , and backwardk implementations , under a fixed memory budget .
Training deep learning models is becoming increasingly challenging due to a memory bottleneck that limits the size of the feature maps that can be stored. The paper presents an automatic framework (MONET) that minimizes the memory footprint for deep networks. The novelty of MONET is that it jointly optimizes over: (a) global compute graph level techniques (such as checkpointing) and (b) local techniques (such as memory-efficient implementations of individual operators). While there are several existing works that focus separately on optimizing global techniques (e.g. the work on “Checkmate”) or local techniques, MONET is the first to jointly optimize over global and local techniques.
SP:9d73791f8959a5303d9ee3cdab9aa6d9b89f8ea7
Generalized Universal Approximation for Certified Networks
To certify safety and robustness of neural networks , researchers have successfully applied abstract interpretation , primarily using interval bound propagation . To understand the power of interval bounds , we present the abstract universal approximation ( AUA ) theorem , a generalization of the recent result by Baader et al . ( 2020 ) for ReLU networks to a large class of neural networks . The AUA theorem states that for any continuous function f , there exists a neural network that ( 1 ) approximates f ( universal approximation ) and ( 2 ) whose interval bounds are an arbitrarily close approximation of the set semantics of f . The network may be constructed using any activation function from a rich class of functions—sigmoid , tanh , ReLU , ELU , etc.—making our result quite general . The key implication of the AUA theorem is that there always exists certifiably robust neural networks , which can be constructed using a wide range of activation functions . 1 INTRODUCTION . With wide adoption of neural networks , new safety and security concerns arose . The most prominent property of study has been robustness ( Goodfellow et al. , 2015 ) : small perturbations to the input of a network should not change the prediction . For example , a small change to an image of a stop sign should not cause a classifier to think it is a speed-limit sign . A number of researchers have proposed the use of abstract interpretation ( Cousot & Cousot , 1977 ) techniques to prove robustness of neural networks ( Gehr et al. , 2018 ; Wang et al. , 2018 ; Anderson et al. , 2019 ) and to train robust models ( Mirman et al. , 2018 ; Gowal et al. , 2018 ; Huang et al. , 2019 ; Wong & Kolter , 2018 ; Wong et al. , 2018 ; Balunovic & Vechev , 2020 ) . Suppose we want to verify robustness of a neural network to small changes in the brightness of an image . We can represent a large set of images , with varying brightness , as an element of some abstract domain , and propagate it through the network , effectively executing the network on an intractably large number of images . If all images lead to the same prediction , then we have a proof that the network is robust on the original image . The simplest abstract interpretation technique that leads to practical verification results is interval analysis—also referred to as interval bound propagation . In our example , if each pixel in a monochrome image is a real number r , then the pixel can be represented as an interval [ r− , r+ ] , where denotes the range of brightness we wish to be robust on . Then , the box representing the interval of each pixel is propagated through the network using interval arithmetic operations . The interval domain has been successfully used for certifying properties of neural networks in vision ( Gehr et al. , 2018 ; Gowal et al. , 2018 ) , NLP ( Huang et al. , 2019 ) , as well as cyber-physical systems ( Wang et al. , 2018 ) . Why does the interval domain work for certifying neural networks ? To begin understanding this question , Baader et al . ( 2020 ) demonstrated a surprising connection between the universal approximation theorem and neural-network certification using interval bounds . Their theorem states that not only can neural networks approximate any continuous function f ( universal approximation ) as we have known for decades , but we can find a neural network , using rectified linear unit ( ReLU ) activation functions , whose interval bounds are an arbitrarily close approximation of the set semantics of f , i.e. , the result of applying f to a set of inputs ( e.g. , set of similar images ) . AUA theorem ( semi-formally ) : For a continuous function f : Rm → R that we wish to approximate and error δ > 0 , there is a neural network N that has the following behavior : Let B ⊂ Rm be a box . The red interval ( top ) is the tightest interval that contains all outputs of f when applied to x ∈ B . If we propagate box B through N using interval bounds , we may get the black interval ( bottom ) N # ( B ) , whose lower/upper bounds are up to δ away from the red interval . 6 δ 6 δ minx∈B f ( x ) maxx∈B f ( x ) N # ( B ) Figure 1 : Semi-formal illustration of AUA theorem . ( Right is adapted from Baader et al . ( 2020 ) . ) The theorem of Baader et al . ( 2020 ) is restricted to networks that use rectified linear units ( ReLU ) . In this work , we present a general universal approximation result for certified networks using a rich class of well-behaved activation functions . Specifically , we make the following contributions . Abstract universal approximation ( AUA ) theorem . We prove what we call the abstract universal approximation theorem , or AUA theorem for short : Let f be the function we wish to approximate , and let δ > 0 be the tolerated error . Then , there exists a neural network N , built using any well-behaved activation function , that has the following behavior : For any box of inputs B , we can certify , using interval bounds , that the range of outputs of N is δ close to the range outputs of f . If the box B of inputs is a single point in Euclidean space , the AUA theorem reduces to the universal approximation theorem ; thus , AUA generalizes universal approximation . Fig . 1 further illustrates the AUA theorem . Existence of robust classifiers . While the AUA theorem is purely theoretical , it sheds light on the existence of certifiable neural networks . Suppose there is some ideal robust image classifier f using the ` ∞ norm , which is typically used to define a set of images in the neighborhood of a given image . The classical universal approximation theorem tells us that , for any desired precision , there is a neural network that can approximate f . We prove that the AUA theorem implies us that there exists a neural network for which we can automatically certify robustness using interval bounds while controlling approximation error . In addition , this neural network can be built using almost any activation function in the literature , and more . Squashable functions . We define a rich class of activation functions , which we call squashable functions , for which our abstract universal approximation theorem holds . This class expands the functions defined by Hornik et al . ( 1989 ) for universal approximation and includes popular activation functions , like ReLU , sigmoid , tanh , ELU , and other activations that have been shown to be useful for training robust neural networks ( Xie et al. , 2020 ) . The key feature of squashable activation functions is that they have left and right limits ( or we can use them to construct functions with limits ) . We exploit limits to approximate step ( sign ) functions , and therefore construct step-like approximations of f , while controlling approximation error δ . Proof of AUA theorem . We present a constructive proof of the AUA theorem . Our construction is inspired by and synthesizes a range of results : ( 1 ) the work of Hornik et al . ( 1989 ) on squashing functions for universal approximation , ( 2 ) the work of Csáji ( 2001 ) for using the sign ( step ) function to construct Haar ( wavelet ) functions , and ( 3 ) the work of Baader et al . ( 2020 ) on the specialized AUA theorem for ReLUs . The key idea of Baader et al . ( 2020 ) is to construct an indicator function for box-shaped regions . We observe that squashable functions can approximate the sign function , and therefore approximate such indicator functions , while carefully controlling precision of abstract interpretation . Our proof uses a simpler indicator construction compared to Baader et al . ( 2020 ) , and as a result its analysis is also simpler . 2 RELATED WORK . The classical universal approximation ( UA ) theorem has been established for decades . In contrast to AUA , UA states that a neural network with one single hidden layer can approximate any continuous function on a compact domain . One of the first versions goes back to Cybenko ( 1989 ) ; Hornik et al . ( 1989 ) , who showed that the standard feed-forward neural network with sigmoidal or squashing activations is a universal approximator . The most general version of UA was discovered by Leshno et al . ( 1993 ) , who showed that the feed-forward neural network is a universal approximator if and only if the activation function is non-polynomial . Because AUA implies UA , this means AUA can not hold beyond non-polynomial activation functions . There are also other variants of UA . Some of them study the expressiveness of neural networks with structural constraints , such as restricted width per layer Lu et al . ( 2017 ) ; Kidger & Lyons ( 2019 ) , or specific neural network architectures Lin & Jegelka ( 2018 ) . Another line of work focuses on specific functions that one wants to approximate rather than arbitrary continuous functions , such as Anil et al . ( 2019 ) ; Cohen et al . ( 2019 ) , who study approximation of Lipschitz functions . Neural-network verification has received a lot of attention in recent years . Most techniques are either based on decision procedures , like SMT solvers Ehlers ( 2017 ) ; Katz et al . ( 2017 ) and integer linear programming ( ILP ) solvers Tjeng et al . ( 2019 ) , or abstract interpretation . The former class can often provide sound and complete verification on neural networks with piecewise-linear operations , like ReLU , but is not scalable due to the complexity of the problem and the size of the networks . Abstract-interpretation-based techniques sacrifice completeness for efficient verification . We have considered the simplest non-trivial numerical domain , intervals , that has been shown to produce strong results , both for robustness verification and adversarial training Gehr et al . ( 2018 ) ; Anderson et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Mirman et al . ( 2018 ) ; Wang et al . ( 2018 ) ; Zhang et al . ( 2020 ) . Researchers have considered richer domains Singh et al . ( 2018 ; 2019 ) , like zonotopes Ghorbal et al . ( 2009 ) and forms of polyhedra Cousot & Halbwachs ( 1978 ) . Since such domains are strictly more precise than intervals , the AUA theorem holds for them . 3 FOUNDATIONS AND SQUASHABLE ACTIVATION FUNCTIONS . 3.1 NEURAL NETWORKS AND SQAUSHABLE ACTIVATIONS . A neural network N is a function in Rm → R. We define a network N following a simple grammar , a composition of primitive arithmetic operations and activation functions . Definition 3.1 ( Neural network grammar ) . Let x ∈ Rm be the input to the neural network . A neural network N is defined using the following grammar : N = c | xi | N1 +N2 | c ∗N1 | t ( N1 ) , where c ∈ R , xi is the ith element of x , and t : R→ R is an activation function . We will always fix a single activation function t to be used in the grammar . We now present a general class of activation functions that we will call squashable activation functions . Fig . 2 shows some examples . Definition 3.2 ( Squashable functions ) . t : R→ R is squashable iff ( 1 ) there is a < b ∈ R such that lim x→−∞ t ( x ) = a , lim x→∞ t ( x ) = b , and ∀x < y. t ( x ) 6 t ( y ) ( 1 ) or ( 2 ) we can construct a function t′ that satisfies Eq . ( 1 ) as affine transformations and function compositions of copies of t , i.e. , following the grammar in Def . 3.1 . E.g. , t′ ( x ) = t ( 1− t ( x ) ) . Informally , an activation function is in this class if we can use it to construct a monotonically increasing function that has limits in the left and right directions , −∞ and∞.1 Squashable activation 1In our construction and proof , we do not need the function to be monotonic ; however , in practice , most activation functions are monotonic and abstractly interpreting arbitrary functions is impractical . functions extend the squashing functions used by Hornik et al . ( 1989 ) . All of the activation functions in Fig . 2 are squashable . Fig . 2 ( top ) shows activation functions that satisfy Eq . ( 1 ) , and are therefore squashable . For example , sigmoid and tanh easily satisfy Eq . ( 1 ) : both have limits and are monotonically increasing . What about activation functions like ReLU , ELU , softplus , etc. , shown in Fig . 2 ( bottom ) ? It is easy to see that they do not satisfy Eq . ( 1 ) : none of them have a right limit . However , by point ( 2 ) of Def . 3.2 , given an activation function t , if we can construct a new activation function t′ that satisfies Eq . ( 1 ) , using the operations in the grammar in Def . 3.1 , then t is squashable . We give a general and simple construction that works for all activation functions in Fig . 2 ( bottom ) . Proposition 3.3 . Let t ∈ { ReLU , softplus , smoothReLUa , ELU } . The function t′ ( x ) = t ( 1 − t ( −x ) ) satisfies Eq . ( 1 ) . Therefore , ReLU , softplus , Smooth ReLU , and ELU , are squashable . Example 3.4 . Fig . 3 shows t ( 1 − t ( −x ) ) , for t = ReLU and t = softplus . Both have left/right limits and are monotonic . Thus , they satisfy Eq . ( 1 ) and therefore ReLU and softplus are squashable .
This paper proposes to extend the techniques of Baader et al. [2020], demonstrating that interval analysis provable ReLU networks are universal approximators, to a larger class of activation functions, which they call squashable functions. Furthermore, they claim that their proof of this theorem is simpler due to using a bounded depth construction.
SP:8887faab7d4c3fc72d031bca7281683261833706
Generalized Universal Approximation for Certified Networks
To certify safety and robustness of neural networks , researchers have successfully applied abstract interpretation , primarily using interval bound propagation . To understand the power of interval bounds , we present the abstract universal approximation ( AUA ) theorem , a generalization of the recent result by Baader et al . ( 2020 ) for ReLU networks to a large class of neural networks . The AUA theorem states that for any continuous function f , there exists a neural network that ( 1 ) approximates f ( universal approximation ) and ( 2 ) whose interval bounds are an arbitrarily close approximation of the set semantics of f . The network may be constructed using any activation function from a rich class of functions—sigmoid , tanh , ReLU , ELU , etc.—making our result quite general . The key implication of the AUA theorem is that there always exists certifiably robust neural networks , which can be constructed using a wide range of activation functions . 1 INTRODUCTION . With wide adoption of neural networks , new safety and security concerns arose . The most prominent property of study has been robustness ( Goodfellow et al. , 2015 ) : small perturbations to the input of a network should not change the prediction . For example , a small change to an image of a stop sign should not cause a classifier to think it is a speed-limit sign . A number of researchers have proposed the use of abstract interpretation ( Cousot & Cousot , 1977 ) techniques to prove robustness of neural networks ( Gehr et al. , 2018 ; Wang et al. , 2018 ; Anderson et al. , 2019 ) and to train robust models ( Mirman et al. , 2018 ; Gowal et al. , 2018 ; Huang et al. , 2019 ; Wong & Kolter , 2018 ; Wong et al. , 2018 ; Balunovic & Vechev , 2020 ) . Suppose we want to verify robustness of a neural network to small changes in the brightness of an image . We can represent a large set of images , with varying brightness , as an element of some abstract domain , and propagate it through the network , effectively executing the network on an intractably large number of images . If all images lead to the same prediction , then we have a proof that the network is robust on the original image . The simplest abstract interpretation technique that leads to practical verification results is interval analysis—also referred to as interval bound propagation . In our example , if each pixel in a monochrome image is a real number r , then the pixel can be represented as an interval [ r− , r+ ] , where denotes the range of brightness we wish to be robust on . Then , the box representing the interval of each pixel is propagated through the network using interval arithmetic operations . The interval domain has been successfully used for certifying properties of neural networks in vision ( Gehr et al. , 2018 ; Gowal et al. , 2018 ) , NLP ( Huang et al. , 2019 ) , as well as cyber-physical systems ( Wang et al. , 2018 ) . Why does the interval domain work for certifying neural networks ? To begin understanding this question , Baader et al . ( 2020 ) demonstrated a surprising connection between the universal approximation theorem and neural-network certification using interval bounds . Their theorem states that not only can neural networks approximate any continuous function f ( universal approximation ) as we have known for decades , but we can find a neural network , using rectified linear unit ( ReLU ) activation functions , whose interval bounds are an arbitrarily close approximation of the set semantics of f , i.e. , the result of applying f to a set of inputs ( e.g. , set of similar images ) . AUA theorem ( semi-formally ) : For a continuous function f : Rm → R that we wish to approximate and error δ > 0 , there is a neural network N that has the following behavior : Let B ⊂ Rm be a box . The red interval ( top ) is the tightest interval that contains all outputs of f when applied to x ∈ B . If we propagate box B through N using interval bounds , we may get the black interval ( bottom ) N # ( B ) , whose lower/upper bounds are up to δ away from the red interval . 6 δ 6 δ minx∈B f ( x ) maxx∈B f ( x ) N # ( B ) Figure 1 : Semi-formal illustration of AUA theorem . ( Right is adapted from Baader et al . ( 2020 ) . ) The theorem of Baader et al . ( 2020 ) is restricted to networks that use rectified linear units ( ReLU ) . In this work , we present a general universal approximation result for certified networks using a rich class of well-behaved activation functions . Specifically , we make the following contributions . Abstract universal approximation ( AUA ) theorem . We prove what we call the abstract universal approximation theorem , or AUA theorem for short : Let f be the function we wish to approximate , and let δ > 0 be the tolerated error . Then , there exists a neural network N , built using any well-behaved activation function , that has the following behavior : For any box of inputs B , we can certify , using interval bounds , that the range of outputs of N is δ close to the range outputs of f . If the box B of inputs is a single point in Euclidean space , the AUA theorem reduces to the universal approximation theorem ; thus , AUA generalizes universal approximation . Fig . 1 further illustrates the AUA theorem . Existence of robust classifiers . While the AUA theorem is purely theoretical , it sheds light on the existence of certifiable neural networks . Suppose there is some ideal robust image classifier f using the ` ∞ norm , which is typically used to define a set of images in the neighborhood of a given image . The classical universal approximation theorem tells us that , for any desired precision , there is a neural network that can approximate f . We prove that the AUA theorem implies us that there exists a neural network for which we can automatically certify robustness using interval bounds while controlling approximation error . In addition , this neural network can be built using almost any activation function in the literature , and more . Squashable functions . We define a rich class of activation functions , which we call squashable functions , for which our abstract universal approximation theorem holds . This class expands the functions defined by Hornik et al . ( 1989 ) for universal approximation and includes popular activation functions , like ReLU , sigmoid , tanh , ELU , and other activations that have been shown to be useful for training robust neural networks ( Xie et al. , 2020 ) . The key feature of squashable activation functions is that they have left and right limits ( or we can use them to construct functions with limits ) . We exploit limits to approximate step ( sign ) functions , and therefore construct step-like approximations of f , while controlling approximation error δ . Proof of AUA theorem . We present a constructive proof of the AUA theorem . Our construction is inspired by and synthesizes a range of results : ( 1 ) the work of Hornik et al . ( 1989 ) on squashing functions for universal approximation , ( 2 ) the work of Csáji ( 2001 ) for using the sign ( step ) function to construct Haar ( wavelet ) functions , and ( 3 ) the work of Baader et al . ( 2020 ) on the specialized AUA theorem for ReLUs . The key idea of Baader et al . ( 2020 ) is to construct an indicator function for box-shaped regions . We observe that squashable functions can approximate the sign function , and therefore approximate such indicator functions , while carefully controlling precision of abstract interpretation . Our proof uses a simpler indicator construction compared to Baader et al . ( 2020 ) , and as a result its analysis is also simpler . 2 RELATED WORK . The classical universal approximation ( UA ) theorem has been established for decades . In contrast to AUA , UA states that a neural network with one single hidden layer can approximate any continuous function on a compact domain . One of the first versions goes back to Cybenko ( 1989 ) ; Hornik et al . ( 1989 ) , who showed that the standard feed-forward neural network with sigmoidal or squashing activations is a universal approximator . The most general version of UA was discovered by Leshno et al . ( 1993 ) , who showed that the feed-forward neural network is a universal approximator if and only if the activation function is non-polynomial . Because AUA implies UA , this means AUA can not hold beyond non-polynomial activation functions . There are also other variants of UA . Some of them study the expressiveness of neural networks with structural constraints , such as restricted width per layer Lu et al . ( 2017 ) ; Kidger & Lyons ( 2019 ) , or specific neural network architectures Lin & Jegelka ( 2018 ) . Another line of work focuses on specific functions that one wants to approximate rather than arbitrary continuous functions , such as Anil et al . ( 2019 ) ; Cohen et al . ( 2019 ) , who study approximation of Lipschitz functions . Neural-network verification has received a lot of attention in recent years . Most techniques are either based on decision procedures , like SMT solvers Ehlers ( 2017 ) ; Katz et al . ( 2017 ) and integer linear programming ( ILP ) solvers Tjeng et al . ( 2019 ) , or abstract interpretation . The former class can often provide sound and complete verification on neural networks with piecewise-linear operations , like ReLU , but is not scalable due to the complexity of the problem and the size of the networks . Abstract-interpretation-based techniques sacrifice completeness for efficient verification . We have considered the simplest non-trivial numerical domain , intervals , that has been shown to produce strong results , both for robustness verification and adversarial training Gehr et al . ( 2018 ) ; Anderson et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Mirman et al . ( 2018 ) ; Wang et al . ( 2018 ) ; Zhang et al . ( 2020 ) . Researchers have considered richer domains Singh et al . ( 2018 ; 2019 ) , like zonotopes Ghorbal et al . ( 2009 ) and forms of polyhedra Cousot & Halbwachs ( 1978 ) . Since such domains are strictly more precise than intervals , the AUA theorem holds for them . 3 FOUNDATIONS AND SQUASHABLE ACTIVATION FUNCTIONS . 3.1 NEURAL NETWORKS AND SQAUSHABLE ACTIVATIONS . A neural network N is a function in Rm → R. We define a network N following a simple grammar , a composition of primitive arithmetic operations and activation functions . Definition 3.1 ( Neural network grammar ) . Let x ∈ Rm be the input to the neural network . A neural network N is defined using the following grammar : N = c | xi | N1 +N2 | c ∗N1 | t ( N1 ) , where c ∈ R , xi is the ith element of x , and t : R→ R is an activation function . We will always fix a single activation function t to be used in the grammar . We now present a general class of activation functions that we will call squashable activation functions . Fig . 2 shows some examples . Definition 3.2 ( Squashable functions ) . t : R→ R is squashable iff ( 1 ) there is a < b ∈ R such that lim x→−∞ t ( x ) = a , lim x→∞ t ( x ) = b , and ∀x < y. t ( x ) 6 t ( y ) ( 1 ) or ( 2 ) we can construct a function t′ that satisfies Eq . ( 1 ) as affine transformations and function compositions of copies of t , i.e. , following the grammar in Def . 3.1 . E.g. , t′ ( x ) = t ( 1− t ( x ) ) . Informally , an activation function is in this class if we can use it to construct a monotonically increasing function that has limits in the left and right directions , −∞ and∞.1 Squashable activation 1In our construction and proof , we do not need the function to be monotonic ; however , in practice , most activation functions are monotonic and abstractly interpreting arbitrary functions is impractical . functions extend the squashing functions used by Hornik et al . ( 1989 ) . All of the activation functions in Fig . 2 are squashable . Fig . 2 ( top ) shows activation functions that satisfy Eq . ( 1 ) , and are therefore squashable . For example , sigmoid and tanh easily satisfy Eq . ( 1 ) : both have limits and are monotonically increasing . What about activation functions like ReLU , ELU , softplus , etc. , shown in Fig . 2 ( bottom ) ? It is easy to see that they do not satisfy Eq . ( 1 ) : none of them have a right limit . However , by point ( 2 ) of Def . 3.2 , given an activation function t , if we can construct a new activation function t′ that satisfies Eq . ( 1 ) , using the operations in the grammar in Def . 3.1 , then t is squashable . We give a general and simple construction that works for all activation functions in Fig . 2 ( bottom ) . Proposition 3.3 . Let t ∈ { ReLU , softplus , smoothReLUa , ELU } . The function t′ ( x ) = t ( 1 − t ( −x ) ) satisfies Eq . ( 1 ) . Therefore , ReLU , softplus , Smooth ReLU , and ELU , are squashable . Example 3.4 . Fig . 3 shows t ( 1 − t ( −x ) ) , for t = ReLU and t = softplus . Both have left/right limits and are monotonic . Thus , they satisfy Eq . ( 1 ) and therefore ReLU and softplus are squashable .
The paper shows an "augmented" universal approximation (UA) result for neural networks that the authors call Abstract UA (AUA for short) and the motivation comes from understanding expressivity and certifiability of NN. Their result holds for NN with a wide variety of activation units and this is the main point of the paper, which directly extends the same result for ReLU networks (Baader et al. 2020).
SP:8887faab7d4c3fc72d031bca7281683261833706
Generalized Universal Approximation for Certified Networks
To certify safety and robustness of neural networks , researchers have successfully applied abstract interpretation , primarily using interval bound propagation . To understand the power of interval bounds , we present the abstract universal approximation ( AUA ) theorem , a generalization of the recent result by Baader et al . ( 2020 ) for ReLU networks to a large class of neural networks . The AUA theorem states that for any continuous function f , there exists a neural network that ( 1 ) approximates f ( universal approximation ) and ( 2 ) whose interval bounds are an arbitrarily close approximation of the set semantics of f . The network may be constructed using any activation function from a rich class of functions—sigmoid , tanh , ReLU , ELU , etc.—making our result quite general . The key implication of the AUA theorem is that there always exists certifiably robust neural networks , which can be constructed using a wide range of activation functions . 1 INTRODUCTION . With wide adoption of neural networks , new safety and security concerns arose . The most prominent property of study has been robustness ( Goodfellow et al. , 2015 ) : small perturbations to the input of a network should not change the prediction . For example , a small change to an image of a stop sign should not cause a classifier to think it is a speed-limit sign . A number of researchers have proposed the use of abstract interpretation ( Cousot & Cousot , 1977 ) techniques to prove robustness of neural networks ( Gehr et al. , 2018 ; Wang et al. , 2018 ; Anderson et al. , 2019 ) and to train robust models ( Mirman et al. , 2018 ; Gowal et al. , 2018 ; Huang et al. , 2019 ; Wong & Kolter , 2018 ; Wong et al. , 2018 ; Balunovic & Vechev , 2020 ) . Suppose we want to verify robustness of a neural network to small changes in the brightness of an image . We can represent a large set of images , with varying brightness , as an element of some abstract domain , and propagate it through the network , effectively executing the network on an intractably large number of images . If all images lead to the same prediction , then we have a proof that the network is robust on the original image . The simplest abstract interpretation technique that leads to practical verification results is interval analysis—also referred to as interval bound propagation . In our example , if each pixel in a monochrome image is a real number r , then the pixel can be represented as an interval [ r− , r+ ] , where denotes the range of brightness we wish to be robust on . Then , the box representing the interval of each pixel is propagated through the network using interval arithmetic operations . The interval domain has been successfully used for certifying properties of neural networks in vision ( Gehr et al. , 2018 ; Gowal et al. , 2018 ) , NLP ( Huang et al. , 2019 ) , as well as cyber-physical systems ( Wang et al. , 2018 ) . Why does the interval domain work for certifying neural networks ? To begin understanding this question , Baader et al . ( 2020 ) demonstrated a surprising connection between the universal approximation theorem and neural-network certification using interval bounds . Their theorem states that not only can neural networks approximate any continuous function f ( universal approximation ) as we have known for decades , but we can find a neural network , using rectified linear unit ( ReLU ) activation functions , whose interval bounds are an arbitrarily close approximation of the set semantics of f , i.e. , the result of applying f to a set of inputs ( e.g. , set of similar images ) . AUA theorem ( semi-formally ) : For a continuous function f : Rm → R that we wish to approximate and error δ > 0 , there is a neural network N that has the following behavior : Let B ⊂ Rm be a box . The red interval ( top ) is the tightest interval that contains all outputs of f when applied to x ∈ B . If we propagate box B through N using interval bounds , we may get the black interval ( bottom ) N # ( B ) , whose lower/upper bounds are up to δ away from the red interval . 6 δ 6 δ minx∈B f ( x ) maxx∈B f ( x ) N # ( B ) Figure 1 : Semi-formal illustration of AUA theorem . ( Right is adapted from Baader et al . ( 2020 ) . ) The theorem of Baader et al . ( 2020 ) is restricted to networks that use rectified linear units ( ReLU ) . In this work , we present a general universal approximation result for certified networks using a rich class of well-behaved activation functions . Specifically , we make the following contributions . Abstract universal approximation ( AUA ) theorem . We prove what we call the abstract universal approximation theorem , or AUA theorem for short : Let f be the function we wish to approximate , and let δ > 0 be the tolerated error . Then , there exists a neural network N , built using any well-behaved activation function , that has the following behavior : For any box of inputs B , we can certify , using interval bounds , that the range of outputs of N is δ close to the range outputs of f . If the box B of inputs is a single point in Euclidean space , the AUA theorem reduces to the universal approximation theorem ; thus , AUA generalizes universal approximation . Fig . 1 further illustrates the AUA theorem . Existence of robust classifiers . While the AUA theorem is purely theoretical , it sheds light on the existence of certifiable neural networks . Suppose there is some ideal robust image classifier f using the ` ∞ norm , which is typically used to define a set of images in the neighborhood of a given image . The classical universal approximation theorem tells us that , for any desired precision , there is a neural network that can approximate f . We prove that the AUA theorem implies us that there exists a neural network for which we can automatically certify robustness using interval bounds while controlling approximation error . In addition , this neural network can be built using almost any activation function in the literature , and more . Squashable functions . We define a rich class of activation functions , which we call squashable functions , for which our abstract universal approximation theorem holds . This class expands the functions defined by Hornik et al . ( 1989 ) for universal approximation and includes popular activation functions , like ReLU , sigmoid , tanh , ELU , and other activations that have been shown to be useful for training robust neural networks ( Xie et al. , 2020 ) . The key feature of squashable activation functions is that they have left and right limits ( or we can use them to construct functions with limits ) . We exploit limits to approximate step ( sign ) functions , and therefore construct step-like approximations of f , while controlling approximation error δ . Proof of AUA theorem . We present a constructive proof of the AUA theorem . Our construction is inspired by and synthesizes a range of results : ( 1 ) the work of Hornik et al . ( 1989 ) on squashing functions for universal approximation , ( 2 ) the work of Csáji ( 2001 ) for using the sign ( step ) function to construct Haar ( wavelet ) functions , and ( 3 ) the work of Baader et al . ( 2020 ) on the specialized AUA theorem for ReLUs . The key idea of Baader et al . ( 2020 ) is to construct an indicator function for box-shaped regions . We observe that squashable functions can approximate the sign function , and therefore approximate such indicator functions , while carefully controlling precision of abstract interpretation . Our proof uses a simpler indicator construction compared to Baader et al . ( 2020 ) , and as a result its analysis is also simpler . 2 RELATED WORK . The classical universal approximation ( UA ) theorem has been established for decades . In contrast to AUA , UA states that a neural network with one single hidden layer can approximate any continuous function on a compact domain . One of the first versions goes back to Cybenko ( 1989 ) ; Hornik et al . ( 1989 ) , who showed that the standard feed-forward neural network with sigmoidal or squashing activations is a universal approximator . The most general version of UA was discovered by Leshno et al . ( 1993 ) , who showed that the feed-forward neural network is a universal approximator if and only if the activation function is non-polynomial . Because AUA implies UA , this means AUA can not hold beyond non-polynomial activation functions . There are also other variants of UA . Some of them study the expressiveness of neural networks with structural constraints , such as restricted width per layer Lu et al . ( 2017 ) ; Kidger & Lyons ( 2019 ) , or specific neural network architectures Lin & Jegelka ( 2018 ) . Another line of work focuses on specific functions that one wants to approximate rather than arbitrary continuous functions , such as Anil et al . ( 2019 ) ; Cohen et al . ( 2019 ) , who study approximation of Lipschitz functions . Neural-network verification has received a lot of attention in recent years . Most techniques are either based on decision procedures , like SMT solvers Ehlers ( 2017 ) ; Katz et al . ( 2017 ) and integer linear programming ( ILP ) solvers Tjeng et al . ( 2019 ) , or abstract interpretation . The former class can often provide sound and complete verification on neural networks with piecewise-linear operations , like ReLU , but is not scalable due to the complexity of the problem and the size of the networks . Abstract-interpretation-based techniques sacrifice completeness for efficient verification . We have considered the simplest non-trivial numerical domain , intervals , that has been shown to produce strong results , both for robustness verification and adversarial training Gehr et al . ( 2018 ) ; Anderson et al . ( 2019 ) ; Huang et al . ( 2019 ) ; Mirman et al . ( 2018 ) ; Wang et al . ( 2018 ) ; Zhang et al . ( 2020 ) . Researchers have considered richer domains Singh et al . ( 2018 ; 2019 ) , like zonotopes Ghorbal et al . ( 2009 ) and forms of polyhedra Cousot & Halbwachs ( 1978 ) . Since such domains are strictly more precise than intervals , the AUA theorem holds for them . 3 FOUNDATIONS AND SQUASHABLE ACTIVATION FUNCTIONS . 3.1 NEURAL NETWORKS AND SQAUSHABLE ACTIVATIONS . A neural network N is a function in Rm → R. We define a network N following a simple grammar , a composition of primitive arithmetic operations and activation functions . Definition 3.1 ( Neural network grammar ) . Let x ∈ Rm be the input to the neural network . A neural network N is defined using the following grammar : N = c | xi | N1 +N2 | c ∗N1 | t ( N1 ) , where c ∈ R , xi is the ith element of x , and t : R→ R is an activation function . We will always fix a single activation function t to be used in the grammar . We now present a general class of activation functions that we will call squashable activation functions . Fig . 2 shows some examples . Definition 3.2 ( Squashable functions ) . t : R→ R is squashable iff ( 1 ) there is a < b ∈ R such that lim x→−∞ t ( x ) = a , lim x→∞ t ( x ) = b , and ∀x < y. t ( x ) 6 t ( y ) ( 1 ) or ( 2 ) we can construct a function t′ that satisfies Eq . ( 1 ) as affine transformations and function compositions of copies of t , i.e. , following the grammar in Def . 3.1 . E.g. , t′ ( x ) = t ( 1− t ( x ) ) . Informally , an activation function is in this class if we can use it to construct a monotonically increasing function that has limits in the left and right directions , −∞ and∞.1 Squashable activation 1In our construction and proof , we do not need the function to be monotonic ; however , in practice , most activation functions are monotonic and abstractly interpreting arbitrary functions is impractical . functions extend the squashing functions used by Hornik et al . ( 1989 ) . All of the activation functions in Fig . 2 are squashable . Fig . 2 ( top ) shows activation functions that satisfy Eq . ( 1 ) , and are therefore squashable . For example , sigmoid and tanh easily satisfy Eq . ( 1 ) : both have limits and are monotonically increasing . What about activation functions like ReLU , ELU , softplus , etc. , shown in Fig . 2 ( bottom ) ? It is easy to see that they do not satisfy Eq . ( 1 ) : none of them have a right limit . However , by point ( 2 ) of Def . 3.2 , given an activation function t , if we can construct a new activation function t′ that satisfies Eq . ( 1 ) , using the operations in the grammar in Def . 3.1 , then t is squashable . We give a general and simple construction that works for all activation functions in Fig . 2 ( bottom ) . Proposition 3.3 . Let t ∈ { ReLU , softplus , smoothReLUa , ELU } . The function t′ ( x ) = t ( 1 − t ( −x ) ) satisfies Eq . ( 1 ) . Therefore , ReLU , softplus , Smooth ReLU , and ELU , are squashable . Example 3.4 . Fig . 3 shows t ( 1 − t ( −x ) ) , for t = ReLU and t = softplus . Both have left/right limits and are monotonic . Thus , they satisfy Eq . ( 1 ) and therefore ReLU and softplus are squashable .
This paper studies the universal approximation of robust networks called the abstract universal approximation. While the traditional universal approximation aims to approximate the single output corresponding to each input value, abstract universal approximation studies the output interval generated by the input interval (or box) and the interval value propagation. The main contribution of the paper is to extend the result of Baader et al., 2020 to networks using general squashable activation functions.
SP:8887faab7d4c3fc72d031bca7281683261833706
A Deeper Look at Discounting Mismatch in Actor-Critic Algorithms
1 INTRODUCTION . Actor-critic algorithms have enjoyed great success both theoretically ( Williams , 1992 ; Sutton et al. , 2000 ; Konda , 2002 ; Schulman et al. , 2015a ) and empirically ( Mnih et al. , 2016 ; Silver et al. , 2016 ; Schulman et al. , 2017 ; OpenAI , 2018 ) . There is , however , a longstanding gap between the theory behind actor-critic algorithms and how practitioners implement them . Let γ , γA , and γC be the discount factors for defining the objective , updating the actor , and updating the critic respectively . Theoretically , no matter whether γ = 1 or γ < 1 , we should always use γA = γC = γ ( Sutton et al. , 2000 ; Schulman et al. , 2015a ) or at least keep γA = γC if Blackwell optimality ( Veinott , 1969 ; Weitzman , 2001 ) 1 is considered . Practitioners , however , usually use γA = 1 and γC < 1 in their implementations ( Dhariwal et al. , 2017 ; Caspi et al. , 2017 ; Zhang , 2018 ; Kostrikov , 2018 ; Achiam , 2018 ; Liang et al. , 2018 ; Stooke & Abbeel , 2019 ) . Although this mismatch and its theoretical disadvantage have been recognized by Thomas ( 2014 ) ; Nota & Thomas ( 2020 ) , whether and why it yields benefits in practice has not been systematically studied . In this paper , we empirically investigate this mismatch from a representation learning perspective . We consider two scenarios separately . Scenario 1 : The true objective is undiscounted ( γ = 1 ) . The theory prescribes to use γA = γC = γ = 1 . Practitioners , however , usually use γA = γ = 1 but γC < 1 , introducing bias . We explain this mismatch with the following hypothesis : Hypothesis 1. γC < 1 optimizes a bias-variance-representation trade-off . It is easy to see that γC < 1 reduces the variance in bootstrapping targets . Besides this , we further provide empirical evidence showing that when γC < 1 , it may become easier to find a good representation compared to γC = 1 . Consequently , although using γC < 1 introduces bias , it can facilitate representation learning . For our empirical study , we make use of recently introduced techniques , such fixed horizon temporal different learning ( De Asis et al. , 2019 ) and distributional reinforcement learning ( Bellemare et al. , 2017 ) to disentangle the various effects the discount factor has on the learning process . Scenario 2 : The true objective function is discounted ( γ < 1 ) . Theoretically , there is a γt term for the actor update on a transition observed at time t in a trajectory ( Sutton et al. , 2000 ; Schulman 1Blackwell optimality states that , in finite MDPs , there exists a γ0 < 1 such that for all γ ≥ γ0 , the optimal policies for the γ-discounted objective are the same . et al. , 2015a ) . Practitioners , however , usually ignore this term while using a discounted critic , i.e. , γA = 1 and γC = γ < 1 are used . We explain this mismatch with the following hypothesis : Hypothesis 2 . Using γC = γ < 1 and γA = 1 is effectively similar to using γC = γA = γ < 1 plus an auxiliary loss that sometimes facilitates representation learning . Our empirical study involves implementing the auxiliary task explicitly by using an additional policy for optimizing the difference term between the loss of γA = 1 and the loss of γA < 1 . We also design new benchmarking environments where the sign of the reward function is flipped after a certain time step such that later transitions differ from earlier ones . In that setting , γA = 1 becomes harmful . 2 BACKGROUND Markov Decision Processes : We consider an infinite horizon MDP with a finite state space S , a finite action spaceA , a bounded reward function r : S → R , a transition kernel p : S × S × A → [ 0 , 1 ] , an initial state distribution µ0 , and a discount factor γ ∈ [ 0 , 1 ] .2 The initial state S0 is sampled from µ0 . At time step t , an agent in state St takes action At ∼ π ( ·|St ) , where π : A×S → [ 0 , 1 ] is the policy it follows . The agent then gets a reward Rt+1 . = r ( St ) and proceeds to the next state St+1 ∼ p ( ·|St , At ) . The return of the policy π at time step t is defined as Gt . = ∑∞ i=1 γ i−1Rt+i , which allows us to define the state value function vγπ ( S ) . = E [ Gt|St = s ] and the state-action value function qγπ ( s , a ) . = E [ Gt|St = s , At = a ] . We consider episodic tasks where we assume there is an absorbing state s∞ ∈ S such that r ( s∞ ) = 0 and p ( s∞|s∞ , a ) = 1 holds for any a ∈ A . When γ < 1 , vγπ and qγπ are always well defined . When γ = 1 , to ensure v γ π and q γ π are well defined , we further assume finite expected episode length . Let Tπs be a random variable denoting the first time step that an agent hits s∞ when following π given S0 = s. We assume Tmax . = supπ∈Π maxs E [ Tπs ] < ∞ , where π is parameterized by θ and Π is the corresponding function class . Similar assumptions are also used in stochastic shortest path problems ( e.g. , Section 2.2 of Bertsekas & Tsitsiklis ( 1996 ) ) . In our experiments , all the environments have a hard time limit of 1000 , i.e. , Tmax = 1000 . This is standard practice , classic RL environments also have an upper limit on their episode lengths ( e.g . 27k in Bellemare et al . ( 2013 , ALE ) ) . Following Pardo et al . ( 2018 ) , we add the ( normalized ) time step t in the state to keep the environment Markovian . We measure the performance of a policy π with Jγ ( π ) . = ES0∼µ0 [ vγπ ( S0 ) ] . Vanilla Policy Gradient : Sutton et al . ( 2000 ) compute∇θJγ ( π ) as ∇θJγ ( π ) . = ∑ s d γ π ( s ) ∑ a q γ π ( s , a ) ∇θπ ( a|s ) , ( 1 ) where dγπ ( s ) . = ∑∞ t=0 γ t Pr ( St = s|µ0 , p , π ) for γ < 1 and dγπ ( s ) . = E [ ∑TπS0 t=0 Pr ( St = s|S0 , p , π ) ] for γ = 1.3 Note dγπ remains well-defined for γ = 1 when Tmax < ∞ . In order to optimize the policy performance Jγ ( π ) , one can follow ( 1 ) and , at time step t , update θt as θt+1 ← θt + αγtAqγCπ ( St , At ) ∇θ log π ( At|St ) , ( 2 ) where α is a learning rate . If we replace qγCπ with a learned value function , the update rule ( 2 ) becomes an actor-critic algorithm , where the actor refers to π and the critic refers to the learned approximation of qγCπ . In practice , an estimate for v γC π instead of q γC π is usually learned . Theoretically , we should have γA = γC = γ . Practitioners , however , usually ignore the γtA term in ( 2 ) , and use γC < γA = 1 . What this update truly optimizes remains an open problem ( Nota & Thomas , 2020 ) . TRPO and PPO : To improve the stability of actor-critic algorithms , Schulman et al . ( 2015a ) propose Trust Region Policy Optimization ( TRPO ) , based on the performance improvement lemma : Lemma 1 . ( Theorem 1 in Schulman et al . ( 2015a ) ) For γ < 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Adv γ π ( s , a ) |γ ( π , π ′ ) ( 1−γ ) 2 , 2Following Schulman et al . ( 2015a ) , we consider r : S → R instead of r : S ×A → R for simplicity . 3Sutton et al . ( 2000 ) do not explicitly define dγπ when γ = 1 , which , however , can be easily deduced from Chapter 13.2 in Sutton & Barto ( 2018 ) . where Advγπ ( s , a ) . = Es′∼p ( ·|s , a ) [ r ( s ) + γvγπ ( s′ ) − vγπ ( s ) ] is the advantage , ( π , π′ ) . = maxsDKL ( π ( ·|s ) ||π′ ( ·|s ) ) , and DKL refers to the KL divergence . To facilitate our empirical study , we first make a theoretical contribution by extending Lemma 1 to the undiscounted setting . We have the following lemma : Lemma 2 . Assuming Tmax < ∞ , for γ = 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Advγπ ( s , a ) |T 2max ( π , π′ ) . The proof of Lemma 2 is provided in the appendix . A practical implementation of Lemmas 1 and 2 is to compute a new policy θ via gradient ascent on the clipped objective : L ( θ ) . = ∑∞ t=0 γ t A min { πθ ( At|St ) πθold ( At|St ) AdvγCπθold ( St , At ) , clip ( πθ ( At|St ) πθold ( At|St ) ) AdvγCπθold ( St , At ) } , ( 3 ) where St and At are sampled from πθold , and clip ( x ) . = max ( min ( x , 1 + ) , 1 − ) with a hyperparameter . Theoretically , we should have γA = γC , but practical algorithms like Proximal Policy Optimization ( Schulman et al. , 2017 , PPO ) usually use γC < γA = 1 . Policy Evaluation : We now introduce several policy evaluation techniques we use in our empirical study . Let v̂ be our estimate of vγπ . At time step t , Temporal Difference learning ( TD , Sutton ( 1988 ) ) updates v̂ as v̂ ( St ) ← v̂ ( St ) +α ( Rt+1 + γv̂ ( St+1 ) − v̂ ( St ) ) . Instead of the infinite horizon discounted returnGt , De Asis et al . ( 2019 ) propose to consider theH-step returnGHt . = ∑H i=1Rt+i . Correspondingly , the H-step value function is defined as vHπ ( s ) . = E [ GHt |St = s ] . We let v̂H be our estimate of vHπ . At time step t , De Asis et al . ( 2019 ) use the following update rule to learn v̂ H : v̂i ( St ) ← v̂i ( St ) + α ( Rt+1 + v̂i−1 ( St+1 ) − v̂i ( St ) ) ( i = 1 , . . . H ) , ( 4 ) where v̂0 ( s ) .= 0 . In other words , to learn v̂H , we need to learn { v̂i } i=1 , ... , H simultaneously . De Asis et al . ( 2019 ) call ( 4 ) Fixed Horizon Temporal Difference learning ( FHTD ) . As Gt is a random variable , Bellemare et al . ( 2017 ) propose to learn its full distribution instead of its expectation only , yielding the Distributional Reinforcement Learning ( RL ) paradigm . They use a categorical distribution with 51 atoms uniformly distributed in [ −Vmax , Vmax ] to approximate the distribution of Gt , where Vmax is a hyperparameter . In this paper , we refer to the corresponding policy evaluation algorithm as C51 . Methodology : We consider MuJoCo robot simulation tasks from OpenAI gym ( Brockman et al. , 2016 ) as our benchmark . Given its popularity in understanding deep RL algorithms ( Henderson et al. , 2017 ; Ilyas et al. , 2018 ; Engstrom et al. , 2019 ; Andrychowicz et al. , 2020 ) and designing new deep RL algorithms ( Fujimoto et al. , 2018 ; Haarnoja et al. , 2018 ) , we believe our empirical results are relevant to most practitioners . We choose PPO , a simple yet effective and widely used algorithm , as the representative actor-critic algorithm for our empirical study . PPO is usually equipped with generalized advantage estimation ( Schulman et al. , 2015b , GAE ) , which has a tunable hyperparameter γ̂ . The roles of γ and γ̂ are similar . To reduce its confounding effect , we do not use GAE in our experiments , i.e. , the advantage estimation for our actor is simply the TD errorRt+1 +γCv̂ ( St+1 ) − v̂ ( St ) . The PPO pseudocode we follow is provided in Alg . 1 in the appendix and we refer to it as the default PPO implementation . We use the standard architecture and optimizer across all tasks , in particular , the actor and the critic do not share layers . We conduct a thorough learning rate search in Ant for each algorithmic configuration ( i.e. , a curve in a figure ) and then use the same learning rate for all other tasks . When using FHTD and C51 , we also include H and Vmax in the grid search . All details are provided in the appendix . We report the average episode return of the ten most recent episodes against the number of interactions with the environment . Curves are averages over ten independent runs with shaded regions indicating standard errors .
The authors examine the commonly used paradigm of not discounting in the policy gradient objective. They propose two hypotheses relating to discounting. (1) discounting the critic improves representation learning. (2) undiscounted policy gradient is similar to discounting + an auxiliary loss. These hypotheses are studied through a series of empirical tests in the MuJoCo domain with PPO.
SP:55498a52c714b215caa9902e24f67daedf1f6bfd
A Deeper Look at Discounting Mismatch in Actor-Critic Algorithms
1 INTRODUCTION . Actor-critic algorithms have enjoyed great success both theoretically ( Williams , 1992 ; Sutton et al. , 2000 ; Konda , 2002 ; Schulman et al. , 2015a ) and empirically ( Mnih et al. , 2016 ; Silver et al. , 2016 ; Schulman et al. , 2017 ; OpenAI , 2018 ) . There is , however , a longstanding gap between the theory behind actor-critic algorithms and how practitioners implement them . Let γ , γA , and γC be the discount factors for defining the objective , updating the actor , and updating the critic respectively . Theoretically , no matter whether γ = 1 or γ < 1 , we should always use γA = γC = γ ( Sutton et al. , 2000 ; Schulman et al. , 2015a ) or at least keep γA = γC if Blackwell optimality ( Veinott , 1969 ; Weitzman , 2001 ) 1 is considered . Practitioners , however , usually use γA = 1 and γC < 1 in their implementations ( Dhariwal et al. , 2017 ; Caspi et al. , 2017 ; Zhang , 2018 ; Kostrikov , 2018 ; Achiam , 2018 ; Liang et al. , 2018 ; Stooke & Abbeel , 2019 ) . Although this mismatch and its theoretical disadvantage have been recognized by Thomas ( 2014 ) ; Nota & Thomas ( 2020 ) , whether and why it yields benefits in practice has not been systematically studied . In this paper , we empirically investigate this mismatch from a representation learning perspective . We consider two scenarios separately . Scenario 1 : The true objective is undiscounted ( γ = 1 ) . The theory prescribes to use γA = γC = γ = 1 . Practitioners , however , usually use γA = γ = 1 but γC < 1 , introducing bias . We explain this mismatch with the following hypothesis : Hypothesis 1. γC < 1 optimizes a bias-variance-representation trade-off . It is easy to see that γC < 1 reduces the variance in bootstrapping targets . Besides this , we further provide empirical evidence showing that when γC < 1 , it may become easier to find a good representation compared to γC = 1 . Consequently , although using γC < 1 introduces bias , it can facilitate representation learning . For our empirical study , we make use of recently introduced techniques , such fixed horizon temporal different learning ( De Asis et al. , 2019 ) and distributional reinforcement learning ( Bellemare et al. , 2017 ) to disentangle the various effects the discount factor has on the learning process . Scenario 2 : The true objective function is discounted ( γ < 1 ) . Theoretically , there is a γt term for the actor update on a transition observed at time t in a trajectory ( Sutton et al. , 2000 ; Schulman 1Blackwell optimality states that , in finite MDPs , there exists a γ0 < 1 such that for all γ ≥ γ0 , the optimal policies for the γ-discounted objective are the same . et al. , 2015a ) . Practitioners , however , usually ignore this term while using a discounted critic , i.e. , γA = 1 and γC = γ < 1 are used . We explain this mismatch with the following hypothesis : Hypothesis 2 . Using γC = γ < 1 and γA = 1 is effectively similar to using γC = γA = γ < 1 plus an auxiliary loss that sometimes facilitates representation learning . Our empirical study involves implementing the auxiliary task explicitly by using an additional policy for optimizing the difference term between the loss of γA = 1 and the loss of γA < 1 . We also design new benchmarking environments where the sign of the reward function is flipped after a certain time step such that later transitions differ from earlier ones . In that setting , γA = 1 becomes harmful . 2 BACKGROUND Markov Decision Processes : We consider an infinite horizon MDP with a finite state space S , a finite action spaceA , a bounded reward function r : S → R , a transition kernel p : S × S × A → [ 0 , 1 ] , an initial state distribution µ0 , and a discount factor γ ∈ [ 0 , 1 ] .2 The initial state S0 is sampled from µ0 . At time step t , an agent in state St takes action At ∼ π ( ·|St ) , where π : A×S → [ 0 , 1 ] is the policy it follows . The agent then gets a reward Rt+1 . = r ( St ) and proceeds to the next state St+1 ∼ p ( ·|St , At ) . The return of the policy π at time step t is defined as Gt . = ∑∞ i=1 γ i−1Rt+i , which allows us to define the state value function vγπ ( S ) . = E [ Gt|St = s ] and the state-action value function qγπ ( s , a ) . = E [ Gt|St = s , At = a ] . We consider episodic tasks where we assume there is an absorbing state s∞ ∈ S such that r ( s∞ ) = 0 and p ( s∞|s∞ , a ) = 1 holds for any a ∈ A . When γ < 1 , vγπ and qγπ are always well defined . When γ = 1 , to ensure v γ π and q γ π are well defined , we further assume finite expected episode length . Let Tπs be a random variable denoting the first time step that an agent hits s∞ when following π given S0 = s. We assume Tmax . = supπ∈Π maxs E [ Tπs ] < ∞ , where π is parameterized by θ and Π is the corresponding function class . Similar assumptions are also used in stochastic shortest path problems ( e.g. , Section 2.2 of Bertsekas & Tsitsiklis ( 1996 ) ) . In our experiments , all the environments have a hard time limit of 1000 , i.e. , Tmax = 1000 . This is standard practice , classic RL environments also have an upper limit on their episode lengths ( e.g . 27k in Bellemare et al . ( 2013 , ALE ) ) . Following Pardo et al . ( 2018 ) , we add the ( normalized ) time step t in the state to keep the environment Markovian . We measure the performance of a policy π with Jγ ( π ) . = ES0∼µ0 [ vγπ ( S0 ) ] . Vanilla Policy Gradient : Sutton et al . ( 2000 ) compute∇θJγ ( π ) as ∇θJγ ( π ) . = ∑ s d γ π ( s ) ∑ a q γ π ( s , a ) ∇θπ ( a|s ) , ( 1 ) where dγπ ( s ) . = ∑∞ t=0 γ t Pr ( St = s|µ0 , p , π ) for γ < 1 and dγπ ( s ) . = E [ ∑TπS0 t=0 Pr ( St = s|S0 , p , π ) ] for γ = 1.3 Note dγπ remains well-defined for γ = 1 when Tmax < ∞ . In order to optimize the policy performance Jγ ( π ) , one can follow ( 1 ) and , at time step t , update θt as θt+1 ← θt + αγtAqγCπ ( St , At ) ∇θ log π ( At|St ) , ( 2 ) where α is a learning rate . If we replace qγCπ with a learned value function , the update rule ( 2 ) becomes an actor-critic algorithm , where the actor refers to π and the critic refers to the learned approximation of qγCπ . In practice , an estimate for v γC π instead of q γC π is usually learned . Theoretically , we should have γA = γC = γ . Practitioners , however , usually ignore the γtA term in ( 2 ) , and use γC < γA = 1 . What this update truly optimizes remains an open problem ( Nota & Thomas , 2020 ) . TRPO and PPO : To improve the stability of actor-critic algorithms , Schulman et al . ( 2015a ) propose Trust Region Policy Optimization ( TRPO ) , based on the performance improvement lemma : Lemma 1 . ( Theorem 1 in Schulman et al . ( 2015a ) ) For γ < 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Adv γ π ( s , a ) |γ ( π , π ′ ) ( 1−γ ) 2 , 2Following Schulman et al . ( 2015a ) , we consider r : S → R instead of r : S ×A → R for simplicity . 3Sutton et al . ( 2000 ) do not explicitly define dγπ when γ = 1 , which , however , can be easily deduced from Chapter 13.2 in Sutton & Barto ( 2018 ) . where Advγπ ( s , a ) . = Es′∼p ( ·|s , a ) [ r ( s ) + γvγπ ( s′ ) − vγπ ( s ) ] is the advantage , ( π , π′ ) . = maxsDKL ( π ( ·|s ) ||π′ ( ·|s ) ) , and DKL refers to the KL divergence . To facilitate our empirical study , we first make a theoretical contribution by extending Lemma 1 to the undiscounted setting . We have the following lemma : Lemma 2 . Assuming Tmax < ∞ , for γ = 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Advγπ ( s , a ) |T 2max ( π , π′ ) . The proof of Lemma 2 is provided in the appendix . A practical implementation of Lemmas 1 and 2 is to compute a new policy θ via gradient ascent on the clipped objective : L ( θ ) . = ∑∞ t=0 γ t A min { πθ ( At|St ) πθold ( At|St ) AdvγCπθold ( St , At ) , clip ( πθ ( At|St ) πθold ( At|St ) ) AdvγCπθold ( St , At ) } , ( 3 ) where St and At are sampled from πθold , and clip ( x ) . = max ( min ( x , 1 + ) , 1 − ) with a hyperparameter . Theoretically , we should have γA = γC , but practical algorithms like Proximal Policy Optimization ( Schulman et al. , 2017 , PPO ) usually use γC < γA = 1 . Policy Evaluation : We now introduce several policy evaluation techniques we use in our empirical study . Let v̂ be our estimate of vγπ . At time step t , Temporal Difference learning ( TD , Sutton ( 1988 ) ) updates v̂ as v̂ ( St ) ← v̂ ( St ) +α ( Rt+1 + γv̂ ( St+1 ) − v̂ ( St ) ) . Instead of the infinite horizon discounted returnGt , De Asis et al . ( 2019 ) propose to consider theH-step returnGHt . = ∑H i=1Rt+i . Correspondingly , the H-step value function is defined as vHπ ( s ) . = E [ GHt |St = s ] . We let v̂H be our estimate of vHπ . At time step t , De Asis et al . ( 2019 ) use the following update rule to learn v̂ H : v̂i ( St ) ← v̂i ( St ) + α ( Rt+1 + v̂i−1 ( St+1 ) − v̂i ( St ) ) ( i = 1 , . . . H ) , ( 4 ) where v̂0 ( s ) .= 0 . In other words , to learn v̂H , we need to learn { v̂i } i=1 , ... , H simultaneously . De Asis et al . ( 2019 ) call ( 4 ) Fixed Horizon Temporal Difference learning ( FHTD ) . As Gt is a random variable , Bellemare et al . ( 2017 ) propose to learn its full distribution instead of its expectation only , yielding the Distributional Reinforcement Learning ( RL ) paradigm . They use a categorical distribution with 51 atoms uniformly distributed in [ −Vmax , Vmax ] to approximate the distribution of Gt , where Vmax is a hyperparameter . In this paper , we refer to the corresponding policy evaluation algorithm as C51 . Methodology : We consider MuJoCo robot simulation tasks from OpenAI gym ( Brockman et al. , 2016 ) as our benchmark . Given its popularity in understanding deep RL algorithms ( Henderson et al. , 2017 ; Ilyas et al. , 2018 ; Engstrom et al. , 2019 ; Andrychowicz et al. , 2020 ) and designing new deep RL algorithms ( Fujimoto et al. , 2018 ; Haarnoja et al. , 2018 ) , we believe our empirical results are relevant to most practitioners . We choose PPO , a simple yet effective and widely used algorithm , as the representative actor-critic algorithm for our empirical study . PPO is usually equipped with generalized advantage estimation ( Schulman et al. , 2015b , GAE ) , which has a tunable hyperparameter γ̂ . The roles of γ and γ̂ are similar . To reduce its confounding effect , we do not use GAE in our experiments , i.e. , the advantage estimation for our actor is simply the TD errorRt+1 +γCv̂ ( St+1 ) − v̂ ( St ) . The PPO pseudocode we follow is provided in Alg . 1 in the appendix and we refer to it as the default PPO implementation . We use the standard architecture and optimizer across all tasks , in particular , the actor and the critic do not share layers . We conduct a thorough learning rate search in Ant for each algorithmic configuration ( i.e. , a curve in a figure ) and then use the same learning rate for all other tasks . When using FHTD and C51 , we also include H and Vmax in the grid search . All details are provided in the appendix . We report the average episode return of the ten most recent episodes against the number of interactions with the environment . Curves are averages over ten independent runs with shaded regions indicating standard errors .
In this paper, the authors focus on the discounting mismatch in the Actor-Critic algorithm. From comprehensive experiments, the authors claim that this mismatch is either a bias-variance representation tradeoff or an auxiliary task for the actor update. Since the discounting mismatch problem is a well-known gap between the theoretical analysis and the application, their work, especially the experiments, might have some impact on how to understand this gap.
SP:55498a52c714b215caa9902e24f67daedf1f6bfd
A Deeper Look at Discounting Mismatch in Actor-Critic Algorithms
1 INTRODUCTION . Actor-critic algorithms have enjoyed great success both theoretically ( Williams , 1992 ; Sutton et al. , 2000 ; Konda , 2002 ; Schulman et al. , 2015a ) and empirically ( Mnih et al. , 2016 ; Silver et al. , 2016 ; Schulman et al. , 2017 ; OpenAI , 2018 ) . There is , however , a longstanding gap between the theory behind actor-critic algorithms and how practitioners implement them . Let γ , γA , and γC be the discount factors for defining the objective , updating the actor , and updating the critic respectively . Theoretically , no matter whether γ = 1 or γ < 1 , we should always use γA = γC = γ ( Sutton et al. , 2000 ; Schulman et al. , 2015a ) or at least keep γA = γC if Blackwell optimality ( Veinott , 1969 ; Weitzman , 2001 ) 1 is considered . Practitioners , however , usually use γA = 1 and γC < 1 in their implementations ( Dhariwal et al. , 2017 ; Caspi et al. , 2017 ; Zhang , 2018 ; Kostrikov , 2018 ; Achiam , 2018 ; Liang et al. , 2018 ; Stooke & Abbeel , 2019 ) . Although this mismatch and its theoretical disadvantage have been recognized by Thomas ( 2014 ) ; Nota & Thomas ( 2020 ) , whether and why it yields benefits in practice has not been systematically studied . In this paper , we empirically investigate this mismatch from a representation learning perspective . We consider two scenarios separately . Scenario 1 : The true objective is undiscounted ( γ = 1 ) . The theory prescribes to use γA = γC = γ = 1 . Practitioners , however , usually use γA = γ = 1 but γC < 1 , introducing bias . We explain this mismatch with the following hypothesis : Hypothesis 1. γC < 1 optimizes a bias-variance-representation trade-off . It is easy to see that γC < 1 reduces the variance in bootstrapping targets . Besides this , we further provide empirical evidence showing that when γC < 1 , it may become easier to find a good representation compared to γC = 1 . Consequently , although using γC < 1 introduces bias , it can facilitate representation learning . For our empirical study , we make use of recently introduced techniques , such fixed horizon temporal different learning ( De Asis et al. , 2019 ) and distributional reinforcement learning ( Bellemare et al. , 2017 ) to disentangle the various effects the discount factor has on the learning process . Scenario 2 : The true objective function is discounted ( γ < 1 ) . Theoretically , there is a γt term for the actor update on a transition observed at time t in a trajectory ( Sutton et al. , 2000 ; Schulman 1Blackwell optimality states that , in finite MDPs , there exists a γ0 < 1 such that for all γ ≥ γ0 , the optimal policies for the γ-discounted objective are the same . et al. , 2015a ) . Practitioners , however , usually ignore this term while using a discounted critic , i.e. , γA = 1 and γC = γ < 1 are used . We explain this mismatch with the following hypothesis : Hypothesis 2 . Using γC = γ < 1 and γA = 1 is effectively similar to using γC = γA = γ < 1 plus an auxiliary loss that sometimes facilitates representation learning . Our empirical study involves implementing the auxiliary task explicitly by using an additional policy for optimizing the difference term between the loss of γA = 1 and the loss of γA < 1 . We also design new benchmarking environments where the sign of the reward function is flipped after a certain time step such that later transitions differ from earlier ones . In that setting , γA = 1 becomes harmful . 2 BACKGROUND Markov Decision Processes : We consider an infinite horizon MDP with a finite state space S , a finite action spaceA , a bounded reward function r : S → R , a transition kernel p : S × S × A → [ 0 , 1 ] , an initial state distribution µ0 , and a discount factor γ ∈ [ 0 , 1 ] .2 The initial state S0 is sampled from µ0 . At time step t , an agent in state St takes action At ∼ π ( ·|St ) , where π : A×S → [ 0 , 1 ] is the policy it follows . The agent then gets a reward Rt+1 . = r ( St ) and proceeds to the next state St+1 ∼ p ( ·|St , At ) . The return of the policy π at time step t is defined as Gt . = ∑∞ i=1 γ i−1Rt+i , which allows us to define the state value function vγπ ( S ) . = E [ Gt|St = s ] and the state-action value function qγπ ( s , a ) . = E [ Gt|St = s , At = a ] . We consider episodic tasks where we assume there is an absorbing state s∞ ∈ S such that r ( s∞ ) = 0 and p ( s∞|s∞ , a ) = 1 holds for any a ∈ A . When γ < 1 , vγπ and qγπ are always well defined . When γ = 1 , to ensure v γ π and q γ π are well defined , we further assume finite expected episode length . Let Tπs be a random variable denoting the first time step that an agent hits s∞ when following π given S0 = s. We assume Tmax . = supπ∈Π maxs E [ Tπs ] < ∞ , where π is parameterized by θ and Π is the corresponding function class . Similar assumptions are also used in stochastic shortest path problems ( e.g. , Section 2.2 of Bertsekas & Tsitsiklis ( 1996 ) ) . In our experiments , all the environments have a hard time limit of 1000 , i.e. , Tmax = 1000 . This is standard practice , classic RL environments also have an upper limit on their episode lengths ( e.g . 27k in Bellemare et al . ( 2013 , ALE ) ) . Following Pardo et al . ( 2018 ) , we add the ( normalized ) time step t in the state to keep the environment Markovian . We measure the performance of a policy π with Jγ ( π ) . = ES0∼µ0 [ vγπ ( S0 ) ] . Vanilla Policy Gradient : Sutton et al . ( 2000 ) compute∇θJγ ( π ) as ∇θJγ ( π ) . = ∑ s d γ π ( s ) ∑ a q γ π ( s , a ) ∇θπ ( a|s ) , ( 1 ) where dγπ ( s ) . = ∑∞ t=0 γ t Pr ( St = s|µ0 , p , π ) for γ < 1 and dγπ ( s ) . = E [ ∑TπS0 t=0 Pr ( St = s|S0 , p , π ) ] for γ = 1.3 Note dγπ remains well-defined for γ = 1 when Tmax < ∞ . In order to optimize the policy performance Jγ ( π ) , one can follow ( 1 ) and , at time step t , update θt as θt+1 ← θt + αγtAqγCπ ( St , At ) ∇θ log π ( At|St ) , ( 2 ) where α is a learning rate . If we replace qγCπ with a learned value function , the update rule ( 2 ) becomes an actor-critic algorithm , where the actor refers to π and the critic refers to the learned approximation of qγCπ . In practice , an estimate for v γC π instead of q γC π is usually learned . Theoretically , we should have γA = γC = γ . Practitioners , however , usually ignore the γtA term in ( 2 ) , and use γC < γA = 1 . What this update truly optimizes remains an open problem ( Nota & Thomas , 2020 ) . TRPO and PPO : To improve the stability of actor-critic algorithms , Schulman et al . ( 2015a ) propose Trust Region Policy Optimization ( TRPO ) , based on the performance improvement lemma : Lemma 1 . ( Theorem 1 in Schulman et al . ( 2015a ) ) For γ < 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Adv γ π ( s , a ) |γ ( π , π ′ ) ( 1−γ ) 2 , 2Following Schulman et al . ( 2015a ) , we consider r : S → R instead of r : S ×A → R for simplicity . 3Sutton et al . ( 2000 ) do not explicitly define dγπ when γ = 1 , which , however , can be easily deduced from Chapter 13.2 in Sutton & Barto ( 2018 ) . where Advγπ ( s , a ) . = Es′∼p ( ·|s , a ) [ r ( s ) + γvγπ ( s′ ) − vγπ ( s ) ] is the advantage , ( π , π′ ) . = maxsDKL ( π ( ·|s ) ||π′ ( ·|s ) ) , and DKL refers to the KL divergence . To facilitate our empirical study , we first make a theoretical contribution by extending Lemma 1 to the undiscounted setting . We have the following lemma : Lemma 2 . Assuming Tmax < ∞ , for γ = 1 and any two policies π and π′ , Jγ ( π ′ ) ≥ Jγ ( π ) + ( ∑ s d γ π ( s ) ∑ a π ′ ( a|s ) Advγπ ( s , a ) ) − 4 maxs , a |Advγπ ( s , a ) |T 2max ( π , π′ ) . The proof of Lemma 2 is provided in the appendix . A practical implementation of Lemmas 1 and 2 is to compute a new policy θ via gradient ascent on the clipped objective : L ( θ ) . = ∑∞ t=0 γ t A min { πθ ( At|St ) πθold ( At|St ) AdvγCπθold ( St , At ) , clip ( πθ ( At|St ) πθold ( At|St ) ) AdvγCπθold ( St , At ) } , ( 3 ) where St and At are sampled from πθold , and clip ( x ) . = max ( min ( x , 1 + ) , 1 − ) with a hyperparameter . Theoretically , we should have γA = γC , but practical algorithms like Proximal Policy Optimization ( Schulman et al. , 2017 , PPO ) usually use γC < γA = 1 . Policy Evaluation : We now introduce several policy evaluation techniques we use in our empirical study . Let v̂ be our estimate of vγπ . At time step t , Temporal Difference learning ( TD , Sutton ( 1988 ) ) updates v̂ as v̂ ( St ) ← v̂ ( St ) +α ( Rt+1 + γv̂ ( St+1 ) − v̂ ( St ) ) . Instead of the infinite horizon discounted returnGt , De Asis et al . ( 2019 ) propose to consider theH-step returnGHt . = ∑H i=1Rt+i . Correspondingly , the H-step value function is defined as vHπ ( s ) . = E [ GHt |St = s ] . We let v̂H be our estimate of vHπ . At time step t , De Asis et al . ( 2019 ) use the following update rule to learn v̂ H : v̂i ( St ) ← v̂i ( St ) + α ( Rt+1 + v̂i−1 ( St+1 ) − v̂i ( St ) ) ( i = 1 , . . . H ) , ( 4 ) where v̂0 ( s ) .= 0 . In other words , to learn v̂H , we need to learn { v̂i } i=1 , ... , H simultaneously . De Asis et al . ( 2019 ) call ( 4 ) Fixed Horizon Temporal Difference learning ( FHTD ) . As Gt is a random variable , Bellemare et al . ( 2017 ) propose to learn its full distribution instead of its expectation only , yielding the Distributional Reinforcement Learning ( RL ) paradigm . They use a categorical distribution with 51 atoms uniformly distributed in [ −Vmax , Vmax ] to approximate the distribution of Gt , where Vmax is a hyperparameter . In this paper , we refer to the corresponding policy evaluation algorithm as C51 . Methodology : We consider MuJoCo robot simulation tasks from OpenAI gym ( Brockman et al. , 2016 ) as our benchmark . Given its popularity in understanding deep RL algorithms ( Henderson et al. , 2017 ; Ilyas et al. , 2018 ; Engstrom et al. , 2019 ; Andrychowicz et al. , 2020 ) and designing new deep RL algorithms ( Fujimoto et al. , 2018 ; Haarnoja et al. , 2018 ) , we believe our empirical results are relevant to most practitioners . We choose PPO , a simple yet effective and widely used algorithm , as the representative actor-critic algorithm for our empirical study . PPO is usually equipped with generalized advantage estimation ( Schulman et al. , 2015b , GAE ) , which has a tunable hyperparameter γ̂ . The roles of γ and γ̂ are similar . To reduce its confounding effect , we do not use GAE in our experiments , i.e. , the advantage estimation for our actor is simply the TD errorRt+1 +γCv̂ ( St+1 ) − v̂ ( St ) . The PPO pseudocode we follow is provided in Alg . 1 in the appendix and we refer to it as the default PPO implementation . We use the standard architecture and optimizer across all tasks , in particular , the actor and the critic do not share layers . We conduct a thorough learning rate search in Ant for each algorithmic configuration ( i.e. , a curve in a figure ) and then use the same learning rate for all other tasks . When using FHTD and C51 , we also include H and Vmax in the grid search . All details are provided in the appendix . We report the average episode return of the ten most recent episodes against the number of interactions with the environment . Curves are averages over ten independent runs with shaded regions indicating standard errors .
The paper proposes an empirical study of the discount factor as a regularization parameter in the actor-critic architectures. Specifically, the paper considers the case in which the actor and the critic employ different values of the discount factor. Two scenarios are considered. First, the paper analyzes the case in which the true objective is undiscounted and a discount factor is employed in the critic (like in TRPO and PPO). Second, the case in which the true objective is actually discounted but the discount factor is ignored in the update of the actor. A quite large suite of experimental results is reported.
SP:55498a52c714b215caa9902e24f67daedf1f6bfd
Grounding Language to Autonomously-Acquired Skills via Goal Generation
We are interested in the autonomous acquisition of repertoires of skills . Languageconditioned reinforcement learning ( LC-RL ) approaches are great tools in this quest , as they allow to express abstract goals as sets of constraints on the states . However , most LC-RL agents are not autonomous and can not learn without external instructions and feedback . Besides , their direct language condition can not account for the goal-directed behavior of pre-verbal infants and strongly limits the expression of behavioral diversity for a given language input . To resolve these issues , we propose a new conceptual approach to language-conditioned RL : the Language-Goal-Behavior architecture ( LGB ) . LGB decouples skill learning and language grounding via an intermediate semantic representation of the world . To showcase the properties of LGB , we present a specific implementation called DECSTR . DECSTR is an intrinsically motivated learning agent endowed with an innate semantic representation describing spatial relations between physical objects . In a first stage ( G→B ) , it freely explores its environment and targets selfgenerated semantic configurations . In a second stage ( L→G ) , it trains a languageconditioned goal generator to generate semantic goals that match the constraints expressed in language-based inputs . We showcase the additional properties of LGB w.r.t . both an end-to-end LC-RL approach and a similar approach leveraging non-semantic , continuous intermediate representations . Intermediate semantic representations help satisfy language commands in a diversity of ways , enable strategy switching after a failure and facilitate language grounding . 1 INTRODUCTION . Developmental psychology investigates the interactions between learning and developmental processes that support the slow but extraordinary transition from the behavior of infants to the sophisticated intelligence of human adults ( Piaget , 1977 ; Smith & Gasser , 2005 ) . Inspired by this line of thought , the central endeavour of developmental robotics consists in shaping a set of machine learning processes able to generate a similar growth of capabilities in robots ( Weng et al. , 2001 ; Lungarella et al. , 2003 ) . In this broad context , we are more specifically interested in designing learning agents able to : 1 ) explore open-ended environments and grow repertoires of skills in a self-supervised way and 2 ) learn from a tutor via language commands . The design of intrinsically motivated agents marked a major step towards these goals . The Intrinsically Motivated Goal Exploration Processes family ( IMGEPs ) , for example , describes embodied agents that interact with their environment at the sensorimotor level and are endowed with the ability to represent and set their own goals , rewarding themselves over completion ( Forestier et al. , 2017 ) . Recently , goal-conditioned reinforcement learning ( GC-RL ) appeared like a viable way to implement IMGEPs and target the open-ended and self-supervised acquisition of diverse skills . ∗Equal contribution . Goal-conditioned RL approaches train goal-conditioned policies to target multiple goals ( Kaelbling , 1993 ; Schaul et al. , 2015 ) . While most GC-RL approaches express goals as target features ( e.g . target block positions ( Andrychowicz et al. , 2017 ) , agent positions in a maze ( Schaul et al. , 2015 ) or target images ( Nair et al. , 2018 ) ) , recent approaches started to use language to express goals , as language can express sets of constraints on the state space ( e.g . open the red door ) in a more abstract and interpretable way ( Luketina et al. , 2019 ) . However , most GC-RL approaches – and language-based ones ( LC-RL ) in particular – are not intrinsically motivated and receive external instructions and rewards . The IMAGINE approach is one of the rare examples of intrinsically motivated LC-RL approaches ( Colas et al. , 2020 ) . In any case , the language condition suffers from three drawbacks . 1 ) It couples skill learning and language grounding . Thus , it can not account for goal-directed behaviors in pre-verbal infants ( Mandler , 1999 ) . 2 ) Direct conditioning limits the behavioral diversity associated to language input : a single instruction leads to a low diversity of behaviors only resulting from the stochasticity of the policy or the environment . 3 ) This lack of behavioral diversity prevents agents from switching strategy after a failure . To circumvent these three limitations , one can decouple skill learning and language grounding via an intermediate innate semantic representation . On one hand , agents can learn skills by targeting configurations from the semantic representation space . On the other hand , they can learn to generate valid semantic configurations matching the constraints expressed by language instructions . This generation can be the backbone of behavioral diversity : a given sentence might correspond to a whole set of matching configurations . This is what we propose in this work . Contributions . We propose a novel conceptual RL architecture , named LGB for Language-GoalBehavior and pictured in Figure 1 ( right ) . This LGB architecture enables an agent to decouple the intrinsically motivated acquisition of a repertoire of skills ( Goals → Behavior ) from language grounding ( Language→ Goals ) , via the use of semantic goal representation . To our knowledge , the LGB architecture is the only one to combine the following four features : • It is intrinsically motivated : it selects its own ( semantic ) goals and generates its own rewards , • It decouples skill learning from language grounding , accounting for infants learning , • It can exhibit a diversity of behaviors for any given instruction , • It can switch strategy in case of failures . Besides , we introduce an instance of LGB , named DECSTR for DEep sets and Curriculum with SemanTic goal Representations . Using DECSTR , we showcase the advantages of the conceptual decoupling idea . In the skill learning phase , the DECSTR agent evolves in a manipulation environment and leverages semantic representations based on predicates describing spatial relations between physical objects . These predicates are known to be used by infants from a very young age ( Mandler , 2012 ) . DECSTR autonomously learns to discover and master all reachable configurations in its semantic representation space . In the language grounding phase , we train a Conditional Variational Auto-Encoder ( C-VAE ) to generate semantic goals from language instructions . Finally , we can evaluate the agent in an instruction-following phase by composing the two first phases . The experimental section investigates three questions : how does DECSTR perform in the three phases ? How does it compare to end-to-end LC-RL approaches ? Do we need intermediate representations to be semantic ? Code and videos can be found at https : //sites.google.com/view/decstr/ . 2 RELATED WORK . Standard language-conditioned RL . Most approaches from the LC-RL literature define instruction following agents that receive external instructions and rewards ( Hermann et al. , 2017 ; Chan et al. , 2019 ; Bahdanau et al. , 2018 ; Cideron et al. , 2019 ; Jiang et al. , 2019 ; Fu et al. , 2019 ) , except the IMAGINE approach which introduced intrinsically motivated agents able to set their own goals and to imagine new ones ( Colas et al. , 2020 ) . In both cases , the language-condition prevents the decoupling of language acquisition and skill learning , true behavioral diversity and efficient strategy switching behaviors . Our approach is different , as we can decouple language acquisition from skill learning . The language-conditioned goal generation allows behavioral diversity and strategy switching behaviors . Goal-conditioned RL with target coordinates for block manipulation . Our proposed implementation of LGB , called DECSTR , evolves in a block manipulation domain . Stacking blocks is one of the earliest benchmarks in artificial intelligence ( e.g . Sussman ( 1973 ) ; Tate et al . ( 1975 ) ) and has led to many simulation and robotics studies ( Deisenroth et al. , 2011 ; Xu et al. , 2018 ; Colas et al. , 2019a ) . Recently , Lanier et al . ( 2019 ) and Li et al . ( 2019 ) demonstrated impressive results by stacking up to 4 and 6 blocks respectively . However , these approaches are not intrinsically motivated , involve hand-defined curriculum strategies and express goals as specific target block positions . In contrast , the DECSTR agent is intrinsically motivated , builds its own curriculum and uses semantic goal representations ( symbolic or language-based ) based on spatial relations between blocks . Decoupling language acquisition and skill learning . Several works investigate the use of semantic representations to associate meanings and skills ( Alomari et al. , 2017 ; Tellex et al. , 2011 ; Kulick et al. , 2013 ) . While the two first use semantic representations as an intermediate layer between language and skills , the third one does not use language . While DECSTR acquires skills autonomously , previous approaches all use skills that are either manually generated ( Alomari et al. , 2017 ) , handengineered ( Tellex et al. , 2011 ) or obtained via optimal control methods ( Kulick et al. , 2013 ) . Closer to us , Lynch & Sermanet ( 2020 ) also decouple skill learning from language acquisition in a goalconditioned imitation learning paradigm by mapping both language goals and images goals to a shared representation space . However , this approach is not intrinsically motivated as it relies on a dataset of human tele-operated strategies . The deterministic merging of representations also limits the emergence of behavioral diversity and efficient strategy-switching behaviors . 3 METHODS . This section presents our proposed Language-Goal-Behavior architecture ( LGB ) represented in Figure 1 ( Section 3.1 ) and a particular instance of the LGB architecture called DECSTR . We first present the environment it is set in [ 3.2 ] , then describe the implementations of the three modules composing any LGB architecture : 1 ) the semantic representation [ 3.3 ] ; 2 ) the intrinsically motivated goal-conditioned algorithm [ 3.4 ] and 3 ) the language-conditioned goal generator [ 3.5 ] . We finally present how the three phases described in Figure 1 are evaluated [ 3.6 ] . 3.1 THE LANGUAGE-GOAL-BEHAVIOR ARCHITECTURE . The LGB architecture is composed of three main modules . First , the semantic representation defines the behavioral and goal spaces of the agent . Second , the intrinsically motivated GC-RL algorithm is in charge of the skill learning phase . Third , the language-conditioned goal generator is in charge of the language grounding phase . Both phases can be combined in the instruction following phase . The three phases are respectively called G→B for Goal → Behavior , L→G for Language → Goal and L→G→B for Language → Goal → Behavior , see Figure 1 and Appendix A . Instances of the LGB architecture should demonstrate the four properties listed in the introduction : 1 ) be intrinsically motivated ; 2 ) decouple skill learning and language grounding ( by design ) ; 3 ) favor behavioral diversity ; 4 ) allow strategy switching . We argue that any LGB algorithm should fulfill the following constraints . For LGB to be intrinsically motivated ( 1 ) , the algorithm needs to integrate the generation and selection of semantic goals and to generate its own rewards . For LGB to demonstrate behavioral diversity and strategy switching ( 3 , 4 ) , the language-conditioned goal generator must efficiently model the distribution of semantic goals satisfying the constraints expressed by any language input . 3.2 ENVIRONMENT The DECSTR agent evolves in the Fetch Manipulate environment : a robotic manipulation domain based on MUJOCO ( Todorov et al. , 2012 ) and derived from the Fetch tasks ( Plappert et al. , 2018 ) , see Figure 2 . Actions are 4-dimensional : 3D gripper velocities and grasping velocity . Observations include the Cartesian and angular positions and velocities of the gripper and the three blocks . Inspired by the framework of Zone of Proximal Development that describes how parents organize the learning environment of their children ( Vygotsky , 1978 ) , we let a social partner facilitate DECSTR ’ s exploration by providing non-trivial initial configurations . After a first period of autonomous exploration , the social partner initializes the scene with stacks of 2 blocks 21 % of times , stacks of 3 blocks 9 % of times , and a block is initially put in the agent ’ s gripper 50 % of times . This help is not provided during offline evaluations .
This paper proposes DECSTR, a goal-driven RL framework where the goal is represented as a binary vector that encodes the semantic relationships between objects. The state is assumed to contain disentangled features for each of the objects (and other features relating to the agent’s end-effectors). The architecture is based on Deep Sets (Zaher et al., 2017), which allows the pairs of the objects to be encoded with a shared network. The paper also introduces a curriculum learning strategy similar to CURIOUS (Colas et al., 2019), which relies on metrics such as competence and learning progress (LP) in order to select goals to pursue during an episode. One key difference is that unlike CURIOUS which uses expert-defined “goal buckets”, DECSTR groups the goals based on recency of discovery. Once trained to be able to behave with respect to these semantic relationship goals, the second phase is language grounding. They learn a module (implemented as C-VAE) that converts from natural language text to the semantic configuration goal space. Experiments were conducted in the Fetch Manipulate robotic arm environment and compared with ablations of DECSTR without some of its components, demonstrating strong performance and generalization to various types of language instructions.
SP:b0203f1c10cc5af3a8273ab1517267704ee46743
Grounding Language to Autonomously-Acquired Skills via Goal Generation
We are interested in the autonomous acquisition of repertoires of skills . Languageconditioned reinforcement learning ( LC-RL ) approaches are great tools in this quest , as they allow to express abstract goals as sets of constraints on the states . However , most LC-RL agents are not autonomous and can not learn without external instructions and feedback . Besides , their direct language condition can not account for the goal-directed behavior of pre-verbal infants and strongly limits the expression of behavioral diversity for a given language input . To resolve these issues , we propose a new conceptual approach to language-conditioned RL : the Language-Goal-Behavior architecture ( LGB ) . LGB decouples skill learning and language grounding via an intermediate semantic representation of the world . To showcase the properties of LGB , we present a specific implementation called DECSTR . DECSTR is an intrinsically motivated learning agent endowed with an innate semantic representation describing spatial relations between physical objects . In a first stage ( G→B ) , it freely explores its environment and targets selfgenerated semantic configurations . In a second stage ( L→G ) , it trains a languageconditioned goal generator to generate semantic goals that match the constraints expressed in language-based inputs . We showcase the additional properties of LGB w.r.t . both an end-to-end LC-RL approach and a similar approach leveraging non-semantic , continuous intermediate representations . Intermediate semantic representations help satisfy language commands in a diversity of ways , enable strategy switching after a failure and facilitate language grounding . 1 INTRODUCTION . Developmental psychology investigates the interactions between learning and developmental processes that support the slow but extraordinary transition from the behavior of infants to the sophisticated intelligence of human adults ( Piaget , 1977 ; Smith & Gasser , 2005 ) . Inspired by this line of thought , the central endeavour of developmental robotics consists in shaping a set of machine learning processes able to generate a similar growth of capabilities in robots ( Weng et al. , 2001 ; Lungarella et al. , 2003 ) . In this broad context , we are more specifically interested in designing learning agents able to : 1 ) explore open-ended environments and grow repertoires of skills in a self-supervised way and 2 ) learn from a tutor via language commands . The design of intrinsically motivated agents marked a major step towards these goals . The Intrinsically Motivated Goal Exploration Processes family ( IMGEPs ) , for example , describes embodied agents that interact with their environment at the sensorimotor level and are endowed with the ability to represent and set their own goals , rewarding themselves over completion ( Forestier et al. , 2017 ) . Recently , goal-conditioned reinforcement learning ( GC-RL ) appeared like a viable way to implement IMGEPs and target the open-ended and self-supervised acquisition of diverse skills . ∗Equal contribution . Goal-conditioned RL approaches train goal-conditioned policies to target multiple goals ( Kaelbling , 1993 ; Schaul et al. , 2015 ) . While most GC-RL approaches express goals as target features ( e.g . target block positions ( Andrychowicz et al. , 2017 ) , agent positions in a maze ( Schaul et al. , 2015 ) or target images ( Nair et al. , 2018 ) ) , recent approaches started to use language to express goals , as language can express sets of constraints on the state space ( e.g . open the red door ) in a more abstract and interpretable way ( Luketina et al. , 2019 ) . However , most GC-RL approaches – and language-based ones ( LC-RL ) in particular – are not intrinsically motivated and receive external instructions and rewards . The IMAGINE approach is one of the rare examples of intrinsically motivated LC-RL approaches ( Colas et al. , 2020 ) . In any case , the language condition suffers from three drawbacks . 1 ) It couples skill learning and language grounding . Thus , it can not account for goal-directed behaviors in pre-verbal infants ( Mandler , 1999 ) . 2 ) Direct conditioning limits the behavioral diversity associated to language input : a single instruction leads to a low diversity of behaviors only resulting from the stochasticity of the policy or the environment . 3 ) This lack of behavioral diversity prevents agents from switching strategy after a failure . To circumvent these three limitations , one can decouple skill learning and language grounding via an intermediate innate semantic representation . On one hand , agents can learn skills by targeting configurations from the semantic representation space . On the other hand , they can learn to generate valid semantic configurations matching the constraints expressed by language instructions . This generation can be the backbone of behavioral diversity : a given sentence might correspond to a whole set of matching configurations . This is what we propose in this work . Contributions . We propose a novel conceptual RL architecture , named LGB for Language-GoalBehavior and pictured in Figure 1 ( right ) . This LGB architecture enables an agent to decouple the intrinsically motivated acquisition of a repertoire of skills ( Goals → Behavior ) from language grounding ( Language→ Goals ) , via the use of semantic goal representation . To our knowledge , the LGB architecture is the only one to combine the following four features : • It is intrinsically motivated : it selects its own ( semantic ) goals and generates its own rewards , • It decouples skill learning from language grounding , accounting for infants learning , • It can exhibit a diversity of behaviors for any given instruction , • It can switch strategy in case of failures . Besides , we introduce an instance of LGB , named DECSTR for DEep sets and Curriculum with SemanTic goal Representations . Using DECSTR , we showcase the advantages of the conceptual decoupling idea . In the skill learning phase , the DECSTR agent evolves in a manipulation environment and leverages semantic representations based on predicates describing spatial relations between physical objects . These predicates are known to be used by infants from a very young age ( Mandler , 2012 ) . DECSTR autonomously learns to discover and master all reachable configurations in its semantic representation space . In the language grounding phase , we train a Conditional Variational Auto-Encoder ( C-VAE ) to generate semantic goals from language instructions . Finally , we can evaluate the agent in an instruction-following phase by composing the two first phases . The experimental section investigates three questions : how does DECSTR perform in the three phases ? How does it compare to end-to-end LC-RL approaches ? Do we need intermediate representations to be semantic ? Code and videos can be found at https : //sites.google.com/view/decstr/ . 2 RELATED WORK . Standard language-conditioned RL . Most approaches from the LC-RL literature define instruction following agents that receive external instructions and rewards ( Hermann et al. , 2017 ; Chan et al. , 2019 ; Bahdanau et al. , 2018 ; Cideron et al. , 2019 ; Jiang et al. , 2019 ; Fu et al. , 2019 ) , except the IMAGINE approach which introduced intrinsically motivated agents able to set their own goals and to imagine new ones ( Colas et al. , 2020 ) . In both cases , the language-condition prevents the decoupling of language acquisition and skill learning , true behavioral diversity and efficient strategy switching behaviors . Our approach is different , as we can decouple language acquisition from skill learning . The language-conditioned goal generation allows behavioral diversity and strategy switching behaviors . Goal-conditioned RL with target coordinates for block manipulation . Our proposed implementation of LGB , called DECSTR , evolves in a block manipulation domain . Stacking blocks is one of the earliest benchmarks in artificial intelligence ( e.g . Sussman ( 1973 ) ; Tate et al . ( 1975 ) ) and has led to many simulation and robotics studies ( Deisenroth et al. , 2011 ; Xu et al. , 2018 ; Colas et al. , 2019a ) . Recently , Lanier et al . ( 2019 ) and Li et al . ( 2019 ) demonstrated impressive results by stacking up to 4 and 6 blocks respectively . However , these approaches are not intrinsically motivated , involve hand-defined curriculum strategies and express goals as specific target block positions . In contrast , the DECSTR agent is intrinsically motivated , builds its own curriculum and uses semantic goal representations ( symbolic or language-based ) based on spatial relations between blocks . Decoupling language acquisition and skill learning . Several works investigate the use of semantic representations to associate meanings and skills ( Alomari et al. , 2017 ; Tellex et al. , 2011 ; Kulick et al. , 2013 ) . While the two first use semantic representations as an intermediate layer between language and skills , the third one does not use language . While DECSTR acquires skills autonomously , previous approaches all use skills that are either manually generated ( Alomari et al. , 2017 ) , handengineered ( Tellex et al. , 2011 ) or obtained via optimal control methods ( Kulick et al. , 2013 ) . Closer to us , Lynch & Sermanet ( 2020 ) also decouple skill learning from language acquisition in a goalconditioned imitation learning paradigm by mapping both language goals and images goals to a shared representation space . However , this approach is not intrinsically motivated as it relies on a dataset of human tele-operated strategies . The deterministic merging of representations also limits the emergence of behavioral diversity and efficient strategy-switching behaviors . 3 METHODS . This section presents our proposed Language-Goal-Behavior architecture ( LGB ) represented in Figure 1 ( Section 3.1 ) and a particular instance of the LGB architecture called DECSTR . We first present the environment it is set in [ 3.2 ] , then describe the implementations of the three modules composing any LGB architecture : 1 ) the semantic representation [ 3.3 ] ; 2 ) the intrinsically motivated goal-conditioned algorithm [ 3.4 ] and 3 ) the language-conditioned goal generator [ 3.5 ] . We finally present how the three phases described in Figure 1 are evaluated [ 3.6 ] . 3.1 THE LANGUAGE-GOAL-BEHAVIOR ARCHITECTURE . The LGB architecture is composed of three main modules . First , the semantic representation defines the behavioral and goal spaces of the agent . Second , the intrinsically motivated GC-RL algorithm is in charge of the skill learning phase . Third , the language-conditioned goal generator is in charge of the language grounding phase . Both phases can be combined in the instruction following phase . The three phases are respectively called G→B for Goal → Behavior , L→G for Language → Goal and L→G→B for Language → Goal → Behavior , see Figure 1 and Appendix A . Instances of the LGB architecture should demonstrate the four properties listed in the introduction : 1 ) be intrinsically motivated ; 2 ) decouple skill learning and language grounding ( by design ) ; 3 ) favor behavioral diversity ; 4 ) allow strategy switching . We argue that any LGB algorithm should fulfill the following constraints . For LGB to be intrinsically motivated ( 1 ) , the algorithm needs to integrate the generation and selection of semantic goals and to generate its own rewards . For LGB to demonstrate behavioral diversity and strategy switching ( 3 , 4 ) , the language-conditioned goal generator must efficiently model the distribution of semantic goals satisfying the constraints expressed by any language input . 3.2 ENVIRONMENT The DECSTR agent evolves in the Fetch Manipulate environment : a robotic manipulation domain based on MUJOCO ( Todorov et al. , 2012 ) and derived from the Fetch tasks ( Plappert et al. , 2018 ) , see Figure 2 . Actions are 4-dimensional : 3D gripper velocities and grasping velocity . Observations include the Cartesian and angular positions and velocities of the gripper and the three blocks . Inspired by the framework of Zone of Proximal Development that describes how parents organize the learning environment of their children ( Vygotsky , 1978 ) , we let a social partner facilitate DECSTR ’ s exploration by providing non-trivial initial configurations . After a first period of autonomous exploration , the social partner initializes the scene with stacks of 2 blocks 21 % of times , stacks of 3 blocks 9 % of times , and a block is initially put in the agent ’ s gripper 50 % of times . This help is not provided during offline evaluations .
This work proposed DECSTR, a procedure for encouraging intrinsic motivation via an intermediate semantic state-space representation. The authors propose an intermediate semantic state space that the intrinsically motivated agent learns to explore. For the environment provided (a 3-block system), the agent fully explores the symbolic state space, reaching all feasible symbolic states. In the second part of the work, the authors train a language model capable of proposing symbolic goals (in the form of symbolic states) from natural language input and shows that the previously-intrinsically-motivated agent can now be made to reach these goals, demonstrating that the symbolic-goal-conditioned policy is sufficient for instruction following in their 3-block domain.
SP:b0203f1c10cc5af3a8273ab1517267704ee46743
Grounding Language to Autonomously-Acquired Skills via Goal Generation
We are interested in the autonomous acquisition of repertoires of skills . Languageconditioned reinforcement learning ( LC-RL ) approaches are great tools in this quest , as they allow to express abstract goals as sets of constraints on the states . However , most LC-RL agents are not autonomous and can not learn without external instructions and feedback . Besides , their direct language condition can not account for the goal-directed behavior of pre-verbal infants and strongly limits the expression of behavioral diversity for a given language input . To resolve these issues , we propose a new conceptual approach to language-conditioned RL : the Language-Goal-Behavior architecture ( LGB ) . LGB decouples skill learning and language grounding via an intermediate semantic representation of the world . To showcase the properties of LGB , we present a specific implementation called DECSTR . DECSTR is an intrinsically motivated learning agent endowed with an innate semantic representation describing spatial relations between physical objects . In a first stage ( G→B ) , it freely explores its environment and targets selfgenerated semantic configurations . In a second stage ( L→G ) , it trains a languageconditioned goal generator to generate semantic goals that match the constraints expressed in language-based inputs . We showcase the additional properties of LGB w.r.t . both an end-to-end LC-RL approach and a similar approach leveraging non-semantic , continuous intermediate representations . Intermediate semantic representations help satisfy language commands in a diversity of ways , enable strategy switching after a failure and facilitate language grounding . 1 INTRODUCTION . Developmental psychology investigates the interactions between learning and developmental processes that support the slow but extraordinary transition from the behavior of infants to the sophisticated intelligence of human adults ( Piaget , 1977 ; Smith & Gasser , 2005 ) . Inspired by this line of thought , the central endeavour of developmental robotics consists in shaping a set of machine learning processes able to generate a similar growth of capabilities in robots ( Weng et al. , 2001 ; Lungarella et al. , 2003 ) . In this broad context , we are more specifically interested in designing learning agents able to : 1 ) explore open-ended environments and grow repertoires of skills in a self-supervised way and 2 ) learn from a tutor via language commands . The design of intrinsically motivated agents marked a major step towards these goals . The Intrinsically Motivated Goal Exploration Processes family ( IMGEPs ) , for example , describes embodied agents that interact with their environment at the sensorimotor level and are endowed with the ability to represent and set their own goals , rewarding themselves over completion ( Forestier et al. , 2017 ) . Recently , goal-conditioned reinforcement learning ( GC-RL ) appeared like a viable way to implement IMGEPs and target the open-ended and self-supervised acquisition of diverse skills . ∗Equal contribution . Goal-conditioned RL approaches train goal-conditioned policies to target multiple goals ( Kaelbling , 1993 ; Schaul et al. , 2015 ) . While most GC-RL approaches express goals as target features ( e.g . target block positions ( Andrychowicz et al. , 2017 ) , agent positions in a maze ( Schaul et al. , 2015 ) or target images ( Nair et al. , 2018 ) ) , recent approaches started to use language to express goals , as language can express sets of constraints on the state space ( e.g . open the red door ) in a more abstract and interpretable way ( Luketina et al. , 2019 ) . However , most GC-RL approaches – and language-based ones ( LC-RL ) in particular – are not intrinsically motivated and receive external instructions and rewards . The IMAGINE approach is one of the rare examples of intrinsically motivated LC-RL approaches ( Colas et al. , 2020 ) . In any case , the language condition suffers from three drawbacks . 1 ) It couples skill learning and language grounding . Thus , it can not account for goal-directed behaviors in pre-verbal infants ( Mandler , 1999 ) . 2 ) Direct conditioning limits the behavioral diversity associated to language input : a single instruction leads to a low diversity of behaviors only resulting from the stochasticity of the policy or the environment . 3 ) This lack of behavioral diversity prevents agents from switching strategy after a failure . To circumvent these three limitations , one can decouple skill learning and language grounding via an intermediate innate semantic representation . On one hand , agents can learn skills by targeting configurations from the semantic representation space . On the other hand , they can learn to generate valid semantic configurations matching the constraints expressed by language instructions . This generation can be the backbone of behavioral diversity : a given sentence might correspond to a whole set of matching configurations . This is what we propose in this work . Contributions . We propose a novel conceptual RL architecture , named LGB for Language-GoalBehavior and pictured in Figure 1 ( right ) . This LGB architecture enables an agent to decouple the intrinsically motivated acquisition of a repertoire of skills ( Goals → Behavior ) from language grounding ( Language→ Goals ) , via the use of semantic goal representation . To our knowledge , the LGB architecture is the only one to combine the following four features : • It is intrinsically motivated : it selects its own ( semantic ) goals and generates its own rewards , • It decouples skill learning from language grounding , accounting for infants learning , • It can exhibit a diversity of behaviors for any given instruction , • It can switch strategy in case of failures . Besides , we introduce an instance of LGB , named DECSTR for DEep sets and Curriculum with SemanTic goal Representations . Using DECSTR , we showcase the advantages of the conceptual decoupling idea . In the skill learning phase , the DECSTR agent evolves in a manipulation environment and leverages semantic representations based on predicates describing spatial relations between physical objects . These predicates are known to be used by infants from a very young age ( Mandler , 2012 ) . DECSTR autonomously learns to discover and master all reachable configurations in its semantic representation space . In the language grounding phase , we train a Conditional Variational Auto-Encoder ( C-VAE ) to generate semantic goals from language instructions . Finally , we can evaluate the agent in an instruction-following phase by composing the two first phases . The experimental section investigates three questions : how does DECSTR perform in the three phases ? How does it compare to end-to-end LC-RL approaches ? Do we need intermediate representations to be semantic ? Code and videos can be found at https : //sites.google.com/view/decstr/ . 2 RELATED WORK . Standard language-conditioned RL . Most approaches from the LC-RL literature define instruction following agents that receive external instructions and rewards ( Hermann et al. , 2017 ; Chan et al. , 2019 ; Bahdanau et al. , 2018 ; Cideron et al. , 2019 ; Jiang et al. , 2019 ; Fu et al. , 2019 ) , except the IMAGINE approach which introduced intrinsically motivated agents able to set their own goals and to imagine new ones ( Colas et al. , 2020 ) . In both cases , the language-condition prevents the decoupling of language acquisition and skill learning , true behavioral diversity and efficient strategy switching behaviors . Our approach is different , as we can decouple language acquisition from skill learning . The language-conditioned goal generation allows behavioral diversity and strategy switching behaviors . Goal-conditioned RL with target coordinates for block manipulation . Our proposed implementation of LGB , called DECSTR , evolves in a block manipulation domain . Stacking blocks is one of the earliest benchmarks in artificial intelligence ( e.g . Sussman ( 1973 ) ; Tate et al . ( 1975 ) ) and has led to many simulation and robotics studies ( Deisenroth et al. , 2011 ; Xu et al. , 2018 ; Colas et al. , 2019a ) . Recently , Lanier et al . ( 2019 ) and Li et al . ( 2019 ) demonstrated impressive results by stacking up to 4 and 6 blocks respectively . However , these approaches are not intrinsically motivated , involve hand-defined curriculum strategies and express goals as specific target block positions . In contrast , the DECSTR agent is intrinsically motivated , builds its own curriculum and uses semantic goal representations ( symbolic or language-based ) based on spatial relations between blocks . Decoupling language acquisition and skill learning . Several works investigate the use of semantic representations to associate meanings and skills ( Alomari et al. , 2017 ; Tellex et al. , 2011 ; Kulick et al. , 2013 ) . While the two first use semantic representations as an intermediate layer between language and skills , the third one does not use language . While DECSTR acquires skills autonomously , previous approaches all use skills that are either manually generated ( Alomari et al. , 2017 ) , handengineered ( Tellex et al. , 2011 ) or obtained via optimal control methods ( Kulick et al. , 2013 ) . Closer to us , Lynch & Sermanet ( 2020 ) also decouple skill learning from language acquisition in a goalconditioned imitation learning paradigm by mapping both language goals and images goals to a shared representation space . However , this approach is not intrinsically motivated as it relies on a dataset of human tele-operated strategies . The deterministic merging of representations also limits the emergence of behavioral diversity and efficient strategy-switching behaviors . 3 METHODS . This section presents our proposed Language-Goal-Behavior architecture ( LGB ) represented in Figure 1 ( Section 3.1 ) and a particular instance of the LGB architecture called DECSTR . We first present the environment it is set in [ 3.2 ] , then describe the implementations of the three modules composing any LGB architecture : 1 ) the semantic representation [ 3.3 ] ; 2 ) the intrinsically motivated goal-conditioned algorithm [ 3.4 ] and 3 ) the language-conditioned goal generator [ 3.5 ] . We finally present how the three phases described in Figure 1 are evaluated [ 3.6 ] . 3.1 THE LANGUAGE-GOAL-BEHAVIOR ARCHITECTURE . The LGB architecture is composed of three main modules . First , the semantic representation defines the behavioral and goal spaces of the agent . Second , the intrinsically motivated GC-RL algorithm is in charge of the skill learning phase . Third , the language-conditioned goal generator is in charge of the language grounding phase . Both phases can be combined in the instruction following phase . The three phases are respectively called G→B for Goal → Behavior , L→G for Language → Goal and L→G→B for Language → Goal → Behavior , see Figure 1 and Appendix A . Instances of the LGB architecture should demonstrate the four properties listed in the introduction : 1 ) be intrinsically motivated ; 2 ) decouple skill learning and language grounding ( by design ) ; 3 ) favor behavioral diversity ; 4 ) allow strategy switching . We argue that any LGB algorithm should fulfill the following constraints . For LGB to be intrinsically motivated ( 1 ) , the algorithm needs to integrate the generation and selection of semantic goals and to generate its own rewards . For LGB to demonstrate behavioral diversity and strategy switching ( 3 , 4 ) , the language-conditioned goal generator must efficiently model the distribution of semantic goals satisfying the constraints expressed by any language input . 3.2 ENVIRONMENT The DECSTR agent evolves in the Fetch Manipulate environment : a robotic manipulation domain based on MUJOCO ( Todorov et al. , 2012 ) and derived from the Fetch tasks ( Plappert et al. , 2018 ) , see Figure 2 . Actions are 4-dimensional : 3D gripper velocities and grasping velocity . Observations include the Cartesian and angular positions and velocities of the gripper and the three blocks . Inspired by the framework of Zone of Proximal Development that describes how parents organize the learning environment of their children ( Vygotsky , 1978 ) , we let a social partner facilitate DECSTR ’ s exploration by providing non-trivial initial configurations . After a first period of autonomous exploration , the social partner initializes the scene with stacks of 2 blocks 21 % of times , stacks of 3 blocks 9 % of times , and a block is initially put in the agent ’ s gripper 50 % of times . This help is not provided during offline evaluations .
The DECSTR system's intrinsic motivations may be applicable to other application domains, depending on how objects and relations are enumerated. This potential is not explored beyond the toy environment presented. The learning methods (especially inductive biases) are hand-crafted based on human-level knowledge about semantic predicates, but only two ("above" and "close") are demonstrated. Without demonstrating the system on any other configuration or world, it's difficult to tell whether it's able to solve only the problem it's been crafted to solve in this specific environment.
SP:b0203f1c10cc5af3a8273ab1517267704ee46743
On interaction between augmentations and corruptions in natural corruption robustness
1 Introduction . Robustness to distribution shift , i.e . when the train and test distributions differ , is an important feature of practical machine learning models . Among many forms of distribution shift , one particularly relevant category for computer vision are image corruptions . For example , test data may come from sources that differ from the training set in terms of lighting , camera quality , or other features . Postprocessing transforms , such as photo touch-up , image filters , or compression effects are commonplace in real-world data . Models developed using clean , undistorted inputs typically perform dramatically worse when confronted with these sorts of image corruptions [ 8 , 13 ] . The subject of corruption robustness has a long history in computer vision [ 1 , 6 , 28 ] and recently has been studied actively with the release of benchmark datasets such as ImageNet-C [ 13 ] . One particular property of image corruptions is that they are low-level distortions in nature . Corruptions are transformations of an image that affect structural information such as colors , textures , or geometry [ 5 ] and are typically free of high-level semantics . Therefore , it is natural to expect that data augmentation techniques , which expand the training set with random low-level transformations , can help learn robust models . Indeed , data augmentation has become a central technique in several recent methods [ 14 , 20 , 25 ] that achieve large improvements on ImageNet-C and related benchmarks . One caveat for data augmentation based approaches is the test corruptions are expected to be unknown at training time . If the corruptions are known , they may simply be applied to the training set as data augmentations to trivially adapt to the test distribution . Instead , an ideal robust model needs to be ∗This work completed as part of the Facebook AI residency program . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . robust to any valid corruption , including ones unseen in any previous benchmark . Of course , in practice the robustness of a model can only be evaluated approximately by measuring its corruption error on a representative corruption benchmark . To avoid trivial adaptation to the benchmark , recent works manually exclude test corruptions from the training augmentations . However , with a toy experiment presented in Figure 1 , we argue that this strategy alone might not be enough and that visually similar augmentation outputs and test corruptions can lead to significant benchmark improvements even if the exact corruption transformations are excluded . This observation raises two important questions . One , how exactly does the similarity between train time augmentations and corruptions of the test set affect the error ? And two , if the gains are due to the similarity , they may not translate into better robustness to other possible corruptions , so how well will data augmentations generalize beyond a given benchmark ? In this work , we take a step towards answering these questions , with the goal of better understanding the relationship between data augmentation and test-time corruptions . Using a feature space on image transforms and a new measure called Minimal Sample Distance ( MSD ) on this space , we are able to quantify the distance between augmentation schemes and classes of corruption transformation . With our approach , we empirically show an intuitive yet surprisingly overlooked finding : Augmentation-corruption perceptual similarity is a strong predictor of corruption error . Based on this finding , we perform additional experiments to show that data augmentation aids corruption robustness by increasing perceptual similarity between a ( possibly small ) fraction of the training data and the test set . To further support our claims , we introduce a set of new corruptions , called CIFAR/ImageNet-C , to test the degree to which common data augmentation methods generalize from the original CIFAR/ImageNet-C. To choose these corruptions , we expand the set of natural corruptions and sample new corruptions that are far away from CIFAR/ImageNet-C in our feature space for measuring perceptual similarity . We then demonstrate that augmentation schemes designed specifically to improve robustness show significantly degraded performance on CIFAR/ImageNet-C . Some augmentation schemes still show some improvement over baseline , which suggests meaningful progress towards general corruption robustness is being made , but different augmentation schemes exhibit different degrees of generalization capability . As an implication , caution is needed for fair robustness evaluations when additional data augmentation is introduced . These results suggest a major challenge that is often overlooked in the study of corruption robustness : generalization is often poor . Since perceptual similarity can predict performance , for any fixed finite set of test corruptions , improvements on that set may generalize poorly to dissimilar corruptions . We 3Example transforms are for illustrative purpose only and are exaggerated . Base image © Sehee Park . hope that these results , tools , and benchmarks will help researchers better understand why a given augmentation scheme has good corruption error and whether it should be expected to generalize to dissimilar corruptions . On the positive side , our experiments show that generalization does emerge among perceptually similar transforms , and that only a small fraction of sampled augmentations need to be similar to a given corruption . Section 6 discusses these points in more depth . 2 Related Work . Corruption robustness benchmarks and analysis . ImageNet-C [ 13 ] is a corruption dataset often used as a benchmark in robustness studies . Other corruption datasets [ 15 , 27 ] collect corrupted images from real world sources and thus have a mixture of semantic distribution shifts and perceptual transforms . Corruption robustness differs from adversarial robustness [ 31 ] , which seeks invariance to small , worst case distortions . One notable difference is that improving corruption robustness often slightly improves regular test error , instead of harming it . Yin et al . [ 38 ] analyzes corruption robustness in the context of transforms ’ frequency spectra ; this can also influence corruption error independently from perceptual similarity . Here we study the relationship between augmentations and corruptions more generically , and explore the relationship between perceptual similarity and generalization to new corruptions . Dao et al . [ 3 ] and Wu et al . [ 36 ] study the theory of data augmentation for regular test error . Hendrycks et al . [ 15 ] and Taori et al . [ 33 ] study how the performance on synthetic corruption transforms generalizes to performance on corruption datasets collected from the real world . Here we do not address this issue directly but touch upon it in the discussion . Improving corruption robustness . Data augmentations designed to improve robustness include AugMix [ 14 ] , which composites common image transforms , Patch Gaussian [ 20 ] , which applies Gaussian noise in square patches , and ANT [ 25 ] , which augments with an adversarially learned noise distribution . AutoAugment [ 2 ] learns augmentation policies that optimize clean error but has since been shown to improve corruption error [ 38 ] . Mixup [ 40 ] can improve robustness [ 18 ] , but its label augmentation complicates the dependence on image augmentation . Stylized-ImageNet [ 9 ] , which applies style transfer to input images , can also improve robustness . DeepAugment [ 15 ] , which applies augmentations to a deep representation of an image , can also give large improvements in robustness . Noisy Student [ 37 ] and Assemble-ResNet [ 18 ] combine data augmentation with new models and training procedures and greatly enhance corruption robustness . In addition to training-time methods , there are approaches that adapt to unseen corruptions at test time , e.g . using self-supervised tasks [ 30 ] , entropy minimization [ 35 ] , or with a focus on privacy and data transmission efficiency [ 19 ] . While we do not directly address these approaches here , our methods potentially provide tools that could be used to measure shifting distributions in an online regime . 3 Perceptual similarity for augmentations and corruptions . First , we study the importance of similarity between augmentations and corruptions for improving performance on those corruptions . To do so , we need a means to compare augmentations and corruptions . Both types of transforms are perceptual in nature , meaning they affect low-level image structure while leaving high-level semantic information intact , so we expect a good distance to be a measure of perceptual similarity . Then , we need to find the appropriate measure of distance between the augmentation and corruption distributions . We will argue below that distributional equivalence is not appropriate in the context of corruption robustness , and instead introduce the minimal sample distance , a simple measure that does capture a relevant sense of distribution distance . Measuring similarity between perceptual transforms . We define a perceptual transform as a transform that acts on low-level image structure but not high-level semantic information . As such , we expect two transforms should be similar if their actions on this low-level structure are similar , independent of algorithmic or per-pixel differences between them . A closely related , well-studied problem is the perceptual similarity between images . A common approach is to train a neural network on a classification task and use intermediate layers as a feature space for measuring distances [ 42 ] . We adapt this idea to obtain a feature space for measuring distances between perceptual transforms . We start with a feature extractor for images , which we call f̂ ( x ) . To train the model from which we will extract features , we assume access to a dataset D of image label pairs ( x , y ) associated with a classification task . The model should be trained using only default data augmentation for the task in question so that the feature extractor is independent of the transforms we will use it to study . In order to obtain a very simple measure , we use just the last hidden layer of the network as a feature space . A perceptual transform t ( x ) may be encoded by applying it to all images in D , encoding the transformed images , and averaging the features over these images . For efficiency , we find it sufficient to average over only a randomly sampled subset of images DS in D. In Section 4.1 we discuss the size of DS . The random choice of images is a property of the feature extractor , and so remains fixed when encoding multiple transforms . This reduces variance when computing distances between two transforms . The transform feature extractor is given by f ( t ) = Ex∈DS [ f̂ ( t ( x ) ) − f̂ ( x ) ] . The perceptual similarity between an augmentation and a corruption can be taken as the L2 distance on this feature space f . Minimal sample distance . We now seek to compare the distribution of an augmentation scheme pa to a distribution of a corruption benchmark pc . If the goal was to optimize error on a known corruption distribution , exact equivalence of distributions is the correct measure to minimize . But since the goal is robustness to general , unknown corruption distributions , a good augmentation scheme should be equivalent to no single corruption distribution . To illustrate this behavior , consider a toy problem where we have access to the corruption transforms at training time . A very rough , necessary-but-insufficient measure of distributional similarity is dMMD ( pa , pc ) = ||Ea∼pa [ f ( a ) ] − Ec∼pc [ f ( c ) ] || . This is the maximal mean discrepancy on a fixed , finite feature space , so for brevity we will refer to it as MMD . We still employ the featurization f ( t ) , since we are comparing transforms and not images , unlike in typical domain adaptation . Consider two corruption distributions , here impulse noise and motion blur , and an augmentation scheme that is a mixture of the two corruption distributions . Figure 2b shows MMD between the augmentation and impulse noise corruption scales linearly with mixing fraction , but error on impulse noise remains low until the mixing fraction is almost 0 % impulse noise . This implies distributional similarity is a poor predictor of corruption error . Indeed , low dMMD with any one corruption distribution suggests the augmentation overlaps it significantly , so the augmentation is unlikely to aid dissimilar corruptions . Our expectation for the behavior of the error in Figure 2b is that networks can often successfully memorize rare examples seen during training , so that only a very small fraction of sampled images need impulse noise augmentations to perform well on impulse noise corruptions . An appropriate distance should then measure how close augmentation samples can come to the corruption distribution , even if the density of those samples is low . We thus propose a very simple measure called minimal sample distance ( MSD ) , which is just the perceptual similarity between an average corruption and the closest augmentation from a finite set of samples A ∼ pa : dMSD ( pa , pc ) = min a∈A∼pa ||f ( a ) − Ec∼pc [ f ( c ) ] || . ( 1 ) Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 .8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 .2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Figure 3 : Example relationships between MSD and corruption error . ρ is the Spearman rank correlation . MSD correlates well with error across all four categories of corruption in CIFAR-10-C. For completeness , we also show brightness , a negative example where correlation is poor . A schematic comparison of MMD and MSD is shown in Figure 2a . While both MMD and MSD are small for an augmentation scheme that is distributionally similar to a corruption distribution , only MSD remains small for a broad distribution that occasionally produces samples near multiple corruption distributions . Figure 2b shows MSD , like test error , is small for most mixing fractions in the toy problem described above . Note the measure ’ s need to accommodate robustness to general , unknown corruption distributions has led it to be asymmetric , so it differs from more formal distance metrics that may be used to predict generalization error , such as the Wasserstein distance [ 43 ] .
The paper studies the importance of similarity between augmentations and corruptions for improving performance on those corruptions. To measure the distance between the augmentation and corruption distributions, the paper proposes a new metric, Minimal Sample Distance (MSD), which is the perceptual similarity between an average corruption and the closest augmentation from a finite set of samples sampled from the augmented data distribution. It is shown that MSD overcomes the drawbacks of distributional distance measures like Maximum Mean Discrepancy (MMD). A new benchmark, called ImageNet-C-bar, made up of corruptions that are perceptually dissimilar to ImageNet-C, is introduced. Using standard evaluation, it is empirically shown that several recent augmentation schemes show degraded performance on the new dataset, suggesting that they generate augmentations only perceptually similar to ImageNet-C and thus are prone to overfitting.
SP:38b5e8808025e698744d9544e91d334ee6566fa2
On interaction between augmentations and corruptions in natural corruption robustness
1 Introduction . Robustness to distribution shift , i.e . when the train and test distributions differ , is an important feature of practical machine learning models . Among many forms of distribution shift , one particularly relevant category for computer vision are image corruptions . For example , test data may come from sources that differ from the training set in terms of lighting , camera quality , or other features . Postprocessing transforms , such as photo touch-up , image filters , or compression effects are commonplace in real-world data . Models developed using clean , undistorted inputs typically perform dramatically worse when confronted with these sorts of image corruptions [ 8 , 13 ] . The subject of corruption robustness has a long history in computer vision [ 1 , 6 , 28 ] and recently has been studied actively with the release of benchmark datasets such as ImageNet-C [ 13 ] . One particular property of image corruptions is that they are low-level distortions in nature . Corruptions are transformations of an image that affect structural information such as colors , textures , or geometry [ 5 ] and are typically free of high-level semantics . Therefore , it is natural to expect that data augmentation techniques , which expand the training set with random low-level transformations , can help learn robust models . Indeed , data augmentation has become a central technique in several recent methods [ 14 , 20 , 25 ] that achieve large improvements on ImageNet-C and related benchmarks . One caveat for data augmentation based approaches is the test corruptions are expected to be unknown at training time . If the corruptions are known , they may simply be applied to the training set as data augmentations to trivially adapt to the test distribution . Instead , an ideal robust model needs to be ∗This work completed as part of the Facebook AI residency program . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . robust to any valid corruption , including ones unseen in any previous benchmark . Of course , in practice the robustness of a model can only be evaluated approximately by measuring its corruption error on a representative corruption benchmark . To avoid trivial adaptation to the benchmark , recent works manually exclude test corruptions from the training augmentations . However , with a toy experiment presented in Figure 1 , we argue that this strategy alone might not be enough and that visually similar augmentation outputs and test corruptions can lead to significant benchmark improvements even if the exact corruption transformations are excluded . This observation raises two important questions . One , how exactly does the similarity between train time augmentations and corruptions of the test set affect the error ? And two , if the gains are due to the similarity , they may not translate into better robustness to other possible corruptions , so how well will data augmentations generalize beyond a given benchmark ? In this work , we take a step towards answering these questions , with the goal of better understanding the relationship between data augmentation and test-time corruptions . Using a feature space on image transforms and a new measure called Minimal Sample Distance ( MSD ) on this space , we are able to quantify the distance between augmentation schemes and classes of corruption transformation . With our approach , we empirically show an intuitive yet surprisingly overlooked finding : Augmentation-corruption perceptual similarity is a strong predictor of corruption error . Based on this finding , we perform additional experiments to show that data augmentation aids corruption robustness by increasing perceptual similarity between a ( possibly small ) fraction of the training data and the test set . To further support our claims , we introduce a set of new corruptions , called CIFAR/ImageNet-C , to test the degree to which common data augmentation methods generalize from the original CIFAR/ImageNet-C. To choose these corruptions , we expand the set of natural corruptions and sample new corruptions that are far away from CIFAR/ImageNet-C in our feature space for measuring perceptual similarity . We then demonstrate that augmentation schemes designed specifically to improve robustness show significantly degraded performance on CIFAR/ImageNet-C . Some augmentation schemes still show some improvement over baseline , which suggests meaningful progress towards general corruption robustness is being made , but different augmentation schemes exhibit different degrees of generalization capability . As an implication , caution is needed for fair robustness evaluations when additional data augmentation is introduced . These results suggest a major challenge that is often overlooked in the study of corruption robustness : generalization is often poor . Since perceptual similarity can predict performance , for any fixed finite set of test corruptions , improvements on that set may generalize poorly to dissimilar corruptions . We 3Example transforms are for illustrative purpose only and are exaggerated . Base image © Sehee Park . hope that these results , tools , and benchmarks will help researchers better understand why a given augmentation scheme has good corruption error and whether it should be expected to generalize to dissimilar corruptions . On the positive side , our experiments show that generalization does emerge among perceptually similar transforms , and that only a small fraction of sampled augmentations need to be similar to a given corruption . Section 6 discusses these points in more depth . 2 Related Work . Corruption robustness benchmarks and analysis . ImageNet-C [ 13 ] is a corruption dataset often used as a benchmark in robustness studies . Other corruption datasets [ 15 , 27 ] collect corrupted images from real world sources and thus have a mixture of semantic distribution shifts and perceptual transforms . Corruption robustness differs from adversarial robustness [ 31 ] , which seeks invariance to small , worst case distortions . One notable difference is that improving corruption robustness often slightly improves regular test error , instead of harming it . Yin et al . [ 38 ] analyzes corruption robustness in the context of transforms ’ frequency spectra ; this can also influence corruption error independently from perceptual similarity . Here we study the relationship between augmentations and corruptions more generically , and explore the relationship between perceptual similarity and generalization to new corruptions . Dao et al . [ 3 ] and Wu et al . [ 36 ] study the theory of data augmentation for regular test error . Hendrycks et al . [ 15 ] and Taori et al . [ 33 ] study how the performance on synthetic corruption transforms generalizes to performance on corruption datasets collected from the real world . Here we do not address this issue directly but touch upon it in the discussion . Improving corruption robustness . Data augmentations designed to improve robustness include AugMix [ 14 ] , which composites common image transforms , Patch Gaussian [ 20 ] , which applies Gaussian noise in square patches , and ANT [ 25 ] , which augments with an adversarially learned noise distribution . AutoAugment [ 2 ] learns augmentation policies that optimize clean error but has since been shown to improve corruption error [ 38 ] . Mixup [ 40 ] can improve robustness [ 18 ] , but its label augmentation complicates the dependence on image augmentation . Stylized-ImageNet [ 9 ] , which applies style transfer to input images , can also improve robustness . DeepAugment [ 15 ] , which applies augmentations to a deep representation of an image , can also give large improvements in robustness . Noisy Student [ 37 ] and Assemble-ResNet [ 18 ] combine data augmentation with new models and training procedures and greatly enhance corruption robustness . In addition to training-time methods , there are approaches that adapt to unseen corruptions at test time , e.g . using self-supervised tasks [ 30 ] , entropy minimization [ 35 ] , or with a focus on privacy and data transmission efficiency [ 19 ] . While we do not directly address these approaches here , our methods potentially provide tools that could be used to measure shifting distributions in an online regime . 3 Perceptual similarity for augmentations and corruptions . First , we study the importance of similarity between augmentations and corruptions for improving performance on those corruptions . To do so , we need a means to compare augmentations and corruptions . Both types of transforms are perceptual in nature , meaning they affect low-level image structure while leaving high-level semantic information intact , so we expect a good distance to be a measure of perceptual similarity . Then , we need to find the appropriate measure of distance between the augmentation and corruption distributions . We will argue below that distributional equivalence is not appropriate in the context of corruption robustness , and instead introduce the minimal sample distance , a simple measure that does capture a relevant sense of distribution distance . Measuring similarity between perceptual transforms . We define a perceptual transform as a transform that acts on low-level image structure but not high-level semantic information . As such , we expect two transforms should be similar if their actions on this low-level structure are similar , independent of algorithmic or per-pixel differences between them . A closely related , well-studied problem is the perceptual similarity between images . A common approach is to train a neural network on a classification task and use intermediate layers as a feature space for measuring distances [ 42 ] . We adapt this idea to obtain a feature space for measuring distances between perceptual transforms . We start with a feature extractor for images , which we call f̂ ( x ) . To train the model from which we will extract features , we assume access to a dataset D of image label pairs ( x , y ) associated with a classification task . The model should be trained using only default data augmentation for the task in question so that the feature extractor is independent of the transforms we will use it to study . In order to obtain a very simple measure , we use just the last hidden layer of the network as a feature space . A perceptual transform t ( x ) may be encoded by applying it to all images in D , encoding the transformed images , and averaging the features over these images . For efficiency , we find it sufficient to average over only a randomly sampled subset of images DS in D. In Section 4.1 we discuss the size of DS . The random choice of images is a property of the feature extractor , and so remains fixed when encoding multiple transforms . This reduces variance when computing distances between two transforms . The transform feature extractor is given by f ( t ) = Ex∈DS [ f̂ ( t ( x ) ) − f̂ ( x ) ] . The perceptual similarity between an augmentation and a corruption can be taken as the L2 distance on this feature space f . Minimal sample distance . We now seek to compare the distribution of an augmentation scheme pa to a distribution of a corruption benchmark pc . If the goal was to optimize error on a known corruption distribution , exact equivalence of distributions is the correct measure to minimize . But since the goal is robustness to general , unknown corruption distributions , a good augmentation scheme should be equivalent to no single corruption distribution . To illustrate this behavior , consider a toy problem where we have access to the corruption transforms at training time . A very rough , necessary-but-insufficient measure of distributional similarity is dMMD ( pa , pc ) = ||Ea∼pa [ f ( a ) ] − Ec∼pc [ f ( c ) ] || . This is the maximal mean discrepancy on a fixed , finite feature space , so for brevity we will refer to it as MMD . We still employ the featurization f ( t ) , since we are comparing transforms and not images , unlike in typical domain adaptation . Consider two corruption distributions , here impulse noise and motion blur , and an augmentation scheme that is a mixture of the two corruption distributions . Figure 2b shows MMD between the augmentation and impulse noise corruption scales linearly with mixing fraction , but error on impulse noise remains low until the mixing fraction is almost 0 % impulse noise . This implies distributional similarity is a poor predictor of corruption error . Indeed , low dMMD with any one corruption distribution suggests the augmentation overlaps it significantly , so the augmentation is unlikely to aid dissimilar corruptions . Our expectation for the behavior of the error in Figure 2b is that networks can often successfully memorize rare examples seen during training , so that only a very small fraction of sampled images need impulse noise augmentations to perform well on impulse noise corruptions . An appropriate distance should then measure how close augmentation samples can come to the corruption distribution , even if the density of those samples is low . We thus propose a very simple measure called minimal sample distance ( MSD ) , which is just the perceptual similarity between an average corruption and the closest augmentation from a finite set of samples A ∼ pa : dMSD ( pa , pc ) = min a∈A∼pa ||f ( a ) − Ec∼pc [ f ( c ) ] || . ( 1 ) Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 .8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 .2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Figure 3 : Example relationships between MSD and corruption error . ρ is the Spearman rank correlation . MSD correlates well with error across all four categories of corruption in CIFAR-10-C. For completeness , we also show brightness , a negative example where correlation is poor . A schematic comparison of MMD and MSD is shown in Figure 2a . While both MMD and MSD are small for an augmentation scheme that is distributionally similar to a corruption distribution , only MSD remains small for a broad distribution that occasionally produces samples near multiple corruption distributions . Figure 2b shows MSD , like test error , is small for most mixing fractions in the toy problem described above . Note the measure ’ s need to accommodate robustness to general , unknown corruption distributions has led it to be asymmetric , so it differs from more formal distance metrics that may be used to predict generalization error , such as the Wasserstein distance [ 43 ] .
The paper introduces the Minimal Sample Distance (MSD): a measure of the minimal distance, in a trained network representation space, between samples modified with an augmentation and the average of all samples modified by a corruption. It uses this metric to claim that there exists a high correlation between the corruption error and the MSD of a given augmentation. This way, it claims that focusing on benchmarks like ImageNet-C may lead to overfitting to the corruptions present in that benchmark.
SP:38b5e8808025e698744d9544e91d334ee6566fa2
On interaction between augmentations and corruptions in natural corruption robustness
1 Introduction . Robustness to distribution shift , i.e . when the train and test distributions differ , is an important feature of practical machine learning models . Among many forms of distribution shift , one particularly relevant category for computer vision are image corruptions . For example , test data may come from sources that differ from the training set in terms of lighting , camera quality , or other features . Postprocessing transforms , such as photo touch-up , image filters , or compression effects are commonplace in real-world data . Models developed using clean , undistorted inputs typically perform dramatically worse when confronted with these sorts of image corruptions [ 8 , 13 ] . The subject of corruption robustness has a long history in computer vision [ 1 , 6 , 28 ] and recently has been studied actively with the release of benchmark datasets such as ImageNet-C [ 13 ] . One particular property of image corruptions is that they are low-level distortions in nature . Corruptions are transformations of an image that affect structural information such as colors , textures , or geometry [ 5 ] and are typically free of high-level semantics . Therefore , it is natural to expect that data augmentation techniques , which expand the training set with random low-level transformations , can help learn robust models . Indeed , data augmentation has become a central technique in several recent methods [ 14 , 20 , 25 ] that achieve large improvements on ImageNet-C and related benchmarks . One caveat for data augmentation based approaches is the test corruptions are expected to be unknown at training time . If the corruptions are known , they may simply be applied to the training set as data augmentations to trivially adapt to the test distribution . Instead , an ideal robust model needs to be ∗This work completed as part of the Facebook AI residency program . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . robust to any valid corruption , including ones unseen in any previous benchmark . Of course , in practice the robustness of a model can only be evaluated approximately by measuring its corruption error on a representative corruption benchmark . To avoid trivial adaptation to the benchmark , recent works manually exclude test corruptions from the training augmentations . However , with a toy experiment presented in Figure 1 , we argue that this strategy alone might not be enough and that visually similar augmentation outputs and test corruptions can lead to significant benchmark improvements even if the exact corruption transformations are excluded . This observation raises two important questions . One , how exactly does the similarity between train time augmentations and corruptions of the test set affect the error ? And two , if the gains are due to the similarity , they may not translate into better robustness to other possible corruptions , so how well will data augmentations generalize beyond a given benchmark ? In this work , we take a step towards answering these questions , with the goal of better understanding the relationship between data augmentation and test-time corruptions . Using a feature space on image transforms and a new measure called Minimal Sample Distance ( MSD ) on this space , we are able to quantify the distance between augmentation schemes and classes of corruption transformation . With our approach , we empirically show an intuitive yet surprisingly overlooked finding : Augmentation-corruption perceptual similarity is a strong predictor of corruption error . Based on this finding , we perform additional experiments to show that data augmentation aids corruption robustness by increasing perceptual similarity between a ( possibly small ) fraction of the training data and the test set . To further support our claims , we introduce a set of new corruptions , called CIFAR/ImageNet-C , to test the degree to which common data augmentation methods generalize from the original CIFAR/ImageNet-C. To choose these corruptions , we expand the set of natural corruptions and sample new corruptions that are far away from CIFAR/ImageNet-C in our feature space for measuring perceptual similarity . We then demonstrate that augmentation schemes designed specifically to improve robustness show significantly degraded performance on CIFAR/ImageNet-C . Some augmentation schemes still show some improvement over baseline , which suggests meaningful progress towards general corruption robustness is being made , but different augmentation schemes exhibit different degrees of generalization capability . As an implication , caution is needed for fair robustness evaluations when additional data augmentation is introduced . These results suggest a major challenge that is often overlooked in the study of corruption robustness : generalization is often poor . Since perceptual similarity can predict performance , for any fixed finite set of test corruptions , improvements on that set may generalize poorly to dissimilar corruptions . We 3Example transforms are for illustrative purpose only and are exaggerated . Base image © Sehee Park . hope that these results , tools , and benchmarks will help researchers better understand why a given augmentation scheme has good corruption error and whether it should be expected to generalize to dissimilar corruptions . On the positive side , our experiments show that generalization does emerge among perceptually similar transforms , and that only a small fraction of sampled augmentations need to be similar to a given corruption . Section 6 discusses these points in more depth . 2 Related Work . Corruption robustness benchmarks and analysis . ImageNet-C [ 13 ] is a corruption dataset often used as a benchmark in robustness studies . Other corruption datasets [ 15 , 27 ] collect corrupted images from real world sources and thus have a mixture of semantic distribution shifts and perceptual transforms . Corruption robustness differs from adversarial robustness [ 31 ] , which seeks invariance to small , worst case distortions . One notable difference is that improving corruption robustness often slightly improves regular test error , instead of harming it . Yin et al . [ 38 ] analyzes corruption robustness in the context of transforms ’ frequency spectra ; this can also influence corruption error independently from perceptual similarity . Here we study the relationship between augmentations and corruptions more generically , and explore the relationship between perceptual similarity and generalization to new corruptions . Dao et al . [ 3 ] and Wu et al . [ 36 ] study the theory of data augmentation for regular test error . Hendrycks et al . [ 15 ] and Taori et al . [ 33 ] study how the performance on synthetic corruption transforms generalizes to performance on corruption datasets collected from the real world . Here we do not address this issue directly but touch upon it in the discussion . Improving corruption robustness . Data augmentations designed to improve robustness include AugMix [ 14 ] , which composites common image transforms , Patch Gaussian [ 20 ] , which applies Gaussian noise in square patches , and ANT [ 25 ] , which augments with an adversarially learned noise distribution . AutoAugment [ 2 ] learns augmentation policies that optimize clean error but has since been shown to improve corruption error [ 38 ] . Mixup [ 40 ] can improve robustness [ 18 ] , but its label augmentation complicates the dependence on image augmentation . Stylized-ImageNet [ 9 ] , which applies style transfer to input images , can also improve robustness . DeepAugment [ 15 ] , which applies augmentations to a deep representation of an image , can also give large improvements in robustness . Noisy Student [ 37 ] and Assemble-ResNet [ 18 ] combine data augmentation with new models and training procedures and greatly enhance corruption robustness . In addition to training-time methods , there are approaches that adapt to unseen corruptions at test time , e.g . using self-supervised tasks [ 30 ] , entropy minimization [ 35 ] , or with a focus on privacy and data transmission efficiency [ 19 ] . While we do not directly address these approaches here , our methods potentially provide tools that could be used to measure shifting distributions in an online regime . 3 Perceptual similarity for augmentations and corruptions . First , we study the importance of similarity between augmentations and corruptions for improving performance on those corruptions . To do so , we need a means to compare augmentations and corruptions . Both types of transforms are perceptual in nature , meaning they affect low-level image structure while leaving high-level semantic information intact , so we expect a good distance to be a measure of perceptual similarity . Then , we need to find the appropriate measure of distance between the augmentation and corruption distributions . We will argue below that distributional equivalence is not appropriate in the context of corruption robustness , and instead introduce the minimal sample distance , a simple measure that does capture a relevant sense of distribution distance . Measuring similarity between perceptual transforms . We define a perceptual transform as a transform that acts on low-level image structure but not high-level semantic information . As such , we expect two transforms should be similar if their actions on this low-level structure are similar , independent of algorithmic or per-pixel differences between them . A closely related , well-studied problem is the perceptual similarity between images . A common approach is to train a neural network on a classification task and use intermediate layers as a feature space for measuring distances [ 42 ] . We adapt this idea to obtain a feature space for measuring distances between perceptual transforms . We start with a feature extractor for images , which we call f̂ ( x ) . To train the model from which we will extract features , we assume access to a dataset D of image label pairs ( x , y ) associated with a classification task . The model should be trained using only default data augmentation for the task in question so that the feature extractor is independent of the transforms we will use it to study . In order to obtain a very simple measure , we use just the last hidden layer of the network as a feature space . A perceptual transform t ( x ) may be encoded by applying it to all images in D , encoding the transformed images , and averaging the features over these images . For efficiency , we find it sufficient to average over only a randomly sampled subset of images DS in D. In Section 4.1 we discuss the size of DS . The random choice of images is a property of the feature extractor , and so remains fixed when encoding multiple transforms . This reduces variance when computing distances between two transforms . The transform feature extractor is given by f ( t ) = Ex∈DS [ f̂ ( t ( x ) ) − f̂ ( x ) ] . The perceptual similarity between an augmentation and a corruption can be taken as the L2 distance on this feature space f . Minimal sample distance . We now seek to compare the distribution of an augmentation scheme pa to a distribution of a corruption benchmark pc . If the goal was to optimize error on a known corruption distribution , exact equivalence of distributions is the correct measure to minimize . But since the goal is robustness to general , unknown corruption distributions , a good augmentation scheme should be equivalent to no single corruption distribution . To illustrate this behavior , consider a toy problem where we have access to the corruption transforms at training time . A very rough , necessary-but-insufficient measure of distributional similarity is dMMD ( pa , pc ) = ||Ea∼pa [ f ( a ) ] − Ec∼pc [ f ( c ) ] || . This is the maximal mean discrepancy on a fixed , finite feature space , so for brevity we will refer to it as MMD . We still employ the featurization f ( t ) , since we are comparing transforms and not images , unlike in typical domain adaptation . Consider two corruption distributions , here impulse noise and motion blur , and an augmentation scheme that is a mixture of the two corruption distributions . Figure 2b shows MMD between the augmentation and impulse noise corruption scales linearly with mixing fraction , but error on impulse noise remains low until the mixing fraction is almost 0 % impulse noise . This implies distributional similarity is a poor predictor of corruption error . Indeed , low dMMD with any one corruption distribution suggests the augmentation overlaps it significantly , so the augmentation is unlikely to aid dissimilar corruptions . Our expectation for the behavior of the error in Figure 2b is that networks can often successfully memorize rare examples seen during training , so that only a very small fraction of sampled images need impulse noise augmentations to perform well on impulse noise corruptions . An appropriate distance should then measure how close augmentation samples can come to the corruption distribution , even if the density of those samples is low . We thus propose a very simple measure called minimal sample distance ( MSD ) , which is just the perceptual similarity between an average corruption and the closest augmentation from a finite set of samples A ∼ pa : dMSD ( pa , pc ) = min a∈A∼pa ||f ( a ) − Ec∼pc [ f ( c ) ] || . ( 1 ) Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 .8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 .2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Minimal Sample Distance C or ru pt io n Er ro r 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 Elastic Transform , Frost , 12 14 16 18 20 12 16 20 24 1.0 1.5 2.0 2.5 3.0 20 30 40 50 Zoom Blur , 0.4 0.8 1.2 1.6 10 15 20 25 Gaussian Noise , 6.0 6.5 7.0 7.5 0.10 0.14 0.18 0.22 Brightness , 10 15 20 25 0.6 0.8 1.0 1.2 Contrast , Figure 3 : Example relationships between MSD and corruption error . ρ is the Spearman rank correlation . MSD correlates well with error across all four categories of corruption in CIFAR-10-C. For completeness , we also show brightness , a negative example where correlation is poor . A schematic comparison of MMD and MSD is shown in Figure 2a . While both MMD and MSD are small for an augmentation scheme that is distributionally similar to a corruption distribution , only MSD remains small for a broad distribution that occasionally produces samples near multiple corruption distributions . Figure 2b shows MSD , like test error , is small for most mixing fractions in the toy problem described above . Note the measure ’ s need to accommodate robustness to general , unknown corruption distributions has led it to be asymmetric , so it differs from more formal distance metrics that may be used to predict generalization error , such as the Wasserstein distance [ 43 ] .
This paper proposes ImageNet-\bar{C} which uses a smaller number of carefully chosen corruptions, compared to ImageNet-C. The authors try to argue that previous work is overfitting to ImageNet-C. They claim "overfitting indeed occurs." Additionally, they propose "Minimum Sample Distance," showing that they can predict generalization performance using feature embedding distances.
SP:38b5e8808025e698744d9544e91d334ee6566fa2
Deep Data Flow Analysis
1 INTRODUCTION . Compiler implementation is a complex and expensive activity ( Cooper & Torczon , 2012 ) . For this reason , there has been significant interest in using machine learning to automate various compiler tasks ( Allamanis et al. , 2018 ) . Most works have restricted their attention to selecting compiler heuristics or making optimization decisions ( Ashouri et al. , 2018 ; Wang & O ’ Boyle , 2018 ) . Whether learned or engineered by human experts , these decisions naturally require reasoning about the program and its behavior . Human experts most often rely upon data flow analyses ( Kildall , 1973 ; Kam & Ullman , 1976 ) . These are algorithms on abstract interpretations of the program , propagating information of interest through the program ’ s control-flow graph until a fixed point is reached ( Kam & Ullman , 1977 ) . Two examples out of many data flow analyses are : liveness – determining when resources become dead ( unused ) and may be reclaimed ; and available expressions – discovering which expressions have been computed on all paths to points in the program . Prior machine learning works , on the other hand , have typically represented the entirety of the program ’ s behavior as a fixed-length , statically computed feature vector ( Ashouri et al. , 2018 ) . Typical feature values might be the number of instructions in a loop or the dependency depth . The weakness of these techniques is shown by the fact that they are trivially confused by the addition of dead code , which changes their feature vectors without changing the program ’ s behavior or its response to optimizations . Such learning algorithms are unable to learn their own abstract interpretations of the program and so can not avoid these pitfalls or more subtle versions thereof ( Barchi et al. , 2019 ) . Recently , there have been attempts to develop representations that allow finer-grain program reasoning . Many , however , are limited both by how inputs are represented as well as how inputs are processed . Representations based on source code and its direct artifacts ( e.g. , AST ) ( Alon et al. , 2018a ; Yin et al. , 2018 ; Haj-Ali et al. , 2020 ) put unnecessary emphasis on naming and stylistic choices that may not correlate with the functionality of the code ( e.g. , Fig . 2a ) . Approaches based on intermediate representations ( IR ) ( Ben-Nun et al. , 2018 ; Mirhoseini et al. , 2017 ; Brauckmann et al. , 2020 ) remove such noise but fail to capture information about the program that is important for analysis ( e.g. , Fig . 2b variables , Fig . 2c commutativity ) . In both cases , models are expected to reason about the flow of information in programs using representations that do not directly encode this information . Clearly , a program representation is needed that enables machine learning algorithms to reason about the execution of a program by developing its own data flow analyses . Since current approaches are ill-suited to program-wide data flow analysis , we propose overcoming their limitations by making the program ’ s control , data , and call dependencies a central part of the program ’ s representation and a primary consideration when processing it . We achieve this by seeing the program as a graph in which individual statements are connected to other statements through relational dependencies . Each statement in the program is understood only in the context of the statements interacting with it . Through relational reasoning ( Battaglia et al. , 2018 ) , a latent representation of each statement is learned that is a function of not just the statement itself , but also of the ( latent ) representations of its graph neighborhood . Notably , this formulation has a striking similarity to the IRs used by compilers , and the iterative propagation of information resembles the transfer functions and meet operators in traditional data flow analyses ( Kildall , 1973 ) . Recently proposed techniques for learning over graphs have shown promise in a number of domains ( Schlichtkrull et al. , 2018 ; Ziwei et al. , 2020 ) . With a suitable representation and graph-based model , we extend these approaches to the domain of compiler analysis , enabling downstream tasks built on top of such graph models to natively incorporate reasoning about data flow into their decision making . This improves performance on downstream tasks without requiring additional features . We make the following contributions : • We propose a portable , language-independent graph representation of programs derived from compiler IRs . PROGRAML is the first representation to capture whole-program control- , data- , and call relations between instructions and operands as well as their order and data types . PROGRAML is a compiler-agnostic design for use at all points in the optimization pipeline ; we provide implementations for LLVM and XLA IRs . • We introduce a benchmark dataset that poses a suite of established compiler analysis tasks as supervised machine learning problems . DEEPDATAFLOW comprises five tasks that require , in combination , the ability to model : control- and data-flow , function boundaries , instruction types , and the type and order of operands over complex programs . DEEPDATAFLOW is constructed from 461k real-world program IRs covering a diverse range of domains and source languages , totaling 8.5 billion data flow analysis classification labels . • We adapt Gated-Graph Neural Networks ( GGNN ) to the PROGRAML representation . We show that , within a bounded problem size , our approach achieves ≥ 0.939 F1 score on all analysis tasks , a significant improvement over state-of-the-art representations . In evaluating the limits of this approach we propose directions to better learn over programs . 2 RELATED WORK . Data flow analysis is a long established area of work firmly embedded in modern compilers . Despite its central role , there has been limited work in learning such analysis . Bielik et al . ( 2017 ) use ASTs and code synthesis to learn rule-sets for static analyses , some of which are dataflow-related . Our approach does not require a program generator or a hand-crafted DSL for rules . Shi et al . ( 2020 ) and Wang & Su ( 2020 ) use dynamic information ( e.g. , register snapshots and traces ) from instrumented binaries to embed an assembler graph representation . We propose a static approach that does not need runtime features . Si et al . ( 2018 ) use a graph embedding of an SSA form to generate invariants . The lack of phi nodes and function call/return edges means that the representation is not suitable for interprocedural analysis as it stands . Kanade et al . ( 2020 ) explore a large-scale , context-dependent vector embedding . This is done at a token level , however , and is unsuited for dataflow analysis . Prior work on learning over programs employed methods from Natural Language Processing that represented programs as a sequence of lexical tokens ( Allamanis , 2016 ; Cummins et al. , 2017a ) . However , source-level representations are not suited for analyzing partially optimized compiler IRs as the input source can not be recovered . In program analysis it is critical to capture the structured nature of programs ( Raychev et al. , 2015 ; Allamanis et al. , 2017 ; Alon et al. , 2018b ) . Thus , syntactic ( tree-based ) as well as semantic ( graph-based ) representations have been proposed ( Allamanis et al. , 2018 ; Brauckmann et al. , 2020 ) . Dam et al . ( 2018 ) annotate nodes in Abstract Syntax Trees ( ASTs ) with type information and employ Tree-Based LSTMs ( Tai et al. , 2015 ) for program defect prediction . Both Raychev et al . ( 2015 ) and Alon et al . ( 2018a ; b ) use path-based abstractions of the AST as program representations , while Allamanis et al . ( 2017 ) augment ASTs with a hand-crafted set of additional typed edges and use GGNNs ( Li et al. , 2015 ) to learn downstream tasks related to variable naming . Another line of research considers modelling binary similarity via control-flow graphs ( CFGs ) with an adaptation of GNNs called Graph Matching Networks ( Li et al. , 2019 ) . The history of IR-based graph representations for optimization goes back to Ferrante et al . ( 1987 ) , who remove superfluous control-flow edges to ease optimization with a compact graph representation . A more contemporary precursor to our approach is the ConteXtual Flow Graph ( XFG ) ( BenNun et al. , 2018 ) , which combines control-flow with data-flow relations in order to learn unsupervised embeddings of LLVM-IR statements . XFGs omit information that is critical to analysis including the notion of argument order , vertices for both variables and constants , and all control-flow edges . PROGRAML , in combining call-graphs ( CG ) , control-flow graphs , and data-flow graphs ( DFG ) , offers an IR-level program representation that is designed to be useful for a variety of purposes from specific program analyses to downstream optimization tasks . Control and Data Flow Graphs ( CDFG ) ( Brauckmann et al. , 2020 ) use graph vertices for statements and have bi-directional edges for control and data dependencies . The CDFG uses only the instruction opcode to represent a statement , omitting operands , variables , data types , and constants . This prohibits the reasoning about variables and expressions that are required for many data flow analyses , including 3 out of the 5 benchmark tasks that we establish below . Mendis et al . ( 2019 ) represent LLVM-IR using a graph that is specialized to a vectorization task . They use unique edge types to differentiate the first five operand positions and augment the graph structure with vectorization opportunities that they compute a priori . Our approach is not specialized to a task , enabling such opportunities learned ( e.g. , subexpression detection ) , and uses a embedding weighting to differentiate edge positions without having to learn separate edge transfer weights for each . Finally , an alternate approach is taken by IR2Vec ( Keerthy S et al. , 2019 ) , an LLVM-IR-specific representation that elegantly models part-ofstatements as relations . However , in order to compute the values of the embeddings , IR2Vec requires access to the type of data flow analyses that our approach learns from data alone . 3 A GRAPHICAL REPRESENTATION FOR DEEP PROGRAM ANALYSIS . This section presents PROGRAML , a novel IR-based program representation that closely matches the data structures used traditionally in inter-procedural data flow analysis and can be processed natively by deep learning models . We represent programs as directed multigraphs where instructions , variables , and constants are vertices , and relations between vertices are edges . Edges are typed to differentiate control- , data- , and call-flow . Additionally , we augment edges with a local position attribute to encode the order of operands to instructions , and to differentiate between divergent branches in control-flow . We construct a PROGRAML graph G = ( V , E ) by traversing a compiler IR . An initially empty graph G = ∅ is populated in three stages : control-flow , data-flow , and call-flow , shown in Figure 3 . In practice the three stages of graph construction can be combined in a single O ( |V |+ |E| ) pass . ( I ) Control Flow We construct the full-flow graph of an IR by inserting a vertex for each instruction and connecting control-flow edges ( Fig . 3a , 3b ) . Control edges are augmented with a numeric position using an ascending sequence based on their order in the list of an instruction ’ s successors . ( II ) Data Flow We introduce constant values and variables as graph vertices ( Fig . 3c ) . Dataflow edges are inserted to capture the relation from constants and variables to the instructions that use them as operands , and from instructions to produced variables . As each unique variable and constant is a vertex , variables can be distinguished by their scope , and unlike the source-level representations of prior works , variables in different scopes map to distinct vertices and can thus be discerned . Data edges have a position attribute that encodes the order of operands for instructions . The latent representation of a statement ( e.g. , % 1 = add i32 % 0 , 1 ) is thus a function of the vertex representing the instruction and the vertices of any operand variables or constants , modulated by their order in the list of operands . ( III ) Call Flow Call edges capture the relation between an instruction that calls a function and the entry instruction of the called function ( Fig . 3d ) . Return call edges are added from each of the terminal instructions of a function to the calling statement . Control edges do not span functions , such that an IR with functions F produces |F | disconnected subgraphs ( the same is not true for data edges which may cross function boundaries , e.g. , in the case of a global constant which is used across many parts of a program ) . For IRs that support external linkage , an additional vertex is created representing an external call site and connected to all externally visible functions . If a call site references a function not defined in the current IR , a dummy function is created consisting of a single instruction vertex and connected through call edges to all call sites in the current IR . A unique dummy function is created for each externally defined function .
The authors present a language-independent, compiler-agnostic graph representation of programs (ProGraML) designed for machine learning. Their representation is noteworthy for including the program's control, data, and call dependencies, and more generally for including enough information for standard dataflow analyses to be possible in principle. Their goal is to train machine learning systems on this representation to provide heuristics to replace manual heuristic-engineering inside compilers. The authors introduce a large benchmark dataset that poses several established compiler analysis tasks as supervised learning problems, and show that thanks to their well-designed program representation, established network architectures (i.e. Gated Graph Neural Networks) perform well on all analysis tasks. Perhaps more importantly though only a side note in the text, they show that GGNNs on ProGraML outperform prior approaches on two downstream tasks for which non-ML techniques are not perfect: device mappings and algorithm classification.
SP:54b8e490c922c62392b4b475ceec8b8d3ec65c7b
Deep Data Flow Analysis
1 INTRODUCTION . Compiler implementation is a complex and expensive activity ( Cooper & Torczon , 2012 ) . For this reason , there has been significant interest in using machine learning to automate various compiler tasks ( Allamanis et al. , 2018 ) . Most works have restricted their attention to selecting compiler heuristics or making optimization decisions ( Ashouri et al. , 2018 ; Wang & O ’ Boyle , 2018 ) . Whether learned or engineered by human experts , these decisions naturally require reasoning about the program and its behavior . Human experts most often rely upon data flow analyses ( Kildall , 1973 ; Kam & Ullman , 1976 ) . These are algorithms on abstract interpretations of the program , propagating information of interest through the program ’ s control-flow graph until a fixed point is reached ( Kam & Ullman , 1977 ) . Two examples out of many data flow analyses are : liveness – determining when resources become dead ( unused ) and may be reclaimed ; and available expressions – discovering which expressions have been computed on all paths to points in the program . Prior machine learning works , on the other hand , have typically represented the entirety of the program ’ s behavior as a fixed-length , statically computed feature vector ( Ashouri et al. , 2018 ) . Typical feature values might be the number of instructions in a loop or the dependency depth . The weakness of these techniques is shown by the fact that they are trivially confused by the addition of dead code , which changes their feature vectors without changing the program ’ s behavior or its response to optimizations . Such learning algorithms are unable to learn their own abstract interpretations of the program and so can not avoid these pitfalls or more subtle versions thereof ( Barchi et al. , 2019 ) . Recently , there have been attempts to develop representations that allow finer-grain program reasoning . Many , however , are limited both by how inputs are represented as well as how inputs are processed . Representations based on source code and its direct artifacts ( e.g. , AST ) ( Alon et al. , 2018a ; Yin et al. , 2018 ; Haj-Ali et al. , 2020 ) put unnecessary emphasis on naming and stylistic choices that may not correlate with the functionality of the code ( e.g. , Fig . 2a ) . Approaches based on intermediate representations ( IR ) ( Ben-Nun et al. , 2018 ; Mirhoseini et al. , 2017 ; Brauckmann et al. , 2020 ) remove such noise but fail to capture information about the program that is important for analysis ( e.g. , Fig . 2b variables , Fig . 2c commutativity ) . In both cases , models are expected to reason about the flow of information in programs using representations that do not directly encode this information . Clearly , a program representation is needed that enables machine learning algorithms to reason about the execution of a program by developing its own data flow analyses . Since current approaches are ill-suited to program-wide data flow analysis , we propose overcoming their limitations by making the program ’ s control , data , and call dependencies a central part of the program ’ s representation and a primary consideration when processing it . We achieve this by seeing the program as a graph in which individual statements are connected to other statements through relational dependencies . Each statement in the program is understood only in the context of the statements interacting with it . Through relational reasoning ( Battaglia et al. , 2018 ) , a latent representation of each statement is learned that is a function of not just the statement itself , but also of the ( latent ) representations of its graph neighborhood . Notably , this formulation has a striking similarity to the IRs used by compilers , and the iterative propagation of information resembles the transfer functions and meet operators in traditional data flow analyses ( Kildall , 1973 ) . Recently proposed techniques for learning over graphs have shown promise in a number of domains ( Schlichtkrull et al. , 2018 ; Ziwei et al. , 2020 ) . With a suitable representation and graph-based model , we extend these approaches to the domain of compiler analysis , enabling downstream tasks built on top of such graph models to natively incorporate reasoning about data flow into their decision making . This improves performance on downstream tasks without requiring additional features . We make the following contributions : • We propose a portable , language-independent graph representation of programs derived from compiler IRs . PROGRAML is the first representation to capture whole-program control- , data- , and call relations between instructions and operands as well as their order and data types . PROGRAML is a compiler-agnostic design for use at all points in the optimization pipeline ; we provide implementations for LLVM and XLA IRs . • We introduce a benchmark dataset that poses a suite of established compiler analysis tasks as supervised machine learning problems . DEEPDATAFLOW comprises five tasks that require , in combination , the ability to model : control- and data-flow , function boundaries , instruction types , and the type and order of operands over complex programs . DEEPDATAFLOW is constructed from 461k real-world program IRs covering a diverse range of domains and source languages , totaling 8.5 billion data flow analysis classification labels . • We adapt Gated-Graph Neural Networks ( GGNN ) to the PROGRAML representation . We show that , within a bounded problem size , our approach achieves ≥ 0.939 F1 score on all analysis tasks , a significant improvement over state-of-the-art representations . In evaluating the limits of this approach we propose directions to better learn over programs . 2 RELATED WORK . Data flow analysis is a long established area of work firmly embedded in modern compilers . Despite its central role , there has been limited work in learning such analysis . Bielik et al . ( 2017 ) use ASTs and code synthesis to learn rule-sets for static analyses , some of which are dataflow-related . Our approach does not require a program generator or a hand-crafted DSL for rules . Shi et al . ( 2020 ) and Wang & Su ( 2020 ) use dynamic information ( e.g. , register snapshots and traces ) from instrumented binaries to embed an assembler graph representation . We propose a static approach that does not need runtime features . Si et al . ( 2018 ) use a graph embedding of an SSA form to generate invariants . The lack of phi nodes and function call/return edges means that the representation is not suitable for interprocedural analysis as it stands . Kanade et al . ( 2020 ) explore a large-scale , context-dependent vector embedding . This is done at a token level , however , and is unsuited for dataflow analysis . Prior work on learning over programs employed methods from Natural Language Processing that represented programs as a sequence of lexical tokens ( Allamanis , 2016 ; Cummins et al. , 2017a ) . However , source-level representations are not suited for analyzing partially optimized compiler IRs as the input source can not be recovered . In program analysis it is critical to capture the structured nature of programs ( Raychev et al. , 2015 ; Allamanis et al. , 2017 ; Alon et al. , 2018b ) . Thus , syntactic ( tree-based ) as well as semantic ( graph-based ) representations have been proposed ( Allamanis et al. , 2018 ; Brauckmann et al. , 2020 ) . Dam et al . ( 2018 ) annotate nodes in Abstract Syntax Trees ( ASTs ) with type information and employ Tree-Based LSTMs ( Tai et al. , 2015 ) for program defect prediction . Both Raychev et al . ( 2015 ) and Alon et al . ( 2018a ; b ) use path-based abstractions of the AST as program representations , while Allamanis et al . ( 2017 ) augment ASTs with a hand-crafted set of additional typed edges and use GGNNs ( Li et al. , 2015 ) to learn downstream tasks related to variable naming . Another line of research considers modelling binary similarity via control-flow graphs ( CFGs ) with an adaptation of GNNs called Graph Matching Networks ( Li et al. , 2019 ) . The history of IR-based graph representations for optimization goes back to Ferrante et al . ( 1987 ) , who remove superfluous control-flow edges to ease optimization with a compact graph representation . A more contemporary precursor to our approach is the ConteXtual Flow Graph ( XFG ) ( BenNun et al. , 2018 ) , which combines control-flow with data-flow relations in order to learn unsupervised embeddings of LLVM-IR statements . XFGs omit information that is critical to analysis including the notion of argument order , vertices for both variables and constants , and all control-flow edges . PROGRAML , in combining call-graphs ( CG ) , control-flow graphs , and data-flow graphs ( DFG ) , offers an IR-level program representation that is designed to be useful for a variety of purposes from specific program analyses to downstream optimization tasks . Control and Data Flow Graphs ( CDFG ) ( Brauckmann et al. , 2020 ) use graph vertices for statements and have bi-directional edges for control and data dependencies . The CDFG uses only the instruction opcode to represent a statement , omitting operands , variables , data types , and constants . This prohibits the reasoning about variables and expressions that are required for many data flow analyses , including 3 out of the 5 benchmark tasks that we establish below . Mendis et al . ( 2019 ) represent LLVM-IR using a graph that is specialized to a vectorization task . They use unique edge types to differentiate the first five operand positions and augment the graph structure with vectorization opportunities that they compute a priori . Our approach is not specialized to a task , enabling such opportunities learned ( e.g. , subexpression detection ) , and uses a embedding weighting to differentiate edge positions without having to learn separate edge transfer weights for each . Finally , an alternate approach is taken by IR2Vec ( Keerthy S et al. , 2019 ) , an LLVM-IR-specific representation that elegantly models part-ofstatements as relations . However , in order to compute the values of the embeddings , IR2Vec requires access to the type of data flow analyses that our approach learns from data alone . 3 A GRAPHICAL REPRESENTATION FOR DEEP PROGRAM ANALYSIS . This section presents PROGRAML , a novel IR-based program representation that closely matches the data structures used traditionally in inter-procedural data flow analysis and can be processed natively by deep learning models . We represent programs as directed multigraphs where instructions , variables , and constants are vertices , and relations between vertices are edges . Edges are typed to differentiate control- , data- , and call-flow . Additionally , we augment edges with a local position attribute to encode the order of operands to instructions , and to differentiate between divergent branches in control-flow . We construct a PROGRAML graph G = ( V , E ) by traversing a compiler IR . An initially empty graph G = ∅ is populated in three stages : control-flow , data-flow , and call-flow , shown in Figure 3 . In practice the three stages of graph construction can be combined in a single O ( |V |+ |E| ) pass . ( I ) Control Flow We construct the full-flow graph of an IR by inserting a vertex for each instruction and connecting control-flow edges ( Fig . 3a , 3b ) . Control edges are augmented with a numeric position using an ascending sequence based on their order in the list of an instruction ’ s successors . ( II ) Data Flow We introduce constant values and variables as graph vertices ( Fig . 3c ) . Dataflow edges are inserted to capture the relation from constants and variables to the instructions that use them as operands , and from instructions to produced variables . As each unique variable and constant is a vertex , variables can be distinguished by their scope , and unlike the source-level representations of prior works , variables in different scopes map to distinct vertices and can thus be discerned . Data edges have a position attribute that encodes the order of operands for instructions . The latent representation of a statement ( e.g. , % 1 = add i32 % 0 , 1 ) is thus a function of the vertex representing the instruction and the vertices of any operand variables or constants , modulated by their order in the list of operands . ( III ) Call Flow Call edges capture the relation between an instruction that calls a function and the entry instruction of the called function ( Fig . 3d ) . Return call edges are added from each of the terminal instructions of a function to the calling statement . Control edges do not span functions , such that an IR with functions F produces |F | disconnected subgraphs ( the same is not true for data edges which may cross function boundaries , e.g. , in the case of a global constant which is used across many parts of a program ) . For IRs that support external linkage , an additional vertex is created representing an external call site and connected to all externally visible functions . If a call site references a function not defined in the current IR , a dummy function is created consisting of a single instruction vertex and connected through call edges to all call sites in the current IR . A unique dummy function is created for each externally defined function .
A methodology for learning representations of programs using graph neural networks applied to graphs extracted from a compiler intermediate representation is presented. The graph representation captures both control flow as well as data dependencies and also represents calls to/returns from functions. A large new dataset to evaluate if models can learn to perform dataflow analyses is introduced, and experimental results show that the described method can be trained to perform these with high accuracy (at least for small programs). Further experiments in the appendix illustrate that the proposed graph structure is also useful for more standard tasks that cannot be solved well using existing algorithms.
SP:54b8e490c922c62392b4b475ceec8b8d3ec65c7b
Deep Data Flow Analysis
1 INTRODUCTION . Compiler implementation is a complex and expensive activity ( Cooper & Torczon , 2012 ) . For this reason , there has been significant interest in using machine learning to automate various compiler tasks ( Allamanis et al. , 2018 ) . Most works have restricted their attention to selecting compiler heuristics or making optimization decisions ( Ashouri et al. , 2018 ; Wang & O ’ Boyle , 2018 ) . Whether learned or engineered by human experts , these decisions naturally require reasoning about the program and its behavior . Human experts most often rely upon data flow analyses ( Kildall , 1973 ; Kam & Ullman , 1976 ) . These are algorithms on abstract interpretations of the program , propagating information of interest through the program ’ s control-flow graph until a fixed point is reached ( Kam & Ullman , 1977 ) . Two examples out of many data flow analyses are : liveness – determining when resources become dead ( unused ) and may be reclaimed ; and available expressions – discovering which expressions have been computed on all paths to points in the program . Prior machine learning works , on the other hand , have typically represented the entirety of the program ’ s behavior as a fixed-length , statically computed feature vector ( Ashouri et al. , 2018 ) . Typical feature values might be the number of instructions in a loop or the dependency depth . The weakness of these techniques is shown by the fact that they are trivially confused by the addition of dead code , which changes their feature vectors without changing the program ’ s behavior or its response to optimizations . Such learning algorithms are unable to learn their own abstract interpretations of the program and so can not avoid these pitfalls or more subtle versions thereof ( Barchi et al. , 2019 ) . Recently , there have been attempts to develop representations that allow finer-grain program reasoning . Many , however , are limited both by how inputs are represented as well as how inputs are processed . Representations based on source code and its direct artifacts ( e.g. , AST ) ( Alon et al. , 2018a ; Yin et al. , 2018 ; Haj-Ali et al. , 2020 ) put unnecessary emphasis on naming and stylistic choices that may not correlate with the functionality of the code ( e.g. , Fig . 2a ) . Approaches based on intermediate representations ( IR ) ( Ben-Nun et al. , 2018 ; Mirhoseini et al. , 2017 ; Brauckmann et al. , 2020 ) remove such noise but fail to capture information about the program that is important for analysis ( e.g. , Fig . 2b variables , Fig . 2c commutativity ) . In both cases , models are expected to reason about the flow of information in programs using representations that do not directly encode this information . Clearly , a program representation is needed that enables machine learning algorithms to reason about the execution of a program by developing its own data flow analyses . Since current approaches are ill-suited to program-wide data flow analysis , we propose overcoming their limitations by making the program ’ s control , data , and call dependencies a central part of the program ’ s representation and a primary consideration when processing it . We achieve this by seeing the program as a graph in which individual statements are connected to other statements through relational dependencies . Each statement in the program is understood only in the context of the statements interacting with it . Through relational reasoning ( Battaglia et al. , 2018 ) , a latent representation of each statement is learned that is a function of not just the statement itself , but also of the ( latent ) representations of its graph neighborhood . Notably , this formulation has a striking similarity to the IRs used by compilers , and the iterative propagation of information resembles the transfer functions and meet operators in traditional data flow analyses ( Kildall , 1973 ) . Recently proposed techniques for learning over graphs have shown promise in a number of domains ( Schlichtkrull et al. , 2018 ; Ziwei et al. , 2020 ) . With a suitable representation and graph-based model , we extend these approaches to the domain of compiler analysis , enabling downstream tasks built on top of such graph models to natively incorporate reasoning about data flow into their decision making . This improves performance on downstream tasks without requiring additional features . We make the following contributions : • We propose a portable , language-independent graph representation of programs derived from compiler IRs . PROGRAML is the first representation to capture whole-program control- , data- , and call relations between instructions and operands as well as their order and data types . PROGRAML is a compiler-agnostic design for use at all points in the optimization pipeline ; we provide implementations for LLVM and XLA IRs . • We introduce a benchmark dataset that poses a suite of established compiler analysis tasks as supervised machine learning problems . DEEPDATAFLOW comprises five tasks that require , in combination , the ability to model : control- and data-flow , function boundaries , instruction types , and the type and order of operands over complex programs . DEEPDATAFLOW is constructed from 461k real-world program IRs covering a diverse range of domains and source languages , totaling 8.5 billion data flow analysis classification labels . • We adapt Gated-Graph Neural Networks ( GGNN ) to the PROGRAML representation . We show that , within a bounded problem size , our approach achieves ≥ 0.939 F1 score on all analysis tasks , a significant improvement over state-of-the-art representations . In evaluating the limits of this approach we propose directions to better learn over programs . 2 RELATED WORK . Data flow analysis is a long established area of work firmly embedded in modern compilers . Despite its central role , there has been limited work in learning such analysis . Bielik et al . ( 2017 ) use ASTs and code synthesis to learn rule-sets for static analyses , some of which are dataflow-related . Our approach does not require a program generator or a hand-crafted DSL for rules . Shi et al . ( 2020 ) and Wang & Su ( 2020 ) use dynamic information ( e.g. , register snapshots and traces ) from instrumented binaries to embed an assembler graph representation . We propose a static approach that does not need runtime features . Si et al . ( 2018 ) use a graph embedding of an SSA form to generate invariants . The lack of phi nodes and function call/return edges means that the representation is not suitable for interprocedural analysis as it stands . Kanade et al . ( 2020 ) explore a large-scale , context-dependent vector embedding . This is done at a token level , however , and is unsuited for dataflow analysis . Prior work on learning over programs employed methods from Natural Language Processing that represented programs as a sequence of lexical tokens ( Allamanis , 2016 ; Cummins et al. , 2017a ) . However , source-level representations are not suited for analyzing partially optimized compiler IRs as the input source can not be recovered . In program analysis it is critical to capture the structured nature of programs ( Raychev et al. , 2015 ; Allamanis et al. , 2017 ; Alon et al. , 2018b ) . Thus , syntactic ( tree-based ) as well as semantic ( graph-based ) representations have been proposed ( Allamanis et al. , 2018 ; Brauckmann et al. , 2020 ) . Dam et al . ( 2018 ) annotate nodes in Abstract Syntax Trees ( ASTs ) with type information and employ Tree-Based LSTMs ( Tai et al. , 2015 ) for program defect prediction . Both Raychev et al . ( 2015 ) and Alon et al . ( 2018a ; b ) use path-based abstractions of the AST as program representations , while Allamanis et al . ( 2017 ) augment ASTs with a hand-crafted set of additional typed edges and use GGNNs ( Li et al. , 2015 ) to learn downstream tasks related to variable naming . Another line of research considers modelling binary similarity via control-flow graphs ( CFGs ) with an adaptation of GNNs called Graph Matching Networks ( Li et al. , 2019 ) . The history of IR-based graph representations for optimization goes back to Ferrante et al . ( 1987 ) , who remove superfluous control-flow edges to ease optimization with a compact graph representation . A more contemporary precursor to our approach is the ConteXtual Flow Graph ( XFG ) ( BenNun et al. , 2018 ) , which combines control-flow with data-flow relations in order to learn unsupervised embeddings of LLVM-IR statements . XFGs omit information that is critical to analysis including the notion of argument order , vertices for both variables and constants , and all control-flow edges . PROGRAML , in combining call-graphs ( CG ) , control-flow graphs , and data-flow graphs ( DFG ) , offers an IR-level program representation that is designed to be useful for a variety of purposes from specific program analyses to downstream optimization tasks . Control and Data Flow Graphs ( CDFG ) ( Brauckmann et al. , 2020 ) use graph vertices for statements and have bi-directional edges for control and data dependencies . The CDFG uses only the instruction opcode to represent a statement , omitting operands , variables , data types , and constants . This prohibits the reasoning about variables and expressions that are required for many data flow analyses , including 3 out of the 5 benchmark tasks that we establish below . Mendis et al . ( 2019 ) represent LLVM-IR using a graph that is specialized to a vectorization task . They use unique edge types to differentiate the first five operand positions and augment the graph structure with vectorization opportunities that they compute a priori . Our approach is not specialized to a task , enabling such opportunities learned ( e.g. , subexpression detection ) , and uses a embedding weighting to differentiate edge positions without having to learn separate edge transfer weights for each . Finally , an alternate approach is taken by IR2Vec ( Keerthy S et al. , 2019 ) , an LLVM-IR-specific representation that elegantly models part-ofstatements as relations . However , in order to compute the values of the embeddings , IR2Vec requires access to the type of data flow analyses that our approach learns from data alone . 3 A GRAPHICAL REPRESENTATION FOR DEEP PROGRAM ANALYSIS . This section presents PROGRAML , a novel IR-based program representation that closely matches the data structures used traditionally in inter-procedural data flow analysis and can be processed natively by deep learning models . We represent programs as directed multigraphs where instructions , variables , and constants are vertices , and relations between vertices are edges . Edges are typed to differentiate control- , data- , and call-flow . Additionally , we augment edges with a local position attribute to encode the order of operands to instructions , and to differentiate between divergent branches in control-flow . We construct a PROGRAML graph G = ( V , E ) by traversing a compiler IR . An initially empty graph G = ∅ is populated in three stages : control-flow , data-flow , and call-flow , shown in Figure 3 . In practice the three stages of graph construction can be combined in a single O ( |V |+ |E| ) pass . ( I ) Control Flow We construct the full-flow graph of an IR by inserting a vertex for each instruction and connecting control-flow edges ( Fig . 3a , 3b ) . Control edges are augmented with a numeric position using an ascending sequence based on their order in the list of an instruction ’ s successors . ( II ) Data Flow We introduce constant values and variables as graph vertices ( Fig . 3c ) . Dataflow edges are inserted to capture the relation from constants and variables to the instructions that use them as operands , and from instructions to produced variables . As each unique variable and constant is a vertex , variables can be distinguished by their scope , and unlike the source-level representations of prior works , variables in different scopes map to distinct vertices and can thus be discerned . Data edges have a position attribute that encodes the order of operands for instructions . The latent representation of a statement ( e.g. , % 1 = add i32 % 0 , 1 ) is thus a function of the vertex representing the instruction and the vertices of any operand variables or constants , modulated by their order in the list of operands . ( III ) Call Flow Call edges capture the relation between an instruction that calls a function and the entry instruction of the called function ( Fig . 3d ) . Return call edges are added from each of the terminal instructions of a function to the calling statement . Control edges do not span functions , such that an IR with functions F produces |F | disconnected subgraphs ( the same is not true for data edges which may cross function boundaries , e.g. , in the case of a global constant which is used across many parts of a program ) . For IRs that support external linkage , an additional vertex is created representing an external call site and connected to all externally visible functions . If a call site references a function not defined in the current IR , a dummy function is created consisting of a single instruction vertex and connected through call edges to all call sites in the current IR . A unique dummy function is created for each externally defined function .
The paper proposes a new program representation to find semantic code embeddings (ProGraML). The authors use these embeddings to perform a number of traditional dataflow analysis tasks that you can find in modern day compilers. When trained under a supervised learning setting, Deep Data Flow (DDF) analysis learns to perform these tasks more accurately compared to other deep program representations.
SP:54b8e490c922c62392b4b475ceec8b8d3ec65c7b
Optimal Transport Graph Neural Networks
Current graph neural network ( GNN ) architectures naively average or sum node embeddings into an aggregated graph representation—potentially losing structural or semantic information . We here introduce OT-GNN , a model that computes graph embeddings using parametric prototypes that highlight key facets of different graph aspects . Towards this goal , we are ( to our knowledge ) the first to successfully combine optimal transport ( OT ) with parametric graph models . Graph representations are obtained from Wasserstein distances between the set of GNN node embeddings and “ prototype ” point clouds as free parameters . We theoretically prove that , unlike traditional sum aggregation , our function class on point clouds satisfies a fundamental universal approximation theorem . Empirically , we address an inherent collapse optimization issue by proposing a noise contrastive regularizer to steer the model towards truly exploiting the optimal transport geometry . Finally , we consistently report better generalization performance on several molecular property prediction tasks , while exhibiting smoother graph representations . 1 INTRODUCTION . Recently , there has been considerable interest in developing learning algorithms for structured data such as graphs . For example , molecular property prediction has many applications in chemistry and drug discovery ( Yang et al. , 2019 ; Vamathevan et al. , 2019 ) . Historically , graphs were decomposed into features such as molecular fingerprints , or turned into non-parametric graph kernels ( Vishwanathan et al. , 2010 ; Shervashidze et al. , 2011 ) . More recently , learned representations via graph neural networks ( GNNs ) have achieved state-of-the-art on graph prediction tasks ( Duvenaud et al. , 2015 ; Defferrard et al. , 2016 ; Kipf & Welling , 2017 ; Yang et al. , 2019 ) . Despite these successes , graph neural networks are often underutilized in whole graph prediction tasks such as molecule property prediction . Specifically , while GNNs produce node embeddings for each atom in the molecule , these are typically aggregated via simple operations such as a sum or average , turning the molecule into a single vector prior to classification or regression . As a result , some of the information naturally extracted by node embeddings may be lost . Departing from this simple aggregation step , Togninalli et al . ( 2019 ) recently proposed a kernel function over graphs by directly comparing non-parametric node embeddings as point clouds through optimal transport ( Wasserstein distance ) . Their non-parametric model yields better empirical performance over popular graph kernels , but this idea hasn ’ t been extended to the more challenging parametric case where optimization difficulties have to be reconciled with the combinatorial aspects of optimal transport solvers . Motivated by these observations and drawing inspiration from prior work on prototype learning ( appendix F ) , we introduce a new class of GNNs where the key representational step consists of comparing each input graph to a set of abstract prototypes ( fig . 1 ) . These prototypes play the role of basis functions ; they are stored as point clouds as if they were encoded from actual real graphs . Each input graph is first encoded into a set of node embeddings using any existing GNN architecture . We then compare this resulting embedding point cloud to the prototype embedding sets . Formally , the distance between two point clouds is measured by their optimal transport Wasserstein distances . The prototypes as abstract basis functions can be understood as keys that highlight property values associated with different graph structural features . In contrast to previous kernel methods , the prototypes are learned together with the GNN parameters in an end-to-end manner . Our notion of prototypes is inspired from the vast prior work on prototype learning which we highlight in appendix F. In our case , prototypes are not required to be the mean of a cluster of data , but instead they are entities living in the data embedding space that capture helpful information for the task under consideration . The closest analogy are the centers of radial basis function networks ( Chen et al. , 1991 ; Poggio & Girosi , 1990 ) , but we also inspire from learning vector quantization approaches ( Kohonen , 1995 ) and prototypical networks ( Snell et al. , 2017 ) . Our model improves upon traditional aggregation by explicitly tapping into the full set of node embeddings without collapsing them first to a single vector . We theoretically prove that , unlike standard GNN aggregation , our model defines a class of set functions that is a universal approximator . Introducing prototype points clouds as free parameters trained using combinatorial optimal transport solvers creates a challenging optimization problem . Indeed , as the models are trained end-to-end , the primary signal is initially available only in aggregate form . If trained as is , the prototypes often collapse to single points , reducing the Wasserstein distance between point clouds to Euclidean comparisons of their means . To counter this effect , we introduce a contrastive regularizer which effectively prevents the model from collapsing ( Section 3.2 ) . We demonstrate its merits empirically . Our contributions . First , we introduce an efficiently trainable class of graph neural networks enhanced with optimal transport ( OT ) primitives for computing graph representations based on relations with abstract prototypes . Second , we are the first to successfully train parametric graph models together with combinatorial OT distances , despite optimization difficulties . A key element is our noise contrastive regularizer that prevents the model from collapsing back to standard summation , thus fully exploiting the OT geometry . Third , we provide a theoretical justification of the increased representational power compared to the standard GNN aggregation method . Finally , our model shows consistent empirical improvements over previous state-of-the-art on molecular datasets , yielding also smoother graph embedding spaces . 2 PRELIMINARIES . 2.1 DIRECTED MESSAGE PASSING NEURAL NETWORKS ( D-MPNN ) . We briefly remind here of the simplified D-MPNN ( Dai et al. , 2016 ) architecture which was adapted for state-of-the-art molecular property prediction by Yang et al . ( 2019 ) . This model takes as input a directed graph G = ( V , E ) , with node and edge features denoted by xv and evw respectively , for v , w in the vertex set V and v → w in the edge set E. The parameters of D-MPNN are the matrices { Wi , Wm , Wo } . It keeps track of messages mtvw and hidden states htvw for each step t , defined as follows . An initial hidden state is set to h0vw : = ReLU ( Wicat ( xv , evw ) ) where “ cat ” denotes concatenation . Then , the updates are : mt+1vw = ∑ k∈N ( v ) \ { w } htkv , h t+1 vw = ReLU ( h 0 vw + Wmm t+1 vw ) , ( 1 ) where N ( v ) = { k ∈ V | ( k , v ) ∈ E } denotes v ’ s incoming neighbors . After T steps of message passing , node embeddings are obtained by summing edge embeddings : mv = ∑ w∈N ( v ) hTvw , hv = ReLU ( Wocat ( xv , mv ) ) . ( 2 ) A final graph embedding is then obtained as h = ∑ v∈V hv , which is usually fed to a multilayer perceptron ( MLP ) for classification or regression . 2.2 OPTIMAL TRANSPORT GEOMETRY . Optimal Transport ( Peyré et al. , 2019 ) is a mathematical framework that defines distances or similarities between objects such as probability distributions , either discrete or continuous , as the cost of an optimal transport plan from one to the other . Wasserstein distance for point clouds . Let a point cloud X = { xi } ni=1 of size n be a set of n points xi ∈ Rd . Given point clouds X , Y of respective sizes n , m , a transport plan ( or coupling ) is a matrix T of size n ×m with entries in [ 0 , 1 ] , satisfying the two following marginal constraints : T1m = 1 n1n and T T1n = 1 m1m . Intuitively , the marginal constraints mean that T preserves the mass from X to Y . We denote the set of such couplings as CXY . Given a cost function c on Rd , its associated Wasserstein discrepancy is defined as W ( X , Y ) = min T∈CXY ∑ ij Tijc ( xi , yj ) . ( 3 ) We further describe the shape of optimal transports for point clouds of same sizes in Appendix B.3 . 3 MODEL & PRACTICE . 3.1 ARCHITECTURE ENHANCEMENT . Reformulating standard architectures . As mentioned at the end of Section 2.1 , the final graph embedding h = ∑ v∈V hv obtained by aggregating node embeddings is usually fed to a MLP performing a matrix-multiplication whose i-th component is ( Rh ) i = 〈ri , h〉 , where ri is the i-th row of matrix R. Replacing 〈· , ·〉 by a distance/kernel k ( · , · ) allows the processing of more general graph representations than just vectors in Rd , such as point clouds or adjacency tensors . From a single point to a point cloud . We propose to replace the aggregated graph embedding h = ∑ v∈V hv by the point cloud ( of unaggregated node embeddings ) H = { hv } v∈V , and the inner-products 〈h , ri〉 by the below written Wasserstein discrepancy : W ( H , Qi ) : = min T∈CHQi ∑ vj Tvjc ( hv , q j i ) , ( 4 ) where Qi = { qji } j∈ { 1 , ... , N } , ∀i ∈ { 1 , . . . , M } represent M prototype point clouds each being represented as a set of N embeddings as free trainable parameters , and the cost is chosen as c = ‖ · − · ‖22 or c = −〈· , ·〉 . Note that both options yield identical optimal transport plans . Greater representational power . We formulate mathematically in Section 4 that this kernel has a strictly greater representational power than the kernel corresponding to standard inner-product on top of a sum aggregation , to distinguish between different point clouds . Final architecture . Finally , the vector of all Wasserstein distances in eq . ( 4 ) becomes the input to a final MLP with a single scalar as output . This can then be used as the prediction for various downstream tasks . This model is depicted in fig . 1 and motivated theoretically in section 4.1 . 3.2 CONTRASTIVE REGULARIZATION . What would happen toW ( H , Qi ) if all points qji belonging to point cloud Qi would collapse to the same point qi ? All transport plans would yield the same cost , giving for c = −〈· , ·〉 : W ( H , Qi ) = − ∑ vj Tvj〈hv , qji 〉 = −〈h , qi/|V |〉 . ( 5 ) In this scenario , our proposition would simply over-parametrize the standard Euclidean model . A first obstacle and its cause . Our first empirical trials with OT-enhanced GNNs showed that a model trained with only the Wasserstein component would sometimes perform similarly to the Euclidean baseline in both train and validation settings , in spite of its greater representational power . Further investigation revealed that the Wasserstein model would naturally displace the points in each of its prototype point clouds in such a way that the optimal transport plan T obtained by maximizing∑ vj Tvj〈hv , q j i 〉 was not discriminative , i.e . many other transports would yield a similar Wasserstein cost . Indeed , as shown in Eq . ( 5 ) , if each point cloud collapses to its mean , then the Wasserstein geometry collaspses to Euclidean geometry . In this scenario , any transport plan yields the same Wasserstein cost . Further explanations are provided in Appendix A.1 and Figure 3 .. Contrastive regularization . To address this difficulty , we consider adding a regularizer which encourages the model to displace its prototype point clouds such that the optimal transport plans would be discriminative against chosen contrastive transport plans . Namely , consider a point cloud Y of node embeddings and let Ti be an optimal transport plan obtained in the computation of W ( Y , Qi ) . For each Ti , we then build a set Neg ( Ti ) ⊂ CYQi of noisy/contrastive transports . If we denote byWT ( X , Y ) : = ∑ kl Tklc ( xk , yl ) the Wasserstein cost obtained for the particular transport T , then our contrastive regularization consists in maximizing the term : ∑ i log ( e−WTi ( Y , Qi ) e−WTi ( Y , Qi ) + ∑ T∈Neg ( Ti ) e −WT ( Y , Qi ) ) , ( 6 ) which can be interpreted as the log-likelihood that the correct transport Ti be ( as it should ) a better minimizer ofWT ( Y , Qi ) than its negative samples . This can be considered as an approximation of log ( Pr ( Ti | Y , Qi ) ) , where the partition function is approximated by our selection of negative examples , as done e.g . by Nickel & Kiela ( 2017 ) . Its effect is shown in Figure 3 . Remarks . The selection of negative examples should reflect the trade-off : ( i ) to not be too large , for computational efficiency while ( ii ) containing sufficiently meaningful and challenging contrastive samples . Details about choice of contrastive samples are given in Appendix A.2 . Note that replacing the set Neg ( Ti ) with a singleton { T } for a contrastive random variable T lets us rewrite Eq . ( 6 ) as1∑ i log σ ( WT −WTi ) , reminiscent of noise contrastive estimation ( Gutmann & Hyvärinen , 2010 ) .
The paper introduces a novel approach to aggregate information of graph neural network node embeddings in order to support graph-level machine learning, like graph classification or graph regression. The aggregation is performed by comparing the node embeddings of a graph to learned, prototypical node embeddings via the Wasserstein distance. The vector of distances to the prototypes then serves as a concise representation that can be fed into a subsequent standard multi-layer perceptron for classification or regression. This approach is proven to be strictly more powerful than just adding up the node embeddings, which is the most common state-of-the-art. Finally, the paper evaluates the proposed aggregation function on two graph classification and two graph regression data sets, showing superior performance in all cases.
SP:d4a4b5024e975d9321a8cd123c64f4220e38b990
Optimal Transport Graph Neural Networks
Current graph neural network ( GNN ) architectures naively average or sum node embeddings into an aggregated graph representation—potentially losing structural or semantic information . We here introduce OT-GNN , a model that computes graph embeddings using parametric prototypes that highlight key facets of different graph aspects . Towards this goal , we are ( to our knowledge ) the first to successfully combine optimal transport ( OT ) with parametric graph models . Graph representations are obtained from Wasserstein distances between the set of GNN node embeddings and “ prototype ” point clouds as free parameters . We theoretically prove that , unlike traditional sum aggregation , our function class on point clouds satisfies a fundamental universal approximation theorem . Empirically , we address an inherent collapse optimization issue by proposing a noise contrastive regularizer to steer the model towards truly exploiting the optimal transport geometry . Finally , we consistently report better generalization performance on several molecular property prediction tasks , while exhibiting smoother graph representations . 1 INTRODUCTION . Recently , there has been considerable interest in developing learning algorithms for structured data such as graphs . For example , molecular property prediction has many applications in chemistry and drug discovery ( Yang et al. , 2019 ; Vamathevan et al. , 2019 ) . Historically , graphs were decomposed into features such as molecular fingerprints , or turned into non-parametric graph kernels ( Vishwanathan et al. , 2010 ; Shervashidze et al. , 2011 ) . More recently , learned representations via graph neural networks ( GNNs ) have achieved state-of-the-art on graph prediction tasks ( Duvenaud et al. , 2015 ; Defferrard et al. , 2016 ; Kipf & Welling , 2017 ; Yang et al. , 2019 ) . Despite these successes , graph neural networks are often underutilized in whole graph prediction tasks such as molecule property prediction . Specifically , while GNNs produce node embeddings for each atom in the molecule , these are typically aggregated via simple operations such as a sum or average , turning the molecule into a single vector prior to classification or regression . As a result , some of the information naturally extracted by node embeddings may be lost . Departing from this simple aggregation step , Togninalli et al . ( 2019 ) recently proposed a kernel function over graphs by directly comparing non-parametric node embeddings as point clouds through optimal transport ( Wasserstein distance ) . Their non-parametric model yields better empirical performance over popular graph kernels , but this idea hasn ’ t been extended to the more challenging parametric case where optimization difficulties have to be reconciled with the combinatorial aspects of optimal transport solvers . Motivated by these observations and drawing inspiration from prior work on prototype learning ( appendix F ) , we introduce a new class of GNNs where the key representational step consists of comparing each input graph to a set of abstract prototypes ( fig . 1 ) . These prototypes play the role of basis functions ; they are stored as point clouds as if they were encoded from actual real graphs . Each input graph is first encoded into a set of node embeddings using any existing GNN architecture . We then compare this resulting embedding point cloud to the prototype embedding sets . Formally , the distance between two point clouds is measured by their optimal transport Wasserstein distances . The prototypes as abstract basis functions can be understood as keys that highlight property values associated with different graph structural features . In contrast to previous kernel methods , the prototypes are learned together with the GNN parameters in an end-to-end manner . Our notion of prototypes is inspired from the vast prior work on prototype learning which we highlight in appendix F. In our case , prototypes are not required to be the mean of a cluster of data , but instead they are entities living in the data embedding space that capture helpful information for the task under consideration . The closest analogy are the centers of radial basis function networks ( Chen et al. , 1991 ; Poggio & Girosi , 1990 ) , but we also inspire from learning vector quantization approaches ( Kohonen , 1995 ) and prototypical networks ( Snell et al. , 2017 ) . Our model improves upon traditional aggregation by explicitly tapping into the full set of node embeddings without collapsing them first to a single vector . We theoretically prove that , unlike standard GNN aggregation , our model defines a class of set functions that is a universal approximator . Introducing prototype points clouds as free parameters trained using combinatorial optimal transport solvers creates a challenging optimization problem . Indeed , as the models are trained end-to-end , the primary signal is initially available only in aggregate form . If trained as is , the prototypes often collapse to single points , reducing the Wasserstein distance between point clouds to Euclidean comparisons of their means . To counter this effect , we introduce a contrastive regularizer which effectively prevents the model from collapsing ( Section 3.2 ) . We demonstrate its merits empirically . Our contributions . First , we introduce an efficiently trainable class of graph neural networks enhanced with optimal transport ( OT ) primitives for computing graph representations based on relations with abstract prototypes . Second , we are the first to successfully train parametric graph models together with combinatorial OT distances , despite optimization difficulties . A key element is our noise contrastive regularizer that prevents the model from collapsing back to standard summation , thus fully exploiting the OT geometry . Third , we provide a theoretical justification of the increased representational power compared to the standard GNN aggregation method . Finally , our model shows consistent empirical improvements over previous state-of-the-art on molecular datasets , yielding also smoother graph embedding spaces . 2 PRELIMINARIES . 2.1 DIRECTED MESSAGE PASSING NEURAL NETWORKS ( D-MPNN ) . We briefly remind here of the simplified D-MPNN ( Dai et al. , 2016 ) architecture which was adapted for state-of-the-art molecular property prediction by Yang et al . ( 2019 ) . This model takes as input a directed graph G = ( V , E ) , with node and edge features denoted by xv and evw respectively , for v , w in the vertex set V and v → w in the edge set E. The parameters of D-MPNN are the matrices { Wi , Wm , Wo } . It keeps track of messages mtvw and hidden states htvw for each step t , defined as follows . An initial hidden state is set to h0vw : = ReLU ( Wicat ( xv , evw ) ) where “ cat ” denotes concatenation . Then , the updates are : mt+1vw = ∑ k∈N ( v ) \ { w } htkv , h t+1 vw = ReLU ( h 0 vw + Wmm t+1 vw ) , ( 1 ) where N ( v ) = { k ∈ V | ( k , v ) ∈ E } denotes v ’ s incoming neighbors . After T steps of message passing , node embeddings are obtained by summing edge embeddings : mv = ∑ w∈N ( v ) hTvw , hv = ReLU ( Wocat ( xv , mv ) ) . ( 2 ) A final graph embedding is then obtained as h = ∑ v∈V hv , which is usually fed to a multilayer perceptron ( MLP ) for classification or regression . 2.2 OPTIMAL TRANSPORT GEOMETRY . Optimal Transport ( Peyré et al. , 2019 ) is a mathematical framework that defines distances or similarities between objects such as probability distributions , either discrete or continuous , as the cost of an optimal transport plan from one to the other . Wasserstein distance for point clouds . Let a point cloud X = { xi } ni=1 of size n be a set of n points xi ∈ Rd . Given point clouds X , Y of respective sizes n , m , a transport plan ( or coupling ) is a matrix T of size n ×m with entries in [ 0 , 1 ] , satisfying the two following marginal constraints : T1m = 1 n1n and T T1n = 1 m1m . Intuitively , the marginal constraints mean that T preserves the mass from X to Y . We denote the set of such couplings as CXY . Given a cost function c on Rd , its associated Wasserstein discrepancy is defined as W ( X , Y ) = min T∈CXY ∑ ij Tijc ( xi , yj ) . ( 3 ) We further describe the shape of optimal transports for point clouds of same sizes in Appendix B.3 . 3 MODEL & PRACTICE . 3.1 ARCHITECTURE ENHANCEMENT . Reformulating standard architectures . As mentioned at the end of Section 2.1 , the final graph embedding h = ∑ v∈V hv obtained by aggregating node embeddings is usually fed to a MLP performing a matrix-multiplication whose i-th component is ( Rh ) i = 〈ri , h〉 , where ri is the i-th row of matrix R. Replacing 〈· , ·〉 by a distance/kernel k ( · , · ) allows the processing of more general graph representations than just vectors in Rd , such as point clouds or adjacency tensors . From a single point to a point cloud . We propose to replace the aggregated graph embedding h = ∑ v∈V hv by the point cloud ( of unaggregated node embeddings ) H = { hv } v∈V , and the inner-products 〈h , ri〉 by the below written Wasserstein discrepancy : W ( H , Qi ) : = min T∈CHQi ∑ vj Tvjc ( hv , q j i ) , ( 4 ) where Qi = { qji } j∈ { 1 , ... , N } , ∀i ∈ { 1 , . . . , M } represent M prototype point clouds each being represented as a set of N embeddings as free trainable parameters , and the cost is chosen as c = ‖ · − · ‖22 or c = −〈· , ·〉 . Note that both options yield identical optimal transport plans . Greater representational power . We formulate mathematically in Section 4 that this kernel has a strictly greater representational power than the kernel corresponding to standard inner-product on top of a sum aggregation , to distinguish between different point clouds . Final architecture . Finally , the vector of all Wasserstein distances in eq . ( 4 ) becomes the input to a final MLP with a single scalar as output . This can then be used as the prediction for various downstream tasks . This model is depicted in fig . 1 and motivated theoretically in section 4.1 . 3.2 CONTRASTIVE REGULARIZATION . What would happen toW ( H , Qi ) if all points qji belonging to point cloud Qi would collapse to the same point qi ? All transport plans would yield the same cost , giving for c = −〈· , ·〉 : W ( H , Qi ) = − ∑ vj Tvj〈hv , qji 〉 = −〈h , qi/|V |〉 . ( 5 ) In this scenario , our proposition would simply over-parametrize the standard Euclidean model . A first obstacle and its cause . Our first empirical trials with OT-enhanced GNNs showed that a model trained with only the Wasserstein component would sometimes perform similarly to the Euclidean baseline in both train and validation settings , in spite of its greater representational power . Further investigation revealed that the Wasserstein model would naturally displace the points in each of its prototype point clouds in such a way that the optimal transport plan T obtained by maximizing∑ vj Tvj〈hv , q j i 〉 was not discriminative , i.e . many other transports would yield a similar Wasserstein cost . Indeed , as shown in Eq . ( 5 ) , if each point cloud collapses to its mean , then the Wasserstein geometry collaspses to Euclidean geometry . In this scenario , any transport plan yields the same Wasserstein cost . Further explanations are provided in Appendix A.1 and Figure 3 .. Contrastive regularization . To address this difficulty , we consider adding a regularizer which encourages the model to displace its prototype point clouds such that the optimal transport plans would be discriminative against chosen contrastive transport plans . Namely , consider a point cloud Y of node embeddings and let Ti be an optimal transport plan obtained in the computation of W ( Y , Qi ) . For each Ti , we then build a set Neg ( Ti ) ⊂ CYQi of noisy/contrastive transports . If we denote byWT ( X , Y ) : = ∑ kl Tklc ( xk , yl ) the Wasserstein cost obtained for the particular transport T , then our contrastive regularization consists in maximizing the term : ∑ i log ( e−WTi ( Y , Qi ) e−WTi ( Y , Qi ) + ∑ T∈Neg ( Ti ) e −WT ( Y , Qi ) ) , ( 6 ) which can be interpreted as the log-likelihood that the correct transport Ti be ( as it should ) a better minimizer ofWT ( Y , Qi ) than its negative samples . This can be considered as an approximation of log ( Pr ( Ti | Y , Qi ) ) , where the partition function is approximated by our selection of negative examples , as done e.g . by Nickel & Kiela ( 2017 ) . Its effect is shown in Figure 3 . Remarks . The selection of negative examples should reflect the trade-off : ( i ) to not be too large , for computational efficiency while ( ii ) containing sufficiently meaningful and challenging contrastive samples . Details about choice of contrastive samples are given in Appendix A.2 . Note that replacing the set Neg ( Ti ) with a singleton { T } for a contrastive random variable T lets us rewrite Eq . ( 6 ) as1∑ i log σ ( WT −WTi ) , reminiscent of noise contrastive estimation ( Gutmann & Hyvärinen , 2010 ) .
This paper combines OT with parametric graph neural network. It replace the inner product between the graph embedding and the first layer weights of MLP by the Wasserstein distance between the node embeddings and some point clouds. Then the GNN, point clouds and the downstream MLP are trained in an end-to-end way. A regularization term is adopted to enforce the point clouds are not collapsed. The authors then theoretically show that the Wasserstein kernel is universal.
SP:d4a4b5024e975d9321a8cd123c64f4220e38b990
Optimal Transport Graph Neural Networks
Current graph neural network ( GNN ) architectures naively average or sum node embeddings into an aggregated graph representation—potentially losing structural or semantic information . We here introduce OT-GNN , a model that computes graph embeddings using parametric prototypes that highlight key facets of different graph aspects . Towards this goal , we are ( to our knowledge ) the first to successfully combine optimal transport ( OT ) with parametric graph models . Graph representations are obtained from Wasserstein distances between the set of GNN node embeddings and “ prototype ” point clouds as free parameters . We theoretically prove that , unlike traditional sum aggregation , our function class on point clouds satisfies a fundamental universal approximation theorem . Empirically , we address an inherent collapse optimization issue by proposing a noise contrastive regularizer to steer the model towards truly exploiting the optimal transport geometry . Finally , we consistently report better generalization performance on several molecular property prediction tasks , while exhibiting smoother graph representations . 1 INTRODUCTION . Recently , there has been considerable interest in developing learning algorithms for structured data such as graphs . For example , molecular property prediction has many applications in chemistry and drug discovery ( Yang et al. , 2019 ; Vamathevan et al. , 2019 ) . Historically , graphs were decomposed into features such as molecular fingerprints , or turned into non-parametric graph kernels ( Vishwanathan et al. , 2010 ; Shervashidze et al. , 2011 ) . More recently , learned representations via graph neural networks ( GNNs ) have achieved state-of-the-art on graph prediction tasks ( Duvenaud et al. , 2015 ; Defferrard et al. , 2016 ; Kipf & Welling , 2017 ; Yang et al. , 2019 ) . Despite these successes , graph neural networks are often underutilized in whole graph prediction tasks such as molecule property prediction . Specifically , while GNNs produce node embeddings for each atom in the molecule , these are typically aggregated via simple operations such as a sum or average , turning the molecule into a single vector prior to classification or regression . As a result , some of the information naturally extracted by node embeddings may be lost . Departing from this simple aggregation step , Togninalli et al . ( 2019 ) recently proposed a kernel function over graphs by directly comparing non-parametric node embeddings as point clouds through optimal transport ( Wasserstein distance ) . Their non-parametric model yields better empirical performance over popular graph kernels , but this idea hasn ’ t been extended to the more challenging parametric case where optimization difficulties have to be reconciled with the combinatorial aspects of optimal transport solvers . Motivated by these observations and drawing inspiration from prior work on prototype learning ( appendix F ) , we introduce a new class of GNNs where the key representational step consists of comparing each input graph to a set of abstract prototypes ( fig . 1 ) . These prototypes play the role of basis functions ; they are stored as point clouds as if they were encoded from actual real graphs . Each input graph is first encoded into a set of node embeddings using any existing GNN architecture . We then compare this resulting embedding point cloud to the prototype embedding sets . Formally , the distance between two point clouds is measured by their optimal transport Wasserstein distances . The prototypes as abstract basis functions can be understood as keys that highlight property values associated with different graph structural features . In contrast to previous kernel methods , the prototypes are learned together with the GNN parameters in an end-to-end manner . Our notion of prototypes is inspired from the vast prior work on prototype learning which we highlight in appendix F. In our case , prototypes are not required to be the mean of a cluster of data , but instead they are entities living in the data embedding space that capture helpful information for the task under consideration . The closest analogy are the centers of radial basis function networks ( Chen et al. , 1991 ; Poggio & Girosi , 1990 ) , but we also inspire from learning vector quantization approaches ( Kohonen , 1995 ) and prototypical networks ( Snell et al. , 2017 ) . Our model improves upon traditional aggregation by explicitly tapping into the full set of node embeddings without collapsing them first to a single vector . We theoretically prove that , unlike standard GNN aggregation , our model defines a class of set functions that is a universal approximator . Introducing prototype points clouds as free parameters trained using combinatorial optimal transport solvers creates a challenging optimization problem . Indeed , as the models are trained end-to-end , the primary signal is initially available only in aggregate form . If trained as is , the prototypes often collapse to single points , reducing the Wasserstein distance between point clouds to Euclidean comparisons of their means . To counter this effect , we introduce a contrastive regularizer which effectively prevents the model from collapsing ( Section 3.2 ) . We demonstrate its merits empirically . Our contributions . First , we introduce an efficiently trainable class of graph neural networks enhanced with optimal transport ( OT ) primitives for computing graph representations based on relations with abstract prototypes . Second , we are the first to successfully train parametric graph models together with combinatorial OT distances , despite optimization difficulties . A key element is our noise contrastive regularizer that prevents the model from collapsing back to standard summation , thus fully exploiting the OT geometry . Third , we provide a theoretical justification of the increased representational power compared to the standard GNN aggregation method . Finally , our model shows consistent empirical improvements over previous state-of-the-art on molecular datasets , yielding also smoother graph embedding spaces . 2 PRELIMINARIES . 2.1 DIRECTED MESSAGE PASSING NEURAL NETWORKS ( D-MPNN ) . We briefly remind here of the simplified D-MPNN ( Dai et al. , 2016 ) architecture which was adapted for state-of-the-art molecular property prediction by Yang et al . ( 2019 ) . This model takes as input a directed graph G = ( V , E ) , with node and edge features denoted by xv and evw respectively , for v , w in the vertex set V and v → w in the edge set E. The parameters of D-MPNN are the matrices { Wi , Wm , Wo } . It keeps track of messages mtvw and hidden states htvw for each step t , defined as follows . An initial hidden state is set to h0vw : = ReLU ( Wicat ( xv , evw ) ) where “ cat ” denotes concatenation . Then , the updates are : mt+1vw = ∑ k∈N ( v ) \ { w } htkv , h t+1 vw = ReLU ( h 0 vw + Wmm t+1 vw ) , ( 1 ) where N ( v ) = { k ∈ V | ( k , v ) ∈ E } denotes v ’ s incoming neighbors . After T steps of message passing , node embeddings are obtained by summing edge embeddings : mv = ∑ w∈N ( v ) hTvw , hv = ReLU ( Wocat ( xv , mv ) ) . ( 2 ) A final graph embedding is then obtained as h = ∑ v∈V hv , which is usually fed to a multilayer perceptron ( MLP ) for classification or regression . 2.2 OPTIMAL TRANSPORT GEOMETRY . Optimal Transport ( Peyré et al. , 2019 ) is a mathematical framework that defines distances or similarities between objects such as probability distributions , either discrete or continuous , as the cost of an optimal transport plan from one to the other . Wasserstein distance for point clouds . Let a point cloud X = { xi } ni=1 of size n be a set of n points xi ∈ Rd . Given point clouds X , Y of respective sizes n , m , a transport plan ( or coupling ) is a matrix T of size n ×m with entries in [ 0 , 1 ] , satisfying the two following marginal constraints : T1m = 1 n1n and T T1n = 1 m1m . Intuitively , the marginal constraints mean that T preserves the mass from X to Y . We denote the set of such couplings as CXY . Given a cost function c on Rd , its associated Wasserstein discrepancy is defined as W ( X , Y ) = min T∈CXY ∑ ij Tijc ( xi , yj ) . ( 3 ) We further describe the shape of optimal transports for point clouds of same sizes in Appendix B.3 . 3 MODEL & PRACTICE . 3.1 ARCHITECTURE ENHANCEMENT . Reformulating standard architectures . As mentioned at the end of Section 2.1 , the final graph embedding h = ∑ v∈V hv obtained by aggregating node embeddings is usually fed to a MLP performing a matrix-multiplication whose i-th component is ( Rh ) i = 〈ri , h〉 , where ri is the i-th row of matrix R. Replacing 〈· , ·〉 by a distance/kernel k ( · , · ) allows the processing of more general graph representations than just vectors in Rd , such as point clouds or adjacency tensors . From a single point to a point cloud . We propose to replace the aggregated graph embedding h = ∑ v∈V hv by the point cloud ( of unaggregated node embeddings ) H = { hv } v∈V , and the inner-products 〈h , ri〉 by the below written Wasserstein discrepancy : W ( H , Qi ) : = min T∈CHQi ∑ vj Tvjc ( hv , q j i ) , ( 4 ) where Qi = { qji } j∈ { 1 , ... , N } , ∀i ∈ { 1 , . . . , M } represent M prototype point clouds each being represented as a set of N embeddings as free trainable parameters , and the cost is chosen as c = ‖ · − · ‖22 or c = −〈· , ·〉 . Note that both options yield identical optimal transport plans . Greater representational power . We formulate mathematically in Section 4 that this kernel has a strictly greater representational power than the kernel corresponding to standard inner-product on top of a sum aggregation , to distinguish between different point clouds . Final architecture . Finally , the vector of all Wasserstein distances in eq . ( 4 ) becomes the input to a final MLP with a single scalar as output . This can then be used as the prediction for various downstream tasks . This model is depicted in fig . 1 and motivated theoretically in section 4.1 . 3.2 CONTRASTIVE REGULARIZATION . What would happen toW ( H , Qi ) if all points qji belonging to point cloud Qi would collapse to the same point qi ? All transport plans would yield the same cost , giving for c = −〈· , ·〉 : W ( H , Qi ) = − ∑ vj Tvj〈hv , qji 〉 = −〈h , qi/|V |〉 . ( 5 ) In this scenario , our proposition would simply over-parametrize the standard Euclidean model . A first obstacle and its cause . Our first empirical trials with OT-enhanced GNNs showed that a model trained with only the Wasserstein component would sometimes perform similarly to the Euclidean baseline in both train and validation settings , in spite of its greater representational power . Further investigation revealed that the Wasserstein model would naturally displace the points in each of its prototype point clouds in such a way that the optimal transport plan T obtained by maximizing∑ vj Tvj〈hv , q j i 〉 was not discriminative , i.e . many other transports would yield a similar Wasserstein cost . Indeed , as shown in Eq . ( 5 ) , if each point cloud collapses to its mean , then the Wasserstein geometry collaspses to Euclidean geometry . In this scenario , any transport plan yields the same Wasserstein cost . Further explanations are provided in Appendix A.1 and Figure 3 .. Contrastive regularization . To address this difficulty , we consider adding a regularizer which encourages the model to displace its prototype point clouds such that the optimal transport plans would be discriminative against chosen contrastive transport plans . Namely , consider a point cloud Y of node embeddings and let Ti be an optimal transport plan obtained in the computation of W ( Y , Qi ) . For each Ti , we then build a set Neg ( Ti ) ⊂ CYQi of noisy/contrastive transports . If we denote byWT ( X , Y ) : = ∑ kl Tklc ( xk , yl ) the Wasserstein cost obtained for the particular transport T , then our contrastive regularization consists in maximizing the term : ∑ i log ( e−WTi ( Y , Qi ) e−WTi ( Y , Qi ) + ∑ T∈Neg ( Ti ) e −WT ( Y , Qi ) ) , ( 6 ) which can be interpreted as the log-likelihood that the correct transport Ti be ( as it should ) a better minimizer ofWT ( Y , Qi ) than its negative samples . This can be considered as an approximation of log ( Pr ( Ti | Y , Qi ) ) , where the partition function is approximated by our selection of negative examples , as done e.g . by Nickel & Kiela ( 2017 ) . Its effect is shown in Figure 3 . Remarks . The selection of negative examples should reflect the trade-off : ( i ) to not be too large , for computational efficiency while ( ii ) containing sufficiently meaningful and challenging contrastive samples . Details about choice of contrastive samples are given in Appendix A.2 . Note that replacing the set Neg ( Ti ) with a singleton { T } for a contrastive random variable T lets us rewrite Eq . ( 6 ) as1∑ i log σ ( WT −WTi ) , reminiscent of noise contrastive estimation ( Gutmann & Hyvärinen , 2010 ) .
The paper proposes OT-GNN, which incorporates optimal transport distance to message passing of GNN. The message passing is aggregated by using a Wasserstein discrepancy for a point cloud. The contrastive regularization is utilized to overcome extreme clustering of nodes of the same class. Also, in theory, the author shows that the Wasserstein kernel is universal while the "agg" kernel is not. The proposed model is tested on several molecular property prediction tasks. The OT-GNN achieves slightly better performance against existing methods.
SP:d4a4b5024e975d9321a8cd123c64f4220e38b990
Online Adversarial Purification based on Self-supervised Learning
1 INTRODUCTION . Deep neural networks have achieved remarkable results in many machine learning applications . However , these networks are known to be vulnerable to adversarial attacks , i.e . strategies which aim to find adversarial examples that are close or even perceptually indistinguishable from their natural counterparts but easily mis-classified by the networks . This vulnerability raises theory-wise issues about the interpretability of deep learning as well as application-wise issues when deploying neural networks in security-sensitive applications . Many strategies have been proposed to empower neural networks to defend against these adversaries . The current most widely used genre of defense strategies is adversarial training . Adversarial training is an on-the-fly data augmentation method that improves robustness by training the network not only with clean examples but adversarial ones as well . For example , Madry et al . ( 2017 ) propose projected gradient descent as a universal first-order attack and strengthen the network by presenting it with such adversarial examples during training ( e.g. , adversarial training ) . However , this method is computationally expensive as finding these adversarial examples involves sample-wise gradient computation at every epoch . Self-supervised representation learning aims to learn meaningful representations of unlabeled data where the supervision comes from the data itself . While this seems orthogonal to the study of adversarial vulnerability , recent works use representation learning as a lens to understand as well as improve adversarial robustness ( Hendrycks et al. , 2019 ; Mao et al. , 2019 ; Chen et al. , 2020a ; Naseer et al. , 2020 ) . This recent line of research suggests that self-supervised learning , which often leads to a more informative and meaningful data representation , can benefit the robustness of deep networks . In this paper , we study how self-supervised representation learning can improve adversarial robustness . We present Self-supervised Online Adversarial Purification ( SOAP ) , a novel defense strategy that uses an auxiliary self-supervised loss to purify adversarial examples at test-time , as illustrated in Figure 1 . During training , beside the classification task , we jointly train the network on a carefully selected self-supervised task . The multi-task learning improves the robustness of the network and more importantly , enables us to counter the adversarial perturbation at test-time by leveraging the label-independent nature of self-supervised signals . Experiments demonstrate that SOAP performs competitively on various architectures across different datasets with only a small computation overhead compared with vanilla training . Furthermore , we design a new attack strategy that targets both the classification and the auxiliary tasks , and show that our method is robust to this adaptive adversary as well . Code is available at https : //github.com/Mishne-Lab/SOAP . 2 RELATED WORK . Adversarial training Adversarial training aims to improve robustness through data augmentation , where the network is trained on adversarially perturbed examples instead of the clean original training samples ( Goodfellow et al. , 2014 ; Kurakin et al. , 2016 ; Tramèr et al. , 2017 ; Madry et al. , 2017 ; Kannan et al. , 2018 ; Zhang et al. , 2019 ) . By solving a min-max problem , the network learns a smoother data manifold and decision boundary which improve robustness . However , the computational cost of adversarial training is high because strong adversarial examples are typically found in an iterative manner with heavy gradient calculation . Compared with adversarial training , our method avoids solving the complex inner-max problem and thus is significantly more efficient in training . Our method does increase test-time computation but it is practically negligible per sample . Adversarial purification Another genre of robust learning focuses on shifting the adversarial examples back to the clean data representation , namely purification . Gu & Rigazio ( 2014 ) exploited using a general DAE ( Vincent et al. , 2008 ) to remove adversarial noises ; Meng & Chen ( 2017 ) train a reformer network , which is a collection of autoencoders , to move adversarial examples towards clean manifold ; Liao et al . ( 2018 ) train a UNet that can denoise adversarial examples to their clean counterparts ; Samangouei et al . ( 2018 ) train a GAN on clean examples and project the adversarial examples to the manifold of the generator ; Song et al . ( 2018 ) assume adversarial examples have lower probability and learn the image distribution with a PixelCNN so that they can maximize the probability of a given test example ; Naseer et al . ( 2020 ) train a conditional GAN by letting it play a min-max game with a critic network in order to differentiate between clean and adversarial examples . In contrast to above approaches , SOAP achieves better robust accuracy and does not require a GAN which is hard and inefficient to train . More importantly , our approach exploits a wider range of self-supervised signals for purification and conceptually can be applied to any format of data and not just images , given an appropriate self-supervised task . Self-supervised learning Self-supervised learning aims to learn intermediate representations of unlabeled data that are useful for unknown downstream tasks . This is done by solving a selfsupervised task , or pretext task , where the supervision of the task comes from the data itself . Recently , a variety of self-supervised tasks have been proposed on images , including data reconstruction ( Vincent et al. , 2008 ; Rifai et al. , 2011 ) , relative positioning of patches ( Doersch et al. , 2015 ; Noroozi & Favaro , 2016 ) , colorization ( Zhang et al. , 2016 ) , transformation prediction ( Dosovitskiy et al. , 2014 ; Gidaris et al. , 2018 ) or a combination of tasks ( Doersch & Zisserman , 2017 ) . More recently , studies have shown how self-supervised learning can improve adversarial robustness . Mao et al . ( 2019 ) find that adversarial attacks fool the networks by shifting latent representation to a false class . Hendrycks et al . ( 2019 ) observe that PGD adversarial training along with an auxiliary rotation prediction task improves robustness , while Naseer et al . ( 2020 ) use feature distortion as a self-supervised signal to find transferable attacks that generalize across different architectures and tasks . Chen et al . ( 2020a ) combine adversarial training and self-supervised pre-training to boost fine-tuned robustness . These methods typically combine self-supervised learning with adversarial training , thus the computational cost is still high . In contrast , our approach achieves robust accuracy by test-time purification which uses a variety of self-supervised signals as auxiliary objectives . 3 SELF-SUPERVISED PURIFICATION . 3.1 PROBLEM FORMULATION . As aforementioned , Mao et al . ( 2019 ) observe that adversaries shift clean representations towards false classes to diminish robust accuracy . The small error in input space , carefully chosen by adversaries , gets amplified through the network , and finally leads to wrong classification . A natural way to solve this is to perturb adversarial examples so as to shift their representation back to the true classes , i.e . purification . In this paper we only consider classification as our main task , but our approach should be easily generalized to other tasks as well . Consider an encoder z = f ( x ; θenc ) , a classifier g ( z ; θcls ) on top of the representation z , and the network g ◦f a composition of the encoder and the classifier . We formulate the purification problem as follows : for an adversarial example ( xadv , y ) and its clean counterpart ( x , y ) ( unknown to the network ) , a purification strategy π aims to find xpfy = π ( xadv ) that is as close to the clean example x as possible : xpfy → x . However , this problem is underdetermined as different clean examples can share the same adversarial counterpart , i.e . there might be multiple or even infinite solutions for xpfy . Thus , we consider the relaxation min π Lcls ( ( g ◦ f ) ( xpfy ) , y ) s.t . ||xpfy − xadv|| ≤ adv , xpfy = π ( xadv ) , ( 1 ) i.e . we accept xpfy as long as Lcls is sufficiently small and the perturbation is bounded . Here Lcls is the cross entropy loss for classification and adv is the budget of adversarial perturbation . However , this problem is still unsolvable since neither the true label y nor the budget adv is available at testtime . We need an alternative approach that can lead to a similar optimum . 3.2 SELF-SUPERVISED ONLINE PURIFICATION . Let h ( z ; θaux ) be an auxiliary device that shares the same representation z with g ( z ; θcls ) , and Laux be the auxiliary self-supervised objective . The intuition behind SOAP is that the shift in representation z that hinders classification will hinder the auxiliary self-supervised task as well . In other words , large Laux often implies large Lcls . Therefore , we propose to use Laux as an alternative to Lcls in Eq . ( 1 ) . Then we can purify the adversarial examples using the auxiliary self-supervised signals , since the purified examples which perform better on the auxiliary task ( small Laux ) should perform better on classification as well ( small Lcls ) . During training , we jointly minimize the classification loss and self-supervised auxiliary loss min θ { Lcls ( ( g ◦ f ) ( x ; θenc , θcls ) , y ) + αLaux ( ( h ◦ f ) ( x ; θenc , θaux ) ) } , ( 2 ) where α is a trade-off parameter between the two tasks . At test-time , given fixed network parameters θ , we use the label-independent auxiliary objective to perform gradient descent in the input space . The purification objective is min π Laux ( ( h ◦ f ) ( xpfy ) ) s.t . ||xpfy − xadv|| ≤ pfy , xpfy = π ( xadv ) , ( 3 ) where pfy is the budget of purification . This is legitimate at test-time because unlike Eq . ( 1 ) , the supervision or the purification signal comes from data itself . Also , compared with vanilla training the only training increment of SOAP is an additional self-supervised regularization term . Thus , the computational complexity is largely reduced compared with adversarial training methods . In Sec . 4 , we will show that adversarial examples do perform worse on auxiliary tasks and the gradient of the auxiliary loss provides useful information on improving robustness . Note that adv is replaced with pfy in Eq . ( 3 ) , and we will discuss how to find appropriate pfy in the next section . Algorithm 1 PGD attack Input : x : a test example ; T : the number of attack steps Output : xadv : the adversarial example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Lcls ( ( g ◦ f ) ( x+ δ ; θenc , θcls ) , y ) 4 : δ ← δ + γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − adv ) , adv ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xadv ← x+ δ Algorithm 2 Multi-step purification Input : x : a test example ; T : the number of purification steps Output : xpfy : the purified example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Laux ( ( h ◦ f ) ( x+ δ ; θenc , θaux ) ) 4 : δ ← δ − γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − pfy ) , pfy ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xpfy ← x+ δ
Online defenses of adversarial examples is an old topic: Given an input x (potentially adversarially perturbed) at test time, we want to sanitize x to get x', on which the trained classifier $g \circ f$ gives the correct answer. This paper proposes a new architecture for online defenses via self supervision. There are two new things in the proposal:
SP:c8a94e6bc17a9e9c3b5345b436130668207d29bd
Online Adversarial Purification based on Self-supervised Learning
1 INTRODUCTION . Deep neural networks have achieved remarkable results in many machine learning applications . However , these networks are known to be vulnerable to adversarial attacks , i.e . strategies which aim to find adversarial examples that are close or even perceptually indistinguishable from their natural counterparts but easily mis-classified by the networks . This vulnerability raises theory-wise issues about the interpretability of deep learning as well as application-wise issues when deploying neural networks in security-sensitive applications . Many strategies have been proposed to empower neural networks to defend against these adversaries . The current most widely used genre of defense strategies is adversarial training . Adversarial training is an on-the-fly data augmentation method that improves robustness by training the network not only with clean examples but adversarial ones as well . For example , Madry et al . ( 2017 ) propose projected gradient descent as a universal first-order attack and strengthen the network by presenting it with such adversarial examples during training ( e.g. , adversarial training ) . However , this method is computationally expensive as finding these adversarial examples involves sample-wise gradient computation at every epoch . Self-supervised representation learning aims to learn meaningful representations of unlabeled data where the supervision comes from the data itself . While this seems orthogonal to the study of adversarial vulnerability , recent works use representation learning as a lens to understand as well as improve adversarial robustness ( Hendrycks et al. , 2019 ; Mao et al. , 2019 ; Chen et al. , 2020a ; Naseer et al. , 2020 ) . This recent line of research suggests that self-supervised learning , which often leads to a more informative and meaningful data representation , can benefit the robustness of deep networks . In this paper , we study how self-supervised representation learning can improve adversarial robustness . We present Self-supervised Online Adversarial Purification ( SOAP ) , a novel defense strategy that uses an auxiliary self-supervised loss to purify adversarial examples at test-time , as illustrated in Figure 1 . During training , beside the classification task , we jointly train the network on a carefully selected self-supervised task . The multi-task learning improves the robustness of the network and more importantly , enables us to counter the adversarial perturbation at test-time by leveraging the label-independent nature of self-supervised signals . Experiments demonstrate that SOAP performs competitively on various architectures across different datasets with only a small computation overhead compared with vanilla training . Furthermore , we design a new attack strategy that targets both the classification and the auxiliary tasks , and show that our method is robust to this adaptive adversary as well . Code is available at https : //github.com/Mishne-Lab/SOAP . 2 RELATED WORK . Adversarial training Adversarial training aims to improve robustness through data augmentation , where the network is trained on adversarially perturbed examples instead of the clean original training samples ( Goodfellow et al. , 2014 ; Kurakin et al. , 2016 ; Tramèr et al. , 2017 ; Madry et al. , 2017 ; Kannan et al. , 2018 ; Zhang et al. , 2019 ) . By solving a min-max problem , the network learns a smoother data manifold and decision boundary which improve robustness . However , the computational cost of adversarial training is high because strong adversarial examples are typically found in an iterative manner with heavy gradient calculation . Compared with adversarial training , our method avoids solving the complex inner-max problem and thus is significantly more efficient in training . Our method does increase test-time computation but it is practically negligible per sample . Adversarial purification Another genre of robust learning focuses on shifting the adversarial examples back to the clean data representation , namely purification . Gu & Rigazio ( 2014 ) exploited using a general DAE ( Vincent et al. , 2008 ) to remove adversarial noises ; Meng & Chen ( 2017 ) train a reformer network , which is a collection of autoencoders , to move adversarial examples towards clean manifold ; Liao et al . ( 2018 ) train a UNet that can denoise adversarial examples to their clean counterparts ; Samangouei et al . ( 2018 ) train a GAN on clean examples and project the adversarial examples to the manifold of the generator ; Song et al . ( 2018 ) assume adversarial examples have lower probability and learn the image distribution with a PixelCNN so that they can maximize the probability of a given test example ; Naseer et al . ( 2020 ) train a conditional GAN by letting it play a min-max game with a critic network in order to differentiate between clean and adversarial examples . In contrast to above approaches , SOAP achieves better robust accuracy and does not require a GAN which is hard and inefficient to train . More importantly , our approach exploits a wider range of self-supervised signals for purification and conceptually can be applied to any format of data and not just images , given an appropriate self-supervised task . Self-supervised learning Self-supervised learning aims to learn intermediate representations of unlabeled data that are useful for unknown downstream tasks . This is done by solving a selfsupervised task , or pretext task , where the supervision of the task comes from the data itself . Recently , a variety of self-supervised tasks have been proposed on images , including data reconstruction ( Vincent et al. , 2008 ; Rifai et al. , 2011 ) , relative positioning of patches ( Doersch et al. , 2015 ; Noroozi & Favaro , 2016 ) , colorization ( Zhang et al. , 2016 ) , transformation prediction ( Dosovitskiy et al. , 2014 ; Gidaris et al. , 2018 ) or a combination of tasks ( Doersch & Zisserman , 2017 ) . More recently , studies have shown how self-supervised learning can improve adversarial robustness . Mao et al . ( 2019 ) find that adversarial attacks fool the networks by shifting latent representation to a false class . Hendrycks et al . ( 2019 ) observe that PGD adversarial training along with an auxiliary rotation prediction task improves robustness , while Naseer et al . ( 2020 ) use feature distortion as a self-supervised signal to find transferable attacks that generalize across different architectures and tasks . Chen et al . ( 2020a ) combine adversarial training and self-supervised pre-training to boost fine-tuned robustness . These methods typically combine self-supervised learning with adversarial training , thus the computational cost is still high . In contrast , our approach achieves robust accuracy by test-time purification which uses a variety of self-supervised signals as auxiliary objectives . 3 SELF-SUPERVISED PURIFICATION . 3.1 PROBLEM FORMULATION . As aforementioned , Mao et al . ( 2019 ) observe that adversaries shift clean representations towards false classes to diminish robust accuracy . The small error in input space , carefully chosen by adversaries , gets amplified through the network , and finally leads to wrong classification . A natural way to solve this is to perturb adversarial examples so as to shift their representation back to the true classes , i.e . purification . In this paper we only consider classification as our main task , but our approach should be easily generalized to other tasks as well . Consider an encoder z = f ( x ; θenc ) , a classifier g ( z ; θcls ) on top of the representation z , and the network g ◦f a composition of the encoder and the classifier . We formulate the purification problem as follows : for an adversarial example ( xadv , y ) and its clean counterpart ( x , y ) ( unknown to the network ) , a purification strategy π aims to find xpfy = π ( xadv ) that is as close to the clean example x as possible : xpfy → x . However , this problem is underdetermined as different clean examples can share the same adversarial counterpart , i.e . there might be multiple or even infinite solutions for xpfy . Thus , we consider the relaxation min π Lcls ( ( g ◦ f ) ( xpfy ) , y ) s.t . ||xpfy − xadv|| ≤ adv , xpfy = π ( xadv ) , ( 1 ) i.e . we accept xpfy as long as Lcls is sufficiently small and the perturbation is bounded . Here Lcls is the cross entropy loss for classification and adv is the budget of adversarial perturbation . However , this problem is still unsolvable since neither the true label y nor the budget adv is available at testtime . We need an alternative approach that can lead to a similar optimum . 3.2 SELF-SUPERVISED ONLINE PURIFICATION . Let h ( z ; θaux ) be an auxiliary device that shares the same representation z with g ( z ; θcls ) , and Laux be the auxiliary self-supervised objective . The intuition behind SOAP is that the shift in representation z that hinders classification will hinder the auxiliary self-supervised task as well . In other words , large Laux often implies large Lcls . Therefore , we propose to use Laux as an alternative to Lcls in Eq . ( 1 ) . Then we can purify the adversarial examples using the auxiliary self-supervised signals , since the purified examples which perform better on the auxiliary task ( small Laux ) should perform better on classification as well ( small Lcls ) . During training , we jointly minimize the classification loss and self-supervised auxiliary loss min θ { Lcls ( ( g ◦ f ) ( x ; θenc , θcls ) , y ) + αLaux ( ( h ◦ f ) ( x ; θenc , θaux ) ) } , ( 2 ) where α is a trade-off parameter between the two tasks . At test-time , given fixed network parameters θ , we use the label-independent auxiliary objective to perform gradient descent in the input space . The purification objective is min π Laux ( ( h ◦ f ) ( xpfy ) ) s.t . ||xpfy − xadv|| ≤ pfy , xpfy = π ( xadv ) , ( 3 ) where pfy is the budget of purification . This is legitimate at test-time because unlike Eq . ( 1 ) , the supervision or the purification signal comes from data itself . Also , compared with vanilla training the only training increment of SOAP is an additional self-supervised regularization term . Thus , the computational complexity is largely reduced compared with adversarial training methods . In Sec . 4 , we will show that adversarial examples do perform worse on auxiliary tasks and the gradient of the auxiliary loss provides useful information on improving robustness . Note that adv is replaced with pfy in Eq . ( 3 ) , and we will discuss how to find appropriate pfy in the next section . Algorithm 1 PGD attack Input : x : a test example ; T : the number of attack steps Output : xadv : the adversarial example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Lcls ( ( g ◦ f ) ( x+ δ ; θenc , θcls ) , y ) 4 : δ ← δ + γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − adv ) , adv ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xadv ← x+ δ Algorithm 2 Multi-step purification Input : x : a test example ; T : the number of purification steps Output : xpfy : the purified example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Laux ( ( h ◦ f ) ( x+ δ ; θenc , θaux ) ) 4 : δ ← δ − γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − pfy ) , pfy ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xpfy ← x+ δ
This paper studies adversarial defense by combing purification and self-supervised loss. During inference, the authors propose an online-purification method based on (clipped) iterative gradient ascent. The loss used by purification is from some pre-defined self-supervised tasks. During training, joint loss of softmax and self-supervised loss are used to match the purification process in inference. Experiments on MNIST10 and CIFAR10 demonstrate the effectiveness of the proposed method over several SOTA baselines. The evaluation considers both the white-box and black-box attack setup.
SP:c8a94e6bc17a9e9c3b5345b436130668207d29bd
Online Adversarial Purification based on Self-supervised Learning
1 INTRODUCTION . Deep neural networks have achieved remarkable results in many machine learning applications . However , these networks are known to be vulnerable to adversarial attacks , i.e . strategies which aim to find adversarial examples that are close or even perceptually indistinguishable from their natural counterparts but easily mis-classified by the networks . This vulnerability raises theory-wise issues about the interpretability of deep learning as well as application-wise issues when deploying neural networks in security-sensitive applications . Many strategies have been proposed to empower neural networks to defend against these adversaries . The current most widely used genre of defense strategies is adversarial training . Adversarial training is an on-the-fly data augmentation method that improves robustness by training the network not only with clean examples but adversarial ones as well . For example , Madry et al . ( 2017 ) propose projected gradient descent as a universal first-order attack and strengthen the network by presenting it with such adversarial examples during training ( e.g. , adversarial training ) . However , this method is computationally expensive as finding these adversarial examples involves sample-wise gradient computation at every epoch . Self-supervised representation learning aims to learn meaningful representations of unlabeled data where the supervision comes from the data itself . While this seems orthogonal to the study of adversarial vulnerability , recent works use representation learning as a lens to understand as well as improve adversarial robustness ( Hendrycks et al. , 2019 ; Mao et al. , 2019 ; Chen et al. , 2020a ; Naseer et al. , 2020 ) . This recent line of research suggests that self-supervised learning , which often leads to a more informative and meaningful data representation , can benefit the robustness of deep networks . In this paper , we study how self-supervised representation learning can improve adversarial robustness . We present Self-supervised Online Adversarial Purification ( SOAP ) , a novel defense strategy that uses an auxiliary self-supervised loss to purify adversarial examples at test-time , as illustrated in Figure 1 . During training , beside the classification task , we jointly train the network on a carefully selected self-supervised task . The multi-task learning improves the robustness of the network and more importantly , enables us to counter the adversarial perturbation at test-time by leveraging the label-independent nature of self-supervised signals . Experiments demonstrate that SOAP performs competitively on various architectures across different datasets with only a small computation overhead compared with vanilla training . Furthermore , we design a new attack strategy that targets both the classification and the auxiliary tasks , and show that our method is robust to this adaptive adversary as well . Code is available at https : //github.com/Mishne-Lab/SOAP . 2 RELATED WORK . Adversarial training Adversarial training aims to improve robustness through data augmentation , where the network is trained on adversarially perturbed examples instead of the clean original training samples ( Goodfellow et al. , 2014 ; Kurakin et al. , 2016 ; Tramèr et al. , 2017 ; Madry et al. , 2017 ; Kannan et al. , 2018 ; Zhang et al. , 2019 ) . By solving a min-max problem , the network learns a smoother data manifold and decision boundary which improve robustness . However , the computational cost of adversarial training is high because strong adversarial examples are typically found in an iterative manner with heavy gradient calculation . Compared with adversarial training , our method avoids solving the complex inner-max problem and thus is significantly more efficient in training . Our method does increase test-time computation but it is practically negligible per sample . Adversarial purification Another genre of robust learning focuses on shifting the adversarial examples back to the clean data representation , namely purification . Gu & Rigazio ( 2014 ) exploited using a general DAE ( Vincent et al. , 2008 ) to remove adversarial noises ; Meng & Chen ( 2017 ) train a reformer network , which is a collection of autoencoders , to move adversarial examples towards clean manifold ; Liao et al . ( 2018 ) train a UNet that can denoise adversarial examples to their clean counterparts ; Samangouei et al . ( 2018 ) train a GAN on clean examples and project the adversarial examples to the manifold of the generator ; Song et al . ( 2018 ) assume adversarial examples have lower probability and learn the image distribution with a PixelCNN so that they can maximize the probability of a given test example ; Naseer et al . ( 2020 ) train a conditional GAN by letting it play a min-max game with a critic network in order to differentiate between clean and adversarial examples . In contrast to above approaches , SOAP achieves better robust accuracy and does not require a GAN which is hard and inefficient to train . More importantly , our approach exploits a wider range of self-supervised signals for purification and conceptually can be applied to any format of data and not just images , given an appropriate self-supervised task . Self-supervised learning Self-supervised learning aims to learn intermediate representations of unlabeled data that are useful for unknown downstream tasks . This is done by solving a selfsupervised task , or pretext task , where the supervision of the task comes from the data itself . Recently , a variety of self-supervised tasks have been proposed on images , including data reconstruction ( Vincent et al. , 2008 ; Rifai et al. , 2011 ) , relative positioning of patches ( Doersch et al. , 2015 ; Noroozi & Favaro , 2016 ) , colorization ( Zhang et al. , 2016 ) , transformation prediction ( Dosovitskiy et al. , 2014 ; Gidaris et al. , 2018 ) or a combination of tasks ( Doersch & Zisserman , 2017 ) . More recently , studies have shown how self-supervised learning can improve adversarial robustness . Mao et al . ( 2019 ) find that adversarial attacks fool the networks by shifting latent representation to a false class . Hendrycks et al . ( 2019 ) observe that PGD adversarial training along with an auxiliary rotation prediction task improves robustness , while Naseer et al . ( 2020 ) use feature distortion as a self-supervised signal to find transferable attacks that generalize across different architectures and tasks . Chen et al . ( 2020a ) combine adversarial training and self-supervised pre-training to boost fine-tuned robustness . These methods typically combine self-supervised learning with adversarial training , thus the computational cost is still high . In contrast , our approach achieves robust accuracy by test-time purification which uses a variety of self-supervised signals as auxiliary objectives . 3 SELF-SUPERVISED PURIFICATION . 3.1 PROBLEM FORMULATION . As aforementioned , Mao et al . ( 2019 ) observe that adversaries shift clean representations towards false classes to diminish robust accuracy . The small error in input space , carefully chosen by adversaries , gets amplified through the network , and finally leads to wrong classification . A natural way to solve this is to perturb adversarial examples so as to shift their representation back to the true classes , i.e . purification . In this paper we only consider classification as our main task , but our approach should be easily generalized to other tasks as well . Consider an encoder z = f ( x ; θenc ) , a classifier g ( z ; θcls ) on top of the representation z , and the network g ◦f a composition of the encoder and the classifier . We formulate the purification problem as follows : for an adversarial example ( xadv , y ) and its clean counterpart ( x , y ) ( unknown to the network ) , a purification strategy π aims to find xpfy = π ( xadv ) that is as close to the clean example x as possible : xpfy → x . However , this problem is underdetermined as different clean examples can share the same adversarial counterpart , i.e . there might be multiple or even infinite solutions for xpfy . Thus , we consider the relaxation min π Lcls ( ( g ◦ f ) ( xpfy ) , y ) s.t . ||xpfy − xadv|| ≤ adv , xpfy = π ( xadv ) , ( 1 ) i.e . we accept xpfy as long as Lcls is sufficiently small and the perturbation is bounded . Here Lcls is the cross entropy loss for classification and adv is the budget of adversarial perturbation . However , this problem is still unsolvable since neither the true label y nor the budget adv is available at testtime . We need an alternative approach that can lead to a similar optimum . 3.2 SELF-SUPERVISED ONLINE PURIFICATION . Let h ( z ; θaux ) be an auxiliary device that shares the same representation z with g ( z ; θcls ) , and Laux be the auxiliary self-supervised objective . The intuition behind SOAP is that the shift in representation z that hinders classification will hinder the auxiliary self-supervised task as well . In other words , large Laux often implies large Lcls . Therefore , we propose to use Laux as an alternative to Lcls in Eq . ( 1 ) . Then we can purify the adversarial examples using the auxiliary self-supervised signals , since the purified examples which perform better on the auxiliary task ( small Laux ) should perform better on classification as well ( small Lcls ) . During training , we jointly minimize the classification loss and self-supervised auxiliary loss min θ { Lcls ( ( g ◦ f ) ( x ; θenc , θcls ) , y ) + αLaux ( ( h ◦ f ) ( x ; θenc , θaux ) ) } , ( 2 ) where α is a trade-off parameter between the two tasks . At test-time , given fixed network parameters θ , we use the label-independent auxiliary objective to perform gradient descent in the input space . The purification objective is min π Laux ( ( h ◦ f ) ( xpfy ) ) s.t . ||xpfy − xadv|| ≤ pfy , xpfy = π ( xadv ) , ( 3 ) where pfy is the budget of purification . This is legitimate at test-time because unlike Eq . ( 1 ) , the supervision or the purification signal comes from data itself . Also , compared with vanilla training the only training increment of SOAP is an additional self-supervised regularization term . Thus , the computational complexity is largely reduced compared with adversarial training methods . In Sec . 4 , we will show that adversarial examples do perform worse on auxiliary tasks and the gradient of the auxiliary loss provides useful information on improving robustness . Note that adv is replaced with pfy in Eq . ( 3 ) , and we will discuss how to find appropriate pfy in the next section . Algorithm 1 PGD attack Input : x : a test example ; T : the number of attack steps Output : xadv : the adversarial example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Lcls ( ( g ◦ f ) ( x+ δ ; θenc , θcls ) , y ) 4 : δ ← δ + γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − adv ) , adv ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xadv ← x+ δ Algorithm 2 Multi-step purification Input : x : a test example ; T : the number of purification steps Output : xpfy : the purified example 1 : δ ← 0 2 : for t = 1 , 2 , . . . , T do 3 : ` ← Laux ( ( h ◦ f ) ( x+ δ ; θenc , θaux ) ) 4 : δ ← δ − γ sign ( ∇x ` ) 5 : δ ← min ( max ( δ , − pfy ) , pfy ) 6 : δ ← min ( max ( x+ δ , 0 ) , 1 ) − x 7 : end for 8 : xpfy ← x+ δ
The paper introduces a defence for adversarial attack based on minimising a self-supervised loss on the test examples. Authors work under the assumption that minimising the self-supervised loss would be equivalent to minimising the supervised loss (to which they don't have access at test time). Authors evaluate their method on MNIST and CIFAR.
SP:c8a94e6bc17a9e9c3b5345b436130668207d29bd
Optimizing Memory Placement using Evolutionary Graph Reinforcement Learning
1 INTRODUCTION . The proliferation of deep learning ( DL ) has been fueled , in part , by a rapid growth in the size and complexity of deep neural networks ( DNN ) ( Dean et al. , 2012 ; Ying et al. , 2018 ) . This has spurred the rapid development of hardware ( Wang et al. , 2016 ; Jouppi et al. , 2017 ) and software ( Abadi et al. , 2016 ; Paszke et al. , 2018 ; Cyphers et al. , 2018 ) dedicated to deep learning workloads that seek to optimize critical performance metrics like throughput and power efficiency ( Mattson et al. , 2020 ) . Producing compiler optimizations that map the tensors of a neural network ’ s computational graph to the memory units on host hardware is a critical challenge . Since different memory types trade off bandwidth and capacity differently , a sub-optimal mapping could significantly increase latency . For DL inference , the computational graph is static and placement can be pre-planned instead of relying on online cache management ( Zhang et al. , 2020 ; Shi et al. , 2019 ) . However , this is especially challenging with DNNs due to the high dimensional search space . For example , ResNet-50 ( He et al. , 2016 ) has 57 operational layers . Mapping each activation and weight tensor to , for example , three ( DRAM , LLC , and SRAM ) memory caches represents 3 ( 2∗57 ) ≈ 1054 possible decisions . BERT ( Devlin et al. , 2018 ) has 376 operational layers , and a search space of ∼ 10358 . Since optimizing this mapping is intractable with traditional approaches , such as dynamic programming ( Bellman , 1954 ) , current solutions primarily rely on manually-tuned heuristic rules encoded in a compiler . Because of the large search space , prior reinforcement learning ( RL ) algorithms for automating mappings have relied on manually-designed grouping ( Mirhoseini et al. , 2017 ; Addanki et al. , 2018 ) or a learned grouper whose hierarchical structure is domain dependent ( Mirhoseini et al. , 2018 ) . In addition to the extremely large action space , the large number of nodes render the reward sparse and noisy , and thus further unsuitable for gradient-based Deep RL algorithms . This sparsity stems from the fact that an overall performance metric can only be measured after all nodes have been processed . ∗Equal Contribution †Correspondence to : < somdeb.majumdar @ intel.com > In this paper , we present Evolutionary Graph Reinforcement Learning ( EGRL ) , a hybrid approach of evolutionary search with gradient-based learning , that is able to natively search in a high-dimensional space that is orders-of-magnitude larger than previous approaches . EGRL is an extension of CERL ( Khadka et al. , 2019 ) , a population based method for sparse-reward tasks that combines fast policy gradient ( PG ) learning with a stable evolutionary algorithm ( EA ) . Since the action spaces explored in this paper are several orders of magnitude larger than those explored in CERL , we introduce Boltzmann chromosomes - a set of fast , stateless policies that accelerate evolution by providing partially optimized solutions as anchors . This mechanism is necessary to improve the sampleefficiency of the slow EA component for this large action space . Further , we employ a graph neural network ( GNN ) ( Wu et al. , 2020 ; Scarselli et al. , 2008 ) to represent our policy . This allows our agent to natively process computational graphs representing deep learning workloads , enabling generalization over workloads of varying size and connectivity . We demonstrate our solution on the Intel Neural Network Processor for Inference ( NNP-I ) , a deep learning accelerator , to map modern neural networks on one of the three memory hierarchies on the chip . Each memory level in this chip has trade-offs in memory size and bandwidth , as detailed in Wechsler et al . ( 2019 ) . This additionally differentiates our work from prior works such as REGAL ( Paliwal et al. , 2020 ) that assume infinite bandwidth and memory that are not practical on real hardware . Additionally , we consider single-batch inference , an important industry benchmark Mattson et al . ( 2020 ) . While large batch sizes have greater computational efficiency ( e.g. , Boudoukh et al . ( 2020 ) on NNP-I ) , they are sub-optimal for a given inference example due to the latency associated with queuing up a batch . Therefore , single-batch inference is key to many time-critical applications ( Park et al. , 2018 ) where an individual inference query needs to be processed in real-time . Results on ResNet-50 , ResNet-101 ( He et al. , 2016 ) and BERT , show that EGRL significantly outperforms the chipset ’ s native compiler across all workloads , and exceeds the performance of dynamic programming , evolutionary search and policy-gradient approaches . Specifically , the contributions of this work are : 1 . A generalized GNN-based policy that can natively accept a computational graph and produce a corresponding graph representation with the optimal memory maps . This eliminates the need for serialized , layer-dependent representations . 2 . EGRL , a scalable population-based algorithm that can effectively train on sparse and noisy feedback from the host hardware in large search spaces . 3 . An RL agent that trains directly on the hardware , with a feedback mechanism for constraint violation , and thus allowing direct deployment and testing on hardware . 2 RELATED WORK . Optimizing Hardware using Machine Learning : In this work , we study the problem of mapping tensors to memory components on a device . Several recent works have studied the use of machine learning to optimize the execution of computation graphs on hardware -a similar combinatorics problem . Mirhoseini et al . ( 2017 ) designed a policy gradient ( PG ) based Placer policy to map parts of neural models on hardware . However , it relied on a heuristic grouping strategy to significantly reduce the action space . Mirhoseini et al . ( 2018 ) improved this architecture by replacing the heuristic module with a Grouper policy . While this does represent an end-to-end PG approach , it is significantly more complex and hyperparameter-heavy than EGRL ’ s PG network . Specifically , their Placer is an LSTM based Seq-to-Seq model with attention . The hierarchical structure is domain dependent - specific to operation grouping . Mirhoseini et al . ( 2020 ) also applied Deep RL to learn subsystem placement to optimize power , performance and chip area but relied on similar heuristic grouping strategies to significantly reduce the action space seen by the agent . A closely related work is Placeto ( Addanki et al. , 2018 ) where the nodes of a computation graph are sequentially placed on hardware . Similar to EGRL , they also operate on a GNN representation . EGRL primarily differs from Placeto in simultaneously mapping all nodes . We found empirically that a sequential mapping strategy was significantly more sample-inefficient and could not scale to larger workloads . Sequential mapping strategies have the additional disadvantage of not being able to exploit parallelism during policy training . Placeto also adopts the manual grouping strategy from Mirhoseini et al . ( 2018 ) and adds an additional Merge and Collocate heuristic . In contrast , EGRL has a simpler architecture using generic PG and EA to scale to large search spaces . For example , previous work with manual grouping operate at most in 5280 ≈ 10196 dimensional action space ( Mirhoseini et al. , 2017 ) , compared to ∼ 10358 for our BERT problem . Compared to pure PG based approaches , EGRL has significantly fewer hyperparameters to tune - primarily due to the reduced dependency on PG learning by using a population based search to handle sparse rewards . Another closely related work is REGAL ( Paliwal et al. , 2020 ) , which optimizes run-time and peakmemory via hardware placement . It also utilizes a graph representation with a genetic algorithm ( GA ) guided by RL . The RL agent predicts the parameters of GA - a form of indirect information transfer - while GA directly optimizes the final strategy . In contrast , our RL and EA components co-optimize the mapping strategies via direct information transfer ( policy migration ) and a shared replay buffer . REGAL assumes infinite bandwidth , whereas we train and validate entirely on physical hardware introducing specific mechanisms to incentivize compiler-valid mappings . This ensures that our solutions are performant under real-world operating conditions and closer to production-use . As a relatively new research field , we are challenged by the unavailability of reproducible code for prior work . The domain specific heuristics as described above render it difficult to apply algorithms designed for , say , chip placement to our memory mapping problem . Therefore , we adopt a stateof-the-art PG method as a baseline , since PG is a common central component of the above prior work . Classical Search Methods : Classical methods such as Simulated Annealing ( SA ) ( Kirkpatrick et al. , 1983 ) and genetic algorithms ( GA ) have also been studied for problems that have a similar combinatorial search complexity as memory placement . SA evolves new solution via small perturbations on existing solutions and retaining solutions that yield improved performance . A temperature parameter drives the exploration into new solution spaces . Our evolutionary algorithms ( EA ) ( Floreano et al. , 2008 ; Lüders et al. , 2017 ; Fogel , 2006 ; Spears et al. , 1993 ) improve on SA by systematically evolving new solutions within a population of solutions by performing mutations ( similar to SA ) and cross-over between pairs of solutions . Both methods are known to produce highly performant and stable solutions but are also significantly slower compared to Deep RL . In this work , we use EA both as a component of EGRL and also as a baseline . The PG components of EGRL produce fast , semi-performant solutions which then become anchors in the EA module . This essentially `` guides '' the EA to a performant solution by providing better anchors to search around . We demonstrate this via ablation studies that isolate the EA and PG components of EGRL . We also introduce Boltzmann chromosomes in the EA population - a set of stateless policies that directly perturb action proposals to accelerate exploration – with a temperature term that balances exploration and exploitation . This component is motivated by SA . Evolutionary RL : Our overall architecture builds on top of CERL ( Khadka and Tumer , 2018 ; Khadka et al. , 2019 ) which combines EA and PG . It diversifies exploration by allowing a population of EA policies to add data to a central replay buffer shared by a population of PG learners . We directly build on CERL because it has been shown to be effective in optimizing sparse feedback signals . Our memory mapping solution inherently relies on optimizing a very sparse feedback signal ( e.g. , latency ) that is obtained at the end of an inference run on a workload . For the PG portion of our architecture , we adopt Soft-Actor Critic ( SAC ) ( Haarnoja et al. , 2018 ) , the current state-of-the-art model-free algorithm developed for continuous high-dimensional settings . SAC uses an actor-critic architecture with separate networks for the policy and the Q-value function . A stochastic Gaussian policy enables it to use a maximum entropy objective ( Ziebart et al. , 2008 ) through which it demonstrates state-of-the-art results . We modify SAC to be compatible with our discrete action space .
This paper proposes a new algorithm called EGRL to improve computation graph running time by optimizing placement of the graph's components on memory. Specifically, the authors demonstrate the algorithm on the Intel Neural Networks Processor for Inference (NNP-I), which allows them to map neural network components on one of three memory hierarchies, each with different tradeoffs. The authors demonstrate that this technique provides speedups on BERT, Resnet-50 and Resnet-101.
SP:4bea250d51f4de4be23762958f555db511609842
Optimizing Memory Placement using Evolutionary Graph Reinforcement Learning
1 INTRODUCTION . The proliferation of deep learning ( DL ) has been fueled , in part , by a rapid growth in the size and complexity of deep neural networks ( DNN ) ( Dean et al. , 2012 ; Ying et al. , 2018 ) . This has spurred the rapid development of hardware ( Wang et al. , 2016 ; Jouppi et al. , 2017 ) and software ( Abadi et al. , 2016 ; Paszke et al. , 2018 ; Cyphers et al. , 2018 ) dedicated to deep learning workloads that seek to optimize critical performance metrics like throughput and power efficiency ( Mattson et al. , 2020 ) . Producing compiler optimizations that map the tensors of a neural network ’ s computational graph to the memory units on host hardware is a critical challenge . Since different memory types trade off bandwidth and capacity differently , a sub-optimal mapping could significantly increase latency . For DL inference , the computational graph is static and placement can be pre-planned instead of relying on online cache management ( Zhang et al. , 2020 ; Shi et al. , 2019 ) . However , this is especially challenging with DNNs due to the high dimensional search space . For example , ResNet-50 ( He et al. , 2016 ) has 57 operational layers . Mapping each activation and weight tensor to , for example , three ( DRAM , LLC , and SRAM ) memory caches represents 3 ( 2∗57 ) ≈ 1054 possible decisions . BERT ( Devlin et al. , 2018 ) has 376 operational layers , and a search space of ∼ 10358 . Since optimizing this mapping is intractable with traditional approaches , such as dynamic programming ( Bellman , 1954 ) , current solutions primarily rely on manually-tuned heuristic rules encoded in a compiler . Because of the large search space , prior reinforcement learning ( RL ) algorithms for automating mappings have relied on manually-designed grouping ( Mirhoseini et al. , 2017 ; Addanki et al. , 2018 ) or a learned grouper whose hierarchical structure is domain dependent ( Mirhoseini et al. , 2018 ) . In addition to the extremely large action space , the large number of nodes render the reward sparse and noisy , and thus further unsuitable for gradient-based Deep RL algorithms . This sparsity stems from the fact that an overall performance metric can only be measured after all nodes have been processed . ∗Equal Contribution †Correspondence to : < somdeb.majumdar @ intel.com > In this paper , we present Evolutionary Graph Reinforcement Learning ( EGRL ) , a hybrid approach of evolutionary search with gradient-based learning , that is able to natively search in a high-dimensional space that is orders-of-magnitude larger than previous approaches . EGRL is an extension of CERL ( Khadka et al. , 2019 ) , a population based method for sparse-reward tasks that combines fast policy gradient ( PG ) learning with a stable evolutionary algorithm ( EA ) . Since the action spaces explored in this paper are several orders of magnitude larger than those explored in CERL , we introduce Boltzmann chromosomes - a set of fast , stateless policies that accelerate evolution by providing partially optimized solutions as anchors . This mechanism is necessary to improve the sampleefficiency of the slow EA component for this large action space . Further , we employ a graph neural network ( GNN ) ( Wu et al. , 2020 ; Scarselli et al. , 2008 ) to represent our policy . This allows our agent to natively process computational graphs representing deep learning workloads , enabling generalization over workloads of varying size and connectivity . We demonstrate our solution on the Intel Neural Network Processor for Inference ( NNP-I ) , a deep learning accelerator , to map modern neural networks on one of the three memory hierarchies on the chip . Each memory level in this chip has trade-offs in memory size and bandwidth , as detailed in Wechsler et al . ( 2019 ) . This additionally differentiates our work from prior works such as REGAL ( Paliwal et al. , 2020 ) that assume infinite bandwidth and memory that are not practical on real hardware . Additionally , we consider single-batch inference , an important industry benchmark Mattson et al . ( 2020 ) . While large batch sizes have greater computational efficiency ( e.g. , Boudoukh et al . ( 2020 ) on NNP-I ) , they are sub-optimal for a given inference example due to the latency associated with queuing up a batch . Therefore , single-batch inference is key to many time-critical applications ( Park et al. , 2018 ) where an individual inference query needs to be processed in real-time . Results on ResNet-50 , ResNet-101 ( He et al. , 2016 ) and BERT , show that EGRL significantly outperforms the chipset ’ s native compiler across all workloads , and exceeds the performance of dynamic programming , evolutionary search and policy-gradient approaches . Specifically , the contributions of this work are : 1 . A generalized GNN-based policy that can natively accept a computational graph and produce a corresponding graph representation with the optimal memory maps . This eliminates the need for serialized , layer-dependent representations . 2 . EGRL , a scalable population-based algorithm that can effectively train on sparse and noisy feedback from the host hardware in large search spaces . 3 . An RL agent that trains directly on the hardware , with a feedback mechanism for constraint violation , and thus allowing direct deployment and testing on hardware . 2 RELATED WORK . Optimizing Hardware using Machine Learning : In this work , we study the problem of mapping tensors to memory components on a device . Several recent works have studied the use of machine learning to optimize the execution of computation graphs on hardware -a similar combinatorics problem . Mirhoseini et al . ( 2017 ) designed a policy gradient ( PG ) based Placer policy to map parts of neural models on hardware . However , it relied on a heuristic grouping strategy to significantly reduce the action space . Mirhoseini et al . ( 2018 ) improved this architecture by replacing the heuristic module with a Grouper policy . While this does represent an end-to-end PG approach , it is significantly more complex and hyperparameter-heavy than EGRL ’ s PG network . Specifically , their Placer is an LSTM based Seq-to-Seq model with attention . The hierarchical structure is domain dependent - specific to operation grouping . Mirhoseini et al . ( 2020 ) also applied Deep RL to learn subsystem placement to optimize power , performance and chip area but relied on similar heuristic grouping strategies to significantly reduce the action space seen by the agent . A closely related work is Placeto ( Addanki et al. , 2018 ) where the nodes of a computation graph are sequentially placed on hardware . Similar to EGRL , they also operate on a GNN representation . EGRL primarily differs from Placeto in simultaneously mapping all nodes . We found empirically that a sequential mapping strategy was significantly more sample-inefficient and could not scale to larger workloads . Sequential mapping strategies have the additional disadvantage of not being able to exploit parallelism during policy training . Placeto also adopts the manual grouping strategy from Mirhoseini et al . ( 2018 ) and adds an additional Merge and Collocate heuristic . In contrast , EGRL has a simpler architecture using generic PG and EA to scale to large search spaces . For example , previous work with manual grouping operate at most in 5280 ≈ 10196 dimensional action space ( Mirhoseini et al. , 2017 ) , compared to ∼ 10358 for our BERT problem . Compared to pure PG based approaches , EGRL has significantly fewer hyperparameters to tune - primarily due to the reduced dependency on PG learning by using a population based search to handle sparse rewards . Another closely related work is REGAL ( Paliwal et al. , 2020 ) , which optimizes run-time and peakmemory via hardware placement . It also utilizes a graph representation with a genetic algorithm ( GA ) guided by RL . The RL agent predicts the parameters of GA - a form of indirect information transfer - while GA directly optimizes the final strategy . In contrast , our RL and EA components co-optimize the mapping strategies via direct information transfer ( policy migration ) and a shared replay buffer . REGAL assumes infinite bandwidth , whereas we train and validate entirely on physical hardware introducing specific mechanisms to incentivize compiler-valid mappings . This ensures that our solutions are performant under real-world operating conditions and closer to production-use . As a relatively new research field , we are challenged by the unavailability of reproducible code for prior work . The domain specific heuristics as described above render it difficult to apply algorithms designed for , say , chip placement to our memory mapping problem . Therefore , we adopt a stateof-the-art PG method as a baseline , since PG is a common central component of the above prior work . Classical Search Methods : Classical methods such as Simulated Annealing ( SA ) ( Kirkpatrick et al. , 1983 ) and genetic algorithms ( GA ) have also been studied for problems that have a similar combinatorial search complexity as memory placement . SA evolves new solution via small perturbations on existing solutions and retaining solutions that yield improved performance . A temperature parameter drives the exploration into new solution spaces . Our evolutionary algorithms ( EA ) ( Floreano et al. , 2008 ; Lüders et al. , 2017 ; Fogel , 2006 ; Spears et al. , 1993 ) improve on SA by systematically evolving new solutions within a population of solutions by performing mutations ( similar to SA ) and cross-over between pairs of solutions . Both methods are known to produce highly performant and stable solutions but are also significantly slower compared to Deep RL . In this work , we use EA both as a component of EGRL and also as a baseline . The PG components of EGRL produce fast , semi-performant solutions which then become anchors in the EA module . This essentially `` guides '' the EA to a performant solution by providing better anchors to search around . We demonstrate this via ablation studies that isolate the EA and PG components of EGRL . We also introduce Boltzmann chromosomes in the EA population - a set of stateless policies that directly perturb action proposals to accelerate exploration – with a temperature term that balances exploration and exploitation . This component is motivated by SA . Evolutionary RL : Our overall architecture builds on top of CERL ( Khadka and Tumer , 2018 ; Khadka et al. , 2019 ) which combines EA and PG . It diversifies exploration by allowing a population of EA policies to add data to a central replay buffer shared by a population of PG learners . We directly build on CERL because it has been shown to be effective in optimizing sparse feedback signals . Our memory mapping solution inherently relies on optimizing a very sparse feedback signal ( e.g. , latency ) that is obtained at the end of an inference run on a workload . For the PG portion of our architecture , we adopt Soft-Actor Critic ( SAC ) ( Haarnoja et al. , 2018 ) , the current state-of-the-art model-free algorithm developed for continuous high-dimensional settings . SAC uses an actor-critic architecture with separate networks for the policy and the Q-value function . A stochastic Gaussian policy enables it to use a maximum entropy objective ( Ziebart et al. , 2008 ) through which it demonstrates state-of-the-art results . We modify SAC to be compatible with our discrete action space .
The paper proposes Evolutionary Graph Reinforcement Learning to solve the memory placement problem. Main ideas are using GNN as the network architecture for reinforcement learning agents that look for more informed priors for evolutionary algorithms. Overall novelty of the paper comes from the neat combination of RL, EA, and GNN, and applying it to memory placement (ML for Systems).
SP:4bea250d51f4de4be23762958f555db511609842
Optimizing Memory Placement using Evolutionary Graph Reinforcement Learning
1 INTRODUCTION . The proliferation of deep learning ( DL ) has been fueled , in part , by a rapid growth in the size and complexity of deep neural networks ( DNN ) ( Dean et al. , 2012 ; Ying et al. , 2018 ) . This has spurred the rapid development of hardware ( Wang et al. , 2016 ; Jouppi et al. , 2017 ) and software ( Abadi et al. , 2016 ; Paszke et al. , 2018 ; Cyphers et al. , 2018 ) dedicated to deep learning workloads that seek to optimize critical performance metrics like throughput and power efficiency ( Mattson et al. , 2020 ) . Producing compiler optimizations that map the tensors of a neural network ’ s computational graph to the memory units on host hardware is a critical challenge . Since different memory types trade off bandwidth and capacity differently , a sub-optimal mapping could significantly increase latency . For DL inference , the computational graph is static and placement can be pre-planned instead of relying on online cache management ( Zhang et al. , 2020 ; Shi et al. , 2019 ) . However , this is especially challenging with DNNs due to the high dimensional search space . For example , ResNet-50 ( He et al. , 2016 ) has 57 operational layers . Mapping each activation and weight tensor to , for example , three ( DRAM , LLC , and SRAM ) memory caches represents 3 ( 2∗57 ) ≈ 1054 possible decisions . BERT ( Devlin et al. , 2018 ) has 376 operational layers , and a search space of ∼ 10358 . Since optimizing this mapping is intractable with traditional approaches , such as dynamic programming ( Bellman , 1954 ) , current solutions primarily rely on manually-tuned heuristic rules encoded in a compiler . Because of the large search space , prior reinforcement learning ( RL ) algorithms for automating mappings have relied on manually-designed grouping ( Mirhoseini et al. , 2017 ; Addanki et al. , 2018 ) or a learned grouper whose hierarchical structure is domain dependent ( Mirhoseini et al. , 2018 ) . In addition to the extremely large action space , the large number of nodes render the reward sparse and noisy , and thus further unsuitable for gradient-based Deep RL algorithms . This sparsity stems from the fact that an overall performance metric can only be measured after all nodes have been processed . ∗Equal Contribution †Correspondence to : < somdeb.majumdar @ intel.com > In this paper , we present Evolutionary Graph Reinforcement Learning ( EGRL ) , a hybrid approach of evolutionary search with gradient-based learning , that is able to natively search in a high-dimensional space that is orders-of-magnitude larger than previous approaches . EGRL is an extension of CERL ( Khadka et al. , 2019 ) , a population based method for sparse-reward tasks that combines fast policy gradient ( PG ) learning with a stable evolutionary algorithm ( EA ) . Since the action spaces explored in this paper are several orders of magnitude larger than those explored in CERL , we introduce Boltzmann chromosomes - a set of fast , stateless policies that accelerate evolution by providing partially optimized solutions as anchors . This mechanism is necessary to improve the sampleefficiency of the slow EA component for this large action space . Further , we employ a graph neural network ( GNN ) ( Wu et al. , 2020 ; Scarselli et al. , 2008 ) to represent our policy . This allows our agent to natively process computational graphs representing deep learning workloads , enabling generalization over workloads of varying size and connectivity . We demonstrate our solution on the Intel Neural Network Processor for Inference ( NNP-I ) , a deep learning accelerator , to map modern neural networks on one of the three memory hierarchies on the chip . Each memory level in this chip has trade-offs in memory size and bandwidth , as detailed in Wechsler et al . ( 2019 ) . This additionally differentiates our work from prior works such as REGAL ( Paliwal et al. , 2020 ) that assume infinite bandwidth and memory that are not practical on real hardware . Additionally , we consider single-batch inference , an important industry benchmark Mattson et al . ( 2020 ) . While large batch sizes have greater computational efficiency ( e.g. , Boudoukh et al . ( 2020 ) on NNP-I ) , they are sub-optimal for a given inference example due to the latency associated with queuing up a batch . Therefore , single-batch inference is key to many time-critical applications ( Park et al. , 2018 ) where an individual inference query needs to be processed in real-time . Results on ResNet-50 , ResNet-101 ( He et al. , 2016 ) and BERT , show that EGRL significantly outperforms the chipset ’ s native compiler across all workloads , and exceeds the performance of dynamic programming , evolutionary search and policy-gradient approaches . Specifically , the contributions of this work are : 1 . A generalized GNN-based policy that can natively accept a computational graph and produce a corresponding graph representation with the optimal memory maps . This eliminates the need for serialized , layer-dependent representations . 2 . EGRL , a scalable population-based algorithm that can effectively train on sparse and noisy feedback from the host hardware in large search spaces . 3 . An RL agent that trains directly on the hardware , with a feedback mechanism for constraint violation , and thus allowing direct deployment and testing on hardware . 2 RELATED WORK . Optimizing Hardware using Machine Learning : In this work , we study the problem of mapping tensors to memory components on a device . Several recent works have studied the use of machine learning to optimize the execution of computation graphs on hardware -a similar combinatorics problem . Mirhoseini et al . ( 2017 ) designed a policy gradient ( PG ) based Placer policy to map parts of neural models on hardware . However , it relied on a heuristic grouping strategy to significantly reduce the action space . Mirhoseini et al . ( 2018 ) improved this architecture by replacing the heuristic module with a Grouper policy . While this does represent an end-to-end PG approach , it is significantly more complex and hyperparameter-heavy than EGRL ’ s PG network . Specifically , their Placer is an LSTM based Seq-to-Seq model with attention . The hierarchical structure is domain dependent - specific to operation grouping . Mirhoseini et al . ( 2020 ) also applied Deep RL to learn subsystem placement to optimize power , performance and chip area but relied on similar heuristic grouping strategies to significantly reduce the action space seen by the agent . A closely related work is Placeto ( Addanki et al. , 2018 ) where the nodes of a computation graph are sequentially placed on hardware . Similar to EGRL , they also operate on a GNN representation . EGRL primarily differs from Placeto in simultaneously mapping all nodes . We found empirically that a sequential mapping strategy was significantly more sample-inefficient and could not scale to larger workloads . Sequential mapping strategies have the additional disadvantage of not being able to exploit parallelism during policy training . Placeto also adopts the manual grouping strategy from Mirhoseini et al . ( 2018 ) and adds an additional Merge and Collocate heuristic . In contrast , EGRL has a simpler architecture using generic PG and EA to scale to large search spaces . For example , previous work with manual grouping operate at most in 5280 ≈ 10196 dimensional action space ( Mirhoseini et al. , 2017 ) , compared to ∼ 10358 for our BERT problem . Compared to pure PG based approaches , EGRL has significantly fewer hyperparameters to tune - primarily due to the reduced dependency on PG learning by using a population based search to handle sparse rewards . Another closely related work is REGAL ( Paliwal et al. , 2020 ) , which optimizes run-time and peakmemory via hardware placement . It also utilizes a graph representation with a genetic algorithm ( GA ) guided by RL . The RL agent predicts the parameters of GA - a form of indirect information transfer - while GA directly optimizes the final strategy . In contrast , our RL and EA components co-optimize the mapping strategies via direct information transfer ( policy migration ) and a shared replay buffer . REGAL assumes infinite bandwidth , whereas we train and validate entirely on physical hardware introducing specific mechanisms to incentivize compiler-valid mappings . This ensures that our solutions are performant under real-world operating conditions and closer to production-use . As a relatively new research field , we are challenged by the unavailability of reproducible code for prior work . The domain specific heuristics as described above render it difficult to apply algorithms designed for , say , chip placement to our memory mapping problem . Therefore , we adopt a stateof-the-art PG method as a baseline , since PG is a common central component of the above prior work . Classical Search Methods : Classical methods such as Simulated Annealing ( SA ) ( Kirkpatrick et al. , 1983 ) and genetic algorithms ( GA ) have also been studied for problems that have a similar combinatorial search complexity as memory placement . SA evolves new solution via small perturbations on existing solutions and retaining solutions that yield improved performance . A temperature parameter drives the exploration into new solution spaces . Our evolutionary algorithms ( EA ) ( Floreano et al. , 2008 ; Lüders et al. , 2017 ; Fogel , 2006 ; Spears et al. , 1993 ) improve on SA by systematically evolving new solutions within a population of solutions by performing mutations ( similar to SA ) and cross-over between pairs of solutions . Both methods are known to produce highly performant and stable solutions but are also significantly slower compared to Deep RL . In this work , we use EA both as a component of EGRL and also as a baseline . The PG components of EGRL produce fast , semi-performant solutions which then become anchors in the EA module . This essentially `` guides '' the EA to a performant solution by providing better anchors to search around . We demonstrate this via ablation studies that isolate the EA and PG components of EGRL . We also introduce Boltzmann chromosomes in the EA population - a set of stateless policies that directly perturb action proposals to accelerate exploration – with a temperature term that balances exploration and exploitation . This component is motivated by SA . Evolutionary RL : Our overall architecture builds on top of CERL ( Khadka and Tumer , 2018 ; Khadka et al. , 2019 ) which combines EA and PG . It diversifies exploration by allowing a population of EA policies to add data to a central replay buffer shared by a population of PG learners . We directly build on CERL because it has been shown to be effective in optimizing sparse feedback signals . Our memory mapping solution inherently relies on optimizing a very sparse feedback signal ( e.g. , latency ) that is obtained at the end of an inference run on a workload . For the PG portion of our architecture , we adopt Soft-Actor Critic ( SAC ) ( Haarnoja et al. , 2018 ) , the current state-of-the-art model-free algorithm developed for continuous high-dimensional settings . SAC uses an actor-critic architecture with separate networks for the policy and the Q-value function . A stochastic Gaussian policy enables it to use a maximum entropy objective ( Ziebart et al. , 2008 ) through which it demonstrates state-of-the-art results . We modify SAC to be compatible with our discrete action space .
Optimizing the execution of deep neural networks has tremendous impact on the cost and performance in many industries due to the proliferation of "Deep Learning". There has recently been an interesting line of work of using learning to optimize policies related to placement and scheduling of the neural network computation graph outperforming tediously hand-crafted heuristics. The proposed paper would be a nice extension along this line.
SP:4bea250d51f4de4be23762958f555db511609842
Gradient Vaccine: Investigating and Improving Multi-task Optimization in Massively Multilingual Models
1 INTRODUCTION . Modern multilingual methods , such as multilingual language models ( Devlin et al. , 2018 ; Lample & Conneau , 2019 ; Conneau et al. , 2019 ) and multilingual neural machine translation ( NMT ) ( Firat et al. , 2016 ; Johnson et al. , 2017 ; Aharoni et al. , 2019 ; Arivazhagan et al. , 2019 ) , have been showing success in processing tens or hundreds of languages simultaneously in a single large model . These models are appealing for two reasons : ( 1 ) Efficiency : training and deploying a single multilingual model requires much less resources than maintaining one model for each language considered , ( 2 ) Positive cross-lingual transfer : by transferring knowledge from high-resource languages ( HRL ) , multilingual models are able to improve performance on low-resource languages ( LRL ) on a wide variety of tasks ( Pires et al. , 2019 ; Wu & Dredze , 2019 ; Siddhant et al. , 2020 ; Hu et al. , 2020 ) . Despite their efficacy , how to properly analyze or improve the optimization procedure of multilingual models remains under-explored . In particular , multilingual models are multi-task learning ( MTL ) ( Ruder , 2017 ) in nature but existing literature often train them in a monolithic manner , naively using a single language-agnostic objective on the concatenated corpus of many languages . While this approach ignores task relatedness and might induce negative interference ( Wang et al. , 2020b ) , its optimization process also remains a black-box , muffling the interaction among different languages during training and the cross-lingual transferring mechanism . In this work , we attempt to open the multilingual optimization black-box via the analysis of loss geometry . Specifically , we aim to answer the following questions : ( 1 ) Do typologically similar languages enjoy more similar loss geometries in the optimization process of multilingual models ? ( 2 ) If so , in the joint training procedure , do more similar gradient trajectories imply less interference between tasks , hence leading to better model quality ? ( 3 ) Lastly , can we deliberately encourage ∗Work done during an internship at Google . more geometrically aligned parameter updates to improve multi-task optimization , especially in real-world massively multilingual models that contain heavily noisy and unbalanced training data ? Towards this end , we perform a comprehensive study on massively multilingual neural machine translation tasks , where each language pair is considered as a separate task . We first study the correlation between language and loss geometry similarities , characterized by gradient similarity along the optimization trajectory . We investigate how they evolve throughout the whole training process , and glean insights on how they correlate with cross-lingual transfer and joint performance . In particular , our experiments reveal that gradient similarities across tasks correlate strongly with both language proximities and model performance , and thus we observe that typologically close languages share similar gradients that would further lead to well-aligned multilingual structure ( Wu et al. , 2019 ) and successful cross-lingual transfer . Based on these findings , we identify a major limitation of a popular multi-task learning method ( Yu et al. , 2020 ) applied in multilingual models and propose a preemptive method , Gradient Vaccine , that leverages task relatedness to set gradient similarity objectives and adaptively align task gradients to achieve such objectives . Empirically , our approach obtains significant performance gain over the standard monolithic optimization strategy and popular multi-task baselines on large-scale multilingual NMT models and multilingual language models . To the best of our knowledge , this is the first work to systematically study and improve loss geometries in multilingual optimization at scale . 2 INVESTIGATING MULTI-TASK OPTIMIZATION IN MASSIVELY MULTILINGUAL MODELS . While prior work have studied the effect of data ( Arivazhagan et al. , 2019 ; Wang et al. , 2020a ) , architecture ( Blackwood et al. , 2018 ; Sachan & Neubig , 2018 ; Vázquez et al. , 2019 ; Escolano et al. , 2020 ) and scale ( Huang et al. , 2019b ; Lepikhin et al. , 2020 ) on multilingual models , their optimization dynamics are not well understood . We hereby perform a series of control experiments on massively multilingual NMT models to investigate how gradients interact in multilingual settings and what are their impacts on model performance , as existing work hypothesizes that gradient conflicts , defined as negative cosine similarity between gradients , can be detrimental for multi-task learning ( Yu et al. , 2020 ) and cause negative transfer ( Wang et al. , 2019 ) . 2.1 EXPERIMENTAL SETUP . For training multilingual machine translation models , we mainly follow the setup in Arivazhagan et al . ( 2019 ) . In particular , we jointly train multiple translation language pairs in a single sequenceto-sequence ( seq2seq ) model ( Sutskever et al. , 2014 ) . We use the Transformer-Big ( Vaswani et al. , 2017 ) architecture containing 375M parameters described in ( Chen et al. , 2018a ) , where all parameters are shared across language pairs . We use an effective batch sizes of 500k tokens , and utilize data parallelism to train all models over 64 TPUv3 chips . Sentences are encoded using a shared source-target Sentence Piece Model ( Kudo & Richardson , 2018 ) with 64k tokens , and a < 2xx > token is prepended to the source sentence to indicate the target language ( Johnson et al. , 2017 ) . The full training details can be found in Appendix B . To study real-world multi-task optimization on a massive scale , we use an in-house training corpus1 ( Arivazhagan et al. , 2019 ) generated by crawling and extracting parallel sentences from the web ( Uszkoreit et al. , 2010 ) , which contains more than 25 billion sentence pairs for 102 languages to and from English . We select 25 languages ( 50 language pairs pivoted on English ) , containing over 8 billion sentence pairs , from 10 diverse language families and 4 different levels of data sizes ( detailed in Appendix A ) . We then train two models on two directions separately , namely Any→En and En→Any . Furthermore , to minimize the confounding factors of inconsistent sentence semantics across language pairs , we create a multi-way aligned evaluation set of 3k sentences for all languages2 . Then , for each checkpoint at an interval of 1000 training steps , we measure pair-wise cosine similarities of the model ’ s gradients on this dataset between all language pairs . We examine gradient similarities at various granularities , from specific layers to the entire model . 1We also experiment on publicly available dataset of WMT and obtain similar observations in Appendix C. 2In other words , 3k semantically identical sentences are given in 25 languages . 2.2 OBSERVATIONS . We make the following three main observations . Our findings are consistent across different model architectures and settings ( see Appendix C and D for more results and additional discussions ) . 1 . Gradient similarities reflect language proximities . We first examine if close tasks enjoy similar loss geometries and vice versa . Here , we use language proximity ( defined according to their memberships in a linguistic language family ) to control task similarity , and utilize gradient similarity to measure loss geometry . We choose typological similarity because it is informative and popular , and we leave the exploration of other language similarity measurements for future work . In Figure 1 , we use a symmetric heatmap to visualize pair-wise gradient similarities , averaged across all checkpoints at different training steps . Specifically , we observe strong clustering by membership closeness in the linguistic family , along the diagonal of the gradient similarity matrix . In addition , all European languages form a large cluster in the upper-left corner , with an even smaller fine-grained cluster of Slavic languages inside . Furthermore , we also observe similarities for Western European languages gradually decrease in West Slavic→South Slavic→East Slavic , illustrating the gradual continuum of language proximity . 2 . Gradient similarities correlate positively with model quality . As gradient similarities correlate well with task proximities , it is natural to ask whether higher gradient similarities lead to better multi-task performance . In Figure 2 ( a ) , we train a joint model of all language pairs in both En→Any and Any→En directions , and compare gradient similarities between these two . While prior work has shown that En→Any is harder and less amenable for positive transfer ( Arivazhagan et al. , 2019 ) , we find that gradients of tasks in En→Any are indeed less similar than those in Any→En . On the other hand , while larger batch sizes often improve model quality , we observe that models trained with smaller batches have less similar loss geometries ( Appendix D ) . These all indicate that gradient interference poses great challenge to the learning procedure . To further verify this , we pair En→Fr with different language pairs ( e.g . En→Es or En→Hi ) , and train a set of models with exactly two language pairs5 . We then evaluate their performance on the En→Fr test set , and compare their BLEU scores versus gradient similarities between paired two tasks . As shown in Figure 2 ( b ) , gradient similarities correlate positively with model performance , again demonstrating that dissimilar gradients introduce interference and undermine model quality . 3 . Gradient similarities evolve across layers and training steps . While the previous discussion focuses on the gradient similarity of the whole model averaged over all checkpoints , we now 4Western European includes Romance and Germanic . 5To remove confounding factors , we fix the same sampling strategy for all these models . study it across different layers and training steps . Figure 4 ( c ) shows the evolution of the gradient similarities throughout the training . Interestingly , we observe diverse patterns for different gradient subsets . For instance , gradients between En→Fr and En→Hi gradually become less similar ( from positive to negative ) in layer 1 of the decoder but more similar ( from negative to positive ) in the encoder of the same layer . On the other hand , gradient similarities between En→Fr and En→Es are always higher than those between En→Fr and En→Hi in the same layer , consistent with prior observation that gradients reflect language similarities . In addition , we evaluate the difference between gradient similarities in the multilingual encoder and decoder in Figure 4 ( a ) . We find that the gradients are more similar in the decoder ( positive values ) for the Any→En direction but less similar ( negative values ) for the En→Any direction . This is in line with our intuition that gradients should be more consistent when the decoder only needs to handle one single language . Moreover , we visualize how gradient similarities evolve across layers in Figure 4 ( b ) . We notice that similarity between gradients increase/decrease as we move up from bottom to top layers for the Any→En/En→Any direction , and hypothesize that this is due to the difference in label space ( English-only tokens versus tokens from many languages ) . These results demonstrate that the dynamics of gradients evolve over model layers and training time . Our analysis highlights the important role of loss geometries in multilingual models . With these points in mind , we next turn to the problem of how to improve multi-task optimization in multilingual models in a systematic way . 3 PROPOSED METHOD Following our observations that inter-task loss geometries correlate well with language similarities and model quality , a natural question to ask next is how we can take advantage of such gradient dynamics and design optimization procedures superior to the standard monolithic practice . Since we train large-scale models on real-world dataset consisting of billions of words , of which tasks are highly unbalanced and exhibit complex interactions , we propose an effective approach that not only exploits inter-task structures but also is applicable to unbalanced tasks and noisy data . To motivate our method , we first review a state-of-the-art multi-task learning method and show how the observation in Section 2 helps us to identify its limitation .
The paper studies the behaviour of gradient similarities across languages in multilingual NMT models. They find gradient similarities mirror language similarity. Hence, they look at method to gradient-based methods for multilingual NMT. They apply PCGrad to the multilingual NMT task and also extend this method to address the cases when the task gradients have only weak similarity.
SP:7d2d23d569debc0e7857f6b61b54c7d632bccefc
Gradient Vaccine: Investigating and Improving Multi-task Optimization in Massively Multilingual Models
1 INTRODUCTION . Modern multilingual methods , such as multilingual language models ( Devlin et al. , 2018 ; Lample & Conneau , 2019 ; Conneau et al. , 2019 ) and multilingual neural machine translation ( NMT ) ( Firat et al. , 2016 ; Johnson et al. , 2017 ; Aharoni et al. , 2019 ; Arivazhagan et al. , 2019 ) , have been showing success in processing tens or hundreds of languages simultaneously in a single large model . These models are appealing for two reasons : ( 1 ) Efficiency : training and deploying a single multilingual model requires much less resources than maintaining one model for each language considered , ( 2 ) Positive cross-lingual transfer : by transferring knowledge from high-resource languages ( HRL ) , multilingual models are able to improve performance on low-resource languages ( LRL ) on a wide variety of tasks ( Pires et al. , 2019 ; Wu & Dredze , 2019 ; Siddhant et al. , 2020 ; Hu et al. , 2020 ) . Despite their efficacy , how to properly analyze or improve the optimization procedure of multilingual models remains under-explored . In particular , multilingual models are multi-task learning ( MTL ) ( Ruder , 2017 ) in nature but existing literature often train them in a monolithic manner , naively using a single language-agnostic objective on the concatenated corpus of many languages . While this approach ignores task relatedness and might induce negative interference ( Wang et al. , 2020b ) , its optimization process also remains a black-box , muffling the interaction among different languages during training and the cross-lingual transferring mechanism . In this work , we attempt to open the multilingual optimization black-box via the analysis of loss geometry . Specifically , we aim to answer the following questions : ( 1 ) Do typologically similar languages enjoy more similar loss geometries in the optimization process of multilingual models ? ( 2 ) If so , in the joint training procedure , do more similar gradient trajectories imply less interference between tasks , hence leading to better model quality ? ( 3 ) Lastly , can we deliberately encourage ∗Work done during an internship at Google . more geometrically aligned parameter updates to improve multi-task optimization , especially in real-world massively multilingual models that contain heavily noisy and unbalanced training data ? Towards this end , we perform a comprehensive study on massively multilingual neural machine translation tasks , where each language pair is considered as a separate task . We first study the correlation between language and loss geometry similarities , characterized by gradient similarity along the optimization trajectory . We investigate how they evolve throughout the whole training process , and glean insights on how they correlate with cross-lingual transfer and joint performance . In particular , our experiments reveal that gradient similarities across tasks correlate strongly with both language proximities and model performance , and thus we observe that typologically close languages share similar gradients that would further lead to well-aligned multilingual structure ( Wu et al. , 2019 ) and successful cross-lingual transfer . Based on these findings , we identify a major limitation of a popular multi-task learning method ( Yu et al. , 2020 ) applied in multilingual models and propose a preemptive method , Gradient Vaccine , that leverages task relatedness to set gradient similarity objectives and adaptively align task gradients to achieve such objectives . Empirically , our approach obtains significant performance gain over the standard monolithic optimization strategy and popular multi-task baselines on large-scale multilingual NMT models and multilingual language models . To the best of our knowledge , this is the first work to systematically study and improve loss geometries in multilingual optimization at scale . 2 INVESTIGATING MULTI-TASK OPTIMIZATION IN MASSIVELY MULTILINGUAL MODELS . While prior work have studied the effect of data ( Arivazhagan et al. , 2019 ; Wang et al. , 2020a ) , architecture ( Blackwood et al. , 2018 ; Sachan & Neubig , 2018 ; Vázquez et al. , 2019 ; Escolano et al. , 2020 ) and scale ( Huang et al. , 2019b ; Lepikhin et al. , 2020 ) on multilingual models , their optimization dynamics are not well understood . We hereby perform a series of control experiments on massively multilingual NMT models to investigate how gradients interact in multilingual settings and what are their impacts on model performance , as existing work hypothesizes that gradient conflicts , defined as negative cosine similarity between gradients , can be detrimental for multi-task learning ( Yu et al. , 2020 ) and cause negative transfer ( Wang et al. , 2019 ) . 2.1 EXPERIMENTAL SETUP . For training multilingual machine translation models , we mainly follow the setup in Arivazhagan et al . ( 2019 ) . In particular , we jointly train multiple translation language pairs in a single sequenceto-sequence ( seq2seq ) model ( Sutskever et al. , 2014 ) . We use the Transformer-Big ( Vaswani et al. , 2017 ) architecture containing 375M parameters described in ( Chen et al. , 2018a ) , where all parameters are shared across language pairs . We use an effective batch sizes of 500k tokens , and utilize data parallelism to train all models over 64 TPUv3 chips . Sentences are encoded using a shared source-target Sentence Piece Model ( Kudo & Richardson , 2018 ) with 64k tokens , and a < 2xx > token is prepended to the source sentence to indicate the target language ( Johnson et al. , 2017 ) . The full training details can be found in Appendix B . To study real-world multi-task optimization on a massive scale , we use an in-house training corpus1 ( Arivazhagan et al. , 2019 ) generated by crawling and extracting parallel sentences from the web ( Uszkoreit et al. , 2010 ) , which contains more than 25 billion sentence pairs for 102 languages to and from English . We select 25 languages ( 50 language pairs pivoted on English ) , containing over 8 billion sentence pairs , from 10 diverse language families and 4 different levels of data sizes ( detailed in Appendix A ) . We then train two models on two directions separately , namely Any→En and En→Any . Furthermore , to minimize the confounding factors of inconsistent sentence semantics across language pairs , we create a multi-way aligned evaluation set of 3k sentences for all languages2 . Then , for each checkpoint at an interval of 1000 training steps , we measure pair-wise cosine similarities of the model ’ s gradients on this dataset between all language pairs . We examine gradient similarities at various granularities , from specific layers to the entire model . 1We also experiment on publicly available dataset of WMT and obtain similar observations in Appendix C. 2In other words , 3k semantically identical sentences are given in 25 languages . 2.2 OBSERVATIONS . We make the following three main observations . Our findings are consistent across different model architectures and settings ( see Appendix C and D for more results and additional discussions ) . 1 . Gradient similarities reflect language proximities . We first examine if close tasks enjoy similar loss geometries and vice versa . Here , we use language proximity ( defined according to their memberships in a linguistic language family ) to control task similarity , and utilize gradient similarity to measure loss geometry . We choose typological similarity because it is informative and popular , and we leave the exploration of other language similarity measurements for future work . In Figure 1 , we use a symmetric heatmap to visualize pair-wise gradient similarities , averaged across all checkpoints at different training steps . Specifically , we observe strong clustering by membership closeness in the linguistic family , along the diagonal of the gradient similarity matrix . In addition , all European languages form a large cluster in the upper-left corner , with an even smaller fine-grained cluster of Slavic languages inside . Furthermore , we also observe similarities for Western European languages gradually decrease in West Slavic→South Slavic→East Slavic , illustrating the gradual continuum of language proximity . 2 . Gradient similarities correlate positively with model quality . As gradient similarities correlate well with task proximities , it is natural to ask whether higher gradient similarities lead to better multi-task performance . In Figure 2 ( a ) , we train a joint model of all language pairs in both En→Any and Any→En directions , and compare gradient similarities between these two . While prior work has shown that En→Any is harder and less amenable for positive transfer ( Arivazhagan et al. , 2019 ) , we find that gradients of tasks in En→Any are indeed less similar than those in Any→En . On the other hand , while larger batch sizes often improve model quality , we observe that models trained with smaller batches have less similar loss geometries ( Appendix D ) . These all indicate that gradient interference poses great challenge to the learning procedure . To further verify this , we pair En→Fr with different language pairs ( e.g . En→Es or En→Hi ) , and train a set of models with exactly two language pairs5 . We then evaluate their performance on the En→Fr test set , and compare their BLEU scores versus gradient similarities between paired two tasks . As shown in Figure 2 ( b ) , gradient similarities correlate positively with model performance , again demonstrating that dissimilar gradients introduce interference and undermine model quality . 3 . Gradient similarities evolve across layers and training steps . While the previous discussion focuses on the gradient similarity of the whole model averaged over all checkpoints , we now 4Western European includes Romance and Germanic . 5To remove confounding factors , we fix the same sampling strategy for all these models . study it across different layers and training steps . Figure 4 ( c ) shows the evolution of the gradient similarities throughout the training . Interestingly , we observe diverse patterns for different gradient subsets . For instance , gradients between En→Fr and En→Hi gradually become less similar ( from positive to negative ) in layer 1 of the decoder but more similar ( from negative to positive ) in the encoder of the same layer . On the other hand , gradient similarities between En→Fr and En→Es are always higher than those between En→Fr and En→Hi in the same layer , consistent with prior observation that gradients reflect language similarities . In addition , we evaluate the difference between gradient similarities in the multilingual encoder and decoder in Figure 4 ( a ) . We find that the gradients are more similar in the decoder ( positive values ) for the Any→En direction but less similar ( negative values ) for the En→Any direction . This is in line with our intuition that gradients should be more consistent when the decoder only needs to handle one single language . Moreover , we visualize how gradient similarities evolve across layers in Figure 4 ( b ) . We notice that similarity between gradients increase/decrease as we move up from bottom to top layers for the Any→En/En→Any direction , and hypothesize that this is due to the difference in label space ( English-only tokens versus tokens from many languages ) . These results demonstrate that the dynamics of gradients evolve over model layers and training time . Our analysis highlights the important role of loss geometries in multilingual models . With these points in mind , we next turn to the problem of how to improve multi-task optimization in multilingual models in a systematic way . 3 PROPOSED METHOD Following our observations that inter-task loss geometries correlate well with language similarities and model quality , a natural question to ask next is how we can take advantage of such gradient dynamics and design optimization procedures superior to the standard monolithic practice . Since we train large-scale models on real-world dataset consisting of billions of words , of which tasks are highly unbalanced and exhibit complex interactions , we propose an effective approach that not only exploits inter-task structures but also is applicable to unbalanced tasks and noisy data . To motivate our method , we first review a state-of-the-art multi-task learning method and show how the observation in Section 2 helps us to identify its limitation .
This paper conducts comprehensive analyses and a method to the multi-task training in multilingual models. By analyzing the gradient similarity of two tasks in multilingual NMT, this paper reveals that gradient similarities reflect language proximities, correlate with model quality, and also evolve with layers and training steps. Furthermore, this paper proposes a method called GradVac to improve the multi-task training over standard monolithic training. Experiment results show GradVac achieves better accuracy than other multi-task optimization methods.
SP:7d2d23d569debc0e7857f6b61b54c7d632bccefc
Gradient Vaccine: Investigating and Improving Multi-task Optimization in Massively Multilingual Models
1 INTRODUCTION . Modern multilingual methods , such as multilingual language models ( Devlin et al. , 2018 ; Lample & Conneau , 2019 ; Conneau et al. , 2019 ) and multilingual neural machine translation ( NMT ) ( Firat et al. , 2016 ; Johnson et al. , 2017 ; Aharoni et al. , 2019 ; Arivazhagan et al. , 2019 ) , have been showing success in processing tens or hundreds of languages simultaneously in a single large model . These models are appealing for two reasons : ( 1 ) Efficiency : training and deploying a single multilingual model requires much less resources than maintaining one model for each language considered , ( 2 ) Positive cross-lingual transfer : by transferring knowledge from high-resource languages ( HRL ) , multilingual models are able to improve performance on low-resource languages ( LRL ) on a wide variety of tasks ( Pires et al. , 2019 ; Wu & Dredze , 2019 ; Siddhant et al. , 2020 ; Hu et al. , 2020 ) . Despite their efficacy , how to properly analyze or improve the optimization procedure of multilingual models remains under-explored . In particular , multilingual models are multi-task learning ( MTL ) ( Ruder , 2017 ) in nature but existing literature often train them in a monolithic manner , naively using a single language-agnostic objective on the concatenated corpus of many languages . While this approach ignores task relatedness and might induce negative interference ( Wang et al. , 2020b ) , its optimization process also remains a black-box , muffling the interaction among different languages during training and the cross-lingual transferring mechanism . In this work , we attempt to open the multilingual optimization black-box via the analysis of loss geometry . Specifically , we aim to answer the following questions : ( 1 ) Do typologically similar languages enjoy more similar loss geometries in the optimization process of multilingual models ? ( 2 ) If so , in the joint training procedure , do more similar gradient trajectories imply less interference between tasks , hence leading to better model quality ? ( 3 ) Lastly , can we deliberately encourage ∗Work done during an internship at Google . more geometrically aligned parameter updates to improve multi-task optimization , especially in real-world massively multilingual models that contain heavily noisy and unbalanced training data ? Towards this end , we perform a comprehensive study on massively multilingual neural machine translation tasks , where each language pair is considered as a separate task . We first study the correlation between language and loss geometry similarities , characterized by gradient similarity along the optimization trajectory . We investigate how they evolve throughout the whole training process , and glean insights on how they correlate with cross-lingual transfer and joint performance . In particular , our experiments reveal that gradient similarities across tasks correlate strongly with both language proximities and model performance , and thus we observe that typologically close languages share similar gradients that would further lead to well-aligned multilingual structure ( Wu et al. , 2019 ) and successful cross-lingual transfer . Based on these findings , we identify a major limitation of a popular multi-task learning method ( Yu et al. , 2020 ) applied in multilingual models and propose a preemptive method , Gradient Vaccine , that leverages task relatedness to set gradient similarity objectives and adaptively align task gradients to achieve such objectives . Empirically , our approach obtains significant performance gain over the standard monolithic optimization strategy and popular multi-task baselines on large-scale multilingual NMT models and multilingual language models . To the best of our knowledge , this is the first work to systematically study and improve loss geometries in multilingual optimization at scale . 2 INVESTIGATING MULTI-TASK OPTIMIZATION IN MASSIVELY MULTILINGUAL MODELS . While prior work have studied the effect of data ( Arivazhagan et al. , 2019 ; Wang et al. , 2020a ) , architecture ( Blackwood et al. , 2018 ; Sachan & Neubig , 2018 ; Vázquez et al. , 2019 ; Escolano et al. , 2020 ) and scale ( Huang et al. , 2019b ; Lepikhin et al. , 2020 ) on multilingual models , their optimization dynamics are not well understood . We hereby perform a series of control experiments on massively multilingual NMT models to investigate how gradients interact in multilingual settings and what are their impacts on model performance , as existing work hypothesizes that gradient conflicts , defined as negative cosine similarity between gradients , can be detrimental for multi-task learning ( Yu et al. , 2020 ) and cause negative transfer ( Wang et al. , 2019 ) . 2.1 EXPERIMENTAL SETUP . For training multilingual machine translation models , we mainly follow the setup in Arivazhagan et al . ( 2019 ) . In particular , we jointly train multiple translation language pairs in a single sequenceto-sequence ( seq2seq ) model ( Sutskever et al. , 2014 ) . We use the Transformer-Big ( Vaswani et al. , 2017 ) architecture containing 375M parameters described in ( Chen et al. , 2018a ) , where all parameters are shared across language pairs . We use an effective batch sizes of 500k tokens , and utilize data parallelism to train all models over 64 TPUv3 chips . Sentences are encoded using a shared source-target Sentence Piece Model ( Kudo & Richardson , 2018 ) with 64k tokens , and a < 2xx > token is prepended to the source sentence to indicate the target language ( Johnson et al. , 2017 ) . The full training details can be found in Appendix B . To study real-world multi-task optimization on a massive scale , we use an in-house training corpus1 ( Arivazhagan et al. , 2019 ) generated by crawling and extracting parallel sentences from the web ( Uszkoreit et al. , 2010 ) , which contains more than 25 billion sentence pairs for 102 languages to and from English . We select 25 languages ( 50 language pairs pivoted on English ) , containing over 8 billion sentence pairs , from 10 diverse language families and 4 different levels of data sizes ( detailed in Appendix A ) . We then train two models on two directions separately , namely Any→En and En→Any . Furthermore , to minimize the confounding factors of inconsistent sentence semantics across language pairs , we create a multi-way aligned evaluation set of 3k sentences for all languages2 . Then , for each checkpoint at an interval of 1000 training steps , we measure pair-wise cosine similarities of the model ’ s gradients on this dataset between all language pairs . We examine gradient similarities at various granularities , from specific layers to the entire model . 1We also experiment on publicly available dataset of WMT and obtain similar observations in Appendix C. 2In other words , 3k semantically identical sentences are given in 25 languages . 2.2 OBSERVATIONS . We make the following three main observations . Our findings are consistent across different model architectures and settings ( see Appendix C and D for more results and additional discussions ) . 1 . Gradient similarities reflect language proximities . We first examine if close tasks enjoy similar loss geometries and vice versa . Here , we use language proximity ( defined according to their memberships in a linguistic language family ) to control task similarity , and utilize gradient similarity to measure loss geometry . We choose typological similarity because it is informative and popular , and we leave the exploration of other language similarity measurements for future work . In Figure 1 , we use a symmetric heatmap to visualize pair-wise gradient similarities , averaged across all checkpoints at different training steps . Specifically , we observe strong clustering by membership closeness in the linguistic family , along the diagonal of the gradient similarity matrix . In addition , all European languages form a large cluster in the upper-left corner , with an even smaller fine-grained cluster of Slavic languages inside . Furthermore , we also observe similarities for Western European languages gradually decrease in West Slavic→South Slavic→East Slavic , illustrating the gradual continuum of language proximity . 2 . Gradient similarities correlate positively with model quality . As gradient similarities correlate well with task proximities , it is natural to ask whether higher gradient similarities lead to better multi-task performance . In Figure 2 ( a ) , we train a joint model of all language pairs in both En→Any and Any→En directions , and compare gradient similarities between these two . While prior work has shown that En→Any is harder and less amenable for positive transfer ( Arivazhagan et al. , 2019 ) , we find that gradients of tasks in En→Any are indeed less similar than those in Any→En . On the other hand , while larger batch sizes often improve model quality , we observe that models trained with smaller batches have less similar loss geometries ( Appendix D ) . These all indicate that gradient interference poses great challenge to the learning procedure . To further verify this , we pair En→Fr with different language pairs ( e.g . En→Es or En→Hi ) , and train a set of models with exactly two language pairs5 . We then evaluate their performance on the En→Fr test set , and compare their BLEU scores versus gradient similarities between paired two tasks . As shown in Figure 2 ( b ) , gradient similarities correlate positively with model performance , again demonstrating that dissimilar gradients introduce interference and undermine model quality . 3 . Gradient similarities evolve across layers and training steps . While the previous discussion focuses on the gradient similarity of the whole model averaged over all checkpoints , we now 4Western European includes Romance and Germanic . 5To remove confounding factors , we fix the same sampling strategy for all these models . study it across different layers and training steps . Figure 4 ( c ) shows the evolution of the gradient similarities throughout the training . Interestingly , we observe diverse patterns for different gradient subsets . For instance , gradients between En→Fr and En→Hi gradually become less similar ( from positive to negative ) in layer 1 of the decoder but more similar ( from negative to positive ) in the encoder of the same layer . On the other hand , gradient similarities between En→Fr and En→Es are always higher than those between En→Fr and En→Hi in the same layer , consistent with prior observation that gradients reflect language similarities . In addition , we evaluate the difference between gradient similarities in the multilingual encoder and decoder in Figure 4 ( a ) . We find that the gradients are more similar in the decoder ( positive values ) for the Any→En direction but less similar ( negative values ) for the En→Any direction . This is in line with our intuition that gradients should be more consistent when the decoder only needs to handle one single language . Moreover , we visualize how gradient similarities evolve across layers in Figure 4 ( b ) . We notice that similarity between gradients increase/decrease as we move up from bottom to top layers for the Any→En/En→Any direction , and hypothesize that this is due to the difference in label space ( English-only tokens versus tokens from many languages ) . These results demonstrate that the dynamics of gradients evolve over model layers and training time . Our analysis highlights the important role of loss geometries in multilingual models . With these points in mind , we next turn to the problem of how to improve multi-task optimization in multilingual models in a systematic way . 3 PROPOSED METHOD Following our observations that inter-task loss geometries correlate well with language similarities and model quality , a natural question to ask next is how we can take advantage of such gradient dynamics and design optimization procedures superior to the standard monolithic practice . Since we train large-scale models on real-world dataset consisting of billions of words , of which tasks are highly unbalanced and exhibit complex interactions , we propose an effective approach that not only exploits inter-task structures but also is applicable to unbalanced tasks and noisy data . To motivate our method , we first review a state-of-the-art multi-task learning method and show how the observation in Section 2 helps us to identify its limitation .
Taking multilingual NMT (MNMT) into account, this work, investigates better model optimization alternative, that is in part can be attributed as a multi-task optimization problem. MNMT's are quite beneficial from different perspectives (improving low-resource languages, efficiency, etc). However, their inherently multi-task nature requires more focus on how to gist out the best possible learning for each of the languages pairs. With a potential impact on the optimization of other multi-task models, this work asks how model the similarity between model gradients is crucial in multi-task settings, and how to best optimize MNMT models focusing on the typologically similarity of languages. By analyzing the geometry of the NMT model objective function, authors indicate that computing similarity along gradient provides information on the relationship between languages and the overall model performance. Authors argue the analysis of the gradient helps to identify the point of limitation in multi-task learning, which the work aims to address, by focusing the parameter updates for tasks that are similar or close in terms of geometrical alignment (also known as Gradient Vaccine /GradVac/).
SP:7d2d23d569debc0e7857f6b61b54c7d632bccefc
MixSize: Training Convnets With Mixed Image Sizes for Improved Accuracy, Speed and Scale Resiliency
1 INTRODUCTION Convolutional neural networks are successfully used to solve various tasks across multiple domains such as visual ( Krizhevsky et al. , 2012 ; Ren et al. , 2015 ) , audio ( van den Oord et al. , 2016 ) , language ( Gehring et al. , 2017 ) and speech ( Abdel-Hamid et al. , 2014 ) . While scale-invariance is considered important for visual representations ( Lowe , 1999 ) , convolutional networks are not scale invariant with respect to the spatial resolution of the image input , as a change in image dimension may lead to a non-linear change of their output . Even though CNNs are able to achieve state-of-the-art results in many tasks and domains , their sensitivity to the image size is an inherent de- ficiency that limits practical use cases , and requires that images at evaluation time match training image size . For example , Touvron et al . ( 2019 ) demonstrated that networks trained on specific image size , perform poorly on other image sizes at evaluation time , as confirmed in Figure 1 . The most common method to improve scale invariance in CNNs to artificially enlarge the dataset using a set of label-preserving transformations also known as “ data augmentation ” ( Howard , 2013 ; Krizhevsky et al. , 2012 ) . Several of these transformations scale and crop objects appearing within the data , thus increasing the network ’ s robustness to inputs of different scale . Several works attempted to achieve scale invariance by modifying the network structure to learn over multiple possible target input scales ( Takahashi et al. , 2017 ; Xu et al. , 2014 ; Zhang et al. , 2019 ) . These methods 1https : //github.com/paper-submissions/mixsize explicitly change the model for specific input size , thus not benefiting from possible lower computational requirements of using smaller image sizes , nor with ability of inferring on sizes not observed during training . Another approach suggested by Cai et al . ( 2020 ) modifies network structure and training regime to account for variety of inference modes without additional specialized training . In this work , we introduce a novel training regime , “ MixSize ” for convolutional networks that uses stochastic image and batch sizes . The main contributions of the MixSize regime are : • Reducing image size sensitivity . We show that the MixSize training regime can improve model performance on a wide range of sizes used at evaluation . • Faster inference . As our mixed-size models can be evaluated at smaller image sizes , we show up to 2× reduction in computations required at inference to reach the same accuracy as the baseline model . • Faster training vs. high accuracy . We show that reducing the average image size at training leads to a trade-off between the time required to train the model and its final accuracy . 2 BACKGROUND AND RELATED WORK . 2.1 USING MULTIPLE IMAGE SIZES . Deep convolutional networks are traditionally trained using fixed-size inputs , with spatial dimensions H × W and a batch size B . The network architecture is configured such that the spatial dimensions are reduced through strided pooling or convolutions , with the last classification layer applied on a 1 × 1 spatial dimension . Modern convolutional networks usually conclude with a final ” global ” average pooling ( Lin et al. , 2013 ; Szegedy et al. , 2015 ) , which reduces any remaining spatial dimensions with a simple averaging operation . Modifying the spatial size of an input to a convolutional layer by a factor γ , will yield an output with size scaled by the same factor γ . This modification does not require any change to the number of parameters of the given convolutional layer , nor its underlying operation . It was observed by practitioners and previous works that a network trained on a specific input dimension can still be used at inference using a modified image size to some extent ( Simonyan & Zisserman , 2014 ) . Moreover , evaluating with an image size that is larger than used for training can improve accuracy up to a threshold , after which it quickly deteriorates ( Touvron et al. , 2019 ) . Although not explicitly trained to handle varying image sizes , CNNs are commonly evaluated on multiple scales post-training , such as in the case of detection ( Lin et al. , 2017 ; Redmon & Farhadi , 2018 ; Liu et al. , 2020 ) and segmentation ( He et al. , 2017 ) tasks . In these tasks , a network that was pretrained with fixed image size for classification is used as the backbone of a larger model that is expected to adapt to a wide variety of image sizes . Recently , Tan & Le ( 2019 ) showed a computation-vs-accuracy trade-off in applying scaling to the image size used for convolutional networks training and evaluation . This finding is consistent with past findings , which demonstrated that training with a larger image size can result in a better classification accuracy ( Huang et al. , 2018 ; Szegedy et al. , 2016 ) . In addition , previous works explored the notion of “ progressive resizing ” ( Howard , 2018 ; Karras et al. , 2017 ) — increasing image size as training progresses to improve model performance and time to convergence . A similar idea by Wu et al . ( 2020 ) was used to improve performance of training on video data , by balancing resolution with batch size . Another related work by Touvron et al . ( 2019 ) demonstrated that CNNs can be trained using a fixed small image size and fine-tuned post-training to a larger size , with which evaluation will be performed . This procedure reduced the train-test discrepancy caused by the change in image size and allowed faster training time and improved accuracy — at the cost of additional fine-tuning procedure and additional computations at inference time . In this work we will further explore the notion of using multiple image sizes at training , so the CNN performance will be resilient to test time changes of the image size . 2.2 LARGE BATCH TRAINING OF DEEP NETWORKS . Deep neural network training can be distributed across many computational units and devices . The most common distribution method is by “ data-parallelism ” — computing an average estimate of the gradients using multiple , separately computed data samples . As training NN models is done using batch-SGD method and its variants , scaling this process across multiple computational devices while maintaining similar utilization for each device inflates the global batch size . Large batch training is known to affect the generalization capabilities of NNs and as such , it requires to modify its optimization regime . While several works claimed that large-batch training leads to an inherent “ generalization gap ” ( Keskar et al. , 2016 ) , more recent works demonstrated that this gap is largely caused by insufficient number of optimization steps performed and can be partly mitigated by hyper-parameter tuning ( Hoffer et al. , 2017 ; Shallue et al. , 2018 ) . In order to cope with the variations in the network training dynamics , several modifications of the optimization procedure have been proposed . For instance , a linear ( Goyal et al. , 2017 ) or square-root ( Hoffer et al. , 2017 ) scaling of the learning rate with respect to the batch size growth . Other modifications include perlayer gradient scaling schemes ( You et al. , 2017 ) and optimizer modifications ( Ginsburg et al. , 2019 ) . Several works also explored using incremented batch-sizes ( Smith et al. , 2018 ) in order to decrease the number of training iterations required to reach the desired accuracy . Recent work ( Hoffer et al. , 2020 ) introduced the notion of “ Batch Augmentation ” ( BA ) — increasing the batch size by augmenting several instances of each sample within the same batch . BA aids generalization across a wide variety of models and tasks , with the expense of an increased computational effort per step . A similar method called “ Repeated Augmentation ” ( RA ) was proposed by Berman et al . ( 2019 ) . It was also demonstrated that BA may allow to decrease the number of training steps needed to achieve a similar accuracy and also mitigate I/O throughput bottlenecks ( Choi et al. , 2019 ) . As previous works investigated mostly homogeneous training settings ( e.g. , using a fixed batch size ) , an open question still exists on the utility of rapidly varying batch-sizes . We will explore this notion by modifying the optimization method , enabling training with varying batch-sizes and limited hyper-parameter tuning . 3 MIXSIZE : TRAINING WITH MULTIPLE IMAGE SCALES . The traditional practice of training convolutional networks using fixed-size images holds several shortcomings . As it is a common practice to use different image size for evaluation than that used for training ( He et al. , 2017 ; Lin et al. , 2017 ; Redmon & Farhadi , 2018 ) , it was observed by Touvron et al . ( 2019 ) and empirically verified ( Figure 1 ) that classification accuracy may degrade above or below a certain size threshold . Similarly , we observed this phenomenon in a wide variety of common networks ( Appendix Figure 4 ) . This hints the issue here is related more to the training procedure , rather than to a specific model . To remedy these issues , we suggest a stochastic training regime , where image sizes may vary in each optimization step . Motivation . We hypothesize that a considerable part of the training of convolutional networks can be performed at a lower image size than the target size used at test time . As a first step to substantiate this claim , we evaluated the impact of various image sizes on the CNN training progress by examining gradient statistics during training . Specifically , we measured the correlation between weight gradients with respect to varying image sizes ( Appendix Table 2 ) . We see that gradients computed across different sizes of the same images have a stronger correlation than those obtained across different images . Moreover , the correlation is most significant during the first stages of training and decreases as the model converges . This observation suggests that smaller image gradients can be used as an estimate to the full image gradients , with a smaller computational footprint . Therefore , using large images along the entire training process may be sub-optimal in terms of computational resource utilization . We continue to test our hypothesis using a novel mixed-size training regime . MixSize training regime . We propose ” MixSize ” , a stochastic training regime where input sizes can vary . In this regime , we modified the spatial dimensions H , W ( height and width ) of the input image size2 , as well as the batch size . The batch size is modified either by the number of used samples , denoted B , or by the number of batch-augmentations for each sample ( Hoffer et al. , 2020 ) , denoted D ( “ duplicates ” ) . To simplify our notation and use-cases , we will follow the common practice of training on square images and use S = H = W . Formally , in the MixSize regime , these 2The spatial dimensions of all intermediate maps in the CNN are changed accordingly , at the same scale as the input . sizes can be described as random variables sharing a single discrete distribution ( Ŝ , B̂ , D̂ ) = { ( S , B , D ) i w.p . pi } , ( 1 ) where ∀i : pi ≥ 0 and ∑ i pi = 1 . As the computational cost of each training step is approximately proportional to S2 · B · D , we choose these quantities to reflect a nearly fixed budget for any choice i such that S2iBiDi ≈ Const . Thus , in this regime , the computational and memory requirements for each step in remain fixed . Benefits and Trade-offs . We will show that using our MixSize regime can have a positive impact on the resiliency of trained networks to various images sizes at evaluation time by demonstrating better accuracy across a wide range of sizes . This entails a considerable saving in computational burden required for inference , especially when using smaller models . Furthermore , given a fixed budget of computational and time resources ( per step ) , we can now modify our regime along spatial and batch axes . We will explore two trade-offs : • Decrease number of iterations per epoch – by enlarging B at the expense of S. • Improve generalization per epoch – by enlarging D at the expense of S. We denote our modified mixed-size regimes as B+ for an increased effective batch-size and D+ for an increased number of BA duplicates of the same ratio .
The paper proposes the use of mixed image sizes during training. They argue empirically that such an approach improves generalization for both fixed image size (e.g. 224 in ImageNet) as well as for variable image size. The proposed training algorithm maintains the same computational budget at each step by either changing the batch size or by using more/less augmentation. They show that adjusting the batch size leads to a faster training but using augmentation leads to a better test accuracy (hence a tradeoff).
SP:a49dca8ae6f8da27c7e929ca096a71a8833cb989
MixSize: Training Convnets With Mixed Image Sizes for Improved Accuracy, Speed and Scale Resiliency
1 INTRODUCTION Convolutional neural networks are successfully used to solve various tasks across multiple domains such as visual ( Krizhevsky et al. , 2012 ; Ren et al. , 2015 ) , audio ( van den Oord et al. , 2016 ) , language ( Gehring et al. , 2017 ) and speech ( Abdel-Hamid et al. , 2014 ) . While scale-invariance is considered important for visual representations ( Lowe , 1999 ) , convolutional networks are not scale invariant with respect to the spatial resolution of the image input , as a change in image dimension may lead to a non-linear change of their output . Even though CNNs are able to achieve state-of-the-art results in many tasks and domains , their sensitivity to the image size is an inherent de- ficiency that limits practical use cases , and requires that images at evaluation time match training image size . For example , Touvron et al . ( 2019 ) demonstrated that networks trained on specific image size , perform poorly on other image sizes at evaluation time , as confirmed in Figure 1 . The most common method to improve scale invariance in CNNs to artificially enlarge the dataset using a set of label-preserving transformations also known as “ data augmentation ” ( Howard , 2013 ; Krizhevsky et al. , 2012 ) . Several of these transformations scale and crop objects appearing within the data , thus increasing the network ’ s robustness to inputs of different scale . Several works attempted to achieve scale invariance by modifying the network structure to learn over multiple possible target input scales ( Takahashi et al. , 2017 ; Xu et al. , 2014 ; Zhang et al. , 2019 ) . These methods 1https : //github.com/paper-submissions/mixsize explicitly change the model for specific input size , thus not benefiting from possible lower computational requirements of using smaller image sizes , nor with ability of inferring on sizes not observed during training . Another approach suggested by Cai et al . ( 2020 ) modifies network structure and training regime to account for variety of inference modes without additional specialized training . In this work , we introduce a novel training regime , “ MixSize ” for convolutional networks that uses stochastic image and batch sizes . The main contributions of the MixSize regime are : • Reducing image size sensitivity . We show that the MixSize training regime can improve model performance on a wide range of sizes used at evaluation . • Faster inference . As our mixed-size models can be evaluated at smaller image sizes , we show up to 2× reduction in computations required at inference to reach the same accuracy as the baseline model . • Faster training vs. high accuracy . We show that reducing the average image size at training leads to a trade-off between the time required to train the model and its final accuracy . 2 BACKGROUND AND RELATED WORK . 2.1 USING MULTIPLE IMAGE SIZES . Deep convolutional networks are traditionally trained using fixed-size inputs , with spatial dimensions H × W and a batch size B . The network architecture is configured such that the spatial dimensions are reduced through strided pooling or convolutions , with the last classification layer applied on a 1 × 1 spatial dimension . Modern convolutional networks usually conclude with a final ” global ” average pooling ( Lin et al. , 2013 ; Szegedy et al. , 2015 ) , which reduces any remaining spatial dimensions with a simple averaging operation . Modifying the spatial size of an input to a convolutional layer by a factor γ , will yield an output with size scaled by the same factor γ . This modification does not require any change to the number of parameters of the given convolutional layer , nor its underlying operation . It was observed by practitioners and previous works that a network trained on a specific input dimension can still be used at inference using a modified image size to some extent ( Simonyan & Zisserman , 2014 ) . Moreover , evaluating with an image size that is larger than used for training can improve accuracy up to a threshold , after which it quickly deteriorates ( Touvron et al. , 2019 ) . Although not explicitly trained to handle varying image sizes , CNNs are commonly evaluated on multiple scales post-training , such as in the case of detection ( Lin et al. , 2017 ; Redmon & Farhadi , 2018 ; Liu et al. , 2020 ) and segmentation ( He et al. , 2017 ) tasks . In these tasks , a network that was pretrained with fixed image size for classification is used as the backbone of a larger model that is expected to adapt to a wide variety of image sizes . Recently , Tan & Le ( 2019 ) showed a computation-vs-accuracy trade-off in applying scaling to the image size used for convolutional networks training and evaluation . This finding is consistent with past findings , which demonstrated that training with a larger image size can result in a better classification accuracy ( Huang et al. , 2018 ; Szegedy et al. , 2016 ) . In addition , previous works explored the notion of “ progressive resizing ” ( Howard , 2018 ; Karras et al. , 2017 ) — increasing image size as training progresses to improve model performance and time to convergence . A similar idea by Wu et al . ( 2020 ) was used to improve performance of training on video data , by balancing resolution with batch size . Another related work by Touvron et al . ( 2019 ) demonstrated that CNNs can be trained using a fixed small image size and fine-tuned post-training to a larger size , with which evaluation will be performed . This procedure reduced the train-test discrepancy caused by the change in image size and allowed faster training time and improved accuracy — at the cost of additional fine-tuning procedure and additional computations at inference time . In this work we will further explore the notion of using multiple image sizes at training , so the CNN performance will be resilient to test time changes of the image size . 2.2 LARGE BATCH TRAINING OF DEEP NETWORKS . Deep neural network training can be distributed across many computational units and devices . The most common distribution method is by “ data-parallelism ” — computing an average estimate of the gradients using multiple , separately computed data samples . As training NN models is done using batch-SGD method and its variants , scaling this process across multiple computational devices while maintaining similar utilization for each device inflates the global batch size . Large batch training is known to affect the generalization capabilities of NNs and as such , it requires to modify its optimization regime . While several works claimed that large-batch training leads to an inherent “ generalization gap ” ( Keskar et al. , 2016 ) , more recent works demonstrated that this gap is largely caused by insufficient number of optimization steps performed and can be partly mitigated by hyper-parameter tuning ( Hoffer et al. , 2017 ; Shallue et al. , 2018 ) . In order to cope with the variations in the network training dynamics , several modifications of the optimization procedure have been proposed . For instance , a linear ( Goyal et al. , 2017 ) or square-root ( Hoffer et al. , 2017 ) scaling of the learning rate with respect to the batch size growth . Other modifications include perlayer gradient scaling schemes ( You et al. , 2017 ) and optimizer modifications ( Ginsburg et al. , 2019 ) . Several works also explored using incremented batch-sizes ( Smith et al. , 2018 ) in order to decrease the number of training iterations required to reach the desired accuracy . Recent work ( Hoffer et al. , 2020 ) introduced the notion of “ Batch Augmentation ” ( BA ) — increasing the batch size by augmenting several instances of each sample within the same batch . BA aids generalization across a wide variety of models and tasks , with the expense of an increased computational effort per step . A similar method called “ Repeated Augmentation ” ( RA ) was proposed by Berman et al . ( 2019 ) . It was also demonstrated that BA may allow to decrease the number of training steps needed to achieve a similar accuracy and also mitigate I/O throughput bottlenecks ( Choi et al. , 2019 ) . As previous works investigated mostly homogeneous training settings ( e.g. , using a fixed batch size ) , an open question still exists on the utility of rapidly varying batch-sizes . We will explore this notion by modifying the optimization method , enabling training with varying batch-sizes and limited hyper-parameter tuning . 3 MIXSIZE : TRAINING WITH MULTIPLE IMAGE SCALES . The traditional practice of training convolutional networks using fixed-size images holds several shortcomings . As it is a common practice to use different image size for evaluation than that used for training ( He et al. , 2017 ; Lin et al. , 2017 ; Redmon & Farhadi , 2018 ) , it was observed by Touvron et al . ( 2019 ) and empirically verified ( Figure 1 ) that classification accuracy may degrade above or below a certain size threshold . Similarly , we observed this phenomenon in a wide variety of common networks ( Appendix Figure 4 ) . This hints the issue here is related more to the training procedure , rather than to a specific model . To remedy these issues , we suggest a stochastic training regime , where image sizes may vary in each optimization step . Motivation . We hypothesize that a considerable part of the training of convolutional networks can be performed at a lower image size than the target size used at test time . As a first step to substantiate this claim , we evaluated the impact of various image sizes on the CNN training progress by examining gradient statistics during training . Specifically , we measured the correlation between weight gradients with respect to varying image sizes ( Appendix Table 2 ) . We see that gradients computed across different sizes of the same images have a stronger correlation than those obtained across different images . Moreover , the correlation is most significant during the first stages of training and decreases as the model converges . This observation suggests that smaller image gradients can be used as an estimate to the full image gradients , with a smaller computational footprint . Therefore , using large images along the entire training process may be sub-optimal in terms of computational resource utilization . We continue to test our hypothesis using a novel mixed-size training regime . MixSize training regime . We propose ” MixSize ” , a stochastic training regime where input sizes can vary . In this regime , we modified the spatial dimensions H , W ( height and width ) of the input image size2 , as well as the batch size . The batch size is modified either by the number of used samples , denoted B , or by the number of batch-augmentations for each sample ( Hoffer et al. , 2020 ) , denoted D ( “ duplicates ” ) . To simplify our notation and use-cases , we will follow the common practice of training on square images and use S = H = W . Formally , in the MixSize regime , these 2The spatial dimensions of all intermediate maps in the CNN are changed accordingly , at the same scale as the input . sizes can be described as random variables sharing a single discrete distribution ( Ŝ , B̂ , D̂ ) = { ( S , B , D ) i w.p . pi } , ( 1 ) where ∀i : pi ≥ 0 and ∑ i pi = 1 . As the computational cost of each training step is approximately proportional to S2 · B · D , we choose these quantities to reflect a nearly fixed budget for any choice i such that S2iBiDi ≈ Const . Thus , in this regime , the computational and memory requirements for each step in remain fixed . Benefits and Trade-offs . We will show that using our MixSize regime can have a positive impact on the resiliency of trained networks to various images sizes at evaluation time by demonstrating better accuracy across a wide range of sizes . This entails a considerable saving in computational burden required for inference , especially when using smaller models . Furthermore , given a fixed budget of computational and time resources ( per step ) , we can now modify our regime along spatial and batch axes . We will explore two trade-offs : • Decrease number of iterations per epoch – by enlarging B at the expense of S. • Improve generalization per epoch – by enlarging D at the expense of S. We denote our modified mixed-size regimes as B+ for an increased effective batch-size and D+ for an increased number of BA duplicates of the same ratio .
This paper proposes to increase training costs to compensate for the reduced costs from multi-scale CNN training by either increasing batch size (and therefore lowering the number of iterations per epoch) or increasing the number of augmented versions (duplicates) of the same samples within a batch. The former allows for smaller total training costs than conventional single-scale training, while the latter maintains the total training costs but improves the final performance. Several training improvement methods are introduced to improve the multi-scale training.
SP:a49dca8ae6f8da27c7e929ca096a71a8833cb989
MixSize: Training Convnets With Mixed Image Sizes for Improved Accuracy, Speed and Scale Resiliency
1 INTRODUCTION Convolutional neural networks are successfully used to solve various tasks across multiple domains such as visual ( Krizhevsky et al. , 2012 ; Ren et al. , 2015 ) , audio ( van den Oord et al. , 2016 ) , language ( Gehring et al. , 2017 ) and speech ( Abdel-Hamid et al. , 2014 ) . While scale-invariance is considered important for visual representations ( Lowe , 1999 ) , convolutional networks are not scale invariant with respect to the spatial resolution of the image input , as a change in image dimension may lead to a non-linear change of their output . Even though CNNs are able to achieve state-of-the-art results in many tasks and domains , their sensitivity to the image size is an inherent de- ficiency that limits practical use cases , and requires that images at evaluation time match training image size . For example , Touvron et al . ( 2019 ) demonstrated that networks trained on specific image size , perform poorly on other image sizes at evaluation time , as confirmed in Figure 1 . The most common method to improve scale invariance in CNNs to artificially enlarge the dataset using a set of label-preserving transformations also known as “ data augmentation ” ( Howard , 2013 ; Krizhevsky et al. , 2012 ) . Several of these transformations scale and crop objects appearing within the data , thus increasing the network ’ s robustness to inputs of different scale . Several works attempted to achieve scale invariance by modifying the network structure to learn over multiple possible target input scales ( Takahashi et al. , 2017 ; Xu et al. , 2014 ; Zhang et al. , 2019 ) . These methods 1https : //github.com/paper-submissions/mixsize explicitly change the model for specific input size , thus not benefiting from possible lower computational requirements of using smaller image sizes , nor with ability of inferring on sizes not observed during training . Another approach suggested by Cai et al . ( 2020 ) modifies network structure and training regime to account for variety of inference modes without additional specialized training . In this work , we introduce a novel training regime , “ MixSize ” for convolutional networks that uses stochastic image and batch sizes . The main contributions of the MixSize regime are : • Reducing image size sensitivity . We show that the MixSize training regime can improve model performance on a wide range of sizes used at evaluation . • Faster inference . As our mixed-size models can be evaluated at smaller image sizes , we show up to 2× reduction in computations required at inference to reach the same accuracy as the baseline model . • Faster training vs. high accuracy . We show that reducing the average image size at training leads to a trade-off between the time required to train the model and its final accuracy . 2 BACKGROUND AND RELATED WORK . 2.1 USING MULTIPLE IMAGE SIZES . Deep convolutional networks are traditionally trained using fixed-size inputs , with spatial dimensions H × W and a batch size B . The network architecture is configured such that the spatial dimensions are reduced through strided pooling or convolutions , with the last classification layer applied on a 1 × 1 spatial dimension . Modern convolutional networks usually conclude with a final ” global ” average pooling ( Lin et al. , 2013 ; Szegedy et al. , 2015 ) , which reduces any remaining spatial dimensions with a simple averaging operation . Modifying the spatial size of an input to a convolutional layer by a factor γ , will yield an output with size scaled by the same factor γ . This modification does not require any change to the number of parameters of the given convolutional layer , nor its underlying operation . It was observed by practitioners and previous works that a network trained on a specific input dimension can still be used at inference using a modified image size to some extent ( Simonyan & Zisserman , 2014 ) . Moreover , evaluating with an image size that is larger than used for training can improve accuracy up to a threshold , after which it quickly deteriorates ( Touvron et al. , 2019 ) . Although not explicitly trained to handle varying image sizes , CNNs are commonly evaluated on multiple scales post-training , such as in the case of detection ( Lin et al. , 2017 ; Redmon & Farhadi , 2018 ; Liu et al. , 2020 ) and segmentation ( He et al. , 2017 ) tasks . In these tasks , a network that was pretrained with fixed image size for classification is used as the backbone of a larger model that is expected to adapt to a wide variety of image sizes . Recently , Tan & Le ( 2019 ) showed a computation-vs-accuracy trade-off in applying scaling to the image size used for convolutional networks training and evaluation . This finding is consistent with past findings , which demonstrated that training with a larger image size can result in a better classification accuracy ( Huang et al. , 2018 ; Szegedy et al. , 2016 ) . In addition , previous works explored the notion of “ progressive resizing ” ( Howard , 2018 ; Karras et al. , 2017 ) — increasing image size as training progresses to improve model performance and time to convergence . A similar idea by Wu et al . ( 2020 ) was used to improve performance of training on video data , by balancing resolution with batch size . Another related work by Touvron et al . ( 2019 ) demonstrated that CNNs can be trained using a fixed small image size and fine-tuned post-training to a larger size , with which evaluation will be performed . This procedure reduced the train-test discrepancy caused by the change in image size and allowed faster training time and improved accuracy — at the cost of additional fine-tuning procedure and additional computations at inference time . In this work we will further explore the notion of using multiple image sizes at training , so the CNN performance will be resilient to test time changes of the image size . 2.2 LARGE BATCH TRAINING OF DEEP NETWORKS . Deep neural network training can be distributed across many computational units and devices . The most common distribution method is by “ data-parallelism ” — computing an average estimate of the gradients using multiple , separately computed data samples . As training NN models is done using batch-SGD method and its variants , scaling this process across multiple computational devices while maintaining similar utilization for each device inflates the global batch size . Large batch training is known to affect the generalization capabilities of NNs and as such , it requires to modify its optimization regime . While several works claimed that large-batch training leads to an inherent “ generalization gap ” ( Keskar et al. , 2016 ) , more recent works demonstrated that this gap is largely caused by insufficient number of optimization steps performed and can be partly mitigated by hyper-parameter tuning ( Hoffer et al. , 2017 ; Shallue et al. , 2018 ) . In order to cope with the variations in the network training dynamics , several modifications of the optimization procedure have been proposed . For instance , a linear ( Goyal et al. , 2017 ) or square-root ( Hoffer et al. , 2017 ) scaling of the learning rate with respect to the batch size growth . Other modifications include perlayer gradient scaling schemes ( You et al. , 2017 ) and optimizer modifications ( Ginsburg et al. , 2019 ) . Several works also explored using incremented batch-sizes ( Smith et al. , 2018 ) in order to decrease the number of training iterations required to reach the desired accuracy . Recent work ( Hoffer et al. , 2020 ) introduced the notion of “ Batch Augmentation ” ( BA ) — increasing the batch size by augmenting several instances of each sample within the same batch . BA aids generalization across a wide variety of models and tasks , with the expense of an increased computational effort per step . A similar method called “ Repeated Augmentation ” ( RA ) was proposed by Berman et al . ( 2019 ) . It was also demonstrated that BA may allow to decrease the number of training steps needed to achieve a similar accuracy and also mitigate I/O throughput bottlenecks ( Choi et al. , 2019 ) . As previous works investigated mostly homogeneous training settings ( e.g. , using a fixed batch size ) , an open question still exists on the utility of rapidly varying batch-sizes . We will explore this notion by modifying the optimization method , enabling training with varying batch-sizes and limited hyper-parameter tuning . 3 MIXSIZE : TRAINING WITH MULTIPLE IMAGE SCALES . The traditional practice of training convolutional networks using fixed-size images holds several shortcomings . As it is a common practice to use different image size for evaluation than that used for training ( He et al. , 2017 ; Lin et al. , 2017 ; Redmon & Farhadi , 2018 ) , it was observed by Touvron et al . ( 2019 ) and empirically verified ( Figure 1 ) that classification accuracy may degrade above or below a certain size threshold . Similarly , we observed this phenomenon in a wide variety of common networks ( Appendix Figure 4 ) . This hints the issue here is related more to the training procedure , rather than to a specific model . To remedy these issues , we suggest a stochastic training regime , where image sizes may vary in each optimization step . Motivation . We hypothesize that a considerable part of the training of convolutional networks can be performed at a lower image size than the target size used at test time . As a first step to substantiate this claim , we evaluated the impact of various image sizes on the CNN training progress by examining gradient statistics during training . Specifically , we measured the correlation between weight gradients with respect to varying image sizes ( Appendix Table 2 ) . We see that gradients computed across different sizes of the same images have a stronger correlation than those obtained across different images . Moreover , the correlation is most significant during the first stages of training and decreases as the model converges . This observation suggests that smaller image gradients can be used as an estimate to the full image gradients , with a smaller computational footprint . Therefore , using large images along the entire training process may be sub-optimal in terms of computational resource utilization . We continue to test our hypothesis using a novel mixed-size training regime . MixSize training regime . We propose ” MixSize ” , a stochastic training regime where input sizes can vary . In this regime , we modified the spatial dimensions H , W ( height and width ) of the input image size2 , as well as the batch size . The batch size is modified either by the number of used samples , denoted B , or by the number of batch-augmentations for each sample ( Hoffer et al. , 2020 ) , denoted D ( “ duplicates ” ) . To simplify our notation and use-cases , we will follow the common practice of training on square images and use S = H = W . Formally , in the MixSize regime , these 2The spatial dimensions of all intermediate maps in the CNN are changed accordingly , at the same scale as the input . sizes can be described as random variables sharing a single discrete distribution ( Ŝ , B̂ , D̂ ) = { ( S , B , D ) i w.p . pi } , ( 1 ) where ∀i : pi ≥ 0 and ∑ i pi = 1 . As the computational cost of each training step is approximately proportional to S2 · B · D , we choose these quantities to reflect a nearly fixed budget for any choice i such that S2iBiDi ≈ Const . Thus , in this regime , the computational and memory requirements for each step in remain fixed . Benefits and Trade-offs . We will show that using our MixSize regime can have a positive impact on the resiliency of trained networks to various images sizes at evaluation time by demonstrating better accuracy across a wide range of sizes . This entails a considerable saving in computational burden required for inference , especially when using smaller models . Furthermore , given a fixed budget of computational and time resources ( per step ) , we can now modify our regime along spatial and batch axes . We will explore two trade-offs : • Decrease number of iterations per epoch – by enlarging B at the expense of S. • Improve generalization per epoch – by enlarging D at the expense of S. We denote our modified mixed-size regimes as B+ for an increased effective batch-size and D+ for an increased number of BA duplicates of the same ratio .
This paper presents a mixed-size CNN training scheme, using several different input image sizes for one single model training. The authors assume the training budget, represented as S_i^2*B_i*D_i (i.e., spatial sample size, the number of batched distinct samples and the duplicates for each distinct sample), to be a fixed constant during training step i. Under such an assumption, two mixed-size training scenarios are considered, one for training acceleration and the other for improved model generalization ability. The authors additionally use step-wise image size sampling, gradient smoothing, and per-size BN calibration to enhance the model performance under the above two mixed-size training scenarios. Experimental validation is performed on CIFAR and ImageNet datasets using diverse CNN structures.
SP:a49dca8ae6f8da27c7e929ca096a71a8833cb989
Data-aware Low-Rank Compression for Large NLP Models
1 INTRODUCTION . The representations learned by large-scale Natural Language Processing ( NLP ) models such as BERT have been widely used in various tasks ( Devlin et al. , 2018 ) . The pre-trained models of BERT and its variations are used as feature extractors for the downstream tasks such as question answering and natural language understanding ( Radford et al . ; Howard & Ruder , 2018 ) . The success of the pre-trained BERT relies on the usage of large corpus and big models . Indeed , researchers have reported better results of models with more parameters ( Shazeer et al. , 2018 ) and number of layers ( Al-Rfou et al. , 2019 ) . The increasing model size of the pre-trained models inhibits the public user from training a model from scratch , and it also brings the efficiency challenges , including the inference speed and the model size when deploying the model on devices . To deal with the efficiency issue , most existing works resort to adjusting the model structures or distillation . For instance , Kitaev et al . ( 2020 ) uses locality-sensitive hashing to accelerate dot-product attention , Lan et al . ( 2019 ) uses repeating model parameters to reduce the size and Zhang et al . ( 2018 ) applies a pre-defined attention pattern to save computation . A large body of prior work focuses on variants of distillation information has also been explored ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ) . However , all these methods either require a specific design of model architecture which is not generic , or require users to train the proposed structure from scratch which greatly reduces its practicality . In this work , we try to explore an acceleration method that is more generic . Note that as shown in Figure 1 , matrix multiplication ( Feed-forward layer ) is a fundamental operation which appears many times in the Transformer architecture . In fact , the underlying computation of both multi-head attention layers and feed-forward layers is matrix multiplication . Therefore , instead of resorting to the complex architecture redesign approaches , we aim to investigate whether low-rank matrix approximation , the most classical and simple model compression approach , can be used to accelerate Transformers . Despite being successfully applied to CNN ( Yu et al. , 2017 ; Sindhwani et al. , 2015 ; Shim et al. , 2017 ; You et al. , 2019 ) , at the first glance low-rank compression can not work for BERT . We could see in Figure 2 that regardless of layers , matrices in feed-forward layer , query and key transformation of attention layer are not low-rank . Therefore , even the optimal low-rank approximation ( e.g. , by SVD ) will lead to large reconstruction error and empirically the performance is limited . This is probably why low-rank approximation has not been used in BERT compression . In this paper , we propose a novel low-rank approximation algorithm to compress the weight matrices even though they are not low-rank . The main idea is to exploit the data distribution . In NLP applications , the latent features , indicating some information extracted from natural sentences , often lie in a subspace with a lower intrinsic dimension . Therefore , in most of the matrix-vector products , even though the weight matrices are not low-rank , the input vectors lie in a low-dimensional subspace , allowing dimension reduction with minimal degraded performance . We mathematically formulate this generalized low-rank approximation problem which includes the data distribution term and provide a closed-form solution for the optimal rank-k decomposition of the weight matrices . We propose DRONE method based on this novel Data-awaRe lOw-raNk comprEssion idea . Our decomposition significantly outperforms SVD under the same rank constraint , and can successfully accelerate the BERT model without sacrificing too much test performance . 2 RELATED WORK . The inference speed is important for NLP models when deployed in various applications . Generally speaking , inference efficiency could be enhanced by hardware ( Shawahna et al. , 2018 ) or lower-level instruction optimization ( Ning , 2020 ) . On the other hand , the main focus of the current research is on using algorithmic methods to reduce the computational complexity . It could be mainly categorized into two aspects : Attention Complexity Reduction and Model Size Reduction . Attention Complexity Reduction Attention mechanism is the building block of transformer model and it attracts most attentions of researcher recently in NLP field ( Vaswani et al. , 2017 ) . Pre-training on large courpus of BERT , a transformer-based model , has contributed to state-of-the-art performance on various tasks after fine-tuning ( Devlin et al. , 2018 ) . Attention on sequences of length L is O ( L2 ) in both computational and memory complexity . This would take long inference time when the sequence is long . Thus , researchers have focused on reducing the complexity of the attention module . Kitaev et al . ( 2020 ) uses uses locality-sensitive hashing to reduce the complexity to O ( LlogL ) . Zhang et al . ( 2018 ) ; Child et al . ( 2019 ) pre-defined an attention map to have a constant computational time . Goyal et al . progressively eliminates the redundant context vectors within the attended sequence to improve the efficiency of attention in last few layers of the model . Wang et al . ( 2020 ) proposes to train the low-rank attention by choosing a rank r L. This is similar with our work in the sense of leveraging low-rank structures . But our method do not require retraining the model and could be applied to different modules other than attention . In fact , most of these methods require special modules and thus we need to retrain the proposed models from scratch . This prohibits the usage of a large body of publicly available open models for faster research progress . More importantly , these methods only focus on the long sequence scenario . We found out that attention module is actually not the bottleneck of inference time in common usage as shown in Figure 1 . In most if not all models of common usages , two layers of large feed-forward layer are appended after attention module which incurs much more computational time . Attention complexity reduction only works when a large sequence is used but in current practice this is unusual . Thus , accelerating attention module itself is not contributing to a significant reduction of overall inference time . Model Size Reduction Efficiency of inference time is also related to model compression . In principle , smaller models would lead to smaller number of operations and thus faster inference time . Sanh et al . ( 2020 ) has explored pruning methods on BERT models to eliminate the redundant links , and there is a line of research on pruning methods ( Han et al. , 2015a ; b ; Chen et al. , 2020 ) . Quantization methods ( Zafrir et al. , 2019 ; Hubara et al. , 2016 ; Lin et al. , 2016 ) could convert the 32 bits float models into lower-bits fixed-point representation , and theoretically make model prediction faster with fixed point accelerator . Lan et al . ( 2019 ) reduces the model size by sharing of encoder parameters . A large body of prior work focuses on variants of knowledge distillation ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ; 2020 ) . These methods use different strategies to distill information from teacher network and reduce the number of layers ( Sanh et al. , 2019 ) or hidden dimension size ( Jiao et al. , 2019 ) . Further , A hybrid compression method by combining matrix factorization , pruning and knowledge distillation is proposed by Mao et al . ( 2020 ) . Among the above mentioned methods , Quantization requires hardware accelerator to reduce the inference time which is not applicable to general scenario . Pruning methods could only reduce the model size , but the inference speed might not be reduced due to the limitation of sparse operations . Only algorithmic method such as distillation could serve as a generic inference time accelerating method . We want to emphasize that our method is orthogonal to these distillation methods . In fact , the proposed method is a generic acceleration method applicable to all components in most NLP models . In section 4 , we show that DRONE can be combined with the distilled models to further improve the performance . 3 METHODS . We now introduce a generic algorithm for improving efficiency of matrix multiplication . The computation of Feed-Forward ( FF ) Layer in the attention models can be described as : h = Wx+ b , ( 1 ) where W ∈ Rd2×d1 and b ∈ Rd2 are model parameters , x ∈ Rd1 is the latent representation of a token , and h ∈ Rd2 is the output . Assume the sequence length is L , all the token representations x1 , . . . , xL ∈ Rd1 will pass through this same operation , so in practice the whole FF layer can be computed by a matrix-matrix product W [ x1 , . . . xn ] + b , and the computation of bias term b would be broadcasted to all L input tokens . In practice we will normally have L max ( d1 , d2 ) ( e.g. , L = 128 , d2 = 3 , 072 ) . A standard way to accelerate the computation is to perform low-rank approximation over W. A lowrank approximation can be acquired by using singular value decomposition ( SVD ) , which achieves the best rank-k approximation in terms of Frobenius norm and we could write W as : W = USV T ≈ UW , kVW , kT , with unitary matrices U ∈ Rd2×d2 , V ∈ Rd1×d1 and a diagonal matrix S ∈ Rd2×d1 . UW , k ∈ Rd2×k and VW , k ∈ Rd1×k are the rank-k approximation matrices by taking UW , k = US 1 2 k , VW , k = S 1 2 k V , where S 1 2 k is the square-root of the first k entries of the diagonal matrix S. Given such approximation , we could simplify the computation in equation 1 by writing it as : h = Wx+ b ≈ UW , kVW , kTx+ b . After the rank-k low-rank approximation , the computational complexity reduces from O ( d2d1 ) to O ( ( d1 + d2 ) k ) . When k is small enough , low-rank approximation could not only accelerate the computation ( Shim et al. , 2017 ) but also compress the model size ( Sainath et al. , 2013 ) . However , as we showed in Figure 2 , matrices in FF layer of BERT models do not show obvious low-rank structures . Ideally , we want a small percentage of the ranks which containing all large singular values such that sum of singular values connected to the selected ranks divided by sum of all singular values is large . But we could observe that choosing rank k to be larger than 50 % of the ranks ( e.g. , about 0.5 times min ( d1 , d2 ) ) could only accumulate 60 percent of the total singular values . This will lead to a large approximation error . In the meantime , the complexity is still about O ( d2d1 ) and there is no enhancement of speed . Despite the matrices in the model are not low-rank , here we provide an illustrative example to show that a low-rank computation could still exist when data distribution lies in a lower intrinsic dimension . Suppose we have a W defined as below and the input x lies in a subspace : W = 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 , x ∈ span ( 2 2 5 5 4 , 1 1 2 2 6 ) , In this case , W is a full-rank matrix so there won ’ t be a lossless low-rank approximation on W . On the other hand , input data x lies in a 2-dimensional subspace such that we could construct the following computation : 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 ︸ ︷︷ ︸ W 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x = 43 23 90 39 66 41 45 37 29 21 ︸ ︷︷ ︸ U [ −1 −1 0.5 0.5 0 −0.5 0 0 0 0.25 ] ︸ ︷︷ ︸ V T 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x , which gives a rank-2 matrix UV T where W 6= UV T but Wx = UV Tx for any x in the low dimensional space . This shows that even if we can ’ t approximate the W matrix , it is still possible to construct a good low-rank decomposition , and the key will be to exploit the space of input vectors .
This paper studies a technique to increase the inference speed and decrease model sizes of pretrained NLP models such as BERT. Since most operations in BERT consist of matrix multiplications, the authors conduct empirical experiments to show that while matrices themselves are not low-rank, the learned representation of each layer lies in a low-dimensional space. These empirical insights lead the authors to propose an approach based on data-aware low-rank compression of pretrained weight matrices and can be applied to fully-connected and self-attention layers. Their approach is able to improve both model size and inference speed
SP:861821cf96296ddff89505ab191fb9d7bee45f6d
Data-aware Low-Rank Compression for Large NLP Models
1 INTRODUCTION . The representations learned by large-scale Natural Language Processing ( NLP ) models such as BERT have been widely used in various tasks ( Devlin et al. , 2018 ) . The pre-trained models of BERT and its variations are used as feature extractors for the downstream tasks such as question answering and natural language understanding ( Radford et al . ; Howard & Ruder , 2018 ) . The success of the pre-trained BERT relies on the usage of large corpus and big models . Indeed , researchers have reported better results of models with more parameters ( Shazeer et al. , 2018 ) and number of layers ( Al-Rfou et al. , 2019 ) . The increasing model size of the pre-trained models inhibits the public user from training a model from scratch , and it also brings the efficiency challenges , including the inference speed and the model size when deploying the model on devices . To deal with the efficiency issue , most existing works resort to adjusting the model structures or distillation . For instance , Kitaev et al . ( 2020 ) uses locality-sensitive hashing to accelerate dot-product attention , Lan et al . ( 2019 ) uses repeating model parameters to reduce the size and Zhang et al . ( 2018 ) applies a pre-defined attention pattern to save computation . A large body of prior work focuses on variants of distillation information has also been explored ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ) . However , all these methods either require a specific design of model architecture which is not generic , or require users to train the proposed structure from scratch which greatly reduces its practicality . In this work , we try to explore an acceleration method that is more generic . Note that as shown in Figure 1 , matrix multiplication ( Feed-forward layer ) is a fundamental operation which appears many times in the Transformer architecture . In fact , the underlying computation of both multi-head attention layers and feed-forward layers is matrix multiplication . Therefore , instead of resorting to the complex architecture redesign approaches , we aim to investigate whether low-rank matrix approximation , the most classical and simple model compression approach , can be used to accelerate Transformers . Despite being successfully applied to CNN ( Yu et al. , 2017 ; Sindhwani et al. , 2015 ; Shim et al. , 2017 ; You et al. , 2019 ) , at the first glance low-rank compression can not work for BERT . We could see in Figure 2 that regardless of layers , matrices in feed-forward layer , query and key transformation of attention layer are not low-rank . Therefore , even the optimal low-rank approximation ( e.g. , by SVD ) will lead to large reconstruction error and empirically the performance is limited . This is probably why low-rank approximation has not been used in BERT compression . In this paper , we propose a novel low-rank approximation algorithm to compress the weight matrices even though they are not low-rank . The main idea is to exploit the data distribution . In NLP applications , the latent features , indicating some information extracted from natural sentences , often lie in a subspace with a lower intrinsic dimension . Therefore , in most of the matrix-vector products , even though the weight matrices are not low-rank , the input vectors lie in a low-dimensional subspace , allowing dimension reduction with minimal degraded performance . We mathematically formulate this generalized low-rank approximation problem which includes the data distribution term and provide a closed-form solution for the optimal rank-k decomposition of the weight matrices . We propose DRONE method based on this novel Data-awaRe lOw-raNk comprEssion idea . Our decomposition significantly outperforms SVD under the same rank constraint , and can successfully accelerate the BERT model without sacrificing too much test performance . 2 RELATED WORK . The inference speed is important for NLP models when deployed in various applications . Generally speaking , inference efficiency could be enhanced by hardware ( Shawahna et al. , 2018 ) or lower-level instruction optimization ( Ning , 2020 ) . On the other hand , the main focus of the current research is on using algorithmic methods to reduce the computational complexity . It could be mainly categorized into two aspects : Attention Complexity Reduction and Model Size Reduction . Attention Complexity Reduction Attention mechanism is the building block of transformer model and it attracts most attentions of researcher recently in NLP field ( Vaswani et al. , 2017 ) . Pre-training on large courpus of BERT , a transformer-based model , has contributed to state-of-the-art performance on various tasks after fine-tuning ( Devlin et al. , 2018 ) . Attention on sequences of length L is O ( L2 ) in both computational and memory complexity . This would take long inference time when the sequence is long . Thus , researchers have focused on reducing the complexity of the attention module . Kitaev et al . ( 2020 ) uses uses locality-sensitive hashing to reduce the complexity to O ( LlogL ) . Zhang et al . ( 2018 ) ; Child et al . ( 2019 ) pre-defined an attention map to have a constant computational time . Goyal et al . progressively eliminates the redundant context vectors within the attended sequence to improve the efficiency of attention in last few layers of the model . Wang et al . ( 2020 ) proposes to train the low-rank attention by choosing a rank r L. This is similar with our work in the sense of leveraging low-rank structures . But our method do not require retraining the model and could be applied to different modules other than attention . In fact , most of these methods require special modules and thus we need to retrain the proposed models from scratch . This prohibits the usage of a large body of publicly available open models for faster research progress . More importantly , these methods only focus on the long sequence scenario . We found out that attention module is actually not the bottleneck of inference time in common usage as shown in Figure 1 . In most if not all models of common usages , two layers of large feed-forward layer are appended after attention module which incurs much more computational time . Attention complexity reduction only works when a large sequence is used but in current practice this is unusual . Thus , accelerating attention module itself is not contributing to a significant reduction of overall inference time . Model Size Reduction Efficiency of inference time is also related to model compression . In principle , smaller models would lead to smaller number of operations and thus faster inference time . Sanh et al . ( 2020 ) has explored pruning methods on BERT models to eliminate the redundant links , and there is a line of research on pruning methods ( Han et al. , 2015a ; b ; Chen et al. , 2020 ) . Quantization methods ( Zafrir et al. , 2019 ; Hubara et al. , 2016 ; Lin et al. , 2016 ) could convert the 32 bits float models into lower-bits fixed-point representation , and theoretically make model prediction faster with fixed point accelerator . Lan et al . ( 2019 ) reduces the model size by sharing of encoder parameters . A large body of prior work focuses on variants of knowledge distillation ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ; 2020 ) . These methods use different strategies to distill information from teacher network and reduce the number of layers ( Sanh et al. , 2019 ) or hidden dimension size ( Jiao et al. , 2019 ) . Further , A hybrid compression method by combining matrix factorization , pruning and knowledge distillation is proposed by Mao et al . ( 2020 ) . Among the above mentioned methods , Quantization requires hardware accelerator to reduce the inference time which is not applicable to general scenario . Pruning methods could only reduce the model size , but the inference speed might not be reduced due to the limitation of sparse operations . Only algorithmic method such as distillation could serve as a generic inference time accelerating method . We want to emphasize that our method is orthogonal to these distillation methods . In fact , the proposed method is a generic acceleration method applicable to all components in most NLP models . In section 4 , we show that DRONE can be combined with the distilled models to further improve the performance . 3 METHODS . We now introduce a generic algorithm for improving efficiency of matrix multiplication . The computation of Feed-Forward ( FF ) Layer in the attention models can be described as : h = Wx+ b , ( 1 ) where W ∈ Rd2×d1 and b ∈ Rd2 are model parameters , x ∈ Rd1 is the latent representation of a token , and h ∈ Rd2 is the output . Assume the sequence length is L , all the token representations x1 , . . . , xL ∈ Rd1 will pass through this same operation , so in practice the whole FF layer can be computed by a matrix-matrix product W [ x1 , . . . xn ] + b , and the computation of bias term b would be broadcasted to all L input tokens . In practice we will normally have L max ( d1 , d2 ) ( e.g. , L = 128 , d2 = 3 , 072 ) . A standard way to accelerate the computation is to perform low-rank approximation over W. A lowrank approximation can be acquired by using singular value decomposition ( SVD ) , which achieves the best rank-k approximation in terms of Frobenius norm and we could write W as : W = USV T ≈ UW , kVW , kT , with unitary matrices U ∈ Rd2×d2 , V ∈ Rd1×d1 and a diagonal matrix S ∈ Rd2×d1 . UW , k ∈ Rd2×k and VW , k ∈ Rd1×k are the rank-k approximation matrices by taking UW , k = US 1 2 k , VW , k = S 1 2 k V , where S 1 2 k is the square-root of the first k entries of the diagonal matrix S. Given such approximation , we could simplify the computation in equation 1 by writing it as : h = Wx+ b ≈ UW , kVW , kTx+ b . After the rank-k low-rank approximation , the computational complexity reduces from O ( d2d1 ) to O ( ( d1 + d2 ) k ) . When k is small enough , low-rank approximation could not only accelerate the computation ( Shim et al. , 2017 ) but also compress the model size ( Sainath et al. , 2013 ) . However , as we showed in Figure 2 , matrices in FF layer of BERT models do not show obvious low-rank structures . Ideally , we want a small percentage of the ranks which containing all large singular values such that sum of singular values connected to the selected ranks divided by sum of all singular values is large . But we could observe that choosing rank k to be larger than 50 % of the ranks ( e.g. , about 0.5 times min ( d1 , d2 ) ) could only accumulate 60 percent of the total singular values . This will lead to a large approximation error . In the meantime , the complexity is still about O ( d2d1 ) and there is no enhancement of speed . Despite the matrices in the model are not low-rank , here we provide an illustrative example to show that a low-rank computation could still exist when data distribution lies in a lower intrinsic dimension . Suppose we have a W defined as below and the input x lies in a subspace : W = 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 , x ∈ span ( 2 2 5 5 4 , 1 1 2 2 6 ) , In this case , W is a full-rank matrix so there won ’ t be a lossless low-rank approximation on W . On the other hand , input data x lies in a 2-dimensional subspace such that we could construct the following computation : 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 ︸ ︷︷ ︸ W 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x = 43 23 90 39 66 41 45 37 29 21 ︸ ︷︷ ︸ U [ −1 −1 0.5 0.5 0 −0.5 0 0 0 0.25 ] ︸ ︷︷ ︸ V T 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x , which gives a rank-2 matrix UV T where W 6= UV T but Wx = UV Tx for any x in the low dimensional space . This shows that even if we can ’ t approximate the W matrix , it is still possible to construct a good low-rank decomposition , and the key will be to exploit the space of input vectors .
This work introduces a low-rank based compression method, called DRONE, to accelerate the inference of large NLP models. Instead of decomposing weight matrices in a model, DRONE proposes to exploit the low-rank decomposition by considering the input vectors, which can be in a low-rank space. To compress the whole model, DRONE performs low-rank decomposition from the lower layers to the upper layers in a sequential order. DRONE also proposes a way to extend the low-rank decomposition to dot-product attention. In the evaluation, the paper evaluates their approach against BERT-base and LSTM, and shows that their approaches can obtain better latency-vs-accuracy trade-off versus SVD-based compression method.
SP:861821cf96296ddff89505ab191fb9d7bee45f6d
Data-aware Low-Rank Compression for Large NLP Models
1 INTRODUCTION . The representations learned by large-scale Natural Language Processing ( NLP ) models such as BERT have been widely used in various tasks ( Devlin et al. , 2018 ) . The pre-trained models of BERT and its variations are used as feature extractors for the downstream tasks such as question answering and natural language understanding ( Radford et al . ; Howard & Ruder , 2018 ) . The success of the pre-trained BERT relies on the usage of large corpus and big models . Indeed , researchers have reported better results of models with more parameters ( Shazeer et al. , 2018 ) and number of layers ( Al-Rfou et al. , 2019 ) . The increasing model size of the pre-trained models inhibits the public user from training a model from scratch , and it also brings the efficiency challenges , including the inference speed and the model size when deploying the model on devices . To deal with the efficiency issue , most existing works resort to adjusting the model structures or distillation . For instance , Kitaev et al . ( 2020 ) uses locality-sensitive hashing to accelerate dot-product attention , Lan et al . ( 2019 ) uses repeating model parameters to reduce the size and Zhang et al . ( 2018 ) applies a pre-defined attention pattern to save computation . A large body of prior work focuses on variants of distillation information has also been explored ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ) . However , all these methods either require a specific design of model architecture which is not generic , or require users to train the proposed structure from scratch which greatly reduces its practicality . In this work , we try to explore an acceleration method that is more generic . Note that as shown in Figure 1 , matrix multiplication ( Feed-forward layer ) is a fundamental operation which appears many times in the Transformer architecture . In fact , the underlying computation of both multi-head attention layers and feed-forward layers is matrix multiplication . Therefore , instead of resorting to the complex architecture redesign approaches , we aim to investigate whether low-rank matrix approximation , the most classical and simple model compression approach , can be used to accelerate Transformers . Despite being successfully applied to CNN ( Yu et al. , 2017 ; Sindhwani et al. , 2015 ; Shim et al. , 2017 ; You et al. , 2019 ) , at the first glance low-rank compression can not work for BERT . We could see in Figure 2 that regardless of layers , matrices in feed-forward layer , query and key transformation of attention layer are not low-rank . Therefore , even the optimal low-rank approximation ( e.g. , by SVD ) will lead to large reconstruction error and empirically the performance is limited . This is probably why low-rank approximation has not been used in BERT compression . In this paper , we propose a novel low-rank approximation algorithm to compress the weight matrices even though they are not low-rank . The main idea is to exploit the data distribution . In NLP applications , the latent features , indicating some information extracted from natural sentences , often lie in a subspace with a lower intrinsic dimension . Therefore , in most of the matrix-vector products , even though the weight matrices are not low-rank , the input vectors lie in a low-dimensional subspace , allowing dimension reduction with minimal degraded performance . We mathematically formulate this generalized low-rank approximation problem which includes the data distribution term and provide a closed-form solution for the optimal rank-k decomposition of the weight matrices . We propose DRONE method based on this novel Data-awaRe lOw-raNk comprEssion idea . Our decomposition significantly outperforms SVD under the same rank constraint , and can successfully accelerate the BERT model without sacrificing too much test performance . 2 RELATED WORK . The inference speed is important for NLP models when deployed in various applications . Generally speaking , inference efficiency could be enhanced by hardware ( Shawahna et al. , 2018 ) or lower-level instruction optimization ( Ning , 2020 ) . On the other hand , the main focus of the current research is on using algorithmic methods to reduce the computational complexity . It could be mainly categorized into two aspects : Attention Complexity Reduction and Model Size Reduction . Attention Complexity Reduction Attention mechanism is the building block of transformer model and it attracts most attentions of researcher recently in NLP field ( Vaswani et al. , 2017 ) . Pre-training on large courpus of BERT , a transformer-based model , has contributed to state-of-the-art performance on various tasks after fine-tuning ( Devlin et al. , 2018 ) . Attention on sequences of length L is O ( L2 ) in both computational and memory complexity . This would take long inference time when the sequence is long . Thus , researchers have focused on reducing the complexity of the attention module . Kitaev et al . ( 2020 ) uses uses locality-sensitive hashing to reduce the complexity to O ( LlogL ) . Zhang et al . ( 2018 ) ; Child et al . ( 2019 ) pre-defined an attention map to have a constant computational time . Goyal et al . progressively eliminates the redundant context vectors within the attended sequence to improve the efficiency of attention in last few layers of the model . Wang et al . ( 2020 ) proposes to train the low-rank attention by choosing a rank r L. This is similar with our work in the sense of leveraging low-rank structures . But our method do not require retraining the model and could be applied to different modules other than attention . In fact , most of these methods require special modules and thus we need to retrain the proposed models from scratch . This prohibits the usage of a large body of publicly available open models for faster research progress . More importantly , these methods only focus on the long sequence scenario . We found out that attention module is actually not the bottleneck of inference time in common usage as shown in Figure 1 . In most if not all models of common usages , two layers of large feed-forward layer are appended after attention module which incurs much more computational time . Attention complexity reduction only works when a large sequence is used but in current practice this is unusual . Thus , accelerating attention module itself is not contributing to a significant reduction of overall inference time . Model Size Reduction Efficiency of inference time is also related to model compression . In principle , smaller models would lead to smaller number of operations and thus faster inference time . Sanh et al . ( 2020 ) has explored pruning methods on BERT models to eliminate the redundant links , and there is a line of research on pruning methods ( Han et al. , 2015a ; b ; Chen et al. , 2020 ) . Quantization methods ( Zafrir et al. , 2019 ; Hubara et al. , 2016 ; Lin et al. , 2016 ) could convert the 32 bits float models into lower-bits fixed-point representation , and theoretically make model prediction faster with fixed point accelerator . Lan et al . ( 2019 ) reduces the model size by sharing of encoder parameters . A large body of prior work focuses on variants of knowledge distillation ( Sanh et al. , 2019 ; Jiao et al. , 2019 ; Sun et al. , 2020 ; Liu et al. , 2020 ; Xu et al. , 2020 ; Sun et al. , 2019 ; 2020 ) . These methods use different strategies to distill information from teacher network and reduce the number of layers ( Sanh et al. , 2019 ) or hidden dimension size ( Jiao et al. , 2019 ) . Further , A hybrid compression method by combining matrix factorization , pruning and knowledge distillation is proposed by Mao et al . ( 2020 ) . Among the above mentioned methods , Quantization requires hardware accelerator to reduce the inference time which is not applicable to general scenario . Pruning methods could only reduce the model size , but the inference speed might not be reduced due to the limitation of sparse operations . Only algorithmic method such as distillation could serve as a generic inference time accelerating method . We want to emphasize that our method is orthogonal to these distillation methods . In fact , the proposed method is a generic acceleration method applicable to all components in most NLP models . In section 4 , we show that DRONE can be combined with the distilled models to further improve the performance . 3 METHODS . We now introduce a generic algorithm for improving efficiency of matrix multiplication . The computation of Feed-Forward ( FF ) Layer in the attention models can be described as : h = Wx+ b , ( 1 ) where W ∈ Rd2×d1 and b ∈ Rd2 are model parameters , x ∈ Rd1 is the latent representation of a token , and h ∈ Rd2 is the output . Assume the sequence length is L , all the token representations x1 , . . . , xL ∈ Rd1 will pass through this same operation , so in practice the whole FF layer can be computed by a matrix-matrix product W [ x1 , . . . xn ] + b , and the computation of bias term b would be broadcasted to all L input tokens . In practice we will normally have L max ( d1 , d2 ) ( e.g. , L = 128 , d2 = 3 , 072 ) . A standard way to accelerate the computation is to perform low-rank approximation over W. A lowrank approximation can be acquired by using singular value decomposition ( SVD ) , which achieves the best rank-k approximation in terms of Frobenius norm and we could write W as : W = USV T ≈ UW , kVW , kT , with unitary matrices U ∈ Rd2×d2 , V ∈ Rd1×d1 and a diagonal matrix S ∈ Rd2×d1 . UW , k ∈ Rd2×k and VW , k ∈ Rd1×k are the rank-k approximation matrices by taking UW , k = US 1 2 k , VW , k = S 1 2 k V , where S 1 2 k is the square-root of the first k entries of the diagonal matrix S. Given such approximation , we could simplify the computation in equation 1 by writing it as : h = Wx+ b ≈ UW , kVW , kTx+ b . After the rank-k low-rank approximation , the computational complexity reduces from O ( d2d1 ) to O ( ( d1 + d2 ) k ) . When k is small enough , low-rank approximation could not only accelerate the computation ( Shim et al. , 2017 ) but also compress the model size ( Sainath et al. , 2013 ) . However , as we showed in Figure 2 , matrices in FF layer of BERT models do not show obvious low-rank structures . Ideally , we want a small percentage of the ranks which containing all large singular values such that sum of singular values connected to the selected ranks divided by sum of all singular values is large . But we could observe that choosing rank k to be larger than 50 % of the ranks ( e.g. , about 0.5 times min ( d1 , d2 ) ) could only accumulate 60 percent of the total singular values . This will lead to a large approximation error . In the meantime , the complexity is still about O ( d2d1 ) and there is no enhancement of speed . Despite the matrices in the model are not low-rank , here we provide an illustrative example to show that a low-rank computation could still exist when data distribution lies in a lower intrinsic dimension . Suppose we have a W defined as below and the input x lies in a subspace : W = 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 , x ∈ span ( 2 2 5 5 4 , 1 1 2 2 6 ) , In this case , W is a full-rank matrix so there won ’ t be a lossless low-rank approximation on W . On the other hand , input data x lies in a 2-dimensional subspace such that we could construct the following computation : 7 0 2 3 1 9 6 7 5 0 6 1 8 0 3 4 3 2 1 4 1 2 2 1 2 ︸ ︷︷ ︸ W 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x = 43 23 90 39 66 41 45 37 29 21 ︸ ︷︷ ︸ U [ −1 −1 0.5 0.5 0 −0.5 0 0 0 0.25 ] ︸ ︷︷ ︸ V T 2 1 2 1 5 2 5 2 4 6 [ a b ] ︸ ︷︷ ︸ x , which gives a rank-2 matrix UV T where W 6= UV T but Wx = UV Tx for any x in the low dimensional space . This shows that even if we can ’ t approximate the W matrix , it is still possible to construct a good low-rank decomposition , and the key will be to exploit the space of input vectors .
The goal of this paper is to accelerate large-scale NLP models. This paper reduces the computational complexity by exploiting the data distribution. They claim that exploiting the data distribution enables us to perform low-rank approximation on feed-forward networks. Furthermore, they use that idea to reduce the complexity of the dot-product of attention modules. They experimentally show that they achieve faster inference time while retaining original accuracy. In addition, they show that their method can be combined with distillation methods.
SP:861821cf96296ddff89505ab191fb9d7bee45f6d
Neighbor Class Consistency on Unsupervised Domain Adaptation
1 INTRODUCTION . Recent advances in deep neural network have dominated many computer vision tasks , such as image recognition He et al . ( 2016 ) , object detectionGirshick ( 2015 ) , and semantic segmentationLong et al . ( 2015 ) . However , collection and manual annotation need no trivial human effort , especially for vision tasks like semantic segmentation where dense annotations are required . Thanks to the growth of computer graphics field , it is now possible to leverage CNN to synthetic images with computergenerated annotations ( Richter et al . ( 2016 ) ; Ros et al . ( 2016 ) ) , so unlimited amount of data with free annotation is available for training network in scale . However , directly applying the model trained on synthetic source data to unlabeled target data leads to performance degradation and Unsupervised Domain Adaptation ( UDA ) aims to tackle this domain shift problem . A widespread of UDA methods were proposed to align the domain-invariant representations by simultaneously minimizing the source error and discrepancy ( e.g . H-divergence Ben-David et al . ( 2010 ) ; Hoffman et al . ( 2016 ) H4H-divergenceBen-David et al . ( 2010 ) ) between two domain such as the maximum mean discrepancy Tzeng et al . ( 2014 ) , correlation distanceSun et al . ( 2016 ) and etc . Further , adversarial learning-based UDA Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) methods aim to reduce this discrepancy between two domain by minimizing the adversarial loss . However , the major limitation of adversarial learning is that it only aligns the global feature distribution of two domains without considering the class labels . As the result , a small H4H distance does not guarantee the small error on ideal joint hypothesis on the features of two domains Liu et al . ( 2019 ) . To alleviate this issue , Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) and Self-Training ( Lee ( 2013 ) ; Zou et al . ( 2018 ) ) are the two dominant methods to enforce the cluster assumption such that network can learn a discriminative feature space by pushing the decision boundary away from densely-distributed area . However , as decision boundary is largely biased to- wards source data , trusting biased network predictions will push target features towards their nearest source class prototypes while deteriorating the intrinsic discriminative target structure as shown in Fig . 1 ( 2.a ) . Motivated by agglomerative clustering methods ( Sarfraz et al . ( 2019 ) ) which assume that features in the nearby region should be clustered together , we investigate target features from source pretrained model and observe that they are intrinsically discriminative and have a very high possibility of sharing the same label with their neighbors as shown in Fig . 1 ( 2.b ) . To utilize this high-quality pairwise neighbor supervision , we propose a simple and effective approach to impose Neighbor Class Consistency between target samples and their neighbors . To alleviate propagated errors from false neighbor supervision , we introduce an Entropy-based weighting scheme to emphasize more on the reliable pairwise neighbor supervision . Additionally , we categorize Self Class Consistency as a special case of our method where the nearest neighbor of a sample is its self-augmentation . Further , we explore feature representation learning based on the ranking relationship between selfaugmentation and the first neighbor given an anchor . We enforce the features of anchors to be closer to their self-augmentation than their first neighbors . In summary , our main contributions are shown as follows : ( 1 ) We revisit the source pre-trained model and observe the intrinsic discriminative nature of target features from source model . ( 2 ) Based on this observation , we propose Neighbor Class Consistency ( NC ) to utilize the high-quality pairwise neighbor pseudo supervision over noisy class-wise pseudo supervision from Self-Training methods . ( 3 ) We introduce an Entropy-based weighting scheme to help our framework be more robust to unreliable neighbor supervision . ( 4 ) We categorize Self Class Consistency as a special case of our framework and explore the first neighbor for feature representation learning . ( 5 ) We conduct extensive experiments on three UDA benchmarks datasets . NC outperforms all existing methods and achieves a new UDA state-of-the-art performance . Notably , we achieve 86.2 % on challenging VisDA17 dataset . 2 RELATED WORK . Discrepancy based domain adaptation Following the theoretical upper bound proposed in BenDavid et al . ( 2007 ) , existing methods have explored to align the feature representations of the source and target images by minimizing the distribution discrepancy . For example , Maximum Mean Discrepancy ( MMD ) Tzeng et al . ( 2014 ) is proposed to match the mean and covariance of source and target distributions . Alternatively , adversarial domain adaptation methods Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) solve this domain discrepancy by training a domain- invariant feature generator which produces the features to fool a discriminator that distinguishes the representations from source and target domains . However , since the domain discriminator aligns source and target features without considering the class labels , merely aligning the global marginal distribution of the features in the two domains fails to align the class-wise distribution . Clustering based domain adaptation Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) . and self-training ( Zou et al . ( 2018 ) ; Gu et al . ( 2020 ) ) are two streams of approaches to realize the class-wise alignment across domains . However , minimizing the conditional entropy of target prediction based on source biased classifier will harm the intrinsic discriminative target structure . To this end , prototypical classifier and alignment Xie et al . ( 2018 ) ; Pan et al . ( 2019 ) have been explored to mitigate the noisy supervision from source biased classifier . However , the prototypes of target samples are still noisy estimated cluster centers and therefore target samples away from prototypes may still risk of being wrongly classified . Similar effort has been made by Tang et al . ( 2020 ) on learning the latent discriminative target structure with respect to learnable clusters via deep clustering framework Ghasedi Dizaji et al . ( 2017 ) . Consistency Regularization In semi-supervised setting , mainstream methods apply various consistency regularization on unlabeled data with different pre-defined positive counterpart . Among them , Tarvainen & Valpola ( 2017 ) impose consistency between predictions from student network and moving-average based teacher networks . Virtual Adversarial Training Miyato et al . ( 2018 ) tries to make network invariant to small adversarial permutations around the neighborhood of a sample while DTALee et al . ( 2019 ) enforces the target predictions from the networks with different choice of dropout mask to be consistent . In un/self-supervised setting , SimCLR ( Chen et al . ( 2020 ) ) and MoCo ( He et al . ( 2020 ) ) are the two prevalent approaches to conduct contrastive learning on the feature space among unlabeled data , its strong augmentation and other negative samples from either extremely large current batch or momentum updated memory banks . In comparison to those un/self-supervised methods , our method exploreS neighbor samples for consistency regularization . In cross-domain person re-identification , Zhong et al . ( 2019 ) also utilize the neighbor information on target data . To emphasize the difference , our method focuses on regularizing the classifier to be less biased toward source domain by applying target neighbor class consistency while they focus on the feature representation learning by enforcing neighbor feature invariance . 3 METHOD . 3.1 PROBLEM DEFINITION . In unsupervised domain adaptation ( UDA ) , source domain data is denoted as Ds = { ( xsi , ysi ) | Ns i=1 } where xsi and y s i denote the i-th training sample and its label , Ns is the number of source images . Target domain data is denoted as Dt = { xti| Nt i=1 } where Nt is the number of target images . The objective of UDA is to train a deep neural network G ( ·|θ ) which has access to the source data ( xsi , y s i ) drawn from Ds and target data xti drawn from Dt such that the modelG ( ·|θ ) can generalize on target domain . Network G ( ·|θ ) = C ◦ F ( ·|θ ) is comprised of a feature extractor F ( ·|θ ) and a classifier C ( ·|θ ) where θ denotes network parameters . 3.2 REVISIT SUPERVISED PRE-TRAINING FOR SOURCE DOMAIN . In general , UDA pre-trains a network G ( ·|θ ) on source domain by standard cross entropy loss and then the network is transferred to inference the target data . The source supervised objective function is in the form of , Lssrc ( θ ) = 1 Ns Ns∑ i=1 Lce ( C ( F ( xsi |θ ) ) , ysi ) . ( 1 ) However , the model trained on source data usually generalizes poorly on target data due to the domain shift between the joint distribution of two domains . Self-Training ( ST ) and Entropy Minimization ( Ent ) methods are proposed to make the network be confident on its target predictions following the cluster assumption and thus improve the discrim- inativeness of network . Their objective functions are calculated as LtST ( θ ) = 1 Nt Nt∑ i=1 Lce ( C ( F ( xti|θ ) ) , ỹti ) , ( 2 ) LtEnt ( θ ) = 1 Nt Nt∑ i=1 H ( C ( F ( xti|θ ) ) ) , ( 3 ) where ỹti is the pseudo label for the i target sample andH is entropy function . Nonetheless , the pseudo labels of target samples are noisy as the network is biased towards source data . Trusting noisy label or prediction has high risk of misleading the training and propagate errors . Inspired by agglomerative clustering methods which claim that features should be clustered with their near neighborhood , we hypothesize that source domain pre-training can provide a feature space where target features are intrinsically discriminative and have high probability of sharing the same labels with their neighbors . To verify this , we apply k-Nearest Neighbor ( kNN ) search on target features extracted from source model on Offce-31 A→W . We evaluate the pairwise label consistent accuracy between target features and their k-th neighbors . Table 1 shows that target features from source model have very high accuracy of sharing the same label with their K-th neighbors . It demonstrates our hypothesis that target features from source model are locally discriminative . This observation motivates us to leverage this relative ” clean ” pairwise pseudo supervision to help the network generalization on target domain over the noisy class-wise pseudo supervision . 3.3 NEIGHBORHOOD CLASS CONSISTENCY . 1 ) Neighborhood Discovery . First , we extract target features zt = F ( xt|θ ) from source pre-train model and save them into a target feature memory bank Vt = { zti | Nt i=1 } . Then we apply kNN on target features Vt to explore the neighborhood Nk ( zt ) which is defined as follows : Nk ( ztj ) = { zti |s ( zti , ztj ) is top-k in Vt } , ( 4 ) where s is a similarity metric and k is the number of neighbors . Note that we update the memory bank Vt with the newest features in training and conduct kNN on Vt at every epoch . 2 ) Vanilla Neighborhood Class Consistency ( VNC ) . Based on our motivation that target samples should share the same class label with their neighbors , we propose VNC to enforce the class assignment consistency between pairwise neighbors by mutual information ( MI ) maximization between their network predictions . Formally , we formulate the objective function of VNC in the form of : LtV NC ( θ ) = − 1 Nt Nt∑ i=1 1 k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) . ( 5 ) It is also worth noting that the memory bank serves as a look-up table to retrieve the target features and feed them into the classifier C for computing the Neighborhood Class Consistency loss . As the size of k can be potentially large , using memory bank can implicitly enlarge the batch size by k times without introducing extra computational cost and time . 3 ) Entropy-weighted Neighborhood Class Consistency ( ENC ) . Table 1 shows that the reliability of pairwise neighborhood supervision is decreased with the rise of neighborhood size k. In other words , there is a trade-off between large neighborhood diversity and reliability of neighbor supervision . A straightforward idea is to treat each neighbor pairs differently in terms of loss weight such that hopefully positive neighbor pairs ( Correct ) will have higher loss weight than negative neighbor pairs ( False ) . To achieve this , we propose a entropy-based weighting scheme ( EW ) to assign different loss weight on different neighbor pairs given an anchor . As the entropy is a measurement of sample prediction certainty , the less entropy is , more confident the prediction is and thus more weight we will assign on . Formally , we define the loss weight and objective of ENC as follows : w ( zt ) = 1− H ( C ( z t|θ ) ) logM , ( 6 ) LtENC ( θ ) = − 1 Nt Nt∑ i=1 w ( ztj ) k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) , ( 7 ) where M is the number of class . We claim that entropy-based weighting helps mitigate the problem of noisy pairwise supervision and it is more robust to the neighborhood size k as it will down-weight the neighbor pairs if the selected neighbor samples have high entropy value .
This paper tackles Unsupervised Domain Adaptation. The authors focus on the intrinsic discriminative feature for target samples. The proposed method, Neighborhood Class Consistency among target samples and augmented ones, is proposed as a set of multiple losses to calculate the consistency from several aspects. The experimental results show that the proposed method achieves state-of-the-art performance using the same backbone network.
SP:0da26728efc61af9be3b15caa90317fd587c5e21
Neighbor Class Consistency on Unsupervised Domain Adaptation
1 INTRODUCTION . Recent advances in deep neural network have dominated many computer vision tasks , such as image recognition He et al . ( 2016 ) , object detectionGirshick ( 2015 ) , and semantic segmentationLong et al . ( 2015 ) . However , collection and manual annotation need no trivial human effort , especially for vision tasks like semantic segmentation where dense annotations are required . Thanks to the growth of computer graphics field , it is now possible to leverage CNN to synthetic images with computergenerated annotations ( Richter et al . ( 2016 ) ; Ros et al . ( 2016 ) ) , so unlimited amount of data with free annotation is available for training network in scale . However , directly applying the model trained on synthetic source data to unlabeled target data leads to performance degradation and Unsupervised Domain Adaptation ( UDA ) aims to tackle this domain shift problem . A widespread of UDA methods were proposed to align the domain-invariant representations by simultaneously minimizing the source error and discrepancy ( e.g . H-divergence Ben-David et al . ( 2010 ) ; Hoffman et al . ( 2016 ) H4H-divergenceBen-David et al . ( 2010 ) ) between two domain such as the maximum mean discrepancy Tzeng et al . ( 2014 ) , correlation distanceSun et al . ( 2016 ) and etc . Further , adversarial learning-based UDA Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) methods aim to reduce this discrepancy between two domain by minimizing the adversarial loss . However , the major limitation of adversarial learning is that it only aligns the global feature distribution of two domains without considering the class labels . As the result , a small H4H distance does not guarantee the small error on ideal joint hypothesis on the features of two domains Liu et al . ( 2019 ) . To alleviate this issue , Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) and Self-Training ( Lee ( 2013 ) ; Zou et al . ( 2018 ) ) are the two dominant methods to enforce the cluster assumption such that network can learn a discriminative feature space by pushing the decision boundary away from densely-distributed area . However , as decision boundary is largely biased to- wards source data , trusting biased network predictions will push target features towards their nearest source class prototypes while deteriorating the intrinsic discriminative target structure as shown in Fig . 1 ( 2.a ) . Motivated by agglomerative clustering methods ( Sarfraz et al . ( 2019 ) ) which assume that features in the nearby region should be clustered together , we investigate target features from source pretrained model and observe that they are intrinsically discriminative and have a very high possibility of sharing the same label with their neighbors as shown in Fig . 1 ( 2.b ) . To utilize this high-quality pairwise neighbor supervision , we propose a simple and effective approach to impose Neighbor Class Consistency between target samples and their neighbors . To alleviate propagated errors from false neighbor supervision , we introduce an Entropy-based weighting scheme to emphasize more on the reliable pairwise neighbor supervision . Additionally , we categorize Self Class Consistency as a special case of our method where the nearest neighbor of a sample is its self-augmentation . Further , we explore feature representation learning based on the ranking relationship between selfaugmentation and the first neighbor given an anchor . We enforce the features of anchors to be closer to their self-augmentation than their first neighbors . In summary , our main contributions are shown as follows : ( 1 ) We revisit the source pre-trained model and observe the intrinsic discriminative nature of target features from source model . ( 2 ) Based on this observation , we propose Neighbor Class Consistency ( NC ) to utilize the high-quality pairwise neighbor pseudo supervision over noisy class-wise pseudo supervision from Self-Training methods . ( 3 ) We introduce an Entropy-based weighting scheme to help our framework be more robust to unreliable neighbor supervision . ( 4 ) We categorize Self Class Consistency as a special case of our framework and explore the first neighbor for feature representation learning . ( 5 ) We conduct extensive experiments on three UDA benchmarks datasets . NC outperforms all existing methods and achieves a new UDA state-of-the-art performance . Notably , we achieve 86.2 % on challenging VisDA17 dataset . 2 RELATED WORK . Discrepancy based domain adaptation Following the theoretical upper bound proposed in BenDavid et al . ( 2007 ) , existing methods have explored to align the feature representations of the source and target images by minimizing the distribution discrepancy . For example , Maximum Mean Discrepancy ( MMD ) Tzeng et al . ( 2014 ) is proposed to match the mean and covariance of source and target distributions . Alternatively , adversarial domain adaptation methods Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) solve this domain discrepancy by training a domain- invariant feature generator which produces the features to fool a discriminator that distinguishes the representations from source and target domains . However , since the domain discriminator aligns source and target features without considering the class labels , merely aligning the global marginal distribution of the features in the two domains fails to align the class-wise distribution . Clustering based domain adaptation Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) . and self-training ( Zou et al . ( 2018 ) ; Gu et al . ( 2020 ) ) are two streams of approaches to realize the class-wise alignment across domains . However , minimizing the conditional entropy of target prediction based on source biased classifier will harm the intrinsic discriminative target structure . To this end , prototypical classifier and alignment Xie et al . ( 2018 ) ; Pan et al . ( 2019 ) have been explored to mitigate the noisy supervision from source biased classifier . However , the prototypes of target samples are still noisy estimated cluster centers and therefore target samples away from prototypes may still risk of being wrongly classified . Similar effort has been made by Tang et al . ( 2020 ) on learning the latent discriminative target structure with respect to learnable clusters via deep clustering framework Ghasedi Dizaji et al . ( 2017 ) . Consistency Regularization In semi-supervised setting , mainstream methods apply various consistency regularization on unlabeled data with different pre-defined positive counterpart . Among them , Tarvainen & Valpola ( 2017 ) impose consistency between predictions from student network and moving-average based teacher networks . Virtual Adversarial Training Miyato et al . ( 2018 ) tries to make network invariant to small adversarial permutations around the neighborhood of a sample while DTALee et al . ( 2019 ) enforces the target predictions from the networks with different choice of dropout mask to be consistent . In un/self-supervised setting , SimCLR ( Chen et al . ( 2020 ) ) and MoCo ( He et al . ( 2020 ) ) are the two prevalent approaches to conduct contrastive learning on the feature space among unlabeled data , its strong augmentation and other negative samples from either extremely large current batch or momentum updated memory banks . In comparison to those un/self-supervised methods , our method exploreS neighbor samples for consistency regularization . In cross-domain person re-identification , Zhong et al . ( 2019 ) also utilize the neighbor information on target data . To emphasize the difference , our method focuses on regularizing the classifier to be less biased toward source domain by applying target neighbor class consistency while they focus on the feature representation learning by enforcing neighbor feature invariance . 3 METHOD . 3.1 PROBLEM DEFINITION . In unsupervised domain adaptation ( UDA ) , source domain data is denoted as Ds = { ( xsi , ysi ) | Ns i=1 } where xsi and y s i denote the i-th training sample and its label , Ns is the number of source images . Target domain data is denoted as Dt = { xti| Nt i=1 } where Nt is the number of target images . The objective of UDA is to train a deep neural network G ( ·|θ ) which has access to the source data ( xsi , y s i ) drawn from Ds and target data xti drawn from Dt such that the modelG ( ·|θ ) can generalize on target domain . Network G ( ·|θ ) = C ◦ F ( ·|θ ) is comprised of a feature extractor F ( ·|θ ) and a classifier C ( ·|θ ) where θ denotes network parameters . 3.2 REVISIT SUPERVISED PRE-TRAINING FOR SOURCE DOMAIN . In general , UDA pre-trains a network G ( ·|θ ) on source domain by standard cross entropy loss and then the network is transferred to inference the target data . The source supervised objective function is in the form of , Lssrc ( θ ) = 1 Ns Ns∑ i=1 Lce ( C ( F ( xsi |θ ) ) , ysi ) . ( 1 ) However , the model trained on source data usually generalizes poorly on target data due to the domain shift between the joint distribution of two domains . Self-Training ( ST ) and Entropy Minimization ( Ent ) methods are proposed to make the network be confident on its target predictions following the cluster assumption and thus improve the discrim- inativeness of network . Their objective functions are calculated as LtST ( θ ) = 1 Nt Nt∑ i=1 Lce ( C ( F ( xti|θ ) ) , ỹti ) , ( 2 ) LtEnt ( θ ) = 1 Nt Nt∑ i=1 H ( C ( F ( xti|θ ) ) ) , ( 3 ) where ỹti is the pseudo label for the i target sample andH is entropy function . Nonetheless , the pseudo labels of target samples are noisy as the network is biased towards source data . Trusting noisy label or prediction has high risk of misleading the training and propagate errors . Inspired by agglomerative clustering methods which claim that features should be clustered with their near neighborhood , we hypothesize that source domain pre-training can provide a feature space where target features are intrinsically discriminative and have high probability of sharing the same labels with their neighbors . To verify this , we apply k-Nearest Neighbor ( kNN ) search on target features extracted from source model on Offce-31 A→W . We evaluate the pairwise label consistent accuracy between target features and their k-th neighbors . Table 1 shows that target features from source model have very high accuracy of sharing the same label with their K-th neighbors . It demonstrates our hypothesis that target features from source model are locally discriminative . This observation motivates us to leverage this relative ” clean ” pairwise pseudo supervision to help the network generalization on target domain over the noisy class-wise pseudo supervision . 3.3 NEIGHBORHOOD CLASS CONSISTENCY . 1 ) Neighborhood Discovery . First , we extract target features zt = F ( xt|θ ) from source pre-train model and save them into a target feature memory bank Vt = { zti | Nt i=1 } . Then we apply kNN on target features Vt to explore the neighborhood Nk ( zt ) which is defined as follows : Nk ( ztj ) = { zti |s ( zti , ztj ) is top-k in Vt } , ( 4 ) where s is a similarity metric and k is the number of neighbors . Note that we update the memory bank Vt with the newest features in training and conduct kNN on Vt at every epoch . 2 ) Vanilla Neighborhood Class Consistency ( VNC ) . Based on our motivation that target samples should share the same class label with their neighbors , we propose VNC to enforce the class assignment consistency between pairwise neighbors by mutual information ( MI ) maximization between their network predictions . Formally , we formulate the objective function of VNC in the form of : LtV NC ( θ ) = − 1 Nt Nt∑ i=1 1 k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) . ( 5 ) It is also worth noting that the memory bank serves as a look-up table to retrieve the target features and feed them into the classifier C for computing the Neighborhood Class Consistency loss . As the size of k can be potentially large , using memory bank can implicitly enlarge the batch size by k times without introducing extra computational cost and time . 3 ) Entropy-weighted Neighborhood Class Consistency ( ENC ) . Table 1 shows that the reliability of pairwise neighborhood supervision is decreased with the rise of neighborhood size k. In other words , there is a trade-off between large neighborhood diversity and reliability of neighbor supervision . A straightforward idea is to treat each neighbor pairs differently in terms of loss weight such that hopefully positive neighbor pairs ( Correct ) will have higher loss weight than negative neighbor pairs ( False ) . To achieve this , we propose a entropy-based weighting scheme ( EW ) to assign different loss weight on different neighbor pairs given an anchor . As the entropy is a measurement of sample prediction certainty , the less entropy is , more confident the prediction is and thus more weight we will assign on . Formally , we define the loss weight and objective of ENC as follows : w ( zt ) = 1− H ( C ( z t|θ ) ) logM , ( 6 ) LtENC ( θ ) = − 1 Nt Nt∑ i=1 w ( ztj ) k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) , ( 7 ) where M is the number of class . We claim that entropy-based weighting helps mitigate the problem of noisy pairwise supervision and it is more robust to the neighborhood size k as it will down-weight the neighbor pairs if the selected neighbor samples have high entropy value .
This paper proposed neighbor class consistency regularization together with an entropy-based weighting factor to tackle the problem of unsupervised domain adaptation. Another self class consistency regularization was further introduced to help training. The difference between "neighbor class" and "self class" is the positive pair selection, where "neighbor class" uses k-nearest neighbors as positive pairs, and "self class" uses an augmented version of the anchor itself.
SP:0da26728efc61af9be3b15caa90317fd587c5e21
Neighbor Class Consistency on Unsupervised Domain Adaptation
1 INTRODUCTION . Recent advances in deep neural network have dominated many computer vision tasks , such as image recognition He et al . ( 2016 ) , object detectionGirshick ( 2015 ) , and semantic segmentationLong et al . ( 2015 ) . However , collection and manual annotation need no trivial human effort , especially for vision tasks like semantic segmentation where dense annotations are required . Thanks to the growth of computer graphics field , it is now possible to leverage CNN to synthetic images with computergenerated annotations ( Richter et al . ( 2016 ) ; Ros et al . ( 2016 ) ) , so unlimited amount of data with free annotation is available for training network in scale . However , directly applying the model trained on synthetic source data to unlabeled target data leads to performance degradation and Unsupervised Domain Adaptation ( UDA ) aims to tackle this domain shift problem . A widespread of UDA methods were proposed to align the domain-invariant representations by simultaneously minimizing the source error and discrepancy ( e.g . H-divergence Ben-David et al . ( 2010 ) ; Hoffman et al . ( 2016 ) H4H-divergenceBen-David et al . ( 2010 ) ) between two domain such as the maximum mean discrepancy Tzeng et al . ( 2014 ) , correlation distanceSun et al . ( 2016 ) and etc . Further , adversarial learning-based UDA Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) methods aim to reduce this discrepancy between two domain by minimizing the adversarial loss . However , the major limitation of adversarial learning is that it only aligns the global feature distribution of two domains without considering the class labels . As the result , a small H4H distance does not guarantee the small error on ideal joint hypothesis on the features of two domains Liu et al . ( 2019 ) . To alleviate this issue , Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) and Self-Training ( Lee ( 2013 ) ; Zou et al . ( 2018 ) ) are the two dominant methods to enforce the cluster assumption such that network can learn a discriminative feature space by pushing the decision boundary away from densely-distributed area . However , as decision boundary is largely biased to- wards source data , trusting biased network predictions will push target features towards their nearest source class prototypes while deteriorating the intrinsic discriminative target structure as shown in Fig . 1 ( 2.a ) . Motivated by agglomerative clustering methods ( Sarfraz et al . ( 2019 ) ) which assume that features in the nearby region should be clustered together , we investigate target features from source pretrained model and observe that they are intrinsically discriminative and have a very high possibility of sharing the same label with their neighbors as shown in Fig . 1 ( 2.b ) . To utilize this high-quality pairwise neighbor supervision , we propose a simple and effective approach to impose Neighbor Class Consistency between target samples and their neighbors . To alleviate propagated errors from false neighbor supervision , we introduce an Entropy-based weighting scheme to emphasize more on the reliable pairwise neighbor supervision . Additionally , we categorize Self Class Consistency as a special case of our method where the nearest neighbor of a sample is its self-augmentation . Further , we explore feature representation learning based on the ranking relationship between selfaugmentation and the first neighbor given an anchor . We enforce the features of anchors to be closer to their self-augmentation than their first neighbors . In summary , our main contributions are shown as follows : ( 1 ) We revisit the source pre-trained model and observe the intrinsic discriminative nature of target features from source model . ( 2 ) Based on this observation , we propose Neighbor Class Consistency ( NC ) to utilize the high-quality pairwise neighbor pseudo supervision over noisy class-wise pseudo supervision from Self-Training methods . ( 3 ) We introduce an Entropy-based weighting scheme to help our framework be more robust to unreliable neighbor supervision . ( 4 ) We categorize Self Class Consistency as a special case of our framework and explore the first neighbor for feature representation learning . ( 5 ) We conduct extensive experiments on three UDA benchmarks datasets . NC outperforms all existing methods and achieves a new UDA state-of-the-art performance . Notably , we achieve 86.2 % on challenging VisDA17 dataset . 2 RELATED WORK . Discrepancy based domain adaptation Following the theoretical upper bound proposed in BenDavid et al . ( 2007 ) , existing methods have explored to align the feature representations of the source and target images by minimizing the distribution discrepancy . For example , Maximum Mean Discrepancy ( MMD ) Tzeng et al . ( 2014 ) is proposed to match the mean and covariance of source and target distributions . Alternatively , adversarial domain adaptation methods Ganin & Lempitsky ( 2015 ) ; Tzeng et al . ( 2017 ) ; Radford et al . ( 2015 ) ; Hoffman et al . ( 2018 ) ; Tsai et al . ( 2018 ) ; Sankaranarayanan et al . ( 2018 ) ; Luo et al . ( 2019 ) solve this domain discrepancy by training a domain- invariant feature generator which produces the features to fool a discriminator that distinguishes the representations from source and target domains . However , since the domain discriminator aligns source and target features without considering the class labels , merely aligning the global marginal distribution of the features in the two domains fails to align the class-wise distribution . Clustering based domain adaptation Entropy minimization ( Grandvalet & Bengio ( 2005 ) ; Vu et al . ( 2019 ) ) . and self-training ( Zou et al . ( 2018 ) ; Gu et al . ( 2020 ) ) are two streams of approaches to realize the class-wise alignment across domains . However , minimizing the conditional entropy of target prediction based on source biased classifier will harm the intrinsic discriminative target structure . To this end , prototypical classifier and alignment Xie et al . ( 2018 ) ; Pan et al . ( 2019 ) have been explored to mitigate the noisy supervision from source biased classifier . However , the prototypes of target samples are still noisy estimated cluster centers and therefore target samples away from prototypes may still risk of being wrongly classified . Similar effort has been made by Tang et al . ( 2020 ) on learning the latent discriminative target structure with respect to learnable clusters via deep clustering framework Ghasedi Dizaji et al . ( 2017 ) . Consistency Regularization In semi-supervised setting , mainstream methods apply various consistency regularization on unlabeled data with different pre-defined positive counterpart . Among them , Tarvainen & Valpola ( 2017 ) impose consistency between predictions from student network and moving-average based teacher networks . Virtual Adversarial Training Miyato et al . ( 2018 ) tries to make network invariant to small adversarial permutations around the neighborhood of a sample while DTALee et al . ( 2019 ) enforces the target predictions from the networks with different choice of dropout mask to be consistent . In un/self-supervised setting , SimCLR ( Chen et al . ( 2020 ) ) and MoCo ( He et al . ( 2020 ) ) are the two prevalent approaches to conduct contrastive learning on the feature space among unlabeled data , its strong augmentation and other negative samples from either extremely large current batch or momentum updated memory banks . In comparison to those un/self-supervised methods , our method exploreS neighbor samples for consistency regularization . In cross-domain person re-identification , Zhong et al . ( 2019 ) also utilize the neighbor information on target data . To emphasize the difference , our method focuses on regularizing the classifier to be less biased toward source domain by applying target neighbor class consistency while they focus on the feature representation learning by enforcing neighbor feature invariance . 3 METHOD . 3.1 PROBLEM DEFINITION . In unsupervised domain adaptation ( UDA ) , source domain data is denoted as Ds = { ( xsi , ysi ) | Ns i=1 } where xsi and y s i denote the i-th training sample and its label , Ns is the number of source images . Target domain data is denoted as Dt = { xti| Nt i=1 } where Nt is the number of target images . The objective of UDA is to train a deep neural network G ( ·|θ ) which has access to the source data ( xsi , y s i ) drawn from Ds and target data xti drawn from Dt such that the modelG ( ·|θ ) can generalize on target domain . Network G ( ·|θ ) = C ◦ F ( ·|θ ) is comprised of a feature extractor F ( ·|θ ) and a classifier C ( ·|θ ) where θ denotes network parameters . 3.2 REVISIT SUPERVISED PRE-TRAINING FOR SOURCE DOMAIN . In general , UDA pre-trains a network G ( ·|θ ) on source domain by standard cross entropy loss and then the network is transferred to inference the target data . The source supervised objective function is in the form of , Lssrc ( θ ) = 1 Ns Ns∑ i=1 Lce ( C ( F ( xsi |θ ) ) , ysi ) . ( 1 ) However , the model trained on source data usually generalizes poorly on target data due to the domain shift between the joint distribution of two domains . Self-Training ( ST ) and Entropy Minimization ( Ent ) methods are proposed to make the network be confident on its target predictions following the cluster assumption and thus improve the discrim- inativeness of network . Their objective functions are calculated as LtST ( θ ) = 1 Nt Nt∑ i=1 Lce ( C ( F ( xti|θ ) ) , ỹti ) , ( 2 ) LtEnt ( θ ) = 1 Nt Nt∑ i=1 H ( C ( F ( xti|θ ) ) ) , ( 3 ) where ỹti is the pseudo label for the i target sample andH is entropy function . Nonetheless , the pseudo labels of target samples are noisy as the network is biased towards source data . Trusting noisy label or prediction has high risk of misleading the training and propagate errors . Inspired by agglomerative clustering methods which claim that features should be clustered with their near neighborhood , we hypothesize that source domain pre-training can provide a feature space where target features are intrinsically discriminative and have high probability of sharing the same labels with their neighbors . To verify this , we apply k-Nearest Neighbor ( kNN ) search on target features extracted from source model on Offce-31 A→W . We evaluate the pairwise label consistent accuracy between target features and their k-th neighbors . Table 1 shows that target features from source model have very high accuracy of sharing the same label with their K-th neighbors . It demonstrates our hypothesis that target features from source model are locally discriminative . This observation motivates us to leverage this relative ” clean ” pairwise pseudo supervision to help the network generalization on target domain over the noisy class-wise pseudo supervision . 3.3 NEIGHBORHOOD CLASS CONSISTENCY . 1 ) Neighborhood Discovery . First , we extract target features zt = F ( xt|θ ) from source pre-train model and save them into a target feature memory bank Vt = { zti | Nt i=1 } . Then we apply kNN on target features Vt to explore the neighborhood Nk ( zt ) which is defined as follows : Nk ( ztj ) = { zti |s ( zti , ztj ) is top-k in Vt } , ( 4 ) where s is a similarity metric and k is the number of neighbors . Note that we update the memory bank Vt with the newest features in training and conduct kNN on Vt at every epoch . 2 ) Vanilla Neighborhood Class Consistency ( VNC ) . Based on our motivation that target samples should share the same class label with their neighbors , we propose VNC to enforce the class assignment consistency between pairwise neighbors by mutual information ( MI ) maximization between their network predictions . Formally , we formulate the objective function of VNC in the form of : LtV NC ( θ ) = − 1 Nt Nt∑ i=1 1 k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) . ( 5 ) It is also worth noting that the memory bank serves as a look-up table to retrieve the target features and feed them into the classifier C for computing the Neighborhood Class Consistency loss . As the size of k can be potentially large , using memory bank can implicitly enlarge the batch size by k times without introducing extra computational cost and time . 3 ) Entropy-weighted Neighborhood Class Consistency ( ENC ) . Table 1 shows that the reliability of pairwise neighborhood supervision is decreased with the rise of neighborhood size k. In other words , there is a trade-off between large neighborhood diversity and reliability of neighbor supervision . A straightforward idea is to treat each neighbor pairs differently in terms of loss weight such that hopefully positive neighbor pairs ( Correct ) will have higher loss weight than negative neighbor pairs ( False ) . To achieve this , we propose a entropy-based weighting scheme ( EW ) to assign different loss weight on different neighbor pairs given an anchor . As the entropy is a measurement of sample prediction certainty , the less entropy is , more confident the prediction is and thus more weight we will assign on . Formally , we define the loss weight and objective of ENC as follows : w ( zt ) = 1− H ( C ( z t|θ ) ) logM , ( 6 ) LtENC ( θ ) = − 1 Nt Nt∑ i=1 w ( ztj ) k ∑ j∈Nk ( zti ) MI ( C ( zti |θ ) , C ( ztj |θ ) ) , ( 7 ) where M is the number of class . We claim that entropy-based weighting helps mitigate the problem of noisy pairwise supervision and it is more robust to the neighborhood size k as it will down-weight the neighbor pairs if the selected neighbor samples have high entropy value .
This paper addresses the unsupervised domain adaption (UDA) problem. Particularly, the paper proposes to impose neighbor class consistency on target features to preserve intrinsic discriminative nature of target data and presents an entropy-based weighting scheme to improve robustness against the potential noisy neighbor supervision. The motivation of the paper is clear and the method is well presented. Extensive experiments show the effectiveness of the proposed method. However, the paper suffers some problems, such as
SP:0da26728efc61af9be3b15caa90317fd587c5e21
CROSS-SUPERVISED OBJECT DETECTION
1 INTRODUCTION . Deep architectures have achieved great success in many computer vision tasks including object recognition and the closely related problem of object detection . Modern detectors , such as the Faster RCNN ( Ren et al. , 2015 ) , YOLO ( Redmon et al. , 2016 ) , and RetinaNet ( Lin et al. , 2017 ) , use the same network backbone as popular recognition models . However , even with the same backbone architectures , detection and recognition models require different types of supervision . A good detector relies heavily on precise bounding boxes and labels for each instance ( we shall refer to these as instance-level annotations ) , whereas a recognition model needs only image-level labels . Needless to say , it is more time consuming and expensive to obtain high quality bounding box annotations than class labels . As a result , current detectors are limited to a small set of categories relative to their object recognition counterparts . To address this limitation , it is natural to ask , “ Is it possible to learn detectors with only class labels ? ” This problem is commonly referred to as weakly supervised object detection ( WSOD ) . Early WSOD work ( Hoffman et al. , 2014 ) showed fair performance by directly applying recognition networks to object detection . More recently , researchers have used multiple instance learning methods ( Dietterich et al. , 1997 ) to recast WSOD as a multi-label classification problem ( Bilen & Vedaldi , 2016 ) . However , these weakly supervised detectors perform poorly at localization . Most WSOD experiments have been conducted on the ILSVRC ( Russakovsky et al. , 2015 ) data set , in which images have only a single object , or on the PASCAL VOC ( Everingham et al. , 2010 ) data set , which has only 20 categories . The simplicity of these data sets limits the number and types of distractors in an image , making localization substantially easier . Learning from only class labels , it is challenging to detect objects at different scales in an image that contains many distractors . In particular , as shown in our experiments , weakly supervised object detectors do not work well in complex multi-object scenes , such as the COCO dataset ( Lin et al. , 2014 ) . To address this challenge , we focus on a form of learning in which the localization of classes with only object labels ( weakly labeled classes ) can benefit from other classes that have ground truth bounding boxes ( fully labeled classes ) . We refer to this interesting learning paradigm as crosssupervised object detection ( CSOD ) . While several works ( Hoffman et al. , 2014 ; Tang et al. , 2016 ; Yang et al. , 2019a ; Redmon & Farhadi , 2017 ) have explored this problem before , they still have the same limitation as the WSOD work we mentioned above . Those cross-supervised object detectors work under simplified scenarios ( e.g. , ILSVRC data set ) where images contain single objects and are object-centered . They struggle to learn under more complex and realistic scenarios , where there are multiple objects from potentially very different classes , and objects could be small and appear anywhere in the images . In this work , we show that by doing multi-task learning on both weaklysupervised base classes and fully-supervised novel classes , our model is able to learn a good detector under the CSOD setting . More formally , we define CSOD as follows . At training time , we are given 1 ) images contain objects from both base and novel classes , 2 ) both class labels and ground truth bounding boxes for base objects , and 3 ) only class labels for novel objects . Our goal is to detect novel objects . In CSOD , base classes and novel classes are disjoint . Thus , it can be seen as performing fullysupervised detection on the base classes and weakly supervised detection on the novel classes . It has similarities to both transfer learning and semi-supervised learning , since it transfer knowledge from base class to novel class and have more information about some instances than other instances . However , CSOD represents a distinct and novel paradigm for learning . The current weakly-supervised method has several drawbacks to learn from a multi objects image . As shown in Fig . 1 , a weakly supervised object detector tends to detect only the most discriminating part of novel objects instead of the whole object . Notice how only the head of the person , and not the whole body , is detected . Another issue is that the localizer for one object ( e.g. , the horse ) may be confused by the occurrence of another object , such as the person on the horse . This example illustrates the gap between detection and recognition : without ground truth bounding boxes , the detector acts like a standard recognition model – focusing on discriminating rather than detecting . In this paper , we explore two major mechanisms for improving on this . Our first mechanism is unifying detection and recognition . Using the same network backbone architecture , recognition and detection can be seen as image-level classification and region-level classification respectively , suggesting a strong relation between them . In particular , it suggests a shared training framework in which the same backbone is used with different heads for detection and recognition . Thus , we combine a detection head learned from ground truth bounding boxes , and a recognition head learned in a weakly supervised fashion from class labels . Unlike a traditional recognition head , our recognition head produces a class score for multiple proposals and is capable of detecting objects . The second mechanism is learning a spatial correlation module to reduce the gap between detection and recognition . It takes several high-confidence bounding boxes produced by the recognition head as input , and learns to regress ground truth bounding boxes . By combining these mechanisms together , our model outperforms all previous models when all novel objects are weakly labeled . In summary , our contributions are three-fold . First , we define a new task—cross-supervised object detection , which enables us to leverage knowledge from fully labeled base categories to help learn a robust detector from novel object class labels only . Second , we propose a unified framework in which two heads are learned from class labels and detection labels respectively , along with a spatial correlation module bridging the gap between recognition and detection . Third , we significantly outperform existing methods ( Zhang et al . ( 2018a ) ; Tang et al . ( 2017 ; 2018 ) ) on PASCAL VOC and COCO , suggesting that CSOD could be a promising approach for expanding object detection to a much larger number of categories . 2 RELATED WORK . Weakly supervised object detection . WSOD ( Kosugi et al . ( 2019 ) ; Zeng et al . ( 2019 ) ; Yang et al . ( 2019b ) ; Wan et al . ( 2019 ) ; Arun et al . ( 2019 ) ; Wan et al . ( 2018 ) ; Zhang et al . ( 2018b ) ; Ren et al . ( 2020 ) ; Zhang et al . ( 2018c ) ; Li et al . ( 2019 ) ; Gao et al . ( 2019b ) ; Kosugi et al . ( 2019 ) ) attempts to learn a detector with only image category labels . Most of these methods adopt the idea of Multiple Instance Learning ( Dietterich et al . ( 1997 ) ) to recast WSOD as a multi-label classification task . Bilen & Vedaldi ( 2016 ) propose an end-to-end network by modifying a classifier to operate at the level of image regions , serving as a region selector and a classifier simultaneously . Tang et al . ( 2017 ) and Tang et al . ( 2018 ) find that several iterations of online refinement based on the outputs of previous iterations boosts performance . Wei et al . ( 2018 ) and Diba et al . ( 2017 ) use semantic segmentation based on class activation maps ( Zhou et al . ( 2016 ) ) to help generate tight bounding boxes . However , WSOD methods tend to focus on the most discriminating part of an object and are prone to distractions from co-occurring objects . Detecting a part of the object or distractors represents convergence to a local optimum . Thus , their performance depends heavily on initialization . In comparison , our proposed cross-supervised object detector alleviates the issue of getting trapped in a local optimum by leveraging knowledge learned from fully labeled base categories . Cross-supervised object detection . There are several previous works using both image-level and instance-level annotations . Kuen et al . ( 2019 ) learned a parameter transferring function between a classifier and a detector , enabling an image-based classification network to be adapted to a regionbased classification network . Hoffman et al . ( 2014 ) and Tang et al . ( 2016 ) propose methods of adaptation for knowledge transfer from classification features to detection features . Uijlings et al . ( 2018 ) use a proposal generator trained on base classes to transfer knowledge by leveraging a MIL framework , organized in a semantic hierarchy . Hoffman et al . ( 2015 ) design a three-step framework to learn a feature representation from weakly supervised classes and strongly supervised classes jointly . However , these methods can only perform object localization in single object scenes such as ILSVRC , whereas our method can perform object detection in complex multi-object scenes as well , e.g . COCO . Also , it is worth noting that we are doing multi-task learning , which means that we jointly learn from base and novel classes . In comparison , some works ( Uijlings et al. , 2018 ) are doing transfer learning . They first learn a model on base classes and then transfer and fine-tune the model on novel classes . Gao et al . ( 2019a ) use a few instance-level labels and a large scale of image-level labels for each category in a training-mining framework , which is referred to as semisupervised detection . Zhang et al . ( 2018a ) propose a framework named MSD that learn objectness on base categories and use it to reject distractors when learning novel objects . In comparison , our spatial correlation module not only learns objectness , but also refines coarse bounding boxes . Further , our model learns from both base and novel classes instead of only novel classes . 3 CROSS-SUPERVISED OBJECT DETECTION . CSOD requires us to learn from instance-level annotations ( detection labels ) and image-level annotations ( recognition labels ) . In this section , we explain the unification of detection and recognition and introduce our framework . In the next section , we describe our novel spatial correlation module . 3.1 UNIFYING DETECTION AND RECOGNITION . How to learn a detector from both instance-level and image-level annotations ? Since detection and recognition can be seen as region-level and image-level classification respectively , a natural choice is to design a unified framework that combines a detection head and a recognition head that can learn from image-level and instance-level annotations respectively . Here we exploit several baselines to unify the detection and recognition head . ( 1 ) Finetune . We first learn through the detection head on base classes with fully labeled samples . Then , we finetune our model using the recognition head on novel classes with only class labels . ( 2 ) Two Head . We simultaneously learn the detection and recognition head on base and novel classes , respectively . The weights of the backbones are updated using the loss backpropagated from both heads jointly . ( 3 ) Two head + . Instead of learning only on novel classes , we learn the recognition head from class labels of both base and novel classes whereas the recognition head remain the same . ( 4 ) Two Branch . Instead of having two shared fully-connected layers after RoI pooling layer ( see Fig . 2 ) , we make these two fully-connected layers seperated , allowing the detection and recognition head to have separate unshared pair of fully-connected layers each . Everything else is the same as the Two Head baseline . Experiments are conducted to compare these baselines in § 5.1 and § 5.2 . Our proposed model is based on Two Head . We will discuss the details in § 3.2 . The connection between the recognition and detection head . The baselines mentioned above only use the recognition head to detect novel objects , ignoring the fact that a detection head can play the same role even better . A majority of WSOD methods ( Tang et al . ( 2017 ) ; Wan et al . ( 2019 ) ; Wei et al . ( 2018 ) ) find that re-train a new detector taking the top-scoring bounding boxes from a weakly supervised object detector as ground truth marginally improve the performance . Even with coarse and noisy pseudo bounding boxes , a standard object detector produces better detection results than a weakly supervised object detector . Keeping this hypothesis in mind , we introduce a guidance from the recognition head to the detection head . For each of the novel categories existing in a training sample , the recognition head outputs the top-scoring bounding box , which are then used by the detection head as supervision in that sample .
The paper proposes a new task cross-supervised object detection, which trains object detectors on the combination of base class images with instance-level annotations and novel class image with only image-level annotations. A network with a recognition head which is trained by image-level annotations and a detection head which is trained by instance-level annotations is proposed for the task. To generate instance-level annotations for novel class images with only image-level annotations, the paper proposes a spatial correlation module to generate pseudo gt boxes from high-confidence boxes. Results on PASCAL VOC and COCO show that the proposed method obtains very promising object detection results for novel classes.
SP:c394e67f3796de6bb8a6bddc2681dfa574a1ec51
CROSS-SUPERVISED OBJECT DETECTION
1 INTRODUCTION . Deep architectures have achieved great success in many computer vision tasks including object recognition and the closely related problem of object detection . Modern detectors , such as the Faster RCNN ( Ren et al. , 2015 ) , YOLO ( Redmon et al. , 2016 ) , and RetinaNet ( Lin et al. , 2017 ) , use the same network backbone as popular recognition models . However , even with the same backbone architectures , detection and recognition models require different types of supervision . A good detector relies heavily on precise bounding boxes and labels for each instance ( we shall refer to these as instance-level annotations ) , whereas a recognition model needs only image-level labels . Needless to say , it is more time consuming and expensive to obtain high quality bounding box annotations than class labels . As a result , current detectors are limited to a small set of categories relative to their object recognition counterparts . To address this limitation , it is natural to ask , “ Is it possible to learn detectors with only class labels ? ” This problem is commonly referred to as weakly supervised object detection ( WSOD ) . Early WSOD work ( Hoffman et al. , 2014 ) showed fair performance by directly applying recognition networks to object detection . More recently , researchers have used multiple instance learning methods ( Dietterich et al. , 1997 ) to recast WSOD as a multi-label classification problem ( Bilen & Vedaldi , 2016 ) . However , these weakly supervised detectors perform poorly at localization . Most WSOD experiments have been conducted on the ILSVRC ( Russakovsky et al. , 2015 ) data set , in which images have only a single object , or on the PASCAL VOC ( Everingham et al. , 2010 ) data set , which has only 20 categories . The simplicity of these data sets limits the number and types of distractors in an image , making localization substantially easier . Learning from only class labels , it is challenging to detect objects at different scales in an image that contains many distractors . In particular , as shown in our experiments , weakly supervised object detectors do not work well in complex multi-object scenes , such as the COCO dataset ( Lin et al. , 2014 ) . To address this challenge , we focus on a form of learning in which the localization of classes with only object labels ( weakly labeled classes ) can benefit from other classes that have ground truth bounding boxes ( fully labeled classes ) . We refer to this interesting learning paradigm as crosssupervised object detection ( CSOD ) . While several works ( Hoffman et al. , 2014 ; Tang et al. , 2016 ; Yang et al. , 2019a ; Redmon & Farhadi , 2017 ) have explored this problem before , they still have the same limitation as the WSOD work we mentioned above . Those cross-supervised object detectors work under simplified scenarios ( e.g. , ILSVRC data set ) where images contain single objects and are object-centered . They struggle to learn under more complex and realistic scenarios , where there are multiple objects from potentially very different classes , and objects could be small and appear anywhere in the images . In this work , we show that by doing multi-task learning on both weaklysupervised base classes and fully-supervised novel classes , our model is able to learn a good detector under the CSOD setting . More formally , we define CSOD as follows . At training time , we are given 1 ) images contain objects from both base and novel classes , 2 ) both class labels and ground truth bounding boxes for base objects , and 3 ) only class labels for novel objects . Our goal is to detect novel objects . In CSOD , base classes and novel classes are disjoint . Thus , it can be seen as performing fullysupervised detection on the base classes and weakly supervised detection on the novel classes . It has similarities to both transfer learning and semi-supervised learning , since it transfer knowledge from base class to novel class and have more information about some instances than other instances . However , CSOD represents a distinct and novel paradigm for learning . The current weakly-supervised method has several drawbacks to learn from a multi objects image . As shown in Fig . 1 , a weakly supervised object detector tends to detect only the most discriminating part of novel objects instead of the whole object . Notice how only the head of the person , and not the whole body , is detected . Another issue is that the localizer for one object ( e.g. , the horse ) may be confused by the occurrence of another object , such as the person on the horse . This example illustrates the gap between detection and recognition : without ground truth bounding boxes , the detector acts like a standard recognition model – focusing on discriminating rather than detecting . In this paper , we explore two major mechanisms for improving on this . Our first mechanism is unifying detection and recognition . Using the same network backbone architecture , recognition and detection can be seen as image-level classification and region-level classification respectively , suggesting a strong relation between them . In particular , it suggests a shared training framework in which the same backbone is used with different heads for detection and recognition . Thus , we combine a detection head learned from ground truth bounding boxes , and a recognition head learned in a weakly supervised fashion from class labels . Unlike a traditional recognition head , our recognition head produces a class score for multiple proposals and is capable of detecting objects . The second mechanism is learning a spatial correlation module to reduce the gap between detection and recognition . It takes several high-confidence bounding boxes produced by the recognition head as input , and learns to regress ground truth bounding boxes . By combining these mechanisms together , our model outperforms all previous models when all novel objects are weakly labeled . In summary , our contributions are three-fold . First , we define a new task—cross-supervised object detection , which enables us to leverage knowledge from fully labeled base categories to help learn a robust detector from novel object class labels only . Second , we propose a unified framework in which two heads are learned from class labels and detection labels respectively , along with a spatial correlation module bridging the gap between recognition and detection . Third , we significantly outperform existing methods ( Zhang et al . ( 2018a ) ; Tang et al . ( 2017 ; 2018 ) ) on PASCAL VOC and COCO , suggesting that CSOD could be a promising approach for expanding object detection to a much larger number of categories . 2 RELATED WORK . Weakly supervised object detection . WSOD ( Kosugi et al . ( 2019 ) ; Zeng et al . ( 2019 ) ; Yang et al . ( 2019b ) ; Wan et al . ( 2019 ) ; Arun et al . ( 2019 ) ; Wan et al . ( 2018 ) ; Zhang et al . ( 2018b ) ; Ren et al . ( 2020 ) ; Zhang et al . ( 2018c ) ; Li et al . ( 2019 ) ; Gao et al . ( 2019b ) ; Kosugi et al . ( 2019 ) ) attempts to learn a detector with only image category labels . Most of these methods adopt the idea of Multiple Instance Learning ( Dietterich et al . ( 1997 ) ) to recast WSOD as a multi-label classification task . Bilen & Vedaldi ( 2016 ) propose an end-to-end network by modifying a classifier to operate at the level of image regions , serving as a region selector and a classifier simultaneously . Tang et al . ( 2017 ) and Tang et al . ( 2018 ) find that several iterations of online refinement based on the outputs of previous iterations boosts performance . Wei et al . ( 2018 ) and Diba et al . ( 2017 ) use semantic segmentation based on class activation maps ( Zhou et al . ( 2016 ) ) to help generate tight bounding boxes . However , WSOD methods tend to focus on the most discriminating part of an object and are prone to distractions from co-occurring objects . Detecting a part of the object or distractors represents convergence to a local optimum . Thus , their performance depends heavily on initialization . In comparison , our proposed cross-supervised object detector alleviates the issue of getting trapped in a local optimum by leveraging knowledge learned from fully labeled base categories . Cross-supervised object detection . There are several previous works using both image-level and instance-level annotations . Kuen et al . ( 2019 ) learned a parameter transferring function between a classifier and a detector , enabling an image-based classification network to be adapted to a regionbased classification network . Hoffman et al . ( 2014 ) and Tang et al . ( 2016 ) propose methods of adaptation for knowledge transfer from classification features to detection features . Uijlings et al . ( 2018 ) use a proposal generator trained on base classes to transfer knowledge by leveraging a MIL framework , organized in a semantic hierarchy . Hoffman et al . ( 2015 ) design a three-step framework to learn a feature representation from weakly supervised classes and strongly supervised classes jointly . However , these methods can only perform object localization in single object scenes such as ILSVRC , whereas our method can perform object detection in complex multi-object scenes as well , e.g . COCO . Also , it is worth noting that we are doing multi-task learning , which means that we jointly learn from base and novel classes . In comparison , some works ( Uijlings et al. , 2018 ) are doing transfer learning . They first learn a model on base classes and then transfer and fine-tune the model on novel classes . Gao et al . ( 2019a ) use a few instance-level labels and a large scale of image-level labels for each category in a training-mining framework , which is referred to as semisupervised detection . Zhang et al . ( 2018a ) propose a framework named MSD that learn objectness on base categories and use it to reject distractors when learning novel objects . In comparison , our spatial correlation module not only learns objectness , but also refines coarse bounding boxes . Further , our model learns from both base and novel classes instead of only novel classes . 3 CROSS-SUPERVISED OBJECT DETECTION . CSOD requires us to learn from instance-level annotations ( detection labels ) and image-level annotations ( recognition labels ) . In this section , we explain the unification of detection and recognition and introduce our framework . In the next section , we describe our novel spatial correlation module . 3.1 UNIFYING DETECTION AND RECOGNITION . How to learn a detector from both instance-level and image-level annotations ? Since detection and recognition can be seen as region-level and image-level classification respectively , a natural choice is to design a unified framework that combines a detection head and a recognition head that can learn from image-level and instance-level annotations respectively . Here we exploit several baselines to unify the detection and recognition head . ( 1 ) Finetune . We first learn through the detection head on base classes with fully labeled samples . Then , we finetune our model using the recognition head on novel classes with only class labels . ( 2 ) Two Head . We simultaneously learn the detection and recognition head on base and novel classes , respectively . The weights of the backbones are updated using the loss backpropagated from both heads jointly . ( 3 ) Two head + . Instead of learning only on novel classes , we learn the recognition head from class labels of both base and novel classes whereas the recognition head remain the same . ( 4 ) Two Branch . Instead of having two shared fully-connected layers after RoI pooling layer ( see Fig . 2 ) , we make these two fully-connected layers seperated , allowing the detection and recognition head to have separate unshared pair of fully-connected layers each . Everything else is the same as the Two Head baseline . Experiments are conducted to compare these baselines in § 5.1 and § 5.2 . Our proposed model is based on Two Head . We will discuss the details in § 3.2 . The connection between the recognition and detection head . The baselines mentioned above only use the recognition head to detect novel objects , ignoring the fact that a detection head can play the same role even better . A majority of WSOD methods ( Tang et al . ( 2017 ) ; Wan et al . ( 2019 ) ; Wei et al . ( 2018 ) ) find that re-train a new detector taking the top-scoring bounding boxes from a weakly supervised object detector as ground truth marginally improve the performance . Even with coarse and noisy pseudo bounding boxes , a standard object detector produces better detection results than a weakly supervised object detector . Keeping this hypothesis in mind , we introduce a guidance from the recognition head to the detection head . For each of the novel categories existing in a training sample , the recognition head outputs the top-scoring bounding box , which are then used by the detection head as supervision in that sample .
This paper introduces a new method for training an object detector on a dataset that consists of some object categories with instance-level bounding box annotations, as well as some other object categories with only image-level labels. The topic is interesting, important, and potentially very useful for real applications. The authors propose an idea to transfer knowledge from a weakly supervised (WS) detection head into a fully supervised (FS) detection head, by producing pseudo-ground-truth bounding boxes for classes with image-level labels. The idea is straightforward and interesting. Experiments show significant and consistent gains in various scenarios. The paper is well-written.
SP:c394e67f3796de6bb8a6bddc2681dfa574a1ec51
CROSS-SUPERVISED OBJECT DETECTION
1 INTRODUCTION . Deep architectures have achieved great success in many computer vision tasks including object recognition and the closely related problem of object detection . Modern detectors , such as the Faster RCNN ( Ren et al. , 2015 ) , YOLO ( Redmon et al. , 2016 ) , and RetinaNet ( Lin et al. , 2017 ) , use the same network backbone as popular recognition models . However , even with the same backbone architectures , detection and recognition models require different types of supervision . A good detector relies heavily on precise bounding boxes and labels for each instance ( we shall refer to these as instance-level annotations ) , whereas a recognition model needs only image-level labels . Needless to say , it is more time consuming and expensive to obtain high quality bounding box annotations than class labels . As a result , current detectors are limited to a small set of categories relative to their object recognition counterparts . To address this limitation , it is natural to ask , “ Is it possible to learn detectors with only class labels ? ” This problem is commonly referred to as weakly supervised object detection ( WSOD ) . Early WSOD work ( Hoffman et al. , 2014 ) showed fair performance by directly applying recognition networks to object detection . More recently , researchers have used multiple instance learning methods ( Dietterich et al. , 1997 ) to recast WSOD as a multi-label classification problem ( Bilen & Vedaldi , 2016 ) . However , these weakly supervised detectors perform poorly at localization . Most WSOD experiments have been conducted on the ILSVRC ( Russakovsky et al. , 2015 ) data set , in which images have only a single object , or on the PASCAL VOC ( Everingham et al. , 2010 ) data set , which has only 20 categories . The simplicity of these data sets limits the number and types of distractors in an image , making localization substantially easier . Learning from only class labels , it is challenging to detect objects at different scales in an image that contains many distractors . In particular , as shown in our experiments , weakly supervised object detectors do not work well in complex multi-object scenes , such as the COCO dataset ( Lin et al. , 2014 ) . To address this challenge , we focus on a form of learning in which the localization of classes with only object labels ( weakly labeled classes ) can benefit from other classes that have ground truth bounding boxes ( fully labeled classes ) . We refer to this interesting learning paradigm as crosssupervised object detection ( CSOD ) . While several works ( Hoffman et al. , 2014 ; Tang et al. , 2016 ; Yang et al. , 2019a ; Redmon & Farhadi , 2017 ) have explored this problem before , they still have the same limitation as the WSOD work we mentioned above . Those cross-supervised object detectors work under simplified scenarios ( e.g. , ILSVRC data set ) where images contain single objects and are object-centered . They struggle to learn under more complex and realistic scenarios , where there are multiple objects from potentially very different classes , and objects could be small and appear anywhere in the images . In this work , we show that by doing multi-task learning on both weaklysupervised base classes and fully-supervised novel classes , our model is able to learn a good detector under the CSOD setting . More formally , we define CSOD as follows . At training time , we are given 1 ) images contain objects from both base and novel classes , 2 ) both class labels and ground truth bounding boxes for base objects , and 3 ) only class labels for novel objects . Our goal is to detect novel objects . In CSOD , base classes and novel classes are disjoint . Thus , it can be seen as performing fullysupervised detection on the base classes and weakly supervised detection on the novel classes . It has similarities to both transfer learning and semi-supervised learning , since it transfer knowledge from base class to novel class and have more information about some instances than other instances . However , CSOD represents a distinct and novel paradigm for learning . The current weakly-supervised method has several drawbacks to learn from a multi objects image . As shown in Fig . 1 , a weakly supervised object detector tends to detect only the most discriminating part of novel objects instead of the whole object . Notice how only the head of the person , and not the whole body , is detected . Another issue is that the localizer for one object ( e.g. , the horse ) may be confused by the occurrence of another object , such as the person on the horse . This example illustrates the gap between detection and recognition : without ground truth bounding boxes , the detector acts like a standard recognition model – focusing on discriminating rather than detecting . In this paper , we explore two major mechanisms for improving on this . Our first mechanism is unifying detection and recognition . Using the same network backbone architecture , recognition and detection can be seen as image-level classification and region-level classification respectively , suggesting a strong relation between them . In particular , it suggests a shared training framework in which the same backbone is used with different heads for detection and recognition . Thus , we combine a detection head learned from ground truth bounding boxes , and a recognition head learned in a weakly supervised fashion from class labels . Unlike a traditional recognition head , our recognition head produces a class score for multiple proposals and is capable of detecting objects . The second mechanism is learning a spatial correlation module to reduce the gap between detection and recognition . It takes several high-confidence bounding boxes produced by the recognition head as input , and learns to regress ground truth bounding boxes . By combining these mechanisms together , our model outperforms all previous models when all novel objects are weakly labeled . In summary , our contributions are three-fold . First , we define a new task—cross-supervised object detection , which enables us to leverage knowledge from fully labeled base categories to help learn a robust detector from novel object class labels only . Second , we propose a unified framework in which two heads are learned from class labels and detection labels respectively , along with a spatial correlation module bridging the gap between recognition and detection . Third , we significantly outperform existing methods ( Zhang et al . ( 2018a ) ; Tang et al . ( 2017 ; 2018 ) ) on PASCAL VOC and COCO , suggesting that CSOD could be a promising approach for expanding object detection to a much larger number of categories . 2 RELATED WORK . Weakly supervised object detection . WSOD ( Kosugi et al . ( 2019 ) ; Zeng et al . ( 2019 ) ; Yang et al . ( 2019b ) ; Wan et al . ( 2019 ) ; Arun et al . ( 2019 ) ; Wan et al . ( 2018 ) ; Zhang et al . ( 2018b ) ; Ren et al . ( 2020 ) ; Zhang et al . ( 2018c ) ; Li et al . ( 2019 ) ; Gao et al . ( 2019b ) ; Kosugi et al . ( 2019 ) ) attempts to learn a detector with only image category labels . Most of these methods adopt the idea of Multiple Instance Learning ( Dietterich et al . ( 1997 ) ) to recast WSOD as a multi-label classification task . Bilen & Vedaldi ( 2016 ) propose an end-to-end network by modifying a classifier to operate at the level of image regions , serving as a region selector and a classifier simultaneously . Tang et al . ( 2017 ) and Tang et al . ( 2018 ) find that several iterations of online refinement based on the outputs of previous iterations boosts performance . Wei et al . ( 2018 ) and Diba et al . ( 2017 ) use semantic segmentation based on class activation maps ( Zhou et al . ( 2016 ) ) to help generate tight bounding boxes . However , WSOD methods tend to focus on the most discriminating part of an object and are prone to distractions from co-occurring objects . Detecting a part of the object or distractors represents convergence to a local optimum . Thus , their performance depends heavily on initialization . In comparison , our proposed cross-supervised object detector alleviates the issue of getting trapped in a local optimum by leveraging knowledge learned from fully labeled base categories . Cross-supervised object detection . There are several previous works using both image-level and instance-level annotations . Kuen et al . ( 2019 ) learned a parameter transferring function between a classifier and a detector , enabling an image-based classification network to be adapted to a regionbased classification network . Hoffman et al . ( 2014 ) and Tang et al . ( 2016 ) propose methods of adaptation for knowledge transfer from classification features to detection features . Uijlings et al . ( 2018 ) use a proposal generator trained on base classes to transfer knowledge by leveraging a MIL framework , organized in a semantic hierarchy . Hoffman et al . ( 2015 ) design a three-step framework to learn a feature representation from weakly supervised classes and strongly supervised classes jointly . However , these methods can only perform object localization in single object scenes such as ILSVRC , whereas our method can perform object detection in complex multi-object scenes as well , e.g . COCO . Also , it is worth noting that we are doing multi-task learning , which means that we jointly learn from base and novel classes . In comparison , some works ( Uijlings et al. , 2018 ) are doing transfer learning . They first learn a model on base classes and then transfer and fine-tune the model on novel classes . Gao et al . ( 2019a ) use a few instance-level labels and a large scale of image-level labels for each category in a training-mining framework , which is referred to as semisupervised detection . Zhang et al . ( 2018a ) propose a framework named MSD that learn objectness on base categories and use it to reject distractors when learning novel objects . In comparison , our spatial correlation module not only learns objectness , but also refines coarse bounding boxes . Further , our model learns from both base and novel classes instead of only novel classes . 3 CROSS-SUPERVISED OBJECT DETECTION . CSOD requires us to learn from instance-level annotations ( detection labels ) and image-level annotations ( recognition labels ) . In this section , we explain the unification of detection and recognition and introduce our framework . In the next section , we describe our novel spatial correlation module . 3.1 UNIFYING DETECTION AND RECOGNITION . How to learn a detector from both instance-level and image-level annotations ? Since detection and recognition can be seen as region-level and image-level classification respectively , a natural choice is to design a unified framework that combines a detection head and a recognition head that can learn from image-level and instance-level annotations respectively . Here we exploit several baselines to unify the detection and recognition head . ( 1 ) Finetune . We first learn through the detection head on base classes with fully labeled samples . Then , we finetune our model using the recognition head on novel classes with only class labels . ( 2 ) Two Head . We simultaneously learn the detection and recognition head on base and novel classes , respectively . The weights of the backbones are updated using the loss backpropagated from both heads jointly . ( 3 ) Two head + . Instead of learning only on novel classes , we learn the recognition head from class labels of both base and novel classes whereas the recognition head remain the same . ( 4 ) Two Branch . Instead of having two shared fully-connected layers after RoI pooling layer ( see Fig . 2 ) , we make these two fully-connected layers seperated , allowing the detection and recognition head to have separate unshared pair of fully-connected layers each . Everything else is the same as the Two Head baseline . Experiments are conducted to compare these baselines in § 5.1 and § 5.2 . Our proposed model is based on Two Head . We will discuss the details in § 3.2 . The connection between the recognition and detection head . The baselines mentioned above only use the recognition head to detect novel objects , ignoring the fact that a detection head can play the same role even better . A majority of WSOD methods ( Tang et al . ( 2017 ) ; Wan et al . ( 2019 ) ; Wei et al . ( 2018 ) ) find that re-train a new detector taking the top-scoring bounding boxes from a weakly supervised object detector as ground truth marginally improve the performance . Even with coarse and noisy pseudo bounding boxes , a standard object detector produces better detection results than a weakly supervised object detector . Keeping this hypothesis in mind , we introduce a guidance from the recognition head to the detection head . For each of the novel categories existing in a training sample , the recognition head outputs the top-scoring bounding box , which are then used by the detection head as supervision in that sample .
This paper defines cross-supervised object detection which learns a detector from both image-level and instance-level annotations. It proposes a unified framework along with a spatial correlation module for the task. The spatial correlation module is used for transfer mapping information from base categories to novel categories. It conducts experiments on the PASCAL VOC dataset and COCO dataset, demonstrating the effectiveness.
SP:c394e67f3796de6bb8a6bddc2681dfa574a1ec51
SEQUENCE-LEVEL FEATURES: HOW GRU AND LSTM CELLS CAPTURE N-GRAMS
1 INTRODUCTION . Long Short-term Memory ( LSTM ) ( Hochreiter & Schmidhuber , 1997 ) and Gated Recurrent Unit ( GRU ) ( Chung et al. , 2014 ) are widely used and investigated for tasks that involve sequential data . They are generally believed to be capable of capturing long-range dependencies while being able to alleviate gradient vanishing or explosion issues ( Hochreiter & Schmidhuber , 1997 ; Karpathy et al. , 2015 ; Sutskever et al. , 2014 ) . While such models were empirically shown to be successful across a range of tasks , certain fundamental questions such as “ what essential features are GRU or LSTM cells able to capture ? ” have not yet been fully addressed . Lacking answers to them may limit our ability in designing better architectures . One obstacle can be attributed to the non-linear activations used in the cells that prevent us from obtaining explicit closed-form expressions for hidden states . A possible solution is to expand the non-linear functions using the Taylor series ( Arfken & Mullin , 1985 ) and represent hidden states with explicit input terms . Literally , each hidden state can be viewed as the combination of constituent terms capturing features of different levels of complexity . However , there is a prohibitively large number of polynomial terms involved and they can be difficult to manage . But it is possible that certain terms are more significant than others . Through a series of mathematical transformation , we found there were sequence-level representations in a form of matrix-vector multiplications among the expanded and unrolled hidden states of the GRU/LSTM cell . Such representations could represent sequence-level features that could theoretically be sensitive to the order of tokens and able to differ from the token-level features of its tokens as well as the sequence-level features of its sub-sequences , thus making it able to represent N -grams . We assessed the significance of such sequence-level representations on sentiment analysis and language modeling tasks . We observed that the sequence-level representations derived from a GRU or LSTM cell were able to reflect desired properties on sentiment analysis tasks . Furthermore , in both the sentiment analysis and language modeling tasks , we replaced the GRU or LSTM cell with corresponding sequence-level representations ( along with token-level representations ) directly during training , and found that such models behaved similarly to the standard GRU or LSTM based models . This indicated that the sequence-level features might be significant for GRU or LSTM cells . 2 RELATED WORK . There have been plenty of prior works aiming to explain the behaviors of RNNs along with the variants . Early efforts were focused on exploring the empirical behaviors of recurrent neural networks ( RNNs ) . Li et al . ( 2015 ) proposed a visualization approach to analyze intermediate representations of the LSTM-based models where certain interesting patterns could be observed . However , it might not be easy to extend to models with high-dimension representations . Greff et al . ( 2016 ) explored the performances of LSTM variants on representative tasks such as speech recognition , handwriting recognition , and argued that none of the proposed variants could significantly improve upon the standard LSTM architecture . Karpathy et al . ( 2015 ) studied the existence of interpretable cells that could capture long-range dependencies such as line lengths , quotes and brackets . However , those works did not involve the internal mechanism of GRUs or LSTMs . Melis et al . ( 2020 ) and Krause et al . ( 2017 ) found that creating richer interaction between contexts and inputs on top of standard LSTMs could result in improvements . Their efforts actually pointed out the significance of rich interactions between inputs and contexts for LSTMs , but did not study what possible features such interactions could result in for good performances . Arras et al . ( 2017 ) applied an extended technique Layer-wise Relevance Propagation ( LRP ) to a bidirectional LSTM for sentiment analysis and produced reliable explanations of which words are responsible for attributing sentiment in individual text . Murdoch et al . ( 2018 ) leverage contextual decomposition methods to conduct analysis on the interactions of terms for LSTMS , which could produce importance scores for words , phrases and word interactions . A RNN unrolling technique was proposed by Sherstinsky ( 2018 ) based on signal processing concepts , transforming the RNN into the “ Vanilla LSTM ” network through a series of logical arguments , and Kanai et al . ( 2017 ) discussed the conditions that could prevent gradient explosions by looking into the dynamics of GRUs . Merrill et al . ( 2020 ) examined the properties of saturated RNNs and linked the update behaviors to weighted finite-state machines . Their ideas gave inspirations to explore internal behaviors of LSTM or GRU cells further . In this work , we sought to explore and study such significant underlying features . 3 MODEL DEFINITIONS . Vanilla RNN The representation of a vanilla RNN cell can be written as : ht = tanh ( Wixt +Whht−1 ) , ( 1 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t− 1 ) or the initial hidden state . Wi andWh are weight matrices . Bias is suppressed here as well . GRU The representation of a GRU cell can be written as 1 : rt = σ ( Wirxt +Whrht−1 ) , zt = σ ( Wizxt +Whzht−1 ) , nt = tanh ( Winxt + rt Whnht−1 ) , ht = ( 1− zt ) nt + zt ht−1 , ( 2 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t − 1 ) or the initial hidden state . rt ∈ Rd , zt ∈ Rd , nt ∈ Rd are the reset , update , and the new gates respectively . W ? ? refers to a weight matrix . σ is the elementwise sigmoid function , and is the element-wise Hadamard product . LSTM The representation of an LSTM cell can be written as : it = σ ( Wiixt +Whiht−1 ) , ft = σ ( Wifxt +Whfht−1 ) , ot = σ ( Wioxt +Whoht−1 ) , c′t = tanh ( Wicxt +Whcht−1 ) , ct = ft ct−1 + it c′t , ht = ot tanh ( ct ) , ( 3 ) 1For brevity , we suppressed the bias for both GRU and LSTM cells here . where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , it , ft , ot ∈ Rd are the input gate , forget gate , output gate respectively . c′t ∈ Rd is the new memory , ct is the final memory . W ? ? refers to a weight matrix . 4 UNROLLING RNNS . Using the Taylor series , the activations tanh ( x ) and σ ( x ) can be expanded ( at 0 ) as : tanh ( x ) = x+O ( x3 ) ( |x| < π 2 ) , σ ( x ) = 1 2 + 1 4 x+O ( x3 ) ( |x| < π ) ( 4 ) In this work , we do not seek to approximate the GRU or LSTM cells precisely , but to explore what features the cells could capture . 4.1 VANILLA RNN . We can expand the vanilla RNN hidden state using the Taylor series as : ht = x n t +Whht−1 +O ( x n t +Whht−1 ) 3 , ( 5 ) where xnt =Wixt . Let us unroll it as : ht = x n t + t−1∑ i=1 W t−ih x n i + r ( x1 , x2 , ... , xt ) , ( 6 ) where r is the unrolled representation produced by higher-order terms . It can be seen that the vanilla RNN cell can capture the input information at each time step . 4.2 GRU . Let us write xrt = Wirxt , x z t = Wizxt , x n t = Winxt , h r t−1 = Whrht−1 , h z t−1 = Whzht−1 , hnt−1 =Whnht−1 . Plugging Equation 4 in Equation 2 , we can expand the hidden state at time step t , then combine like terms with respect to the order of ht−1 and represent them as : ht = 1 2 xnt − 1 4 xnt xzt︸ ︷︷ ︸ zeroth−order + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt ) hnt−1 − 1 16 xrt xzt hnt−1︸ ︷︷ ︸ first−order + 1 4 hzt−1 ht−1 + 1 8 ( hrt−1 − hzt−1 ) hnt−1 − 1 16 xrt hzt−1 hnt−1 − 1 16 xzt hrt−1 hnt−1︸ ︷︷ ︸ second−order − 1 16 hzt−1 hrt−1 hnt−1︸ ︷︷ ︸ third−order +ξ ( xt , ht−1 ) , ( 7 ) where ξ ( xt , ht−1 ) refers to the higher-order terms of xt , ht−1 as well as their interactions . We will focus on the terms involving zeroth-order and first-order terms of ht−1 and explore the features they can possibly result in . Then the hidden state at time step t can be written as : ht = 1 2 xnt − 1 4 xnt xzt + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt − 1 2 xzt xrt ) hnt−1 + ξ′ ( xt , ht−1 ) , ( 8 ) where ξ′ ( xt , ht−1 ) refers to the higher-order terms of ht−1 plus ξ ( xt , ht−1 ) . Note that the Hadamard products can be transformed into matrix-vector multiplications ( a b = diag ( a ) b ) and we can obtain the following : ht = 1 2 xnt − 1 4 xnt xzt + [ 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn ] ht−1 + ξ′ ( xt , ht−1 ) . ( 9 ) For brevity , let us define two functions of xt : g ( xt ) = 1 2 xnt − 1 4 xnt xzt , A ( xt ) = 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn . ( 10 ) Both g ( xt ) andA ( xt ) are only functions of xt . Then we can rewrite Equation 9 as : ht = g ( xt ) +A ( xt ) ht−1 + ξ ′ ( xt , ht−1 ) . ( 11 ) Throughout all the previous time steps ( assuming the initial state are 0s ) , the hidden state at time step t can be finally unrolled as : ht = g ( xt ) + t−1∑ i=1 A ( xt ) A ( xt−1 ) ... A ( xi+1 ) ︸ ︷︷ ︸ M ( i+1 ) : t g ( xi ) + g ( x1 , x2 , ... , xt ) = g ( xt ) + t−1∑ i=1 M ( i+1 ) : tg ( xi ) ︸ ︷︷ ︸ Φi : t + g ( x1 , x2 , ... , xt ) , ( 12 ) where M ( i+1 ) : t = ∏i+1 k=tA ( xk ) ∈ Rd×d is the matrix-matrix product from time step t to i + 1 , g ( x1 , x2 , ... , xt ) are the unrolled representations from the higher-order terms in Equation 11 . The function g ( xt ) solely encodes current input , namely token-level features and thus we call it tokenlevel representation . The matrix-vector product Φi : t = M ( i+1 ) : tg ( xi ) encodes the tokens starting from time step i and ending at time step t. If the matrices are different and not diagonal , any change of the order will result in a different product . Therefore , Φi : t is able to capture the feature of the token sequence between time step i and t in an order-sensitive manner . We call it a sequence-level representation . Such representations are calculated sequentially from the left to the right through a sequence of vector/matrix multiplications , leading to features reminiscent of the classical N -grams commonly used in natural language processing ( NLP ) . Let us use ĥt to denote the first two terms in Equation 12 as : ĥt = g ( xt ) + t−1∑ i=1 Φi : t. ( 13 ) ĥt can be called as N -gram representations ( N ≥ 1 ) . At time step t , it is able to encode current token input and all the token sequences starting from time step i ∈ { 1 , 2 , ... , t − 1 } and ending at time step t given an instance . In other words , it is a linear combination of current token-level input feature ( can be understood as the unigram feature ) and sequence-level features of all the possible N -grams ending at time step t. Bidirectional GRUs would be able to capture sequence-level features from both directions . If we make a comparison with the unrolled vanilla RNN cell as discussed above , we can see that the sequence-level representation A ( xt ) A ( xt−1 ) ... A ( xi+1 ) g ( xi ) is more expressive than W t−ih x n i ( i = 1 , ... , t − 1 ) when capturing the sequence level features . Specifically , the sequence level representation in GRU explicitly models interactions among input tokens , while capturing the useful order information conveyed by them . This may also be a reason why gating mechanism can bring in improved effectiveness over vanilla RNNs apart from alleviating the gradient vanishing or explosion problems .
This paper proposes to linearize GRU and LSTM cells (as error terms should be negligible when inputs are small in magnitude). Putting these linearized, or, really, affine, RNN cells together into a single-layer sequence processor, thanks to the affine-ness, we can decompose the score that is obtained by taking dot products with a query at each timestep into contribution by immediate unigram features and all subsequences leading to this unigram. The authors evaluate these scores, showing that they do and don't capture phenomena in a synthetic dataset and proceeding to show that when both training and evaluating with this simplified network on SST yields strong results.
SP:bb8dbe6d6edaa4fa6ee844e75bbeaf3ac4e96a38
SEQUENCE-LEVEL FEATURES: HOW GRU AND LSTM CELLS CAPTURE N-GRAMS
1 INTRODUCTION . Long Short-term Memory ( LSTM ) ( Hochreiter & Schmidhuber , 1997 ) and Gated Recurrent Unit ( GRU ) ( Chung et al. , 2014 ) are widely used and investigated for tasks that involve sequential data . They are generally believed to be capable of capturing long-range dependencies while being able to alleviate gradient vanishing or explosion issues ( Hochreiter & Schmidhuber , 1997 ; Karpathy et al. , 2015 ; Sutskever et al. , 2014 ) . While such models were empirically shown to be successful across a range of tasks , certain fundamental questions such as “ what essential features are GRU or LSTM cells able to capture ? ” have not yet been fully addressed . Lacking answers to them may limit our ability in designing better architectures . One obstacle can be attributed to the non-linear activations used in the cells that prevent us from obtaining explicit closed-form expressions for hidden states . A possible solution is to expand the non-linear functions using the Taylor series ( Arfken & Mullin , 1985 ) and represent hidden states with explicit input terms . Literally , each hidden state can be viewed as the combination of constituent terms capturing features of different levels of complexity . However , there is a prohibitively large number of polynomial terms involved and they can be difficult to manage . But it is possible that certain terms are more significant than others . Through a series of mathematical transformation , we found there were sequence-level representations in a form of matrix-vector multiplications among the expanded and unrolled hidden states of the GRU/LSTM cell . Such representations could represent sequence-level features that could theoretically be sensitive to the order of tokens and able to differ from the token-level features of its tokens as well as the sequence-level features of its sub-sequences , thus making it able to represent N -grams . We assessed the significance of such sequence-level representations on sentiment analysis and language modeling tasks . We observed that the sequence-level representations derived from a GRU or LSTM cell were able to reflect desired properties on sentiment analysis tasks . Furthermore , in both the sentiment analysis and language modeling tasks , we replaced the GRU or LSTM cell with corresponding sequence-level representations ( along with token-level representations ) directly during training , and found that such models behaved similarly to the standard GRU or LSTM based models . This indicated that the sequence-level features might be significant for GRU or LSTM cells . 2 RELATED WORK . There have been plenty of prior works aiming to explain the behaviors of RNNs along with the variants . Early efforts were focused on exploring the empirical behaviors of recurrent neural networks ( RNNs ) . Li et al . ( 2015 ) proposed a visualization approach to analyze intermediate representations of the LSTM-based models where certain interesting patterns could be observed . However , it might not be easy to extend to models with high-dimension representations . Greff et al . ( 2016 ) explored the performances of LSTM variants on representative tasks such as speech recognition , handwriting recognition , and argued that none of the proposed variants could significantly improve upon the standard LSTM architecture . Karpathy et al . ( 2015 ) studied the existence of interpretable cells that could capture long-range dependencies such as line lengths , quotes and brackets . However , those works did not involve the internal mechanism of GRUs or LSTMs . Melis et al . ( 2020 ) and Krause et al . ( 2017 ) found that creating richer interaction between contexts and inputs on top of standard LSTMs could result in improvements . Their efforts actually pointed out the significance of rich interactions between inputs and contexts for LSTMs , but did not study what possible features such interactions could result in for good performances . Arras et al . ( 2017 ) applied an extended technique Layer-wise Relevance Propagation ( LRP ) to a bidirectional LSTM for sentiment analysis and produced reliable explanations of which words are responsible for attributing sentiment in individual text . Murdoch et al . ( 2018 ) leverage contextual decomposition methods to conduct analysis on the interactions of terms for LSTMS , which could produce importance scores for words , phrases and word interactions . A RNN unrolling technique was proposed by Sherstinsky ( 2018 ) based on signal processing concepts , transforming the RNN into the “ Vanilla LSTM ” network through a series of logical arguments , and Kanai et al . ( 2017 ) discussed the conditions that could prevent gradient explosions by looking into the dynamics of GRUs . Merrill et al . ( 2020 ) examined the properties of saturated RNNs and linked the update behaviors to weighted finite-state machines . Their ideas gave inspirations to explore internal behaviors of LSTM or GRU cells further . In this work , we sought to explore and study such significant underlying features . 3 MODEL DEFINITIONS . Vanilla RNN The representation of a vanilla RNN cell can be written as : ht = tanh ( Wixt +Whht−1 ) , ( 1 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t− 1 ) or the initial hidden state . Wi andWh are weight matrices . Bias is suppressed here as well . GRU The representation of a GRU cell can be written as 1 : rt = σ ( Wirxt +Whrht−1 ) , zt = σ ( Wizxt +Whzht−1 ) , nt = tanh ( Winxt + rt Whnht−1 ) , ht = ( 1− zt ) nt + zt ht−1 , ( 2 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t − 1 ) or the initial hidden state . rt ∈ Rd , zt ∈ Rd , nt ∈ Rd are the reset , update , and the new gates respectively . W ? ? refers to a weight matrix . σ is the elementwise sigmoid function , and is the element-wise Hadamard product . LSTM The representation of an LSTM cell can be written as : it = σ ( Wiixt +Whiht−1 ) , ft = σ ( Wifxt +Whfht−1 ) , ot = σ ( Wioxt +Whoht−1 ) , c′t = tanh ( Wicxt +Whcht−1 ) , ct = ft ct−1 + it c′t , ht = ot tanh ( ct ) , ( 3 ) 1For brevity , we suppressed the bias for both GRU and LSTM cells here . where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , it , ft , ot ∈ Rd are the input gate , forget gate , output gate respectively . c′t ∈ Rd is the new memory , ct is the final memory . W ? ? refers to a weight matrix . 4 UNROLLING RNNS . Using the Taylor series , the activations tanh ( x ) and σ ( x ) can be expanded ( at 0 ) as : tanh ( x ) = x+O ( x3 ) ( |x| < π 2 ) , σ ( x ) = 1 2 + 1 4 x+O ( x3 ) ( |x| < π ) ( 4 ) In this work , we do not seek to approximate the GRU or LSTM cells precisely , but to explore what features the cells could capture . 4.1 VANILLA RNN . We can expand the vanilla RNN hidden state using the Taylor series as : ht = x n t +Whht−1 +O ( x n t +Whht−1 ) 3 , ( 5 ) where xnt =Wixt . Let us unroll it as : ht = x n t + t−1∑ i=1 W t−ih x n i + r ( x1 , x2 , ... , xt ) , ( 6 ) where r is the unrolled representation produced by higher-order terms . It can be seen that the vanilla RNN cell can capture the input information at each time step . 4.2 GRU . Let us write xrt = Wirxt , x z t = Wizxt , x n t = Winxt , h r t−1 = Whrht−1 , h z t−1 = Whzht−1 , hnt−1 =Whnht−1 . Plugging Equation 4 in Equation 2 , we can expand the hidden state at time step t , then combine like terms with respect to the order of ht−1 and represent them as : ht = 1 2 xnt − 1 4 xnt xzt︸ ︷︷ ︸ zeroth−order + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt ) hnt−1 − 1 16 xrt xzt hnt−1︸ ︷︷ ︸ first−order + 1 4 hzt−1 ht−1 + 1 8 ( hrt−1 − hzt−1 ) hnt−1 − 1 16 xrt hzt−1 hnt−1 − 1 16 xzt hrt−1 hnt−1︸ ︷︷ ︸ second−order − 1 16 hzt−1 hrt−1 hnt−1︸ ︷︷ ︸ third−order +ξ ( xt , ht−1 ) , ( 7 ) where ξ ( xt , ht−1 ) refers to the higher-order terms of xt , ht−1 as well as their interactions . We will focus on the terms involving zeroth-order and first-order terms of ht−1 and explore the features they can possibly result in . Then the hidden state at time step t can be written as : ht = 1 2 xnt − 1 4 xnt xzt + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt − 1 2 xzt xrt ) hnt−1 + ξ′ ( xt , ht−1 ) , ( 8 ) where ξ′ ( xt , ht−1 ) refers to the higher-order terms of ht−1 plus ξ ( xt , ht−1 ) . Note that the Hadamard products can be transformed into matrix-vector multiplications ( a b = diag ( a ) b ) and we can obtain the following : ht = 1 2 xnt − 1 4 xnt xzt + [ 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn ] ht−1 + ξ′ ( xt , ht−1 ) . ( 9 ) For brevity , let us define two functions of xt : g ( xt ) = 1 2 xnt − 1 4 xnt xzt , A ( xt ) = 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn . ( 10 ) Both g ( xt ) andA ( xt ) are only functions of xt . Then we can rewrite Equation 9 as : ht = g ( xt ) +A ( xt ) ht−1 + ξ ′ ( xt , ht−1 ) . ( 11 ) Throughout all the previous time steps ( assuming the initial state are 0s ) , the hidden state at time step t can be finally unrolled as : ht = g ( xt ) + t−1∑ i=1 A ( xt ) A ( xt−1 ) ... A ( xi+1 ) ︸ ︷︷ ︸ M ( i+1 ) : t g ( xi ) + g ( x1 , x2 , ... , xt ) = g ( xt ) + t−1∑ i=1 M ( i+1 ) : tg ( xi ) ︸ ︷︷ ︸ Φi : t + g ( x1 , x2 , ... , xt ) , ( 12 ) where M ( i+1 ) : t = ∏i+1 k=tA ( xk ) ∈ Rd×d is the matrix-matrix product from time step t to i + 1 , g ( x1 , x2 , ... , xt ) are the unrolled representations from the higher-order terms in Equation 11 . The function g ( xt ) solely encodes current input , namely token-level features and thus we call it tokenlevel representation . The matrix-vector product Φi : t = M ( i+1 ) : tg ( xi ) encodes the tokens starting from time step i and ending at time step t. If the matrices are different and not diagonal , any change of the order will result in a different product . Therefore , Φi : t is able to capture the feature of the token sequence between time step i and t in an order-sensitive manner . We call it a sequence-level representation . Such representations are calculated sequentially from the left to the right through a sequence of vector/matrix multiplications , leading to features reminiscent of the classical N -grams commonly used in natural language processing ( NLP ) . Let us use ĥt to denote the first two terms in Equation 12 as : ĥt = g ( xt ) + t−1∑ i=1 Φi : t. ( 13 ) ĥt can be called as N -gram representations ( N ≥ 1 ) . At time step t , it is able to encode current token input and all the token sequences starting from time step i ∈ { 1 , 2 , ... , t − 1 } and ending at time step t given an instance . In other words , it is a linear combination of current token-level input feature ( can be understood as the unigram feature ) and sequence-level features of all the possible N -grams ending at time step t. Bidirectional GRUs would be able to capture sequence-level features from both directions . If we make a comparison with the unrolled vanilla RNN cell as discussed above , we can see that the sequence-level representation A ( xt ) A ( xt−1 ) ... A ( xi+1 ) g ( xi ) is more expressive than W t−ih x n i ( i = 1 , ... , t − 1 ) when capturing the sequence level features . Specifically , the sequence level representation in GRU explicitly models interactions among input tokens , while capturing the useful order information conveyed by them . This may also be a reason why gating mechanism can bring in improved effectiveness over vanilla RNNs apart from alleviating the gradient vanishing or explosion problems .
This paper provides a reliable interpretation of modern RNN models, through unrolling GRU and LSTM cells. The approximate state representations include a token-level term that only depends on the current input token and a sentence-level term that depends on all inputs until the current token. The deriving process is clear and illuminating. The experiment section shows that the approximation shares similar behavior and performance as the original model.
SP:bb8dbe6d6edaa4fa6ee844e75bbeaf3ac4e96a38
SEQUENCE-LEVEL FEATURES: HOW GRU AND LSTM CELLS CAPTURE N-GRAMS
1 INTRODUCTION . Long Short-term Memory ( LSTM ) ( Hochreiter & Schmidhuber , 1997 ) and Gated Recurrent Unit ( GRU ) ( Chung et al. , 2014 ) are widely used and investigated for tasks that involve sequential data . They are generally believed to be capable of capturing long-range dependencies while being able to alleviate gradient vanishing or explosion issues ( Hochreiter & Schmidhuber , 1997 ; Karpathy et al. , 2015 ; Sutskever et al. , 2014 ) . While such models were empirically shown to be successful across a range of tasks , certain fundamental questions such as “ what essential features are GRU or LSTM cells able to capture ? ” have not yet been fully addressed . Lacking answers to them may limit our ability in designing better architectures . One obstacle can be attributed to the non-linear activations used in the cells that prevent us from obtaining explicit closed-form expressions for hidden states . A possible solution is to expand the non-linear functions using the Taylor series ( Arfken & Mullin , 1985 ) and represent hidden states with explicit input terms . Literally , each hidden state can be viewed as the combination of constituent terms capturing features of different levels of complexity . However , there is a prohibitively large number of polynomial terms involved and they can be difficult to manage . But it is possible that certain terms are more significant than others . Through a series of mathematical transformation , we found there were sequence-level representations in a form of matrix-vector multiplications among the expanded and unrolled hidden states of the GRU/LSTM cell . Such representations could represent sequence-level features that could theoretically be sensitive to the order of tokens and able to differ from the token-level features of its tokens as well as the sequence-level features of its sub-sequences , thus making it able to represent N -grams . We assessed the significance of such sequence-level representations on sentiment analysis and language modeling tasks . We observed that the sequence-level representations derived from a GRU or LSTM cell were able to reflect desired properties on sentiment analysis tasks . Furthermore , in both the sentiment analysis and language modeling tasks , we replaced the GRU or LSTM cell with corresponding sequence-level representations ( along with token-level representations ) directly during training , and found that such models behaved similarly to the standard GRU or LSTM based models . This indicated that the sequence-level features might be significant for GRU or LSTM cells . 2 RELATED WORK . There have been plenty of prior works aiming to explain the behaviors of RNNs along with the variants . Early efforts were focused on exploring the empirical behaviors of recurrent neural networks ( RNNs ) . Li et al . ( 2015 ) proposed a visualization approach to analyze intermediate representations of the LSTM-based models where certain interesting patterns could be observed . However , it might not be easy to extend to models with high-dimension representations . Greff et al . ( 2016 ) explored the performances of LSTM variants on representative tasks such as speech recognition , handwriting recognition , and argued that none of the proposed variants could significantly improve upon the standard LSTM architecture . Karpathy et al . ( 2015 ) studied the existence of interpretable cells that could capture long-range dependencies such as line lengths , quotes and brackets . However , those works did not involve the internal mechanism of GRUs or LSTMs . Melis et al . ( 2020 ) and Krause et al . ( 2017 ) found that creating richer interaction between contexts and inputs on top of standard LSTMs could result in improvements . Their efforts actually pointed out the significance of rich interactions between inputs and contexts for LSTMs , but did not study what possible features such interactions could result in for good performances . Arras et al . ( 2017 ) applied an extended technique Layer-wise Relevance Propagation ( LRP ) to a bidirectional LSTM for sentiment analysis and produced reliable explanations of which words are responsible for attributing sentiment in individual text . Murdoch et al . ( 2018 ) leverage contextual decomposition methods to conduct analysis on the interactions of terms for LSTMS , which could produce importance scores for words , phrases and word interactions . A RNN unrolling technique was proposed by Sherstinsky ( 2018 ) based on signal processing concepts , transforming the RNN into the “ Vanilla LSTM ” network through a series of logical arguments , and Kanai et al . ( 2017 ) discussed the conditions that could prevent gradient explosions by looking into the dynamics of GRUs . Merrill et al . ( 2020 ) examined the properties of saturated RNNs and linked the update behaviors to weighted finite-state machines . Their ideas gave inspirations to explore internal behaviors of LSTM or GRU cells further . In this work , we sought to explore and study such significant underlying features . 3 MODEL DEFINITIONS . Vanilla RNN The representation of a vanilla RNN cell can be written as : ht = tanh ( Wixt +Whht−1 ) , ( 1 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t− 1 ) or the initial hidden state . Wi andWh are weight matrices . Bias is suppressed here as well . GRU The representation of a GRU cell can be written as 1 : rt = σ ( Wirxt +Whrht−1 ) , zt = σ ( Wizxt +Whzht−1 ) , nt = tanh ( Winxt + rt Whnht−1 ) , ht = ( 1− zt ) nt + zt ht−1 , ( 2 ) where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , ht−1 is the hidden state of the layer at time ( t − 1 ) or the initial hidden state . rt ∈ Rd , zt ∈ Rd , nt ∈ Rd are the reset , update , and the new gates respectively . W ? ? refers to a weight matrix . σ is the elementwise sigmoid function , and is the element-wise Hadamard product . LSTM The representation of an LSTM cell can be written as : it = σ ( Wiixt +Whiht−1 ) , ft = σ ( Wifxt +Whfht−1 ) , ot = σ ( Wioxt +Whoht−1 ) , c′t = tanh ( Wicxt +Whcht−1 ) , ct = ft ct−1 + it c′t , ht = ot tanh ( ct ) , ( 3 ) 1For brevity , we suppressed the bias for both GRU and LSTM cells here . where ht ∈ Rd , xt ∈ Rdx are the hidden state and input at time step t respectively , it , ft , ot ∈ Rd are the input gate , forget gate , output gate respectively . c′t ∈ Rd is the new memory , ct is the final memory . W ? ? refers to a weight matrix . 4 UNROLLING RNNS . Using the Taylor series , the activations tanh ( x ) and σ ( x ) can be expanded ( at 0 ) as : tanh ( x ) = x+O ( x3 ) ( |x| < π 2 ) , σ ( x ) = 1 2 + 1 4 x+O ( x3 ) ( |x| < π ) ( 4 ) In this work , we do not seek to approximate the GRU or LSTM cells precisely , but to explore what features the cells could capture . 4.1 VANILLA RNN . We can expand the vanilla RNN hidden state using the Taylor series as : ht = x n t +Whht−1 +O ( x n t +Whht−1 ) 3 , ( 5 ) where xnt =Wixt . Let us unroll it as : ht = x n t + t−1∑ i=1 W t−ih x n i + r ( x1 , x2 , ... , xt ) , ( 6 ) where r is the unrolled representation produced by higher-order terms . It can be seen that the vanilla RNN cell can capture the input information at each time step . 4.2 GRU . Let us write xrt = Wirxt , x z t = Wizxt , x n t = Winxt , h r t−1 = Whrht−1 , h z t−1 = Whzht−1 , hnt−1 =Whnht−1 . Plugging Equation 4 in Equation 2 , we can expand the hidden state at time step t , then combine like terms with respect to the order of ht−1 and represent them as : ht = 1 2 xnt − 1 4 xnt xzt︸ ︷︷ ︸ zeroth−order + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt ) hnt−1 − 1 16 xrt xzt hnt−1︸ ︷︷ ︸ first−order + 1 4 hzt−1 ht−1 + 1 8 ( hrt−1 − hzt−1 ) hnt−1 − 1 16 xrt hzt−1 hnt−1 − 1 16 xzt hrt−1 hnt−1︸ ︷︷ ︸ second−order − 1 16 hzt−1 hrt−1 hnt−1︸ ︷︷ ︸ third−order +ξ ( xt , ht−1 ) , ( 7 ) where ξ ( xt , ht−1 ) refers to the higher-order terms of xt , ht−1 as well as their interactions . We will focus on the terms involving zeroth-order and first-order terms of ht−1 and explore the features they can possibly result in . Then the hidden state at time step t can be written as : ht = 1 2 xnt − 1 4 xnt xzt + 1 2 ht−1 + 1 4 hnt−1 + 1 4 xzt ht−1 − 1 4 xnt hzt−1 + 1 8 ( xrt − xzt − 1 2 xzt xrt ) hnt−1 + ξ′ ( xt , ht−1 ) , ( 8 ) where ξ′ ( xt , ht−1 ) refers to the higher-order terms of ht−1 plus ξ ( xt , ht−1 ) . Note that the Hadamard products can be transformed into matrix-vector multiplications ( a b = diag ( a ) b ) and we can obtain the following : ht = 1 2 xnt − 1 4 xnt xzt + [ 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn ] ht−1 + ξ′ ( xt , ht−1 ) . ( 9 ) For brevity , let us define two functions of xt : g ( xt ) = 1 2 xnt − 1 4 xnt xzt , A ( xt ) = 1 2 I + 1 4 Whn + 1 4 diag ( xzt ) − 1 4 diag ( xnt ) Whz + 1 8 diag ( xrt − xzt − 1 2 xzt xrt ) Whn . ( 10 ) Both g ( xt ) andA ( xt ) are only functions of xt . Then we can rewrite Equation 9 as : ht = g ( xt ) +A ( xt ) ht−1 + ξ ′ ( xt , ht−1 ) . ( 11 ) Throughout all the previous time steps ( assuming the initial state are 0s ) , the hidden state at time step t can be finally unrolled as : ht = g ( xt ) + t−1∑ i=1 A ( xt ) A ( xt−1 ) ... A ( xi+1 ) ︸ ︷︷ ︸ M ( i+1 ) : t g ( xi ) + g ( x1 , x2 , ... , xt ) = g ( xt ) + t−1∑ i=1 M ( i+1 ) : tg ( xi ) ︸ ︷︷ ︸ Φi : t + g ( x1 , x2 , ... , xt ) , ( 12 ) where M ( i+1 ) : t = ∏i+1 k=tA ( xk ) ∈ Rd×d is the matrix-matrix product from time step t to i + 1 , g ( x1 , x2 , ... , xt ) are the unrolled representations from the higher-order terms in Equation 11 . The function g ( xt ) solely encodes current input , namely token-level features and thus we call it tokenlevel representation . The matrix-vector product Φi : t = M ( i+1 ) : tg ( xi ) encodes the tokens starting from time step i and ending at time step t. If the matrices are different and not diagonal , any change of the order will result in a different product . Therefore , Φi : t is able to capture the feature of the token sequence between time step i and t in an order-sensitive manner . We call it a sequence-level representation . Such representations are calculated sequentially from the left to the right through a sequence of vector/matrix multiplications , leading to features reminiscent of the classical N -grams commonly used in natural language processing ( NLP ) . Let us use ĥt to denote the first two terms in Equation 12 as : ĥt = g ( xt ) + t−1∑ i=1 Φi : t. ( 13 ) ĥt can be called as N -gram representations ( N ≥ 1 ) . At time step t , it is able to encode current token input and all the token sequences starting from time step i ∈ { 1 , 2 , ... , t − 1 } and ending at time step t given an instance . In other words , it is a linear combination of current token-level input feature ( can be understood as the unigram feature ) and sequence-level features of all the possible N -grams ending at time step t. Bidirectional GRUs would be able to capture sequence-level features from both directions . If we make a comparison with the unrolled vanilla RNN cell as discussed above , we can see that the sequence-level representation A ( xt ) A ( xt−1 ) ... A ( xi+1 ) g ( xi ) is more expressive than W t−ih x n i ( i = 1 , ... , t − 1 ) when capturing the sequence level features . Specifically , the sequence level representation in GRU explicitly models interactions among input tokens , while capturing the useful order information conveyed by them . This may also be a reason why gating mechanism can bring in improved effectiveness over vanilla RNNs apart from alleviating the gradient vanishing or explosion problems .
This paper attempts to add a contribution on understanding how gated recurrent neural networks like GRUs and LSTMs can learn the representation of n-grams. The authors expand the sigmoid function and the hyperbolic tangent function using Taylor series to obtain approximated closed-form mathematical expression of hidden representation when using the GRU or the LSTM as the update rules. The approximated hidden representation of the GRU and the LSTM update rules can be separated into two terms, (1) the current token-level input feature and (2) the sequence-level feature, which is a weighted sum of all previous tokens. As the hidden representation consists of two feature terms, one can take each feature (either token-level or sequence-level) separately for a downstream task, e.g., evaluate how good when sequence-level feature is used for predicting polarity score in sentiment analysis.
SP:bb8dbe6d6edaa4fa6ee844e75bbeaf3ac4e96a38
Semantically-Adaptive Upsampling for Layout-to-Image Translation
1 INTRODUCTION . The layout-to-image translation task aims to translate input layouts to realistic images ( see Fig . 1 ( a ) ) , which have many real-world applications and draw much attention from the community ( Park et al. , 2019 ; Liu et al. , 2019 ; Jiang et al. , 2020 ; Tang et al. , 2020 ) . For example , Park et al . ( 2019 ) propose GauGAN with a novel spatially-adaptive normalization to generate realistic images from semantic layouts . Liu et al . ( 2019 ) propose CC-FPSE , which predicts convolutional kernels conditioned on the semantic layout and then generate the images . Tang et al . ( 2020 ) propose LGGAN with several local generators for generating realistic small objects . Despite the interesting exploration of these methods , we can still observe artifacts and blurriness in their generated images because they always adopt the nearest-neighbor interpolation to upsample feature maps and then to generate final results . Feature upsampling is a key operation in the layout-to-image translation task . Traditional upsampling methods such as nearest-neighbor , bilinear , and bicubic only consider sub-pixel neighborhood ( indicated by white circles in Fig . 1 ( b ) ) , failing to capture the complete semantic information , e.g. , the head and body of the dog , and the front part of the car . Learnable upsampling methods such as Deconvolution ( Noh et al. , 2015 ) and Pixel Shuffle Shi et al . ( 2016 ) are able to obtain the global information with larger kernel size , but learns the same kernel ( indicated by the white arrows in Fig . 1 ( c ) ) across the image , regardless of the semantic information . Other feature enhancement methods such as Spatial Attention ( Fu et al. , 2019 ) can learn different kernels ( indicated by different color arrows in Fig . 1 ( d ) ) , but it still inevitable captures a lot of redundant information , i.e. , ‘ grasses ’ and ‘ soil ’ . Also , it is prohibitively expensive since it needs to consider all the pixels . To fix these limitations , we propose a novel Semantically-Adaptive UpSampling ( SA-UpSample ) for this challenging task in Fig . 1 ( e ) . Our SA-UpSample dynamically upsamples a small subset of relevant pixels based on the semantic information , i.e. , the green and the tangerine circles represent the pixels within the dog and the car , respectively . In this way , SA-UpSample is more efficient than both Deconvolution , Pixel Shuffle , and Spatial Attention , and can capture more complete semantic information than traditional upsampling methods such as the nearest-neighbor interpolation . We perform extensive experiments on six popular datasets with diverse scenarios and different image resolutions , i.e. , Cityscapes ( Cordts et al. , 2016 ) , ADE20K ( Zhou et al. , 2017 ) , COCO-Stuff ( Caesar et al. , 2018 ) , DeepFashion ( Liu et al. , 2016 ) , CelebAMask-HQ ( Lee et al. , 2020 ) , and Facades ( Tyleček & Šára , 2013 ) . We show that with the help of SA-UpSample , our framework can synthesize better results compared to several state-of-the-art methods . Moreover , an extensive ablation study shows the effectiveness of SA-UpSample against other feature upsampling and enhancement methods for the layout-to-image translation task . 2 RELATED WORK . Feature Upsampling . Traditional upsampling methods such as nearest-neighbor and bilinear interpolations use spatial distance and hand-crafted kernels to capture the correlations between pixels . Recently , several deep learning methods such as Deconvolution ( Noh et al. , 2015 ) and Pixel Shuffle Shi et al . ( 2016 ) are proposed to upsample feature maps using learnable kernels . However , these methods either exploit semantic information in a small neighborhood or use a fixed kernel . Some other works of super-resolution , inpainting , denoising ( Mildenhall et al. , 2018 ; Wang et al. , 2019 ; Jo et al. , 2018 ; Hu et al. , 2019 ) also explore using learnable kernels . However , the settings of these tasks are significantly different from ours , making their methods can not be used directly . Layout-to-Image Translation tries to convert semantic layouts into realistic images ( Park et al. , 2019 ; Liu et al. , 2019 ; Jiang et al. , 2020 ; Tang et al. , 2020 ; Zhu et al. , 2020a ; Ntavelis et al. , 2020 ; Zhu et al. , 2020b ) . Although existing methods have generated good images , we still see unsatisfactory aspects mainly in the generated content details and intra-object completions , which we believe is mainly due to they always adopt the nearest-neighbor interpolation to upsample feature maps and then generate final results . To fix this limitation , we propose a novel Semantically-Adaptive UpSampling ( SA-UpSample ) for this task . To the best of our knowledge , we are the first to investigate the influence of feature upsampling on this challenging task . 3 SEMANTICALLY-ADAPTIVE UPSAMPLING ( SA-UPSAMPLE ) . An illustration of the proposed Semantically-Adaptive UpSampling ( SA-UpSample ) is shown in Fig . 2 , which mainly consists of two branches , i.e. , the Semantically-Adaptive Kernel Generation ( SAKG ) branch predicting upsample kernels according to the semantic information , and the Semantically-Adaptive Feature Upsampling ( SAFU ) branch selectively performs the feature upsampling based on the kernels learned in SAKG . All components are trained in an end-to-end fashion so that the two branches can benefit from each other . Specifically , given a feature map f∈RC×H×W and an upsample scale s , SA-UpSample aims to produce a new feature map f ′∈RC×Hs×Ws . For any target location l′= ( i′ , j′ ) in the output f ′ , there is a corresponding source location l= ( i , j ) at the input f , where i=bi′/sc , j=bj′/sc . We denote N ( l , k ) as the k×k sub-region of f centered at the location l in , i.e. , the neighbor of the location l. See Fig . 1 and 2 for illustration . 3.1 SEMANTICALLY-ADAPTIVE KERNEL GENERATION ( SAKG ) BRANCH . This branch aims to generate a semantically-adaptive kernel at each location according to the semantic information , which consists of four modules , i.e. , Feature Channel Compression , Semantic Kernel Generation , Feature Shuffle , and Channel-wise Normalization . Feature Channel Compression . This module is used to reduce the network parameters and computational cost . Specifically , the input feature f is fed into a convolution layer with 1×1 kernel to compress the input channel from C to C ′ , making SA-UpSample with fewer network parameters . Semantic Kernel Generation . This module receives the feature fc∈RC ′×H×W as input ( where H and W denotes the height and width of the feature map ) and ties to generate different semanticallyadaptive kernels , which can be represented as fk∈Rk 2s2×H×W , where k is the semantically-adaptive upsampling kernel size and s is the expected upsample scale . Feature Shuffle . We then feed the feature fk through a feature shuffle layer for rearranging elements in fk , leading to a new feature map fs∈Rk 2×Hs×Ws , where k2=k×k represents the learned semantic kernel . Note that the learned semantic kernels are quit different at different locations l′ , as shown in Fig . 1 and 3 . Channel-wise Normalization . After that , we perform a channel-wise softmax operation on each semantic kernel fs to obtain the normalized kernel fn , i.e. , the sum of the weight values in k2 is equal to 1 . In this way , we can guarantee that information from the combination would not explode . Also , the semantically-adaptive kernels can encode where to emphasize or suppress according to the semantic information . 3.2 SEMANTICALLY-ADAPTIVE FEATURE UPSAMPLING ( SAFU ) BRANCH . This branch aims to upsample the input feature f based on the kernel fn learned in the SAKG branch in a semantically-adaptive way , which contains four modules , i.e. , Feature Spatial Expansion , Sliding Local Block Extraction , Feature Reshape , and Upsampling Feature Selection . Feature Spatial Expansion . The input feature f is fed into this module to expand the size of spatial from H×W to Hs×Ws . Specifically , we adopt the nearest interpolation to achieve this process . Sliding Local Block Extraction . Then the expanded feature fe∈RC×Hs×Ws is fed into this module to extract sliding local block of each location in fe , leading to the new feature fl∈RCk 2×Hs×Ws . Feature Reshape . Thus , we reshape fl by adding a dimension , resulting in a new feature fr∈RC×k 2×Hs×Ws . In this way , we can do multiplication between the reshaped local block fr and the learned kernel fn . Upsamling Feature Selection . Finally , the feature map fr and the kernel fn learned in the SAKG branch are fed into the Upsampling Feature Selection module to generate the final feature map f ′∈RC×Hs×Ws by an weighted sum manner . The computation process at the location l= ( i , j ) can be expressed as follow , f ′ = bk/2c∑ p=−bk/2c bk/2c∑ q=−bk/2c fr ( i+ p , j + q ) × fn ( p , q ) . ( 1 ) In this way , the pixels in the learned kernel fn contributes to the upsampled pixel l′ differently , based on the semantic information of features instead of the spatial distance of locations . The semantics of the upsampled feature map can be stronger than the original one , since the information from relevant points in a local region can be more attended , and the pixels with the same semantic label can achieve mutual gains , improving intra-object semantic consistency . 3.3 WHY DOES THE SA-UPSAMPLE WORK BETTER ? . A short answer is that it can better preserve semantic information against common upsampling methods . Specifically , while other upsampling methods such as nearest-neighbor interpolation and Deconvolution are essential parts in almost all the state-of-the-art image generation ( Radford et al. , 2016 ) and translation ( Park et al. , 2019 ) models , they tend to ‘ pollute ’ semantic information when performing feature upsampling since it would inevitably incorporate contaminating information from irrelevant regions ( see Fig . 1 ) . In contrast , the proposed SA-UpSample performs feature upsampling by using itself , i.e. , it uses the pixels belonging to the same semantic label to upsample the feature maps . Hence , the generator can better preserve semantic information . It enjoys the benefit of feature upsampling without losing the input semantic information . In Fig . 3 , we show some examples of the learned semantically-adaptive kernels . We can easily observe that the proposed SA-UpSample upsamples features by leveraging complementary features in the regions of the same semantic information than local regions of fixed shape to generate consistent objects/scenarios , further confirming our motivations . 3.4 OPTIMIZATION OBJECTIVE AND TRAINING DETAILS . We follow GauGAN ( Park et al. , 2019 ) and use three losses as our training objective , i.e. , L=λganLgan+λfLf+λpLp , where Lgan , Lf and Lp represent adversarial , discriminator feature matching , and perceptual loss , respectively . We set λgan=1 , λf=10 , and λp=10 in our experiments . We use the multi-scale discriminator ( Park et al. , 2019 ) as our discriminator . Moreover , we set C ′=64 , k=5 and s=2 in the proposed SA-UpSample . We replace the upsampling layers in GauGAN with our SA-UpSample layers . The proposed method is implemented by using PyTorch ( Paszke et al. , 2019 ) . We conduct the experiments on NVIDIA DGX1 with 8 32GB V100 GPUs .
This paper proposes a semantically-adaptive upsampling approach for layout-to-image translation. It uses the semantic label map to predict spatially-adaptive upsampling kernels for feature map upsampling. Compared with traditional upsampling methods, it has a larger receptive field to focus on not only nearby pixels, but also semantically-related pixels at a longer distance. Experiments are conducted on Cityscapes, ADE20K, COCO-Stuff, DeepFashion, CelebAMask-HQ, and Facades datasets, and the proposed approach achieves better results compared with the baseline.
SP:9cc61518a96c3aebe0869a87fc84ea2e13c752e5
Semantically-Adaptive Upsampling for Layout-to-Image Translation
1 INTRODUCTION . The layout-to-image translation task aims to translate input layouts to realistic images ( see Fig . 1 ( a ) ) , which have many real-world applications and draw much attention from the community ( Park et al. , 2019 ; Liu et al. , 2019 ; Jiang et al. , 2020 ; Tang et al. , 2020 ) . For example , Park et al . ( 2019 ) propose GauGAN with a novel spatially-adaptive normalization to generate realistic images from semantic layouts . Liu et al . ( 2019 ) propose CC-FPSE , which predicts convolutional kernels conditioned on the semantic layout and then generate the images . Tang et al . ( 2020 ) propose LGGAN with several local generators for generating realistic small objects . Despite the interesting exploration of these methods , we can still observe artifacts and blurriness in their generated images because they always adopt the nearest-neighbor interpolation to upsample feature maps and then to generate final results . Feature upsampling is a key operation in the layout-to-image translation task . Traditional upsampling methods such as nearest-neighbor , bilinear , and bicubic only consider sub-pixel neighborhood ( indicated by white circles in Fig . 1 ( b ) ) , failing to capture the complete semantic information , e.g. , the head and body of the dog , and the front part of the car . Learnable upsampling methods such as Deconvolution ( Noh et al. , 2015 ) and Pixel Shuffle Shi et al . ( 2016 ) are able to obtain the global information with larger kernel size , but learns the same kernel ( indicated by the white arrows in Fig . 1 ( c ) ) across the image , regardless of the semantic information . Other feature enhancement methods such as Spatial Attention ( Fu et al. , 2019 ) can learn different kernels ( indicated by different color arrows in Fig . 1 ( d ) ) , but it still inevitable captures a lot of redundant information , i.e. , ‘ grasses ’ and ‘ soil ’ . Also , it is prohibitively expensive since it needs to consider all the pixels . To fix these limitations , we propose a novel Semantically-Adaptive UpSampling ( SA-UpSample ) for this challenging task in Fig . 1 ( e ) . Our SA-UpSample dynamically upsamples a small subset of relevant pixels based on the semantic information , i.e. , the green and the tangerine circles represent the pixels within the dog and the car , respectively . In this way , SA-UpSample is more efficient than both Deconvolution , Pixel Shuffle , and Spatial Attention , and can capture more complete semantic information than traditional upsampling methods such as the nearest-neighbor interpolation . We perform extensive experiments on six popular datasets with diverse scenarios and different image resolutions , i.e. , Cityscapes ( Cordts et al. , 2016 ) , ADE20K ( Zhou et al. , 2017 ) , COCO-Stuff ( Caesar et al. , 2018 ) , DeepFashion ( Liu et al. , 2016 ) , CelebAMask-HQ ( Lee et al. , 2020 ) , and Facades ( Tyleček & Šára , 2013 ) . We show that with the help of SA-UpSample , our framework can synthesize better results compared to several state-of-the-art methods . Moreover , an extensive ablation study shows the effectiveness of SA-UpSample against other feature upsampling and enhancement methods for the layout-to-image translation task . 2 RELATED WORK . Feature Upsampling . Traditional upsampling methods such as nearest-neighbor and bilinear interpolations use spatial distance and hand-crafted kernels to capture the correlations between pixels . Recently , several deep learning methods such as Deconvolution ( Noh et al. , 2015 ) and Pixel Shuffle Shi et al . ( 2016 ) are proposed to upsample feature maps using learnable kernels . However , these methods either exploit semantic information in a small neighborhood or use a fixed kernel . Some other works of super-resolution , inpainting , denoising ( Mildenhall et al. , 2018 ; Wang et al. , 2019 ; Jo et al. , 2018 ; Hu et al. , 2019 ) also explore using learnable kernels . However , the settings of these tasks are significantly different from ours , making their methods can not be used directly . Layout-to-Image Translation tries to convert semantic layouts into realistic images ( Park et al. , 2019 ; Liu et al. , 2019 ; Jiang et al. , 2020 ; Tang et al. , 2020 ; Zhu et al. , 2020a ; Ntavelis et al. , 2020 ; Zhu et al. , 2020b ) . Although existing methods have generated good images , we still see unsatisfactory aspects mainly in the generated content details and intra-object completions , which we believe is mainly due to they always adopt the nearest-neighbor interpolation to upsample feature maps and then generate final results . To fix this limitation , we propose a novel Semantically-Adaptive UpSampling ( SA-UpSample ) for this task . To the best of our knowledge , we are the first to investigate the influence of feature upsampling on this challenging task . 3 SEMANTICALLY-ADAPTIVE UPSAMPLING ( SA-UPSAMPLE ) . An illustration of the proposed Semantically-Adaptive UpSampling ( SA-UpSample ) is shown in Fig . 2 , which mainly consists of two branches , i.e. , the Semantically-Adaptive Kernel Generation ( SAKG ) branch predicting upsample kernels according to the semantic information , and the Semantically-Adaptive Feature Upsampling ( SAFU ) branch selectively performs the feature upsampling based on the kernels learned in SAKG . All components are trained in an end-to-end fashion so that the two branches can benefit from each other . Specifically , given a feature map f∈RC×H×W and an upsample scale s , SA-UpSample aims to produce a new feature map f ′∈RC×Hs×Ws . For any target location l′= ( i′ , j′ ) in the output f ′ , there is a corresponding source location l= ( i , j ) at the input f , where i=bi′/sc , j=bj′/sc . We denote N ( l , k ) as the k×k sub-region of f centered at the location l in , i.e. , the neighbor of the location l. See Fig . 1 and 2 for illustration . 3.1 SEMANTICALLY-ADAPTIVE KERNEL GENERATION ( SAKG ) BRANCH . This branch aims to generate a semantically-adaptive kernel at each location according to the semantic information , which consists of four modules , i.e. , Feature Channel Compression , Semantic Kernel Generation , Feature Shuffle , and Channel-wise Normalization . Feature Channel Compression . This module is used to reduce the network parameters and computational cost . Specifically , the input feature f is fed into a convolution layer with 1×1 kernel to compress the input channel from C to C ′ , making SA-UpSample with fewer network parameters . Semantic Kernel Generation . This module receives the feature fc∈RC ′×H×W as input ( where H and W denotes the height and width of the feature map ) and ties to generate different semanticallyadaptive kernels , which can be represented as fk∈Rk 2s2×H×W , where k is the semantically-adaptive upsampling kernel size and s is the expected upsample scale . Feature Shuffle . We then feed the feature fk through a feature shuffle layer for rearranging elements in fk , leading to a new feature map fs∈Rk 2×Hs×Ws , where k2=k×k represents the learned semantic kernel . Note that the learned semantic kernels are quit different at different locations l′ , as shown in Fig . 1 and 3 . Channel-wise Normalization . After that , we perform a channel-wise softmax operation on each semantic kernel fs to obtain the normalized kernel fn , i.e. , the sum of the weight values in k2 is equal to 1 . In this way , we can guarantee that information from the combination would not explode . Also , the semantically-adaptive kernels can encode where to emphasize or suppress according to the semantic information . 3.2 SEMANTICALLY-ADAPTIVE FEATURE UPSAMPLING ( SAFU ) BRANCH . This branch aims to upsample the input feature f based on the kernel fn learned in the SAKG branch in a semantically-adaptive way , which contains four modules , i.e. , Feature Spatial Expansion , Sliding Local Block Extraction , Feature Reshape , and Upsampling Feature Selection . Feature Spatial Expansion . The input feature f is fed into this module to expand the size of spatial from H×W to Hs×Ws . Specifically , we adopt the nearest interpolation to achieve this process . Sliding Local Block Extraction . Then the expanded feature fe∈RC×Hs×Ws is fed into this module to extract sliding local block of each location in fe , leading to the new feature fl∈RCk 2×Hs×Ws . Feature Reshape . Thus , we reshape fl by adding a dimension , resulting in a new feature fr∈RC×k 2×Hs×Ws . In this way , we can do multiplication between the reshaped local block fr and the learned kernel fn . Upsamling Feature Selection . Finally , the feature map fr and the kernel fn learned in the SAKG branch are fed into the Upsampling Feature Selection module to generate the final feature map f ′∈RC×Hs×Ws by an weighted sum manner . The computation process at the location l= ( i , j ) can be expressed as follow , f ′ = bk/2c∑ p=−bk/2c bk/2c∑ q=−bk/2c fr ( i+ p , j + q ) × fn ( p , q ) . ( 1 ) In this way , the pixels in the learned kernel fn contributes to the upsampled pixel l′ differently , based on the semantic information of features instead of the spatial distance of locations . The semantics of the upsampled feature map can be stronger than the original one , since the information from relevant points in a local region can be more attended , and the pixels with the same semantic label can achieve mutual gains , improving intra-object semantic consistency . 3.3 WHY DOES THE SA-UPSAMPLE WORK BETTER ? . A short answer is that it can better preserve semantic information against common upsampling methods . Specifically , while other upsampling methods such as nearest-neighbor interpolation and Deconvolution are essential parts in almost all the state-of-the-art image generation ( Radford et al. , 2016 ) and translation ( Park et al. , 2019 ) models , they tend to ‘ pollute ’ semantic information when performing feature upsampling since it would inevitably incorporate contaminating information from irrelevant regions ( see Fig . 1 ) . In contrast , the proposed SA-UpSample performs feature upsampling by using itself , i.e. , it uses the pixels belonging to the same semantic label to upsample the feature maps . Hence , the generator can better preserve semantic information . It enjoys the benefit of feature upsampling without losing the input semantic information . In Fig . 3 , we show some examples of the learned semantically-adaptive kernels . We can easily observe that the proposed SA-UpSample upsamples features by leveraging complementary features in the regions of the same semantic information than local regions of fixed shape to generate consistent objects/scenarios , further confirming our motivations . 3.4 OPTIMIZATION OBJECTIVE AND TRAINING DETAILS . We follow GauGAN ( Park et al. , 2019 ) and use three losses as our training objective , i.e. , L=λganLgan+λfLf+λpLp , where Lgan , Lf and Lp represent adversarial , discriminator feature matching , and perceptual loss , respectively . We set λgan=1 , λf=10 , and λp=10 in our experiments . We use the multi-scale discriminator ( Park et al. , 2019 ) as our discriminator . Moreover , we set C ′=64 , k=5 and s=2 in the proposed SA-UpSample . We replace the upsampling layers in GauGAN with our SA-UpSample layers . The proposed method is implemented by using PyTorch ( Paszke et al. , 2019 ) . We conduct the experiments on NVIDIA DGX1 with 8 32GB V100 GPUs .
This paper proposes the Semantic-Adaptive UpSampling method to do feature upsample in layout-to-image translation task. The SA-UpSample module exploit the semantic information to learn adaptive upsample kernels for different input features. The proposed method has the advantage of global view, semantically-adaptive and efficient. Extensive experimental results are shown to prove the effectiveness of the proposed method. The paper is well organized and easy to follow.
SP:9cc61518a96c3aebe0869a87fc84ea2e13c752e5