QUATERNION RECURRENT NEURAL NETWORKS
Year: 2019

Abstract:
Recurrent neural networks (RNNs) are powerful architectures to model sequential data, due to their capability to learn short and long-term dependencies between the basic elements of a sequence. Nonetheless, popular tasks such as speech or images recognition, involve multi-dimensional input features that are characterized by strong internal dependencies between the dimensions of the input vector. We propose a novel quaternion recurrent neural network (QRNN), alongside with a quaternion long-short term memory neural network (QLSTM), that take into account both the external relations and these internal structural dependencies with the quaternion algebra. Similarly to capsules, quaternions allow the QRNN to code internal dependencies by composing and processing multidimensional features as single entities, while the recurrent operation reveals correlations between the elements composing the sequence. We show that both QRNN and QLSTM achieve better performances than RNN and LSTM in a realistic application of automatic speech recognition. Finally, we show that QRNN and QLSTM reduce by a maximum factor of 3.3x the number of free parameters needed, compared to real-valued RNNs and LSTMs to reach better results, leading to a more compact representation of the relevant information.

heading: 1 INTRODUCTION
text: In the last few years, deep neural networks (DNN) have encountered a wide success in different domains due to their capability to learn highly complex input to output mapping. Among the different DNN-based models, the recurrent neural network (RNN) is well adapted to process sequential data. Indeed, RNNs build a vector of activations at each timestep to code latent relations between input vectors. Deep RNNs have been recently used to obtain hidden representations of speech unit sequences (Ravanelli et al., 2018a) or text word sequences (Conneau et al., 2018), and to achieve state-of-the-art performances in many speech recognition tasks (Graves et al., 2013a;b; Amodei et al., 2016; Povey et al., 2016; Chiu et al., 2018). However, many recent tasks based on multi-dimensional input features, such as pixels of an image, acoustic features, or orientations of 3D models, require to represent both external dependencies between different entities, and internal relations between the features that compose each entity. Moreover, RNN-based algorithms commonly require a huge number of parameters to represent sequential data in the hidden space.
Quaternions are hypercomplex numbers that contain a real and three separate imaginary components, perfectly fitting to 3 and 4 dimensional feature vectors, such as for image processing and robot kinematics (Sangwine, 1996; Pei & Cheng, 1999; Aspragathos & Dimitros, 1998). The
∗CIFAR Senior Fellow
idea of bundling groups of numbers into separate entities is also exploited by the recent manifold and capsule networks (Chakraborty et al., 2018; Sabour et al., 2017). Contrary to traditional homogeneous representations, capsule and quaternion networks bundle sets of features together. Thereby, quaternion numbers allow neural network based models to code latent inter-dependencies between groups of input features during the learning process with fewer parameters than RNNs, by taking advantage of the Hamilton product as the equivalent of the ordinary product, but between quaternions. Early applications of quaternion-valued backpropagation algorithms (Arena et al., 1994; 1997) have efficiently solved quaternion functions approximation tasks. More recently, neural networks of complex and hypercomplex numbers have received an increasing attention (Hirose & Yoshida, 2012; Tygert et al., 2016; Danihelka et al., 2016; Wisdom et al., 2016), and some efforts have shown promising results in different applications. In particular, a deep quaternion network (Parcollet et al., 2016; 2017a;b), a deep quaternion convolutional network (Gaudet & Maida, 2018; Parcollet et al., 2018), or a deep complex convolutional network (Trabelsi et al., 2017) have been employed for challenging tasks such as images and language processing. However, these applications do not include recurrent neural networks with operations defined by the quaternion algebra.
This paper proposes to integrate local spectral features in a novel model called quaternion recurrent neural network1 (QRNN), and its gated extension called quaternion long-short term memory neural network (QLSTM). The model is proposed along with a well-adapted parameters initialization and turned out to learn both inter- and intra-dependencies between multidimensional input features and the basic elements of a sequence with drastically fewer parameters (Section 3), making the approach more suitable for low-resource applications. The effectiveness of the proposed QRNN and QLSTM is evaluated on the realistic TIMIT phoneme recognition task (Section 4.2) that shows that both QRNN and QLSTM obtain better performances than RNNs and LSTMs with a best observed phoneme error rate (PER) of 18.5% and 15.1% for QRNN and QLSTM, compared to 19.0% and 15.3% for RNN and LSTM. Moreover, these results are obtained alongside with a reduction of 3.3 times of the number of free parameters. Similar results are observed with the larger Wall Street Journal (WSJ) dataset, whose detailed performances are reported in the Appendix 6.1.1.

