Title: KRONECKER RECURRENT UNITS

Abstract: Our work addresses two important issues with recurrent neural networks: (1) they are over-parametrized, and (2) the recurrent weight matrix is ill-conditioned. The former increases the sample complexity of learning and the training time. The latter causes the vanishing and exploding gradient problem. We present a flexible recurrent neural network model called Kronecker Recurrent Units (KRU). KRU achieves parameter efficiency in RNNs through a Kronecker factored recurrent matrix. It overcomes the ill-conditioning of the recurrent matrix by enforcing soft unitary constraints on the factors. Thanks to the small dimensionality of the factors, maintaining these constraints is computationally efficient. Our experimental results on seven standard data-sets reveal that KRU can reduce the number of parameters by three orders of magnitude in the recurrent weight matrix compared to the existing recurrent models, without trading the statistical performance. These results in particular show that while there are advantages in having a high dimensional recurrent space, the capacity of the recurrent part of the model can be dramatically reduced.

1. INTRODUCTION:

Deep neural networks have defined the state-of-the-art in a wide range of problems in computer vision, speech analysis, and natural language processing (Krizhevsky et al., 2012; Hinton et al., 2012; Mikolov, 2012) . However, these models suffer from two key issues. (1) They are over-parametrized; thus it takes a very long time for training and inference. (2) Learning deep models is difficult because of the poor conditioning of the matrices that parameterize the model. These difficulties are especially relevant to recurrent neural networks. Indeed, the number of distinct parameters in RNNs grows as the square of the size of the hidden state conversely to convolutional networks which enjoy weight sharing. Moreover, poor conditioning of the recurrent matrices results in the gradients to explode or vanish exponentially fast along the time horizon. This problem prevents RNN from capturing long-term dependencies (Hochreiter, 1991; Bengio et al., 1994) .

There exists an extensive body of literature addressing over-parametrization in neural networks. LeCun et al. (1990) first studied the problem and proposed to remove unimportant weights in neural networks by exploiting the second order information. Several techniques which followed include low-rank decomposition (Denil et al., 2013) , training a small network on the soft-targets predicted by a big pre-trained network (Ba & Caruana, 2014) , low bit precision training (Courbariaux et al., 2014) , hashing (Chen et al., 2015) , etc. A notable exception is the deep fried convnets (Yang et al., 2015) which explicitly parameterizes the fully connected layers in a convnet with a computationally cheap and parameter-efficient structured linear operator, the Fastfood transform (Le et al., 2013) . These techniques are primarily aimed at feed-forward fully connected networks and very few studies have focused on the particular case of recurrent networks (Arjovsky et al., 2016) .

The problem of vanishing and exploding gradients has also received significant attention. Hochreiter & Schmidhuber (1997) proposed an effective gating mechanism in their seminal work on LSTMs. Later, this technique was adopted by other models such as the Gated Recurrent Units (GRU) (Chung et al., 2015) and the Highway networks (Srivastava et al., 2015) for recurrent and feed-forward neural networks respectively. Other popular strategies include gradient clipping (Pascanu et al., 2013) , and orthogonal initialization of the recurrent weights (Le et al., 2015) . More recently (Arjovsky et al., 2016) proposed to use a unitary recurrent weight matrix. The use of norm preserving unitary maps prevent the gradients from exploding or vanishing, and thus help to capture long-term dependencies. The resulting model called unitary RNN (uRNN) is computationally efficient since it only explores a small subset of general unitary matrices. Unfortunately, since uRNNs can only span a reduced subset of unitary matrices their expressive power is limited (Wisdom et al., 2016) . We denote this restricted capacity unitary RNN as RC uRNN. Full capacity unitary RNN (FC uRNN) (Wisdom et al., 2016) proposed to overcome this issue by parameterizing the recurrent matrix with a full dimensional unitary matrix, hence sacrificing computational efficiency. Indeed, FC uRNN requires a computationally expensive projection step which takes O(N 3 ) time (N being the size of the hidden state) at each step of the stochastic optimization to maintain the unitary constraint on the recurrent matrix. Mhammedi et al. (2016) in their orthogonal RNN (oRNN) avoided the expensive projection step in FC uRNN by parametrizing the orthogonal matrices using Householder reflection vectors, it allows a fine-grained control over the number of parameters by choosing the number of Householder reflection vectors. When the number of Householder reflection vector approaches N this parametrization spans the full reflection set, which is one of the disconnected subset of the full orthogonal set. Jing et al. (2017) also presented a way of parametrizing unitary matrices which allows fine-grained control on the number of parameters. This work called as Efficient Unitary RNN (EURNN), exploits the continuity of unitary set to have a tunable parametrization ranging from a subset to the full unitary set.

Although the idea of parametrizing recurrent weight matrices with strict unitary linear operator is appealing, it suffers from several issues: (1) Strict unitary constraints severely restrict the search space of the model, thus making the learning process unstable. (2) Strict unitary constraints make forgetting irrelevant information difficult. While this may not be an issue for problems with non-vanishing long term influence, it causes failure when dealing with real world problems that have vanishing long term influence 4.7. Henaff et al. (2016) have previously pointed out that the good performance of strict unitary models on certain synthetic problems is because it exploits the biases in these data-sets which favors a unitary recurrent map and these models may not generalize well to real world data-sets. More recently Vorontsov et al. (2017) have also studied this problem of unitary RNNs and the authors found out that relaxing the strict unitary constraint on the recurrent matrix to a soft unitary constraint improved the convergence speed as well as the generalization performance.

