{'fraction_non_alphanumeric': 0.03353348361228032, 'fraction_numerical': 0.014861656925133157, 'mean_word_length': 5.067538126361656, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Mixed Precision Low-bit Quantization of Neural Network Language Models for Speech Recognition

State-of-the-art language models (LMs) represented by long-short term memory recurrent neural networks (LSTM-RNNs) and Transformers are becoming increasingly complex and expensive for practical applications. Low-bit neural network quantization provides a powerful solution to dramatically reduce their model size. Current quantization methods are based on uniform precision and fail to account for the varying performance sensitivity at different parts of LMs to quantization errors. To this end, novel mixed precision neural network LM quantization methods are proposed in this paper. The optimal local precision choices for LSTM-RNN and Transformer based neural LMs are automatically learned using three techniques. The first two approaches are based on quantization sensitivity metrics in the form of either the KL-divergence measured between full precision and quantized LMs, or Hessian trace weighted quantization perturbation that can be approximated efficiently using matrix free techniques. The third approach is based on mixed precision neural architecture search. In order to overcome the difficulty in using gradient descent methods to directly estimate discrete quantized weights, alternating direction methods of multipliers (ADMM) are used to efficiently train quantized LMs. Experiments were conducted on state-of-the-art LF-MMI CNN-TDNN systems featuring speed perturbation, i-Vector and learning hidden unit contribution (LHUC) based speaker adaptation on two tasks: Switchboard telephone speech and AMI meeting transcription. The proposed mixed precision quantization techniques achieved"lossless"quantization on both tasks, by producing model size compression ratios of up to approximately 16 times over the full precision LSTM and Transformer baseline LMs, while incurring no statistically significant word error rate increase.


I. INTRODUCTION
L ANGUAGE models (LMs) are important components in automatic speech recognition (ASR) systems and many other applications. A key part of the statistical language modelling problem is to derive the suitable representation of long-range history contexts. Directly modelling long-span word histories using conventional back-off n-gram models [1] generally leads to a severe data sparsity issue [2]. To this end, over the past few decades there have been significant efforts of developing artificial neural network based language modelling techniques in the speech technology community [3]- [14]. Neural network language models (NNLMs) representing longer span history contexts in a continuous and lower dimen- Junhao  sional vector space, are used to improve the generalization performance.
With the rapid progress of deep neural network (DNN) based ASR technologies in recent decades, the underlying network architectures of NNLMs have evolved from feedforward structures [3]- [7] to more advanced variants represented by long-short term memory recurrent neural networks (LSTM-RNNs) [8]- [10], [15] and more recently neural Transformers [11]- [14], [16] that are designed for modelling longer range contexts. In particular, Transformer based language models in recent years have defined state-of-the-art performance across a range of ASR task domains [11]- [14], [17]. These models [11]- [13], [17] are often constructed using a deep stacking of multiple self-attention based neural building blocks [18]- [20], each of which also includes residual connections [21] and layer normalization modules [22]. Additional positional encoding layers [16], [23] are employed to augment the self-attention structures with word sequence order information. Performance improvements over conventional LSTM-RNN language models have been widely reported [11], [24].
However, the increasingly deeper and more complex architecture designs featuring in LSTM-RNN and Transformer models present many challenges for current ASR technologies. These not only lead to a large increase in their overall memory footprint and computational cost when operating on the cloud, but also creates difficulty when deployed on edge devices to enhance privacy and reduce latency. In a wider context within the speech technology community, such dramatically increasing demand for computational resources is consistent with the recent trend of moving towards a data and computational intensive all neural end-to-end (E2E) modelling paradigm represented by, for example, Transformers [25]- [27], RNN transducers (RNN-T) [28], and listen, attend and spell (LAS) [29]. State-of-the-art ASR systems featuring these end-to-end approaches often contain a very large number of parameters, for example, up to 280 million [30]. Hence, there is a pressing need of developing ultra-compact, low footprint language modelling methods, and ASR technologies in general, to facilitate more aggressive reduction in memory footprint, model training and evaluation time while maintaining competitive accuracy performance.
To this end, significant efforts have been made in both the machine learning and speech technology communities to develop DNN compression techniques [31]- [74]. Pruning based methods exploiting the structural and parameter sparsity were used to reduce DNN model size in [38]- [44]. They are particularly useful for models containing large fully connected layers such as the ResNet systems [43], [44]. Knowledge distilla-arXiv:2112.11438v1 [cs.CL] 29 Nov 2021 tion and teacher-student learning [45]- [47] based approaches extract information from a pre-trained, larger model into a smaller one. Low rank matrix factorization [48]- [51], [55], and neural architecture search (NAS) based methods [63]- [72] have also been proposed.
Another powerful family of techniques recently drawing increasing interest across the machine learning, computer vision and speech technology communities to solve this problem is to use low-bit DNN quantization techniques [31]- [37], [52], [57], [58], [62], [74], [75]. By replacing floating point based DNN parameters with low precision values, for example, binary numbers, model sizes can be dramatically reduced without changing the DNN architecture [32], [57], [73]. Further DNN size reduction can be obtained when low-precision quantization is used in combination with neural architecture search (NAS) techniques, for example, in the SqueezeNet system designed for computer vision tasks [52]. In contrast to the extensive prior research works on low-bit quantization methods primarily targeting computer vision tasks [31]- [37], [52], only limited previous research in this direction has been conducted in the context of language modelling [57], [58] and ASR systems [56], [59].
Two issues are associated with current low-bit DNN quantization methods. First, these approaches are predominantly based on uniform precision, where an identical bit-width is applied to all weight parameters for quantization [76]. Within such framework, the varying local performance sensitivity exhibited at different parts of the underlying DNN system to quantization errors is not taken into account. In practice, this often leads to large performance degradation against full precision models. Second, when DNN weights are restricted to discrete values, the conventional back-propagation (BP) algorithm based on gradient descent methods cannot be directly applied to estimate the quantized model parameters. Existing approaches for training quantized DNNs often use a modified BP algorithm [31], [32]. In this approach, low precision quantized parameters are first used in a forward pass to compute the error loss, before full precision parameters are then used in a backward pass to propagate the gradients for subsequent model update. However, the inconsistency between quantized, discrete weights and the SGD algorithm assuming continuous and differentiable error cost functions leads to not only very slow convergence in training, but also performance degradation against full precision models.
In order to address the first issue discussed above regarding performance sensitivity, and motivated by the recent development of mixed precision DNN acceleration hardware that allows multiple locally selected precision settings to be used [37], novel mixed precision DNN quantization approaches are proposed in this paper by utilizing locally variable bit-widths at different layer components of LSTM-RNN and Transformer LMs. The optimal local precision settings are automatically learned using three techniques. The first two approaches are based on quantization sensitivity metrics in the form of either Hessian trace weighted quantization perturbation that can be approximated efficiently via matrix free techniques, or the KL-divergence measured between full precision and quantized language models. The third approach is based on mixed precision neural architecture search.
In order to address the second issue over the difficulty in using gradient descent methods to directly estimate NNLMs of discrete weights, the general problem of estimating quantized DNN model parameters is reformulated as an optimization task. For any form of quantized NNLMs using uniform or mixed precision settings, alternating direction methods of multipliers (ADMM) [17], [73], [77] are proposed to efficiently train their discrete parameters. Two sets of model parameters respectively associated with a full precision neural network LM, and the corresponding optimal quantized model with a particular precision setting, are iteratively learned via a decomposed dual ascent scheme in an alternating fashion. This novel quantized NNLM estimation algorithm draws strength from both the decomposability of classic dual ascent schemes and the stable convergence of multiplier methods.
Experiments were conducted on state-of-the-art LF-MMI CNN-TDNN and TDNN systems [78] featuring speed perturbation, i-Vector [79] and learning hidden unit contribution (LHUC) based speaker adaptation [80] on two tasks, Switchboard telephone speech [81] and AMI meeting transcription [82]. Experimental results suggest the proposed mixed precision LM quantization techniques achieved model size compression ratios of about 16 times over the full precision Transformer LM baselines with no statistically significant recognition performance degradation.
The main contributions of this paper are summarized as follows.
1) To the best of our knowledge, this paper presents the first work in the speech technology community to apply mixed precision DNN quantization techniques to both LSTM-RNN and Transformer based NNLMs. In contrast, prior researches within the speech community in this direction largely focused on uniform precision based quantization of convolutional neural networks (CNNs) acoustic models [62] and LSTM-RNN language models [57], [58], [75].
2) To the best of our knowledge, this paper is the first work to introduce ADMM based neural network quantization techniques for speech recognition tasks. In contrast, prior researches with the speech technology community on lowbit quantization of CNNs [62] and LSTM-RNN LMs [57], [58], [75] used the modified BP algorithm [31], [32] while the inconsistency between discrete, quantized parameters and gradient based SGD update remains unaddressed.
3) Transformer LM model size compression ratios of up to approximately 16 times over the full precision Transformer LM baselines with no statistically significant recognition performance degradation were obtained using an average 2-bit mixed precision configuration. To the best of our knowledge, this is the best low-bit Transformer language model compression ratio published so far in the speech technology community while incurring no recognition accuracy loss.
The rest of the paper is organized as follows. LSTM-RNN and Transformer based NNLMs are reviewed in section II. A general neural network quantization scheme based on uniform or locally varying mixed quantization precisions are presented in section III. ADMM based training of quantized NNLMs are presented in Section IV. Section V presents three novel mixed precision quantization methods. Experiments and results are shown in Section VI. Finally, conclusions and possible future work are discussed in section VII.