heading: 2 MOTIVATIONS
text: A major challenge of current machine learning models is to well-represent in the latent space the astonishing amount of data available for recent tasks. For this purpose, a good model has to efficiently encode local relations within the input features, such as between the Red, Green, and Blue (R,G,B) channels of a single image pixel, as well as structural relations, such as those describing edges or shapes composed by groups of pixels. Moreover, in order to learn an adequate representation with the available set of training data and to avoid overfitting, it is convenient to conceive a neural architecture with the smallest number of parameters to be estimated. In the following, we detail the motivations to employ a quaternion-valued RNN instead of a real-valued one to code inter and intra features dependencies with fewer parameters.
As a first step, a better representation of multidimensional data has to be explored to naturally capture internal relations within the input features. For example, an efficient way to represent the information composing an image is to consider each pixel as being a whole entity of three strongly related elements, instead of a group of uni-dimensional elements that could be related to each other, as in traditional real-valued neural networks. Indeed, with a real-valued RNN, the latent relations between the RGB components of a given pixel are hardly coded in the latent space since the weight has to find out these relations among all the pixels composing the image. This problem is effectively solved by replacing real numbers with quaternion numbers. Indeed, quaternions are fourth dimensional and allow one to build and process entities made of up to four related features. The quaternion algebra and more precisely the Hamilton product allows quaternion neural network to capture these internal latent relations within the features encoded in a quaternion. It has been shown that QNNs are able to restore the spatial relations within 3D coordinates (Matsui et al., 2004), and within color pixels (Isokawa et al., 2003), while real-valued NN failed. This is easily explained by the fact that the quaternion-weight components are shared through multiple quaternion-input parts during the Hamilton product , creating relations within the elements. Indeed, Figure 1 shows that the multiple weights required to code latent relations within a feature are considered at the same level as for
1https://github.com/Orkis-Research/Pytorch-Quaternion-Neural-Networks
learning global relations between different features, while the quaternion weight w codes these internal relations within a unique quaternion Qout during the Hamilton product (right).
Then, while bigger neural networks allow better performances, quaternion neural networks make it possible to deal with the same signal dimension but with four times less neural parameters. Indeed, a 4-number quaternion weight linking two 4-number quaternion units only has 4 degrees of freedom, whereas a standard neural net parametrization has 4 × 4 = 16, i.e., a 4-fold saving in memory. Therefore, the natural multidimensional representation of quaternions alongside with their ability to drastically reduce the number of parameters indicate that hyper-complex numbers are a better fit than real numbers to create more efficient models in multidimensional spaces. Based on the success of previous deep quaternion convolutional neural networks and smaller quaternion feed-forward architectures (Kusamichi et al., 2004; Isokawa et al., 2009; Parcollet et al., 2017a), this work proposes to adapt the representation of hyper-complex numbers to the capability of recurrent neural networks in a natural and efficient framework to multidimensional sequential tasks such as speech recognition.
Modern automatic speech recognition systems usually employ input sequences composed of multidimensional acoustic features, such as log Mel features, that are often enriched with their first, second and third time derivatives (Davis & Mermelstein, 1990; Furui, 1986), to integrate contextual information. In standard RNNs, static features are simply concatenated with their derivatives to form a large input vector, without effectively considering that signal derivatives represent different views of the same input. Nonetheless, it is crucial to consider that time derivatives of the spectral energy in a given frequency band at a specific time frame represent a special state of a time-frame, and are linearly correlated (Tokuda et al., 2003). Based on the above motivations and the results observed on previous works about quaternion neural networks, we hypothesize that quaternion RNNs naturally provide a more suitable representation of the input sequence, since these multiple views can be directly embedded in the multiple dimensions space of the quaternion, leading to better generalization.

heading: 3 QUATERNION RECURRENT NEURAL NETWORKS
text: This Section describes the quaternion algebra (Section 3.1), the internal quaternion representation (Section 3.2), the backpropagation through time (BPTT) for quaternions (Section 3.3.2), and proposes an adapted weight initialization to quaternion-valued neurons (Section 3.4).

heading: 3.1 QUATERNION ALGEBRA
text: The quaternion algebra H defines operations between quaternion numbers. A quaternion Q is an extension of a complex number defined in a four dimensional space as:
Q = r1 + xi + yj + zk, (1)
where r, x, y, and z are real numbers, and 1, i, j, and k are the quaternion unit basis. In a quaternion, r is the real part, while xi + yj + zk with i2 = j2 = k2 = ijk = −1 is the imaginary part, or the vector part. Such a definition can be used to describe spatial rotations. The information embedded in the quaterion Q can be summarized into the following matrix of real numbers:
Qmat = r −x −y −zx r −z yy z r −x z −y x r  . (2) The conjugate Q∗ of Q is defined as: Q∗ = r1− xi− yj− zk. (3) Then, a normalized or unit quaternion Q/ is expressed as:
Q/ = Q√
r2 + x2 + y2 + z2 . (4)
Finally, the Hamilton product ⊗ between two quaternions Q1 and Q2 is computed as follows: Q1 ⊗Q2 =(r1r2 − x1x2 − y1y2 − z1z2) + (r1x2 + x1r2 + y1z2 − z1y2)i+
(r1y2 − x1z2 + y1r2 + z1x2)j + (r1z2 + x1y2 − y1x2 + z1r2)k. (5) The Hamilton product (a graphical view is depicted in Figure 1) is used in QRNNs to perform transformations of vectors representing quaternions, as well as scaling and interpolation between two rotations following a geodesic over a sphere in the R3 space as shown in (Minemoto et al., 2017).

heading: 3.2 QUATERNION REPRESENTATION
text: The QRNN is an extension of the real-valued (Medsker & Jain, 2001) and complex-valued (Hu & Wang, 2012; Song & Yam, 1998) recurrent neural networks to hypercomplex numbers. In a quaternion dense layer, all parameters are quaternions, including inputs, outputs, weights, and biases. The quaternion algebra is ensured by manipulating matrices of real numbers (Gaudet & Maida, 2018). Consequently, for each input vector of size N , output vector of size M , dimensions are split into four parts: the first one equals to r, the second is xi, the third one equals to yj, and the last one to zk to compose a quaternion Q = r1 + xi + yj + zk. The inference process of a fully-connected layer is defined in the real-valued space by the dot product between an input vector and a real-valued M ×N weight matrix. In a QRNN, this operation is replaced with the Hamilton product (Eq. 5) with quaternion-valued matrices (i.e. each entry in the weight matrix is a quaternion). The computational complexity of quaternion-valued models is discussed in Appendix 6.1.2

heading: 3.3 LEARNING ALGORITHM
text: The QRNN differs from the real-valued RNN in each learning sub-processes. Therefore, let xt be the input vector at timestep t, ht the hidden state, Whx, Why and Whh the input, output and hidden states weight matrices respectively. The vector bh is the bias of the hidden state and pt, yt are the output and the expected target vectors. More details of the learning process and the parametrization are available on Appendix 6.2.

heading: 3.3.1 FORWARD PHASE
text: Based on the forward propagation of the real-valued RNN (Medsker & Jain, 2001), the QRNN forward equations are extended as follows:
ht = α(Whh ⊗ ht−1 +Whx ⊗ xt + bh), (6) where α is a quaternion split activation function (Xu et al., 2017; Tripathi, 2016) defined as:
α(Q) = f(r) + f(x)i + f(y)j + f(z)k, (7) with f corresponding to any standard activation function. The split approach is preferred in this work due to better prior investigations, better stability (i.e. pure quaternion activation functions contain singularities), and simpler computations. The output vector pt is computed as: pt = β(Why ⊗ ht), (8) where β is any split activation function. Finally, the objective function is a classical loss applied component-wise (e.g., mean squared error, negative log-likelihood).

