{'fraction_non_alphanumeric': 0.034028892455858745, 'fraction_numerical': 0.014354505847282734, 'mean_word_length': 4.649222797927461, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Cascade RNN-Transducer: Syllable Based Streaming On-device Mandarin Speech Recognition with a Syllable-to-Character Converter

End-to-end models are favored in automatic speech recognition (ASR) because of its simplified system structure and superior performance. Among these models, recurrent neural network transducer (RNN-T) has achieved significant progress in streaming on-device speech recognition because of its high-accuracy and low-latency. RNN-T adopts a prediction network to enhance language information, but its language modeling ability is limited because it still needs paired speech-text data to train. Further strengthening the language modeling ability through extra text data, such as shallow fusion with an external language model, only brings a small performance gain. In view of the fact that Mandarin Chinese is a character-based language and each character is pronounced as a tonal syllable, this paper proposes a novel cascade RNN-T approach to improve the language modeling ability of RNN-T. Our approach firstly uses an RNN-T to transform acoustic feature into syllable sequence, and then converts the syllable sequence into character sequence through an RNN-T-based syllable-to-character converter. Thus a rich text repository can be easily used to strengthen the language model ability. By introducing several important tricks, the cascade RNN-T approach surpasses the character-based RNN-T by a large margin on several Mandarin test sets, with much higher recognition quality and similar latency.


INTRODUCTION
Conventional automatic speech recognition (ASR) usually adopts a hybrid system of deep neural network -hidden Markov model (DNN-HMM) [1] which is complex and requires a considerable amount of computing resource, so it is difficult to deploy on edge devices. Recently, end-to-end (E2E) speech recognition has achieved significant progress with simplified system architecture and superior performance. The E2E models usually adopt a sequence-to-sequence (S2S) framework to directly transform acoustic feature sequences into text sequences through specifically-designed neural networks. These models are particularly favored on edge devices for more concise architecture and reduced computing resource consumption over the hybrid ASR systems. However, the E2E speech recognition models, modeling acoustic and language information jointly in a unified framework, usually require a large amount of paired speech-text data for model training. Thus it is difficult for the models themselves to acquire strong language modeling ability by using available text data with more orders of magnitude than the speech-text paired data, especially when the training set does not match the language domain of specific applications. This paper addresses this problem by introducing a novel approach to improve the language modeling ability of E2E models.
As an S2S model, recurrent neural network transducer (RNN-T) [2] and its variants have achieved high-accuracy and low-latency in streaming on-device speech recognition [3,4]. Neural transducer has the streaming decoding ability in nature, while other E2E competitors, particularly those based on attention mechanism, such as transformer [5,6,7] and listen, attend and spell [8] (LAS), have to be modified to possess the streaming ability. RNN-T uses a prediction network to enhance the language information based on the connectionist temporal classification (CTC) [9] criterion. But its language modeling ability is not satisfactory because it still needs paired speech-text data to train. A recent study has unveiled that the language modeling ability of the prediction network is still quite weak [10].
Plenty of effort has been made on improving the performance of E2E models by introducing additional language information. A common solution is to use a language model (LM) fusion strategy: an LM is first externally trained on text data and then incorporated into the E2E model [11,12]. Shallow fusion simply interpolates the label probabilities with the ones from an external LM during decoding stage. Other fusion variants, such as deep fusion, cold fusion and component fusion, have also been proposed. Data augmentation through speech synthesis is another solution. Work in [13,14] has shown that data augmentation with text-to-speech utterances yields improvement to E2E models; however, there still remains a substantial gap in performance between mod-els trained on human speech and those trained on synthesized speech. Similar to the tricks used in conventional hybrid approaches, two-pass decoding also can be introduced to E2E models with improved recognition performance. Recently, a two-pass RNN-T+LAS model, where LAS rescores hypotheses from RNN-T, has been proposed [15] and improved further with more tricks [16]. To surpass server-side conventional model, trade-off between quality and latency has been particularly considered.
Most approaches on neural transducer have been conducted on English corpora and different modeling units, such as phonemes, grapheme and word-piece, have been explored [17]. In this paper, we are particularly interested in streaming on-device Mandarin ASR using RNN-T. Mandarin Chinese is significantly different from English in both written and spoken aspects. Chinese is a character-based language and each character is pronounced as a tonal syllable. There are several studies on LAS and Transformer based Mandarin ASR, but we only find one paper on the use of RNN-T in Mandarin which shows its feasibility on modeling Chinese characters [18]. Character has been widely chosen as a natural modeling unit in Transformer-based Mandarin ASR as well. However, as Chinese has a huge set of characters, all these works have chosen a partial set of frequently-used characters to model while the rest are simply abandoned, which means the abandoned characters can never be outputted, leading to out-of-vocabulary (OOV) problem.
In this paper, we propose a novel cascade RNN-T approach for streaming on-device Mandarin speech recognition. Specifically, we cascade two RNN transducers to strengthen the language modeling ability -the first transforms acoustic input into a syllable sequence, while the second converts the syllable sequence into the final character sequence. The proposed approach has the following advantages: 1) a rich text repository can be easily used to strengthen the language modeling ability; 2) the OOV issue does not exist by the introduction of RNN-T based syllable-to-character (S2C) converter; 3) streaming ability has been maintained as the use of the transducer framework. By introducing several important tricks on the proposed syllable-based cascade RNN-T, including adding convolution layer, self shallow fusion, text augmentation and syllable correction, we manage to surpass the character-based RNN-T by a large margin. Compared with character RNN-T with shallow fusion, cascade RNN-T has an obvious improvement on several Mandarin test sets, with higher recognition quality and similar latency.

