Efficient and effective training of sparse recurrent neural networks

Recurrent neural networks (RNNs) have achieved state-of-the-art performances on various applications. However, RNNs are prone to be memory-bandwidth limited in practical applications and need both long periods of training and inference time. The aforementioned problems are at odds with training and deploying RNNs on resource-limited devices where the memory and floating-point operations (FLOPs) budget are strictly constrained. To address this problem, conventional model compression techniques usually focus on reducing inference costs, operating on a costly pre-trained model. Recently, dynamic sparse training has been proposed to accelerate the training process by directly training sparse neural networks from scratch. However, previous sparse training techniques are mainly designed for convolutional neural networks and multi-layer perceptron. In this paper, we introduce a method to train intrinsically sparse RNN models with a fixed number of parameters and floating-point operations (FLOPs) during training. We demonstrate state-of-the-art sparse performance with long short-term memory and recurrent highway networks on widely used tasks, language modeling, and text classification. We simply use the results to advocate that, contrary to the general belief that training a sparse neural network from scratch leads to worse performance than dense networks, sparse training with adaptive connectivity can usually achieve better performance than dense models for RNNs.


Introduction
Recurrent neural networks (RNNs), as one of the most widespread neural network architectures, mainly focus on a wide variety of applications where data is sequential, such as text classification [38], language modeling [60], speech recognition [64], machine translation [56].On the other hand, RNNs have also shown their notable success in image processing [17], including but not limited to text recognition in scenes [55], facial expression recognition [6], visual question answering [4], handwriting recognition [52].As a well-known architecture of RNNs, LSTM [27] has been widely utilized to encode various input (e.g., image, text, audio and video) to improve the recognition performance [60].LSTM's success is due to its twofold properties.The first one is its natural ability to memorize long-term information, like being deep in time, which fits very well with sequential data [61].This ability is its main advantage compared with other mainstream networks such as Multilayer Perceptron (MLP), CNNs.Second, the exploding and vanishing gradient problems are mitigated by the multiplicative gates regularizing the information over different time steps.
Recently, ensemble models, obtained by stacking RNN layers together with other types of neural network architectures (MLP and CNN), have been shown to further improve the prediction accuracy [5,8,11,13,14,16,26,41]. CNN is usually used as the feature extractor to encode spatial data and RNN is used to handle the temporal correlation of the encoded features.However, while these RNN-based models keep refreshing the records of various competitions, the cost required to train and deploy them is also increasing.Their success is often associated with expensive computations, large memory requests and slow processes in both phases, training and inference.For example, around 30% of the Tensor Processing Unit (TPU) workload in the Google cloud is caused by LSTMs [29].The computation-intensive and memory-intensive make it very difficult to train and deploy these models on resource-limited devices.Different from other neural networks, RNNs are relatively more challenging to be compressed [18,57].To tackle this problem, many researchers have already proposed various methods, such as Sparse Variational Dropout (Sparse VD) [48], sparse regularization [57], distillation [10] and pruning [24,50].While all of them can achieve promising compression rates with negligible performance loss, efficiency can only be obtained for inference because very expensive dense networks are still required in the beginning.
Only very recently, dynamic sparse training (DST) was begun to be studied to enable training sparse neural networks from scratch, with a few approaches including Sparse Evolutionary Training (SET) [47], Dynamic Sparse Reparameterization (DSR) [49], Sparse Networks from Scratch (SNFS) [15], Rigged Lottery (RigL) [18].Due to the limited support for sparse operations in the existing frameworks [1,51], the sparse structures were enforced with binary masks in the above-mentioned works.Liu et al. [36] developed a truly sparse implementation of SET, which demonstrates practical values of DST by being able to train a sparse MLP model with more than one million neurons on commodity hardware.However, these methods mainly focus on feedforward networks (e.g., convolutional neural networks (CNNs), multi-layer perceptrons (MLPs)).The performance of DST in RNNs is still unclear.
In this paper, we propose sparse training of recurrent neural networks (ST-RNNs) to gain effectiveness and efficiency both on training and inference.Concretely, we initialize the network with a sparse topology and then apply an adaptive sparse connectivity technique to optimize the sparse topology during the training phase.In comparison with all conventional compression techniques discussed above, our method is sparse from the design phase, before training.Evaluated on both language modeling and text classification, our proposed method can achieve good performance under a strict parameter budget.The major contributions of this paper are: • Better performance We empirically demonstrate that even with much smaller training FLOPs and inference FLOPs, the sparse RNN models yielded by our method are able to achieve state-of-the-art sparse training performance, even better than the dense models.
2 Related work

