A training method, device, equipment and storage medium for a named entity model

Through the use of source data and target data in low resources or zero resource scenarios, and combined with target -oriented training strategies, the problem of low resource named entity recognition is solved, and the better identification effect on multiple data sets is achieved. And the improvement of the naming entity recognition model.

CN113761924BActive Publication Date: 2025-01-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110420593.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-19
Publication Date
2025-01-28
Estimated Expiration
2041-04-19

AI Technical Summary

Technical Problem

In the scenario of low resources or even zero resources, how to train an accurate named entity recognition model, especially when there is less language and domain labeling data.

Method used

Migration and learning by using a labeled dataset in the source data, and combined with the training of unspoken data in the target data, the target -oriented training strategy is used to reduce the gap between the source and the target areas. Specific steps include: Training the initial model based on the target data and source data, obtaining other task data sets with labeled migration and learning, and fine -tuning through the labeled data in the source data to obtain the named entity recognition model.

Benefits of technology

It shows a better naming entity recognition effect on multiple data sets in cross -language and cross -domains, which improves the accuracy and scalability of named entity recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761924B_ABST
    Figure CN113761924B_ABST
Patent Text Reader

Abstract

The present application discloses a training method, apparatus, device and storage medium for a named entity recognition model, wherein the first model is trained based on a first unlabeled named entity recognition data set in the target data and a second unlabeled named entity recognition data set in the source data. The model parameters of the trained first model are used as the initial model parameters of the second model, and the second model is trained using a first task data set, wherein the first task data set is a data set corresponding to a first task, and the first task is a task other than the named entity recognition task. The model parameters of the trained second model are used as the initial model parameters of the third model, and the third model is fine-tuned using a third named entity recognition data set with labels in the source data to obtain a named entity recognition model. This method achieves the purpose of being able to use more abundant data to transfer relevant knowledge, improves the named entity recognition effect, and is practical and scalable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing of artificial intelligence, and in particular to a training method, apparatus, device and storage medium for a named entity recognition model. Background Art

[0002] Artificial intelligence technology is an interdisciplinary subject. Natural Language Processing (NLP) is a major research direction of artificial intelligence. Named Entity Recognition (NER) is an important basic tool in application fields such as information extraction, question-answering systems, syntactic analysis, and machine translation. It occupies an important position in the process of natural language processing technology becoming practical.

[0003] In the related technology, neural network models are mainly trained through large-scale manually annotated data sets, and named entities in text data are identified through neural network models.

[0004] This method requires a large amount of labeled data. However, in the real world, many languages ​​and fields usually have relatively little labeled data, which leads to low-resource or even zero-resource named entity recognition problems. For low-resource or even zero-resource languages ​​or fields, how to train a named entity model to accurately perform named entity recognition is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to solve the above technical problems, the present application provides a training method, apparatus, device and storage medium for a named entity recognition model, which can use richer data sets for transfer learning, and show better recognition effects on multiple data sets in cross-language and cross-domain scenarios. At the same time, the goal-oriented training strategy further improves the named entity recognition effect, and is practical and scalable.

[0006] The embodiments of the present application disclose the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides a method for training a named entity recognition model, the method comprising:

[0008] Training the first model based on an unlabeled first named entity recognition dataset in the target data and an unlabeled second named entity recognition dataset in the source data;

[0009] Acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, and the first task is a task other than a named entity recognition task;

[0010] Using the model parameters of the first model obtained through training as the initial model parameters of the second model, and training the second model using the first task data set;

[0011] The model parameters of the second model obtained through training are used as initial model parameters of the third model, and the third model is fine-tuned using a third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0012] In a second aspect, an embodiment of the present application provides a training device for a named entity recognition model, the device comprising a first training unit, an acquisition unit, a second training unit, and a third training unit:

[0013] The first training unit is used to train the first model based on the unlabeled first named entity recognition data set in the target data and the unlabeled second named entity recognition data set in the source data;

[0014] The acquisition unit is used to acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, and the first task is a task other than a named entity recognition task;

[0015] The second training unit is used to use the model parameters of the first model obtained through training as initial model parameters of the second model, and train the second model using the first task data set;

[0016] The third training unit is used to use the model parameters of the second model obtained through training as the initial model parameters of the third model, and fine-tune the third model through the third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0017] In a third aspect, an embodiment of the present application provides a training device for a named entity recognition model, the electronic device comprising a processor and a memory:

[0018] The memory is used to store program code and transmit the program code to the processor;

[0019] The processor is configured to execute the method described in the first aspect according to instructions in the program code.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the method described in the first aspect.

[0021] It can be seen from the above technical scheme that in order to train a more accurate and effective named entity recognition model in a low-resource or even zero-resource scenario to solve the problem of low-resource or even zero-resource named entity recognition, this scheme will use the third named entity recognition data set with annotations in the source data (i.e., the source domain or source language) when training the named entity recognition model. In order to narrow the gap between different domains (languages) and implement a goal-oriented training strategy, the first model can be first trained based on the unannotated first named entity recognition data set in the target data and the unannotated second named entity recognition data set in the source data, thereby narrowing the distance between the source domain (language) and the target domain (language). Then, the first task data set with annotations is further obtained, the first task data set is the data set corresponding to the first task, and the first task is other tasks except the named entity recognition task. The model parameters of the first model obtained by training are used as the initial model parameters of the second model, and the second model is trained through the first task data set, so as to combine the data sets of other tasks for transfer learning, so as to achieve the purpose of being able to use more abundant data to transfer related knowledge. Then, the model parameters of the trained second model are used as the initial model parameters of the third model, and the third model is fine-tuned through the third named entity recognition dataset with annotations in the source data to obtain a named entity recognition model. This method uses the aforementioned first named entity recognition dataset, the second named entity recognition dataset, and annotated datasets of other tasks for transfer learning at the same time. It can use richer datasets for transfer learning and show better recognition effects on multiple datasets in cross-language and cross-domain scenarios. At the same time, the goal-oriented training strategy further improves the named entity recognition effect, and is practical and scalable. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technical members in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0023] Figure 1 A schematic diagram of the architecture for knowledge transfer from three aspects: task, language and domain, provided in an embodiment of the present application;

