G -SGD: O PTIMIZING R E LU N EURAL N ETWORKS IN ITS P OSITIVELY S CALE -I NVARIANT S PACE
Anonymous authors
Paper under double-blind review
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., 2016;
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 and can sufﬁciently represent the ReLU neural networks.
After that, we deﬁne a generalized addition as the product operator and the generalized multiplication as the power operator.
We show that the path vectors are generalized linearly dependent.
1 We deﬁne the maximal group of paths which are generalized 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 linear span of the values of basis paths 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 k -th output node as P 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.
3. P OSITIVELY S CALE -I NVARIANT S PACE AND I TS D IMENSION
[Equation]
[Equation] [Equation]
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 (see Figure 1).
In order to describe this dependency clearly, we introduce a new representation of paths.
First, we deﬁne the addition operation " ⊕ " and scalarmultiplication operation " (cid:12) " in space ( R / { 0 } ) m as: w
[Equation]
where w, w (cid:48) ∈ ( R / { 0 } ) m , α ∈ R + .
We call the space ( R / { 0 } ) m equipped with addition operation " ⊕ " and scalar-multiplication operation " (cid:12) " is a generalized linear space (Please refer to Section 8 in
Appendix).
Next we will consider representation of path and operations on path in the generalized linear space.
As described in Section 2.2, each path can be represented as a m -dimensional vector p
=
( p 1 , · · · , p m ) that each element equals 0 or 1 .
In the generalized linear space, considering that 1 and e are the additive identity and multiplicative identity in the ﬁeld R + equipped with " ⊕ " and " (cid:12) ", we assignto p e if p e = 0 and assign e to p e if p e = 1 .
Then p =
( p 1 , · · · , p m ) T becomes a vector that each element equals 1 or e .
Thus the value of path p can be calculated by the inner product of the weight vector and the path vector, i.e., v p ( w ) = (cid:104) w, p (cid:105) , where w = ( w 1 , · · · , w m ) .
Suppose that P ⊂ { 1 , e } m is the set composed by all paths.
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, i.e.,some paths can be linearly represented by other columns.
For example in Figure 1, p 4 = p 2 ⊕ p 3 (cid:9) p 1 and the corresponding values of paths have the relationship: v p 4 ( w ) = v p 2 ( w ) · v p
[Equation]
Thus we need to 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 are called 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 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) ) .
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 = (cid:104) w, p j (cid:105) , w ∈
( R / { 0 } ) m , p j ∈ P 0 } .
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.
Besides, 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.
Due to space limitation, we only show the MLP case with same number of hidden nodes in each hidden layer, and put the skeleton method for general case in Appendix.
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,
[Equation]
Require: initialization w 0 , learning rate η t , training data set D .
according
skeleton
−
according
SGD to
the values of basis
path-
-ratio
t
i ) using
1 according
Update the weights as
t +1 i
Ensure w
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: (1) ∂v p
∂w
e = v p w e if the edge e is contained in path p , otherwise
; (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.
W EIGHT -A LLOCATION (WA) M ETHOD
After the values of basis paths is 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.
Because we have v p j = w (cid:12) p j , the weight-ratios obtained after the projection should satisfy 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 =
[ E, I ] T where E is an H × H identity matrix with diagonal elements
e
and I is an H × m
zero matrix with all elements 1 in generalized linear space.
Then it is easy to prove that rank ( ˜ A )
= m
and we can calculate the inverse matrix of ˜ A and get the weight-ratio as
[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.
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
CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009).
In our experiments, we employ the original
ResNet architecture described in (He et al., 2016).
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.
(2016) (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 2 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.
[Figure]
[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
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, Plain- trained 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
[Figure]
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] [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 .
We call the space ( R / { 0 } ) m equipped with addition operation " ⊕ " and scalar-multiplication operation " (cid:12) " is a generalized linear space.
Please note then it is not a vector space because R / { 0 } together with ⊕ and ⊗ where a ⊗ b = sgn ( a · b ) e ln | a |· ln | b | is not a ﬁeld.
The distributive law is not satisﬁed.
However, we still deﬁne this space to help us the identify the independent group of values of paths.
G ENERAL SKELETON METHODS AND E XAMPLES OF MLP M ODELS
w 1 , · · · , w L .
[Equation]
[Equation] [Equation]
[Equation] [Equation]
[Equation] [Equation]
j =1 { ( s, ( j mod h l +1 ))) | s ∈ S lj } ∪ { ( p sl,j , i l +1 )
| i l +1 ∈
[ h l +1 ] }} 8.
Partition set S l into S lj
= { ( i 0 , · · · i l , j ) | i 0 ∈
[ h 0 ] , · · · , i l ∈ [ h l ] , } , j ∈
[ h 2 ] according to the last element (indexed by j ) in the array.
end for
Ensure: Set S L − 1 .
In this section, we will introduce the skeleton method in Algorithm 2 in a recursive way for general case.
The algorithm will take L − 1 round.
When it takes the l -th round, it regards the network as a l -layer network with layer 1 to layer l and regards the node O l 1 , · · · , O lh l as the output nodes.
When it takes the l + 1 iteration, it regards nodes O l 1 , · · · , O lh l as hidden nodes and identify the skeleton incoming weight and skeleton outgoing weight.
Thus at each round, the number of index for the basis paths will be added by 1.
The logic for the construction of basis paths is that: 1) select one incoming skeleton weight (or incoming basis path only composed by skeleton weights) and one outgoing skeleton weight for each hidden node.
2) the paths which contain no more than one non-skeleton weight is basis paths.
Next, we use some examples to explain the types of skeleton weights, basis paths constructed by skeleton method in the main paper.
We call the basis path which only contains skeleton weights all-basis paths and basis path which contains one non-skeleton weight skip-basis paths.
First, we consider MLP models with the same number of hidden nodes of each layer Hinton et al.
Fig.6(a) shows an example of MLP model.
It only displays the skeleton weights.
We can see that the number of basis paths is three which equals the number of hidden nodes of one layer.
If the number of hidden nodes is h 1 = · · · = h L − 1 = h , by using skeleton method in Algorithm 1, the number of skeleton weights is H = hL and the number of all-basis paths equals the number of hidden nodes of one layer, which is h .
Thus we have
[Equation]
Second, we consider MLP models with decreasing number of hidden nodes, i.e., h 1 ≥ h 2 ≥ · · · ≥ h
L − 1 .
Fig.6(b) shows an example.
We can see that the number of basis paths is ﬁve which equals the largest number of hidden nodes,i.e., h 1 .
We can see that because the h l > h l − 1 , some nodes (e.g., O 21 ) will have multiple incoming weights (e.g., w 2 (1 , 1) , w 2 (5 , 1) ) which are skeleton outgoing weight for the front hidden nodes.
For these nodes, they select one of skeleton weights to be the skeleton incoming weights, which is displayed using red full line (e.g., w 2 (1 , 1) ).
Others are displayed using red dotted line (e.g., w 2 (5 , 1) ).
Thus the path which contains only skeleton weights and less than one dotted skeleton weight is a all-basis path.
We have
[Equation]
[Equation] [Equation]
[Equation] [Equation]
[Equation] [Equation]
[Figure]
Third, we consider MLP models with unbalanced number of hidden nodes of each layer.
If h l − 1 < h l and h l > h l +1 for one layer l with l ≥ 2 , there exists hidden nodes whose the skeleton incoming weight and skeleton outgoing weight are both dotted,e.g., O 24 in Fig.6(b).
In this case, the number of all-basis paths is h 1 + (cid:80) L − 2 l =1 (max { h l , h l +1 } − h l ) .
It is because that each node must be passed by at least one all-basis paths.
Thus for the example showed in Fig.6(b), although both the incoming skeleton weight and the outgoing skeleton weight of O 24 are dotted, the path (1 , 1 , 4 , 1 , 1) passed Ois all-basis path.
In this case, the number of all-basis paths is h 1 + (cid:80) L − 2 l =1 (max { h l , h l +1 } − h l ) .
[Equation]
P ROOFS OF T HEORETICAL R ESULTS IN S ECTION
In this section, we will provide proofs of the lemma and theorems in Section 3 of the main paper.
10. 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
[Equation]
l
[Equation]
[Equation] l ) for l = 2 , · · · , L − 1 , because each weight may be modiﬁed by the operators of its connected two nodes g c l − 1 il
[Equation]
1 ,O l
[Equation]
1 il
[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]
(2) For o l of the L -layer MLP ( l > 2 ): Suppose that
[Equation]
Then we have
[Equation]
l ( i l − 1 , i l ) o l − 1 w,i l − 1 ( x ) 
 =
