CopyNE: Better Contextual ASR by Copying Named Entities (2024)

Abstract: End-to-end automatic speech recognition (ASR) systems have made significant progress in general scenarios. However, it remains challenging to transcribe contextual named entities (NEs) in the contextual ASR scenario. Previous approaches have attempted to address this by utilizing the NE dictionary. These approaches treat entities as individual tokens and generate them token-by-token, which may result in incomplete transcriptions of entities. In this paper, we treat entities as indivisible wholes and introduce the idea of copying into ASR. We design a systematic mechanism called CopyNE, which can copy entities from the NE dictionary. By copying all tokens of an entity at once, we can reduce errors during entity transcription, ensuring the completeness of the entity. Experiments demonstrate that CopyNE consistently improves the accuracy of transcribing entities compared to previous approaches. Even when based on the strong Whisper, CopyNE still achieves notable improvements.

heading: 1 Introduction
text: End-to-end automatic speech recognition (ASR) systems have achieved impressive performance in general scenarios (Chan et al., 2016; Rao et al., 2017; Gulati et al., 2020; Boulianne, 2022). However, in the contextual ASR scenario where speech often contains numerous contextual entities, it remains a challenge for ASR systems to get accurate transcriptions (Alon et al., 2019; Jayanthi et al., 2023). For instance, when utilizing personal voice assistants like Siri or Alexa, it is common to encounter contextual entities such as personal names, place names, and organization names. ASR models trained solely on speech-text data often struggle to transcribe these personalized entities due to their infrequent occurrence in the training set (Sathyendra et al., 2022). Since contextual entities always cover
∗ Corresponding author
a wealth of semantic information. It is important to improve the accuracy of transcribing entities for downstream natural language processing tasks such as information retrieval and spoken language understanding (Ganesan et al., 2021; Wu et al., 2022).
Recently, researchers have started leveraging the information of textual modality as additional contextual knowledge to help contextual ASR. The most typical approach, premised on the assumption that entities are already known before, use a contextual named entity (NE) dictionary as contextual knowledge (Chen et al., 2019; Jain et al., 2020; Han et al., 2021; Huber et al., 2021; Fu et al., 2023). Two representative approaches are “contextual listen, attend and spell” (CLAS) (Pundak et al., 2018) and contextual bias attention (CBA) (Zhang and Zhou, 2022). CLAS employs the knowledge of the dictionary to aid the prediction of each token. They use dictionary representation as extra inputs for token prediction in the decoder. The decoder attends to each entity, and the dictionary representation is an aggregated representation of all entities, weighted by the attention scores. CBA extends CLAS and uses an extra training loss. The loss explicitly makes use of the attention scores and force the model attend to a proper entity in the
2675
dictionary if the token to be predicted is related with the entity.
Previous methods have achieved considerable improvements, especially in transcribing entities. However, they all treat entities as individual tokens. These models utilize contextual knowledge to aid in predicting independent tokens without considering the role of these tokens in constituting a complete entity. In other words, a multi-token entity is broken into isolated tokens during decoding. We argue that this is problematic. For instance, model may erroneously generate the subsequent tokens of an entity, despite correctly producing the preceding tokens. As shown in Figure 1, when transcribing the speech “他来自安徽铜陵” (He comes from Anhui Tongling), an incorrect output of “他来自安徽铜 铃” (He comes from Anhui copper bell) is obtained. Despite the model’s awareness of the location entity “铜陵” in the NE dictionary and its accurate prediction of the first token “铜”, it mistakenly transcribes “陵” (ling) as “铃” (bell) during the tokenlevel prediction process. This occurs because the model predicts tokens independently, neglecting the integrity of the token span as a complete entity. Furthermore, “陵” and “铃” share the same pronunciation “líng”, with “铃” being a more frequently occurring token in the training data. Consequently, the model tends to generate the wrong token “铃”.
In this paper, we propose a new approach for contextual ASR called CopyNE. Unlike previous approaches, we view entities as indivisible wholes. To the best of our knowledge, we are the first to introduce the idea of copying into ASR. We design a systematic and effective mechanism to copy entities from a dictionary. Specifically, CopyNE uses a copy loss that guides the model to copy the correct entity from the dictionary. During inference, our CopyNE has the flexibility to either predict a token from the token vocabulary or copy an entity from the NE dictionary at each decoding step. By copying multiple tokens simultaneously, we can alleviate errors within the entity, thus ensuring the token span as a complete entity.
Experiments on Chinese Aishell (Bu et al., 2017), ST-cmds1, and English Eng (Yadav et al., 2020) datasets show that our CopyNE achieves significant improvements across all scenarios, particularly in the contextual ASR scenario. Compared to previous methods using dictionary, CopyNE achieves relative reductions in CER of 13.5% and
1https://www.openslr.org/38/
20.8% on Aishell and ST-cmds in the contextual scenario. Notably, CopyNE shows more remarkable improvements when it comes to transcribing entities, with relative reductions of 55.4% and 53.9% in the NE-CER metric on Aishell and STcmds. Moreover, when based on Whisper (Radford et al., 2022) and evaluated in its domain of expertise, Eng dataset, CopyNE still achieves an impressive 6.4% and 16.8% relative reductions in WER and NE-WER. We will release our codes, configurations, and models at https://github. com/zsLin177/CopyNE.

