The light gated recurrent units (Li-GRU) is well-known for achieving impressive results in automatic speech recognition (ASR) tasks while being lighter and faster to train than a standard gated recurrent units (GRU). However, the unbounded nature of its rectified linear unit on the candidate recurrent gate induces an important gradient exploding phenomenon disrupting the training process and preventing it from being applied to famous datasets. In this paper, we theoretically and empirically derive the necessary conditions for its stability as well as engineering mechanisms to speed up by a factor of five its training time, hence introducing a novel version of this architecture named SLi-GRU. Then, we evaluate its performance both on a toy task illustrating its newly acquired capabilities and a set of three different ASR datasets demonstrating lower word error rates compared to more complex recurrent neural networks.

Speech Recognition, Recurrent Units.

§ INTRODUCTION

Automatic Speech Recognition (ASR) is the task of transforming spoken language into text. Myriads of real-life devices and applications ranging from personal assistants to smart cars and automatic captioning rely on advanced ASR systems to provide the optimal experience to end users. ASR has greatly benefited from the rise of deep learning to improved robustness and performance. In practice, various deep learning techniques and models exhibiting different strengths and weaknesses have been developed over the last decade. Transformer neural networks, for instance, have reached unprecedented levels of word error rates for offline ASR <cit.>. Sequence-to-sequence (seq2seq) modelling with recurrent neural networks (RNN), on the other hand, has steadily achieved top-notch performance both for online and offline ASR while remaining fairly simpler to approach and implement both for academia and for the industry. Nowadays, transformers and RNN still co-exist widely, and the final choice of the architecture boils down to the desired use-case and the available compute resources. A successful implementation of a recurrent CTC-Attention encoder-decoder was first proposed in <cit.>, and consisted in a recurrent encoder with an attentional recurrent decoder trained jointly with the CTC loss function <cit.>. Such encoder-decoder architectures offer a rich literature as well as an ever-growing number of open-source implementations <cit.> which continue to power many real-life products relying on ASR.

Following the CTC-Attention paradigm, one must find the most appropriate encoder to turn the speech signal into a latent subspace that the decoder can further process. In practice, and based on the successful DeepSpeech architecture <cit.>, many competitive encoders simply combine convolutional layers with a deep recurrent neural network. Hence, the choice of the recurrent unit is of crucial interest to achieve state-of-the-art word error rates. For instance, the light gated recurrent units (Li-GRU) <cit.> network has been designed to carefully address the task of ASR. A Li-GRU is a compact single-gate unit derived from the gated recurrent units (GRU) which reduce by $30\%$ the per-epoch training time over a standard GRU while also improving the ASR accuracy. Nevertheless, and despite a clear interest from the community, two major issues prevent a stronger adoption of the Li-GRU: (1) it highly suffers from exploding gradients as the gate is unbounded; and (2) no optimized implementation exists, hence leading to much larger training times than more complex alternatives such as LSTM neural networks.

The problems of vanishing and exploding gradients in recurrent neural networks (RNNs) have been studied for decades and several methods have been proposed. Gradient clipping and weight decay, for instance, directly act on the values that are flowing throughout the network during the forward and backward propagations <cit.>. Regularization techniques, such as the soft orthogonal regularisation (SOR) <cit.> constraint, propose to directly tackle the problem of uncontrolled growth of the error accumulation during backpropagation through time (BPTT) <cit.> by introducing a term in the loss enforcing the recurrent weight matrices to remain orthogonal <cit.>. Others even proposed to develop a novel RNN architecture learning a unitary recurrent weight matrix in the complex domain <cit.>. An even more stable approach is to directly clip the eigenvalues of the recurrent weight matrices as soon as they reach a certain threshold <cit.>. However, the two latest solutions introduce important complexity overheads at computation time and remain mostly intractable for ASR scenarios with medium and large datasets. Then, and despite promising research directions, the instability of the Li-GRU has never been formally or empirically investigated. It remains impossible to verify if existing methods preventing exploding gradients could benefit the Li-GRU.

