G -SGD: O PTIMIZING R E LU N EURAL N ETWORKS IN ITS P OSITIVELY S CALE -I NVARIANT S PACE
A BSTRACT
It is well known that neural networks with rectiﬁed linear units (ReLU) activation functions are positively scale-invariant.
Conventional algorithms like stochastic gradient descent optimize the neural networks in the vector space of weights, which is, however, not positively scale-invariant.
This mismatch may lead to problems during the optimization process.
Then, a natural question is: can we construct a new vector space that is positively scale-invariant and sufﬁcient to represent ReLU neural networks so as to better facilitate the optimization process ?
In this paper we provide our positive answer to this question.
First, we conduct a formal study on the positive scaling operators which forms a transformation group, denoted as
G .
We show that the value of a path (i e. the product of the weights along the path) in the neural network is invariant to positive scaling and prove that the value vector of all the paths is sufﬁcient to represent the neural networks under mild conditions.
Second, we show that one can identify some basis paths out of all the paths and prove that the linear span of their value vectors (denoted as G -space) is an invariant space with lower dimension under the positive scaling group.
Finally, we design stochastic gradient descent algorithm in G -space (abbreviated as G -SGD) to optimize the value vector of the basis paths of neural networks with little extra cost by leveraging back-propagation.
Our experiments show that G -SGD signiﬁcantly
outperforms the conventional SGD algorithm in optimizing ReLU networks on benchmark datasets
I NTRODUCTION
Over the past ten years, neural networks with rectiﬁed linear hidden units (ReLU) (Hahnloser et al., 2000) as activation functions have demonstrated the power in many important applications, such as information system (Cheng et al., 2016; Wang et al., 2017), image classiﬁcation (He et al., 2016a;
Huang et al., 2017), text understanding (Vaswani et al., 2017), etc.
These networks are usually trained with Stochastic Gradient Descent (SGD), where the gradient of loss function with respect to the weights can be efﬁciently computed via back propagation method (Rumelhart et al., 1986).
Recent studies (Neyshabur et al., 2015; LeCun et al., 2015) show that ReLU networks have positively scale-invariant property, i.e., if the incoming weights of a hidden node with ReLU activation are multiplied by a positive constant c and the outgoing weights are divided by c , the neural network with the new weights will generate exactly the same output as the old one for an arbitrary input.
Conventional SGD optimizes ReLU neural networks in weight space.
However, it is clear that weight vector is not positively scale-invariant.
This mismatch may lead to problems during the optimization process (Neyshabur et al., 2015).
Then, a natural question is: can we construct a new vector space that is positively scale-invariant and sufﬁcient to represent ReLU neural networks so as to better facilitate the optimization process ?
In this paper, we provide positive answer to this question.
We investigate the positively scale-invariant space to sufﬁciently represent ReLU neural networks by the following four steps.
Firstly, we deﬁne the positive scaling operators and show that they form a transformation group (denoted as G ).
The transformation group G will induce an equivalence relationship called positive scaling equivalence .
Then, We found that the values of the paths are invariant to positive scaling operators.
Furthermore, we prove that two weight vectors are positively scale-equivalent if and only if the values of the paths in one neural network equal to those in the other neural network, given the signs of some weights unchanged.
That is to say, the values of all the paths can sufﬁciently represent a ReLU neural network.
After that, we show that the path vectors are linearly dependent.
1 We deﬁne the maximal group of paths which are linearly independent as basis path , which corresponds to the basis of the structure matrix constituted by the path vectors.
Thus, the values of the basis paths are also positively scale-invariant and can sufﬁciently to represent the ReLU neural networks.
We denote the vector whose coordinations are composed by values of basis paths as basis path value vector and call the vector space composed by basis path value vector as G -space.
In addition, we prove that the dimension of G -space is " H " smaller comparing to the weight space, where H is the total number of hidden units in a multi-layer perceptron (MLP) or feature maps in a convolutional networks (CNN).
To sum up, we ﬁnd G -space constituted by the values of the basis paths, which is positively scaleinvariant, can sufﬁciently represent the ReLU neural networks, and has a smaller dimension than the vector space of weights.
Therefore, we propose to optimize the ReLU neural networks in its positively scale-invariant space, i.e., G -space.
We design a novel stochastic gradient descent algorithm in G -space (abbreviated as
G -SGD) to optimize the ReLU neural networks utilizing the gradient with respect to the values of the basis paths.
First, we design skeleton method to construct one group of the basis paths.
Then, we develop inverse-chain rule and weight allocation to efﬁciently compute the gradient of the values of the basis paths by leveraging the back-propagation method.
Please note that by using these techniques, there is very little additional computation overhead for G -SGD in comparison with the conventional
SGD.
We conduct experiments to show the effectiveness of G -SGD.
First, we evaluate G -SGD of training deep convolutional networks on benchmark datasets and demonstrate that G -SGD achieves clearly better performance than baseline optimization algorithms.
Second, we empirically test the performance of G -SGD with different degrees of positive scale-invariance.
The experimental results show that the higher the positive scale-invariance is, the larger the performance improvement of G -SGD over SGD.
This is consistent with that, the positive scale-invariance in weight space will negatively inﬂuence the optimization and our proposed G -SGD algorithm can effectively solve this problem.
B ACKGROUNDS 2. R ELATED W ORKS
There have been some prior works that study the positively scale-invariant property of ReLU networks and design algorithms that are positively scale-invariant.
For example, Badrinarayanan et al.
(2015) notice the positive scale-invariance in ReLU netowrks, and inspired by this, they design algorithms to normalize gradients by layer-wise weight norm.
Du et al.
(2018) study the gradient ﬂow in MLP or
CNN models with linear, ReLU or Leaky ReLU activation, and prove the squared norms of gradient across different layers are automatically balanced and remained invariant in gradient descent with inﬁnitesimal step size.
In our work, we do not care whether the models are balanced or not.
Besides, many other optimization algorithms also have positively scale-invariant property such as Newton’s method and natural gradient descent.
The most related work is Path-SGD (Neyshabur et al., 2015), which also considers the geometry inspired by path norm.
This work is different from ours: 1) they regularize the gradient in weight space by path norm while we optimize the loss function directly in a positively scale-invariant space; 2) they do not consider the dependency between paths and it’s hard for them to compute the exactly path-regularized gradients.
Different from the previous works, we propose to directly optimize the ReLU networks in its positively scale-invariant space, instead of optimizing in the weight space which is not positive scale-invariant.
To the best of our knowledge, at the ﬁrst time, we solve this mismatch by theoretical analysis and an effective and efﬁcient algorithm.
2. R E LU N EURAL N ETWORKS
Let N w ( x ) :
X → Y denote a L -layer multi-layer perceptron (MLP) with weight w ∈ W ⊂ R m , the input space X ⊂ R d and the output space Y ⊂ R K .
In the l -th layer ( l = 0 , · · · , L ), there are h l nodes.
It is clear that, h
=
d, h L = K .
We denote the i l -th node and its value as O li l and o li l , respectively.
We use w l to denote the weight matrix between layer l − 1 and layer l , and use w l ( i l − 1 , i l ) to denote the weight connecting nodes O l − 1 i l − 1 and O li l .
The values of the nodes are propagated as o l = σ (( w l ) T o l − 1 ) , where σ ( · ) = max ( · , 0) is the ReLU activation function.
We use ( i 0 , · · · , i L ) to denote the path starting from input feature node O
i 0 to output node O Li L passing though hidden nodes
O 1 i 1 , · · · , O L − 1 i L − 1 .
We can also regard the network structure as a directed graph ( O , E ) , where O =
{ O 1 , · · · , O H + d + K } is the set of nodes where H denotes the number of hidden nodes and E =
{ e ij } denote the set of edges in a network where e ij denotes the edge pointing to O j from nodes O i .
We use w e , e ∈ E to denote the weight on edge e .
If | E | = m , the weights compose a vector w = ( w 1 , · · · , w m ) T .
We deﬁne a path as a vector p =
( p 1 , · · · , p m ) T and if the edge e is contained in path p , p e = 1 ; otherwise p e = 0 .
Because a path crosses L edges for an L -layer MLP, there are L elements with value 1 and others elements with value 0 .
Using these notations, the value of path p can be calculated as v p ( w ) =
(cid:81) mi
=1 w p
i
i and the activation status of path p can be calculated as a p ( x ; w ) =
(cid:81)
j : p eij
=
I
o j ( x ; w ) > 0) .
We denote the set composed by all paths as P and the set composed by paths which contain edge connecting the i 0 -th input node and the k -th output node as P i 0 ,k .
Thus, the output can be computed as follows:
[Equation]
P OSITIVELY S CALE - INVARIANT S PACE OF R E LU N ETWORKS
In this section, we ﬁrst deﬁne positive scaling transformation group and the equivalence class induced by this group.
Then we study the invariant space under positive scaling transformation group of
ReLU networks and study its dimension.
3. P OSITIVE S CALING T RANSFORMATION G ROUP
We formally deﬁne the positive scaling operator.
We ﬁrst deﬁne a node positive scaling operator g c,O ( w ) :
W → W with constant c > 0 and one hidden node O as
[Equation]
where ˜ w l ( i l − 1 , i l )
=
c · w l ( i l − 1 , i l ) for i l − 1 = 1 , · · · , h l − 1 ; ˜ w l +
( i l , i l +1 )
= 1 c · w l +1 ( i l , i l +1 ) for i
l +1 = 1 , · · · , h l +1 ; and values of other elements of ˜ w are the same with w .
Deﬁnition 3.1 ( positive scaling operator ) Suppose that { O 1 , · · · , O H } is the set of all the hidden nodes in the network where H denotes the number of hidden nodes.
A positive scaling operator g ( c 1 , ··· ,c H ) ( · ) : W → W with c 1 , · · · , c H ∈ R + is deﬁned as
[Equation]
where ◦ denotes function composition.
We then collect all the g ( c 1 , ··· ,c H ) ( · ) together to form a set G := { g ( c 1 , ··· ,c H ) ( · ) : c 1 , · · · , c H ∈ R + } .
It is easy to check that G together with the operation " ◦ " is a group which is called positive scaling transformation group , and we call the group action of G on W as G -action.
(Please refer to Sectionin Appendix.)
Clearly, if there exists an operator g ∈ G to make w = g ( w (cid:48) ) , ReLU networks N w and
N w (cid:48) will generate the same output for any ﬁxed input x .
We deﬁne the positive scaling equivalence induced by G -action.
Deﬁnition 3.2 Consider two ReLU networks with weights w, w (cid:48)
∈ W and the positive scaling transformation group G .
We say w and w (cid:48) are positively scale-equivalent if ∃ g ∈ G such that w = g ( w (cid:48) ) , denote as w ∼ G w (cid:48) .
Given G -action on W , the equivalence relation " ∼ G " partitions W into G -equivalent classes.
The following theorem shows that the sufﬁcient and necessary condition for ReLU networks in the same equivalent class is that they have the same values and activation status of paths.
Theorem 3.3 Consider two ReLU neural networks with weights w, w (cid:48) ∈ W .
We have that w ∼ G w (cid:48)
iff for ∀ path p ∈ P and any ﬁxed input x ∈ X , we have v p ( w ) = v p ( w (cid:48) ) and a p ( x ; w ) = a p ( x ; w ) .
Invariant variables for a group action are important and widely studied in group theory and geometry.
We say a function f : W → R is invariant variable of G -action if f ( w ) =
f ( g ( w )) , ∀ g ∈ G .
Based on Theorem 3.3, a direct corollary is that values and activation status of paths are invariant variables under G -action.
Considering that 1) values of paths are G -invariant variables while the weights aren’t; 2) values of paths together with the activation status determines an positive scale-equivalent class, and are sufﬁcient to determine the loss, we propose to optimize the values of paths instead of weights.
P OSITIVELY S CALE -I NVARIANT S PACE AND I TS D IMENSION
[Equation] [Equation]
v
[Equation]
A is the structure matrix of this example.
Although Theorem 3.3 shows the values of paths are invariant variables under G -action, we ﬁnd that the paths have inner-dependency and therefore their values and activation statuses are not independent.
Let us consider the example in Figure 1.
The values of paths have the relationship v p 4 ( w ) =
[Equation]
[Equation] [Equation]
p
[Equation]
1 ( w ) .
Using the vector representation of paths that is described in section 2.2, we ﬁnd that their path vectors follow the relationship p 4 =
p 2 + p 3 − p 1 , which means that they are not linearly independent.
For a feedforward ReLU neural network, we suppose that P ⊂ { 0 , 1 } m is the set composed by all path vectors.
We denote the matrix composed by all paths as A and call it structure matrix of ReLU networks.
The size of A is m × n where n is the number of paths.
We observe that the paths in matrix
A are not linearly independent.
Then we study the rank of matrix A and ﬁnd a maximal linearly independent group of paths.
Theorem 3.4 If A is the structure matrix for a ReLU network, then we have rank ( A )
= m − H , where m is the dimension of weight vector w and H is the total number of hidden nodes for MLP (or feature maps for CNN models) with ReLU respectively.
Deﬁnition 3.5 ( basis path )
A set of paths P
= { p 1 , · · · , p m − H } which is a subset of P is called a set of basis paths if p 1 , · · · , p m − H compose a maximal linearly independent group of column vectors in structure matrix A .
We design an algorithm called skeleton method to identify basis paths efﬁciently, which will be introduced in Section 4.
For given values of basis paths and structure matrix, the values of w can not be determined unless the values of free variables are ﬁxed (Lay (1997)).
Assume w s 1 , · · · , w s H are selected to be the free variables which are called free skeleton weights , we prove that the activation status can be uniquely determined by the values of basis paths if signs of free skeleton weights are ﬁxed.
Thus, we have the following theorem which is a modiﬁcation of Theorem 3.3.
Theorem 3.6 Consider two ReLU neural networks with weights w, w (cid:48)
∈ W with the same signs of skeleton weights.
We have that w ∼ G w (cid:48)
iff for ∀ p ∈ P 0 , we have v p ( w ) = v p ( w (cid:48) ) .
The detailed proof of Theorem 3.4 and Theorem 3.6 are both depends on Lemma 9.1 in Appendix.
In the following context, we always suppose that ∀ w ∈ W have the same signs of free skeleton weights.
According to Theorem 3.6 and the linear dependency between values of paths, the loss function can be calculated using values of basis paths if signs of free skeleton weights are ﬁxed.
We denote the the loss at training instance ( x, y ) as l ( v ; x, y ) and propose to optimize the values of basis paths.
Considering that values of basis paths are obtained through structure matrix A , the dimension of the space composed by values of basis paths should be equal to rank ( A ) .
Then we deﬁne the following space.
Deﬁnition 3.7 ( G -space )
The G -space is deﬁned as V :
= { v = ( v p 1 , · · · , v p m − H ) : v p j ∈ ( R / { 0 } ) m − H } .
We call the space composed by the values of basis paths G -space, which is invariant under transformation group G , i.e., it is composed by invariant variables under G -action.
Immediately, we can get the following corollary according to Theorem 3.6.
Corollary 3.8 The dimension of G -space is m − H , where m is the number of weights and H is the total number of hidden nodes for MLP or the total number of feature maps for CNN.
We measure the reduction of the dimension for positively scale-invariant space using the invariant ratio H/m , thus we can empirically test how severe this equivalence will inﬂuence the optimization in weight space.
A LGORITHM : G -SGD
In this section, we will introduce the G -SGD that optimizes ReLU neural network models in the G -space.
This novel algorithm makes use of three methods, named Skeleton Method, Inverse-Chain-Rule (ICR) and WeightAllocation (WA), respectively, to calculate the gradients w.r.t.
basis path vector and project the updates back to weights efﬁciently (with little extra computation in comparison with standard SGD).
4. S KELETON M ETHOD
Before the calculation of gradients in G -space, we ﬁrst design an algorithm called skeleton method to construct skeleton weights and basis paths for
MLP whose depth is L and width is h .
Construct skeleton weights: for weight matrix w 2 , · · · , w L − 1 , we select diagonal elements to be the skeleton weights .
For weight matrix w 1 , we select the element w 1 ( i 1 mod d, i 1 ) for column i 1 with i 1 = 1 , · · · , h 1 to be the skeleton weights .
For weight matrix w L , we select the element w L ( i L − 1 , i L − 1 mod K ) for row i L − 1 with i L − 1 = 1 , · · · , h L − 1 to be the skeleton weights .
We call the rest weights non-skeleton weights.
Figure 2 gives an illustration for skeleton weights in a MLP network.
Construct basis paths: A path which contains at most one non-skeleton weights is a basis path.
The proof of this statement could be found in Appendix.
For example , in Figure 2, the paths in red color and the paths with only one black weight are basis paths.
Beyond that, the paths are non-basis paths.
Once we have basis paths, we can calculate the gradients w.r.t.
basis path vector v p i , and iteratively update the model by
[Equation]
where S t is the mini-batch training data in iteration t .
For the calculation of the gradients w.r.t.
basis path vector, we introduce inverse-chain-rule method in next section.
4. I NVERSE -C HAIN -R ULE (ICR) M ETHOD
The basic idea of the Inverse-Chain-Rule method is to connect the gradients w.r.t.
weight vector and those w.r.t.
basis path vector by exploring the chain rules in both directions.
That is, we have, ( ∂l ( w ; x, y )
[Equation]
We ﬁrst compute the gradients w.r.t.
weights, i.e., ∂l ( w ; x,y ) ∂w i for i
= 1 , · · · , m using standard back propagation.
Then we solve Eqn.(3) to obtain the gradients w.r.t.
basis paths, i.e., ∂l ( v ; x,y ) ∂v j for j = 1 , · · · , m − H .
We denote matrix at the right side of Eqn.(3) as G .
Given the following facts:
[Equation]
=
[Equation]
p w e if the edge e is contained in path p , otherwise 0; (2) according to the skeleton method, each non-skeleton weight will be contained in only one basis path, which means there is only one non-zero element in each column corresponding to non-skeleton weights in G , G is sparse and thus the solution of Eqn.(3) is easy to obtain.
4. W EIGHT -A LLOCATION (WA) M ETHOD
After the values of basis paths are updated by SGD, in a new iteration, we employ ICR again by leveraging BP with the new weight.
Thus, we need to project the updates on basis paths back to the updates of weights.
We deﬁne the path-ratio of p j at iteration t as R t ( p j ) :
= v tp j /v t − 1 p j and the weight-ratio of w i at iteration t as r t ( w i ) :
= w ti /w t − 1 i .
Assume that we have already obtained the path-ratio for all the basis paths R t +1 ( p j ) according to ICR method and the SGD update rule.
Then we want to project the path-ratios onto the weight-ratios.
We use the notation (cid:12) to denote the operation w (cid:12) p j = (cid:81) mi
=1 w p ji
i
Because we have v p j ( w ) = w (cid:12) p j , the weight-ratios obtained after the projection should satisfy the following relationship: R t ( p j ) =
r t ( w ) (cid:12) p j .
Generalize the operator (cid:12) from vectors to matrices 2 , we have the following relationship:
[Equation]
where the matrix A (cid:48)
= ( p 1 , · · · , p m − H ) .
According to this relationship, we design Weight-Allocation
Method to project the path-ratio to weight-ratio as described below.
Suppose that w 1 , · · · , w H are the free skeleton weights.
We ﬁrst add H elements with value 1 at the beginning in vector ( R t ( p 1 ) , · · · , R t ( p m − H )) to get a new m -dimensional vector.
Then we append H columns in matrix
A (cid:48) to get a new matrix ˜
A as ˜ A =
[ B, A (cid:48) ] with B =
[ I, 0 ] T where I is an H × H identity matrix with diagonal elements 1 and 0 is an H × m zero matrix with all elements 0 .
Then it is easy to prove that rank ( ˜ A )
= m
and we have the following relationship:
[Equation]
We can get the weight-ratio by (cid:12)
˜
A − 1 on both sides of Eq.(5).
Because we have ( r t (
[Equation]
1 ) , · · · , r t
[Equation]
m
[Equation]
A (cid:12)
[Equation] [Equation]
( r t ( w 1 ) , · · · , r t ( w m ))
(refer to Section 8 in Appendix), we have
[Equation]
After the projection, we can see that weight-ratios of free skeleton weights equal 1 which means that free skeleton weights will not be changed during the training process.
According to the skeleton method again, ˜ A is a sparse matrix and it is easy to calculate its inverse.
Actually, the projection method is not unique.
Although we choose one special projection which ﬁxed values of free skeleton weights in the Weight-Allocation method, we prove that different projection methods will results in the same updates in G -space if they don’t change the signs of free skeleton weights.
Theorem 4.1 Suppose that there are two different projections T 1 and T 2 that project the path-ratio to weight-ratio.
If the projection will not change the signs of free skeleton weights, the values of basis paths will keep the same at every iteration for two G -SGD processes that are initialized with the same values of basis paths and use different projections T 1 and T 2 in WA method respectively.
Require: initialization w 0 , learning rate η t , training data set D .
: w T .
Please note by combining the ICR and WA methods, we can obtain the explicit update rule for
G -SGD, which is concluded in Algorithm 1.
In this way, we obtain the correct gradients.
The extra computational complexity of the ICR and WA methods are far lower than that of forward and backward propagation, and can therefore be neglected in practice.
E XPERIMENTS
In this section, we ﬁrst evaluate the performance of G -SGD on training deep convolutional networks and verify that if our proposed algorithm outperforms other baseline methods.
Then we investigate the inﬂuence of positive scaling invariance on the optimization in weight space, and examine whether optimization in G space brings performance gain.
At last, we compare G -SGD with Path-SGD (Neyshabur et al., 2015) and show the necessity of considering the dependency between paths.
All experiments are averaged over 5 independent trials if without explicit note.
5. D EEP C ONVOLUTIONAL N ETWORK
In this section, we apply our G -SGD to image classiﬁcation tasks and conduct experiments on CIFAR10 and CIFAR-100 (Krizhevsky & Hinton, 2009).
In our experiments, we employ the original ResNet architecture described in (He et al., 2016a).
Speciﬁcally, there is no positive scaling invariance across residual blocks since the residual connections break down the structure matrix described in Section 3.2, we target the invariance in each residual block.
For better comparison, we also conduct our studies on a stacked deep CNN described in He et al.
(2016a)
(refer to PlainNet), and target the positive scaling invariance across all layers.
We train 34 layers ResNet and PlainNet models on the datasets following the training strategies in the original paper, and compare the performance between
G -SGD 3 and vanilla SGD algorithm.
The detailed training strategies could be found in Appendix.
In this section, we focus on the performance of different optimization algorithms, and will discuss the combination of G -SGD and regularization in Appendix.
[Table]
As shown in Figure 3 and Table 1, our G -SGD clearly outperforms SGD on each network and each dataset.
To be speciﬁc, 1) both the lowest training loss and best test accuracy are achieved by
[Figure]
ResNet-34 with G -SGD on both datasets, which indicates that G -SGD indeed helps the optimization of ResNet model; 2) Since G -SGD can eliminate the inﬂuence of positive scaling invariance across all layers of PlainNet, we observe the performance gain on PlainNet is larger than that on ResNet.
For
PlainNet model, G -SGD surprisingly improves the accuracy numbers by 0.8 and 5.7 for CIFARand CIFAR-100, respectively, which veriﬁes both the improper inﬂuence of positive scaling invariance for optimization in weight space and the beneﬁt of optimization in G space.
Moreover, Plaintrained by G -SGD achieves even better accuracy than ResNet-34 trained by SGD on CIFAR-10, which shows the inﬂuence of invariance on optimization in weight space as well.
5. T HE I NFLUENCE OF I NVARIANCE
In this section, we study the inﬂuence of invariance on the optimization for ReLU Networks.
As proved in Section 3, the dimension of weight space is larger than G -space by H , where H is the total number of the hidden nodes in a MLP or the feature maps in a CNN.
We deﬁne the invariant ratio as H/m .
We train several 2-hidden-layer MLP models on Fasion-MNIST (Xiao et al., 2017) with different number of hidden nodes in each layer, and analyze the performance gap ∆ between the models optimized by G -SGD and SGD.
The detailed training strategies and network structures could be found in Appendix.
[Figure]
From Figure 4, we can see that, 1) for each number of H , G -SGD clearly outperforms SGD on both training loss and test error, which veriﬁes our claim that optimization loss function in G space is a better choice; 2) as H increases, the invariant ratio decreases and ∆ gradually decreases as well, which provides the evidence for that the positive scaling invariance in weight space indeed improperly inﬂuences the optimization.
5. C OMPARISON WITH P ATH -SGD
In this section, we compare the performance of Path-SGD and that of G -SGD.
As described in Section 2.1, Path-SGD also consider the positive scaling invariance, but 1) instead of optimizing the loss function in G -space, Path-SGD regularizes optimization by path norm; 2) Path-SGD ignores the dependency among the paths.
We extend the experiments in Neyshabur et al.
(2015) to G -SGD without unbalance initialization, and conduct our studies on MNIST and CIFAR-10 datasets.
The detailed training strategies and description of network structure can be found in Appendix.
[Figure]
As shown in Figure 5, while Path-SGD achieves better or equally good test accuracy and training loss than SGD for both MNIST and CIFAR10 datasets, G -SGD achieves even better performance than
Path-SGD, which is consistent with our theoretical analysis that considering the dependency between the paths and optimizing in G -space bring beneﬁt.
C ONCLUSION
In this paper, we study the G -space for ReLU neural networks and propose a novel optimization algorithm called G -SGD.
We study the positive scaling operators which forms a transformation group
G and prove that the value vector of all the paths is sufﬁcient to represent the neural networks.
Then we show that one can identify basis paths and prove that the linear span of their value vectors (denoted as G -space) is an invariant space with lower dimension under the positive scaling group.
We design
G -SGD algorithm in G -space by leveraging back-propagation.
We conduct extensive experiments to verify the empirical effectiveness of our proposed approach.
In the future, we will examine the performance of G -SGD on more large-scale tasks
A PPENDIX : G -SGD: O PTIMIZING R E LU N EURAL N ETWORKS IN ITS P OSITIVELY S CALE -I NVARIANT SPACE
The Appendix document is composed of examples of skeleton weights and basis paths for different
MLP structures, proofs of propositions, lemmas and theorems and the additional information about the experiments in the paper Optimization of ReLU Neural Networks using G -Stochastic Gradient
Descent
[Table]
N OTATIONS
[Table]
network
[Table] [Table]
[Table]
S OME C ONCEPTS IN A BSTRACT A LGEBRA
Deﬁnition 8.1 ( Transformation group ) Suppose that G is a set of transformations, and ◦ is an operation deﬁned between the elements of G .
If G satisﬁes the following conditions: 1) (operational closure) for any two elements g 1 , g 2 ∈ G , it has g 1 ◦ g 2 ∈ G ; 2) (associativity) for any three elements g 1 , g 2 , g 3 ∈ G , it has ( g 1 ◦ g 2 ) ◦ g
= g 1 ◦
( g 2 ◦ g 3 ) ; 3) (unit element) there exists unit element e ∈ G , so that for any element g ∈ G , there is g ◦ e
= g ; 4) (inverse element) for any element g ∈ G , there exists an inverse element g − 1 ∈ G of g
such that g ◦ g − 1 = e .
Then, G together with the operation " ◦ " is called a transformation group.
Deﬁnition 8.2 ( Group action )
If G is a group and W is a set, then a (left) group action φ G , W of G on W is a function φ G , W : G × W
→ W that satisﬁes the following two axioms (where we denote φ ( g, w ) as g · w ): 1) (identity) e · w = w ; 2) (compatibility) ( g ◦ h ) · w = g ◦ ( h · w ) for all g, h ∈ G and all w ∈ W .
Deﬁnition 8.3 ( Operation (cid:12) )
We deﬁne (cid:12) as a right group action for matrix W m × s =
[ w ij ] i =1 , ··· ,m ; j =1 ··· ,s with w ij ∈ ( R / { 0 } ) as:
[Equation]
where A s × n = [ a jk ] i =1 , ··· ,s ; k =1 , ··· ,n is a matrix with a ij ∈ R .
According to the deﬁnition, we can prove that W (cid:12) A (cid:12) A − 1 =
W if A is a square matrix.
We use
A − 1 =
[˜ a kz ] k =1 , ··· ,s ; z =1 , ··· ,s .
Then the element at the b -th row and c -th column of W (cid:
) A (cid:12)
A −is calculated as
[Equation]
When j = c , (cid:80) sk =1 a jk ˜ a kc = 1 ; otherwise, (cid:80) sk =1 a jk ˜ a kc = 0 .
Thus we have (cid:81) sj =1 sgn ( w bj ) · (cid:81) sk =1 ( (cid:81) sj =1 ·| w bj | a jk ) ˜ a kc = w bc ) .
Thus we have prove the claim: W (cid:12) A (cid:12) A − 1 = W .
Thus Eq.(6) in the main paper is established.
P ROOFS OF T HEORETICAL R ESULTS
In this section, we will provide proofs of the lemma and theorems in Section 3 of the main paper.
9. P ROOF OF T HEOREM 3.
Theorem 3.3: Consider two ReLU neural networks with weights w, w (cid:48) ∈ W .
We have that w ∼ w (cid:48)
iff for ∀ path p and ∀ input x ∈ X , we have v p ( w ) = v p ( w (cid:48) ) and a p ( w, x )
= a p ( w (cid:48) , x ) .
Proof: For the necessity, if w ∼ w (cid:48) , then there exist a positive scaling operator g ( · ) to make g ( w (cid:48) )
=
w .
We use i l to denote the node index of nodes in layer- l and i l ∈ [ h l ] .
Then we have w l ( i l
[Equation]
1 , i l ) =
[Equation]
c
[Equation]
· w
[Equation]
l ( i l − 1 , i l ) for l = 2 , · · · , L − 1 , because each weight may be modiﬁed by the operators of its connected two nodes g c
[Equation] [Equation]
1 and g c lil ,O lil .
Thus v p ( w ) = v p ( w (cid:48) ) is satisﬁed because
[Equation]
Next we need to prove that a p ( w, x ) = a p ( w (cid:48) , x ) is also satisﬁed.
Because the value of the activation is determined by the sign of o l , l = { 1 , · · · , L − 1 } , we just need to prove that
[Equation]
where c li l , i l ∈ [ h l ] , l ∈
[ L − 1] are positive numbers.
We prove it by induction.
(1) For o 1 of a L -layer MLP ( L > 2 ): Suppose that σ ( · ) is a ReLU activation function.
For the i 1 -th hidden node, we have
[Equation]
) For
o l of the L -layer MLP ( l >
2 ): Suppose that
[Equation]
Then we have o lw,i l = σ
[Equation]
Thus we ﬁnish the proof of necessity.
For the sufﬁciency, we need to prove that if v p ( w ) = v p ( w (cid:48) ) and a p ( w, x ) = a p ( w (cid:48) , x ) for ∀ path p and ∀ input x ∈ X , there exists g ∈ G to make w (cid:48)
=
g ( w ) .
First, for hidden node O 1 i 1 in layer-1, we claim that their incoming weights satisfy the following relationship:
[Equation]
Because there exist path p z 1 , · · · , p z h 0 ∈ P to make
[Equation]
[Equation] [Equation]
[Equation]
) , and v p ( w ) = v p ( w (cid:48) ) for any p , we have
[Equation]
Then the claim is established.
Then we prove each c 1 i 1 is positive.
If there exist a constant c 1 i 1 is negative, then o 1 i 1 ( w, x ) (cid:54)
=
o 1 i 1 ( w (cid:48) , x ) .
If o li l ( w, x ) > 0 , we have o li l ( w (cid:48) , x ) = 0 .
Here we assume that x ∈ X where X is a compact set to make that a p ( w, x ) = a p ( w (cid:48) , x ) , ∀ p, ∀ x is equivalent to sgn ( o li l ( w, x ))
=
sgn
( o li l ( w (cid:48) , x )) , ∀ x, ∀ l = 1 , · · · , L .
Thus all the c 1 i 1 for i 1 = 1 , · · · , h 1 are positive.
Then we use the operator g c 11 ,O 11 ◦ · · · ◦ g c 1 h 1 ,O 1 h 1 ( w ) to make the two networks with the same weights at layer 1.
Then based on the networks with the same weights at layer 1, we gradually deal with the weights in other layers from layer 2 to the last layer using similar techniques as layer 1.
We can ﬁnally construct g ∈ G .
Thus we ﬁnish the proof of the sufﬁciency.
(cid:3)
9. P ROOF OF T HEOREM 3.4 AND T HEOREM 3.
In order to prove Theorem 3.4 and Theorem 3.6, we need to prove that there exist a group of paths which are independent and can represent other paths, and the activation status can be calculated using values of basis paths and signs of free skeleton weights.
In order to simplify the proof, we leverage the basis paths constructed by skeleton method.
We only show the proof of the following lemma, from which we can easily get Theorem 3.4 and Theorem 3.6.
Lemma 9.
The paths selected by skeleton method are basis paths and a p ( w, x ) can be calculated using signs of free skeleton weights and the values of basis paths in a recursive way.
Proof sketch: Let us consider the matrix A (cid:48)
= ( p 1 , · · · , p m − H ) composed by basis paths constructed by skeleton method:
[Equation]
There is an identity matrix with size z × z where z is the number of skip skeleton paths.
This identity matrix means that w i is a non-skeleton weight and is contained in p i , i ≤ z .
Thus, through the row transformation of the matrix, B 1 can be transformed to zero matrix.
According to skeleton method, column vectors in B 2 are independent because skeleton weight will only appear in one all-basis path.
Thus the independent property has been proved.
Furthermore, by leveraging the structure of matrix A (cid:48) , it is easily to check that for a non-skeleton path p , it can be calculated as p = (cid:80) zi
=1 α i p i − (cid:80) m
− H j
= z +1 α j p
j where α
i = 0 or 1 and α j = 0 , 1 , 2 · · · , L − 1 .
More speciﬁcally, if p contains w i , i ≤ z , then α i = 1 ; otherwise, α i = 0 .
For the second statement, because the activation status is determined by all the o li l ( x ) , we just need to prove the sign of o li l ( x ) is determined by the value of basis path vector v .
For each hidden node
O li l , there exist only one basis path which passes it and only contain skeleton weights (We call the basis path which contains only skeleton weights all-basis path ).
We denote the value of all-basis path which passes O l i l as v p a ( O l i l ) =
w 1 ( O l i l ) · (cid:81)
Lj =2 w j ( O li l ) , where w j ( O l i l ) denotes the skeleton weight of p a ( O li l ) at the j -th layer which is also an skeleton outgoing weight for one hidden node.
We will prove o li l ( x ) can be calculated as
[Equation]
where F li l ( v ; x ) is a function which is determined by v and the input x .
If Eqn(11) is satisﬁed, the sign of o li l ( x ) can be determined as following:
[Equation]
Next we prove Eqn(11) by induction.
(1) For l = 1 ,
[Equation]
where v p s ( w 1 ( i 0 , i 1 ))) is the value of basis path which contains w 1 ( i 0 , i 1 ) and w j ( O 1 i 1 ) is the outgoing skeleton weight (free skeleton weight) of O 1 i 1 .
It means that Eqn(11) is satisﬁed with
F 1 i 1 ( v ; x ) =
[Equation] [Equation]
) · x
[Equation]
(2) For l > 1 , suppose that o l − 1 i l [Equation] 1 ( x ) =
[Equation]
Thus we have ﬁnished the proof the second statement
[Equation]
9. P ROOF OF C OROLLARY 3.
Corollary 3.8 The dimension of G -space is m − H , where m is the number of weights and H is the total number of hidden nodes for MLP or the total number of feature maps for CNN.
Proof: The dimension of a mathematical space (or object) means that the minimum number of coordinates needed to specify any point within it.
When the signs of free variables are ﬁxed, the number of the variables which are used to represent the output of ReLU neural networks is m − H according to Theorem 3.4.
Thus the dimension of G -space is m − H .
9. P ROOF OF T HEOREM 4.
Theorem 4.1: Suppose that there are two different projections T 1 and T 2 that project the path-ratio to weight-ratio.
If the projection will not change the signs of free skeleton weights, the values of basis paths will keep the same at every iteration for two G -SGD processes that are initialized with the same values of basis paths and use different projections T 1 and T 2 in WA method respectively.
Proof: In fact, the gradients of basis paths only depends on the values of basis paths and are independent with how the weights distribute.
Speciﬁcally, suppose that the two training processes start from the same initial point, i.e., v 0(1)
= v 0(2) .
Because the values of paths and the activation status can be calculated using values of basis paths when the signs of free skeleton weights are ﬁxed, the loss functions can be represented using the values of basis paths.
Then the neural network with equal values of basis paths will produce the same gradient of basis paths.
After one step of SGD, we have v 1(1)
= v 1(2) .
Then all the path ratios are also the same, i.e.,
R 0(1)
( p i )
=
R 0(2) ( p i ) for every basis path p
i .
Then we use T 1 and T 2 to project the path ratios to weight ratios.
Although T 1 ( R 0(1) ( p i )) (cid:54) =
T 2 ( R 0(2) ( p i )) , the two networks are still have equal values of basis paths after the projection, which means they are still in the same equivalent class.
Again, the neural network with equal values of basis paths will produce the same gradient of basis paths.
So the values of basis paths will always keep the same during the G -SGD process.
A PPENDIX I NFORMATION OF THE G -SGD A LGORITHM 10. U PDATE R ULE AND T IME C OMPLEXITY OF G -SGD
Suppose that p i with i = 1 , · · · , z is the basis path containing one non-skeleton weight (denoted as w i ), and p j with j = z
+ 1 , · · · , m − H is the basis path containing skeleton weights only, w j is its skeleton weights at layer 1 , and w k is the free skeleton weights that are not updated.
First, according to the ICR Method, we can get the update rule of value of skeleton paths as below,
[Equation]
Combined with the weight allocation method, we can get the update rule of G -SGD as follows:
[Equation]
where r t ( w j : p i ) is ratio of the skeleton weight w j at layer 1 which is contained in basis path p i .
If the free skeleton weights w k are initialized as [Equation] then v tj = w tj .
Thus we can ﬁrst calculate the path-ratio for all-basis paths:
[Equation]
According to the WA method [Equation] r t ( w j : p i ) =
R t ( p j ) .
Then the update rule for different kinds of weights can be classiﬁed into the following three types
[Equation]
[Equation] [Equation] where r t ( w j : p i ) is ratio of the skeleton weight w j at layer 1 which is contained in basis path
p
i , w j denotes the skeleton weight at layer 1 , w i denotes the non-skeleton weight and w k denotes the free skeleton weights (the skeleton weights that not in layer 1 ).
The forward and backward propagation take the dominating time in both mini-batch SGD and G -SGD.
To be speciﬁc, if the mini-batch size is B , the forward and backward propagation would both take
BT time.
Comparing with SGD, the extra computation is the calculation of R t ( p j ) , which the time complexity is independent with the mini-batch and is equal to the update step in SGD.
Thus the time complexity of G -SGD is upper bound by O (( B + 1) T ) .
Please see the training throughput of our experiments on GPU server in Section 11.1.
10. S KELETON M ETHOD FOR R ES N ET AND ICR M ETHOD FOR B ATCH N ORMALIZATION
For ResNet, we implement the skeleton method to construct skeleton weights and basis paths in each residual block.
Because of the skip-connection, there is an identity weight which doesn’t change during the optimization.
Thus, if the skip-connected weight connects node O , there isn’t a positive scaling operator g O,c ∈ G to make w ∼ g O,c ( w ) .
So we can’t construct basis paths for the whole network.
The invariance of ResNet only exists in each residual block.
In this sense, the equivalence of invariance is less severe than other neural network structure.
Because of the existence of the batch-normalization layers, the output of neural network with BN is ˆ o ijl =
o
lij − µ j √ σj + (cid:15) , where o lij means the j -th output in layer- l which is calculated using the i -th sample, µ j = 1 b (cid:80) [-bi 0 =
-]{+b i 
+}
{+=
+} o l ij is the expectation of o ij , i = 1 , · · · , b and σ 2 j = 1 b (cid:80) b i =1 ( o l ij − µ j ) 2 is the variance.
Assume that o lij = w lj o l − 1 i and the inputs o l − 1 i has expectation 0 and variance 1 (It can be roughly satisﬁed for neural networks with BN.), we have σ 2 j ≈ (cid:107) w lj (cid:107) 2 .
If we deﬁne the value of a path as v w ( p ) = (cid:81) Ll
=1 w l ( i l − 1 ,i l ) (cid:107)
[Equation]
where w li l denotes the incoming weight vector of node O li l .
Thus the loss function of the NN with BN layers can be approximately represented as l ( v ; x, y ) .
Thus inverse-chain-rule for NN with BN layer can be approximated by the following equations.
If w is an incoming weight of node O , we have
[Equation]
which results in
[Equation]
Then we use the above equation in the ICR methods.
A PPENDIX I NFORMATION OF THE E XPERIMENTS 11.
[Figure] We implement our G -SGD using the Pytorch framework with v0.31 stable release, and conduct our experiments comparing with Pytorch built-in SGD optimizer.
Our experiments are conducted on a
GPU server with 4 NVIDIA GTX Titan Xp GPUs and PCI switch.
We show the training throughput (processing images per second) on CIFAR-10 dataset with SGD and G -SGD optimizer on different network architectures.
The multi-GPU training is done by Pytorch built-in multiple GPU module torch.nn.parallel.
DataParallel based on NCCL.
As shown in Figure 6, when the mini-batch size is set to 128, the training throughput of G -SGD is slightly lower than vanilla SGD by about 7%, which indicates that our implementation of G -SGD is indeed efﬁcient.
11. I NITIALIZATION M ETHOD OF S KELETON W EIGHTS
According to our analysis in the main paper, only the signs of skeleton weights matter the optimization.
Thus we need to determine the signs of skeleton weights before training process.
For the absolute value of skeleton weights, we can see from section 10.1 that different absolute value of skeleton weights well determine different scale of learning rate.
Although our theoretical results show that the absolute value of skeleton weights can be randomly set, we choose them to be 1 for easier learning rate tuning and robustness.
In order to verify how signs of skeleton weights inﬂuence the performance.
We test the performance for various combination of signs for them on image classiﬁcation task (see section 5.2).
Results shows that there are no differences for them.
A intuitive explanation is that the selected network model is over-parameterized and the approximation ability will not be inﬂuenced by signs of skeleton weights.
For simplicity, we initialize the value of skeleton weights as 1 .
11. O PTIMIZING 110- LAYER R ES N ET WITH G -SGD
In this section, we study the optimization performance of G -SGD on deeper ResNet model withlayers.
We employ the same training strategies on both model structures, which are detailed described in next subsection.
As we can see in the Figure 7 and Table 5, our G -SGD clearly outperforms
SGD on both shallow and deep ResNet model.
The best test accuracy on ResNet-110 are achieved with G -SGD on both dataset, which meets the same conclusions in Section 5.1.Please note that deeper ResNet doesn’t signiﬁcantly outperform shallow ResNet on CIFAR-100 dataset, which also be observed in the original ResNet paper
He et al.
(2016a)
and the authors propose a new ResNet architecture to solve this problem in He et al.
(2016b).
[Figure]
11. D ETAILED T RAINING S TRATEGIES IN S ECTION 5.1 AND 11.
In previous experiment section, we extend our G -SGD to deep convolutional networks.
CIFAR10 and CIFAR-100 have been used in the experiment.
We apply random crop to the input image by size of 32 with padding 4, and normalize each pixel value to [0,1].
We then apply random horizontal ﬂipping to the image.
The mini-batch size of 128 is used in this experiment.
The training is conducted for 64k iterations.
We follow the learning rate schedule strategy in the original paper [Table] (He et al., 2016a), speciﬁcally, the initial learning rates of vanilla SGD and G -SGD are set to 1.
and then divided by 10 after 32k and 48k iterations.
The ResNet implementation can be found in https://github.com/pytorch/vision/ and the models are initialized by the default methods in PyTorch.
11. T HE C OMBINATION OF G -SGD AND R EGULARIZATION
The optimization algorithms achieve better generalization performance on test dataset by combining with proper regularization methods.
In the previous experiments, we focus on the difference performance of optimization algorithms.
In this section, we conduct the experiments to investigate the combination of G -SGD and regularization.
In weight space, weight norm is widely used as regularization for ReLU networks (He et al., 2016a; Huang et al., 2017).
Recently, (Zheng et al., 2018) propose the basis path norm in G -space.
In this section, we reproduce the experiments in (He et al., 2016a; Zheng et al., 2018) on SGD regularized by weight norm (SGD+WD) and G -SGD regularized by basis path norm ( G -SGD+BPR), and extend them on CIFAR-100 dataset.
The learning rate of 1.0 is widely used to train ResNet model and its variants on CIFAR dataset, hence we employ it in our experiment as well.
We do a wide range grid search for the hyper-parameter λ for weight decay and basis path regularization from { 0 . 1 , 0 . 2 , 0 . 5 } × 10 − α , where α ∈ { 3 , 4 , 5 , 6 } , and report the best performance based on the CIFAR-10 validation set.
We use the same hyper-parameter on
CIFAR-100 dataset.
11. D ETAILED T RAINING S TRATEGIES IN S ECTION 5.
In this section, our aim is to verify the inﬂuence of invariance to optimization in weight space.
We train several 2-hidden-layer MLP models with different invariant ratio (i.e. H/m ) on Fasion dataset.
The original size of input image is 28 × 28 .
We normliazed the input data, and to reduce the dimensions of input feature, we downsample the image to 7 × 7 by using average pooling.
The network structue is followed by [49: h : h :10] where h is the number of hidden nodes in each layer.
The detailed model properties are shown in table 6.
All models are initialized by (He et al., 2015) except the skeleton weights which is mentioned in Section 4 without explicit note.
We use the learning rate of 0.01 and mini-batch size of 64 for vanilla SGD and G -SGD, and train each model for 100 epochs.
[Table]
As shown in Figure 8 and 9, the G -SGD achieves clearly better performance than SGD with combining regularization method on all models and all datasets.
To be speciﬁc, the test accuracy of 94.29% is gained by ResNet-34 trained by SGD and weight decay on CIFAR-10 dataset (the number reported in (He et al., 2016a) is 91.25%), while G -SGD with basis path regularization improves the test accuracy to 94.67%.
On CIFAR-100 dataset, the test accuracy of ResNet-34 trained by SGD and weight decay is 74.39% (the ResNet-34 result on CIFAR-100 hasn’t been reported in He et al.
(2016a), a result of ResNet-110 with similar training strategy on this dataset is reported in Zagoruyko & Komodakis (2016) which is 74.84%), while G -SGD with basis path regularization improves the test accuracy to 75.20%.
The experimental results verify our analysis again that optimization in G -space is a better choice. [Figure] [Figure] [Figure]
D ETAILED T RAINING S TRATEGIES IN S ECTION 5.
Path-SGD (Neyshabur et al., 2015) also notice the positive scale invariance in neural networks with linear or ReLU activation.
Instead of optimizing the loss function in G -space, they use path norm as regularizer to the gradient in weight space.
Meanwhile, the dependency among all paths hasn’t been noted, which leads to the computation overhead of the gradient of path norm is very high.
In section 5.3, we extend the experiments in (Neyshabur et al., 2015) to G -SGD on MNIST and CIFARdataset.
A 5-hidden-layer MLP model is used in this experiment with 64 units in each layer.
We do grid search for the learning {+rate of each algorithm from 1 . 
 × 10 − α , where α is an integer betweento 10. We report the best result for each algorithm. The mini-batch size of 64 is used, and the input images of gray scale are normalized to [0 , 1] .+}