Compression of Recurrent Neural Networks using Matrix Factorization
Compressing neural networks is a key step when deploying models for real-time
or embedded applications. Factorizing the model's matrices using low-rank
approximations is a promising method for achieving compression. While it is
possible to set the rank before training, this approach is neither flexible nor
optimal. In this work, we propose a post-training rank-selection method called
Rank-Tuning that selects a different rank for each matrix. Used in combination
with training adaptations, our method achieves high compression rates with no
or little performance degradation. Our numerical experiments on signal
processing tasks show that we can compress recurrent neural networks up to 14x
with at most 1.4% relative performance reduction.
Lucas Maison, Hélion du Mas des Bourboux, Thomas Courtat
# Compression of Recurrent Neural Networks using Matrix Factorization

###### Abstract

Compressing neural networks is a key step when deploying models for real-time or embedded applications. Factorizing model's matrices using low-rank approximations is a promising method for achieving compression. While it is possible to set the rank before training, this approach is neither flexible nor optimal. In this work, we propose a post-training rank-selection method called Rank-Tuning that select a different rank for each matrix. Used in combination with training adaptations, our method achieve high compression rates with no or little performance degradation. Our numerical experiments on signal processing tasks show that we can compress recurrent neural networks up to \(14\times\) with at most \(1.4\%\) of relative performance reduction.1