II. NN LANGUAGE MODELS
This section reviews two types of neural network language models that are widely used in state-of-the-art speech recognition systems: long-short term memory recurrent neural network (LSTM-RNN) and Transformer based language models.

A. Recurrent Neural Network LMs
The form of LSTM-RNN language models considered in this paper computes the word probability w t given the preceding history context of t − 1 words w 1 , ..., w t−1 as where h t−1 is the D-dimensional vector hidden state encoding part of the history information (w 1 , ..., w t−2 ) up to word w t−2 , where D is the number of RNNLM hidden layer nodes. The most recent word history w t−1 is represented by a Ndimensional one-hot vectorw t , where N is the vocabulary size. This one-hot word input vector is first projected into a M -dimensional (M N ) linear vector embedding as where Θ U is a projection matrix to be learned, before being further fed into the hidden layers where non-linear transformations are applied. The hidden state h t is calculated within the LSTM cells [83] where the previous hidden state h t−1 and the current word input embeddingw t is combined. Each LSTM memory cell consists of a set of Sigmoidal gating activations, the input gate i t , forget gate f t , cell gatec t and output gate o t . These are used to control the information flow within the cells in order to trap longer range history contexts and address the vanishing gradient issue. The respective outputs from these gates are given by where tanh(u) = [tanh(u 1 ), ..., tanh(u D )] for any u ∈ R D . The final hidden state is normally computed recursively in an auto-regressive fashion, for example, from left to right in case of standard uni-directional LSTM-RNN LMs modelling history contexts only [5], [8], [10]. Using the above four gating functions outputs, the LSTM-RNN cell contents c t and hidden state representation h t are finally computed as where ⊗ is the Hadamard product.