heading: 2 The CTC-Transformer Model
text: In this work, we build our proposed approach on the end-to-end CTC-Transformer model, since it is the most widely used and achieves competitive performance in the ASR field (Hori et al., 2017; Kim et al., 2017; Miao et al., 2020; Omachi et al., 2021; Gong et al., 2022). However, it is worth noting that our idea can be applied to other ASR approaches as well.
The CTC-Transformer is built upon the seq-toseq Transformer (Vaswani et al., 2017), with a connectionist temporal classification (CTC) layer added after the audio encoder. As shown in Figure 2, it takes a sequence of acoustic frames X = (x1, ...,xT ) as input and generates the corresponding transcription text y = (y1, ..., yU ) as output. The model consists of two main components: an encoder and a decoder. First, the encoder encodes the acoustic frames X into hidden states H = (h1, ...,hT ). Then, the decoder predicts the target sequence y in an auto-regressive manner. At each decoding step u, the decoder predicts the next target token yu+1 based on the encoder’s output H and the previously predicted tokens y≤u = (y1, ..., yu). This process is expressed as follows:
H = AudioEncoder(X) (1)
du = Decoder(y≤u,H) (2)
P (yu+1|y≤u) = softmax(Wdu + b) (3)
Here, du ∈ Rd denotes the hidden state at step u, and P (yu+1|y≤u) is the posterior distribution of predicting token yu+1. W ∈ R|V|×d and b ∈ R|V| are learned parameters, where V is the token vocabulary, and |V| is the size of the vocabulary.
The loss of Transformer, Ltrans(y), comes from minimizing the negative log probability of y.
Ltrans(y) = − U−1∑
u=0
logP (yu+1|y≤u) (4)
As commonly used in previous works, the CTC loss is also applied here. CTC aligns each acoustic frame with a token from left to right. For a given target sequence y, there may be multiple valid alignments. The CTC loss is derived from maximizing the sum of these valid alignments, and has been proved to be able to enhance the representational capacity of the audio encoder (Kim et al., 2017). Finally, the overall loss is the a weighted sum of the Ltrans(y) and Lctc(y), as follows:
L(y) = λLtrans(y) + (1− λ)Lctc(y) (5)
where λ is a hyper-parameter that determines the relative weight of each loss term.
In inference, the model selects the most probable transcription using beam search as follows:
ŷ = argmax y
( ∑
u
logP (yu+1|y≤u)) (6)
Here, there are many ways to use scores in decoding, such as combining CTC scores and Transformer scores as in training, or using CTC-prefix beam search followed by re-scoring with Transformer to select the optimal result. To compare with most previous works, we use the simplest decoding strategy, as shown in Equation 6.

heading: 3 Our CopyNE Model
text: This section describes our proposed CopyNE model. The basic idea is that the model incorporates a contextual NE dictionary as external knowledge and can choose to directly copy NEs from the dictionary. We design a systematic framework
to implement the idea. During training, a copy loss is designed to encourage the model to copy corresponding entities from the dictionary. During inference, at each generation step, the model can either predict a single token from token vocabulary or directly copy a entity from the given dictionary.