Footnote 1: Code and models are publicly available at [https://github.com/Deathekirl/low-rank-approximation](https://github.com/Deathekirl/low-rank-approximation), together with instructions for downloading the datasets.

_Keywords--_ model compression, low-rank approximation, singular value decomposition, rank-tuning, recurrent neural networks

## 1 Introduction and Related Work

We observe a clear tendency of neural network size growth [1]. New architectures using hundreds of millions or even billions of parameters are elaborated, leading to state-of-the-art performance but also to increasing difficulties: slowness of inference, increased demand for storage, exploding electricity consumption and pollution. These issues inhibit the deployment of high performance neural network models in real-time and embedded applications.

Several general strategies for reducing networks' complexity have been explored with success, including distillation [2], pruning [3], quantization [4], low-rank approximations [5]. The interested reader can refer to [6] for a survey of network compression methods. In this work we focus on low-rank approximations which are a promising technique not yet included in deep learning libraries at the time of writing.

There exist several methods for approximating matrices, for instance the Low-Rank (LR) decomposition [5] where Singular Value Decomposition (SVD) is used to factorize matrices, reducing the number of operations to carry out for the matrix product. Another example is the Tensor-Train (TT) decomposition [7] where a matrix is represented as a product of several tensors.

The LR decomposition can be exploited in a number of ways. The most common approach is to learn the weights of pre-factorized matrices by fixing their rank before training [5, 7, 8, 9, 10]. However, this strategy requires a costly2 research of optimal ranks, or a-priori knowledge of them. Moreover, it's not very adaptable since ranks cannot be changed after training.

Footnote 2: It is necessary to re-train the model from scratch for each ranks combination.
Another approach consists in learning whole matrices and factorize them after training. There exist several training adaptations that can greatly enhance the quality of the decomposition. In [11, 12, 13], authors apply a regularization based on matrix norms (see section 2.2.1). Trained Rank Pruning (TRP, [11]) combines regularization and training-time factorization (see section 2.2.2) and uses _energy_ as a criterion for choosing ranks. The Learning-Compression (LC, [14]) algorithm enable learning weights and ranks alternatively.

These methods have various application areas. One can factorize deep neural networks for vision tasks [5, 9] or ASR tasks [10]. In [11, 12, 13, 5, 14], authors factorize convolutional networks (LeNet, VGG, ResNet) evaluated on image recognition tasks (MNIST, CIFAR, ImageNet, etc.). In [7, 8], authors factorize recurrent networks (RNN, LSTM) evaluated on ASR (Automatic Speech Recognition) or linguistic modeling tasks.

Regularization and training-time factorization have been used in [11] to compress convolutional networks. Recurrent networks have also been compressed using ranks fixed prior to training [8].

The present paper aims at compressing recurrent neural networks through training-time factorization and regularization. To the best of our knowledge, it is the first work implementing both these strategies while also selecting the best ranks during post-training.

The rest of this article is organized as follows. In section 2 we first introduce the mathematical background of our work, then present the two training adaptation methods we used, and finally describe post-training rank selection strategies. In section 3 we present the different evaluation tasks and our model's architecture. We present our results and discuss our findings in section 4. Section 5 concludes this study.

## 2 Low-Rank approximations

for neural networks

This section introduces the key concept of SVD. Then we present two techniques used at training time to obtain matrices of low-rank and achieve better compression. Finally, several post-training rank selection strategies are presented.

### Using SVD to factorize a model

A neural network \(\mathcal{M}\) with parameters \(\theta_{\mathcal{M}}\) is composed of an ensemble of \(M\) weight matrices and bias vectors. For instance, a linear layer uses a matrix \(W\) and a vector \(b\) to perform the operation \(y=Wx+b\). Same reasoning can be applied to more complex units like a GRU (Gated Recurrent Unit [15]) or an attention layer used in the Transformer [16] architecture, which are decomposable in simple matrix-vector operations. The size of the vectors being negligible when compared to the size of the matrices, we focus on compressing the latter.

Let's write a weight matrix \(W\in M(n,m)\) and a data matrix \(A\in M(m,k)\). It costs \(nm\) memory units to store \(W\), and \(nmk\) operations to compute \(W\times A\). It is possible to decompose \(W\) as a product of three matrices

\[W=U\Sigma V^{T}=U\mathrm{diag}(\sigma_{1},...,\sigma_{m})V^{T}, \tag{1}\]

with \(U\in M(n,n)\), \(\Sigma\in M(n,m)\) and \(V\in M(m,m)\). Note that \(\Sigma\) contains the _singular values_ of \(W\), sorted in descending order. According to the Eckart-Young theorem [17], this is an accurate decomposition that always exists.

However, it is also possible to approximate this factorization if we truncate the \(\Sigma\) matrix, keeping only its largest values. The factorization is said to be of _rank_\(r\) if we keep the \(r\) first singular values and drop the rest. In this case we have

\[W\simeq\hat{W}=U_{r}\Sigma_{r}V_{r}^{T}=(U_{r}\Sigma_{r})V_{r}^{T}=\hat{U}_{r} V_{r}^{T}, \tag{2}\]

with \(r\leq\min(n,m)\) and \(U_{r}\), \(\Sigma_{r}\), \(V_{r}^{T}=U[:,:r]\), \(\Sigma[:r]\), \(V^{T}[:r,:]\). As we increase the rank \(r\), the quality of the approximation improves [17], as illustrated by the formula

\[\left\|W-\hat{U}_{r}V_{r}^{T}\right\|_{F}=\sqrt{\sum_{i=r+1}^{m}\sigma_{i}^{2 }}. \tag{3}\]

The storage cost of \(\hat{W}\) is \(r(n+m)\), and the matrix multiplication \(W\times A\) becomes

\[WA\simeq\hat{W}A=\hat{U}_{r}V_{r}^{T}A=\hat{U}_{r}(V_{r}^{T}A), \tag{4}\]

which costs \(r(n+m)k\) operations. In the end, we obtain both a memory and complexity gain if the following condition is met:

\[r<\frac{nm}{n+m}. \tag{5}\]

It is therefore possible to both compress the model and accelerate its inference by decomposing the weight ma
trices using low-ranks.3 The lower the ranks, the better the compression. However, this could lead to a precision diminution if the matrices are too much approximated. We will explore this trade-off in details in section 4.3.

Footnote 3: In theory, there is a speed gain as soon as equation 5 is verified. In practice, the gain depends on the compute library implementation.

### Training adaptations for neural networks compression

SVD can be leveraged to compress any model, including those already trained. However, the compression rate may be poor if no adaptation has been used during training, as we will see in section 4. Here, we present two complementary ways of adapting the training which will increase the compression potential of the model without hurting much its performance.

#### 2.2.1 Nuclear Regularization

The rank of a matrix \(W\) is

\[\text{rank}(W)=\sum_{i=1}^{m}\mathbf{1}_{\sigma_{i}>0}. \tag{6}\]

Minimizing the rank of \(W\) is therefore equivalent to maximizing the number of null singular values. Note that if some singular values are sufficiently close to zero, setting them to zero will reduce the rank of the matrix without changing much its action on vectors. It follows that diminishing the singular values during training will reduce the rank of the matrices, making it easier to compress the model.

One method to do so is to add regularization to the loss function, effectively constraining the rank of the matrices during training. In this work we use the _nuclear norm4_ as a regularizer:

Footnote 4: Also known as _trace norm_ or _Schatten 1-norm_.

\[\left\|W\right\|_{*}=\sum_{i=1}^{m}\sigma_{i}. \tag{7}\]

The loss at epoch \(t\) then becomes

\[\mathscr{L}=\sum_{(X,y)}\mathscr{L}_{task}(\mathcal{M}(X,\theta_{\mathcal{M} }),y)+\lambda(t)\sum_{W\in\theta_{\mathcal{M}}}\left\|W\right\|_{*}, \tag{8}\]

where the sum is evaluated on all the network' weight matrices.5\(\mathscr{L}_{task}\) is the task's objective loss (e.g. cross-entropy for classification tasks and Mean Squared Error (MSE) for regression tasks), and \(\lambda(t)\) is an ad-hoc time-depending function defined as

Footnote 5: However, we decided to only take into account the GRU’ matrices, since they represent more than 99% of the network’ weights.

\[\lambda(t)=\bar{\lambda}\times\begin{cases}0&\text{if }t<T_{1}\\ \frac{t-T_{1}}{T_{2}-T_{1}}&\text{if }T_{1}\leq t<T_{2}\\ 1&\text{otherwise}\end{cases}, \tag{9}\]

where \(\bar{\lambda}\) is the final weight of the regularization and \(T_{1}\) and \(T_{2}\) are two pivot epoch numbers. This function allows for a progressive addition of the regularization during training. Indeed, we find that a model cannot learn if regularization is added from the first epoch. We believe that it needs some time to adjust its weights (which are randomly initialized), after which we can add regularization.

#### 2.2.2 Hard Low-Rank Approximation

Another method for reducing the ranks during training consists in factorizing the matrices every \(N\) epochs with target rank \(R\) (see algorithm 1 for details). We call this method _Hard Low-Rank Approximation_ (HLRA) because it imposes a brutal constraint on the network, effectively reducing the ranks at the cost of performance (i.e. the optimized metric). During training the model eventually regain the lost performance between the factorization steps. In our experiments, we obtain a model with low-rank matrices with no or little performance loss.

```
0: Target rank \(R\), period \(N\) if\(t\equiv 0\mod N\)then for\(W_{i}\in\theta_{\mathcal{M}}\)do \(U,\Sigma,V^{T}=\text{SVD}(W_{i})\) \(U_{R},\Sigma_{R},V_{R}^{T}=U[:,:R],\Sigma[:R],V^{T}[:R,:]\) \(\hat{W_{i}}=U_{R}\times\Sigma_{R}\times V_{R}^{T}\) endfor \(\theta_{\mathcal{M}}\leftarrow\{\hat{W_{1}},...,\hat{W_{M}}\}\) endif
```

**Algorithm 1** HLRA method

### Post-training rank selection strategies

After training, the next step is to factorize each matrix to its optimal rank6 with respect to the model's performance (evaluated on the validation split). The
optimal rank of each weight matrix is unknown. We could brute-force search the ranks, but this is intractable in practice. It is therefore necessary to use heuristics.

#### 2.3.1 Simple strategies

A naive approach for choosing ranks consists in setting all matrices to the same rank \(R_{0}\) and then evaluating the model's performance.7 We can choose the smallest \(R_{0}\) such that the performance stays greater than some threshold.

Footnote 7: Since matrices differ in size, some ranks may be too large for some of them. It is for instance impossible to decompose a \((300,200)\)-matrix to the rank \(250\), since the rank has to be greater than both dimensions. In this case, the matrix is not decomposed.

This strategy however is likely not optimal, since some matrices in the network are harder to factorize than others. A small number of matrices will be responsible for a large part of the performance degradation when \(R_{0}\) is low. One can easily spot these on figure 1: the matrices of the deepest layers have slowly decreasing singular values. When ignoring hard-to-factorize matrices, we can obtain better compression results. This second approach is said to be _adaptative_ since, for a given rank, matrices are factorized only if the associated decomposition error \(\left\|W-\hat{U}_{r}V_{r}^{T}\right\|_{F}\) is less than a given threshold, effectively filtering hard-to-factorize matrices.

#### 2.3.2 Rank-Tuning

We introduce Rank-Tuning, which is a more sophisticated method for selecting the ranks. It is described in algorithm 2. We factorize each matrix \(W_{i}\) it at rank \(r_{i}\) while leaving all the others unfactorized. We then run the model with the compressed matrix and evaluate its performance \(p\) on the validation dataset. If \(p\) is at least at \(\Delta_{p}\) of the topline performance \(p^{*}\), we stop and move on to the next matrix. Otherwise, we keep increasing \(r_{i}\) (therefore diminishing the approximation error) until the condition is met. Finally, when all the ranks \(\hat{r_{1}},...,\hat{r_{M}}\) have been found, we factorize each matrix \(W_{i}\) at rank \(\hat{r_{i}}\) to obtain the compressed network.

```
0: Topline \(p^{*}\), degradation tolerance \(\Delta_{p}\) for\(W_{i}\in\theta_{\mathcal{M}}\)do \(n,m=\text{shape}(W_{i})\) \(U,\Sigma,V^{T}=\text{SVD}(W_{i})\) for\(1\leq r<\frac{nm}{n+m}\)do \(U_{r},\Sigma_{r},V_{r}^{T}=U[:.:r],\Sigma[:r],V^{T}[:r,:]\) \(\hat{W_{i}}=U_{r}\times\Sigma_{r}\times V_{r}^{T}\) \(\hat{\theta}_{\mathcal{M}}\leftarrow\{W_{1},...,\hat{W_{i}},...,W_{M}\}\) \(p=\text{performance}(\mathcal{M},\hat{\theta}_{\mathcal{M}})\) if\(p>p^{*}-\Delta_{p}\)then \(\hat{r_{i}}\gets r\)  break endif endfor return\(\hat{r_{1}},...,\hat{r_{M}}\)
```

**Algorithm 2** Rank-Tuning

#### 2.3.3 Complexity considerations

The exact computational cost of the procedures defined in sections 2.3.1 and 2.3.2 is quite difficult to evaluate, for several reasons:

* they act on matrices of various shapes;
* they rely on highly optimized operations (SVD, matrices operations) which are implemented by linear algebra libraries and whose complexities are not naive.

However, we remark that network's inference is the most costly operation performed. To get an idea of the computational cost of selecting the ranks, we can simply count the number of times we run inference on the validation set.

When using the simple strategies, we run one inference for each possible value of \(R_{0}\). The number of inferences is of the order of \(\mathcal{O}(\underset{n,m=\text{shape}(W_{i})}{\max}(\min(n,m)))\). In our setting, this simplifies to \(\mathcal{O}(h)\), where \(h\) is the hidden size of the GRUs. See section 3.2 for more details on our models' architecture.

When using Rank-Tuning, we run one inference for each possible rank for each matrix. The number of inferences is of the order of \(\mathcal{O}(\underset{n,m=\text{shape}(W_{i})}{\sum}\frac{nm}{n+m})\) which simplifies to \(\mathcal{O}(M\times h)\). The cost of running Rank-Tuning is noticeably higher than those of naive strategies, but it is likely to lead to better compression rates. Moreover, it is still far more efficient than a brute-force search, which would require \(\mathcal{O}(h^{M})\) inferences to run.
Experimental Setup

In this section we first introduce the three tasks on public datasets we used for evaluating our method. We also describe the architecture of our model.

### Introducing the tasks

**SequentialMNIST** is a toy dataset based on the MNIST database (Modified National Institute of Standards and Technology database [18]). It consists of a sequential representation of MNIST images: each \(28\times 28\) image is flattened, leading to a sequence of length \(784\), which is then divided in two sequences of equal length, representing the top and the bottom of the image.

Given the first sequence (top), the task is to reconstruct the second (bottom). This is a sequence-to-sequence problem operating on vectors of size \(392\). We use the original train/test splits, and \(20\%\) of the training set for validation during training. The MSE between the output sequence and the target sequence is used as the learning loss and as the performance metric at test time.

**DOCC10** (Dyni Odontocete Click Classification, 10 species [19]) is a dataset of marine mammals echolocation clicks. Each sample is a sequence of length \(8192\) centered on a _click_ of interest. The task is to classify each sample in one of the \(10\) classes of marine mammals. The dataset is balanced and composed of \(134\,080\) samples, with the train/test splits available on the online challenge website8. We use \(20\%\) of the training set for validation during training. Cross-Entropy is used as the learning loss, while the test performance metric is classification accuracy.

Footnote 8: [https://challengedata.ens.fr/participants/challenges/32/](https://challengedata.ens.fr/participants/challenges/32/)

Footnote 9: [https://www.kaggle.com/datasets/hdumasde/pythgoremodreco](https://www.kaggle.com/datasets/hdumasde/pythgoremodreco)

#### AugMod

[20], which stands for _Augmented Modulation_, is a synthetic dataset of radio signals. It is publicly available.10 The authors used seven different linear modulations and five bins of SNR (Signal to Noise Ratio). They generated \(5000\) examples per (SNR, modulation) pair, leading to a total of \(175\,000\) examples, each of sequence length \(1024\). The task is to classify each sample in one of the seven modulation classes. We use \(10\%\) of the dataset for validation and \(10\%\) for testing. Cross-Entropy is used as the learning loss, while the test performance metric is classification accuracy.

Footnote 10: [https://www.kaggle.com/datasets/hdumasde/pythgoremodreco](https://www.kaggle.com/datasets/hdumasde/pythgoremodreco)

The hyperparameters used for each of these tasks are grouped in table 1. Note that for AugMod, we trained two models of different capacity, labelled _AugMod_ - _Large_ and _AugMod_ - _Small_. We do not apply regularization to the small version of the model, as this results in a larger accuracy loss.

### Model's architecture

Our model consists of a \(l\)-layered GRU with hidden-size \(h\) and dropout applied after each layer, followed by a ReLU (Rectified Linear Unit [21]) activation. At the end, a max pooling layer collapses the time dimension, producing a one-dimensional vector which is finally fed to a fully connected layer. Applying a pooling layer over the time dimension has the advantage of making the model invariant to the number of samples in the input signal [20]. Table 2 summarizes the hyperparameters characterizing the architectures of the models.

Note that for the SequentialMNIST task the model is slightly different. We remove the pooling layer, as a result of which we obtain a sequence as output.

\begin{table}
\begin{tabular}{l c c c c c} \hline  & \(\lambda\) & \(R\) & \(T_{1}\) & \(T_{2}\) & \(N\) & Epo. \\ \hline SeqMNIST & \(10^{-4}\) & 40 & 10 & 120 & 20 & 150 \\ DOCC10 & \(10^{-3}\) & 20 & 5 & 25 & 10 & 50 \\ AugMod - L & \(10^{-4}\) & 20 & 10 & 30 & 15 & 50 \\ AugMod - S & 0 & 10 & n.a. & n.a. & 15 & 100 \\ \hline \end{tabular}
\end{table}
Table 1: Hyperparameters for the different tasks. See equation 9 and algorithm 1 for details.

\begin{table}
\begin{tabular}{l c c c c} \hline  & Input & Output & \(l\) & \(h\) \\ \hline SeqMNIST & 1 & 1 & 2 & 100 \\ DOCC10 & 1 & 10 & 3 & 150 \\ AugMod - Large & 2 & 7 & 3 & 150 \\ AugMod - Small & 2 & 7 & 2 & 62 \\ \hline \end{tabular}
\end{table}
Table 2: Details of the model’s hyperparameters characterizing the architecture.
Results and Discussion

For each model architecture listed in Table 2, we train two models: one baseline trained without any training adaptation (standard training), and another trained using nuclear regularization and HLRA (LRA-aware training). We denote these models _Base_ and _LRA_ respectively.

In this section we first present a qualitative analysis of the impact of training adaptation on the models' singular values. Then we show how much we can compress models using our method. Finally we discuss the size-accuracy trade-off permitted by Rank-Tuning.

### Impact of training adaptations on singular values

Both nuclear regularization and HLRA are supposed to act on the singular values of the matrices. We can check that it is indeed the case by plotting the singular values in decreasing order, that is, the list of values \(\sigma_{1},...,\sigma_{m}\), which are the parameters of the diagonal of matrix \(\Sigma\) (see equation 1). Figure 1 is an example of such a figure for the DOCC10 task, using a logarithmic scale.

We observe that for the _Base_ model, singular values decrease slowly from \(\approx 20\) to \(\approx 0.1\). This is in sharp contrast with the singular values of the _LRA_ model, which decrease steeply from \(\approx 7\) to \(\approx 10^{-4}\). This clearly show the impact of training adaptations.

We can see that some matrices have singular values that decrease less rapidly than others. Indeed, the deeper the layer, the slower singular values decrease. We believe that matrices farther from input need more independent parameters to process the data they receive, their rank is therefore higher and this is reflected by their singular values. As a matter of fact, when we run the Rank-Tuning algorithm on the models, we observe that for each matrix, the selected rank is correlated with the decrease of the associated curve. The lower the rank, the faster the decrease. Thus, looking at this figure, one can quickly identify which matrices will be hard to compress (meaning that they have a high rank).

### Compression of neural networks

As we mentioned in section 3, each dataset is split into three sets (train, validation and test). We use these to define the following compression procedure:

1. train the model using the training set. We use the validation set to do early-stopping;

Figure 1: Singular values evolution, with and without training adaptations, for the different matrices. Curves above and under the black dashed line correspond to a _Base_ model and a _LRA_ model, respectively. GRUs being bilateral, each curve is present twice, one for each direction.
2. after training, use the validation set to search for optimal factorization ranks;
3. use the test set to measure performance of the uncompressed model;
4. use the test set to measure performance of the compressed model.

It turns out that the Rank-Tuning algorithm significantly outperforms10 the simpler rank-selection strategies that we exposed in section 2.3.1, at the cost of a higher computational cost. In the rest of this section, all the models are compressed using Rank-Tuning unless stated otherwise.

Footnote 10: Meaning that models can be compressed further for an equivalent performance degradation.

Results on the different tasks are regrouped in Table 3. For a given task, we report the size (number of parameters), FLOP (Floating-point Operations), and performance of _Base_ and _LRA_ models, before and after applying the compression step (i.e. the Rank-Tuning algorithm). As we can see, our training adaptation method significantly improves the compressibility of the _LRA_ models. With a performance degradation of roughly 1%, we achieve very high compression rates, from 69% to 93% depending on the task, whereas for the _Base_ models (standard training), the compression rates range from 10% to 78%. Note that we systematically obtain better compression rates when using training adaptations.

We observe that compressing the models almost always leads to a small performance reduction. This is expected: since compression is not lossless, we lose some information (parameters) when factorizing matrices. However, by design these are unimportant parameters, that's why we are able to achieve high compression rates without hurting much the performance. We also observe on Table 3 that the use of training adaptations can lead to a performance reduction as high as one accuracy point _before_ compression. If this is statistically significant, this would mean that LRA-aware training slightly hurts the model's performance in order to improve its compressibility. In order to disentangle this observation from the natural variance due to weights initialization, we trained 10 _Base_ and 10 _LRA_ models on the SequentialMNIST task and checked their MSE. We obtained a mean MSE of \(0.321(\sigma=0.022)\) for _Base_ and of \(0.317(\sigma=0.014)\) for _LRA_ models respectively, where \(\sigma\) gives the standard deviation. We thus observe no significant differences between the two training methods. Though we did not run the same experiment with the other tasks due to the high computational cost, we believe we would observe a similar trend.

Note that we don't report inference speed because we're unable to measure it in a satisfactory manner. Although in theory network compression via matrix factorization decreases both the model's size and inference time (as explained in section 2.1), in practice inference relies heavily on matrix multiplications optimized by linear algebra libraries. Thus, without an implementation of a two-step multiplication as described in equation 4, it is not possible to take advantage of the factorization at inference time. Nonetheless, we report the FLOP metric in Table 3 to give an indication of the speed gain that could be achieved using an adequate implementation.

### Size-accuracy trade-off

The Rank-Tuning algorithm 2 is parameterized by the precision tolerance \(\Delta_{p}\). By varying \(\Delta_{p}\), we can produce several compressed models with different compression rates and performance degradation. Note that this can be

Figure 2: A representation of the size-accuracy trade-off for the AugMod task. Uncompressed and compressed models are represented by stars and dots, respectively.
done without additional computations, by slightly adapting the Rank-Tuning algorithm to use a range \([\Delta_{1},\Delta_{2},...]\).

We trained several models (Large and Small architectures, with and without LRA-aware training) on the AugMod dataset, then compressed them with \(\Delta_{p}=\frac{i}{1000}p^{*}\) for \(1\leq i\leq 10\). For each of these factorized models, we plotted its size and performance relative to the baseline (Large, uncompressed). The results are shown on figure 2. As we can see, LRA-aware training significantly improves over standard training both in terms of compression rate and performance. Moreover, this graph clearly shows one of the key advantage of our method: one can choose the desired size-accuracy trade-off according to what is needed for the model's deployment.

Finally, we discuss one key question in model optimisation: in terms of performance, is it better to use a large compressed model or a small uncompressed one? According to our experiments on the AugMod task, a large model trained with LRA-aware training can be compressed to the size of a small model, while retaining superior accuracy (see figure 2, skyblue curve). However, if we want to obtain a model as small as possible, it is better to compress a small model. On the AugMod dataset, we were able to compress the small model nearly \(50\times\) compared to the large model, while retaining \(97\%\) of its accuracy.

## 5 Conclusion

Compressing a neural network while maintaining its performance remains challenging. In this work, we used regularization and training-time factorization to train recurrent neural networks which can be more effectively compressed. Using these training adaptations in conjunction with a post-training rank-selection, we were able to reach very high rates of compression with no or little performance loss. Our experiments show that the proposed method can be used to select a good trade-off between compression and performance. We leave as future work the application of this method to other architectures, as well as the exploration of the combination of low-rank approximations with other compression methods like quantization or distillation.