Our motivation is to address the problems of existing recurrent networks mentioned above. We present a new model called Kronecker Recurrent Units (KRU). At the heart of KRU is the use of Kronecker factored recurrent matrix which provide an elegant way to adjust the number of parameters to the problem at hand. This factorization allows us to finely modulate the number of parameters required to encode N × N matrices, from O(log(N )) when using factors of size 2 × 2, to O(N 2 ) parameters when using a single factor of the size of the matrix itself. We tackle the vanishing and exploding gradient problem through a soft unitary constraint (Jose & Fleuret, 2016; Henaff et al., 2016; Cisse et al., 2017; Vorontsov et al., 2017) . Thanks to the properties of Kronecker matrices (Van Loan, 2000) , this constraint can be enforced efficiently. Please note that KRU can readily be plugged into vanilla real space RNN, LSTM and other variants in place of standard recurrent matrices. However in case of LSTMs we do not need to explicitly enforce the approximate orthogonality constraints as the gating mechanism is designed to prevent vanishing and exploding gradients. Our experimental results on seven standard data-sets reveal that KRU and KRU variants of real space RNN and LSTM can reduce the number of parameters drastically (hence the training and inference time) without trading the statistical performance. Our core contribution in this work is a flexible, parameter efficient and expressive recurrent neural network model which is robust to vanishing and exploding gradient problem.

The paper is organized as follows, in section 2 we restate the formalism of RNN and detail the core motivations for KRU. In section 3 we present the Kronecker recurrent units (KRU). We present our experimental findings in section 4 and section 5 concludes our work. 

t ∈ R M or C M , ŷt ∈ R M or C M Prediction targets and RNN predictions at time t U ∈ C N ×D , W ∈ C N ×N , V ∈ C M ×N Input, recurrent amd output weight matrices b ∈ R N or C N , c ∈ R M or C M

Hidden and output bias σ(.), L(ŷ, y) Point-wise non-linear activation function and the loss function

2. RECURRENT NEURAL NETWORK FORMALISM:

Table 1 summarizes some notations that we use in the paper. We consider the field to be complex rather than real numbers. We will motivate the choice of complex numbers later in this section. Consider a standard recurrent neural network (Elman, 1990) . Given a sequence of T input vectors: x 0 , x 1 , . . . , x T -1 , at a time step t RNN performs the following:

EQUATION

)

where ŷt is the predicted value at time step t.

2.1. OVER PARAMETERIZATION AND COMPUTATIONAL EFFICIENCY:

The total number of parameters in a RNN is c(DN + N 2 + N + M + M N ), where c is 1 for real and 2 for complex parametrization. As we can see, the number of parameters grows quadratically with the hidden dimension, i.e., O(N 2 ). We show in the experiments that this quadratic growth is an over parametrization for many real world problems. Moreover, it has a direct impact on the computational efficiency of RNNs because the evaluation of Wh t-1 takes O(N 2 ) time and it recursively depends on previous hidden states. However, other components Ux t and Vh t can usually be computed efficiently by a single matrix-matrix multiplication for each of the components. That is, we can perform U[x 0 , . . . , x T ] and V[h 0 , . . . , h T -1 ], this is efficient using modern BLAS libraries. So to summarize, if we can control the number of parameters in the recurrent matrix W, then we can control the computational efficiency.

2.2. POOR CONDITIONING IMPLIES GRADIENTS EXPLODE OR VANISH:

The vanishing and exploding gradient problem refers to the decay or growth of the partial derivative of the loss L(.) with respect to the hidden state h t i.e. ∂L ∂ht as the number of time steps T grows (Arjovsky et al., 2016) . By the application of the chain rule, the following can be shown (Arjovsky et al., 2016) :

EQUATION

From Equation 3, it is clear that if the absolute value of the eigenvalues of W deviates from 1 then ∂L ∂ht may explode or vanish exponentially fast with respect to T -t. So a strategy to prevent vanishing and exploding gradient is to control the spectrum of W.

2.3. WHY COMPLEX FIELD?:

Although Arjovsky et al. (2016) and Wisdom et al. (2016) use complex valued networks with unitary constraints on the recurrent matrix, the motivations for such models are not clear. We give a simple but compelling reason for complex-valued recurrent networks.

The absolute value of the determinant of a unitary matrix is 1. Hence in the real space, the set of all unitary (orthogonal) matrices have a determinant of 1 or -1, i.e., the set of all rotations and reflections respectively. Since the determinant is a continuous function, the unitary set in real space is disconnected. Consequently, with the real-valued networks we cannot span the full unitary set using the standard continuous optimization procedures. On the contrary, the unitary set is connected in the complex space as its determinants are the points on the unit circle and we do not have this issue.

As we mentioned in the introduction (Jing et al., 2017) uses this continuity of unitary space to have a tunable continuous parametrization ranging from subspace to full unitary space. Any continuous parametrization in real space can only span a subset of the full orthogonal set. For example, the Householder parametrization (Mhammedi et al., 2016) suffers from this issue.

3. KRONECKER RECURRENT UNITS (KRU):

We consider parameterizing the recurrent matrix W as a Kronecker product of F matrices W 0 , . . . ,

EQUATION

Where each W f ∈ C P f ×Q f and F -1

f =0 P f = F -1 f =0 Q f = N . W f 's are called as Kronecker factors.

To illustrate the Kronecker product of matrices, let us consider the simple case when ∀ f {P f = Q f = 2}. This implies F = log 2 N . And W is recursevly defined as follows:

EQUATION

EQUATION

When ∀ f {p f = q f = 2} the number of parameters is 8 log 2 N and the time complexity of hidden state computation is O(N log 2 N ). When ∀ f {p f = q f = N } then F = 1 and we will recover standard complex valued recurrent neural network. We can span every Kronecker representations in between by choosing the number of factors and the size of each factor. In other words, the number of Kronecker factors and the size of each factor give us fine-grained control over the number of parameters and hence over the computational efficiency. This strategy allows us to design models with the appropriate trade-off between computational budget and statistical performance. All the existing models lack this flexibility.