B. Transformer LMs
The Transformer model architecture considered in this paper features a deep stacking of multiple Transformer decoder blocks. Unless otherwise stated, 6 Transformer decoder blocks are used in all the experiments of this paper. As shown in the top part of Figure 1, each Transformer decoder block consists of a multi-head self-attention [18]- [20] module and a feed forward module. Residual connections [21] and layer normalization operations [22] are also inserted between these two modules. Let x l−1 t denotes the output of the (l − 1)-th Transformer block at input word position t. The multi-head self-attention module in the succeeding l-th block transforms x l−1 t to z l t as follows: where Θ l Q , Θ l K , Θ l V denote the learnable query, key, value projection matrices which map x l−1 t into the corresponding vector representations of query q l t , key k l t and value v l t respectively. z l t is the sequence of of cached key-value vector pairs up to time t, which only contains the history context information and can prevent the model from using any future context. Attention(·) denotes the scaled multi-head dot product self-attention [20]. LayerNorm(·) represents the layer normalization operation [22]. Θ l h denotes the learnable projection matrix applied to the outputs of the Attention operation prior to layer normalization. The normalized output o l t is then fed into the feed forward module: where Θ l 1 and Θ l 2 are the weight matrices that are applied to the normalized output o l t before Gaussian error linear unit (GELU) [84] activation functions and after. For simplicity the bias vectors optionally used in the feed forward modules are omitted in the above Equation (13). In addition, positional embedding layers are also used in all the transformer LMs considered in this paper.
It is assumed in the above standard quantization process that a global quantization table is applied to all weight parameters. In order to account for the fine-grained local quantization sensitivity, the following more general form of quantization is considered for a particular model parameter Θ (l) within any of the l-th weight cluster, for example, all parameters of the same LSTM or Transformer LM layer, can be used. The locally shared l-th quantization table is where the full precision scaling factor α (l) is used to adjust the dynamic range of all the quantized weights in the lth cluster. It is shared locally within each individual DNN parameter clusters. The locally variable quantization bit length n l can be set to be 1, 2, 4, 8 etc. depending on the optimal precision settings to be used. A special case, when the local quantization table in Equation (18) is shared across all the layers in the system, this leads to the traditional uniform precision quantization. The above tying of quantization tables may be flexibly performed at either layer, or node level, or in the extreme case at individual parameter level (this is equivalent to no quantization being applied). Intuitively, the longer the local quantization precision bit widths {n l } are used at each part of the underlying neural language model, a smaller compression ratio after quantization and reduced performance degradation is expected.

IV. ADMM BASED TRAINING OF QUANTIZED DNN
One major challenge faced by both uniform and mixed precision quantization is that the gradient descent methods and back-propagation (BP) algorithm cannot be directly used when weights are quantized to discrete values. To this end, mixed precision BP was proposed in [31], [32] where low precision binarized parameters were first used in the forward pass to compute the error loss before full precision parameters are used in the backward pass to propagate the gradients. However, there is an inconsistency between quantized, discrete weights and the assumption over continuous and differentiable error cost functions in SGD update. Hence, directly training quantized system using mixed precision BP leads to very slow convergence and the performance gap between full precision and quantized systems remains large. An alternative solution to this problem is to reformulate quantization as a constrained optimization problem solved by the alternating direction methods of multipliers (ADMM) [73].
The ADMM based optimization decomposes a dual ascent problem into alternating updates of two variables. In the context of the neural network LM quantization problem considered here, these correspond to the full precision model weights update and the discrete quantization tables estimation. The overall ADMM Lagrange function is given as where F ce is the cross entropy (CE) loss, Θ are the full precision model parameters. f (Θ) represents the quantization of the parameters calculated from the quantization using Equation (17). γ > 0 is the penalty parameter which is empirically set as 10 −3 throughout this paper and λ denotes the Lagrangian multiplier. The standard Lagrangian term expressed in the form of a dot product between the multiplier variable λ and the quantization error, Θ − f (Θ), is shown as the second term in Equation (19). In order to further improve the robustness and convergence speed of the ADMM algorithm, an additional term related to the quantization error squared norm, shown as the third term in Equation (19), is also introduced to form an augmented Lagrangian [73]. Further rearranging Equation (19) leads to the following loss function.
Given a particular uniform or mixed precision quantization configuration, the ADMM algorithm is iteratively performed to find the optimal scaling factors, {α (l) }, in the quantization table(s) of Equation (18). For simplicity, in the following detailed description of the algorithm, we assume a globally shared quantization table {0, ±α, . . . , ±α(2 n−1 − 1)} is applied to all parameters and a single scaling factor α is to be learned. The following iterative update can be extended when multiple shared quantization tables of different bit-widths n l in Equation (18) are used. When the ADMM algorithm is performed at the (k + 1) th iteration, the overall update can be split into three stages presented in the following subsections.

