PERL: Pinyin Enhanced Rephrasing Language Model for Chinese ASR N-best Error Correction Junhong Liang Abstract ASR correction methods have predominantly focused on general datasets and have not effectively utilized Pinyin information, unique to the Chinese language. In this study, we address this gap by proposing a P inyin E nhanced R ephrasing L anguage Model (PERL), specifically designed for N-best correction scenarios. Additionally, we implement a length predictor module to address the variable-length problem. We conduct experiments on the Aishell-1 dataset and our newly proposed DoAD dataset. The results show that our approach outperforms baseline methods, achieving a 29.11% reduction in Character Error Rate (CER) on Aishell-1 and around 70% CER reduction on domain-specific datasets. Furthermore, our approach leverages Pinyin similarity at the token level, providing an advantage over baselines and leading to superior performance. keywords speech recognition, error correction † † address: 1 State Key Laboratory of Multimodal Artificial Intelligence Systems, Institute of Automation, CAS, Beijing, China 2 School of Artificial Intelligence, University of Chinese Academy of Sciences, Beijing, China † † email: liangjunhong2022@ia.ac.cn 1 Introduction Automatic Speech Recognition (ASR) technology has widespread applications, including voice interaction and searching. However, although the widely available End-to-End structure of ASR [ 1 ] , the effectiveness of ASR models is often influenced by various factors, such as the number of speakers, accents, and background noise, errors in ASR model outputs can negatively impact downstream tasks, highlighting the importance of employing post-correction modules to enhance the accuracy of ASR outputs. Pinyin is a Latin-based transcription system for Chinese characters, representing their pronunciation. Pinyin errors are prevalent in daily writing, not only among language learners [ 2 , 3 ] but also among native speakers [ 4 ] , making the integration of Pinyin information crucial for distinguishing characters with identical or similar pronunciations. Recent advancements in Chinese Spelling Correction (CSC) research indicate the potential of adapting text correction tools to address possible Chinese spelling errors in ASR and OCR outputs. Several methods have been proposed to effectively incorporate phonetic information, such as selectively integrating different embeddings of Chinese characters [ 5 ] , predicting Pinyin tokens [ 6 ] , and applying Pinyin integration methods in grammar error correction tasks [ 7 ] . Meanwhile, large language models (LLMs) have been widely utilized in various generative tasks, demonstrating robustness in CSC across different datasets [ 8 ] . However, the decoder-only structure of LLMs cannot maintain fixed output lengths and may introduce unwanted errors [ 9 ] . To address these limitations, methods such as training models at the character level to meet length and Pinyin constraints [ 10 ] or using LLMs as next-token predictors with length reward mechanisms [ 11 ] have been proposed. In this study, we leverage the advantages of the Encoder-Decoder model in the CSC task, incorporating a Pinyin encoder to address frequent Pinyin errors and extend its application to ASR N-best error correction tasks. Most ASR errors are phonetic [ 12 ] , and [ 13 ] highlights that the Pinyin error rate in ASR outputs is lower than the character error rate. Utilizing Pinyin information in ASR systems could also enhance the overall performance [ 14 ] . Previous methods use Pinyin tokens as a source to detect variable length errors [ 15 ] . Recent research advancements explore the potential of LLMs, leveraging their text understanding ability to assist in error correction in a generative style, combined with phonetic information in the pre-training process [ 16 ] or during the instructed fine-tuning [ 17 ] . Previous research has focused on variable-length error correction in generative tasks such as grammatical error correction, where autoregressive models are employed to address unequal-length corrections [ 18 , 19 ] . However, variable-length error correction in tasks like CSC and ASR correction encounter the “hard-constraint” problem, where most tokens in the input sequence remain unchanged [ 5 ] . In the field of OCR correction, several studies have identified issues related to token splitting in English [ 20 ] , Chinese [ 21 ] , and mixed English-Chinese texts [ 22 ] . Similarly, ASR outputs exhibit variable lengths, making error detection crucial. Prior research has proposed improved alignment algorithms for phonetically similar tokens, often incorporating duration predictors to estimate token lengths [ 23 , 24 ] . Additionally, some approaches have employed fine-tuned T5 models with constrained decoding spaces to manage output length [ 25 ] effectively. Furthermore, selection modules have been introduced to balance between the 1-best result and corrections generated by large language models (LLMs) [ 26 ] . Our research addresses the variable-length challenge using a pre-trained length predictor that leverages the extensive knowledge embedded in pre-trained language models, such as BERT, to determine the actual sequence length based on N-best inputs. Our contributions are as follows: 1. We construct the Do main N-best A SR D ataset (DoAD), which integrates original texts and ASR outputs, providing a robust dataset for research on variable-length ASR correction. 2. We propose a Pinyin Enhanced Rephrasing Language Model for N-best ASR Error Correction, pre-train a Pinyin encoder, and incorporate both Pinyin and semantic embeddings into a rephrasing language model. To optimize their integration, we utilize a feed-forward neural network to predict the weight of each embedding, thereby enhancing performance across diverse datasets. 3. We pre-train a length predictor that leverages the rich knowledge embedded in pre-trained language models and N-best results. This approach effectively mitigates the challenges of unequal lengths in variable-length error correction tasks. Figure 1: The structure of our proposed model 2 Method 2.1 Pretrain a Pinyin encoder A Pinyin encoder is designed to represent information about Pinyin. The Chinese pinyin system represents the Pinyin information and contains rich information about the language itself. Each input Chinese sentence will be translated to Chinese Pinyin using pypinyin 1 1 1 https://pypi.org/project/pypinyin/ . Suppose the character of sentence containing n characters is x=(x_{1},x_{2},...,x_{n}) and therefore the pinyin token for i_{th} character is p_{i,1},p_{i,2},...,p_{i,l_{i}} , where l_{i} represents the length of Pinyin of x_{i} . The Pinyin encoder contains four parts. • Pinyin Embedding: Each Pinyin token p_{i,j} will firstly be embedded into a vector \mathbf{p}_{i,j} . • Sequential Embedding: A Uni-directional GRU network captures the sequential embedding. Therefore the encoding of \mathbf{p}_{i,j} is \hat{\mathbf{p}}_{i,j}=\text{GRU}(\hat{\mathbf{p}}_{i,j-1},\mathbf{p}_{i,j}) . After that, only the last hidden state of the last Pinyin note of each sentence is extracted. Therefore, the Pinyin embedding after sequential embedding is \mathbf{P_{0}}=(\hat{\mathbf{p}}_{1,l_{1}},\hat{\mathbf{p}_{2,l_{2}}},...,\hat{\mathbf{p}}_{n,l_{n}}) . • Global Attention Embedding: Transformer layers will be employed to construct the global information, denote L_{p} as the number of transformer layers; therefore, \mathbf{P_{l}}=\text{Transformer}(\mathbf{P_{l-1}}),l\in[1,L_{p}] • Character Prediction: The embedding \mathbf{P}_{L_{p}} will then be used to predict the exact Chinese token of each position. \hat{y}_{i}=\text{Softmax}(\mathbf{W}^{p}\mathbf{p}_{L_{p},i}+\mathbf{b}^{p}),\mathbf{p}_{L,i}\in\mathbf{P}_{L} where \mathbf{W}^{p} and \mathbf{b}^{p} are learnable parameters. Then cross-entropy loss is employed to calculate Pinyin loss \mathcal{L}_{p} during pre-training. \mathcal{L}_{p}=-\frac{1}{n}\sum_{i=1}^{n}y_{i}\log(\hat{y}_{i}) where y_{i} is the ground truth of i_{th} token. 2.2 Pretrain a length predictor A length prediction module is necessary to tackle the variable length issue in ASR N-best Correction. First, we obtain the N-best sentences. Let these sentences be denoted as S_{1},S_{2},\dots,S_{n} , where n is the total number of sentences in the N-best list. These sentences are then concatenated using the delimiter | to form a single concatenated sentence, denoted as: S_{\text{concat}}=S_{1}\ |\ S_{2}\ |\ \dots\ |\ S_{n} . The label is the length of the gold truth sentence. Then we use a BERT model to obtain the semantic embedding \mathbf{E}_{s} of S_{\text{concat}} After that, a linear projector is applied to give the output length. \hat{l}=\text{MLP}(\mathbf{E}_{s}) . Similarly, a cross-entropy loss is applied in this process. 2.3 Pinyin Enhanced Rephrasing Language Model Our model can be divided into two stages: i) input processing and 2) encoding and predicting. Input processing We obtain the N-best sentences. Let these sentences be denoted as S_{1},S_{2},\dots,S_{n} , where n is the total number of sentences in the N-best list. These sentences are then concatenated using the delimiter | to form a single concatenated sentence, denoted as S_{\text{concat}}=S_{1}\ |\ S_{2}\ |\ \dots\ |\ S_{n} . The predicted length \hat{l} of the output sentence is obtained by the length prediction module mentioned in Section 2.2 After that dynamic masking strategy [ 27 ] is employed by randomly setting some tokens as [M] , obtaining S_{\text{masked}} Encoding and predicting The concatenated sentence is processed through Pinyin encoder \text{Enc}_{s} and semantic encoder \text{Enc}_{p} . \mathbf{E}_{s}=\text{Enc}_{s}(S_{\text{masked}}) and \mathbf{E}_{p}=\text{Enc}_{p}(S_{\text{masked}}) . We obtain the sentence embedding by averaging \mathbf{E}_{s} \bar{\mathbf{e}}_{s}=\frac{1}{l_{max}}\sum_{i=1}^{l_{max}}\mathbf{E}_{s}[i] (1) where l_{max} is the maximum length of the sentence and \mathbf{E}_{s}[i] is the i_{th} token embedding of the sentence, and the weight of semantic feature and Pinyin feature for each token is calculated by \displaystyle g_{s,i} \displaystyle=\text{MLP}_{s}(\mathbf{E}_{s}[i],\mathbf{E}_{p}[i],\bar{\mathbf{e}}_{s}) \displaystyle g_{p,i} \displaystyle=\text{MLP}_{p}(\mathbf{E}_{s}[i],\mathbf{E}_{p}[i],\bar{\mathbf{e}}_{s}) Where g_{s,i} and g_{p,i} are the weights of the semantic feature and Pinyin feature for the i_{th} token, respectively. Then, the fused embedding is obtained by \mathbf{E}_{f}=\mathbf{g}_{s}\odot\mathbf{E}_{s}+\mathbf{g}_{p}\odot\mathbf{E}_{p} Finally, the masked token is predicted using BERTForMaskedLM. Cross-entropy loss is applied in this process to obtain the final loss. Figure 1 shows an overview of our model. 3 Experimental Setup 3.1 Data In our experiments, we employ the ChineseHP Aishell-1 dataset [ 13 ] as well as our constructed Do main A SR D ataset (DoAD). We directly crafted the data using the process below. • Data Processing: We choose ECSpell data [ 28 ] , and then each gold truth sentence is segmented by punctuation marks. Then, each sentence is normalized to eliminate Arabic numbers and punctuation. Sentences with lengths smaller than three will be filtered out. • Text to Speech: We use the Microsoft Azure 2 2 2 https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/text-to-speech to convert the normalized sentence to speech, then randomly add a white noise to each audio from 10 dB to 20 dB. • ASR: A whisper ASR model [ 1 ] is applied to obtain N-best dataset. We perform ASR on the Chinese whisper model 3 3 3 https://huggingface.co/BELLE-2/Belle-distilwhisper-large-v2-zh . A final statistics of our data is shown in Table 1 , where #Sen refers to the number of sentences, while #Len denotes the average sentence length and #Equal denotes the number of sentences in which 1-best result has the same length with gold truth. Table 1: Datasets in the experiment Law Med Odw Aishell1 Train Test Train Test Train Test Train Test #Sen 4,040 1,010 10,978 1,820 5,137 1,480 120,099 7,176 #len 13.69 13.64 11.30 11.55 12.45 12.41 14.41 14.60 #Equal 2,469 263 5,878 1,032 2,502 696 113,039 6,699 3.2 Training Parameters The experiments are conducted on two NVIDIA 3090 GPUs. The Pinyin encoder is trained on Wang271k’s gold label dataset, of which 10,000 sentences are chosen as the validation set. The model is trained ten epochs with an initial learning rate 5\times 10^{-4} . The Aishell-1 and DoAD datasets are used to train the length predictor, starting with a learning rate 2\times 10^{-5} . Finally, for the PERL model, we follow the same training parameters shown in [ 27 ] . The mask rate is chosen to be 0.2, and the max length is 128. 3.3 Baselines To thoroughly investigate the ability of our proposed model, several LLMs and deep-neural network based models are chosen as baseline models. ReLM [ 27 ] , the basic Rephrasing Language Model, is trained by filling mask tokens to rephrase the sentence rather than iteratively detect the error for each token. GPT-4o 4 4 4 https://chatgpt.com/?model=gpt-4o , a generative language model developed by OpenAI, improved and optimized based on GPT-4 structure. DeepSeek-V2.5 5 5 5 http://www.deepseek.com/ , which proves excellent ability in coding and mathematical reasoning. Qwen 2.5 6 6 6 https://qwen2.org/qwen2-5 , pre-trained on large multi-lingual dataset. We follow the prompt given in [ 13 ] for generative models. 4 Results 4.1 N-best ASR Correction We utilize the ChineseHP [ 13 ] dataset for Aishell-1 and perform our own ASR on distil-whisper 7 7 7 https://huggingface.co/BELLE-2/Belle-distilwhisper-large-v2-zh . Table 2 shows the N-best ASR correction result, where CER represents the average character error rate, and CERR represents the percentage decrease in the average character error rate. o_{cp} represents the best character combination oracle and o_{nb} represents the best selection oracle. Under our experimental framework, the baseline model exhibited a relatively elevated CER across law, medical, and official document writing domains in our DoAD dataset compared to Aishell-1, presenting a distinct challenge to our proposed model. Empirical results demonstrate that the overall CER of the proposed PERL model was significantly reduced across all datasets, 29.11% on Aishell-1 and around 70% on DoAD. Notably, it achieved superior performance compared to the oracle Chinese character selection. This improvement can be attributed to the PERL model’s capacity to explore potential token candidates within a broader semantic space by leveraging contextual dependencies. At the same time, incorporating Pinyin features enhances the model’s ability to prioritize characters with similarities in Pinyin. In contrast, generative language models demonstrate comparatively lower performance, which we posit is attributable to the inherent limitations of current generative models in effectively addressing tasks constrained by rigid structural requirements. Table 2: Our model’s performance on the post-correction dataset after different speech recognition methods. The best results are highlighted in bold . Method CER% \downarrow -CERR%↓ Aishell1 Law Med Odw Baseline (1-best) 5.84 12.64 16.09 15.94 O_{cp} 2.93 -49.83 3.83 -69.70 6.13 -61.90 4.41 -73.59 O_{nb} 3.49 -32.70 9.44 -25.31 12.66 -28.37 11.89 -28.80 ReLM 5.20 -10.96 5.21 -58.78 6.91 -57.05 6.17 -61.23 GPT-4o 4.41 -24.49 9.83 -22.23 13.27 -17.53 12.40 -22.20 DeepSeek-V2.5 4.25 -27.22 9.12 -27.85 12.61 -21.63 11.68 -26.72 Qwen2.5 4.22 -27.74 8.28 -34.49 12.16 -24.43 11.15 -30.05 PERL 4.10 -29.11 3.41 -73.02 3.91 -75.70 4.87 -69.44 4.2 Pinyin Similarity To assess the importance of the Pinyin encoder in our model, we evaluate the embedding similarity of tokens with similar pronunciations, as shown in Figure 2 . Using embeddings from BERT and our pre-trained Pinyin encoder (Section 2.1 ), we compare pairs of characters whose Pinyin (including tones) have an edit distance of less than 2. The Pinyin encoder achieves an average similarity score of 0.77, significantly higher than BERT’s 0.42. This improvement stems from the Pinyin encoder’s use of pinyin tokens for each character, effectively grouping characters with similar pronunciations into the same phonetic space. 4.3 ASR Model Selection To assess the robustness of our model across different ASR systems, we evaluate it on Belle-distilwhisper-large-v2-zh, as detailed in Section 3.1 , as well as on whisper-small 8 8 8 https://huggingface.co/openai/whisper-small and whisper-large-v3 9 9 9 https://huggingface.co/openai/whisper-large-v3 . Specifically, we measure the CER of the PERL model on these systems. The results in Table 3 demonstrate that the PERL model substantially reduces CER compared to the 1-best baselines, highlighting its strong robustness across diverse ASR models. Table 3: CER of whisper models across different domains. Model Domain Baseline PERL o_{nb} o_{cp} whisper-large-v3 law 15.81 5.65 9.24 7.67 med 15.86 7.20 10.37 9.15 odw 14.75 7.61 9.09 8.04 whisper-small law 26.76 10.77 18.01 14.72 med 29.69 13.22 20.82 17.81 odw 30.02 12.82 19.93 16.51 4.4 Length Prediction To assess the significance of the length prediction module’s significance, we evaluate our model’s length correction performance, as shown in Table 4 . The pre-trained length predictor demonstrates improved accuracy in predicting the correct length compared to relying solely on the 1-best result. This enhancement enables the model to determine the masked tokens, improving overall prediction precision more accurately. Table 4: The effect of the length correction on different whisper models. Model Method #Equal Law Med Odw whisper-large-v3 1-best 910 1,641 1,393 length predict 954 1,685 1,410 whisper-small 1-best 853 1,551 1,289 length predict 913 1,650 1,310 4.5 Ablation Experiments We evaluate our PERL model on the Aishell-1 and DoAD datasets under different ablation settings as shown in Table 5 : (1) removing the length predictor and using only the length of the 1-best prediction, (2) removing the Pinyin encoder, and (3) using only the 1-best prediction during correction. Our findings show that removing the Pinyin encoder or relying solely on the N-best results significantly degrades performance. Furthermore, removing the length predictor during correction results in even more significant performance degradation, as the language model needs to rephrase the sentence into shorter or longer sequences. Table 5: Ablation of PERL model on Aishell-1 and DoAD datasets with different settings. Method Aishell-1 Law Med Odw PERL 4.10 3.41 3.91 4.87 - w/o len 7.28 5.08 5.47 7.12 - w/o pho 4.78 4.27 4.67 5.83 - w/o N-best 4.31 3.69 4.62 5.15 Figure 2: Cosine similarity between the embedding of similar Pinyin chars 4.6 Case Study ASR N-best Correct is shown in Table 6 , PERL could calculate the correct length and incorporate Pinyin knowledge to recover the wrong token 松 into 宗 since they share similar Pinyin. At the same time, the ReLM model failed by correcting this into 块 since it cannot leverage Pinyin information, and the 1-best result was unable to provide potential corrections when compared to N-best results. Table 6: Example of ASR N-best correction for different models, where we use red / blue / orange colors to represent wrong / correct / wrong edit tokens, best viewed in color. Sentences Model Outputs 目前挂牌的只有几 松 土地 目前挂 排 的只有几 松 土地 目前挂牌的只有几 松 土 目前挂牌的只有几 宋 土地 目前挂牌的只有几 宗 土地 目前挂牌的只有几 宗 土地 (PERL) 目前挂牌的只有几 松 土地 (PERL 1-best) 目前挂牌的只有几 块 土地 (ReLM) 目前挂牌的只有几 宗 土地 (GPT-4o) 目前挂牌的只有几 宗 土地 (Gold) Translation: Currently, only a few plots of land are listed for sale. 5 Discussion & Conclusion This paper proposes a Pinyin-enhanced rephrasing language model to address the N-best ASR error correction problem. Our method effectively mitigates the impact of Pinyin errors seen in previous approaches. Additionally, we introduce a length prediction module to handle length inconsistencies in error correction datasets. We also created a domain-specific ASR dataset to extend research in this area. Extensive experiments demonstrate the efficiency of our proposed modules. Notably, this work shows that N-best ASR errors can be corrected using text-based correction methods, bridging different research domains. Future work could explore a more profound integration of Pinyin information into the model.