E XPRESSIVE POWER OF RECURRENT NEURAL NETWORKS
oseledets@skoltech.ru
A BSTRACT
Deep neural networks are surprisingly efﬁcient at solving practical tasks, but the theory behind this phenomenon is only starting to catch up with the practice.
Numerous works show that depth is the key to this efﬁciency.
A certain class of deep convolutional networks – namely those that correspond to the Hierarchical Tucker (HT) tensor decomposition – has been proven to have exponentially higher expressive power than shallow networks.
I.e. a shallow network of exponential width is required to realize the same score function as computed by the deep architecture.
In this paper, we prove the expressive power theorem (an exponential lower bound on the width of the equivalent shallow network) for a class of recurrent neural networks – ones that correspond to the Tensor Train (TT) decomposition.
This means that even processing an image patch by patch with an RNN can be exponentially more efﬁcient than a (shallow) convolutional network with one hidden layer.
Using theoretical results on the relation between the tensor decompositions we compare expressive powers of the HT- and TT-Networks.
We also implement the recurrent TT-Networks and provide numerical evidence of their expressivity.
I NTRODUCTION
Deep neural networks solve many practical problems both in computer vision via Convolutional
Neural Networks (CNNs) (LeCun et al.
; Szegedy et al.
; He et al.
and in audio and text processing via Recurrent Neural Networks (RNNs) (Graves et al.
(2013); Mikolov et al.
; Gers et al.
However, although many works focus on expanding the theoretical explanation of neural networks success (Martens & Medabalimi (2014); Delalleau & Bengio (2011);
Cohen et al.
, the full theory is yet to be developed.
One line of work focuses on expressive power , i.e. proving that some architectures are more expressive than others.
Cohen et al.
(2016) showed the connection between Hierarchical Tucker (HT) tensor decomposition and CNNs, and used this connection to prove that deep CNNs are exponentially more expressive than their shallow counterparts.
However, no such result exists for Recurrent
Neural Networks.
The contributions of this paper are three-fold.
We show the connection between recurrent neural networks and Tensor Train decomposition (see Sec. 4); 2.
We formulate and prove the expressive power theorem for the Tensor Train decomposition (see Sec. 5), which – on the language of RNNs – can be interpreted as follows: to (exactly) emulate a recurrent neural network, a shallow (non-recurrent) architecture of exponentially larger width is required;
Combining the obtained and known results, we compare the expressive power of recurrent (TT), convolutional (HT), and shallow (CP) networks with each other (see Table 2). G 2 G G
G d f ✓ ( x 1 ) f ✓ ( x 2 ) f ✓ ( x 3 ) f ✓ ( x d ) zzz d l y ( X )
D EEP L EARNING AND T ENSOR N ETWORKS
In this section, we review the known connections between tensor decompositions and deep learning and then show the new connection between Tensor Train decomposition and recurrent neural networks.
Suppose that we have a classiﬁcation problem and a dataset of pairs { ( X ( b ) , y ( b ) ) }
Nb =1 .
Let us assume that each object X ( b ) is represented as a sequence of vectors
[Equation]
which is often the case.
To ﬁnd this kind of representation for images, several approaches are possible.
The approach that we follow is to split an image into patches of small size, possibly overlapping, and arrange the vectorized patches in a certain order.
An example of this procedure is 43 … presented on Fig. 2.
We use lower-dimensional representations of { x k } dk =1 .
For this we introduce a collection of parameter dependent feature maps { f θ (cid:96) :
R n → R } m(cid:96) =1 , which are organized into a representation map
[Equation]
A typical choice for such a map is
[Equation]
A x + b ) , that is an afﬁne map followed by some nonlinear activation σ .
In the image case if X was constructed using the procedure described above, the map f θ resembles the traditional convolutional maps – each image patch is projected by an afﬁne map with parameters shared across all the patches, which is followed by a pointwise activation function.
Score functions considered in Cohen et al.
(2016) can be written in the form
[Equation]
where Φ( X ) is a feature tensor , deﬁned as
[Equation]
and W y ∈ R m × m × ...
m is a trainable weight tensor.
Inner product in Eq.
(2) is just a total sum of the entry-wise product of Φ( X ) and W y .
It is also shown that the hypothesis space of the form Eq.
(2) has the universal representation property for m → ∞ .
Similar score functions were considered in
Novikov et al.
; Stoudenmire & Schwab (2016).
Storing the full tensor W y requires an exponential amount of memory, and to reduce the number of degrees of freedom one can use a tensor decompositions .
Various decompositions lead to speciﬁc network architectures and in this context, expressive power of such a network is effectively measured by ranks of the decomposition, which determine the complexity and a total number of degrees of freedom.
For the Hierarchical Tucker (HT) decomposition, Cohen et al.
(2016) proved the expressive power property, i.e. that for almost any tensor W y its HT-rank is exponentially smaller than its CPrank.
We analyze Tensor Train-Networks (TT-Networks), which correspond to a recurrent-type architecture.
We prove that these networks also have exponentially larger representation power than shallow networks (which correspond to the CP-decomposition).
T ENSOR FORMATS REMINDER
In this section we brieﬂy review all the necessary deﬁnitions.
As a d -dimensional tensor X we simply understand a multidimensional array:
[Equation]
To work with tensors it is convenient to use their matricizations , which are deﬁned as follows.
Let us choose some subset of axes s
= { i 1 , i 2 . . .
i m s } of X , and denote its compliment by t = { j 1 , j 2 . . .
j d − m s } , e.g. for a 4 dimensional tensor s could be { 1 , 3 } and t is { 2 , 4 } .
Then matricization of X speciﬁed by ( s, t ) is a matrix
[Equation]
obtained simply by transposing and reshaping the tensor X into matrix, which in practice e.g. in
Python , is performed using numpy.reshape function.
Let us now introduce tensor decompositions we will use later.
3. C ANONICAL
Canonical decomposition, also known as CANDECOMP/PARAFAC or CP-decomposition for short (Harshman (1970); Carroll & Chang (1970)), is deﬁned as follows
[Equation]
The minimal r such that this decomposition exists is called the canonical or CP-rank of X .
We will use the following notation
[Equation]
When rank CP X = 1 it can be written simply as
[Equation]
which means that modes of X are perfectly separated from each other.
Note that storing all entries of a tensor X requires O ( n d ) memory, while its canonical decomposition takes only O ( dnr ) .
However, the problems of determining the exact CP-rank of a tensor and ﬁnding its canonical decomposition are NP-hard, and the problem of approximating a tensor by a tensor of lower CP-rank is ill-posed.
3. T ENSOR T RAIN
A tensor X is said to be represented in the Tensor Train (TT) format (Oseledets (2011))
if each element of X can be computed as follows
[Equation]
where the tensors G k ∈ R r k − 1 × n k × r k ( r 0 = r d = 1 by deﬁnition) are the so-called TT-cores .
The element-wise minimal ranks r = ( r 1 , . . .
r d − 1 ) such that decomposition (5) exists are called
TT-ranks rank TT X = r .
Note that for ﬁxed values of i 1 , i 2 . . , i d , the right-hand side of Eq. (5) is just a product of matrices
G 1 [1 , i 1 , :] G
[: , i 2 , :] . . .
G d [: , i d , 1] .
Storing X in the TT-format requires O ( dnr 2 ) memory and thus also achieves signiﬁcant compression of the data.
Given some tensor X , the algorithm for ﬁnding its TT-decomposition is constructive and is based on a sequence of Singular Value Decompositions (SVDs), which makes it more numerically stable than CP-format.
We also note that when all the TT-ranks equal to each other
[Equation]
, we will sometimes write for simplicity rank TT X = r.
3. H IERARCHICAL T UCKER
A further generalization of the TT-format leads to the so-called Hierarchical Tucker (HT) format.
The deﬁnition of the HT-format is a bit technical and requires introducing the dimension tree (Grasedyck, 2010, Deﬁnition 3.1).
In the next section we will provide an informal introduction into the HT-format, and for more details, we refer the reader to Grasedyck (2010);
Grasedyck &
Hackbusch (2011); Hackbusch (2012).
A RCHITECTURES BASED ON T ENSOR D ECOMPOSITIONS
[Equation]
[Figure]
by a d +dimensional core G .
To construct the tensorial networks we introduce bilinear and multilinear units, which perform a bilinear (multilinear) map of their inputs (see Fig.
3 for an illustration).
Suppose that x ∈ R n , y ∈ R m and G ∈ R n × m × k .
Then a bilinear unit G performs a bilinear map G : R n × R m → R k , deﬁned by the formula
[Equation]
Similarly, for x 1 ∈ R n 1 , . . .
x d ∈ R n d , a multilinear unit G ∈ R n 1 × n 2 × ..
[Equation]
× n d × n j deﬁnes a multilinear map G : (cid:81)
[Equation]
by the formula
[Equation]
In the rest of this section, we describe how to compute the score functions l y ( X ) (see Eq.
(1)) for each class label y , which then could be fed into the loss function (such as cross-entropy).
The architecture we propose to implement the score functions is illustrated on Fig.
For a vector r = ( r 1 , r 2 , . .
r d − 1 ) of positive integers (rank hyperparameter) we deﬁne bilinear units
[Equation]
with r 0 = r d = 1 .
Note that because r 0 = 1 , the ﬁrst unit G 1 is in fact just a linear map, and because r d = 1 the output of the network is just a number.
On a step k ≥ 2 the representation f θ ( x k ) and output of the unit G k − 1 of size r k are fed into the unit G k .
Thus we obtain a recurrent-type neural network with multiplicative connections and without non-linearities.
To draw a connection with the Tensor Train decomposition we make the following observation.
For each of the class labels y let us construct the tensor W y using the deﬁnition of TT-decomposition (Eq.
and taking { G k } dk
=1 used for constructing l y ( X ) as its TT-cores.
Using the deﬁnition of the Eq.
(3) we ﬁnd that the score functions computed by the network from Fig.
1 are given by the formula
[Equation]
which is veriﬁed using Eq.
(5) and Eq.
Thus, we can conclude that the network presented on
Fig.
1 realizes the TT-decomposition of the weight tensor.
We also note that the size of the output of the bilinear unit G k in the TT-Network is equal to r k , which means that the TT-ranks correspond to the width of the network.
Let us now consider other tensor decompositions of the weight tensors W y , construct corresponding network architectures, and compare their properties with the original TT-Network. X
G G G G r f ✓ ( x 1 ) f ✓ ( x 2 )
f ✓ ( x d ) l y ( X ) (a) CP-Network l y ( X )
G
G G
G G
G
Gf ✓ ( x 1 ) f ✓ ( x 2 )
f ✓ ( x 3 ) f ✓ ( x 4 ) (b) HT-Network
A network corresponding to the CP-decomposition is visualized on Fig. 4a.
Each multilinear unit
G α is given by a summand in the formula Eq.
(4), namely
[Equation]
Note that the output of each G α in this case is just a number, and in total there are rank CP W y multilinear units.
Their outputs are then summed up by the Σ node.
As before rank of the decomposition corresponds to the width of the network.
However, in this case the network is shallow , meaning that there is only one hidden layer.
On the Fig.
4b a network of other kind is presented.
Tensor decomposition which underlies it is the
Hierarchical Tucker decomposition, and hence we call it the HT-Network.
It is constructed using a binary tree, where each node other than leaf corresponds to a bilinear unit, and leaves correspond to linear units.
Inputs are fed into leaves, and this data is passed along the tree to the root, which outputs a number.
Ranks, in this case, are just the sizes of the outputs of the intermediate units.
We will denote them by rank HT X .
These are networks considered in Cohen et al.
(2016), where the expressive power of such networks was analyzed and was argued that they resemble traditional
CNNs.
In general Hierarchical Tucker decomposition may be constructed using an arbitrary tree, but not much theory is known in general case.
Our main theoretical results are related to a comparison of the expressive power of these kinds of networks.
Namely, the question that we ask is as follows.
Suppose that we are given a TT-Network.
How complex would be a CP- or HT-Network realizing the same score function?
A natural measure of complexity, in this case, would be the rank of the corresponding tensor decomposition.
To make transitioning between tensor decompositions and deep learning vocabulary easier, we introduce the following table.
[Table]
T HEORETICAL A NALYSIS
In this section we prove the expressive power theorem for the Tensor Train decomposition, that is we prove that given a random d -dimensional tensor in the TT format with ranks r and modes n , with probability 1 this tensor will have exponentially large CP-rank.
Note that the reverse result can not hold true since TT-ranks can not be larger than CP-ranks: rank TT X ≤ rank CP X .
It is known that the problem of determining the exact CP-rank of a tensor is NP-hard.
To bound CP-rank of a tensor the following lemma is useful.
Lemma 1.
Let X
i 1 i 2 ...i d and rank CP X = r.
Then for any matricization X ( s,t ) we have rank X ( s,t ) ≤ r, where the ordinary matrix rank is assumed.
Proof.
Proof is based on the following observation.
Let
[Equation]
be a CP-rank 1 tensor.
Note for any s, t [Equation] because A ( s,t ) can be written as uw T for some u and w .
Then the statement of the lemma follows from the facts that matricization is a linear operation, and that for matrices
[Equation]
B.
We use this lemma to provide a lower bound on the CP-rank in the theorem formulated below.
For example, suppose that we found some matricization of a tensor X which has matrix rank r .
Then, by using the lemma we can estimate that rank CP X ≥ r.
Let us denote n = ( n 1 , n 2 . . .
n d ) .
Set of all tensors X with mode sizes n representable in TT-format with [Equation] , for some vector of positive integers r (inequality is understood entry-wise) forms an irreducible algebraic variety (Shafarevich & Hirsch (1994)), which we denote by M r .
This means that M r is deﬁned by a set of polynomial equations in R n 1 × n 2 ...n d , and that it can not be written as a union (not necessarily disjoint) of two proper non-empty algebraic subsets.
An example where the latter property does not hold would be the union of axes x =
and y = 0 in R 2 , which is an algebraic set deﬁned by the equation
xy = 0 .
The main fact that we use about irreducible algebraic varieties is that any proper algebraic subset of them necessarily has measure
(Ilyashenko & Yakovenko (2008)).
For simplicity let us assume that number of modes d is even, that all mode sizes are equal to n , and we consider M r with r =
( r, r . . .
r ) , so for any X ∈ M r we have
[Equation]
entry-wise.
As the main result we prove the following theorem
Theorem 1.
Suppose that d = 2 k is even.
Deﬁne the following set
[Equation]
where q = min { n, r } .
Then
[Equation]
where µ is the standard Lebesgue measure on M r .
Proof.
Our proof is based on applying Lemma 1 to a particular matricization of X .
Namely, we would like to show that for s = { 1 , 3 , . . .
d − 1 } , t = { 2 , 4 , . . .
d } the following set
[Equation]
has measure 0 .
Indeed, by Lemma 1 we have
[Equation]
so if µ ( B ( s,t ) ) =
then µ ( B ) = 0 as well.
Note that B ( s,t ) is an algebraic subset of M r given by the conditions that the determinants of all q d 2 × q d 2 submatrices of X ( s,t ) are equal to 0 .
Thus to show that µ ( B ( s,t ) )
=
we need to ﬁnd at least one X such that rank X ( s,t ) ≥ q d 2 .
This follows from the fact that because B ( s,t ) is an algebraic subset of the irreducible algebraic variety M r , it is either equal to M r or has measure 0 , as was explained before.
One way to construct such tensor is as follows.
Let us deﬁne the following tensors:
[Equation]
where δ iα is the Kronecker delta symbol:
[Equation]
The TT-ranks of the tensor X deﬁned by the TT-cores (9) are equal to rank TT X =
( r, 1 , r, . . .
, r, 1 , r ) .
Lets consider the following matricization of the tensor X
[Equation]
The following identity holds true for any values of indices such that i k = 1 , . .
. , q, k = 1 , . .
, d.
[Equation]
The last equality holds because (cid:80)
[Equation]
for any i
[Equation]
= 1 , . .
q .
We obtain that
[Equation] [Equation]
where I is the identity matrix of size q d/ 2 × q d/ 2 where q = min { n, r } .
To summarize, we found an example of a tensor X such that rank TT X ≤ r and the matricization
X ( i 1 ,i 3 ,...,i d − 1 ) , ( i 2 ,i 4 ,...,i d ) has a submatrix being equal to the identity matrix of size q d/ 2 × q d/ 2 , and hence rank X ( i 1 ,i 3 ,...,i d − 1 ) , ( i 2 ,i 4 ,...,i d ) ≥ q d/ 2 .
This means that the canonical rank CP X ≥ q d/ 2 which concludes the proof.
In other words, we have proved that for all TT-Networks besides negligible set, the equivalent CPNetwork will have exponentially large width.
To compare the expressive powers of the HT- and
TT-Networks we use the following theorem (Grasedyck, 2010, Section 5.3.2).
Theorem 2.
For any tensor X the following estimates hold.
• If rank TT X ≤ r , then rank HT X ≤ r 2 .
• If rank HT X ≤ r , then rank TT X ≤ r log2( d ) / 2 .
It is also known that this bounds are sharp (see Buczy´nska et al. (2015)).
Thus, we can summarize all the results in the following Table 2.
[Table]
Example that requires exponential width in a shallow network A particular example used to prove Theorem 1 is not important per se since the Theorem states that TT is exponentially more expressive than CP for almost any tensor (for a set of tensors of measure one).
However, to illustrate how the Theorem translates into neural networks consider the following example.
Consider the task of getting d input vectors with n elements each and aiming to compute the following measure of similarity between x 1 , . . .
, x d/ 2 and x d/ 2+1 , . . .
, x d :
[Equation]
We argue that it can be done with a TT-Network of width n by using the TT-tensor X deﬁned in the proof of Theorem 1 and feeding the input vectors in the following order: x 1 , x d/ 2+1 , . . .
x d/ 2 , x d .
The CP-network representing the same function will have n d/ 2 terms (and hence n d/ 2 width) and will correspond to expanding brackets in the expression (12).
The case of equal TT-cores In analogy to the traditional RNNs we can consider a special class of Tensor Trains with the property that all the intermediate TT-cores are equal to each other: G 2 =
G 3 = · · · = G d − 1 , which allows for processing sequences of varied length.
We hypothesize that for this class exactly the same result as in Theorem 1 holds i.e. if we denote the variety of Tensor Trains with equal TT-cores by M eq r , we believe that the following hypothesis holds true:
Hypothesis 1.
Theorem 1 is also valid if M r is replaced by M eq r .
To prove it we can follow the same route as in the proof of Theorem 1.
While we leave ﬁnding an analytical example of a tensor with the desired property of rank maximality to a future work, we have veriﬁed numerically that randomly generated tensors
X from M eq r with d = 6 , n ranging from 2 to 10 and r ranging from 2 to 20 (we have checked 1000 examples for each possible combination) indeed satisfy rank CP X ≥ q d 2 .
E XPERIMENTS
In this section, we experimentally check if indeed – as suggested by Theorem 1 – the CP-Networks require exponentially larger width compared to the TT-Networks to ﬁt a dataset to the same level of accuracy.
This is not clear from the theorem since for natural data, functions that ﬁt this data may lay in the neglectable set where the ranks of the TT- and CP-networks are related via a polynomial function (in contrast to the exponential relationship for all function outside the neglectable set).
Other possible reasons why the theory may be disconnected with practice are optimization issues (although a certain low-rank tensor exists, we may fail to ﬁnd it with SGD) and the existence of the feature maps, which were not taken into account in the theory.
To train the TT- and CP-Networks, we implemented them in TensorFlow (Abadi et al.
and used Adam optimizer with batch size
32 and learning rate sweeping across { 4e-3, 2e-3, 1e-3, 5e-4 } values.
Since we are focused on assessing the expressivity of the format (in contrast to its sensitivity to hyperparameters), we always choose the best performing run according to the training loss.
For the ﬁrst experiment, we generate two-dimensional datasets with Scikit-learn tools ‘moons‘ and ‘circles‘ (Pedregosa et al.
and for each training example feed the two features as two patches into the TT-Network (see Fig. 5).
This example shows that the TT-Networks can implement nontrivial decision boundaries.
For the next experiments, we use computer vision datasets MNIST (LeCun et al.
and CIFAR10 (Krizhevsky & Hinton (2009)).
MNIST is a collection of 70000 handwritten digits, CIFARis a dataset of 60000 natural images which are to be classiﬁed into 10 classes such as bird or cat.
We feed raw pixel data into the TT- and CP-Networks (which extract patches and apply a trainable feature map to them, see Section 2).
In our experiments we choose patch size to be 8 × 8 , feature maps to be afﬁne maps followed by the ReLU activation and we set number of such feature maps to 4 .
For MNIST, both TT- and CP-Networks show reasonable performance ( 1 . 0 train accuracy, 0 .test accuracy without regularizers, and 0 .
98 test accuracy with dropout 0 .
8 applied to each patch) even with ranks less than 5 , which may indicate that the dataset is too simple to draw any conclusion, but serves as a sanity check.
We report the training accuracy for CIFAR-10 on Fig. 6.
Note that we did not use regularizers of any sort for this experiment since we wanted to compare expressive power of networks (the best test accuracy we achieved this way on CIFAR-10 is 0 .
45 for the TT-Network and 0 .
2 for the CPNetwork).
On practice, the expressive power of the TT-Network is only polynomially better than that of the CP-network (Fig. 6), probably because of the reasons discussed above.
R ELATED WORK
A large body of work is devoted to analyzing the theoretical properties of neural networks (Cybenko (1989);
Hornik et al.
(1989); Shwartz-Ziv & Tishby (2017)).
Recent studies focus on depth efﬁciency (Raghu et al.
(2017); Montufar et al.
; Eldan & Shamir (2016); Sutskever et al.
(2013)), in most cases providing worst-case guaranties such as bounds between deep and shallow networks width.
Two works are especially relevant since they analyze depth efﬁciency from the viewpoint of tensor decompositions: expressive power of the Hierarchical Tucker decomposition (Cohen et al.
and its generalization to handle activation functions such as ReLU (Cohen
& Shashua (2016)).
However, all of the works above focus on feedforward networks, while we tackle recurrent architectures.
The only other work that tackles expressivity of RNNs is the concurrent work that applies the TT-decomposition to explicitly modeling high-order interactions of the previous hidden states and analyses the expressive power of the resulting architecture (Yu et al., 2017).
This work, although very related to ours, analyses a different class of recurrent models.
Models similar to the TT-Network were proposed in the literature but were considered from the practical point of view in contrast to the theoretical analyses provided in this paper.
Novikov et al.
; Stoudenmire & Schwab (2016) proposed a model that implements Eq.
(2), but with a predeﬁned (not learnable) feature map Φ .
Wu et al.
(2016) explored recurrent neural networks with multiplicative connections, which can be interpreted as the TT-Networks with bilinear maps that are shared G k
=
G and have low-rank structure imposed on them.
C ONCLUSION
In this paper, we explored the connection between recurrent neural networks and Tensor Train decomposition and used it to prove the expressive power theorem, which states that a shallow network of exponentially large width is required to mimic a recurrent neural network.
The downsides of this approach is that it provides worst-case analysis and do not take optimization issues into account.
In the future work, we would like to address the optimization issues by exploiting the Riemannian geometry properties of the set of TT-tensors of ﬁxed rank and extend the analysis to networks with non-linearity functions inside the recurrent connections (as was done for CNNs in Cohen & Shashua (2016)). A CKNOWLEDGEMENTS
This study was supported by the Ministry of Education and Science of the Russian Federation (grant 14.756.31.0001).