Text classification and language modeling
In this paper, we evaluate our method on two widely used tasks, text classification and language modeling.Text classification is a well-known topic for natural language processing to classify free-text documents into categories by detecting and extracting information in the text.Viewed as a classification problem, text classification can be dealt with by various machine learning techniques such as Naive Bayes [20], support vector machine [9] and neural networks [38].Language modeling is also a well-explored evaluation of the model's ability to estimate the probability distribution of various linguistic units based on the previous sequence of input [30].The conventional technique to solve this application is the n-gram, a model that assigns probabilities to sentences and sequences of words.Recently, recurrent neural networks have been applied to language modeling with surprising performance [60].

Sparse neural networks
There are various effective techniques to yield sparse neural networks, while preserving competitive performance.Here, we briefly discuss some of them below.

Pruning methods
Pruning as a classical model compression method has been widely used to produce different types of sparse neural networks such as restricted Boltzmann machines (RBMs) [45], MLPs, CNNs, and RNNs.By zeroing out the unimportant weights to the function computed by the neural network, pruning is able to achieve a proper compression ratio without substantial loss in performance.LeCun et al. [33] used second-derivative information to prune the unimportant weight whose deletion has the lowest damage to the model performance.Giles et al. [22] proposed a simple pruning and retraining strategy to get sparse recurrent neural networks (RNNs).However, prohibitive computation and many training iterations are the main disadvantages of these methods.Han et al. [25] enabled high compression ratios via a simple heuristic based on a magnitude pruning and retraining strategy.Based on the pruning approach of [25], an efficient compression method focusing on LSTMs was introduced [24].It can compress the LSTM model size by 20 Â (10 Â from pruning and 2 Â from quantization) with negligible loss of the prediction accuracy.Moreover, Narang et al. [50] shrunk the post-pruning sparse LTSM size by 90% through a monotonically increasing threshold.Using a set of hyperparameters can determine the specific pruning thresholds for different layers.Besides, large-sparse models were demonstrated to outperform comparably sized small-dense models on deep CNNs and LSTM-based models [43], which empirically shows the benefits of sparse neural networks.There are also some works trying to analyze sparse neural networks [21,65].Frankle et al. [21] proposed the ''lottery ticket hypothesis'', claiming that pruning makes it possible to find the ''winning tickets'' that can reach the same or even better performance as the dense networks from randomly initialized, dense neural networks.And the initialization of the ''winning tickets'' contributes mainly to its success.Zhou et al. [65] further found that the sign of the initialization of ''winning tickets'' actually results in a good performance, not the corresponding weight values.