A. Full precision model parameter update
The following equation is used to update the full precision weight parameters Θ (k+1) .
where f (Θ (k) ), λ (k) are the quantized weights and error variable at the k th iteration. The gradient of the loss function in Equation (20) w.r.t Θ is calculated as the following.
It is found in practice that the quadratic term of the augmented Lagrangian of Equation (20) can dominate the loss function computation and lead to a local optimum. Following the extra-gradient method suggested in [86], the solution to address this issue in this paper is to perform the gradient calculation by one additional step ahead to improve the convergence.Θ HereΘ represents the temporary variable used to store the intermediate updated parameters, and η 1 and η 2 are separate learning rates that are empirically set as 0.02 and 0.001 throughout the experiments of this paper.

B. Quantization variables update
The quantization variables including the scaling factor α in a globally shared quantization table {0, ±α, . . . , ±α(2 n−1 − 1)}, and the corresponding quantized parameters derived using Equation (17) can be solved by minimizing the following: where alternating updates of the scaling factor estimate α (k) and the associated quantized model parameters V (k+1) α are performed via an inner-loop within the current (k + 1) th outer iteration.
The following algorithm shows the details of such innerloop update. In all the experiments of this paper, the maximum number of inner-loops is set as 20 and practically found sufficient to ensure convergence.

Algorithm 1: Quantization variables update inner loop
The minimization operation of Equation (24) aims to find the corresponding quantized model parameters given the full precision parameter updates in Section IV-A. As it is nontrivial to update both the scaling parameters α (l) of the quantization table of Equation (18) and the quantized parameters derived using Equation (17) at the same time, an alternating estimation procedure is used here in the inner-loop of Algorithm 1, to produce interleaving updates of the scaling parameters α (l) when fixing the current quantized parameters V (k) α , and vice versa when updating the quantized parameters V (k) α , while keeping α (l) unchanged. Intuitively the resulting update of α (l) accounts for the change in the dynamic range of model parameters before and after quantization.

C. Quantization error update
The Lagrange multiplier variable λ, now encoding the accumulated quantization errors computed at each iteration, is updated as In all experiments of this paper the scaling factors α (l) in Equation (18) are initialized to 1.0 before the ADMM update is performed.
The above ADMM estimation of quantized neural network LMs can be executed iteratively until convergence measured in terms of validation data perplexity. In practice, a maximum number of 20 ADMM iterations was used throughout all the experiments of this paper to obtain convergence for all quantized LSTM-RNN and transformer LMs, as will be shown later in the convergence speed analysis of the following Section VI of experiments.
V. MIXED PRECISION QUANTIZATION This section presents three approaches to automatically learn the optimal local precision settings previously introduced in Equation (18) for DNN quantization. The first two minimizes the performance sensitivity to low-bit quantization. They are measured using either the KL divergence between full precision and quantized LMs, or the log-likelihood curvature with respect to quantization error. The third approach uses a mixed precision differentiable neural architecture search technique. Examples of their application to Transformer and LSTM-RNN based LMs are also given.