[0024] Figure 2 A schematic diagram of the system architecture of a method for training a named entity recognition model provided in an embodiment of the present application;

[0025] Figure 3 A flowchart of a method for training a named entity recognition model provided in an embodiment of the present application;

[0026] Figure 4 A goal-oriented transfer learning framework diagram provided for an embodiment of the present application;

[0027] Figure 5 An example diagram of a training method for a named entity recognition model provided for related technologies;

[0028] Figure 6 A flowchart of a method for training a named entity recognition model provided in an embodiment of the present application;

[0029] Figure 7 A structural diagram of a training device for a named entity recognition model provided in an embodiment of the present application;

[0030] Figure 8 A structural diagram of a terminal device provided in an embodiment of the present application;

[0031] Fig. 9 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The embodiments of the present application are described below in conjunction with the accompanying drawings.

[0033] Related technologies mainly use large-scale manually annotated data sets to train neural network models, and use neural network models to identify named entities in text data. This method requires a large amount of annotated data, but in the real world, many languages ​​and fields usually have relatively little annotated data. For low-resource or even zero-resource languages ​​or fields, how to train a named entity model to accurately perform named entity recognition is a technical problem that needs to be solved.

[0034] In order to solve the above technical problems, transfer learning is usually used to train named entity recognition models in low-resource or even zero-resource scenarios. This application analyzes the key to the problem of low-resource or even zero-resource named entity recognition (NER), that is, the lack of target training data that meets the following two conditions at the same time: 1) from the target domain (or language), 2) with annotation information for the target task (NER task). Although the target training data is difficult to obtain, data that only meets one of the above two conditions is easy to obtain. Therefore, this application considers knowledge transfer from three aspects: task, language, and domain, such as Figure 1 As shown in the figure, taking the target training data to be acquired in the target language, such as Spanish, and the target task being named entity recognition as an example, knowledge transfer can be performed from three aspects: task, language, and domain. Figure 1In it, "sao paulo" is in Spanish, and "<sao paulo, place name>, <Brasil, place name>" represents the annotation data for the named entity recognition task.

[0035] A task is something to be done, which can include, for example, machine reading comprehension (MRC) and named entity recognition. Figure 1 In it, "<Brasil, place name>" represents the annotation data for the named entity recognition task, and "Who has the most to lose? | WNJ has the most to lose" represents the text data for the machine reading comprehension task; the languages can include various languages such as Spanish, English, German, etc. Figure 1 In it, "Como seconoce popularmente en Brasil al tenista" is the text data in Spanish, and "Brazil to use hovercrafts for Amazon travel" is the text data in English; the fields can include fields such as medical, biological, news, Twitter, etc. Figure 1 In it, "Santander, 23may" is the text data in the news field, and "RT@Gabriele_Corno: Beach by Josh Adamski#meditation#instiration#CGE http: / / t.co / ParMW4CG4X" is the text data in the Twitter field.

[0036] Specifically, the embodiment of the present application provides a training method for a named entity recognition model. This method simultaneously uses the unannotated first named entity recognition dataset in the target data (i.e., the target field or target language), the unannotated second named entity recognition dataset in the source data (i.e., the source field or source language), and the annotated dataset of other tasks for transfer learning. It can use a more abundant dataset for transfer learning, shows better recognition effects on multiple datasets in scenarios such as cross-language and cross-field, and at the same time, the target-oriented training strategy further improves the named entity recognition effect, having practicality and scalability.

[0037] It should be noted that the method provided by the embodiment of the present application can be applied to application fields such as information extraction, question answering systems, syntactic analysis, and machine translation.

[0038] The method provided in the embodiments of the present application may involve artificial intelligence. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.

[0039] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0040] For example, natural language processing technology in artificial intelligence, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.

[0041] Another example is machine learning in artificial intelligence. Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning. This application trains a named entity recognition model through transfer learning.

[0042] For easier understanding, please refer to Figure 2The training method of the named entity recognition model provided in the embodiment of the present application is introduced, and the method can be executed by a data processing device, and the data processing device can be a terminal or a server. The terminal can be a computer, a tablet computer, etc., and the server can be an independent server or a cluster server.

[0043] Figure 2 A schematic diagram of a system architecture of a method for training a named entity recognition model provided in an embodiment of the present application. The system architecture takes a data processing device as an example, and includes a server 201 .

[0044] Low-resource or zero-resource named entity recognition refers to identifying the occurrence locations and entity types of named entities such as names of people, places, and organization names in the absence of named entity annotation data in the target domain (or language). The data corresponding to the target domain (or language) can constitute the target data, and the data corresponding to other domains (or languages) except the target domain (or language) can constitute the source data.