Sparse neural networks throughout training
Recently, some works of dynamic sparse training have emerged, allowing train sparse neural networks from the beginning.Mocanu et al. [46] introduced restricted Boltzmann machines with a fixed sparse scale-free and smallworld connectivity to obtain sparse models.However, the connectivity graph does not evolve towards the optimal one without a topology optimization method.Based on Bayesian sampling, DeepR [7] can optimize both the training weights and the connectivity topology simultaneously.The convergence of the connectivity topology is guaranteed theoretically.Simple but effective magnitude-based weights pruning and random-based weights growing were proposed in SET [47].In addition to the proper classification performance, it also helps to detect important input features.Cross-layer reallocation of weights was introduced in DSR [49].Dynamic parameter reallocation is able to break the limit of the parameter budget of each layer and allocate more parameters to layers where the training loss is more quickly decreased.Proposed by Dettmers et al. [15], SNFS obtains consistent improvement in various CNN models by using the momentum information of zerovalued weights.However, calculating and storing the momentum of all weights result in extra computation and memory requests.More recently, RigL [18] introduced gradient-based regrowing to get rid of the extra computation and storage caused by SNFS.It demonstrates state-ofthe-art sparse training performance in various CNNs.
Reference [35] proposed a method to measure the distance between sparse connectivities obtained with dynamic sparse training from the perspective of graph theory.They empirically show that there are many different sparse connectivities achieving equally good performance.Unfortunately, RNNs are out of the consideration of the approaches above-mentioned.

ST-RNNs
In this section, we introduce sparse training of recurrent neural networks (ST-RNNs), the new class of sparse recurrent neural network models which we are proposing in this paper.Without loss of generality, we choose ST-LSTM as a specific case to discuss here.Please note that our method can also be easily generalized to other RNNs variants.
The general architecture of ST-LSTM is the same as the one of the dense LSTM.The only difference is that we replace the dense weights of the gates with sparse ones.The gates (f t , i t and o t ) are the keys to optimally regulate the flow of information insides LSTM cells which can be formulated by Eq. 1.
where W xi , W xf , W xo , W hi , W hf and W ho are weight matrices; b i ; b f ; b o and b g are bias weights; x t , h t , g t refer to the input, hidden state, memory cell state at step t; h tÀ1 , g tÀ1 refer to the hidden state, memory cell state at step t À 1; is element-wise multiplication and Á is matrix multiplication; rðÁÞ is the sigmoid function and tanhðÁÞ is the hyperbolic tangent function.
We illustrate the ST-LSTM cell in Fig. 1.The connections within the LSTM cell are initialized to be sparse with a certain sparsity level under the parameters budget.Then, the sparse structure is optimized gradually during the training, since not every naively initialized sparse topology is capable of reaching the competitive performance to the dense network [21].In this paper, we apply a two-step strategy: weight pruning and weight regrowing, to optimize the sparse structure during the training.The cross-layer weights redistribution proposed in [49] is not applied in ST-RNNs, since it focuses on a fixed number of parameters rather than a fixed number of FLOPs.The full ST-RNNs pseudocode is shown in Algorithm 1.Every part of our algorithm is explained below.

Sparse topology initialization
A network can be denoted by: where h 2 R is the dense parameter of the network.Instead of starting with dense parameters, our method enables the network starting with sparse parameters h s .In this paper, we use masks to enforce the sparse structure due to the limited support for sparse operations in the existing frameworks [1,51].Formally, the network is initialized by: where M is the binary mask where the nonzero elements are initialized by a random distribution or the Erd} os-Re ´nyi distribution.Erd} os-Re ´nyi is introduced in [47] where the connection (M k ij ) between neuron h kÀ1 j and h k i exists with the probability: where n k ; n kÀ1 are the number of neurons of layer h k and h kÀ1 , respectively; is a parameter determining the sparsity level s.The smaller is, the more sparse the topology is.
Initialized by Erd} os-Re ´nyi topology, layers with larger weights matrices will have higher sparsity than the smaller ones.Another approach is uniform sparse initialization which initializes every layer with the same sparsity as the total sparsity s.

Pruning strategy
Different from the magnitude-based pruning used in SET which removes a fraction f of the smallest positive weights and of the largest negative weights of each layer after each training epoch, we choose another variant, pruning weights with the smallest absolute values.The effectiveness of such magnitude-based pruning has been shown in many works  [23,25].For each individual weight h i s in every layer, we define its importance as its absolute values: Given a certain pruning rate p, we find the pth percentile of Sðh s Þ with an ascending order as c.Then the new mask is given by: Additionally, we decay the pruning rate p iteratively to zero during training, so that the sparse topology would converge to the optimal one.This is another difference between ST-RNNs and SET.