The idea of using Kronecker factorization for approximating Fisher matrix in the context of natutal gradient methods have recently recieved much attention. The algorithm was originally presented in Martens & Grosse (2015) and was later extended to convolutional layers (Grosse & Martens, 2016) , distributed second order optimization (Ba et al., 2016) and for deep reinforcement learning (Wu et al., 2017) . However Kronecker matrices have not been well explored as learnable parameters except (Zhang et al., 2015 ) used it's spectral property for fast orthogonal projection and (Zhou et al., 2015) used it as a layer in convolutional neural networks.

3.1. SOFT UNITARY CONSTRAINT:

Poor conditioning results in vanishing or exploding gradients. Unfortunately, the standard solution which consists of optimization on the strict unitary set suffers from the retention of noise over time. Indeed, the small eigenvalues of the recurrent matrix can represent a truly vanishing long-term influence on the particular problem and in that sense, there can be good or bad vanishing gradients. Consequently, enforcing strict unitary constraint (forcing the network to never forget) can be a bad strategy. A simple solution to get the best of both worlds is to enforce unitary constraint approximately by using the following regularization:

EQUATION

7) Please note that these constraints are enforced on each factor of the Kronecker factored recurrent matrix. This procedure is computationally very efficient since the size of each factor is typically small. It suffices to do so because if each of the Kronecker factors {W 0 , . . . , W F -1 } are unitary then the full matrix W is unitary (Van Loan, 2000) and if each of the factors are approximately unitary then the full matrix is approximately unitary. We apply soft unitary constraints as a regularizer whose strength is cross-validated on the validation set. This type of regularizer has recently been exploited for real-valued models. (Cisse et al., 2017) showed that enforcing approximate orthogonality constraint on the weight matrices make the network robust to adversarial samples as well as improve the learning speed. In metric learning (Jose & Fleuret, 2016) have shown that it better conditions the projection matrix thereby improving the robustness of stochastic gradient over a wide range of step sizes as well asthe generalization performance. Henaff et al. (2016) and Vorontsov et al. (2017) have also used this soft unitary contraints on standard RNN after identifying the problems with the strict unitary RNN models. However the computational complexity of naively applying this soft constraint is O(N 3 ). This is prohibitive for RNNs with large hidden state unless one considers a Kronecker factorization.

4. EXPERIMENTS:

Existing deep learning libraries such as Theano (Bergstra et al., 2011) , Tensorflow (Abadi et al., 2016) and Pytorch (Paszke et al., 2017) do not support fast primitives for Kronecker products with arbitrary number of factors. So we wrote custom CUDA kernels for Kronecker forward and backward operations. All our models are implemented in C++. We will release our library to reproduce all the results which we report in this paper. We use tanh as activation function for RNN, LSTM and our model KRU-LSTM. Whereas RC uRNN, FC uRNN and KRU uses complex rectified linear units (Arjovsky et al., 2016) .

4.1. COPY MEMORY PROBLEM:

Copy memory problem (Hochreiter & Schmidhuber, 1997) tests the model's ability to recall a sequence after a long time gap. In this problem each sequence is of length T + 20 and each element in the sequence come from 10 classes {0, . . . , 9}. The first 10 elements are sampled uniformly with replacement from {1, . . . , 8}. The next T -1 elements are filled with 0, the 'blank' class followed by 9, the 'delimiter' and the remaining 10 elements are 'blank' category. The goal of the model is to output a sequence of T + 10 blank categories followed by the 10 element sequence from the beginning of the input sequence. The expected average cross entropy for a memory-less strategy is 2016), we choose the training and test set size to be 100K and 10K respectively. All the models were trained using RMSprop with a learning rate of 1e-3, decay of 0.9 and a batch size of 20. For both the settings T = 1000 and T = 2000, KRU converges to zero average cross entropy faster than FC uRNN. All the other baselines are stuck at the memory-less cross entropy.

The results are shown in figure 1 . For this problem we do not learn the recurrent matrix of KRU, We initialize it by random unitary matrix and just learn the input to hidden, hidden to output matrices and the bias. We found out that this strategy already solves the problem faster than all other methods. Our model in this case is similar to a parametrized echo state networks (ESN). ESNs are known to be able to learn long-term dependencies if they are properly initialized (Jaeger, 2001) . We argue that this data-set is not an ideal benchmark for evaluating RNNs in capturing long term dependencies. Just a unitary initialization of the recurrent matrix would solve the problem. 

4.2. ADDING PROBLEM:

Following Arjovsky et al. (2016) we describe the adding problem (Hochreiter & Schmidhuber, 1997) . Each input vector is composed of two sequences of length T . The first sequence is sampled from U[0, 1]. In the second sequence exactly two of the entries is 1, the 'marker' and the remaining is 0.

The first 1 is located uniformly at random in the first half of the sequence and the other 1 is located again uniformly at random in the other half of the sequence. The network's goal is to predict the sum of the numbers from the first sequence corresponding to the marked locations in the second sequence.

We evaluate four settings as in Arjovsky et al. (2016) with T =100, T =200, T =400, and T =750. For all four settings, KRU uses a hidden dimension N of 512 with 2x2 Kronecker factors which corresponds to ≈3K parameters in total. We use a RNN of N = 128 (≈ 17K parameters) , LSTM of N = 128 ( ≈ 67K parameters), RC uRNN of N = 512 ( ≈ 7K parameters) , FC uRNN of N = 128 ( ≈ 33K parameters). The train and test set sizes are chosen to be 100K and 10K respectively. All the models were trained using RMSprop with a learning rate of 1e-3 and a batch size of 20 or 50 with the best results are being reported here.