heading: 3.1 The Model Framework
text: Figure 3 illustrates the framework of our CopyNE model, which shares the same encoder as the CTCTransformer model, but with a distinct decoder. In the decoder, we introduce an extra NE encoder that takes the NE dictionary as input and encodes it into NE representations. Then, we use a dot-product attention module to compute copy probabilities based on the obtained NE representations, which are then aggregated to form the overall dictionary (Dict) representation. The decoder can not only utilize copy probabilities to select entities for copying but also leverage the Dict representation to aid in predicting the next token.
NE Representation. We denote an NE dictionary as E = (e0, e1, ..., eN ). We use e0 = ∅ as a pseudo entity to handle the case where the text to be transcribed has no relation to any entity and the model should not copy any entity at current step.
For each entity ei, we apply a multi-layer LSTM as the NE encoder to encode the token sequence and use the last hidden state of the NE encoder as the entity representation. It is a popular practice in previous contextual ASR works (Pundak et al., 2018; Zhang and Zhou, 2022).
zi = LSTM(ei) (7)
After that, we get entity representations Z = (z0, z1, ...,zN ), where Z ∈ RN×d. Copy Probability. Once the NE representations are obtained, the copy probability is computed by a dot-product attention mechanism. It is used to
determine which entity to copy. First, we compute the attention score aeiu for entity ei at step u as follows:
aeiu = (Wqdu) ⊤(Wkzi)√ d
(8)
where Wq,Wk ∈ Rda×d are two learned parameters. da denotes the dimension of the attention. After that we obtain the attention probability Pc(ei|y≤u) for entity ei by softmax.
Pc(ei|y≤u) = exp(aeiu )∑
ej∈E exp(a ej u )
(9)
Here, Pc(ei|y≤u) not only represents the attention probability of ei but also naturally serves as the copy probability for the entity. During inference, we use the copy probabilities to select the entities for copying.
Dict Representation. With copy (attention) probabilities, we can obtain the Dict representation ru at decoding step u. It is used to help the prediction of subsequent tokens. Specifically, ru ∈ Rd is computed by weighted summing the entity representations with the copy (attention) probabilities.
ru = ∑
ei∈E Pc(ei|y≤u)zi (10)
Dict-enhanced Prediction. Finally, we get the overall Dict representation and copy probabilities. Following Pundak et al. (2018), the Dict representation is applied to help the generation of the next token. So Equation 3 is extended as follows:
P (yu+1|y≤u, E) = softmax(W [du, ru] + b) (11)

heading: 3.2 Training
text: During training, to guide the model in selecting correct entities from the NE dictionary for copying, we introduce an additional copy loss Lcopy. First, based on the ground truth transcription y and the NE dictionary, we construct a copy target σu+1 for each decoding step u, telling the model whether to copy an entity from the dictionary or not, and which one to copy. Then we compute the copy loss Lcopy according to the copy target σu+1 and the copy probability Pc(σu+1|y≤u).
The Computation of Copy Loss. Provided that we have an NE dictionary Eb, we construct a copy target, denoted as σu+1, for decoding step u. In order to build the copy target, we perform maximum matching on the transcription text y from left to right based on the dictionary Eb. If the token span yi,j = (yi, ..., yj) matches the k-th entity ek in Eb, then we set the copy target σi = ek, and σi+1∼j = ∅. This indicates that the model can copy the k-th entity from the dictionary at decoding step i − 1, but cannot copy any entity from decoding step i to j − 1. When it comes to a span of length 1, i.e., i = j, during the left-to-right maximum matching process, we also set σi to ∅2.
For example, in the instance shown in Figure 3, the span “安徽” (An hui) matches the second entity in the dictionary, and the span “铜陵” (Tong ling) matches the first entity in the dictionary. This means that at steps 0 and 2, the model can choose to copy the second and first entities from the dictionary, respectively. Therefore, σ1 = e2 and σ3 = e1, while σ2 = ∅ and σ4 = ∅.
After constructing all the copy targets σ = (σ1, ..., σU ), we can compute the copy loss as follows:
Lcopy(σ) = − U−1∑
u=0
logPc(σu+1|y≤u) (12)
where Pc(σu+1|y≤u) is the copy probability computed in Equation 9, meaning the probability of copying entity σu+1 at decoding step u. It is worth noting that the copy loss and the bias loss in CBA have fundamental differences. The bias loss in CBA provides information to each token, including tokens within entities, about which entity to attend to. In contrast, our copy loss solely instructs the model to copy the entity from the dictionary at the first token of the entity.
Finally, the loss in our CopyNE model is formed as follows:
L = λLtrans(y) + (1− λ)Lctc(y) + Lcopy(σ) (13)
Dictionary Construction. To construct the copy target and compute the copy loss, we should first build a contextual NE dictionary for training. Provided that the entities have been labeled in the
2Please note that in this paper, we primarily focus on entities with a length greater than 1, and therefore only retain such entities in our dictionary.
dataset, we build a NE dictionary Eb for each data batch following previous works.
Firstly, to construct Eb, we extract all entities in the instances of this batch and add them to the dictionary. For instances that do not contain any entities, in order to ensure an adequate number of positive examples, we randomly select one or two substrings of length 2 or 3 from the transcription and include them in the dictionary as pseudo entities. In order to improve the ability of copying the correct entity from a wide range of entities, we also extract additional negative entities from the training set. We analyze the influence of the quantity of negative entities on the model. Due to page constraints, we have included this section in §C.