Regrowing strategy
To keep a pure sparse structure both for the forward and the backward process, we randomly regrow new weights rather than utilizing any information of nonzero parameters.This is the main difference between ST-RNNs with gradientbased sparse training techniques such as RigL and SNFS.Gradient-based regrowing heavily depends on the gradient of every parameter and they still require a dense forward pass at least once per DT iterations, whereas our method keeps a clearly sparse backward pass and requires smaller FLOPs.The random regrow is given by: R is a binary tensor in which the nonzero elements are randomly distributed.The total number of newly activated connections is the same as the number of removed connections to maintain the same sparsity level.As we keep the sparsity level of each layer strictly fixed, the FLOPs needed for training a model are proportional to their dense counterpart.

Computational complexity reduction
In the standard architecture of LSTM networks, there are an input layer, a recurrent LSTM layer and an output layer.Therefore, the learning computational complexity per time step is O(W), where W is the total number of parameters, which can be calculated as: where n h is the number of hidden units; n i and n o are the number of input and the number of output, respectively.is the hyperparameter to control the sparsity level, which usually is a small integer.Approximately, we reduce the complexity of LSTM from Our method differs from SET in several important aspects.(1) We use uniform sparse initialization instead of Erd} os-Re ´nyi.The former consistently achieves better performance with various RNN models than Erd} os-Re ´nyi.
(2) Instead of pruning a fraction f of the smallest positive weights and of the largest negative weights, we prune the weights with the least absolute values.(3) We apply a cosine decay schedule to decay the pruning rate gradually to zero.As demonstrated in Table 2, these components help ST-LSTM outperform SET by a large margin.

Experimental results
To evaluate the effectiveness of our approach, we perform language modeling with stacked LSTM and recurrent highway networks (RHN) on the Penn Treebank (PTB) dataset [40,44] and also perform text classification with one layer LSTM on six large-scale datasets.
Penn Treebank A corpus consisting of over 4.5 million words of American English, is one of the most frequently used data in language modeling.The number of unique tokens in the vocabulary is 10,000.

Language modeling
For the language modeling task, we choose two RNN models: stacked LSTM [61] and recurrent highway networks (RHN) [66].For the language modeling task, we implement ST-RNNs on PyTorch.We compare ST-RNNs with strong state-of-the-art DST baselines including SET, SNFS, and RigL and a dense-to-sparse method, ISS.

Stacked LSTMs
The stacked LSTM is a standard RNN with two stacked LSTM layers with 1500 hidden units per layer.The size of each minibatch is 20 and the unrolled step is 35.We evaluate two sparse initialization methods, Erd} os-Re ´nyi and uniform.We train all models with momentum SGD for 100 epochs and evaluate the best model on the test set.We set the dropout rate to 0.65, the learning rate to 2 and decay it by a factor of 1.33 once the validation loss stops decreasing.We empirically find that a high clip norm of 10 brings large benefits to stacked LSTM over a small clip norm of 0.25 as used in [3, 42,53,59].Our method is evaluated at two sparsity levels, 0.67 and 0.80.Results are shown in Table 2.
We can see that, with 33% parameters, all gradientbased methods (SNFS and RigL) fail to match the performance of the dense-to-sparse method (ISS), whereas random-based methods (SET, ST-LSTM) can all outperform ISS and the dense model.This observation contradicts the common belief that gradient-based weight regrowth achieves better performance than random-based regrowth [15,18].ST-LSTM initialized by Erd} os-Re ´nyi and uniform distribution all outperform ISS and also dense model by around 2 and 3 perplexity, respectively.Even with 80% parameters, ST-LSTM can still outperform its dense counterpart.Moreover, the uniform distribution consistently achieves slightly better performance than the Erd} os-Re ´nyi redistribution in the RNN settings.
It is interesting to evaluate if the dense LSTM trained from scratch with the same number of parameters can reach the performance of ST-LSTM or not.To make a fair comparison, the number of hidden units is set to be 700 and 490, respectively.We name this small dense LSTM as Small Dense.The result shows that directly training a small dense model cannot reach the same perplexity achieved by our method.This highlights the effectiveness of our method as neither the large dense LSTM nor the small dense LSTM can achieve the same performance as ST-LSTM.
We also report the FLOPs required to train one stacked LSTMs by different methods.As we mentioned, one advantage of our method is the training FLOPs is strictly constrained throughout the training, which allows us to choose suitable sparsity levels for different applications.Although the dense-to-sparse methods like ISS can discover sparse neural networks with smaller inference FLOPs, it starts from a highly over-parameterized dense model which is not memory efficient.Different from sparse training methods, ISS doesn't sparsify the embedding layer of stacked LSTMs, leading to a lower number of FLOPs.