This article proposes to formalise and solve the issue that the original Li-GRU encounters. Hence, it introduces the Stabilised Li-GRU (SLi-GRU), offering theoretical and empirical guarantees on its stability compared to the original Li-GRU as well as a five times reduced training time following a well-designed CUDA implementation. In summary, the contributions are fourfold: 1. Theoretically ground the conditions to avoid exploding gradients with the Li-GRU; 2. Analyse the impact of existing methods both theoretically and empirically with the additive task on the Li-GRU, leading to the introduction of the SLi-GRU; 3. Empirically validate the scaling of the SLi-GRU to three well-known speech recognition tasks; and 4. Deliver to the community a CUDA optimized version of the Li-GRU and SLi-GRU within SpeechBrain[https://speechbrain.github.io/].

The conducted experiments on LibriSpeech and CommonVoice demonstrate that the SLi-GRU is much more stable and faster than the original Li-GRU which can not be trained with such datasets. It also obtains better ASR performance than the state-of-the-art baseline offered within Speechbrain based on LSTM neural networks.

§ ON THE INSTABILITY OF THE LI-GRU

The initial definition of the Li-GRU <cit.> is unstable and, in practice, can not be applied to even medium-sized speech recognition datasets such as Librispeech or CommonVoice. First, we recall the basic equations of the Li-GRU (Section <ref>). Then, following a theoretical analysis of the gradient exploding phenomenon arising at training time, we derive the necessary bounds to ensure a smooth training (Section <ref>). Finally, we formalise various approaches to tackle the gradient exploding problem by investigating theoretically their impact on the later boundaries (Section <ref>).

§.§ Light gated recurrent units

The Li-GRU <cit.> has been designed to carefully address the task of speech recognition efficiently. By removing the reset gate, adding a ReLU on the candidate gate, and applying batch normalization ($\mathcal{BN}$) <cit.> on the feed-forward connections the authors were not only able to reduce by $30\%$ the per-epoch training time of a Li-GRU against a standard GRU <cit.>, but also to improve the performance across different tasks. In particular, the Li-GRU equations are:

\begin{equation}
\label{eq:zt_ligru}
z_{t} = \sigma(\mathcal{\mathcal{BN}}(W_{z}x_{t}) + U_{z}h_{t-1}),
\end{equation}

\begin{equation}
\label{eq:relu_ligru}
\tilde{h} = \text{ReLU}(\mathcal{\mathcal{BN}}(W_{h}x_{t}) + U_{h}h_{t-1}),
\end{equation}

\begin{equation}
h_{t} = z_{t} \odot h_{t-1} + (1 - z_{t}) \odot \tilde{h}.
\end{equation}

with $z_{t}$ the update gate, $\tilde{h_{t}}$ the candidate gate, $h_{t}$ the hidden state, all taken at the time step $t$, and $h_{t-1}$ the hidden state from the previous time step. The logistic sigmoid function is denoted as
$\sigma$ while the operator $\odot$ refers to the element-wise product. The Li-GRU is fed at each time step with a vector $x_{t}$. $ {W}_{z}$, $ {W}_{h}$  are the feed-forward, and $ {U}_{z}$, $ {U}_{h}$ the recurrent weights. In the following, we consider $ {W}_{*}$ and $ {U}_{*}$ as references to the weights independently of the gates.

§.§ Gradient instabilities and temporal contributions

Despite its simplicity, the Li-GRU exhibits a weakness in Eq. <ref> as the recurrent process is unbounded, and therefore subject to potential gradient instabilities.
Here, and following carefully previous work from <cit.>, we propose to study from an analytical point of view the theoretical motivations of the Li-GRU instability.

Let $E = \sum_{N}^{t=0} E_{t}$ be the total loss, where $N$ is the sequence length, and $E_{t}$ the loss at the time step $t$. We can highlight the gradient exploding problem in the Li-GRU with the BPTT by showing that each backpropagation step in the recurrent process is controlled by a value $\eta$ that may explode as soon as it deviates from $1$. Following the BPTT, we first obtain $\partial  E_{t}/\partial h_{t}$ and then backpropagate from $\partial  E_{t}/\partial h_{m}$ to $\partial  E_{t}/\partial h_{m-1}$ with ($m \leq t$):

\begin{equation}
\label{eqn:error_in_time_1}
\frac{\partial E_{t}}{\partial h_{m}} = \frac{\partial E_{t}}{\partial h_{t}}(\prod_{i=m}^{t} \frac{\partial h_{i}}{\partial h_{i-1}}),
\end{equation}

\begin{equation}
\label{eqn:error_in_time_2}
\frac{\partial E_{t}}{\partial h_{m}}  = \frac{\partial E_{t}}{\partial h_{t}}(\prod_{i=m}^{t}\frac{\partial ^+ h_{i}}{\partial h_{i-1}} + \frac{\partial h_{i}}{\partial z_{i}} \frac{\partial z_{i}}{\partial h_{i-1}} + \frac{\partial h_{i}}{\partial \tilde{h_{i}}} \frac{\partial \tilde{h_{i}}}{\partial h_{i-1}}),
\end{equation}

with $\partial ^+h_{i}/\partial h_{i-1}$ refering to the immediate partial derivative. Then, we derive the $\partial h_{i}/\partial h_{i-1}$ upper bound called $\eta$ that will describe the necessary conditions triggering the explosion phenomenon. $\eta$ is obtained by computing the norm of each partial derivatives of $\partial h_{i}/\partial h_{i-1}$:

\begin{equation}
\label{eqn:eta}
\eta = \frac{\gamma_{1}}{4} || {U}_{z}||_{2} + || {U}_{h}||_{2},
\end{equation}

with $\gamma_{1} = max_{1 \leq m \leq t, 1 \leq j \leq d} | [h_{m-1}]_{j}|$, and $d$ the hidden dimension size. Then, considering $||\partial E_{t}/\partial h_{m-1}||$ and $||\partial E_{t}/\partial h_{m}||$ at adjacent timesteps and leveraging the norm properties:

\begin{equation}
|| \frac{\partial E_{t}}{\partial h_{m-1}} || \leq \eta || \frac{\partial E_{t}}{\partial h_{m}} ||.
\end{equation}

Finally, by induction, we generalize over non adjacent time steps noted $p$ subject to $p < m$ (i.e applying $\eta$, $m - p$ times):

\begin{equation}
|| \frac{\partial E_{t}}{\partial h_{p}} || \leq \eta^{m - p} ||\frac{\partial E_{t}}{\partial h_{m}}||.
\end{equation}

It results that the Li-GRU may explode as soon as $\eta > 1$ following the increase of the $m-p$ quantity, hence, leading to the exploding gradients phenomenon. Therefore, we wish to keep $\eta$ as close as possible to $1$.

§.§ Stabilizing the Li-GRU

This section presents various methods to tackle exploding gradients in the Li-GRU by analysing their impacts on $\eta$.

Soft orthogonal regularization (SOR). The SOR <cit.> helps any RNN to keep $ {U}_{*}$ close to orthogonal by adding a regularization term to the loss, hence limiting the impact of $ {U}_{*}$ on $\eta$. The spectral norm of a matrix $||{W}||_{2}$ is $1$, simplifying the value of $\eta$ from Eq. <ref>:

\begin{equation}
\eta = \frac{\gamma_{1}}{4} + 1.
\end{equation}

Despite being helpful to approach the problem of exploding gradients, such a regularization will constrain the weights to be in the Stiefel manifolds, and potentially degrade the global training loss.

Weight decay and gradient clipping. Weight decay (WD) <cit.> adds a penalty on the l2-norm of $ {U}_{*}$ and $ {W}_{*}$ potentially reducing the impact of the recurrent weights on $\eta$. Nevertheless, this method is not always sufficient and often is coupled with gradient clipping (GC) <cit.> that rescales the gradient so that its norm remains lower than a threshold, hence postponing the growth of $ {U}_{*}$. In practice, this method is effective for ${U}_{h}$ that is never rescaled.

Sine activation function. In <cit.>, the authors demonstrated that the sine activation function was an excellent bounded alternative for recurrent neural networks. In our case, it will be the non-linearity of the candidate gate and therefore modify the expression of $\eta$ as:

\begin{equation}
\eta = \frac{\gamma_{1}}{4} || {U}_{z}||_{2} + \text{cos}|| {U}_{h}||_{2}.
\end{equation}

Such a change is effective in reducing the impact of $|| {U}_{h}||_{2}$ on $\eta$, however, it remains that $\gamma_{1}$ may explode.

Layer normalization and recurrent weights. Layer normalization ($\mathcal{LN}$) <cit.> normalizes its input to have zero mean and unit variance. If applied to the product of $U_{*}$ and $h_{t-1}$ in Eq. <ref> and Eq. <ref>, it will also reduce the impact of $\gamma_{1}$ on $\eta$, rescale the gradient of $ {U}_{*}$, and accelerate the convergence of the Li-GRU. Introducing the $\mathcal{LN}$ to the original Li-GRU leads to a novel Li-GRU:

\begin{equation}
z_{t} = \sigma(\mathcal{BN}( {W}_{z}x_{t}) + \mathcal{LN}( {U}_{z}h_{t-1})),
\end{equation}

\begin{equation}
\tilde{h} = \text{ReLU}(\mathcal{BN}( {W}_{h}x_{t}) + \mathcal{LN}( {U}_{h}h_{t-1})),
\end{equation}

\begin{equation}
h_{t} = z_{t} \odot h_{t-1} + (1 - z_{t}) \odot \tilde{h}.
\end{equation}

Following the proof from <cit.>, $\eta$ becomes:

\begin{equation}
\eta = \frac{\gamma_{1}}{4\sigma_{z}}|| {U}_{z}||_{2} + \frac{1}{\sigma_{h}}||  {U}_{h}||_{2}.
\end{equation}

with $\sigma$ the standard deviation of the corresponding gates. In the latter formulation, and motivated by <cit.>, we decided to get rid of the gain and bias terms of the layer normaliation to even further simplify the architecture. In short, a simple $\mathcal{LN}$ enables $||\partial E_{t}/\partial h_{m}||$ to remain unaffected by the scaling of the recurrent weights but also minimizes the value of $\gamma_{1}$ due to the normalization of the input.

§ EMPIRICAL EVIDENCES

The empirical validity of the different proposed solutions to the exploding gradients phenomenon is first investigated to properly identify a successor of the Li-GRU named Stabilized Li-GRU (SLi-GRU). Hence, we monitor various metrics including $\eta$ during a task designed to rapidly trigger large gradients (Section <ref>). Then, the SLi-GRU is compared to a standard Li-GRU and well-known LSTM networks on three datasets of speech recognition (Section <ref>).

§.§ The adding task

The adding task <cit.> is a synthetic benchmark designed to generate long sequences quickly highlighting exploding gradients. In practice, a neural network must learn to predict the addition of two numbers that are stored in large sequences. Indeed, having long sequences increases the probability of seeing $\partial h_{t}/\partial h_{m}$ explode. Then, the task requires the network to store real values for very long periods, hence giving a convenient way of evaluating the network memory.

Task Definition. Each input sequence is designed as a pair of components. The first component is a real value sampled from a uniform distribution in the range $[0, 1]$ while the second is either $1$ or $0$, and is used as a marker. The goal of the network in this task is to remember the values of the first component of the two elements that have a $1$ in the second component so that the sum can be produced at the output. All input sequences have a length of $T$. The first marker equal to $1.0$ is randomly picked in the range $[0, T/2-1]$ while the other is in the range $[T/2, T-1]$. Using a large value of $T$ (e.g $2,000$) is sufficient to create the exploding gradient problem and to challenge the network to do a correct summation.

Architecture Details and Network Training. All models are trained following the same setup so that the effect of the different techniques may be properly compared. The maximum number of epochs is $1,000$, and the number of time steps $T$ is $2,000$. The batch size is $256$. Adam <cit.> is used as the optimizer with a learning rate of $0.001$. Each Li-GRU configuration used a ReLU if not mentioned in the legend and a single hidden layer with $1,024$ hidden units. The soft orthogonal regularization $\lambda$ is set to $0.001$ after carefully trying multiple values. Weight decay is fixed to $0.001$ as well and the gradient clipping norm threshold is given at $1$. The training loss is the standard mean squared error (MSE) and the recurrent weights follow an orthogonal initialization <cit.>.

Results. As shown in Fig. <ref>, the layer normalization outperformed all the other methods on the principal metrics (i.e $\eta$ and MSE). Not only the $\mathcal{LN}$ keep $\eta$ close to $1$, but also converged faster to an excellent MSE of $0.0005$ whereas the sine activation, i.e the second best, achieved an MSE of $0.01$. The sine-based Li-GRU is also slower than its $\mathcal{LN}$ counterpart to converge. Moreover, the value of $\eta$ deviated from $1$ with the sine Li-GRU as the number of epochs reached $700$ indicating the start of an instability in the gradients. The SOR, on the other hand, and despite promising performance to postpone the problem of exploding gradients, was not able to reach a correct MSE due to a negative effect of the constraint applied to the recurrent weights. The standard Li-GRU and its gradient clipping and weight decay variant were not able to prevent the exploding gradient phenomenon and crashed at the same time than the standard Li-GRU. The experiments costed a total of $0.04$ kg of $CO_{2}$ <cit.>.

Introducing the SLi-GRU. This analysis demonstrates that the layer normalized Li-GRU, named SLi-GRU thereafter, is the only architecture to: (1) remember past information, hence leading to an excellent MSE score, (2) postpone the gradient exploding problem successfully under tight conditions, and (3) offer a theoretical formulation of $\eta$ that satisfies the need for a high level of stability.

§.§ Automatic speech recognition experiments

The task of speech recognition is to transcribe the content of an audio signal into a human-readable output. One of the challenges of speech recognition lies in the long input sequences potentially triggering exploding gradients with RNNs. In the following, and to illustrate the latter issue, we compare our newly introduced SLi-GRU to Li-GRU and LSTM neural networks on three different datasets including CommonVoice French, Italian and LibriSpeech.

Three datasets with different complexities and sizes are considered to evaluate the models: LibriSpeech <cit.>, CommonVoice French (version 8.0) <cit.>, and CommonVoice Italian (version 8.0) <cit.>. These datasets are primer choices as they exhibit long sequences making the training challenging for the SLi-GRU while remaining extremely competitive as the community has been extensively investigating them. The utterances of CommonVoice (CV) are obtained from volunteers all around the world. The French set (CV-fr) contains $460$K utterances ($671$ hours) with different accents, and more than $16$K participants. The train set consists of $620.59$ hours, while both validation and test sets contain $25.52$, and $25.52$ hours of speech respectively. The Italian set (CV-it), is relatively small compared to CV-fr. It contains $208$, $24$, $26$ hours training, validation, and test data. Finally, LibriSpeech (LS) is a corpus of $960$ hours of read and clean English speech.

Architecture Details and Network Training.

We trained an LSTM <cit.>, a Li-GRU, and a SLi-GRU with two different scenarios on a single and popular end-to-end (E2E) ASR architecture with all datasets: an encoder-decoder CTC-Attention based CRDNN coming from the SpeechBrain toolkit <cit.>. The encoder is composed of three distinct parts: a VGG-like features extractor, a bidirectional RNN, and a deep dense neural network. This is combined with a location-aware attentive GRU decoder jointly trained with the CTC loss. The two different scenarios that are considered for the Li-GRU are: (1) a low-budget model (LB), as claimed by the original Li-GRU authors, we wished to verify if a smaller Li-GRU could achieve state-of-the-art performance. In this particular case, the ASR system has $50.6$M and $94.3$M parameters on CV and LS respectively; (2) a high-budget model (HB), with the Li-GRU matching approximately the same number of neural parameters than the best LSTM-based CRDNN from SpeechBrain (i.e $148$M and $170$M parameters). Hyperparameters and neural architectures vary across the different datasets and are extensively described in the corresponding SpeechBrain recipes <cit.> (commit hash ee50231). A recurrent language model (LM) trained with the LS language modelling resources is coupled via shallow fusion for LibriSpeech. No LM is used with CV.

Results. First, it is worth underlining that the standard Li-GRU did not even succeed in lasting more than one epoch on all tasks as the gradient exploding problem formally demonstrated in this work simply hits hard empirically as well. Such a problem is solved with the introduction of our SLi-GRU that was able to proceed for the entire training hence proving that the recurrent layer normalization is an effective solution to approach exploding gradients in RNNs. Then, with a fixed size of $148$M and $170$M parameters, the SLi-GRU outperformed the previous state-of-the-art CRDNN model from SpeechBrain on the three datasets with WER of $7.82\%$, $3.42\%$, $13.46\%$ and $10.05\%$ compared to $10.36\%$, $3.83\%$, $14.61\%$ and $11.06\%$ for the LSTM on the LS other and clean, and CV French and Italian datasets respectively. Even more interestingly, the LB SLi-GRU solely equipped with a third and half of the neural parameters on CV and LS reached promising performance as the WER only degraded by $0.425$ in average compared to the HB LSTM over the three datasets. Furthermore, the LB SLi-GRU reduced the WER by $21\%$ in average against the LB LSTM. Following the original findings of the Li-GRU <cit.>, it seems clear that our SLi-GRU represents an interesting alternative to LSTM for speech recognition in HB and LB scenarios. Finally, we estimate that at least $39.3$ kg of $CO_{2}$ have been emitted to produce these results <cit.>.

§.§ Efficiency perspectives

The original Li-GRU made available to the community did not leverage any optimization scheme at training time. Hence, it introduced an extremely large overhead in iteration time, even compared to much more complex LSTM networks that directly benefit from a CUDA implementation. As we wish our method to impact widely and positively the community, we decided to implement a custom CUDA version of the SLi-GRU so that anyone may use it with large datasets without suffering from excessive training times. The latter contribution is five times faster and change the time-complexity from a quadratic to a linear regime, compared to the default PyTorch implementation. This contribution replaces the previous Li-GRU implementation in the well-known SpeechBrain toolkit.

§ CONCLUSION

We introduced the SLi-GRU, a theoretically grounded and empirically validated stabilized version of the original Li-GRU. Following an analytical demonstration, we showed that applying a layer-wise normalization to the recurrent gate of the SLi-GRU is sufficient to prevent the exploding gradients phenomenon. During the conducted experiments, the SLi-GRU outperformed the previous state-of-the-art relying on LSTM from the SpeechBrain toolkit in three automatic speech recognition tasks. Furthermore, we also released an optimized version of the SLi-GRU further reducing the required training time by a factor of five.