heading: 3.3.2 QUATERNION BACKPROPAGATION THROUGH TIME
text: The backpropagation through time (BPTT) for quaternion numbers (QBPTT) is an extension of the standard quaternion backpropagation (Nitta, 1995), and its full derivation is available in Appendix 6.3. The gradient with respect to the loss Et is expressed for each weight matrix as ∆thy = ∂Et ∂Why , ∆thh = ∂Et ∂Whh , ∆thx = ∂Et ∂Whx , for the bias vector as ∆tb = ∂Et ∂Bh , and is generalized to ∆t = ∂Et∂W with:
∂Et ∂W = ∂Et ∂W r + i ∂Et ∂W i + j ∂Et ∂W j + k ∂Et ∂W k . (9)
Each term of the above relation is then computed by applying the chain rule. Indeed, and conversaly to real-valued backpropagation, QBPTT must defines the dynamic of the loss w.r.t to each component of the quaternion neural parameters. As a use-case for the equations, the mean squared error at a timestep t and named Et is used as the loss function. Moreover, let λ be a fixed learning rate. First, the weight matrix Why is only seen in the equations of pt. It is therefore straightforward to update each weight of Why at timestep t following:
Why = Why − λ∆thy ⊗ h∗t , with ∆thy = ∂Et ∂Why = (pt − yt), (10)
where h∗t is the conjugate of ht. Then, the weight matrices Whh, Whx and biases bh are arguments of ht with ht−1 involved, and the update equations are derived as:
Whh = Whh − λ∆thh, Whx = Whx − λ∆thx, bh = bh − λ∆tb, (11) with,
∆thh = t∑ m=0 ( t∏ n=m δn)⊗ h∗m−1, ∆thx = t∑ m=0 ( t∏ n=m δn)⊗ x∗m, ∆tb = t∑ m=0 ( t∏ n=m δn), (12)
and,
δn = { W ∗hh ⊗ δn+1 × α′(hpreactn ) if n 6= t W ∗hy ⊗ (pn − yn)× β ′ (ppreactn ) otherwise,
(13)
with hpreactn and p preact n the pre-activation values of hn and pn respectively.

heading: 3.4 PARAMETER INITIALIZATION
text: A well-designed parameter initialization scheme strongly impacts the efficiency of a DNN. An appropriate initialization, in fact, improves DNN convergence, reduces the risk of exploding or vanishing gradient, and often leads to a substantial performance improvement (Glorot & Bengio, 2010). It has been shown that the backpropagation through time algorithm of RNNs is degraded by an inappropriated parameter initialization (Sutskever et al., 2013). Moreover, an hyper-complex parameter cannot be simply initialized randomly and component-wise, due to the interactions between components. Therefore, this Section proposes a procedure reported in Algorithm 1 to initialize a matrix W of quaternion-valued weights. The proposed initialization equations are derived from the polar form of a weight w of W :
w = |w|eq / imagθ = |w|(cos(θ) + q/imagsin(θ)), (14)
and,
wr = ϕ cos(θ), wi = ϕ q / imagi sin(θ), wj = ϕ q / imagj sin(θ), wk = ϕ q / imagk sin(θ). (15)
The angle θ is randomly generated in the interval [−π, π]. The quaternion q/imag is defined as purely normalized imaginary, and is expressed as q/imag = 0 + xi + yj + zk. The imaginary components xi, yj, and zk are sampled from an uniform distribution in [0, 1] to obtain qimag , which is then normalized (following Eq. 4) to obtain q/imag. The parameter ϕ is a random number generated with respect to well-known initialization criterions (such as Glorot or He algorithms) (Glorot & Bengio, 2010; He et al., 2015). However, the equations derived in (Glorot & Bengio, 2010; He et al., 2015) are defined for real-valued weight matrices. Therefore, the variance of W has to be investigated in the quaternion space to obtain ϕ (the full demonstration is provided in Appendix 6.2). The variance of W is:
V ar(W ) = E(|W |2)− [E(|W |)]2, with [E(|W |)]2 = 0. (16)
Algorithm 1 Quaternion-valued weight initialization 1: procedure QINIT(W,nin, nout) 2: σ ← 1√
2(nin+nout) . w.r.t to Glorot criterion and Eq. 18
3: for w in W do 4: θ ← rand(−π, π) 5: ϕ← rand(−σ, σ) 6: x, y, z ← rand(0, 1) 7: qimag ← Quaternion(0, x, y, z) 8: q/imag ←
qimag√ x2+y2+z2
9: wr ← ϕ× cos(θ) . See Eq. 15 10: wi ← ϕ× q/imagi × sin(θ) 11: wj ← ϕ× q/imagj × sin(θ) 12: wk ← ϕ× q/imagk × sin(θ) 13: w ← Quaternion(wr, wi, wj , wk)
Indeed, the weight distribution is normalized. The value of V ar(W ) = E(|W |2), instead, is not trivial in the case of quaternion-valued matrices. Indeed, W follows a Chi-distribution with four degrees of freedom (DOFs). Consequently, V ar(W ) is expressed and computed as follows:
V ar(W ) = E(|W |2) = ∫ ∞ 0 x2f(x) dx = 4σ2. (17)
The Glorot (Glorot & Bengio, 2010) and He (He et al., 2015) criterions are extended to quaternion as:
σ = 1√
2(nin + nout) , and σ = 1√ 2nin , (18)
with nin and nout the number of neurons of the input and output layers respectively. Finally, ϕ can be sampled from [−σ, σ] to complete the weight initialization of Eq. 15.

heading: 4 EXPERIMENTS
text: This Section details the acoustic features extraction (Section 4.1), the experimental setups and the results obtained with QRNNs, QLSTMs, RNNs and LSTMs on the TIMIT speech recognition tasks (Section 4.2). The results reported in bold on tables are obtained with the best configurations of the neural networks observed with the validation set.

heading: 4.1 QUATERNION ACOUSTIC FEATURES
text: The raw audio is first splitted every 10ms with a window of 25ms. Then 40-dimensional log Mel-filterbank coefficients with first, second, and third order derivatives are extracted using the pytorch-kaldi2 (Ravanelli et al., 2018b) toolkit and the Kaldi s5 recipes (Povey et al., 2011). An acoustic quaternion Q(f, t) associated with a frequency f and a time-frame t is formed as follows:
Q(f, t) = e(f, t) + ∂e(f, t)
∂t i +
∂2e(f, t)
∂2t j +
∂3e(f, t)
∂3t k. (19)
Q(f, t) represents multiple views of a frequency f at time frame t, consisting of the energy e(f, t) in the filter band at frequency f , its first time derivative describing a slope view, its second time derivative describing a concavity view, and the third derivative describing the rate of change of the second derivative. Quaternions are used to learn the spatial relations that exist between the 3 described different views that characterize a same frequency (Tokuda et al., 2003). Thus, the quaternion input vector length is 160/4 = 40. Decoding is based on Kaldi (Povey et al., 2011) and weighted finite state transducers (WFST) (Mohri et al., 2002) that integrate acoustic, lexicon and language model probabilities into a single HMM-based search graph.
2pytorch-kaldi is available at https://github.com/mravanelli/pytorch-kaldi

heading: 4.2 THE TIMIT CORPUS
text: The training process is based on the standard 3, 696 sentences uttered by 462 speakers, while testing is conducted on 192 sentences uttered by 24 speakers of the TIMIT (Garofolo et al., 1993) dataset. A validation set composed of 400 sentences uttered by 50 speakers is used for hyper-parameter tuning. The models are compared on a fixed number of layers M = 4 and by varying the number of neurons N from 256 to 2, 048, and 64 to 512 for the RNN and QRNN respectively. Indeed, it is worth underlying that the number of hidden neurons in the quaternion and real spaces do not handle the same amount of real-number values. Indeed, 256 quaternion neurons output are 256× 4 = 1024 real values. Tanh activations are used across all the layers except for the output layer that is based on a softmax function. Models are optimized with RMSPROP with vanilla hyper-parameters and an initial learning rate of 8 · 10−4. The learning rate is progressively annealed using a halving factor of 0.5 that is applied when no performance improvement on the validation set is observed. The models are trained during 25 epochs. All the models converged to a minimum loss, due to the annealed learning rate. A dropout rate of 0.2 is applied over all the hidden layers (Srivastava et al., 2014) except the output one. The negative log-likelihood loss function is used as an objective function. All the experiments are repeated 5 times (5-folds) with different seeds and are averaged to limit any variation due to the random initialization.
The results on the TIMIT task are reported in Table 1. The best PER in realistic conditions (w.r.t to the best validation PER) is 18.5% and 19.0% on the test set for QRNN and RNN models respectively, highlighting an absolute improvement of 0.5% obtained with QRNN. These results compare favorably with the best results obtained so far with architectures that do not integrate access control in multiple memory layers (Ravanelli et al., 2018a). In the latter, a PER of 18.3% is reported on the TIMIT test set with batch-normalized RNNs . Moreover, a remarkable advantage of QRNNs is a drastic reduction (with a factor of 2.5×) of the parameters needed to achieve these results. Indeed, such PERs are obtained with models that employ the same internal dimensionality corresponding to 1, 024 real-valued neurons and 256 quaternion-valued ones, resulting in a number of parameters of 3.8M for QRNN against the 9.4M used in the real-valued RNN. It is also worth noting that QRNNs consistently need fewer parameters than equivalently sized RNNs, with an average reduction factor of 2.26 times. This is easily explained by considering the content of the quaternion algebra. Indeed, for a fully-connected layer with 2, 048 input values and 2, 048 hidden units, a real-valued RNN has 2, 0482 ≈ 4.2M parameters, while to maintain equal input and output dimensions the quaternion equivalent has 512 quaternions inputs and 512 quaternion hidden units. Therefore, the number of parameters for the quaternion-valued model is 5122×4 ≈ 1M. Such a complexity reduction turns out to produce better results and has other advantages such as a smaller memory footprint while saving models on budget memory systems. This characteristic makes our QRNN model particularly suitable for speech recognition conducted on low computational power devices like smartphones (Chen et al., 2014). QRNNs and RNNs accuracies vary accordingly to the architecture with better PER on bigger and wider topologies. Therefore, while good PER are observed with a higher number of parameters, smaller architectures performed at 23.9% and 23.4%, with 1M and 0.6M parameters for the RNN and the QRNN respectively. Such PER are due to a too small number of parameters to solve the task.

heading: 4.3 QUATERNION LONG-SHORT TERM MEMORY NEURAL NETWORKS
text: We propose to extend the QRNN to state-of-the-art models such as long-short term memory neural networks (LSTM), to support and improve the results already observed with the QRNN compared to the RNN in more realistic conditions. LSTM (Hochreiter & Schmidhuber, 1997) neural networks
were introduced to solve the problems of long-term dependencies learning and vanishing or exploding gradient observed with long sequences. Based on the equations of the forward propagation and back propagation through time of QRNN described in Section 3.3.1, and Section 3.3.2, one can easily derive the equations of a quaternion-valued LSTM. Gates are defined with quaternion numbers following the proposal of Danihelka et al. (2016). Therefore, the gate action is characterized by an independent modification of each component of the quaternion-valued signal following a componentwise product with the quaternion-valued gate potential. Let ft,it, ot, ct, and ht be the forget, input, output gates, cell states and the hidden state of a LSTM cell at time-step t:
ft =α(Wf ⊗ xt +Rf ⊗ ht−1 + bf ), (20) it =α(Wi ⊗ xt +Ri ⊗ ht−1 + bi), (21) ct =ft × ct−1 + it × tanh(Wc ⊗ xt +Rc ⊗ ht−1 + bc), (22) ot =α(Wo ⊗ xt +Ro ⊗ ht−1 + bo), (23) ht =ot × tanh(ct), (24)
where W are rectangular input weight matrices, R are square recurrent weight matrices, and b are bias vectors. α is the split activation function and × denotes a component-wise product between two quaternions. Both QLSTM and LSTM are bidirectional and trained on the same conditions than for the QRNN and RNN experiments.
The results on the TIMIT corpus reported on Table 2 support the initial intuitions and the previously established trends. We first point out that the best PER observed is 15.1% and 15.3% on the test set for QLSTMs and LSTM models respectively with an absolute improvement of 0.2% obtained with QLSTM using 3.3 times fewer parameters compared to LSTM. These results are among the top of the line results (Graves et al., 2013b; Ravanelli et al., 2018a) and prove that the proposed quaternion approach can be used in state-of-the-art models. A deeper investigation of QLSTMs performances with the larger Wall Street Journal (WSJ) dataset can be found in Appendix 6.1.1.

heading: 5 CONCLUSION
text: Summary. This paper proposes to process sequences of multidimensional features (such as acoustic data) with a novel quaternion recurrent neural network (QRNN) and quaternion long-short term memory neural network (QLSTM). The experiments conducted on the TIMIT phoneme recognition task show that QRNNs and QLSTMs are more effective to learn a compact representation of multidimensional information by outperforming RNNs and LSTMs with 2 to 3 times less free parameters. Therefore, our initial intuition that the quaternion algebra offers a better and more compact representation for multidimensional features, alongside with a better learning capability of feature internal dependencies through the Hamilton product, have been demonstrated.
Future Work. Future investigations will develop other multi-view features that contribute to decrease ambiguities in representing phonemes in the quaternion space. In this extent, a recent approach based on a quaternion Fourier transform to create quaternion-valued signal has to be investigated. Finally, other high-dimensional neural networks such as manifold and Clifford networks remain mostly unexplored and can benefit from further research.

heading: 6 APPENDIX

heading: 6.1 WALL STREET JOURNAL EXPERIMENTS AND COMPUTATIONAL COMPLEXITY
text: This Section proposes to validate the scaling of the proposed QLSTMs to a bigger and more realistic corpus, with a speech recognition task on the Wall Street Journal (WSJ) dataset. Finally, it discuses the impact of the quaternion algebra in term of computational compexity.

heading: 6.1.1 SPEECH RECOGNITION WITH THE WALL STREET JOURNAL CORPUS
text: We propose to evaluate both QLSTMs and LSTMs with a larger and more realistic corpus to validate the scaling of the observed TIMIT results (Section 4.2). Acoustic input features are described in Section 4.1, and extracted on both the 14 hour subset ‘train-si84’, and the full 81 hour dataset ’trainsi284’ of the Wall Street Journal (WSJ) corpus. The ‘test-dev93’ development set is employed for validation, while ’test-eval92’ composes the testing set. Models architectures are fixed with respect to the best results observed with the TIMIT corpus (Section 4.2). Therefore, both QLSTMs and LSTMs contain four bidirectional layers of internal dimension of size 1, 024. Then, an additional layer of internal size 1, 024 is added before the output layer. The only change on the training procedure compared to the TIMIT experiments concerns the model optimizer, which is set to Adam (Kingma & Ba, 2014) instead of RMSPROP. Results are from a 3-folds average.
It is important to notice that reported results on Table 3 compare favorably with equivalent architectures (Graves et al., 2013a) (WER of 11.7% on ’test-dev93’), and are competitive with state-of-the-art and much more complex models based on better engineered features (Chan & Lane, 2015)(WER of 3.8% with the 81 hours of training data, and on ’test-eval92’). According to Table 3, QLSTMs outperform LSTM in all the training conditions (14 hours and 81 hours) and with respect to both the validation and testing sets. Moreover, QLSTMs still need 2.9 times less neural parameters than LSTMs to achieve such performances. This experiment demonstrates that QLSTMs scale well to larger and more realistic speech datasets and are still more efficient than real-valued LSTMs.

heading: 6.1.2 NOTES ON COMPUTATIONAL COMPLEXITY
text: A computational complexity of O(n2) with n the number of hidden states has been reported by Morchid (2018) for real-valued LSTMs. QLSTMs just involve 4 times larger matrices during computations. Therefore, the computational complexity remains unchanged and equals to O(n2). Nonetheless, and due to the Hamilton product, a single forward propagation between two quaternion neurons uses 28 operations, compared to a single one for two real-valued neurons, implying a longer training time (up to 3 times slower). However, such worst speed performances could easily be alleviated with a proper engineered cuDNN kernel for the Hamilton product, that would helps QNNs to be more efficient than real-valued ones. A well-adapted CUDA kernel would allow QNNs to perform more computations, with fewer parameters, and therefore less memory copy operations from the CPU to the GPU.

heading: 6.2 PARAMETERS INITIALIZATION
text: Let us recall that a generated quaternion weight w from a weight matrix W has a polar form defined as:
w = |w|eq / imagθ = |w|(cos(θ) + q/imagsin(θ)), (25)
with q/imag = 0 + xi + yj + zk a purely imaginary and normalized quaternion. Therefore, w can be computed following:
wr = ϕ cos(θ),
wi = ϕ q / imagi sin(θ), wj = ϕ q / imagj sin(θ),
wk = ϕ q / imagk sin(θ).
(26)
However, ϕ represents a randomly generated variable with respect to the variance of the quaternion weight and the selected initialization criterion. The initialization process follows (Glorot & Bengio, 2010) and (He et al., 2015) to derive the variance of the quaternion-valued weight parameters. Indeed, the variance of W has to be investigated:
V ar(W ) = E(|W |2)− [E(|W |)]2. (27)
[E(|W |)]2 is equals to 0 since the weight distribution is symmetric around 0. Nonetheless, the value of V ar(W ) = E(|W |2) is not trivial in the case of quaternion-valued matrices. Indeed, W follows a Chi-distribution with four degrees of freedom (DOFs) and E(|W |2) is expressed and computed as follows:
E(|W |2) = ∫ ∞ 0 x2f(x) dx, (28)
With f(x) is the probability density function with four DOFs. A four-dimensional vector X = {A,B,C,D} is considered to evaluate the density function f(x). X has components that are normally distributed, centered at zero, and independent. Then, A, B, C and D have density functions:
fA(x;σ) = fB(x;σ) = fC(x;σ) = fD(x;σ) = e−x 2/2σ2
√ 2πσ2 . (29)
The four-dimensional vector X has a length L defined as L = √ A2 +B2 + C2 +D2 with a cumulative distribution function FL(x;σ) in the 4-sphere (n-sphere with n = 4) Sx:
FL(x;σ) = ∫ ∫ ∫ ∫ Sx fA(x;σ)fB(x;σ)fC(x;σ)fD(x;σ) dSx (30)
where Sx = {(a, b, c, d) : √ a2 + b2 + c2 + d2 < x} and dSx = da dbdcdd. The polar representations of the coordinates of X in a 4-dimensional space are defined to compute dSx:
a = ρ cos θ,
b = ρ sin θ cosφ,
c = ρ sin θ sinφ cosψ,
d = ρ sin θ sinφ sinψ,
where ρ is the magnitude (ρ = √ a2 + b2 + c2 + d2) and θ, φ, and ψ are the phases with 0 ≤ θ ≤ π, 0 ≤ φ ≤ π and 0 ≤ ψ ≤ 2π. Then, dSx is evaluated with the Jacobian Jf of f defined as:
Jf = ∂(a, b, c, d)
∂(ρ, θ, φ, ψ) =
dadbdcdd dρdθ dφdψ = ∣∣∣∣∣∣∣∣∣ da dρ da dθ da dφ da dψ db dρ db dθ db dφ db dψ dc dρ dc dθ dc dφ dc dψ
dd dρ dd dθ dd dφ dd dψ
∣∣∣∣∣∣∣∣∣
= ∣∣∣∣∣∣∣ cos θ −ρ sin θ 0 0 sin θ cosφ ρ sin θ cosφ −ρ sin θ sinφ 0 sin θ sinφ cosψ ρ cos θ sinφ cosψ ρ sin θ cosφ cosψ −ρ sin θ sinφ sinψ sin θ sinφ sinψ ρ cos θ sinφ sinψ ρ sin θ cosφ sinψ ρ sin θ sinφ cosψ ∣∣∣∣∣∣∣ . And,
Jf = ρ 3 sin2 θ sinφ. (31)
Therefore, by the Jacobian Jf , we have the polar form:
da dbdcdd = ρ3 sin2 θ sinφdρdθ dφdψ. (32)
Then, writing Eq.(30) in polar coordinates, we obtain:
FL(x, σ) =
( 1√
2πσ2 )4 ∫ ∫ ∫ ∫ x 0 e−a 2/2σ2e−b 2/2σ2e−c 2/2σ2e−d 2/2σ2 dSx
= 1
4π2σ4 ∫ 2π 0 ∫ π 0 ∫ π 0 ∫ x 0 e−ρ 2/2σ2ρ3 sin2 θ sinφdρdθ dφ dψ
= 1
4π2σ4 ∫ 2π 0 dψ ∫ π 0 sinφ dφ ∫ π 0 sin2 θ dθ ∫ x 0 ρ3e−ρ 2/2σ2 dρ
= 1
4π2σ4 2π2
[ θ
2 − sin 2θ 4 ]π 0 ∫ x 0 ρ3e−ρ 2/2σ2 dρ
= 1 4π2σ4 4π π 2 ∫ x 0 ρ3e−ρ 2/2σ2 dρ,
Then,
FL(x, σ) = 1
2σ4 ∫ x 0 ρ3e−ρ 2/2σ2 dρ. (33)
The probability density function for X is the derivative of its cumulative distribution function, which by the fundamental theorem of calculus is:
fL(x, σ) = d
dx FL(x, σ)
= 1
2σ4 x3e−x 2/2σ2 . (34)
The expectation of the squared magnitude becomes:
E(|W |2) = ∫ ∞ 0 x2f(x) dx
= ∫ ∞ 0 x2 1 2σ4 x3e−x 2/2σ2 dx
= 1
2σ4 ∫ ∞ 0 x5e−x 2/2σ2 dx.
With integration by parts we obtain:
E(|W |2) = 1 2σ4
( −x4σ2e−x 2/2σ2 ∣∣∣∞ 0 + ∫ ∞ 0 σ24x3e−x 2/2σ2 dx ) = 1
2σ2
( −x4e−x 2/2σ2 ∣∣∣∞ 0 + ∫ ∞ 0 4x3e−x 2/2σ2 dx ) . (35)
The expectation E(|W |2) is the sum of two terms. The first one:
−x4e−x 2/2σ2 ∣∣∣∞ 0 = lim x→+∞ −x4e−x 2/2σ2 − lim x→+0 x4e−x 2/2σ2
= lim x→+∞
−x4e−x 2/2σ2 ,
Based on the L’Hôpital’s rule, the undetermined limit becomes:
lim x→+∞
−x4e−x 2/2σ2 = − lim
x→+∞
x4
ex2/2σ2
= . . .
= − lim x→+∞
24
(1/σ2)(P (x)ex2/2σ2) (36)
= 0.
With P (x) is polynomial and has a limit to +∞. The second term is calculated in a same way (integration by parts) and E(|W |2) becomes from Eq.(35):
E(|W |2) = 1 2σ2 ∫ ∞ 0 4x3e−x 2/2σ2 dx
= 2
σ2
( x2σ2e−x 2/2σ2 ∣∣∣∞ 0 + ∫ ∞ 0 σ22xe−x 2/2σ2 dx ) .
(37) The limit of first term is equals to 0 with the same method than in Eq.(36). Therefore, the expectation is:
E(|W |2) = 4 (∫ ∞
0
xe−x 2/2σ2 dx ) = 4σ2. (38)
And finally the variance is: V ar(|W |) = 4σ2. (39)

heading: 6.3 QUATERNION BACKPROPAGATION THROUGH TIME
text: Let us recall the forward equations and parameters needed to derive the complete quaternion backpropagation through time (QBPTT) algorithm.

heading: 6.3.1 RECALL OF THE FORWARD PHASE
text: Let xt be the input vector at timestep t, ht the hidden state, Whh, Wxh and Why the hidden state, input and output weight matrices respectively. Finally bh is the biases vector of the hidden states and pt, yt are the output and the expected target vector.
ht = α(h preact t ), (40)
with, hpreactt = Whh ⊗ ht−1 +Wxh ⊗ xt + bh, (41) and α is the quaternion split activation function (Xu et al., 2017) of a quaternion Q defined as: α(Q) = f(r) + if(x) + jf(y) + kf(z), (42)
and f corresponding to any standard activation function. The output vector pt can be computed as:
pt = β(p preact t ), (43)
with ppreactt = Why ⊗ ht, (44)
and β any split activation function. Finally, the objective function is a real-valued loss function applied component-wise. The gradient with respect to the MSE loss is expressed for each weight matrix as ∂Et∂Why , ∂Et ∂Whh , ∂Et∂Whx , and for the bias vector as ∂Et ∂Bh
. In the real-valued space, the dynamic of the loss is only investigated based on all previously connected neurons. In this extent, the QBPTT differs from BPTT due to the fact that the loss must also be derived with respect to each component of a quaternion neural parameter, making it bi-level. This could act as a regularizer during the training process.

heading: 6.3.2 OUTPUT WEIGHT MATRIX
text: The weight matrix Why is used only in the computation of pt. It is therefore straightforward to compute ∂Et∂Why :
∂Et ∂Why = ∂Et ∂W rhy + i ∂Et ∂W ihy + j ∂Et ∂W jhy + k ∂Et ∂W khy . (45)
Each quaternion component is then derived following the chain rule:
∂Et ∂W rhy = ∂Et ∂prt ∂prt ∂W rhy + ∂Et ∂pit ∂pit ∂W rhy + ∂Et ∂pjt ∂pjt ∂W rhy + ∂Et ∂pkt ∂pkt ∂W rhy
= (prt − yrt )× hrt + (pit − yit)× hit + (p j t − y j t )× h j t + (p k t − ykt )× hkt .
(46)
∂Et ∂W ihy = ∂Et ∂prt ∂prt ∂W ihy + ∂Et ∂pit ∂pit ∂W ihy + ∂Et ∂pjt ∂pjt ∂W ihy + ∂Et ∂pkt ∂pkt ∂W ihy
= (prt − yrt )×−hit + (pit − yit)× hrt + (p j t − y j t )× hkt + (pkt − ykt )×−h j t .
(47)
∂Et ∂W jhy = ∂Et ∂prt
∂prt
∂W jhy + ∂Et ∂pit
∂pit
∂W jhy + ∂Et ∂pjt
∂pjt
∂W jhy + ∂Et ∂pkt
∂pkt
∂W jhy
= (prt − yrt )×−h j t + (p i t − yit)×−hkt + (p j t − y j t )× hrt + (pkt − ykt )× hit.
(48)
∂Et ∂W khy = ∂Et ∂prt ∂prt ∂W khy + ∂Et ∂pit ∂pit ∂W khy + ∂Et ∂pjt ∂pjt ∂W khy + ∂Et ∂pkt ∂pkt ∂W khy
= (prt − yrt )×−hkt + (pit − yit)× h j t + (p j t − y j t )×−hit + (pkt − ykt )× hrt .
(49)
By regrouping in a matrix form the ht components from these equations, one can define: hrt h i t h j t h k t −hit hrt hkt −h j t
−hjt −hkt hrt hit −hkt h j t −hit hrt  = h∗t . (50) Therefore,
∂Et ∂Why = (pt − yt)⊗ h∗t . (51)

heading: 6.3.3 HIDDEN WEIGHT MATRIX
text: Conversely to Why the weight matrix Whh is an argument of ht with ht−1 involved. The recursive backpropagation can thus be derived as:
∂E
∂Whh = N∑ t=0 ∂Et ∂Whh . (52)
And,
∂Et ∂Whh = t∑ m=0 ∂Em ∂W rhh + i ∂Em ∂W rhh + j ∂Em ∂W ihh + k ∂Em ∂W khh , (53)
with N the number of timesteps that compose the sequence. As for Why we start with ∂Ek∂W rhh :
t∑ m=0 ∂Em ∂W rhh = t∑ m=0 ∂Et ∂hrt ∂hrt ∂hrm ∂hrm ∂W rhh + ∂Et ∂hit ∂hit ∂him ∂him ∂W rhh
+ ∂Et
∂hjt
∂hjt ∂hjm ∂hjm ∂W rhh + ∂Et ∂hkt ∂hit ∂hkm ∂hkm ∂W rhh .
(54)
Non-recursive elements are derived w.r.t r, i,j, k:
∂Et ∂hrt = ∂Et ∂prt ∂prt ∂hrt + ∂Et ∂pit ∂pit ∂hrt + ∂Et ∂pjt ∂pjt ∂hrt + ∂Et ∂pkt ∂pkt ∂hrt
= (prt − yrt )× f ′ (prt )×W rhy + (pit − yit)× f ′ (pit)×W ihy
+ (pjt − y j t )× f ′ (pjt )×W j hy + (p k t − ykt )× f ′ (pkt )×W khy.
(55)
∂Et ∂hit = ∂Et ∂prt ∂prt ∂hit + ∂Et ∂pit ∂pit ∂hit + ∂Et ∂pjt ∂pjt ∂hit + ∂Et ∂pkt ∂pkt ∂hit
= (prt − yrt )× f ′ (prt )×−W ihy + (pit − yit)× f ′ (pit)×W rhy
+ (pjt − y j t )× f ′ (pjt )×W khy + (pkt − ykt )× f ′ (pkt )×−W j hy.
(56)
∂Et ∂hjt = ∂Et ∂prt
∂prt
∂hjt + ∂Et ∂pit
∂pit
∂hjt + ∂Et ∂pjt
∂pjt
∂hjt + ∂Et ∂pkt
∂pkt ∂hjt
= (prt − yrt )× f ′ (prt )×−W j hy + (p i t − yit)× f ′ (pit)×−W khy
+ (pjt − y j t )× f ′ (pjt )×W rhy + (pkt − ykt )× f ′ (pkt )×W ihy.
(57)
∂Et ∂hkt = ∂Et ∂prt ∂prt ∂hkt + ∂Et ∂pit ∂pit ∂hkt + ∂Et ∂pjt ∂pjt ∂hkt + ∂Et ∂pkt ∂pkt ∂hkt
= (prt − yrt )× f ′ (prt )×−W khy + (pit − yit)× f ′ (pit)×W j hy
+ (pjt − y j t )× f ′ (pjt )×−W ihy + (pkt − ykt )× f ′ (pkt )×W rhy.
(58)
Then,
 ∂hr,m ∂W rhh = hr,t−1 ∂hi,m ∂W rhh = hi,t−1 ∂hj,m ∂W rhh = hj,t−1 ∂hk,m ∂W rhh = hk,t−1 ∂hr,m ∂W ihh = −hi,t−1 ∂hi,m∂W rhh = hi,t−1 ∂hj,m ∂W rhh = hj,t−1 ∂hk,m ∂W rhh = hk,t−1 ∂hr,m ∂W jhh = −hj,t−1 ∂hi,m∂W jhh = −hk,t−1 ∂hj,m∂W jhh = hr,t−1 ∂hk,m ∂W jhh = hi,t−1
∂hr,m ∂Wkhh = −hk,t−1 ∂hi,m∂Wkhh = hj,t−1 ∂hj,m ∂Wkhh = −hi,t−1 ∂hk,m∂Wkhh = hr,t−1
 = h∗t . (59)
The remaining terms ∂h r t ∂hrm , ∂h i t ∂him , ∂h j t ∂hjm and ∂h k t ∂hkm are recursive and are written as:
∂hr,t ∂hr,m = t∏ n=m+1 ∂hr,n ∂hpreactr,n ∂hpreactr,n ∂hr,n−1 + ∂hr,n ∂hpreacti,n ∂hpreacti,n ∂hr,n−1
+ ∂hr,n
∂hpreactj,n
∂hpreactj,n ∂hr,n−1 + ∂hr,n
∂hpreactk,n
∂hpreactk,n ∂hr,n−1 ,
(60)
simplified with,
∂hr,t ∂hr,m = t∏ n=m+1 ∂hr,n ∂hpreactr,n ×W rhh + ∂hr,n ∂hpreacti,n ×W ihh
+ ∂hr,n
∂hpreactj,n ×W jhh +
∂hr,n
∂hpreactk,n ×W khh.
(61)
Consequently,
∂hi,t ∂hi,m = t∏ n=m+1 ∂hi,n ∂hpreactr,n ×−W ihh + ∂hi,n ∂hpreacti,n ×W rhh
+ ∂hj,n
∂hpreactj,n ×W khh +
∂hi,n
∂hpreactk,n ×−W jhh.
(62)
∂hj,t ∂hj,m = t∏ n=m+1 ∂hj,n ∂hpreactr,n ×−W jhh + ∂hj,n ∂hpreacti,n ×−W khh
+ ∂hj,n
∂hpreactj,n ×W rhh +
∂hj,n
∂hpreactk,n ×W ihh.
(63)
∂hk,t ∂hk,m = t∏ n=m+1 ∂hk,n ∂hpreactr,n ×−W khh + ∂hk,n ∂hpreacti,n ×W jhh
+ ∂hk,n
∂hpreactj,n ×−W ihh +
∂hk,n
∂hpreactk,n ×W rhh.
(64)
The same operations are performed for i,j,k in Eq. 68 and ∂Et∂Whh can finally be expressed as:
∂Et ∂Whh = t∑ m=0 ( t∏ n=m+1 δn)⊗ h∗t−1, (65)
with,
δn = { W ∗hh ⊗ δn+1 × α′(hpreactn ) if n 6= t W ∗hy ⊗ (pn − yn)× β ′ (ppreactn ) else.
(66)
6.3.4 INPUT WEIGHT MATRIX
∂Et ∂Whx is computed in the exact same manner as ∂Et∂Whh .
∂E
∂Whx = N∑ t=0 ∂Et ∂Whx . (67)
And,
∂Et ∂Whx = t∑ m=0 ∂Em ∂W rhx + i ∂Em ∂W rhx + j ∂Em ∂W ihx + k ∂Em ∂W khx . (68)
Therefore ∂Et∂Whx is easily extent as:
∂Et ∂Whx = t∑ m=0 ( t∏ n=m+1 δn)⊗ x∗t . (69)
6.3.5 HIDDEN BIASES
∂Et ∂Bh can easily be extended to:
∂E
∂Bh = N∑ t=0 ∂Et ∂Bh . (70)
And,
∂Et ∂Bh = t∑ m=0 ∂Em ∂Brh + i ∂Em ∂Brh + j ∂Em ∂Bih + k ∂Em ∂Bkh . (71)
Nonetheless, since biases are not connected to any inputs or hidden states, the matrix of derivatives defined in Eq. 59 becomes a matrix of 1. Consequently ∂Et∂Bh can be summarized as:
∂Et ∂Bh = t∑ m=0 ( t∏ n=m+1 δn). (72)

Review summaries:
Quality: sufficient though there are issues. Work done in automatic speech recognition on numerous variants of recurrent models, such as interleaved TDNN and LSTM (Peddinti 2017), is completely ignored [addressed in the revision]. The description of derivatives needs to mention the linear relationship between input features and derivatives (see trajectory HMMs by Zen and Tokuda) [addressed in the revision]. TIMIT is a very simple task [addressed by adding WSJ experiments]. Derivations in the appendices could be connected better [addressed in the revision]. 

The paper takes a good step toward developing more structured representations by exploring the use of quaternions in recurrent neural networks.  The idea is motivated by the observation that in many cases there are local relationships among elements of a vector that should be explicitly represented.  This is also the idea behind capsules - to have each "unit" output a vector of parameters to be operated upon rather than a single number.   Here the authors show that by incorporating quaternions into the representations used by RNNs or LSTMs, one achieves better performance at speech recognition tasks using fewer parameters.