Recurrent highway networks
Highway layers [54] are able to build very deep feedforward networks easily via a transform gate and a carry gate, which carries the original input directly to the next layer.Inspired by highway layers, Zilly et al. [66] introduced Recurrent Highway Networks (RHN) in which one or multiple Highway layers are stacked together to increase the recurrence depth.It allows each time step inside RNN layers to have deeper architecture.
We choose the same RHN variant used in ISS [57], that is, ''Variational RHN ?WT'', which refers to a dropout regularization approximating variational Bayesian inference and weight-tying.And the carry gate is also coupled with the transform gate to reduce the number of parameters.Each time step stacks 10 Highway layers together with 830 hidden units for each.The total number of parameters is 23.5 M.
Similar to LSTM, inside the RHN layer, there are matrices W and R represent the weights matrices of the transform gate T and the H nonlinear transform.We first initialize the gate weights with Erd} os-Re ´nyi topology or uniform Sparsity and then apply prune-and-grow strategy to optimize the sparse topology towards an optimal one.We set the batch size to 20 and the sequence length to 35.We also use momentum SGD for ST-RHN with a learning rate of 2. Additionally, the learning rate will be decayed by 1.11 when the validation loss fails to decrease.Dropout rates are set to be 0.20 for the embedding layer, 0.65 for the input layer, 0.25 for the hidden units and 0.65 for the output layer.We train the model for 200 epochs.
The RHN experimental results are shown in Table 3. ST-RHN outperforms the dense model by about 2 test perplexity points with only 50% training FLOPs.Besides, like stacked LSTM, the small dense RHN trained from scratch fails to match the performance of ST-RHN.This stands as empirical evidence regarding the benefit of ST-RNNs.Furthermore, similar to stacked LSTM, uniform Sparsity also has slightly better performance than Erd} os-Re ´nyi for RHN.