A. KL Divergence Based Mixed Precision Quantization
The ultimate goal for any DNN quantization task, including the neural network LMs considered in this paper, is to obtain a "lossless" model compression such that the distance between the distribution embodied by the original full precision LM and that of the quantized model must be minimized. This requires the relative entropy, or equivalently the Kullback-Leibler (KL) divergence between full precision and quantized neural network LMs to be minimized. As a special case, the KL divergence is zero when a lossless compression is achieved, so that the same LM distribution is preserved after quantization. The use of KL divergence based distance metrics in early researches led to widely adopted back-off n-gram LM pruning techniques [87], [88].
In this paper, the KL divergence between the probability distributions obtained from a full precision NNLM and its quantized counterpart using a particular mixed precision setting is used to measure the resulting performance sensitivity. Taking a L-layer Transformer LM for example, for any quantization f (·) being applied to the full precision parameters Θ, the KL divergence based quantization sensitivity measure is computed over the training data of N w words as, where Θ i denote the full precision parameters of the i th layer, and f ni (Θ i ) its associated n i -bit quantized parameters given a particular local precision bit width n i .
Given a target average quantization precision such as 2-bit, the local quantization bit widths used in each layer should be selected such that the total performance sensitivity in Equation (26) is minimized while satisfying the target model size constraint. However, directly evaluate the combined KL divergence metric for all possible mixed precision local quantization settings leads to a very large number of possible systems to be considered. For example, choosing among 4 different precision settings, 1-bit, 2-bit, 4-bit and 8-bit, across all 6 layers of a Transformer LM, produces a total of 4 6 = 4096 mixed precision quantized Transformer LMs to be evaluated in terms of KL divergence against the full precision model.
In order to address this scalability issue, a practical implementation adopted in this paper is based on a divide and conquer approach. The key information required to compute the sensitivity measure in Equation (26) is the local KL divergence metric, Ω KL i , for example, associated with the i th Transformer LM layer. In our implementation, a set of prototype transformer LMs quantized using uniform precision, for example 1-bit, 2-bit, 4-bit and 8-bit are trained off-line first via ADMM optimization of Section IV. The performance sensitivity in Equation (26) can then be computed first locally for each layer by replacing the full precision parameters using each of the above four possible quantization choices at that layer only, before taking the sum to produce the combined net KL divergence metric when a particular mixed precision based local quantization configuration is applied across the entire Transformer LM.
In order to further improve the efficiency when computing the KL divergence based sensitivity measure in Equation (26), a very small number of training data samples, as little as the data of one single mini-batch (batch size set as 32 throughout this paper) can be used, and adopted in all experiments of this paper. In practice this was found to produce quantized LM perplexity comparable to that obtained by computing the KL metric over the entire training data set. An ablation study on the relationship between the amount of Switchboard training data used to compute the KL divergence metric and determine the resulting mixed precision for Transformer LM quantization and the resulting LM's perplexity performance is shown in Table I. In order to further ensure efficiency, the resulting mixed precision quantized LMs using varying automatically learned local precision settings together with quantized parameters inherited from uniform precision models of different bit-widths are fine-tuned, rather than retrained from scratch. In practice, this was found to produce performance comparable to re-training them from scratch after determining the precision settings, as is illustrated in the example contrast of Table II for 2-bit and 4-bit KL mixed precision quantized Transformer LMs on the Switchboard data.
An example application of KL divergence based mixed precision quantization of Transformer and LSTM-RNN LMs are shown in Figure 1 and 2 respectively.

B. Curvature Based Mixed Precision Quantization
The second approach to measure performance sensitivity to quantization examines the local training data log-likelihood curvature. Under mild assumptions such that the parameters of a DNN is twice differentiable and have converged to a local optimum, it has been shown in previous researches [35] that the performance sensitivity to quantization, when using a given precision setting, can be expressed as the squared quantization error further weighted by the parameter Hessian matrix trace.
For any quantization f (·) being applied to the parameters Θ of a L layer Transformer LM, the total performance sensitivity is given by the following sum of Hessian trace weighted squared quantization error.
Intuitively for each cluster of weight parameters (for example of the same layer) to be quantized using a particular precision bit width, given the same amount of model parameter changes resulted from quantization, a smaller Hessian matrix trace indicates a lower performance sensitivity to quantization. Given a target average quantization precision such as 2bit, the local quantization setting, for example, used in each Transformer LM layer, should be selected such that the total performance sensitivity in Equation (27) is minimized while satisfying the target model size constraint. Similar to the KL divergence based mixed precision quantization, a set of prototype Transformer or LSTM-RNN LMs quantized using uniform precision, for example 1-bit, 2-bit, 4-bit and 8-bit, are trained off-line first using the ADMM optimization in Section IV. The log-likelihood curvature based performance sensitivity in Equation (27) can then be computed locally for each layer using each quantization choice before taking the sum to produce the combined net sensitivity measure for any mixed precision setting being considered. For larger LSTM-RNN or Transformer LMs containing up to hundreds of millions of parameters, and large DNNs in general, directly computing the Hessian matrix and its trace is computationally infeasible. In order to address this issue, an efficient stochastic linear algebra approach based on the Huchinson's Algorithm [89] is used to approximate the Hessian trace, where the expensive matrix multiplication between H and z i can be avoided, and efficiently computed using Hessianfree approaches [35]. z i is a random vector sampled from a Gaussian Distribution N (0, 1). Following the previous research reported in [37], the maximum number of Hutchinson steps set as m = 50 is found sufficient to obtain an accurate Hessian approximation for computing the curvature based quantization sensitivity of Equation (27), and used throughout the experiments of this paper. Again for efficiency, a small subset of the training data from a randomly drawn mini-batch (batch size 32) is used, in common with the previous KL divergence metric. Further analysis on the relationship between the sampled training data size and the resulting quantized Transformer LMs perplexity performance is shown in the last line of Table I for the Switchboard data. An example application of the above curvature performance sensitivity based mixed precision quantization of a Transformer LM is shown in Figure 3.