RNN-TRANSDUCER
Our proposed approach is based on a modified version of oracle RNN-T [2]. Here we first introduce the RNN-T structure as well as the typical shallow fusion strategy to strengthen the language modeling ability.

Model architecture
RNN-T has the ability to model the alignment between speech features x = [x 1 , x 2 , · · · , x T ] and output label sequences y = [y 1 , y 2 , · · · , y U ], where T is the number of feature frames and U is the length of the output label sequence. Fig. 1 shows the RNN-T structure used in this paper, which mainly includes an encoder, a predict network and a joint network. Specifically, the encoder converts the speech features into a high-dimensional representation h enc . Different from the oracle RNN-T [2], we add M 1 layers of 1-D convolution with a stride size greater than 1 for down-sampling. This operation will effectively reduce the resource consumption during the training process and decoding stage. In addition, the M 2 layers of dilated 1-D convolution followed can capture local context information more effectively at a small cost of a short latency. The whole process can be expressed as The main purpose of prediction network is to generate a higher-dimensional representation h pred u of last label y u−1 as shown in Eq. (2). In order to avoid the sparsity caused by directly using one-hot label as input, an embedding layer is arranged before N layers of LSTM.
The joint network is represented by several fully connected layers, and finally a softmax layer is used to predict the probability P (k|t, u) of the next label, as shown in where U and V is the projection matrix to combine h enc t and h pred u , and W joint is used to project network's output to the number of labels. During training, RNN-T uses the forwardbackward algorithm [4] to maximize the posterior of y given x.

Shallow fusion
Shallow fusion [12] adopts an RNNLM that can be trained using additional text data to improve the language modeling ability. The method is done by adding up the non-blank posterior probability of RNN-T and RNNLM in the logarithmic domain during the decoding process. As shown in Eq. (5), P (y|x) is the actual posterior probability used in the decoding process, log P (y|x) is the posterior probability of y given x, and log P (y) is the probability of y generated by RNNLM.
When using shallow fusion, beam search can be adopted to ensure that as many decoding paths as possible are considered.

Cascade model architecture
We propose a cascade RNN-T structure shown in Fig. 2. Formally in Eq. (6), the speech features x = [x 1 , x 2 , · · · , x T ] first go through a syllable-level RNN-T, to obtain the syllable sequence y s = [y s 1 , y s 2 , · · · , y s U s ], where U s is the length of the output syllable sequence.
Then we use an S2C converter to convert the syllable sequence y s into the character sequence y: During the training process, only the syllable-level RNN-T model in the first step needs data paired with speech and text, while the S2C converter in the second step can be trained only with text data. This is realized by another RNN-T.

RNN-T based S2C Converter
As shown in Fig. 3, the encoder input for the RNN-T based S2C converter is syllable sequence y s while the input for the prediction network is character sequence y. The output of joint network is the posterior distribution probability of the next character. Here we use an embedding layer to map onehot input to high-dimensional representations in both encoder and prediction networks, and RNN-T loss is used in the training process as well.  Fig. 3. RNN-T based syllable to character converter.

Convolution layer
For a single LSTM layer, the network can only intuitively obtain the information of current token in each time step. In order to capture more context information, we add a convolution layer before the encoder, as described in and h enc = Encoder(h conv ).
During training, in order to ensure the equal length of the input and the output of encoder, assuming that the kernel size of the convolution layer is M s , M s − 1 zeros are padded at the start the syllable sequence.