[0045] In low-resource or even zero-resource scenarios, transfer learning is usually used to train named entity recognition models. Transfer learning can be the application of knowledge learned in a certain field (or language) or task to different related fields (or languages) or tasks. Therefore, in this application, due to the lack of labeled data in the target field (or language), in order to train a named entity recognition model applied to the target field (or language), transfer learning can be performed by combining data from other fields (or languages), namely the source field (or language), and data from other tasks.

[0046] Specifically, server 201 can obtain an unlabeled first named entity recognition dataset in the target data and an unlabeled second named entity recognition dataset in the source data, and train the first model based on the first named entity recognition dataset and the second named entity recognition dataset, thereby narrowing the distance between the source domain (or language) and the target domain (or language), and realizing a goal-oriented training strategy to a certain extent.

[0047] Then, the server 201 obtains the first task data set with annotations, the first task data set is the data set corresponding to the first task, and the first task is a task other than the named entity recognition task. The model parameters of the trained first model are used as the initial model parameters of the second model, and the second model is trained by the first task data set, so as to combine the data sets of other tasks for transfer learning, so as to achieve the purpose of using richer data to transfer relevant knowledge.

[0048] Next, the server 201 uses the model parameters of the trained second model as the initial model parameters of the third model, and fine-tunes the third model using the third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0049] Next, the training method of the named entity model provided in the embodiment of the present application will be introduced in detail with the server as the execution entity.

[0050] See also Figure 3 , Figure 3 A flowchart of a method for training a named entity recognition model is shown, the method comprising:

[0051] S301 , training a first model according to a first unlabeled named entity recognition dataset in target data and a second unlabeled named entity recognition dataset in source data.

[0052] The embodiments of the present application consider knowledge transfer from three perspectives: task, language, and domain. First, four feasible guiding principles are proposed for selecting data sets and effectively transferring knowledge, as follows: 1) It is necessary to consider the available knowledge from the three perspectives of task, domain, and language; 2) For the transfer of domain and language knowledge, consider narrowing the distance between the source domain (or language) and the target domain (or language); 3) For the transfer of target task (NER) knowledge, consider narrowing the distance between the target task (NER) and other tasks (such as MRC), so as to achieve the goal of using the annotation information of other tasks to help the learning of the target task; 4) Finally, the knowledge from the target domain (or language) and the target task (NER) is integrated to get closer to the target training data. Based on the above four guiding principles, the embodiments of the present application design a goal-oriented transfer learning framework, see Figure 4 As shown in the figure, it consists of two parts: 1) a knowledge transfer module, which is used to transfer task, domain and language knowledge from different types of available data; 2) a fine-tuning training module, which includes a complete data utilization method and various training strategies.

[0053] Among them, the fine-tuning training module can be implemented based on a neural network model, such as the AdaptaBERT model. The entire model framework includes three auxiliary training tasks: the first model, the second model and the named entity recognition model.

[0054] Since there is a lack of annotated named entity recognition datasets in the target domain (or language), knowledge can be transferred from other domains (or languages) through the knowledge transfer module. Based on the guiding principle 2) in the fine-tuning training module, in order to narrow the gap between the source domain (or language) and the target domain (or language), the server can obtain the first unannotated named entity recognition dataset in the target data (e.g. Figure 4The dataset identified in a) and the second named entity recognition dataset without annotations in the source data (e.g. Figure 4 b) in order to combine the first named entity recognition dataset and the second named entity recognition dataset to jointly train the first model, thereby narrowing the distance between the two and ensuring that the named entity recognition model obtained by subsequent transfer learning is more suitable for the target domain (or language). The first named entity recognition dataset can be used as D t,no Indicates that the second named entity recognition dataset D s,no The source domain (or language) may include a single domain (or language) or multiple domains (or languages), which is not limited in this embodiment.

[0055] For example, when named entity recognition (target task) is required in Spanish (target language), however, there is very little labeled data for named entity recognition in Spanish. Therefore, transfer learning can be performed through other languages ​​to train a named entity recognition model that can be used for named entity recognition in Spanish. Among them, the other languages ​​can use one language, such as English, or multiple languages ​​can be used at the same time, such as English, French, German, etc.

[0056] It should be noted that the first model may be a language model that can be trained based on an unlabeled dataset. In a possible implementation, the first model may be, for example, a masked language model (MLM), represented by f(·,θ mlm ). MLM helps the named entity recognition model learn context-dependent word representations by reconstructing randomly masked words. Based on guiding principle 2), MLM Figure 4 The model is trained on the mixed datasets identified in a) and b).

[0057] S302: Obtain a first task data set with annotations.

[0058] Based on the guiding principle 1) in the fine-tuning training module, in addition to using the NER datasets of the source domain (or language) and the target domain (or language), it is also necessary to consider the annotated data of other tasks so as to use more abundant data for transfer learning. Therefore, in this embodiment, the server also needs to obtain the first task dataset, which is the dataset corresponding to the first task, and the first task is other tasks except the named entity recognition task.

[0059] Among them, the first task is a task similar to the task of named entity recognition. For example, named entity recognition is to identify entities from text data, and each entity is a fragment in the text data. Therefore, the task of named entity recognition is similar to the task of fragment extraction, so the first task can be a fragment extraction task. Since some MRC tasks can realize fragment extraction, the first task can be a fragment extraction MRC task. Of course, the embodiment of the present application does not limit which specific fragment extraction task the first task is.

[0060] It should be noted that the first task data set can be obtained in different ways. In a possible implementation, the first task data set can be determined based on a combination of one or more of a first data subset with annotations corresponding to the first task in the target data, a second data subset with annotations corresponding to the first task in the source data, and a second task data set with annotations. The second task data set is a data set corresponding to the second task, and the second task is a task other than the first task.