C. Architecture Search Based Mixed Precision Quantization
The third solution to automatically learn the optimal local quantization precision settings is to use mixed precision based neural architecture search (NAS) approaches. Neural architecture search (NAS) techniques [90] can efficiently automate  Neural architecture search using DARTS is performed over an over-parameterized super-network containing paths connecting all candidate DNN structures to be considered. The search is transformed into the estimation of the weights assigned to each candidate neural architecture within the supernetwork. The optimal architecture is obtained by pruning lower weighted paths. This allows both architecture selection and candidate DNN parameters to be consistently optimized within the same super-network model.
The key difference from conventional NAS tasks is that instead of selecting over heterogeneous neural building structures, for example, varying hidden layer left and right context offsets or projection layer dimensionality in LF-MMI trained time delay neural networks (TDNNs) [91], different quantized neural building blocks, for example, LSTM or Transformer LM modules of different bit-widths are considered. This crucial difference requires the associated mixed precision quantization super-network to be specially designed. Such supernetwork is constructed by first separately training transformer LMs using uniform precision, for example 1-bit, 2-bit, 4-bit and 8-bit, using ADMM optimization, before connecting these uniform precision quantized Transformer LMs at each layer, where the system specific activation outputs are linearly combined using a set of quantization precision selection weights as in the following equation: where a l n is the architecture weights using n-bit quantization for the l-th cluster of weight parameters. f n (·) represents n-bit quantization of the weight parameter Θ l and F (·) is the underlying layer's activation function. The set of possible quantization precision setting, N = {1, 2, 4, 8}, is used throughout this paper. An example of such mixed precision Transformer super-network is shown in Figure 4.
In order to avoid the trivial selection of the longest, most generous quantization bit width, these precision selection weights learning can be further constrained by a model complexity penalty term with respect to the number of bits retained after quantization, in order to obtain a target average quantization precision, for example, 2-bit, where F ce (Θ) is the standard cross-entropy loss.

VI. EXPERIMENTS
In this section the performance of mixed precision quantized LSTM-RNN and Transformer LMs are evaluated on two speech recognition systems both of which use state-ofthe-art LF-MMI sequence trained hybrid time delay neural networks (TDNNs) acoustic models with factored weights and additional convolutional layers [78]. Speech perturbation based data augmentation and i-Vector based speaker adaptation are also employed. Modified KN smoothed 4-gram back-off LMs are used during the initial N-best list generation pass before various NNLMs are then applied in the following rescoring stage. In Section VI-A, the first set of experiments conducted on the Switchboard I (SWBD) corpus [81] are presented. In Section VI-B another comparable set of experiments are carried out on the AMI meeting room data [82].
All the LSTM-RMM LMs investigated in this paper consist of 2 LSTM layers while both the input word embedding and hidden layer sizes were set as 1024. All the Transformer LMs used in this paper contain 6 Transformer layers. The dimensionality of all query, key and value embedding and hidden vectors are set as 512 for each batch of data. All the mixed precision quantized LSTM-RNN LMs and Transformer LMs of this paper use layer or node level precision settings that are set either manually as equal bit-widths (1-bit, 2-bit, 4-bit or 8-bit), or automatically learned using the KL, curvature or NAS based mixed precision quantization methods of Sections V. All NNLMs were tained using a single NVIDIA Tesla V100 Volta GPU card. Statistical significance test was conducted at level α = 0.05 based on matched pairs sentence segment word error (MAPSSWE) for recognition performance analysis. This is used to identify various "lossless" neural LM quantization configurations that incur no recognition performance degradation, or statistically significant word error rate (WER) increase.
The implementation used to evaluate the mixed precision quantization methods of this paper is exclusively based on the existing low-bit quantized precisions that are already natively supported by the NVidia Tesla V100 GPU. These include the use of the Boolean and masking operators to implement 1-bit quantization, and the INT8 data type used to implement 2, 4 and 8-bit quantization. In case of 2-bit and 4-bit quantization, extra padded bits of zero were also included.