The results are presented in figure 2 . KRU converges faster than all other baselines even though it has much fewer parameters. This shows the effectiveness of soft unitary constraint which controls the flow of gradients through very long time steps and thus deciding what to forget and remember in an adaptive way. LSTM also converges to the solution and this is achieved through its gating mechanism which controls the flow of the gradients and thus the long term influence. However LSTM has 10 times more parameters than KRU. Both RC uRNN and FC uRNN converges for T = 100 but as we can observe, the learning is not stable. The reason for this is that RC uRNN and FC uRNN retains noise since they are strict unitary models. Please note that we do not evaluate RC uRNN for T = 400 and T = 750 because we found out that the learning is unstable for this model and is often diverging. 

4.3. PIXEL BY PIXEL MNIST:

As outlined by Le et al. (2015) , we evaluate the Pixel by pixel MNIST task. MNIST digits are shown to the network pixel by pixel and the goal is to predict the class of the digit after seeing all the pixels one by one. We consider two tasks: (1) Pixels are read from left to right from top or bottom and (2) Pixels are randomly permuted before being shown to the network. The sequence length for these tasks is T = 28 × 28 = 784. The size of the MNIST training set is 60K among which we choose 5K as the validation set. The models are trained on the remaining 55K points. The model which gave the best validation accuracy is chosen for test set evaluation. All the models are trained using RMSprop with a learning rate of 1e-3 and a decay of 0.9.

The results are summarized in figure 3 

4.4. CHARACTER LEVEL LANGUAGE MODELLING ON PENN TREEBANK (PTB):

We now consider character level language modeling on Penn TreeBank data-set (Marcus et al., 1993) . Penn TreeBank is composed of 5017K characters in the training set, 393K characters in the validation set and 442K characters in the test set. The size of the vocabulary was limited to 10K most frequently occurring words and the rest of the words are replaced by a special <UNK> character (Mikolov, 2012) . The total number of unique characters in the data-set is 50, including the special <UNK> character.

All our models were trained for 50 epochs with a batch size of 50 and using ADAM (Kingma & Ba, 2014) . We use a learning rate of 1e-3 which was found through cross-validation with default beta parameters (Kingma & Ba, 2014 ). If we do not see an improvement in the validation bits per character (BPC) after each epoch then the learning rate is decreased by 0.30. Back-propagation through time (BPTT) is unrolled for 30 time frames on this task.

We did two sets of experiments to have fair evaluation with the models whose results were available for a particular parameter setting (Mhammedi et al., 2016) and also to see how the performance evolves as the number of parameters are increased. We present our results in table 3. We observe that the strict orthogonal model, oRNN fails to generalize as well as other models even with a high capacity recurrent matrix. KRU and KRU-LSTM performs very close to RNN and LSTM with fewer parameters in the recurrent matrix. Please recall that the computational bottleneck in RNN is the computation of hidden states 2.1 and thus having fewer parameters in the recurrent matrix can significantly reduce the training and inference time.

Recently HyperNetworks (Ha et al., 2016) We exactly follow the experimental framework of Chung et al. (2014) for Polyphonic music modeling (Boulanger-Lewandowski et al., 2012) on two datasets: JSB Chorales and Piano-midi. Similar to (Chung et al., 2014) our main objective here is to have a fair evaluation of different recurrent neural networks. We took the baseline RNN and LSTM models of (Chung et al., 2014) whose model sizes were chosen to be small enough to avoid overfitting. We choose the model size of KRU and KRU-LSTM in such way that it has fewer parameters compared to the baselines. As we can in the table 4 both our models (KRU and KRU-LSTM) overfit less and generalizes better. We also present the wall-clock running time of different methods in the figure 4 . 

4.6. FRAMEWISE PHONEME CLASSIFICATION ON TIMIT:

Framewise phoneme classification (Graves & Schmidhuber, 2005) is the problem of classifying the phoneme corresponding to a sound frame. We evaluate the models for this task on the real world TIMIT data-set (Garofolo et al., 1993) . TIMIT contains a training set of 3696 utterances among which we use 184 as the validation set. The test set is composed of 1344 utterances. We extract 12 Mel-Frequency Cepstrum Coefficients (MFCC) (Mermelstein, 1976) from 26 filter banks and also the log energy per frame. We also concatenate the first derivative, resulting in a feature descriptor of dimension 26 per frame. The frame size is chosen to be 10ms and the window size is 25ms.

The number of time steps to which back-propagation through time (BPTT) is unrolled corresponds to the length of each sequence. Since each sequence is of different length this implies that for each sample BPTT steps are different. All the models are trained for 20 epochs with a batch size of 1 using ADAM with default beta parameters (Kingma & Ba, 2014) . The learning rate was cross-validated for each of the models from η ∈ {1e-2, 1e-3, 1e-4} and the best results are reported here. The best learning rate for all the models was found out to be 1e-3 for all the models. Again if we do not observe a decrease in the validation error after each epoch, we decrease the learning rate by a factor of γ ∈ {1e-1, 2e-1, 3e-1} which is again cross-validated. Figure 5 summarizes our results. Figure 5 : KRU and KRU-LSTM performs better than the baseline models with far less parameters in the recurrent weight matrix on the challenging TIMIT data-set (Garofolo et al., 1993) . This significantly bring down the training and inference time of RNNs. Both LSTM and KRU-LSTM converged within 5 epochs whereas RNN and KRU took 20 epochs. A similar result was obtained by (Graves & Schmidhuber, 2005) using RNN and LSTM with 4 times less parameters respectively than our models. However in their work the LSTM took 20 epochs to converge and the RNN took 70 epochs. We have also experimented with the same model size as that of (Graves & Schmidhuber, 2005) and have obtained very similar results as in the table but at the expense of longer training times.

4.7. INFLUENCE OF SOFT UNITARY CONSTRAINTS:

Here we study the properties of soft unitary constraints on KRU. We use Polyphonic music modeling data-sets (Boulanger-Lewandowski et al., 2012) : JSB Chorales and Piano-midi, as well as TIMIT data-set for this set of experiments. We varied the amplitude of soft unitary constraints from 1e -7 to 1e -1, the higher the amplitude the closer the recurrent matrix will be to the unitary set. All other hyper-parameters, such as the learning rate and the model size are fixed. We present our studies in the figure 6 . As we increase the amplitude we can see that the recurrent matrix is getting better conditioned and the spectral norm or the spectral radius is approaching towards 1. As we can see that the validation performance can be improved using this simple soft unitary constraints. For JSB Chorales the best validation performance is achieved at an amplitude of 1e -2, whereas for Piano-midi it is at 1e -1.

For TIMIT phoneme recognition problem, the best validation error is achieved at 1e -5 but as we increase the amplitude further, the performance drops. This might be explained by a vanishing long-term influence that has to be forgotten. Our model achieve this by cross-validating the amplitude of soft unitary constraints. These experiments also reveals the problems of strict unitary models such as RC uRNN (Arjovsky et al., 2016) , FC uRNN (Wisdom et al., 2016) , oRNN (Mhammedi et al., 2016) and EURNN (Jing et al., 2017) that they suffer from the retention of noise from a vanishing long term influence and thus fails to generalize. A popular heuristic strategy to avoid exploding gradients in RNNs and thereby making their training robust and stable is gradient clipping. Most of the state of the art RNN models use gradient clipping for training. Please note that we are not using gradient clipping with KRU. Our soft unitary constraints offer a principled alternative to gradient clipping.

Moreover Hardt et al. (2016) recently showed that gradient descent converges to the global optimizer of linear recurrent neural networks even though the learning problem is non-convex. The necessary condition for the global convergence guarantee requires that the spectral norm of recurrent matrix is bounded by 1. This seminal theoretical result also inspires to use regularizers which control the spectral norm of the recurrent matrix, such as the soft unitary constraints.

5. CONCLUSION:

We have presented a new recurrent neural network model based on its core a Kronecker factored recurrent matrix. Our core reason for using a Kronecker factored recurrent matrix stems from it's elegant algebraic and spectral properties. Kronecker matrices are neither low-rank nor block-diagonal but it is multi-scale like the FFT matrix. Kronecker factorization provides a fine control over the model capacity and it's algebraic properties enable us to design fast matrix multiplication algorithms. It's spectral properties allow us to efficiently enforce constraints like positive semi-definitivity, unitarity and stochasticity. As we have shown, we used the spectral properties to efficiently enforce a soft unitary constraint.

Experimental results show that our approach out-perform classical methods which uses O(N 2 ) parameters in the recurrent matrix. Maybe as important, these experiments show that both on toy problems ( § 4.1 and 4.2), and on real ones ( § 4.3, 4.4, , and § 4.6) , while existing methods require tens of thousands of parameters in the recurrent matrix, competitive or better than state-of-the-art performance can be achieved with far less parameters in the recurrent weight matrix. These surprising results provide a new and counter-intuitive perspective on desirable memory-capable architectures: the state should remain of high dimension to allow the use of high-capacity networks to encode the input into the internal state, and to extract the predicted value, but the recurrent dynamic itself can, and should, be implemented with a low-capacity model.

From a practical standpoint, the core idea in our method is applicable not only to vanilla recurrent neural networks and LSTMS as we showed, but also to a variety of machine learning models such as feed-forward networks (Zhou et al., 2015) , random projections and boosting weak learners. Our future work encompasses exploring other machine learning models and on dynamically increasing the capacity of the models on the fly during training to have a perfect balance between computational efficiency and sample complexity.

APPENDICES A ANALYSIS OF VANISHING AND EXPLODING GRADIENTS IN RNN:

Given a sequence of T input vectors: x 0 , x 1 , . . . , x T -1 , let us consider the operation at the hidden layer t of a recurrent neural network:

EQUATION

By the chain rule,

EQUATION

)

where σ is the non-linear activation function and J k+1 = diag(σ (z k+1 )) is the Jacobian matrix of the non-linear activation function.

EQUATION

From equation 14 it is clear the norm of the gradient is exponentially dependent upon two factors along the time horizon:

• The norm of the Jacobian matrix of the non-linear activation function J k+1 .

• The norm of the hidden to hidden weight matrix W .

These two factors are causing the vanishing and exploding gradient problem.

Since the gradient of the standard non-linear activation functions such as tanh and ReLU are bounded between [0, 1], J k+1 does not contribute to the exploding gradient problem but it can still cause vanishing gradient problem.

B LONG SHORT-TERM MEMORY (LSTM) (HOCHREITER & SCHMIDHUBER, 1997) LSTM networks presented an elegant solution to the vanishing and exploding gradients through the introduction of gating mechanism. Apart from the standard hidden state in RNN, LSTM introduced one more state called cell state c t . LSTM has three different gates whose functionality is described as follows:

• Forget gate (W f , U f , b f ):

Decides what information to keep and erase from the previous cell state.

• Input gate (W i , U f , b i ):

Decides what new information should be added to the cell state.

• Output gate (W o , U o , b o ):Decides which information from the cell state is going to the output.

In addition to the gates, LSTM prepares candidates for the information from the input gate that might get added to the cell state through the action of input gate. Let's denote the parameters describing the function that prepares this candidate information as W c , U c , b c .

Given a sequence of T input vectors: x 0 , x 1 , . . . , x T -1 , at a time step t LSTM performs the following:

EQUATION

where σ(.) and τ (.) are the point-wise sigmoid and tanh functions. indicates element-wise multiplication. The first three are gating operations and the 4th one prepares the candidate information. The 5th operation updates the cell-state and finally in the 6th operation the output gate decided what to go into the current hidden state.

C UNITARY EVOLUTION RNN (ARJOVSKY ET AL., 2016) Unitary evolution RNN (uRNN) proposed to solve the vanishing and exploding gradients through a unitary recurrent matrix, which is for the form:

EQUATION

Where:

• D 1 , D 2 , D 3 : Diagonal matrices whose diagonal entries are of the from D kk = e iθ k , implies each matrix have N parameters, (θ 0 , . . . , θ N -1 ).

• F and F -1 : Fast Fourier operator and inverse fast Fourier operator respectively.

• R 1 , R 2 : Householder reflections. R = I -2 vv H v , where v ∈ C N . The total number of parameters for this uRNN operator is 7N and the matrix vector can be done N log(N ) time. It is parameter efficient and fast but not flexible and suffers from the retention of noise and difficulty in optimization due its unitarity. D FULL CAPACITY UNITARY RNN (WISDOM ET AL., 2016) Full capacity unitary RNN (FC uRNN) does optimization on the full unitary set instead on a subset like uRNN. That is FC uRNN's recurrent matrix W ∈ U (N ). There are several challenges in optimization over unitary manifold especially when combined with stochastic gradient method. The primary challenge being the optimization cost is O(N 3 ) per step.

E ORTHOGONAL RNN (MHAMMEDI ET AL., 2016):

Orthogonal RNN (oRNN) parametrizes the recurrent matrices using Householder reflections.

EQUATION

where

EQUATION

and

EQUATION

where v K ∈ R K . The number of parameters in this parametrization is O(N K). When N = K = 1 and v = 1, it spans the rotation subset and when v = -1, it spans the full reflection subset.

F PROPERTIES OF KRONECKER MATRIX (VAN LOAN, 2000) Consider a matrix W ∈ C N ×N factorized as a Kronecker product of F matrices W 0 , . . . , W F -1 ,

EQUATION

Where each W i ∈ C Pi×Qi respectively and f -1

EQUATION

G PRODUCT BETWEEN A DENSE MATRIX AND A KRONECKER MATRIX:

For simplicity here we use real number notations. Consider a dense matrix X ∈ R M ×K and a Kronecker factored matrix W ∈ R N ×K . That is W = ⊗ F -1 f =0 W f , where each W f ∈ R P f ×Q f respectively and The matrix product in 29 can be recursively defined as

EQUATION

)

Please note that the binary operator is not the standard matrix multiplication operator but instead it denotes a strided matrix multiplication. The stride is computed according to the algebra of Kronecker matrices. Let us define Y recursively:

EQUATION

Combining equation 34 and 32

EQUATION

)

We use the above notation for Y in the algorithm. That is the algorithm illustrated here will cache all the intermediate outputs (Y 0 , . . . , Y F -1 ) instead of just Y F -1 . These intermediate outputs are then later to compute the gradients during the back-propagation. This cache will save some computation during the back-propagation. If the model is just being used for inference then the algorithm can the organized in such a way that we do not need to cache the intermediate outputs and thus save memory.

Algorithm for computing the product between a dense matrix and a Kronecker factored matrix34 is given below 1. All the matrices are assumed to be stored in row major order. For simplicity the algorithm is illustrated in a serial fashion. Please note the lines 4 to 15 except lines 9-11 can be trivially parallelized as it writes to independent memory locations. The GPU implementation exploits this fact.

Algorithm 1 Dense matrix product with a Kronecker matrix, Y = (. . . (XW T 0 ) ⊗ • • • ⊗ W T F -1 ) Input: Dense matrix X ∈ R M ×K , Kronecker factors {W 0 , . . . , W F -1 } : W f ∈ R p f ×q f , Size of each Kronecker factors {(P 0 , Q 0 ), . . . , (P F -1 , Q F -1 )} :

F -1 f =0 P f = N, F -1 f =0 Q f = K, Output: Output matrix Y F -1 ∈ R M ×N 1: for f = 0 to F -1 do 2: stride = K/Q f 3: index = 0 4:

for m = 0 to M -1 do 5:

X m = X + m × K 6:

for p = 0 to P f -1 do 7:

for s = 0 to stride -1 do 8:

Y f [index] = 0 9:

for q = 0 to Q k -1 do 10:

Y f [index] = Y f [index] + X m [q × stride + s] × W f [p × Q f + q] 11:

end for Following the notations from the above section G, here we illustrate the algorithm for computing the gradients in a Kronecker layer. To be clear and concrete the Kronecker layer does the following computation in the forward pass 32.

EQUATION

)

That is, the Kronecker layer is parametrized by a Kronecker factored matrix W = ⊗ F -1 f =0 W f stored as it factors {W 0 , . . . , W F -1 } and it takes an input X and produces output Y = Y F -1 using the algorithm 1.

The following algorithm 2 computes the Gradient of the Kronecker factors: {gW 0 , . . . , gW F -1 } and the Jacobian of the input matrix gX given the Jacobian of the output matrix: gY = gY F -1 .

:



Figures and Tables:

10 log 8 T +20 . Our experimental setup closely follows Wisdom et al. (2016) which in turn follows Arjovsky et al. (2016) but T extended to 1000 and 2000. Our model, KRU uses a hidden dimension N of 128 with 2x2 Kronecker factors which corresponds to ≈5K parameters in total. We use a RNN of N = 128 (≈ 19K parameters) , LSTM of N = 128 ( ≈ 72K parameters), RC uRNN of N = 470 ( ≈ 21K parameters) , FC uRNN of N = 128 ( ≈ 37K parameters). All the baseline models are deliberately chosen to have more parameters than KRU. Following Wisdom et al. (2016); Arjovsky et al. (

Figure1: Learning curves on copy memory problem for T =1000 and T =2000.

Figure2: Results on adding problem for T =100, T =200, T =400 and T =750. KRU consistently outperforms the baselines on all the settings with fewer parameters.

Figure 3: Validation accuracy on pixel by pixel MNIST and permuted MNIST class prediction as the learning progresses.

Figure 4: Wall clock training time on JSB Chorales and Piano-midi data-set.

Figure 6: Analysis of soft unitary constraints on three data-sets. First, second and the third column presents JSB Chorales, Piano-midi and TIMIT data-sets respectively.

=0 P f = N and F -1 f =0 Q f = K. Let us illustrate the matrix product XW T resulting in a matrix Y ∈ R M ×N . Y = XW T . (29)The computational complexity first expanding the Kronecker factored matrix and then computing the matrix product is O(M N K). This can be reduced by exploiting the recursive definition of Kronecker matrices. For examples when N = K and ∀ f {P f = Q f = 2}, the matrix product can be computed in O(M N log N ) time instead of O(M N 2 ).

Notations D, N, M Input, hidden and output dimensions x t ∈ R D or C D , h t ∈ C D Input and hidden state at time t y

Table content: <table/>

and table 2. On the unpermuted task LSTM achieve the state of the art performance even though the convergence speed is slow. Recently a low rank plus diagonal gated recurrent unit (LRD GRU) (Barone, 2016) have shown to achieves 94.7 accuracy on permuted MNIST with 41.2K parameters whereas KRU achieves 94.5 with just 12K parameters i.e KRU has 3x parameters less than LRD GRU. Please also note that KRU is a simple model without a gating mechanism. KRU can be straightforwardly plugged into LSTM and GRU to exploit the additional benefits of the gating mechanism which we will show in the next experiments with a KRU-LSTM.

Table content: <table><tr><td/><td/><td/><td>Pixel by pixel MNIST</td><td/><td/><td/><td/><td colspan="2">Pixel by pixel permuted MNIST</td><td/></tr><tr><td/><td>1</td><td/><td/><td/><td/><td>1</td><td/><td/><td/><td/></tr><tr><td>Validation accuracy</td><td>0 0.2 0.4 0.6 0.8</td><td>50</td><td>100 RC uRNN, n=512, ≈16K params 150 200 250 300 LSTM, n=128, ≈68K params FC uRNN, n=512, ≈540K params FC uRNN, N=116, ≈0K params KRU, n=512, ≈11K params</td><td>350</td><td>Validation accuracy</td><td>0 0.2 0.4 0.6 0.8</td><td>0</td><td>10</td><td>20 LSTM, n=128, ≈68K params 30 40 RC uRNN, n=512, ≈16K params FC uRNN, n=512, ≈540K params FC uRNN, N=116, ≈30K params KRU , n=512, ≈11K params</td><td>50</td></tr><tr><td/><td/><td colspan="2">Training steps (hundreds)</td><td/><td/><td/><td/><td colspan="2">Training steps (hundreds)</td><td/></tr></table>

KRU achieves state of the art performance on pixel by pixel permuted MNIST while having up to four orders of magnitude less parameters than other models.

Table content: <table><tr><td>Model</td><td>n</td><td colspan="5"># Parameters Total Recurrent Valid. Unpermuted accuracy Permuted accuracy Test Valid. Test</td></tr><tr><td colspan="3">LSTM (Arjovsky et al., 2016) RC uRNN (Wisdom et al., 2016) 512 128 FC uRNN (Wisdom et al., 2016) 512 ≈540K ≈68K ≈16K FC uRNN (Wisdom et al., 2016) 116 ≈30K oRNN (Mhammedi et al., 2016) 256 ≈11K EURNN (Jing et al., 2017) 1024 ≈13K KRU 512 ≈11K</td><td>≈65K ≈3.6K ≈524K ≈27K ≈8K ≈4K 72</td><td>98.1 97.9 97.5 92.7 97.0 -96.6</td><td>97.8 97.5 96.9 92.8 97.2 -96.4</td><td>91.7 94.2 94.7 92.2 -94.0 94.7</td><td>91.3 93.3 94.1 92.1 -93.7 94.5</td></tr></table>

have shown to achieve the state of the art performance of 1.265 and 1.219 BPC on the PTB test set with 4.91 and 14.41 million parameters respectively. This is respectively 13 and 38 times more parameters than the KRU-LSTM model which achieves 1.47 test BPC. Also Recurrent Highway Networks (RHN)(Zilly et al., 2016) proved to be a promising model for learning very deep recurrent neural networks. Running experiments, and in particular exploring meta-parameters with models of that size, requires unfortunately computational means beyond what was at our disposal for this work. However, there is no reason that the consistent behavior and improvement observed on the other reference baselines would not generalize to that type of large-scale models. Performance in BPC of KRU variants and other models for character level language modeling on Penn TreeBank data-set. KRU has fewer parameters in the recurrent matrix which significantly bring down training and inference time.

Table content: <table><tr><td>Model</td><td>N</td><td colspan="2"># Parameters Total Recurrent</td><td>Valid. BPC Test BPC</td></tr><tr><td colspan="3">RNN LSTM oRNN (Mhammedi et al., 2016) 512 ≈183K 300 ≈120K 150 ≈127K KRU 411 ≈120K RNN 600 ≈420K LSTM 300 ≈435K KRU 993 ≈418K KRU-LSTM 500 ≈377K</td><td>90K 90K ≈130K ≈38K 360K 360K ≈220K ≈250K</td><td>1.65 1.63 1.73 1.65 1.56 1.50 1.53 1.53</td><td>1.60 1.59 1.68 1.60 1.51 1.45 1.48 1.47</td></tr><tr><td>4.5 POLYPHONIC MUSIC MODELING</td><td/><td/><td/></tr></table>

Average negative log-likelihood of KRU and KRU-LSTM compared to the baseline models.

Table content: <table><tr><td>Model</td><td>n</td><td colspan="4"># Parameters Total Recurrent Train Test Train Test JSB Chorales Piano-midi</td></tr><tr><td colspan="3">RNN (Chung et al., 2014) LSTM (Chung et al., 2014) 36 ≈20K 100 ≈20K KRU 100 ≈10K KRU-LSTM 45 ≈19K</td><td>10K ≈5.1K 58 172</td><td>8.82 8.15 7.90 7.47</td><td>9.10 8.67 8.59 8.54</td><td>5.64 9.03 6.49 9.03 7.57 8.28 7.55 8.18</td></tr></table>

Peer review (iclr2018):
 Summary of the paper ------------------------------- This paper proposes to factorize the hidden-to-hidden matrix of RNNs into a Kronecker product of small matrices, thus reducing the number of parameters, without reducing the size of the hidden vector. They also propose to use a soft unitary constraint on those small matrices (which is equivalent to a soft unitary constraint on the Kronecker product of those matrices), that is fast to compute. They evaluate their model on 6 small scale RNN experiments. Clarity, Significance and Correctness -------------------------------------------------- Clarity: The main idea is clearly motivated and presented, but the experiment section failed to convince me (see details below). Significance: The idea of using factorization for RNNs is not particularly novel. However, it is really nice to be able to decouple the hidden size and the number of recurrent parameters in a simple way. Also, the combination of Kronecker product and soft unitary constraint is really interesting. Correctness: There are minor flaws. Some of the baselines seems to perform poorly, and some comparisons with the baselines seems unfair (see the questions below). Questions -------------- 1. Section 3: You say that you can vary *pf* and *qf* to set the trade-off between computational budget and performances. Have you run some experiments where you vary those parameters? 2. Section 4: Are you using the soft unitary constraint in your experiments? Do you have an hyper-parameter that sets the amplitude of the constraint? If yes, what is its value? Are you using it also on the vanilla RNN or the LSTM? 3. Section 4.1: You say that you don*t train the recurrent matrix in the KRU version. Do you also not train the recurrent matrix in the other models (RNN, LSTM,...)? If yes, how do you explain the differences? If no, I don*t see how those curves compare. 4. Section 4.3: Why does your LSTM in pMNIST performs so poorly? There are way better curves reported in the literature (eg in "Unitary Evolution Recurrent Neural Netwkrs" or "Recurrent Batch Normalization"). 5. General: How does your method compares with other factorization approaches, such as in "Factorization Tricks for LSTM Networks"? 6. Section 4: How does the KRU compares to the other parametrizations, in term of wall-clock time? Remarks ------------ The main claim of the paper is that RNN are over-parametrized and take a long time to train (which I both agree with), but you didn*t convinced me that your parametrization solve any of those problems. I would suggest to: 1. Compare more clearly setups where you fix the hidden size. 2. Compare more clearly setups where you fix the number of parameters. With systematic comparisons like that, it would be easier to understand where the gains in performances are coming from. 3. Add an experiment where you vary *pf* and *qf* (and keep the hidden size fixed) to show how the optimization/generalization performances can be tweaked. 4. Add computation time (wall-clock) for all the experiments, to see how it compares in practice (this could definitively weight in your favor, since you seems to have a nice CUDA implementation). 5. Present results on larger-scale applications (Text8, Teaching Machines to Read and Comprehend, 3 layers LSTM speech recognition setup on TIMIT, DRAW, Machine Translation, ...), especially because your method is really easy to plug in any existing code available online. Typos / Form ------------------ 1. sct 1, par 3: "using Householder reflection vectors, it allows a fine-grained" -> "using Householder reflection vectors, which allows a fine-grained" 2. sct 1, par 3: "This work called as Efficient" -> "This work, called Efficient" 5. sct 1, par 5: "At the heart of KRU is the use of Kronecker" -> "At the heart of KRU, we use Kronecker" 6. sct 1, par 5: "Thanks to the properties of Kronecker matrices" -> "Thanks to the properties of the Kronecker product" 7. sct 1, par 5: "vanilla real space RNN" -> "vanilla RNN" 8. sct 2, par 1: "Consider a standard recurrent" -> "Consider a standard vanilla recurrent" 9. sct 2, par 1: "step t RNN" -> "step t, a vanilla RNN" 11. sct 2.1, par 1: "U and V, this is efficient using modern BLAS" -> "U and V, which can be efficiently computed using modern BLAS" 12. sct 2.3, par 2: "matrices have a determinant of 1 or −1, i.e., the set of all rotations and reflections respectively" -> "matrices, i.e., the set of all rotations and reflections, have a determinant of 1 or −1." 13. sct 3, par 1: "are called as Kronecker" -> "are called Kronecker" 14. sct 3, par 3: "used it*s spectral" -> "used their spectral" 15. sct 3, par 3: "Kronecker matrices" -> "Kronecker products" 18. sct 4.4, par 3: "parameters are increased" -> "parameters increases" 19. sct 5: There is some more typos in the conclusion ("it*s" -> "its") 20. Some plots are hard to read / interpret, mostly because of the round "ticks" you use on the curves. I suggest you remove them everywhere. Also, in the adding problem, it would be cleaner if you down-sampled a bit the curves (as they are super noisy). In pixel by pixel MNIST, some of the legends might have some typos (FC uRNN), and you should use "N" instead of "n" to be consistent with the notation of the paper. 21. Appendix A to E are not necessary, since they are from the literature. 22. sct 3.1, par 2: "is approximately unitary." -> "is approximately unitary (cf Appendix F)." 23. sct 4, par 1: "and backward operations." -> "and backward operations (cf Appendix G and H)." Pros ------ 1. Nice Idea that allows to decouple the hidden size with the number of hidden-to-hidden parameters. 2. Cheap soft unitary constraint 3. Efficient CUDA implementation (not experimentally verified) Cons ------- 1. Some experimental setups are unfair, and some other could be clearer 2. Only small scale experiments (although this factorization has huge potential on larger scale experiments) 3. No wall-clock time that show the speed of the proposed parametrization.