[0061] Based on the guiding principle 3) in the fine-tuning training module, in order to narrow the distance between the target task (NER) and other tasks (such as MRC), so as to use the annotation information of other tasks to help the learning of the target task, the second task can be a named entity recognition task, so as to further narrow the distance between the two in the subsequent training process and achieve better transfer learning effect.

[0062] Take the first task as an example, that is, the first task data set can be the real MRC data directly obtained from the target data (i.e., the first data subset, which can be represented by D t,m Indicates, for example Figure 4 c) in the figure), the real MRC data directly obtained from the source data (i.e., the second data subset, which can be obtained by D s,m Indicates, for example Figure 4 The data set identified by d) in the above may also be determined by the second task data set with annotations in the source data. Since the second task data set is the data set corresponding to the second task, it is necessary to convert the second task data set into the data set corresponding to the first task. Of course, the first task data set may also be obtained according to the above multiple combinations.

[0063] When the first task is an MRC task, the second task can be a NER task, that is, the second task dataset can be a labeled NER dataset, which can be obtained by D s,n Indicates, for example Figure 4 In addition, the second task may also be other tasks, such as an event extraction task, etc., which is not limited in this embodiment.

[0064] In a possible implementation, if the first task data set is determined based on the annotated second task data set, then the method for determining the first task data set based on the annotated second task data set may be to convert the text data in the second task data set into text data that conforms to the target text data format to obtain a third data subset. The target text data format is the text data format corresponding to the first task, and the converted third data subset can be obtained by D s,nm Then, the first task data set is determined according to the third data subset.

[0065] The method of determining the first task data set according to the third data subset may be to directly determine the third data subset as the first task data set. In another possible implementation, the third data subset may also be combined with the first data subset and / or the second data subset as the first task data set. Figure 4 The first task dataset used to train the second model includes D t,m , D s,m and according to D s,n The converted D s,nm .

[0066] S303: Use the model parameters of the first model obtained through training as initial model parameters of the second model, and train the second model using the first task data set.

[0067] During transfer learning, the knowledge learned in S301 can be transferred first, that is, the model parameters of the first model obtained by training are used as the initial model parameters of the second model. In this way, the second model learns the knowledge of the source domain (or language), and then uses the first task data set obtained in S302 to train the second model.

[0068] The second model corresponds to the first task. If the first task is a fragment-extractive MRC task, the second model is a fragment-extractive MRC model, expressed as g(·,θ mrc ). The training process of the first model and the second model can be a process of pre-training a language model.

[0069] The fragment extraction MRC model has the following three main advantages: 1) The MRC model can improve the ability of NER in fragment extraction and help NER better capture the semantic information of different entity types; 2) The MRC model can be used to solve many tasks including NER, so MRC can serve as a bridge between NER and other tasks; 3) The application of the MRC model in other tasks provides a unified framework for transferring different knowledge from other tasks.

[0070] If the second model is a fragment extraction MRC model, a possible implementation method for training the second model through the first task data set is to determine the vector corresponding to each word in the text data included in the first task data set, input the vector corresponding to each word into the second model, and obtain the prediction result of each word being the start of the target segment and the end of the target segment. That is, predict the possibility of each word being the start of the target segment and the end of the target segment, and then construct a loss function through the prediction results, optimize the loss function corresponding to the prediction results, adjust the initial model parameters of the second model, and complete the training of the second model.

[0071] Among them, a word can be a component unit of text data. The way of determining a word is different in different languages. If the language is Chinese, the word can be obtained by segmenting the text data; if the language is a foreign language other than Chinese, such as English, Spanish, etc., the word can be a word in the text data.

[0072] If the fragment extraction MRC model includes two linear classification layers, and a term is a word, then the specific training method is as follows: the context-related words are represented as vectors h t The probability of each word being predicted as the start and end of the target segment is calculated as follows:

[0073]

[0074] in, is the vector h t The probability that the corresponding word is predicted to be the start of the target segment, is the vector h t The probability that the corresponding word is predicted as the end of the target segment, W start and is a learnable parameter, and d1 represents the dimension of the context-dependent word representation. Finally, by optimizing and The cross-over loss function is used to train the model.

[0075] S304: Use the model parameters of the second model obtained through training as the initial model parameters of the third model, and fine-tune the third model using the third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0076] Among them, the third named entity recognition dataset is a labeled NER dataset, which can be expressed as D s,n ,For example Figure 4When the first task in S302 is an MRC task and the second task is a NER task, the third named entity recognition data set can be used as the second task data set to determine the first task data set to train the second model.

[0077] The named entity recognition model is used to further fine-tune the vectors corresponding to the words and obtain the model for prediction. The implementation process is as follows: first, the vectors corresponding to the context-related words are input into the linear classification layer of the named entity recognition model, and training is performed by maximizing the probability of each word being on the correct entity label. Specifically, taking a word as an example, given an input word sequence containing N words x i Represents the i-th word. First, input it into the encoder f θ To obtain the vector corresponding to each word, we can get the vector sequence corresponding to all words. Where H = f θ (X), h i Represents the vector corresponding to the i-th word. Encoder f θ Based on the pre-trained language model implementation, such as BERT, θ represents the initial model parameters.

[0078] Afterwards, h i The input is sent to a linear classification layer and a softmax function to predict the probability distribution of the vector corresponding to the current position on all entity labels, which is expressed as follows:

[0079] in Y represents the one-hot encoding vector corresponding to different entity labels, {W, b} represents the trainable parameters in the named entity model, and its corresponding initial value, i.e., the initial model parameter, can be the model parameter of the second model. The loss function is the cross entropy of the true probability and predicted probability of each word on all entity labels, and then the training of the named entity recognition model is completed according to the loss function.

[0080] Among them, the training steps shown in S301-S304 can correspond to Figure 4 As shown in ①, ②, and ③.

[0081] After training the named entity recognition model, you can use it to perform named entity recognition, that is, use it to make predictions, see Figure 4 In one possible implementation, text data to be identified may be obtained, and the entity label of each word in the text data to be identified may be determined by the named entity recognition model, and then the entity in the text data to be identified may be identified according to the entity label.

[0082] The text data to be recognized can be Figure 4 The unlabeled NER dataset identified in e) is denoted as D t,no Of course, the text data to be recognized can also be t,no Unlabeled text data other than , such as text data acquired in real time that requires named entity recognition.

[0083] It can be seen from the above technical scheme that in order to train a more accurate and effective named entity recognition model in a low-resource or even zero-resource scenario to solve the problem of low-resource or even zero-resource named entity recognition, this scheme will use the third named entity recognition data set with annotations in the source data (i.e., the source domain or source language) when training the named entity recognition model. In order to narrow the gap between different domains (languages) and implement a goal-oriented training strategy, the first model can be first trained based on the unannotated first named entity recognition data set in the target data and the unannotated second named entity recognition data set in the source data, thereby narrowing the distance between the source domain (language) and the target domain (language). Then, the first task data set with annotations is further obtained, the first task data set is the data set corresponding to the first task, and the first task is other tasks except the named entity recognition task. The model parameters of the first model obtained by training are used as the initial model parameters of the second model, and the second model is trained through the first task data set, so as to combine the data sets of other tasks for transfer learning, so as to achieve the purpose of being able to use more abundant data to transfer related knowledge. Then, the model parameters of the trained second model are used as the initial model parameters of the third model, and the third model is fine-tuned through the third named entity recognition dataset with annotations in the source data to obtain a named entity recognition model. This method uses the aforementioned first named entity recognition dataset, the second named entity recognition dataset, and annotated datasets of other tasks for transfer learning at the same time. It can use richer datasets for transfer learning and show better recognition effects on multiple datasets in cross-language and cross-domain scenarios. At the same time, the goal-oriented training strategy further improves the named entity recognition effect, and is practical and scalable.

[0084] Compared with related technologies, see Figure 5As shown, the related art uses a domain tuning plus task tuning architecture to perform cross-domain zero-resource named entity recognition, which only considers the unlabeled data in the target domain (or language) and the source domain (or language), as well as the data with labeled information in the source domain (or language), but ignores the labeled data of other tasks. Specifically, the related art uses the unlabeled data in the source domain and the target domain to perform domain fine-tuning to obtain the mask result, and then migrates the model parameters based on the domain fine-tuning to start task fine-tuning. In the task fine-tuning process, the data with labeled information in the source domain (or language) is used to predict the label to obtain the entity label, so that the named entity recognition model trained in this matter is used in the target domain. The embodiment of the present application considers the labeled data of other tasks, uses a richer data set for transfer learning, and considers narrowing the distance between the target task (NER) and other tasks (such as MRC), realizing a goal-oriented training strategy, further improving the named entity recognition effect, and having practicality and scalability.

[0085] The recognition effects of the method provided in the embodiment of the present application and the method provided in the related art on multiple data sets in two cross-language and cross-domain scenarios can be seen in Table 1:

[0086] Table 1

[0087]

[0088] Among them, D1, D2, D3, D4, D5, and D6 represent different datasets. D1, D2, and D3 are domain-related datasets, and D4, D5, and D6 are language-related datasets. Specifically, D1: WNUT16 named entity recognition dataset, Twitter domain, contains ten predefined entity categories, such as gardens, etc.; D2: Twitter NER named entity recognition dataset, twitter domain, contains four predefined entity categories, such as person name (PER), place name (LOC), organization name (GEO), and others (MISC); D3:SciTech named entity recognition dataset, science and technology news domain, contains four predefined entity categories, such as person name (PER), place name (LOC), organization name (GEO), and others (MISC); D4:CoNLL03 named entity recognition dataset, German, contains four predefined entity categories, such as person name (PER), place name (LOC), organization name (GEO), and others (MISC); D5:CoNLL02 named entity recognition dataset, Spanish, contains four predefined entity categories, such as person name (PER), place name (LOC), organization name (GEO), and others (MISC). It can be seen from Table 1 that on each data set, the corresponding values ​​of the recognition effect shown by the method provided in the present application are higher than those of the related technologies, for example, 68.40 is greater than 62.8, etc., that is, the method provided in the present application shows better named entity recognition effect than the related technologies on multiple data sets in cross-language and cross-domain scenarios.

[0089] It should be noted that there are many methods for training the third model to obtain a named entity recognition model, such as directly using the method described in S304 for training. Of course, it is also possible to consider using a more complex method to enhance the training of the named entity recognition model to further improve the recognition effect of the named entity recognition model.