A. Experiments on Conversational Telephone Speech
The Switchboard I telephone speech corpus we use consists of approximately 300 hours of audio data released by LDC (LDC97S62). Following the Kaldi toolkit [95] and its CNN-TDNN recipe 1 , LF-MMI trained CNN-TDNN acoustic models [78] with data augmentation and i-Vector adaptation [79] were then built. The CNN-TDNN network consisted of 6 convolutional layers followed by 8 context-splicing TDNN layers with 1536 nodes per layer. A 160-dimensional factored linear projection was employed prior to affine transformation in each context-splicing layer other than the first one. ReLU activation functions were used, followed by batch normalization and dropout operations. Left and right context offsets of {−3, 3} were also used in the context-splicing layers. More detailed description fo the baseline system's acoustic modelling configuration can be found in [96]. The Switchboard NIST Hub5'00, RT02 and RT03 evaluation sets were used. A 30K word recognition lexicon was used. Various LSTM and Transformer LMs trained on the Switchboard and Fisher transcripts (LDC2004T19, LDC2005T19) were used to rescore the 4-gram LM produced N-best lists (N = 20). 1) Experiments on LSTM-RNN LMs using baseline full precision, various uniform and mixed quantization settings are shown in Table III. All WER changes as the result of quantization that are of no statistical significance (MAPSSWE, α = 0.05) are marked by " * ". Several trends can be found here: • Among the uniform precision quantized LMs, the LSTM-RNN LMs of 1-bit and 8-bit precisions trained using the ADMM optimization of Section IV consistently outperform those of comparable bit-widths but built using the modified BP algorithm (LM 10 and 11 vs. LM 2 and 5 in Table III). In particular, for 1-bit quantization, the ADMM optimization method produced WER reductions up to 1.1% absolute on the callhm data of the Hub5'00 set over the traditional modified BP algorithm (LM 10 vs. LM 2 in Table III). The advantage of the ADMM algorithm in terms of convergence speed and training efficiency is further illustrated in left part of Figure 5. • The mixed precision quantized LSTM LMs (LM 12-25 in Table III) consistently outperform the uniform precision quantized models (LM 2-11). For example, given the same quantization precision at approximately 2-bit (compression ratio of 16 times over 32-bit full precision), a wide range of mixed precision quantized LMs (LM 13,17,20,22,24 in Table III) produced statistically significant 0.3-0.8% average WER reduction across three test data sets over with the comparable 2-bit uniform precision quantization baseline (LM 3). • Note that the first two of these mixed precision quantized LSTM LMs (LM 13, 17 in Table III) Table III), the KL quantized LM (LM 22) with a 1.9bit average precision gives the lowest average WER of 11.2%. These three mixed precision LMs' respective local selection of quantization bit-widths at different gates of various LSTM layers are shown in Figure 6(a)-6(c). Note that KL and curvature based quantization (LM 20, 22 in Table III) both selected 8-bit precision for the 2nd LSTM layer's output gate parameters, indicating a larger performance sensitivity to quantization measured at the LSTM cells' output gate. • Among all the quantized LSTM LMs marked with " * " in Table III that incur no statistically significant WER increase against the full precision baseline (LM 1), the 1.9-bit KL mixed precision quantized model (LM 22) also produced the largest "lossless" compression ratio of 15.6. 2) Experiments on Transformer LMs designed using a comparable set of contrasts previously used in Table III for LSTM-RNN LMs are shown in Table IV, where a large number of quantized Transformer LMs featuring different forms of mixed quantization schemes (LM 12 to 25 in Table IV, marked with " * ") produced lossless compression with no statistically significant WER changes relative to the baseline full precision model (LM 1). Several other trends that are similar to those found in Table III on LSTM-RNN LMs are summarized below:  TABLE IV  Performance of the baseline full precision (LM 1), uniform precision quantized (LM 2-11) and mixed precision quantized Transformer LMs with local layer or node level precision set either manually with equal bit-width (LM [12][13][14][15][16][17][18][19] or automatically learned (LM 20-25) using KL, curvature (Hes) or NAS based mixed precision quantization methods of Section V on SWBD NIST Hub5'00, RT02 and RT03. Equal weight interpolation of n-gram and neural LMs used in N-best restoring. All WER changes of no statistical significance (MAPSSWE, α = 0.05) over the full precision baseline (LM 1) are marked with " * ". Offline, post-training quantized LMs' performance are also shown (LM 6-9   Table III) and Transformer LMs (figure (b), showing LM 1,2,6 in Table IV) between baseline full precision models ((Baseline), binarized models trained using modified back-propagation (Bin-modBP) [31], [32] and ADMM trained binarized models (Bin-ADMM) on Switchboard validation data.
• Among the uniform precision quantized LMs, the Transformer LMs of 1-bit and 8-bit precision trained using ADMM optimization of Section IV marginally outperform, or are comparable in performance to those two of same precisions using the modified BP algorithm (LM 10 and 11 vs. LM 2 and 5 in Table IV). The advantage of the ADMM based Transformer LM estimation in terms of convergence speed and training efficiency is shown in right part of Figure 5.  Table IV) produced statistically significant 0.4% absolute WER reduction averaged across all data sets over with the comparable 2-bit uniform precision quantization LM (LM 3 in Table IV). • Among the three mixed precision quantized Transformer LMs with approximately 1.9-bit precision (LM 20, 22, 24 in Table IV), the KL and curvature based mixed precision quantized Transformer LMs (LM 22) with a 1.9bit average precision produced the lowest average WER of 10.9%, as well as the largest "lossless" compression ratio of 15.1 among all the quantized Transformer LMs marked with " * " in Table IV that incur no statistically  TABLE V  Performance of the baseline full precision (LM 1), uniform precision quantized (LM 2-7) and mixed precision quantized RNNLMs with local layer or node level precision set either manually with equal bit-width (LM [8][9][10][11][12][13][14][15] or automatically learned (LM 16-21) using KL, Hes or NAS based mixed precision quantization methods of Section V on AMI dev and eval sets of ihm, mdm8 and sdm1 conditions. Equal weight interpolation of n-gram and neural LMs used in N-best restoring. All WER changes of no statistical significance (MAPSSWE, α = 0.05) over the full precision baseline (LM 1) are marked with " * "  Table IV). Their respective local selection of quantization bit-widths at different sublayers within various Transformer layers are shown in Figure 6(e)-6(f), where an expected general trend is found that both the lower Transformer layers heavily tasked with denoising the data, and the top Transformer layer used to immediately predict detailed word probabilities over a large vocabulary, require longer quantization precision settings (2-bit to 8-bit) than those middle Transformer layers (1-bit to 4-bit). • It is also worth noting the 4-bit ADMM node level locally quantized Transformer LM (LM 14 in Table IV), and the 4-bit KL or curvature mixed precision quantized Transformer LM (LM 21, 23 in Table IV), both produced no WER degradation against the full precision model (LM 1), albeit with a smaller compression ratio of 7.0.

B. Experiments on AMI Meeting Room Data
The Augmented Multi-party Interaction (AMI) speech corpus consists of approximately 100 hours of audio data collected using both headset microphone and distant microphone arrays from the meeting environment. Following the Kaldi recipe 3 , three LF-MMI trained [78] acoustic models with speech perturbation based data augmentation and i-Vector based speaker adaptation [79] were then constructed. The AMI 8.9-hour dev and 8.7-hour eval sets recorded under close talking microphone (ihm), single distant microphone (sdm) and multiple distant microphones (mdm) were used. A 47K word recognition lexicon was used. Various LSTM and Transformer LMs based on the same configurations as those on the Switchboard data in Table III and IV were trained 3 egs/ami/s5c/local/chain/run tdnn.sh using a mixture of text sources of 15M words including Fisher transcripts and 3 times of AMI transcriptions before being used to rescore the 3-gram LM produced N-best lists (N = 20). All other experimental configurations remain the same as the Switchboard experiments of Section VI-A.
The mixed precision quantization experiments for RNNLMs and Transformer LMs on AMI meeting room data are shown in Table V and VI . The following trends similar to those previously found on the Switchboard data are again observed in Table V and VI for LSTM-RNN and Transformer LMs.
• The mixed precision quantized LSTM and Transformer LMs (LM 8-21 in Table V and Table VI) consistently outperform the uniform precision quantized models (LM 2-7 in Table V and Table VI). For example, given the same quantization precision at approximately 4-bit (compression ratio of 8 times over 32-bit full precision), a wide range of mixed precision quantized LMs (LM 10, 14, 17, 19, 21 in Table V and Table VI  VI Performance of the baseline full precision (LM 1), uniform precision quantized (LM 2-7) and mixed precision quantized Transformer LMs with local layer or node level precision set either manually with equal bit-width (LM [8][9][10][11][12][13][14][15] or automatically learned (LM 16-21) using KL, Hes or NAS based mixed precision quantization methods of Section V on AMI dev, eval sets of ihm, mdm8 and sdm1 conditions. Equal weight interpolation of n-gram and neural LMs used in N-best restoring. All WER changes of no statistical significance (MAPSSWE, α = 0.05) over the full precision baseline (LM 1) are marked with " * " VII. CONCLUSION This paper presents a set of novel mixed precision based neural network LM quantization techniques for LSTM-RNNs and Transformers. In order to account for the locally varying performance sensitivity to low-bit quantization, the optimal local precision settings are automatically learned by either minimizing the KL-divergence or log-likelihood curvature based performance sensitivity measures, or derived using mixed precision neural architecture search. Quantized LSTM-RNN and Transformer LM parameters are estimated efficiently using alternating direction methods of multipliers based optimization, to address the low convergence speed issue when directly applying gradient descent methods to estimate discrete quantized neural network parameters. Experimental results conducted on two state-of-the-art speech recognition tasks suggest the proposed mixed precision neural network LM quantization methods outperform traditional uniform precision based quantization approaches, and can produce "lossless" quantization and large model size compression ratios of up to around 16 times over the full precision LSTM-RNN and Transformer LM baselines while incurring no statistically significant recognition accuracy degradation.
All of the three automatic mixed precision configuration approaches proposed in this paper aim to minimize the performance sensitivity to quantization errors. To the best of our knowledge, they are the first research work to apply mixed precision quantization to neural language models for speech recognition tasks. For all the three approaches such performance sensitivity measure is related to the empirical training data log-likelihood degradation given a particular quantization precision bit-width setting relative to the full precision model. The precise manner with which such measure is computed differs among the three. This leads to the measures of information loss via KL-divergence, rate of log-likelihood degradation using curvature, and penalized log-likelihood based mixed precision architecture search approaches respectively. Experimental results obtained both the Switchboard and AMI tasks shown in Tables II to V on LSTM-RNN and Transformer LMs suggest the performance between the KL-divergence and log-likelihood curvature methods is consistently close. This is expected as both are measuring similar forms of log-likelihood based quantization loss, while an extra precision penalty term is introduced in the mixed precision NAS cost function. The larger performance difference between the mixed precision architecture search approach and the other two methods, for example, shown in Tables II and III, may be attributed to the use of Softmax function based architecture weights in the DARTS super-network. When similar architecture weights are obtained, the confusion over different candidate precision settings increases and search errors may occur.
Future research will focus on improving mixed precision quantization methods and their application to other neural network components of speech recognition systems and endto-end based neural architectures.