Text classification
For text classification, we provide another implementation of ST-RNNs based on Keras with Tensorflow backend.We choose Erd} os-Re ´nyi topology to initialize sparse layers.We compare ST-LSTM to the one layer standard dense LSTM on four public datasets, Sanders Corpus Twitter, IMDB, Yelp 2018 and Amazon Fine Food Reviews.We choose the first 150,000 samples from Yelp 2018 and split them into training data and test data.To offer fair comparisons, all the hyperparameters of these two models are the same except the sparse connectivity.For the sake of convenience, on all datasets, we set the sparsity hyperparameter to be ¼ 10, with a sparsity level of 95.69%.The dimension of word embedding and the hidden state of LSTM unit are both 256.The number of words in each sentence is 100, and the total number of words in the embedding vector is 20,000.The rewire rate f ¼ 0:2 for Yelp 2018 and Amazon, f ¼ 0:6 for Twitter and f ¼ 0:4 for IMDB; Additionally, the mini-batch size is 64 for Twitter, Yelp and Amazon, and 256 for IMDB.We train the models using Adam optimizer with the learning rate of 0.001 for Twitter and Amazon, 0.01 for Yelp 2018, and 0.0005 for IMDB.Table 4 is the test accuracy for the four datasets on which ST-LSTM is compared with dense LSTM.We can see that ST-LSTM can outperform dense LSTM on three datasets, while decreases the number of parameters from 5.6M to 0.2M.The only dataset that ST-LSTM does not increase the accuracy is Amazon, with a 1.36% loss of accuracy.We mention here that the accuracy on Amazon can be improved by searching for the best hyperparameters, but it is out of the goal of this paper.
Moreover, to sanity check the effectiveness of ST-RNNs and to provide a comparison with existing traditional classifiers, we choose two datasets AG's News and Yelp Review Polarity from published literature [28,63].For these two experiments, the sparsity level is 20 with corresponding sparsity level 92.2%.The optimizer we use is Adam with learning rates 0.01 and 0.001 for AG's News and Yelp Review Polarity, respectively.As shown in Table 5, our method is still competitive among the state-ofthe-art methods on AG's News and Yelp Review Polarity.The best performance shown in bold Flops required to train a network and Flops required to inference on a single data are reported by normalizing with the FLOPs of a dense model ''Small Dense'' represents a small dense RHN trained from scratch with the same number of parameters as ST-LSTM literature on these datasets is outside the scope of this paper, as our aim is to demonstrate the ability of sparse recurrent neural networks to reach (and most of the times to outperform) the performance of their dense counterparts.

Note that outperforming every other model reported in the
Besides this, we are also interested in if ST-LSTM is still trainable under the extreme sparsity.To do this, we set the sparsity to an extreme level (99.1%), and we compare our algorithm with the dense LSTM.We test our approach on five datasets.The results are shown in Table 6.With only 0.04M parameters, our method is still able to find a good sparse topology with competitive performance.

Sensitivity analysis
To understand better how the two hyperparameters, pruning rate and sparsity, influence the performance of ST-RNNs, we make extra analysis on Sanders Corpus Twitter dataset and Penn Treebank dataset.

Pruning rate
As a hyperparameter of ST-RNNs, the pruning rate determines how many connections should be removed after each epoch.We conduct experiments with various pruning rates from 0.1 to 0.9 to study the influence of different pruning rates.The test accuracy is reported in Fig. 2. We can see that the ST-RNNs have better performance with relatively higher pruning rates between 0.5 and 0.9 than the lower options.This is held for both two datasets.Note that, while varying the pruning rate results in the different performance of ST-RNNs, the difference is very small when the pruning rate locates in a proper interval, especially for Twitter.

Sparsity
For sparse training networks, there is a trade-off between the sparsity level and the performance of sparse neural networks.If the network is too sparse, it will not have sufficient capacity to learn the dataset, whereas if the network is too dense, the benefits provided by sparse neural networks will be too subtle.In order to analyze the sensitivity between model performance and sparsity, we perform an experiment with different sparsity levels.The results are reported in Fig. 3.We can see that the one-layer ST-LSTM can outperform the dense counterpart with sparsity in an interval between 52.5% to 99.1%.It is worth noting that, for Twitter with extreme sparsity, when ¼ 2 (sparsity is equal to 99.1%), the accuracy of ST-LSTM The number of parameters of ST-LSTM is 0.04M and the dense LSTM counterpart is 5.6M (78.75%) is still higher than the accuracy of Dense-LSTM (77.19%).Moreover, it is interesting to see that when the sparsity level goes down under 90% the accuracy is also going down, this being in line with our observation that usually sparse networks with adaptive sparse connectivity perform better than fully connected networks.For Penn Treebank, as long as the sparsity is below 80%, ST-LSTM can reach the dense performance.