[0090] Therefore, in a possible implementation, the third model is fine-tuned by the third named entity recognition dataset with annotations in the source data, and the method of obtaining the named entity recognition model can be to pre-train the third model with the third named entity recognition dataset with annotations in the source data, and then a preliminarily trained named entity recognition model can be obtained. Then, the pre-trained third model is used to predict the labels of the text data in the first named entity recognition dataset to obtain the first named entity recognition dataset with pseudo annotations, see Figure 4 As shown in ④, pseudo-annotated data is constructed, which can be expressed as Then the pseudo-annotated NER dataset Applied to continue training the third model, that is, training the pre-trained third model according to the first named entity recognition dataset with pseudo annotations, see Figure 4 As shown in ⑤, the final named entity recognition model is obtained.

[0091] It should be noted that after obtaining the first named entity recognition dataset with pseudo-annotations, the pre-trained third model can continue to be enhanced. Since the initial model parameters of the third model are transferred from the second model, the effect of the second model directly affects the recognition effect of the named entity recognition model obtained by the final training. Therefore, in a possible implementation method, the pre-trained third model is trained according to the first named entity recognition dataset with pseudo-annotations, and the method for obtaining the named entity recognition model can be to determine the first task dataset according to the first named entity recognition dataset with pseudo-annotations, and then train the second model according to the first task dataset obtained at this time, see Figure 4 Then, the pre-trained third model is trained according to the first named entity recognition dataset with pseudo annotations to obtain a named entity recognition model, see Figure 4 As shown in ⑦. At this time, the initial model parameters of the pre-trained third model are obtained according to the model parameters of the second model trained here. The first named entity recognition dataset with pseudo annotations is iteratively trained between the pre-trained third model and the second model.

[0092] That is, after completing one iteration of training of the third model, for example, completing the i-th iteration of training, the third model obtained by the i-th iteration of training is used to update the first named entity recognition dataset with pseudo annotations, see Figure 4 Then, the updated first named entity recognition dataset with pseudo annotations is used to perform the i+1th iteration training, see Figure 4 As shown in 9. After T iterations of training, the final named entity recognition model is obtained, and the named entity recognition model is used for named entity recognition.

[0093] In this embodiment, by performing enhanced training on the named entity recognition model, compared with the pipeline model framework used in the related art, the knowledge contained in different data sets is learned more fully, and the obtained named entity recognition model has better recognition effect.

[0094] Next, the named entity recognition method will be introduced in conjunction with actual application scenarios. The named entity recognition method is implemented based on a named entity recognition model, and the named entity recognition model is trained according to the training method of the named entity recognition model provided in the embodiment of the present application. In order to perform named entity recognition, it is first necessary to train a named entity recognition model. In some fields, the annotated data of the named entity recognition model is very small or even non-existent. In this case, the named entity recognition model can be trained based on the goal-oriented transfer learning method provided in the embodiment of the present application. Among them, the entire model framework includes three auxiliary training tasks: a first model, a second model and a named entity recognition model. In this embodiment, the first model is a masked language model (MLM), and the second model is a fragment-extraction machine reading comprehension (MRC) model, see Figure 6 , the method comprising:

[0095] S601 , training the MLM according to a first unlabeled named entity recognition dataset in the target data and a second unlabeled named entity recognition dataset in the source data.

[0096] S602: Use the model parameters of the MLM obtained through training as the initial model parameters of the MRC model.

[0097] S603: Convert the annotated NER dataset into an annotated MRC dataset.

[0098] At this time, the annotated NER dataset is the annotated second task dataset, and the converted annotated MRC dataset is the third data subset.

[0099] S604: Train the MRC model according to the first data subset with annotations corresponding to the first task in the target data, the second data subset with annotations corresponding to the first task in the source data, and the converted MRC data set with annotations.

[0100] S605: Use the model parameters of the trained MRC model as initial model parameters of the third model.

[0101] S606: Pre-train the third model using a third named entity recognition dataset with annotations in the source data.

[0102] S607: Use the pre-trained third model to perform label prediction on the text data in the first named entity recognition dataset to obtain the first named entity recognition dataset with pseudo-annotations.

[0103] S608: Iteratively train the first named entity recognition dataset with pseudo annotations between the MRC model and the third model.

[0104] The iterative training method may be to update the first named entity recognition dataset with pseudo annotations using the third model obtained in the i-th iterative training, and then perform the (i+1)-th iterative training using the updated first named entity recognition dataset with pseudo annotations.

[0105] S609: After T iterations of training, a final named entity recognition model is obtained.

[0106] S610: Perform named entity recognition using the obtained named entity recognition model.

[0107] It can be seen from the above technical scheme that in order to train a more accurate and effective named entity recognition model in a low-resource or even zero-resource scenario to solve the problem of low-resource or even zero-resource named entity recognition, this scheme will use the third named entity recognition data set with annotations in the source data (i.e., the source domain or source language) when training the named entity recognition model. In order to narrow the gap between different domains (languages) and implement a goal-oriented training strategy, the first model can be first trained based on the unannotated first named entity recognition data set in the target data and the unannotated second named entity recognition data set in the source data, thereby narrowing the distance between the source domain (language) and the target domain (language). Then, the first task data set with annotations is further obtained, the first task data set is the data set corresponding to the first task, and the first task is other tasks except the named entity recognition task. The model parameters of the first model obtained by training are used as the initial model parameters of the second model, and the second model is trained through the first task data set, so as to combine the data sets of other tasks for transfer learning, so as to achieve the purpose of being able to use more abundant data to transfer related knowledge. Then, the model parameters of the trained second model are used as the initial model parameters of the third model, and the third model is fine-tuned through the third named entity recognition dataset with annotations in the source data to obtain a named entity recognition model. This method uses the aforementioned first named entity recognition dataset, the second named entity recognition dataset, and annotated datasets of other tasks for transfer learning at the same time. It can use richer datasets for transfer learning and show better recognition effects on multiple datasets in cross-language and cross-domain scenarios. At the same time, the goal-oriented training strategy further improves the named entity recognition effect, and is practical and scalable.