Self shallow fusion
When using RNN-T as an S2C converter, a large amount of text data can be adopted to train the model. Hence we add a fully-connected layer after the prediction network to give the prediction network an additional task functioning as RNNLM and perform shallow fusion P (y|y s ) = log P (y|y s ) + λ log FC(h pred ).
We call this trick as self shallow fusion. During the training process, we define the loss function aŝ where L RN N −T is the loss of RNN-T and L ce is the loss of additional RNNLM task. The language modeling ability is implicitly embedded in the S2C RNN-T. But it still makes sense to use an additional task to explicitly do language modeling. The above multi-task training method can apparently reduce model parameters as well as computation as we do not need another RNNLM for shallow fusion -this is why we call this trick as self shallow fusion.

Text augmentation
In order to prevent over-fitting, we adopt a text augmentation strategy, which is similar to SpecAugment [19] that is done to audio spectrum. Specifically, during training of S2C RNN-T, we randomly change several syllables in the syllable sequence to some other syllables as the input of the encoder. Alleviating over-fitting, this method can also be regarded as simulation on syllable errors caused by the first syllable-level RNN-T.

Syllable correction
The output of syllable-level RNN-T has insertion, deletion and replacement errors. This means that the input of S2C RNN-T inevitably has errors. So the S2C RNN-T desires the ability to convert the erroneous syllable sequence into character sequence that is grammatically and semantically correct. Inspired by recently studies [20,21], we use a syllable correction strategy to map the 'noisy' syllable sequence to correct character sequence. Because RNN-T has the ability to map unequal length sequences in nature, we first decode the training set using the syllable-level RNN-T to syllable sequences. Then we use these syllable sequences with their corresponding correct character sequences to build additional correction text and mix these data with normal text data. At last, we use the mixed data to finetune an existing S2C RNN-T to improve the performance of the model.

Dataset
In this paper, we evaluated the proposed cascade RNN-T approach on two Mandarin speech recognition tasks: pub-lic AISHELL-2 corpus [22] and internal 7,500 hours corpus. The AISHELL-2 corpus contains 1,000 hours of clean reading speech data collected from 1991 speakers 1 . The 7500-hour corpus contains reading speech data in fields such as entertainment, journalism, literature, technology and free conversation and so on. For both datasets, we reserve 5,000 sentences as development set. In addition, we use 2GB Chinese text data crawled from internet to train the RNNLM and the S2C converter. Character error rate (CER) is reported for AISHELL-1 test set (TA1) [23], AISHELL-2 test set (TA2) [22], an internal voice input test set (VI) and a voice assistant (VA) test set. The VI test set consists of about 3.4 hours data with 3,063 sentences covering many proper nouns and named entities, which is used to verify the language generalization ability of the speech recognition model. The VA test set consists of about 3.9 hours data with 5,000 speech commands to a voice assistant, which is challenging not only in language aspect, but also acoustically because speech is collected at various conditions some with low SNR.

Experimental Setup
For all experiments, the speech features are 71-dimensional log Mel-filterbank (FBank) computed on 25ms window with 10ms shift. We also applied SpecAugment [19] for acoustic data augmentation. For modeling units, we choose 5,139 characters for character-based models and 1,733 tonal syllables for syllable-based models. All experiments are conducted using TensorFlow [24] and Horovod [25]. During training process, we use random state passing (RSP) to avoid long-form problem [26]. We adopt AdamOptimizer [27] with learning rate at 0.0003 and gradient clipping at 5.0 for all models. Moreover, we employ layer normalization and variational recurrent dropout to prevent over-fitting. We use breadth-first beam search algorithm which is effective in exploring and combining alternative alignments [28].
For the character RNN-T, the encoder network consists of 6 convolution layers and 5 LSTM layers while all convolution layers' kernel size is 3 and stride for each layer is {2, 2, 1, 1, 1}, while the number of filters is set to {256, 256, 512, 512, 512} and dilation rate is {1, 1, 1, 2, 4}. The prediction network has 2 LSTM layers and the joint network has 640 hidden units. For the cascade RNN-T, the first syllable-level RNN-T has the same architecture as the character RNN-T just mentioned. And for the second RNN-T for S2C conversion, the encoder network consists of 2 LSTM layers, the prediction network has a single LSTM layer and the joint network has 640 hidden units. The additional convolution layer has 1,024 filters and the kernel size is 3. All the LSTM layers mentioned above have 1,280 hidden units followed by a 640-dimensional projection layer. The RNNLM for shallow fusion in the character RNN-T approach consists of 2 LSTM layers each has 2,048 hidden units with a 640-dimensional projection layer.