Analyze the effect of cross-layer parameter reallocation
Cross-layer parameter reallocation has shown impressive improvement in convolutional neural networks [15,49].To verify the effect of parameter reallocation on RNNs, we compare the perplexity between stacked ST-LSTM and ST-RHN on Penn Treebank with and without parameter reallocation, respectively.The parameter reallocation method we choose is Sparse Momentum proposed in [15], which redistributes weights according to the mean of momentum magnitude m i of all nonzero weights in each layer i.More specifically, first, the momentum contribution of layer i is obtained by normalizing m i through all layers P k i¼0 m i after each epoch.Then, the number of parameters to be regrown in each layer is the multiplication of the total number of regrow weights with the momentum contribution of each layer.
The results can be seen in Table 7. Parameter reallocation among layers results in performance improvement for ST-LSTM steadily for both initialization, whereas the performance degrades dramatically if cross-layer parameter reallocation is used for RHN.These results suggest parameter reallocation is not pivotal for RNNs.At least, proper reallocation strategies are needed to design for sparse RNNs.

Conclusions and future work
In this paper, we propose ST-RNNs to train intrinsically sparse recurrent neural networks efficiently under the situation where the training FLOP budget is strictly limited.(2) inference efficiently: our method yields sparse RNNs that can achieve better performance than their dense counterpart with much fewer FLOPs; (3) state-ofthe-art sparse RNN performance: with the same number of parameters, ST-RNNs achieves state-of-the-art performance with LSTMs and RHN on language modeling and text classification.
One possible direction to improve the performance of sparse training is to apply the advanced activation function e.g., SPOCU [31] and SELU [32], to increase the gradient flow.As noted by [2, 19,34], sparse neural networks suffer from a poor gradient flow which limits the learning capability of the sparse networks.Compared with ReLU which has zero derivatives for all negative inputs, activation functions such as SPOCU and SELU might help to increase the gradient flow of sparse training.Additionally, the ability of SPOCU to alleviate the vanishing gradient problem can also improve the performance of sparse LSTMs.
Besides, the results demonstrated in this paper are achieved by masked weights, since GPU-accelerated libraries have limited support for sparse operations.Our paper provides motivation for new types of hardware accelerators and libraries with better support for sparse neural networks.In future work, we intend to develop more efficient methods to achieve sparse neural networks that can be optimized by contemporary hardware.We are also interested to modify modern libraries so that the advantages of sparse networks can be made full use of.Furthermore, the explanation underlying the observation that sparse networks with adaptive sparse connectivity can generalize better than their dense counterpart has not been fully studied yet.Our work points out important directions for future research.

Compliance with ethical standards
Conflict of interest All authors certify that they have no affiliations with or involvement in any organization or entity with any financial interest or non-financial interest in the subject matter or materials discussed in this manuscript.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made.The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material.If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.To view a copy of this licence, visit http://creativecommons. org/licenses/by/4.0/.

•
Training and inference efficiency We propose an algorithm to enable training intrinsically sparse RNNs with a fixed number of parameters without involving any dense pre-training steps.The training floating-point operations (FLOPs) and the parameter count are strictly proportional to the dense model throughout training.

Fig. 2
Fig. 2 Performance of ST-RNNs with various pruning rates on Sanders Corpus Twitter and Penn Treebank datasets.The performance of the dense model is indicated with a dashed orange line (colour figure online)

Table 1
Datasets for sentiment analysis experiments

Table 2
Single model perplexity on validation and test sets in stacked LSTM on the Penn Treebank datasetThe best performance shown in bold Flops required to train a network and Flops required to inference on a single data are reported by normalizing with the FLOPs of a dense model ''Small Dense'' represents a small dense LSTM trained from scratch with the same number of parameters as ST-LSTM

Table 5
Test accuracy ð%Þ on AG's news and Yelp review polarity

Table 7
Single model perplexity on validation and test sets of ST-LSTM and ST-RHN on PTB with and without cross-layer parameter reallocation