[0108] based on Figure 3 In accordance with the training method of the named entity recognition model provided in the embodiment, the present application embodiment also provides a training device for the named entity recognition model, see Figure 7 , the apparatus 700 includes a first training unit 701, an acquisition unit 702, a second training unit 703 and a third training unit 704:

[0109] The first training unit 701 is used to train the first model according to the unlabeled first named entity recognition data set in the target data and the unlabeled second named entity recognition data set in the source data;

[0110] The acquisition unit 702 is used to acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, and the first task is a task other than a named entity recognition task;

[0111] The second training unit 703 is used to use the model parameters of the first model obtained through training as the initial model parameters of the second model, and train the second model using the first task data set;

[0112] The third training unit 704 is used to use the model parameters of the second model obtained through training as the initial model parameters of the third model, and fine-tune the third model using the third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0113] In a possible implementation, the first task data set is determined based on a combination of one or more of a first data subset with annotations corresponding to the first task in the target data, a second data subset with annotations corresponding to the first task in the source data, and a second task data set with annotations, the second task data set is a data set corresponding to the second task, and the second task is a task other than the first task.

[0114] In a possible implementation, if the first task data set is determined according to the second task data set with annotations, the acquiring unit 702 is configured to:

[0115] Converting the text data in the second task data set into text data conforming to a target text data format to obtain a third data subset, wherein the target text data format is a text data format corresponding to the first task;

[0116] The first task data set is determined according to the third data subset.

[0117] In a possible implementation, the first model is a masked language model, and the second model is a fragment extraction machine reading comprehension model.

[0118] In a possible implementation, the second training unit 703 is used to determine a vector corresponding to each word in the text data included in the first task data set;

[0119] Inputting the vector corresponding to each word into the second model to obtain a prediction result of whether each word is the beginning of the target segment or the end of the target segment;

[0120] The initial model parameters of the second model are adjusted by optimizing the loss function corresponding to the prediction result to complete the training of the second model.

[0121] In a possible implementation, the third training unit 704 is used to pre-train the third model using a third named entity recognition dataset with annotations in the source data;

[0122] Using the pre-trained third model to perform label prediction on the text data in the first named entity recognition dataset to obtain a first named entity recognition dataset with pseudo annotations;

[0123] The pre-trained third model is trained according to the first named entity recognition data set with pseudo-annotations to obtain the named entity recognition model.

[0124] In a possible implementation, the third training unit 704 is used to determine the first task data set according to the first named entity recognition data set with pseudo-annotations;

[0125] Training the second model according to the first task data set;

[0126] The pre-trained third model is trained according to the first named entity recognition data set with pseudo-annotations to obtain the named entity recognition model, and the first named entity recognition data set with pseudo-annotations is iteratively trained between the pre-trained third model and the second model.

[0127] In a possible implementation, the third training unit 704 is used to update the first named entity recognition dataset with pseudo-annotations by using the third model obtained by the i-th iterative training;

[0128] The i+1th iteration training is performed using the updated first named entity recognition dataset with pseudo annotations.

[0129] The present application also provides a training device for a named entity recognition model, which may be a data processing device, such as a terminal device. For example, the terminal device is a smart phone:

[0130] Figure 8 The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Figure 8The smartphone includes: a radio frequency (RF) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, a processor 880, and a power supply 890. The input unit 830 may include a touch panel 831 and other input devices 832, the display unit 840 may include a display panel 841, and the audio circuit 860 may include a speaker 861 and a microphone 862. Those skilled in the art will appreciate that Figure 8 The structure of the smartphone shown in the figure does not constitute a limitation of the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0131] The memory 820 can be used to store software programs and modules. The processor 880 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 820. The memory 820 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, a phone book, etc.), etc. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0132] The processor 880 is the control center of the smartphone, which uses various interfaces and lines to connect various parts of the entire smartphone, and executes various functions of the smartphone and processes data by running or executing software programs and / or modules stored in the memory 820, and calling data stored in the memory 820. Optionally, the processor 880 may include one or more processing units; preferably, the processor 880 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 880.

[0133] In this embodiment, the processor 880 in the terminal device may perform the following steps:

[0134] Training the first model based on an unlabeled first named entity recognition dataset in the target data and an unlabeled second named entity recognition dataset in the source data;

[0135] Acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, and the first task is a task other than a named entity recognition task;

[0136] Using the model parameters of the first model obtained through training as the initial model parameters of the second model, and training the second model using the first task data set;

[0137] The model parameters of the second model obtained through training are used as initial model parameters of the third model, and the third model is fine-tuned using a third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0138] The device may also include a server. The embodiment of the present application also provides a server. See Fig. 9 As shown, Fig. 9 The structural diagram of the server 900 provided in the embodiment of the present application, the server 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 922 (for example, one or more processors) and a memory 932, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 942 or data 944. Among them, the memory 932 and the storage medium 930 can be temporary storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 922 can be configured to communicate with the storage medium 930 and execute a series of instruction operations in the storage medium 930 on the server 900.

[0139] The server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958, and / or one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0140] In this embodiment, the central processor 922 in the server 900 may perform the following steps:

[0141] Training the first model based on an unlabeled first named entity recognition dataset in the target data and an unlabeled second named entity recognition dataset in the source data;