AISHELL-2 Task
To verify our proposed cascade RNN-T, we first evaluate on the open AISHELL-2 corpus. As shown in Tab. 1, we obtain a small performance improvement from using beam search (B1) and shallow fusion (B2) for character-level RNN-T compared with B0 when the hyper-parameter λ for shallow fusion is set to 0.35 and beam size is 5. For cascade RNN-T, during decoding process, we use greedy search for syllable-level RNN-T and beam search with beam size is 5 for S2C RNN-T. The performance of the cascade RNN-T (E0) is worse than character-level RNN-T. But we notice that the syllable error rate on TA2 for the syllable-level RNN-T in the cascade approach (E0) is 12.8%, which is significantly lower than the CER of character RNN-T (B0) on the same test set. This phenomenon unveils that the syllable accuracy of the syllablelevel RNN-T is higher than that of character-level RNN-T, so we believe that the second S2C RNN-T in the proposed cascade architecture holds great potential to be further strengthened to bring much better character error rate. We further improve the S2C RNN-T followed the tricks introduced in Section 3.2, and the results are shown in Tab. 2. From the comparison between E1 and E0, it can be concluded that when the S2C RNN-T captures more context information through the convolution layer, the performance of cascade RNN-T can be significantly improved. For example, the CER on TA1 has been dramatically decreased from 17.4% to 6.66%. From E2 and E3, suppressing the overfitting of the model using text augmentation and explicitly introducing language information using self shallow fusion can also play a positive role. We use the decode result of syllable-level RNN-T on training set to generate correction text, and then finetune the model in E3 with the learning rate of 1e-4 while the normal text data is 7 times larger than correction text data in each batch. And finally, syllable correction (E4) can bring further performance gain and we manage to surpass the characterbased RNN-T (B2) on all testing sets. Specifically on the challenging VI test set, we can achieve 12.65% relative CER reduction. Tab. 3 gives a detailed illustration the changes of deletion, insertion and substitute errors for the proposed tricks on TA2. From E0 to E4, we can see that all kinds of tricks we use can effectively reduce the substitute errors. At the same time, it also confirms that our proposed cascade RNN-T can greatly improve the language modeling ability of the model because substitute errors often represent grammatical errors.

7500-hour Task
We further evaluate the proposed approach on our internal large-scale 7500-hour corpus and use the same experimental setup and hyper-parameters used in AISHELL-2 Task. This time we add another more difficult test set VA that is collected at challenging acoustic conditions. As shown in Tab. 4, we first notice that with the increase of training data, there is a big CER reduction, especially on TA2 and VI test sets, as compared with the AISHELL-2 1000-hour results in Tab. 2. Comparing E9 with B5, our proposed cascade RNN-T can better enhance the language modeling ability of RNN-T than the character RNN-T with shallow fusion. Note that they both use the same 2GB text data for strengthening language modeling. In addition, on the challenging VA test set, cascade RNN-T has a large improvement over character-level RNN-T, with 14.18% relative CER reduction. These results can prove that our proposed method can significantly improve the language modeling ability. In order to determine the advantage of using RNN-T as the S2C converter, we also try LSTM and BLSTM as the S2C converter which contains 2 LSTM or BLSTM layers with 2,048 hidden units followed by a 640dimensional projection layer. From A0 and A1, we can observe that RNN-T based S2C converter has obvious advan-tages over LSTM which is also a streaming structure. The performance of RNN-T based S2C converter also surpasses the BLSTM-based one which is non-streaming and uses both past and future context.

Parameters, Latency and Quality
Tab. 5 summarizes several typical models in terms of the number of parameters, recognition latency and quality. Comparing E4 with B2, we can see that the proposed cascade RNN-T achieves superior performance over the character-based RNN with similar levels of model parameters and recognition latency.

CONCLUSIONS
In this paper, we propose a novel cascade RNN-T approach to improve the language modeling ability of RNN-T. Cascade RNN-T aims to train the language model separately from the acoustic model in order to introduce a large amount of additional text to strengthen the language modeling ability. Specifically, we first use an RNN-T to transform acoustic feature into syllable sequence, and then convert the syllable sequence into character sequence by another RNN-T. By introducing several important tricks, including spanning context through convolution layer, self shallow fusion, text augmentation and syllable correction, our approach manages to surpass character-based RNN-T with a large margin on several Mandarin test sets. As our second RNN-T is an unequal mapping from pronunciation units to graphemes, we plan to try smaller units, e.g., phoneme to grapheme, particularly in English ASR in the future.