heading: 3.3 Inference
text: During inference, unlike previous token-level approaches, our model has the flexibility to predict either a token from the vocabulary or an entity from the NE dictionary. By copying the tokens of an entity at once, our CopyNE model can avoid errors that occur when predicting multiple tokens separately. As shown in Figure 3, our CopyNE model can directly copy the two entities “安徽” and “铜 陵” from the dictionary.
Specifically, at step u, our prediction is based on both the model’s probability for a token v, i.e., P (v|ŷ≤ u,E), and the copy probability for an entity e, i.e., Pc(e|ŷ≤u). The former represents the probability of predicting a token v from the token vocabulary, while the latter is normalized on all entities, originally indicating the attention probability over entity e, which can be naturally interpreted as the probability of copying entity e from the dictionary. To consider both probabilities on the same scale, we devise an elegant decoding strategy by taking use of the copy probability of ∅, i.e., Pc(∅|ŷ≤u), and re-normalize the probabilities to create an unified searching space Q. Q(i|ŷ≤u) = { Pc(∅|ŷ≤u)P (i|ŷ≤u, E), i ∈ V Pc(i|ŷ≤u), i ∈ E, i ̸= ∅
(14) Here, to ensure the sum of the probabilities of all elements is 1, we use Pc(∅|ŷ≤u) as a prior probability, representing the probability of the text to be transcribed has no relation with the entities in the dictionary and the text should be generated from the token vocabulary. If the element is from the token vocabulary V , we obtain the probability by multiplying the prior probability and the model’s
probability for the token. Otherwise, we use the copy probability directly.
However, in our experiments, we observe that the model occasionally selects irrelevant entities for copying. To enhance the quality of copying, we introduce a confidence threshold γ during decoding to filter out low-confidence copies. Specifically, we set Pc(i|ŷ≤u) = 0, i ∈ E, i ̸= ∅, and Pc(∅|ŷ≤u) = 1 when max{Pc(i|ŷ≤u)|i ∈ E, i ̸= ∅} < γ. This means that if the model’s maximum copy probability over real entities is less than γ, it is prevented from copying entities from the dictionary and instead generates tokens from the token vocabulary. In section 4.2, we discuss the influence of the γ in detail.
Finally, we use beam search to select the best element at each step to form the final prediction3.
ŷ = argmax y
( ∑
u
logQ(i|y≤u)) (15)

heading: 4 Experiments

heading: 4.1 Experimental Setup
text: Datasets. Experiments on Chinese Mandarin are conducted on two widely used datasets, Aishell (Bu et al., 2017) and ST-cmds4. We use the Eng dataset released by Yadav et al. (2020) to perform experiments on English. Furthermore, to compare the performance of different methods in contextual ASR scenarios where speeches contain entities, we extract instances containing entities from the dev and test sets, forming the corresponding “∗-NE” datasets. Detailed introduction about the datasets can be found in §A.
NE Dictionary. Aishell and ST-cmds were released without entity annotations. In contrast, the Eng dataset was simultaneously released with audio, transcribed text, and corresponding entity annotations. Chen et al. (2022) further annotated entities for Aishell. So, in our experiments with Aishell and Eng, we use the releated entities to build the NE dictionary. For ST-cmds, we use HanLP5 to get three types of entities: person, location, and organization.
Evaluation Metrics. Character error rate (CER) and word error rate (WER) are used to assess the overall performance of models in Mandarin and
3It has to be noted that the partially predicted ŷ is still encoded at token-level.
4https://www.openslr.org/38/ 5https://github.com/hankcs/HanLP
English ASR tasks. In this paper, to evaluate the model’s entity transcription accuracy, we also employ NE-CER and NE-WER metrics (Han et al., 2021). We align the predicted hypothesis and reference using the minimum edit distance algorithm, and subsequently calculate NE-C(W)ER by measuring the C(W)ER between the entity text in the reference and its counterpart in the hypothesis.
Parameter Setting. The parameter setting in our work is the same as that in most previous works, and the detailed descriptions can be found in §B. To ensure a fair comparison with prior works, we carefully reproduced the CLAS (Pundak et al., 2018) and CBA (Zhang and Zhou, 2022). Moreover, to verify the effectiveness of our approach on pretrained large models, we also conducted experiments on OpenAI Whisper (Radford et al., 2022). Specifically, we use the Whisper model as our transformer encoder and decoder. We choose seeds randomly to run models for 3 times and report the average results.

heading: 4.2 Results
text: Analysis about γ. We first investigate the influence of the copy threshold γ during inference. Figure 4 illustrates how the CER changed on the Aishell dev and Aishell-NE dev with different γ values. Our findings reveal that when the threshold is low, the CER is high, indicating that copying results in more errors when the model copies entities with low confidence. As we increase the γ, the CER decreases, indicating improved reliability of our CopyNE when the model had higher confidence. However, when the threshold becomes too high (above 0.9), the model has fewer opportunities to choose to copy entities, resulting in a higher CER. This happens because it becomes more difficult for the model to trigger the copy mechanism. So, we set γ to 0.9 for all experiments and discussions to enhance the robustness of our model.
Results on Chinese. Table 1 and 2 show the CER and NE-CER of different models on the Chinese dataset. In Table 1, we note that while our primary focus is improving transcription of NEs, we also achieve significant improvements in overall text transcription. Without Whisper, our CopyNE model outperforms the previous CBA approach with a 3.2% relative CER reduction on the Aishell Test and 7.7% on the ST-cmds Test. In contextual ASR scenarios, the improvements are even more pronounced, with a 13.5% relative CER reduction on the Aishell-NE Test and 20.8% on the ST-cmds-NE Test. Even with the powerful Whisper, our CopyNE consistently excels, especially on the ST-cmds dataset, with relative reductions of 8.6% and 15.7% on the two test sets, respectively. Additionally, we observed that CLAS performs well on Aishell, closely matching CopyNE, but its performance on ST-cmds is comparatively weaker, sometimes even worse than the Whisper baseline, a reverse pattern also seen with CBA. In contrast, CopyNE consistently performs well across different datasets, demonstrating its better adaptability.
We also present an improved model, i.e. CopyNE†, which features a more powerful conformer encoder. The results show that CopyNE† can achieve further improvements compared to CopyNE.
In this paper, our main goal is improving the transcription of NEs. From the results presented in Table 2, it is evident that our approach exhibits significant improvements in entity transcription compared to previous methods. When not using Whisper, our CopyNE model achieves an impressive relative NECER reduction of 55.4% on the Aishell-NE Test and 53.9% on the ST-cmds-NE Test. Even based on the powerful Whisper model, our CopyNE continues to achieve remarkable improvements, with a relative NE-CER reduction of 25.4% and 26.7% on the two test sets. This demonstrates that copying entities from the dictionary significantly improves the accuracy of transcribing entities.
Results on English. Whisper (Radford et al., 2022) has shown strong performance in English, so we directly use it as our baseline for experiments on English. As seen in Table 3, CopyNE still outperforms other methods, achieving a 5.2% relative WER reduction compared to CLAS in the general scenario on the Eng test dataset. In contextual scenarios, CopyNE demonstrates 6.4% relative WER reductions and 16.8% relative NE-WER reductions.
Additionally, we observed that CBA lags behind the Whisper baseline. We suspect that this might be due to its approach of encouraging the model to generate entity tokens by modifying Whisper’s output logits, which can disrupt the model’s overall probability distribution, especially given Whisper’s strong fit on English data. On the contrary, our CopyNE is more stable.

heading: 4.3 Impact of the NE dictionary
text: Following previous works (Pundak et al., 2018; Han et al., 2021), we report the main results using exact NE dictionaries from the test sets. However, when collecting dictionaries in real scenarios, to ensure the coverage, many unrelated noisy NEs are inevitably added to the dictionary. To analyze
the impact of noisy entities on CopyNE, we extract entities from the training set that are not included in the test set as noisy NEs. From the corresponding ×2, ×3, and ×4 rows in Table 4, we can see that the introduction of noisy NEs results in a reduction in the model’s performance. Nevertheless, even with the addition of 6k noisy NEs, resulting in the dictionary size being quadrupled (×4), CopyNE continues to outperform CLAS and CBA, despite their reliance on the precise dictionary.
In the more rare cases where some NEs are out of the dictionary (OOD), to analyze CopyNE’s performance in OOD scenarios, we designate some low-frequency NEs from the original dictionary as OOD NEs. These NEs are removed, and decoding is performed using the remaining NEs. From the relevant rows in Table 4, it can be observed that this primarily impacts NE-CER since CopyNE cannot copy missing NEs. However, even when the OOD proportion reaches 15% (Dict size = ×0.85), CopyNE still shows commendable performance.

heading: 4.4 Qualitative Analysis
text: CopyNE demonstrates significant improvements. To gain further insight into CopyNE’s performance, we conduct a qualitative analysis of its generations.
Table 5 shows examples of transcriptions from different ASR models. We can see that in the second example, where CBA successfully identified the correct person entity “杨丙卿” from the dictionary and produced a transcription that is close to gold, it still made a mistake by transcribing “炳” instead of “丙” due to the same pronunciation (bı̌ng). In contrast, CopyNE can copy all the tokens of the entity from the NE dictioanry. For example, in the third example “冈山的桃太郎体育馆” (The Taotailang gym in Gangshan), CopyNE directly copies the location entity “冈山” (Gangshan) and the organization entity “桃太郎体育馆” (Taotailang gym), achieving a completely correct transcription.

heading: 5 Related Works
text: Contextual ASR. Researchers have explored various approaches to help models in the contextual ASR scenario, with the primary approaches being the utilization of external dictionaries and language models (LMs). CLAS (Pundak et al., 2018) was the first to introduce the use of dictionary to aid in prediction. Alon et al. (2019) extend CLAS by adding phonetically similar alternative terms to the dictionary as negative examples, aiming to improve the model’s ability to distinguish entities with similar pronunciations. Huber et al. (2021) propose to utilize the representation of a single entry in the dictionary that is most relevant to the current decoding status. Fu et al. (2023) propose to apply the character-based NE encoder to better capture acoustic features useful for transcribing rare entities. Different from our CopyNE, these methods all treat entities as individual tokens, which may
result in incomplete NE transcriptions. LMs trained on large-scale text data can learn rich linguistic and contextual knowledge, and thus can be used to assist contextual ASR. There are typically two approaches to leverage LMs for contextual ASR. The first approach involves using the dedicated LM to encourage the generation of entity tokens during decoding. (Novak et al., 2012; Aleksic et al., 2015; Zhao et al., 2019a). The second approach is multi-modal pre-training. Researchers have explored joint pre-training of speech and text models, aiming to leverage information from both modalities, and have achieved promising results (Chung et al., 2021; Ao et al., 2022; Zhang et al., 2022). However, compared to using contextual dictionaries, models that rely on LMs tend to have much more parameters, which means that training and deploying require more time and computational resources.
The Copy Mechanism. The copy mechanism can be traced back to the pointer network (Vinyals et al., 2015), which can predict output sequences from the input. The copy mechanism (Gu et al., 2016) extends the pointer network by enabling the model to generate sequences that are not present in the input. According to the source of copying, it can be divided into copying from input text, from document, and from external dictionary.
Copying from Input Text. The copy mechanism is commonly used to copy text from input text. For instance, in text summarization tasks, it is common to employ the copy mechanism to copy keywords from the input text (Cheng and Lapata, 2016; Xu et al., 2020). In grammatical error correction tasks, where only a small portion requires correction, the copy mechanism is used to copy the correct text from the input text (Zhao et al., 2019b).
Copying from Document. In addition to copying from input text, the copy mechanism can be employed to copy text from other texts when the input text is not available. Lan et al. (2023) introduced the copy mechanism in decoder-only language models, where text fragments are selected from a vast amount of documents to generate the target text.
Copying from External Dictionary. In this paper, we introduce a systematic framework, which seamlessly integrates the process of copying from an external dictionary to aid in generation. We believe that our framework can also be applied to other generation tasks.

heading: 6 Conclusion
text: In this paper, we consider entities as indivisible elements and introduce a copy mechanism into ASR for the first time to assist in transcribing entities. We devise a systematic copy framework that can copy all the tokens of an entity from the NE dictionary at once, preserving the token span as a complete entity. Our approach demonstrates substantial improvements on both English and Chinese datasets. In summary, CopyNE represents a significant advancement in contextual ASR, providing a promising direction in this field.
Limitations
From our experiments, we have found that an excessive number of noisy entities can impact the performance. As part of our future work, we intend to explore methods for dynamically filtering out interfering entities from the dictionary during the decoding process.

heading: Acknowledgements
text: We would like to thank the anonymous reviewers for their valuable comments. This work was supported by National Natural Science Foundation of China (Grant No. 62176173 and 62336006), and a Project Funded by the Priority Academic Program Development of Jiangsu Higher Education Institutions.

heading: A Datasets
text: Aishell (Bu et al., 2017) and ST-cmds6 are two widely used Chinese Mandarin datasets. Aishell contains about 150 hours of speech. ST-cmds was built based on commonly used online chatting and user command speeches, which contains about 110 hours of speech. For the English dataset, we utilize the portion of data that has been manually annotated with entities by Yadav et al. (2020), which comprises approximately 150 hours. The Eng dataset is built by extracting content from wellknown English datasets, including Librispeech
6https://www.openslr.org/38/
(Panayotov et al., 2015), CommonVoice7, Tedlium (Rousseau et al., 2012), and Voxforge8.
Table 6 shows the detailed statistics of the datasets used in our experiments. “Sent” means the number of instances. “NE” is the number of different named entities in the dataset and also the size of the contextual entity dictionary used during inference.

heading: B Parameter Settings
text: We use 80-dimensional log-mel acoustic features with 25ms frame window and 10ms frame shift. The log-mel features are first fed into a 2D convolutional layer for downsampling and mapped to 256 dimensions before being inputted into the Audio Encoder. Both the audio encoder and decoder consist of 6 Transformer layers with 4 attention heads each. The NE Encoder is composed of three LSTM layers, with the input being a randomly initialized 256-dimensional embedding vector and the hidden size being 512. The relative weight λ in Equation 13 is set to 0.7. The experiments are conducted on two NVIDIA A100 GPUs.
In addition, for the experiments on Whisper, we use Whisper-small model9, which includes 12 transformer layers in both its encoder and decoder, and is pre-trained on a total of 680,000 hours of multi-lingual and multi-task data. We replace our audio encoder and decoder with the Whisper model and fine-tune the parameters of the entire model on our training set for a maximum of 20 epochs. During fine-tuning, the initial learning rate for the Whisper model’s parameters is set to 1e-5, while the learning rate for other parameters is set to 1e-3 with 10,000 warm-up steps. During inference, we used beam search with a beam size of 5 and 10 for models with and without Whisper, respectively.
7https://en.wikipedia.org/wiki/Common_Voice 8https://en.wikipedia.org/wiki/VoxForge 9https://huggingface.co/openai/whisper-small
C Influence of Negative Entities in Training
During training, we construct an NE dictionary for each batch. To enhance the model’s ability of copying correct entities, we sample additional negative examples.
Suppose the dictionary already contains m entities, either real entities or pseudo sub-string entities. We sample β ·m entities as negative examples from the training set. We utilize the parameter β to control the number of negative examples. Thus, we get the final dictionary for this batch which contains a total of (β + 1) ·m entities. As shown in Figure 5, adding 1 or 2 times the number of negative samples can reduce transcription errors. Specifically, when β = 2, the CER and NE-CER decreased by 0.42% and 0.44% compared to β = 0. However, as β continues to increase, the error rate started to rise. We think that this is due to the presence of excessive noise. This causes the model to excessively focus on the negative samples, thus affecting its ability to accurately copy entities. Therefore, we set β to 2 during training.

heading: Future Work
text: As part of our future work, we intend to explore methods for dynamically filtering out interfering entities from the dictionary during the decoding process