[0142] Acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, and the first task is a task other than a named entity recognition task;

[0143] Using the model parameters of the first model obtained through training as the initial model parameters of the second model, and training the second model using the first task data set;

[0144] The model parameters of the second model obtained through training are used as initial model parameters of the third model, and the third model is fine-tuned using a third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

[0145] According to one aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the training method of the named entity recognition model described in the aforementioned embodiments.

[0146] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above embodiments.

[0147] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0148] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0149] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0151] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.

[0152] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, ordinary technical members in the art should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A training method for a named entity recognition model, characterized in that: The method comprises: Training the first model based on an unlabeled first named entity recognition dataset in the target data and an unlabeled second named entity recognition dataset in the source data; Acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, where the first task is other tasks other than the named entity recognition task and similar to the named entity recognition task; Using the model parameters of the first model obtained through training as the initial model parameters of the second model, and training the second model using the first task data set; The model parameters of the second model obtained through training are used as initial model parameters of the third model, and the third model is fine-tuned using a third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

2. The method according to claim 1, characterized in that The first task data set is determined based on a combination of one or more of a first data subset with annotations corresponding to the first task in the target data, a second data subset with annotations corresponding to the first task in the source data, and a second task data set with annotations, the second task data set is a data set corresponding to the second task, and the second task is a task other than the first task.

3. The method according to claim 2, characterized in that If the first task data set is determined according to the second task data set with annotations, determining the first task data set according to the second task data set with annotations includes: Converting the text data in the second task data set into text data conforming to a target text data format to obtain a third data subset, wherein the target text data format is a text data format corresponding to the first task; The first task data set is determined according to the third data subset.

4. The method according to any one of claims 1 to 3, characterized in that: The first model is a masked language model, and the second model is a fragment extraction machine reading comprehension model.

5. The method according to claim 4, characterized in that The training of the second model by using the first task data set includes: Determine a vector corresponding to each word in the text data included in the first task data set; Inputting the vector corresponding to each word into the second model to obtain a prediction result of whether each word is the beginning of the target segment or the end of the target segment; The initial model parameters of the second model are adjusted by optimizing the loss function corresponding to the prediction result to complete the training of the second model.

6. The method according to any one of claims 1 to 3, characterized in that: The step of fine-tuning the third model using the third named entity recognition dataset with annotations in the source data to obtain the named entity recognition model includes: Pre-training the third model using a third named entity recognition dataset with annotations in the source data; Using the pre-trained third model to perform label prediction on the text data in the first named entity recognition dataset to obtain a first named entity recognition dataset with pseudo annotations; The pre-trained third model is trained according to the first named entity recognition data set with pseudo-annotations to obtain the named entity recognition model.

7. The method according to claim 6, characterized in that The step of training the pre-trained third model according to the first named entity recognition data set with pseudo-annotations to obtain the named entity recognition model includes: Determine the first task data set according to the first named entity recognition data set with pseudo-annotations; Training the second model according to the first task data set; The pre-trained third model is trained according to the first named entity recognition data set with pseudo-annotations to obtain the named entity recognition model, and the first named entity recognition data set with pseudo-annotations is iteratively trained between the pre-trained third model and the second model.

8. The method according to claim 7, characterized in that The method of iteratively training the first named entity recognition data set with pseudo annotations between the pre-trained third model and the second model is: Using the third model obtained by the i-th iteration training to update the first named entity recognition dataset with pseudo-annotations; The i+1th iteration training is performed using the updated first named entity recognition dataset with pseudo annotations.

9. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Obtaining text data to be recognized; Determine the entity label of each word in the text data to be recognized by the named entity recognition model; Entities in the to-be-identified text data are identified according to the entity tags.

10. A training device for a named entity recognition model, characterized in that: The device comprises a first training unit, an acquisition unit, a second training unit and a third training unit: The first training unit is used to train the first model based on the unlabeled first named entity recognition data set in the target data and the unlabeled second named entity recognition data set in the source data; The acquisition unit is used to acquire a first task data set with annotations, where the first task data set is a data set corresponding to a first task, where the first task is a task other than the named entity recognition task and similar to the named entity recognition task; The second training unit is used to use the model parameters of the first model obtained through training as initial model parameters of the second model, and train the second model using the first task data set; The third training unit is used to use the model parameters of the second model obtained through training as the initial model parameters of the third model, and fine-tune the third model through the third named entity recognition data set with annotations in the source data to obtain a named entity recognition model.

11. The device according to claim 10, characterized in that The first task data set is determined based on a combination of one or more of a first data subset with annotations corresponding to the first task in the target data, a second data subset with annotations corresponding to the first task in the source data, and a second task data set with annotations, the second task data set is a data set corresponding to the second task, and the second task is a task other than the first task.

12. The device according to claim 11, characterized in that If the first task data set is determined according to the second task data set with annotations, the acquiring unit is used to: Converting the text data in the second task data set into text data conforming to a target text data format to obtain a third data subset, wherein the target text data format is a text data format corresponding to the first task; The first task data set is determined according to the third data subset.

13. The device according to any one of claims 10 to 12, characterized in that: The first model is a masked language model, and the second model is a fragment extraction machine reading comprehension model.

14. A training device for a named entity recognition model, characterized in that: The device comprises a processor and a memory: The memory is used to store program codes and transmit the program codes to the processor; The processor is configured to execute the method according to any one of claims 1 to 9 according to the instructions in the program code.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the method according to any one of claims 1 to 9.

16. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method according to any one of claims 1 to 9.