σ   h l − 1 (cid:88)
i l − 1 =
c l − 1 i l − 1 · c li l · w (cid:48) l ( i l − 1 , i l ) · c l − 1 i l − 1 · o l − 1 w (cid:48) ,i l − 1 ( x ) 
 =
c li l · o lw (cid:48) ,i l .
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]
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 l i l ( w, x )) = sgn
( o l i 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.
[Equation]
10. 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 10.
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 li l as v p a ( O li l ) =
w 1 ( O li l ) · (cid:81)
Lj =2 w j ( O li l ) , where w j ( O li 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(28) is satisﬁed, the sign of o li l ( x ) can be determined as following:
[Equation]
Next we prove Eqn(28) 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(28) is satisﬁed with
F 1 i 1 ( v ; x ) =
(cid:80)
h
i
=1 v p s ( w 1 ( i 0 , i 1 )))
· x i 0 .
(2) For l > 1 , suppose that o l −
[Equation] [Equation]
Thus we have ﬁnished the proof the second statement.
A PPENDIX I NFORMATION OF THE G -SGD A LGORITHM 11. 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-basis edge (denoted as w i ), and p j with j = z
+ 1 , · · · , m − H is the basis path containing basis edges only, and w j is its basis edge at layer 1 .
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]
41) where R t ( p j : w i ) is ratio of the basis path p
j which contains non-basis weight w i .
If the free skeleton weights w k are initialized as 1 , then v tj = w tj .
Thus we can ﬁrst calculate the path-ratio for all-basis paths:
[Equation]
Then the update rule becomes
[Equation]
where j i is ratio of the basis path p
j which contains non-basis weight w i .
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 12.1.
11. 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 =
o lij is the expectation of o ij , i = 1 , · · · , b and σ 2 j = 1 b (cid:80) bi =1 ( o lij − µ 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
[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 12. T RAINING T HROUGHPUT OF G -SGD
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 7, 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.
12. 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 .
12. D ETAILED T RAINING S TRATEGIES IN S ECTION 5.
In this section, we extend our G -SGD to deep convolutional networks.
CIFAR-10 and CIFARhave 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 (He et al., 2016), speciﬁcally, the initial learning rates of vanilla SGD and G -SGD are set to 1.0 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.
12. 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., 2016; 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., 2016; 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 CIFARdataset.
12. 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 5.
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
[Figure]
[Table]
[Figure] [Figure]
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., 2016) 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.
(2016), 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.
12. 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] .