Named Entity Recognition Model Based on Multi-task Learning and Attention Mechanism
By integrating the multi-head cross-attention named entity recognition model, the problems of insufficient boundary supervision and difficulty in parameter optimization in nested entity recognition are solved, the accuracy and generalization ability of named entity recognition are improved, and the understanding of complex text is enhanced.
Patent Information
- Application Number
- CN202311450661.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2043-11-02
AI Technical Summary
Existing named entity recognition models have problems with error propagation and difficulty in parameter optimization when dealing with nested entities. Especially when the input sentence is too long or there are many entity categories, it is difficult for traditional sequence annotation methods to effectively identify nested entities, and there is a lack of span-based methods. Obvious boundary supervision leads to high precision and low recall.
A named entity recognition model that integrates multi-head cross-attention is adopted. Through the embedded representation module, shared feature representation module, multi-head cross-attention module and multi-task learning module, the boundary supervision and the dependence of the head-to-tail span are enhanced to capture deep semantic information, including BERT embedding, character embedding, word embedding, Bi-LSTM and multi-head cross-attention mechanism, combined with entity span classification and boundary detection modules for multi-task learning.
It improves the accuracy and generalization ability of named entity recognition, enhances the ability to process long-distance dependencies, captures feature information of different granularities, enhances boundary supervision, and improves the model's robustness and ability to understand complex texts. .
Smart Images

Figure CN118114667B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer natural language intelligent processing, and in particular to a named entity recognition model based on multi-task learning and attention mechanism. Background Art
[0002] Named entity recognition refers to the identification of entities with specific meanings in text, including place names, organization names, personal names, etc. Currently, named entity recognition methods mainly use various deep learning models to realize entity recognition in text, which can extract deeper text features and improve the expression ability of related features. At the same time, it abandons the shortcomings of traditional manual methods such as complex operations and poor extraction effects, and realizes efficient and automatic feature extraction. Through the designed network structure training model, the deep semantics of the text is learned, which improves the performance of named entity recognition.
[0003] Named entities are mainly studied for flat entities (Flat NER) and nested entities (Overlap NER). In the past, named entity recognition tasks were mainly flat entity recognition, which was modeled as a character-level sequence labeling task, that is, for a string of input character sequences, the named entity recognition model needs to predict the named entity label corresponding to each character. For example: "It is sunny and windy in Haidian District today." If the downstream task needs to extract the entity of the place type, "Haidian District" should be recognized as the place entity. In other words, the process of extracting the specified type of entity through the learning of the machine learning model by annotating the entity label set in advance is called the sequence labeling task of entity recognition. In the process of named entity recognition tasks, many entities may be nested, that is, a certain entity type also contains multiple other entity types. For example, the sentence "Pay attention to exclude tuberculosis" only contains the flat entity "tuberculosis", while the sentence "Patients with respiratory center involvement" "Respiratory center damage" entity also includes "respiratory center" entity to form a nested form.
[0004] Nested entities have a complex hierarchical structure, which is difficult to be effectively solved by traditional flat entity recognition methods. To address the problem of nested named entity recognition, a span-based named entity recognition method is proposed, which obtains all possible spans of potential entities and classifies spans. The model can easily detect nested entities in different subsequences. However, the span-based method focuses on learning head-tail representations and lacks obvious boundary supervision, resulting in many entity spans not being accurately recognized, causing the model to have a high precision and low recall problem. In addition, it also ignores the dependency relationship between the head and tail span information of the entity to a certain extent.
[0005] Prior art 1
[0006] Ju et al. [1]A stacked LSTM-CRF model is proposed to predict nested named entities, and the nested entities are recognized by dynamically stacking flat NER layers. Katuyar and Cardie [2] Lu and Roth used their proposed recurrent neural network-based approach to handle nested named entity recognition; [3] Introduced a hypergraph structure for learning nested named entities; Wang and Lu [4] Neural segmented hypergraphs are further proposed to solve the nested entity recognition problem.
[0007] Disadvantages of the prior art 1
[0008] Using traditional sequence labeling methods for nested entities has the problem of error propagation. When the input sentence is too long or there are many entity categories in the hypergraph-based model, the hypergraph structure will become complicated, making parameter optimization difficult.
[0009] Prior art 2
[0010] Span-based methods are another state-of-the-art approach to unified named entity recognition. The idea of this type of method is to list all possible spans and classify them. Luan et al. [5] The span model introduced a general framework for several information extraction tasks that share span representations using dynamically constructed span graphs; Sohrab and Miwa et al. [6] By enumerating all possible regions or spans of potential entities and classifying them using a deep neural network; Yu et al. [7] We propose ideas from graph-based dependency parsing to provide the model with a global view of the input through a bi-affine mechanism, scoring the start and end token pairs in a sentence, using the tokens to explore all spans so that the model can accurately predict named entities.
[0011] Disadvantages of the second prior art
[0012] The span-based approach focuses on learning the head-tail representation, which results in a lack of obvious boundary supervision in the model and is easily affected by the wrong boundary during training. In addition, as the length of the entity changes, the dependency between the information will slowly decay, making it difficult to retain all the useful information, resulting in a weakened connection between the head-tail span of the entity.
[0013] References
[0014] [1]Meizhi Ju,Makoto Miwa,and Sophia Ananiadou.2018.A neural layeredmodel for nested named entity recognition.In Proceedings of the 2018Conference of the North American Chapter of the Association for ComputationalLinguistics:Human Language Technologies,V olume 1(Long Papers),pages1446–1459;
[0015] [2]Arzoo Katiyar and Claire Cardie.2018.Nested named entityrecognition revisited.In Proceedings of the 2018 Conference of the NorthAmerican Chapter of the Association for Computational Linguistics:HumanLanguage Technologies,V olume 1(Long Papers),pages 861–871,New Orleans,Louisiana.As sociation for Computational Linguistics;
[0016] [3]Wei Lu and Dan Roth.2015.Joint mention extraction andclassification with mention hypergraphs.In Proceedings of the 2015 Conferenceon Empirical Methods in Natural Language Processing,pages 857–867;
[0017] [4]Bailin Wang and Wei Lu.2018.Neural segmental hypergraphs foroverlapping mention recognition.In Proceedings of the 2018 Conference onEmpirical Methods in Natural Language Processing,pages204–214;
[0018] [5]Yi Luan,Dave Wadden,Luheng He,Amy Shah,Mari Ostendorf,and HannanehHajishirzi.2019.A general framework for information extraction using dynamicspan graphs.In Proceedings of the 2019 Conference of the North AmericanChapter of the Association for Computational Linguistics:Human LanguageTechnologies,V olume 1(Long and Short Papers),pages3036–3046,Minneapolis,Minnesota.Association for Computational Linguistics;
[0019] [6]Mohammad Golam Sohrab and Makoto Miwa.2018.Deep exhaustive modelfor nested named entity recognition.In Proceedings of the 2018 Conference onEmpirical Methods in Natural Language Processing,pages 2843–2849;
[0020] [7]Yu J,Bohnet B,Poesio M.Named Entity Recognition as DependencyParsing[J].arXiv preprint arXiv:2005.07150,2020;
[0021] [8]Kantor B,Globerson A.Coreference Resolution with EntityEqualization:Proceedings of the 57th Annual Meeting of the Association forComputational Linguistics[C]. / / ,2019;
[0022] [9]Zhang X,Zhao J,LeCun Y.Character-level convolutional networks fortext classification[J].Advances in neural information processing systems,2015,28;
[0023]
[10] Armand Joulin,Edouard Grave,Piotr Bojanowski,et al.Bag of Tricksfor Efficient Text Classification[J].CoRR,2016,abs / 1607.01759;
[0024]
[11] Guillaume Lample,Miguel Ballesteros,Sandeep Subramanian,etal.Neural Architectures for Named Entity Recognition[J].CoRR,2016,abs / 1603.01360;
[0025]
[12] WANG Q,ZHOU Y M,TONG R,et al.Incorporating dictionaries into deepneural networks for the chinese clinical named entity recognition[J].Journalof Biomedical Informatics,2019,92:103-133;
[0026]
[13] Kim J D,Ohta T,Tsuruoka Y,et al.Introduction to the bio-entityrecognition task at JNLPBA[C] / / Proceedings of the international jointworkshop on natural language processing in biomedicine and itsapplications.2004:70-75;
[0027]
[14] Kim J-D,Ohta T,Tateisi Y,Tsujii J.GENIA corpus--semanticallyannotated corpus for biotextmining[J].Bioinformatics(Oxford,England),2003,19Suppl 1;
[0028]
[15] Doddington G R,Mitchell A,Przybocki M A,et al.The automaticcontent extraction(ace)program-tasks,data,and evaluation[C] / / Lrec.2004,2(1):837-840;
[0029]
[16] Srivastava N,Hinton G,Krizhevsky A,et al.Dropout:a simple way toprevent neural networks from overfitting[J].The Journal of Machine LearningResearch.2014.1929–1958;
[0030]
[17] Kingma DP,Ba J.Adam:A method for stochastic optimization[J].arXiv preprint arXiv:1412.6980,2014. Summary of the invention
[0031] In view of the defects of the prior art, the present invention provides a named entity recognition model and system integrating multi-head cross attention, enhancing boundary supervision and improving the dependency of head-tail span, capturing semantic information with deep meaning from the text and realizing the understanding of various texts.
[0032] In order to achieve the above invention object, the technical solution adopted by the present invention is as follows:
[0033] A named entity recognition model integrating multi-head cross attention, including: an embedding representation module, a shared feature representation module, a multi-head cross attention module and a multi-task learning module;
[0034] The embedding representation module includes three word vectors, namely: BERT embedding module, character embedding module and word embedding module;
[0035] The BERT embedding module learns rich semantic information through the pre-trained language model to obtain the context-dependent embedding of the target token. In the BERT embedding module, the input sentence is embedded in words, sentences, and positions to obtain the embedding vector of each token. By concatenating these embedding vectors, the context-dependent embedding of the target token can be obtained;
[0036] The character embedding module uses character-level convolutional neural networks (Char-CNN) to encode and map words to character-level vector representations. Specifically, the input text is converted into character encodings, and character-level features are extracted through a one-dimensional convolution operation. Then, a fixed-dimensional character vector is obtained through a maximum pooling operation. Character embedding can capture the structural information within a word, which is particularly effective for uncommon words or misspelled words.
[0037] The word embedding module maps each word to a vector representation. Use a pre-trained word vector model to obtain the word embedding. Word embedding can capture the semantic information of words, which is particularly important for named entity recognition tasks.
[0038] The shared feature representation module includes: a bidirectional long short-term memory network layer (Bi-directional LongShort Term Memory, Bi-LSTM) and a head-tail span representation layer.
[0039] Bi-LSTM: Its function is to obtain more comprehensive semantic information. Bi-LSTM consists of forward LSTM and backward LSTM. The LSTMs in the two directions are connected in series to obtain bidirectional word vector information. Bi-LSTM is used to model the context information of sentences. For each sentence, the representations from left to right and from right to left are calculated separately.
[0040] Head-tail span representation layer: Based on the output of the Bi-LSTM layer, two multi-layer perceptrons (MLPs) are used in each hidden layer h before entering the next layer. t Two different representations (s, e) are created to represent the start and end spans of the entity. s represents the entity header information, and e represents the entity tail information.
[0041] The multi-head cross attention module is used to extract important information from long texts and realize information integration and interaction through a multi-head attention mechanism.
[0042] The multi-task learning module model includes two sub-modules: an entity span classification module and an entity boundary detection module. These two modules work together to improve the accuracy and effect of entity recognition through multi-task learning.
[0043] The entity span classification module uses a biaffine mechanism to obtain context information and uses a score matrix to determine the entity category. The category score of each entity segment is calculated, and the category with the highest score is taken as its predicted category. Then, Softmax combined with cross entropy loss is used to learn the model.
[0044] The entity boundary detection module is used to assist in entity category prediction and identify entity boundaries through sequence labeling. It takes the head and tail span representation as input and uses the rectified linear unit (ReLU) activation function and the Softmax classifier to predict the boundary label. The model is trained by calculating the loss between the true distribution and the predicted distribution.
[0045] The total loss of the named entity recognition model consists of the sum of the loss of the entity span classification module and the loss of the entity boundary detection module. The gradient is calculated based on the total loss and the model parameters are updated.
[0046] Finally, the trained named entity recognition model is used to predict the unlabeled text sentences to obtain the named entity label of each word.
[0047] Furthermore, the input of the BERT embedding module consists of three embedding vectors, namely: word embedding, sentence embedding and position information embedding.
[0048] Word embedding: For each word in the input sentence of the BERT embedding module, it is converted into a vector representation through word embedding. Each word is mapped to a vector of fixed dimension. The BERT embedding module uses these word embedding vectors as part of the input.
[0049] Sentence embedding: For the input sentences of the BERT embedding module, including two or more sentences, for each word, the sentence embedding will mark it as belonging to a certain sentence. This enables the BERT embedding module to distinguish the same words in different sentences.
[0050] Position information embedding: The position information embedding vector contains the relative position information of each word in the sentence, which can obtain the sequential order of words in the sentence so as to understand the order in which the words appear.
[0051] The input of the BERT embedding module is a summation operation of the word embedding vector, the sentence embedding vector, and the position information embedding vector, and a marker is added to mark the beginning of the sentence and separate the two sentences. Such a structure can keep the dimension size of the input vector the same and provide comprehensive information about sentences, words, and positions so that the BERT model can better understand and process text data.
[0052] Furthermore, the word embedding module uses the pre-trained word vectors of FastText. Represents the word embedding vector representation of the sentence at the tth moment. After obtaining the character vector, word vector and context representation, the mapped results are concatenated and sent to the next network. For a sentence consisting of t tokens, the output sequence vector is:
[0053]
[0054] Among them, t represents the current time, [;] represents connection, Represent the three embedding vectors at time t, X t Represents the output vector at the current time t.
[0055] Furthermore, the head-tail span representation layer is specifically the softmax function of the MLP s and MLP e The output of is normalized to obtain the head-tail span representation of the entity. The specific formula is as follows:
[0056] s(t)=softmax(MLP s (h t )) (2)
[0057] e(t)=softmax(MLP e (h t )) (3)
[0058] e Input the encoded representation into the classifier to detect whether the word is the beginning or end of the entity, and generate span representations carrying the entity head and tail information respectively. s(t) and e(t) are the head and tail span representations of the entity respectively. For a tag pair such as (s(t), e(t)), each such tag pair is input into the following network for related tasks.
[0059] Furthermore, the process of the multi-head cross attention module is as follows:
[0060] The (s(t), e(t)) tag pair generated by the shared feature representation module is expressed in the form of Q, K, and V. If K and V represent the head information, Q represents the tail information. Conversely, if Q represents the head information, K and V represent the tail information.
[0061] Further divide Q, K, and V into multiple heads to obtain Q_, K_, and V_;
[0062] Calculate the attention scores of Q_, K_, and V_. The formula is as follows:
[0063]
[0064]
[0065] Among them, d k Represents the dimension of the attention head.
[0066] The attention results of each head are spliced together, and the formula is as follows:
[0067] MultiHead(s)=Concat(head1,...,head h )W s (6)
[0068] Among them, i represents the current moment, MultiHead(s) represents the number of s A linear transformation is performed to obtain the final multi-head attention value, which is the beginning representation that incorporates the end information of the entity.
[0069] Furthermore, the specific process of the entity span classification module is as follows:
[0070] 1) According to the input text sentence, obtain the head and tail span representations represented by MultiHead(s) and MultiHeads(e) obtained in the previous step.
[0071] 2) For each entity segment i, calculate the score of each entity category that the segment can constitute according to formula (7);
[0072]
[0073] r m Provides all possible segments that can constitute a named entity category score under the condition that the head is before the tail. s (i) and MultiHead e (i) indicates the head and tail of segment i, U m Indicates the posterior probability of the entity category of the current word being both the head and the tail, W m Indicates the posterior probability of the entity category of the current word being the head or tail, b m Indicates the prior probability of not knowing what entity category it is, r m (i) represents the category scores of all possible segments that currently constitute the named entity.
[0074] 3) According to the score calculation formula (8), the category with the highest score is obtained as the category predicted for each span:
[0075] y′(i)=argmaxr m (i) (8)
[0076] 4) Use the Softmax function to calculate the probability value of the category score of each segment. The formula is as follows:
[0077]
[0078] 5) Calculate the loss of the span classification module for multiple entity fragments as follows:
[0079]
[0080] Among them, N represents the length of the sentence, C represents the number of entity tag types, and y represents the actual tag type of the current word. If the current category is c, then y ic =1, otherwise 0. m (i c ) is the output of the neural network, and finally the loss loss of the span classification module is obtained. b .
[0081] Furthermore, the specific process of the entity boundary detection module is as follows:
[0082] 1) According to the input text sentence, obtain the head and tail span representations represented by MultiHead(s) and MultiHead(e) obtained in the previous step.
[0083] 2) Using the bi-affine mechanism, the features represented by the head and tail spans are combined to obtain the input features of the boundary detection module, as shown in the following formula:
[0084] O(t)=U(s,e)+b (11)
[0085] 3) Use the rectified linear unit (ReLU) activation function and the Softmax classifier to classify the input features to predict the boundary label, as follows:
[0086] d(t)=softmax(O(t)) (12)
[0087] 4) Calculate the loss between the true distribution d^(t) and the predicted distribution d(t) using the cross entropy loss function as follows:
[0088]
[0089] Since the model shares the same entity boundaries when performing entity boundary detection and entity category judgment, the losses of the two tasks of entity boundary detection and entity span classification are jointly trained. During the training phase, the real entity boundary labels of the data are input into the model to train the entity boundary detection classifier to avoid the classifier being affected by incorrect boundary detection during training. During the testing phase, the output of the boundary detection classifier is used to indicate which entity fragments should be considered when predicting the classification label.
[0090] Furthermore, the total loss of the named entity recognition model is defined as follows:
[0091] Multi_Loss=loss b +αloss d (14)
[0092] α is a hyperparameter, which is used as a mixing ratio parameter to control the introduction of information to control the importance between the two losses of entity boundary detection and entity category judgment. In the future, we will conduct ablation experiments on α and select a suitable α to improve model performance.
[0093] The present invention also discloses a method for named entity recognition, which is implemented based on the above-mentioned named entity recognition model, and the specific steps are as follows:
[0094] 1) Initialize model parameters.
[0095] 2) Traverse each sentence of the original dataset:
[0096] 2.1) Use the BERT embedding module to obtain the contextual representation of the sentence
[0097] 2.2) The character embedding module uses Char-CNN network coding to obtain the character vector of the sentence
[0098] 2.3) Use the word embedding module to obtain the word vector of the sentence
[0099] 2.4) Concatenate to get the input feature vector X of the sentence t .
[0100] 3) Traverse each input feature vector X t :
[0101] 3.1) Input feature vector X t Enter the Bi-LSTM layer and get the output vector ht.
[0102] 3.2) Use two multi-layer perceptrons on the output vector ht to obtain the named entity start label s(t) and end label e(t).
[0103] 4) Traverse each named entity start tag s(t) and end tag e(t):
[0104] 4.1) Use the multi-head cross attention module to obtain the multi-head attention representation MultiHead s (i) and MultiHead e (i).
[0105] 4.2) Enter the training loop of named entity recognition model parameters.
[0106] 4.3) Input multi-head attention representation MultiHead s (i) and MultiHead e (i) Enter the dual affine network training and get the boundary loss loss b .
[0107] 4.4) Input multi-head attention representation MultiHead s (i) and MultiHead e (i) Enter the boundary detection module training and obtain the boundary loss loss d .
[0108] 4.5) Calculate multi-position loss Multi_Loss = loss b +αloss d .
[0109] 4.6) Calculate the gradient according to Multi_Loss and update the model parameters.
[0110] 5) Return the trained named entity recognition model.
[0111] 6) The named entity recognition model is used to predict the unlabeled text sentences and obtain the named entity label of each word.
[0112] Compared with the prior art, the advantages of the present invention are:
[0113] 1. Improve information interaction capabilities: The present invention can effectively capture the association information between different positions in the input sequence, so that the model can better understand the context information. By fusing multi-head cross attention, the model can better utilize the context information at different positions for named entity recognition, thereby improving the accuracy of the model.
[0114] 2. Handling long-distance dependencies: This invention can help the model capture long-distance dependencies, especially when processing longer input sequences. In named entity recognition tasks, it is often necessary to rely on distant contextual information to determine the boundaries and categories of entities. Fusion of multi-head cross attention can help the model better handle such long-distance dependencies and improve the accuracy of named entity recognition.
[0115] 3. Strengthening feature representation at different granularities: The present invention can consider feature representation at different granularities (heads) at the same time. Different heads can focus on different contextual information, thereby providing diversified feature representation. This helps the model obtain more comprehensive and rich feature information at different levels, improving the performance of named entity recognition.
[0116] 4. Improve the generalization ability of the model: This invention helps the model learn more robust and generalized feature representations. By integrating multi-head attention, the model can focus on the contextual information at different positions in the input sequence, thereby reducing the dependence on specific positions and overfitting. This helps improve the generalization ability of the model for different contexts and text styles.
[0117] 5. Enhanced boundary supervision: The named entity recognition model that integrates multi-head cross attention classifies the learned head and tail spans through a dual affine model, and adds an additional boundary detection task to predict the words at the entity boundary. This design can enhance the supervision of entity boundaries and improve the accuracy and robustness of boundaries.
[0118] 6. Improve the dependency between the head and tail span: By introducing the multi-head cross attention mechanism in the Transformer model, the named entity recognition model integrating multi-head cross attention can capture the deep meaning and dependency between the head and tail. This helps to achieve a more comprehensive and in-depth understanding of various texts and improve the performance of the named entity recognition model.
[0119] 7. Capture semantic information with deep meaning: By splicing head-tail information and enhancing the interaction between head and tail information, the named entity recognition model integrating multi-head cross attention can better capture the contextual semantic information between the head and tail. This is very important for understanding the semantic boundaries and semantic roles of entities, thereby improving the model's ability to understand the deep meaning in complex texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0120] Figure 1 It is a schematic diagram of the structure of a named entity recognition model according to an embodiment of the present invention.
[0121] Figure 2 It is a schematic diagram of the input representation structure of BERT according to an embodiment of the present invention.
[0122] Figure 3 It is a schematic diagram of the structure of the multi-head cross attention module implemented in the present invention.
[0123] Figure 4 It is a schematic diagram of the structure of the entity span score matrix implemented in the present invention. DETAILED DESCRIPTION
[0124] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and examples.
[0125] like Figure 1 As shown in the figure, a named entity recognition model integrating multi-head cross attention (Multi-tasklearning-Biaffine mechanism-Multi-head cross attention, MTL-BAM-HCA) includes the following modules: an embedding representation module, a shared feature representation module, a multi-head cross attention module and a multi-task learning module.
[0126] 1. Embedding Representation Module
[0127] In the embedding representation module, it is mainly composed of three word vectors. One is to use the method followed by BERT to obtain the context-related embedding of the target token; one is to use the character-level convolutional neural network (Char-Convolutional Neural Networks, Char-CNN) to encode the character-level vector; the other is to use FastText to obtain the word vector representation.
[0128] (1) BERT Embedding
[0129] BERT passes each word in the input sentence through the word embedding layer and converts it into a vector representation. In order to keep the size of the vector dimension the same, padding operations are performed on training texts of different lengths before word embedding, so that the length of each training text is made the same by taking advantage of the strengths and making up for the weaknesses. In addition to word embedding, BERT's input also contains two embedding layers: one is sentence embedding, which is used to distinguish whether the current word belongs to sentence A or sentence B; the other is position information embedding, which obtains the relative position information of the sentence context and clearly expresses the sequence order of each word in the sentence. The input of BERT consists of the sum of the above three embedding vectors, and the structure is as follows: Figure 2 As shown. Set the [CLS] and [SEP] flags for each input text, [CLS] is used to mark the beginning of a sentence, and [SEP] is used to distinguish two sentences.
[0130] (2)Char-CNN character embedding
[0131] The character embedding layer uses Char-CNN network coding to map words into character-level vector representations. The specific approach is: the input text is constructed into character encoding, transmitted to the one-dimensional Convolutional Neural Networks (CNN) model, and after one-dimensional convolution, it is output with a specific width and then maximum pooled to obtain a character vector representation with a specific dimension.
[0132] (3) FastText word embedding
[0133] Word embedding also maps each word into a vector. This example uses the pre-trained word vectors from FastText. Represents the word embedding vector representation of the sentence at the tth moment. After obtaining the character vector, word vector and context representation, the mapped results are concatenated and sent to the next network. For a sentence consisting of t tokens, the output sequence vector is:
[0134]
[0135] Among them, t represents the current time, [;] represents connection, Represent the three embedding vectors at time t, X t Represents the output vector at the current time t.
[0136] 2. Shared Feature Representation Module
[0137] (1) Bidirectional long short-term memory network layer
[0138] The shared feature representation module first obtains the vector output by BERT and other networks through the bidirectional long short-term memory network layer (Bi-directional Long Short Term Memory, Bi-LSTM), thereby obtaining more comprehensive semantic information. Long Short Term Memory (LSTM) can effectively solve the gradient disappearance or gradient explosion phenomenon in recurrent neural networks. [8] . Bi-LSTM is composed of a forward LSTM and a backward LSTM. The LSTMs in the two directions are connected in series to obtain bidirectional word vector information. This embodiment uses a Bi-LSTM structure to model context information. After obtaining the embedding vector of the embedding layer, Bi-LSTM simulates the contextual time interaction of the sentence. For each sentence, the representations of the two orders from left to right and from right to left are calculated respectively.
[0139] (2) Head-tail span representation
[0140] The head-tail span table module is based on the output of the Bi-LSTM layer. Before entering the next layer, t Two multilayer perceptrons (MLP) are used to create two different representations (s, e) as the start and end of the entity span. s carries information to identify the head of the entity, and e carries information to identify the tail of the entity, removing other redundant information. This improves accuracy compared to the model that directly uses the LSTM output because the start and end contexts of the entity are different. The MLP layer uses a smaller dimensional output, which can reduce the dimensionality of the LSTM output before inputting it into the affine layer to avoid overfitting.
[0141] s(t)=softmax(MLP s (h t )) (2)
[0142] e(t)=softmax(MLP e (h t )) (3)
[0143] e Input the encoded representation into the classifier to detect whether the word is the beginning or end of the entity, and generate span representations carrying the entity head and tail information respectively. s(t) and e(t) are the head and tail span representations of the entity respectively. For a tag pair such as (s(t), e(t)), each such tag pair is input into the following network for related tasks.
[0144] 3. Multi-head Cross-Attention Module
[0145] In long texts, the performance of LSTM decays over time as the number of steps of the current input to the model increases, making it difficult to retain all useful information.
[0146] The multi-head attention mechanism enables the model to focus on important information. The essence of the multi-head idea is to calculate each independent attention, and to learn the interactive information between text, questions, and answers. Multi-heads have an integrated function to prevent overfitting. For the (s(t), e(t)) tag pair generated by the previous module, this module uses multi-head cross attention instead of splicing to fuse the information between the beginning and the end of the tag, and play the role of head-tail information interaction. The specific model is as follows Figure 3 shown.
[0147] Q, K and V come from different layers. If K and V represent header information, Q represents tail information, and vice versa. Figure 3 This is the model flow when K and V represent the beginning of the entity and Q represents the end of the entity. When the beginning of the entity is represented by K and V and the end of the entity is represented by Q, the beginning of the entity carries the relevant information of the end of the entity. For the upper layer input (s(t), e(t)), it is represented in the form of Q, K, V, and then further divided into multiple forms to form Q_, K_, V_ as shown in the figure. Calculate the attention score for each Q_, K_, V_ after division:
[0148]
[0149]
[0150] The updated vector is obtained by concatenating each head calculated by self-attention:
[0151] MultiHead(s)=Concat(head1,...,head h )W s (6)
[0152] Among them, i represents the current moment, MultiHead(s) represents the number of s A linear transformation is performed to obtain the final multi-head attention value, which is the beginning representation that incorporates the end information of the entity.
[0153] 4. Multi-task learning module
[0154] There are two submodules in the MTL-BAM-HCA model: entity boundary detection module and entity span classification module. The following introduces the two modules respectively:
[0155] (1) Entity span classification module
[0156] In the entity span classification module, after using the bi-affine mechanism to obtain MultiHead(s) and MultiHead(e) in the above text, the input is fed into the bi-affine network to obtain a score matrix.
[0157] As Figure 4 shown, it is the entity span matrix constructed for the entity span classification module. For the entity formed by taking "Hu" at the beginning and "Sun" at the end in "Respiratory center damage", the scores of all entity types included in the current dataset for this entity are calculated through the following formula. The entity type with the highest category score is the clinical manifestation, so "Respiratory center damage" is identified as the "Clinical manifestation" entity type. This is a classification problem with fixed categories, and the prior probabilities of the head and tail spans need to be considered simultaneously, as well as the posterior probability that a known word is in a certain category relationship as the head and tail, that is, the following formula:
[0158]
[0159] For entity segment i, r m provides the score of a named entity category that can be formed by all possible segments under the condition that the head is restricted to be before the tail. Among them, MultiHead s (i) and MultiHead e (i) represent the head and tail representations of segment i, obtained from the previous step. U m represents the posterior probability that the current word is the entity category of both the head and the tail. W m represents the posterior probability that the current word is the entity category of the head or the tail. b m represents the prior probability of not knowing what entity category it is. r m (i) represents the category scores of all possible segments that currently form a named entity. Then the category with the highest score is taken as the category predicted for each of its spans:
[0160] y′(i) = argmax r m (i) (8)
[0161] When calculating the scores, the model learns the head and tail spans with interdependent relationships, guiding the generation of accurate spans and span categories. Then, through the Softmax joint cross-entropy loss, the learning process of the model is realized:
[0162]
[0163] The loss of the model is:
[0164]
[0165] Among them, N represents the sentence length, C represents the number of entity label types, y represents the actual label type of the current word, and if the current category is c, then yic =1, otherwise 0. m (i c ) is the output of the neural network, calculated by the above formula, and finally the loss loss of the span classification module is obtained b .
[0166] (2) Entity Boundary Detection Module
[0167] When using the bi-affine mechanism for entity span classification, the introduction of head and tail span information can easily identify nested entities. However, the head and tail span learning makes the model lack clear boundary supervision, which reduces the number of accurate candidate entities learned and reduces the effect of entity recognition. Even for nested entities, the recognition of head and tail spans does not make the internal and external entities connected. The lack of accurate external boundary information will cause internal entity recognition errors and reduce the recognition effect. Therefore, a multi-task learning method is introduced to build a boundary detection module to assist entity category prediction. Boundary detection is actually a sequence labeling process. There are only two sequence transition states, and the classification level is the word level. This word contains the information of the context. The information of this word and its context is updated to the bi-affine mechanism at the same time.
[0168] After obtaining the head and tail span representation, the shared feature representation of multi-task learning is used as input, and the rectified linear unit (ReLU) activation function and Softmax classifier are used to predict the boundary label.
[0169] O(t)=U(s,e)+b (11)
[0170] d(t)=softmax(O(t)) (12)
[0171] For each token in the sentence, where U and b are trainable parameters, we compute the true distribution The loss equation between and predicted distribution d(t):
[0172]
[0173] Since the model shares the same entity boundaries when performing entity boundary detection and entity category judgment, the losses of the two tasks of entity boundary detection and entity span classification are jointly trained. During the training phase, the real entity boundary labels of the data are input into the model to train the entity boundary detection classifier to avoid the classifier being affected by incorrect boundary detection during training. During the testing phase, the output of the boundary detection classifier is used to indicate which entity fragments should be considered when predicting the classification label.
[0174] (3) Multi-task learning loss
[0175] Therefore, the total loss of the model is the sum of the losses of the two parts, and the total loss is defined as:
[0176] Multi_Loss=loss b +αloss d (14)
[0177] α is a hyperparameter, which is used as a mixing ratio parameter to control the introduction of information to control the importance between the two losses of entity boundary detection and entity category judgment. In the future, we will conduct ablation experiments on α and select a suitable α to improve model performance.
[0178] Use the boundary detection module to obtain the boundary information of the entity and obtain the internal and contextual information of the current entity. Multi-task learning learns richer features and optimizes the head and tail span representation through the back propagation of the loss function to improve the more accurate classification of the entity span. The acquisition of external information of nested entities improves the recognition effect of inner entities. At the same time, the inner entity information will also be passed into the boundary detection model through the multi-task model to reversely promote the effect of boundary detection.
[0179] By implementing the above process, the algorithm flow of the MTL-BAM-HCA model is as follows:
[0180] Input: original dataset
[0181] Output: Named Entity Recognition Model
[0182] 1: while (not all original data set sentences have been traversed) do
[0183] 2: Use the method followed by BERT to obtain contextual representation
[0184] 3: Use Char-CNN network encoding to get character vector
[0185] 4: Get the corresponding word vector through FastText
[0186] 5: Splice to get X t
[0187] 6: while (not all X_t^ have been traversed) do
[0188] 7: Input BiLSTM layer to get output ht
[0189] 8: Use two multilayer perceptrons to get s(t) and e(t) for ht
[0190] 9: while (not traversing all s(t), e(t)) do
[0191] 10: MultiHead cross attention processing to obtain MultiHead s (i) MultiHead e (i)
[0192] 11: while (named entity recognition model parameters have not converged) do
[0193] 12: while (not traversing all MultiHead s (i) MultiHead e (i))do
[0194] 13: Input the dual affine network training to get the loss loss b
[0195] 14: Input boundary detection module training to get loss loss d
[0196] 15: Multi_Loss = loss b +αloss d
[0197] V. Experiment
[0198] (1) Experimental environment parameter settings
[0199] This embodiment uses Windows system for experiments, based on Python platform, using pycharm as a development tool, and the model construction uses the deep learning framework Tensorflow. The MTL-BAM-HCA model proposed in this embodiment is experimented on two plane entity datasets JNLPBA and CoNLL2003 and three nested entity datasets GENIA, ACE2005, and ACE2004, and the experimental results are compared with other models that have achieved certain results in the named entity recognition task. The evaluation indicators used are precision P, recall R, and F value.
[0200] The kernel window size is [3,4,5], and the character vector dimension is 50. The public pre-trained word vector FastText is used in the word vector selection, and the word vector dimension is set to 300. The output dimension of the three layers of Bi-LSTM is set to 200, and the dimension of the two fully connected layers is set to 150. Reducing the LSTM output dimension can prevent overfitting. At the same time, to prevent overfitting, dropout is set for the Bi-LSTM layer and the MLP layer respectively. [9] is 0.4 and 0.2; the adaptive moment estimation optimizer (Adamoptimizer) is used during training
[10] As the optimizer for model parameter update, the number of heads of multi-head cross attention is set to 2, that is, K, V, Q are divided into 2 sub-domains and calculated separately, and then integrated; the dropout probability is set to 0.2. The learning rate is set to 0.001.
[0201] (2) Analysis of nested named entity recognition experimental results
[0202] In order to verify the effectiveness of MTL-BAM-HCA in the nested entity recognition task, MTL-BAM-HCA is compared with some existing neural network-based nested named entity recognition models on the GENIA, ACE2004, and ACE2005 nested datasets. The experimental comparison models include some of the nested entity recognition methods mentioned above and the method of Strakova et al. that uses a linearization scheme to encode nested labels, as shown in Tables 1, 2, and 3. Since the precision and recall rates of the experimental results are not shown in some models, the final comparison with other entity recognition models only uses the F1 result as a comparison.
[0203] Table 1 Comparison results with other models on the GENIA dataset
[0204]
[0205] Table 2 Comparison results with other models on the ACE2004 dataset
[0206]
[0207] On the GENIA, ACE2004, and ACE2005 datasets, MTL-BAM-HCA improves by 2.51%, 1.08%, and 1.06% respectively compared to the best Strakova method, and by 7.21%, 12.78%, and 14.86% respectively compared to the worst Ju method. Comparison with the above models verifies that the proposed MTL-BAM-HCA model has good performance in the nested entity recognition task, indicating that the method of introducing a multi-task learning framework, enhancing entity boundary supervision through a boundary detection module, and integrating a multi-head cross attention mechanism to enhance the head-tail dependency is effective in the nested entity recognition task.
[0208] Table 3 Comparison results with other models on the ACE2005 dataset
[0209]
[0210] (3) Analysis of experimental results of plane named entity recognition
[0211] The MTL-BAM-HCA model has been verified to be effective on nested entities. To illustrate the versatility of the model, experiments were conducted on the plane entity datasets JNLPBA and CoNLL2003. MTL-BAM-HCA was compared with other plane entity recognition models. The experimental results are shown in Table 4.
[0212] Table 4 Comparison results with other models on the NLPBA dataset
[0213]
[0214] The experimental results show that on the JNLPBA dataset, MTL-BAM-HCA improves the F1 value of the Song model by 1.28% and the F1 value of the Ju model by 6.22%, indicating that MTL-BAM-HCA has better performance than other models.
[0215] On the CoNLL2003 plane dataset, MTL-BAM-HCA is compared with other plane entity recognition models, and the experimental results are shown in Table 5.
[0216] The experimental results show that on the CoNLL2003 dataset, the F1 value of MTL-BAM-HCA is 2.69% higher than that of Lample model and 0.54% higher than that of Akbik model. This verifies that the MTL-BAM-HCA model has a good effect on the flat dataset CoNLL2003.
[0217] Compared with other models, the MTL-BAM-HCA model achieved relatively good results on both plane datasets, verifying that the model is effective and universal in the task of plane entity recognition.
[0218] Table 5 Comparison results with other models on the CoNLL2003 dataset
[0219]
[0220] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, models, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0221] The present invention is described with reference to flowcharts and / or block diagrams of methods, models, systems, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0222] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0223] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0224] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the implementation methods of the present invention, and should be understood that the protection scope of the present invention is not limited to such special statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A named entity recognition model integrating multi-head cross attention, characterized in that: include: Embedding representation module, shared feature representation module, multi-head cross attention module and multi-task learning module; The embedding representation module includes three word vectors, namely: BERT embedding module, character embedding module and word embedding module; The BERT embedding module learns rich semantic information through the pre-trained language model to obtain the context-dependent embedding of the target token; In the BERT embedding module, the input sentence is embedded in the word embedding, sentence embedding, and position information to obtain the embedding vector of each token; By concatenating these embedding vectors, we can get the context-dependent embedding of the target token; The character embedding module uses the character-level convolutional neural network Char-CNN to encode and map words into character-level vector representations. Specifically, the input text is converted into character encoding and character-level features are extracted through a one-dimensional convolution operation. Then, a fixed-dimensional character vector is obtained through a maximum pooling operation. The word embedding module maps each word into a vector representation; a pre-trained word vector model is used to obtain the word embedding of the word; The shared feature representation module includes: a bidirectional long short-term memory network layer Bi-LSTM and a head-tail span representation layer; Bi-LSTM: Its function is to obtain more comprehensive semantic information. Bi-LSTM consists of forward LSTM and backward LSTM. The LSTMs in the two directions are connected in series to obtain bidirectional word vector information. Bi-LSTM is used to model the contextual information of sentences. For each sentence, the representations from left to right and from right to left are calculated respectively. Head and tail span representation layer: Based on the output of the Bi-LSTM layer, two multi-layer perceptrons (MLPs) are used in each hidden layer h before entering the next layer. t Two different representations (s, e) are created to represent the start and end spans of the entity; s represents the entity header information, and e represents the entity tail information. The multi-head cross attention module is used to extract important information from a long text and realize information integration and interaction through a multi-head attention mechanism. The multi-head cross attention module processes the output of the head-tail span representation layer to obtain the head-tail span representation (s, e), and obtains the multi-head attention representation of the head-tail span; The entity span classification module uses a bi-affine mechanism to obtain contextual information and uses a score matrix to determine the entity category. It takes the multi-head attention representation of the head and tail span as input, calculates the category score of each entity segment, and takes the category with the highest score as its predicted category. It then uses Softmax combined with cross entropy loss to learn the model. The entity boundary detection module is used to assist entity category prediction and identify entity boundaries through sequence labeling. It takes the multi-head attention representation of the head and tail span as input and uses the rectified linear unit ReLU activation function and Softmax classifier to predict boundary labels. The model is trained by calculating the loss between the true distribution and the predicted distribution. The total loss of the named entity recognition model is composed of the sum of the loss of the entity span classification module and the loss of the entity boundary detection module. The gradient is calculated based on the total loss and the model parameters are updated; Finally, the trained named entity recognition model is used to predict the unlabeled text sentences to obtain the named entity label of each word.
2. A named entity recognition model integrating multi-head cross attention according to claim 1, characterized in that: The input of the BERT embedding module consists of three embedding vectors: word embedding, sentence embedding, and position information embedding; Word embedding: For each word in the input sentence of the BERT embedding module, it is converted into a vector representation through word embedding; each word is mapped to a vector of fixed dimension; Sentence embedding: For the input sentences of the BERT embedding module, including two or more sentences, for each word, the sentence embedding will mark it as belonging to a certain sentence; Position information embedding: The position information embedding vector contains the relative position information of each word in the sentence, which can obtain the sequence order of words in the sentence so as to understand the order in which words appear; The input of the BERT embedding module is a summation operation of the word embedding vector, the sentence embedding vector, and the position information embedding vector, and a marker is added to mark the beginning of the sentence and separate two sentences.
3. A named entity recognition model integrating multi-head cross attention according to claim 1, characterized in that: The word embedding module uses FastText's pre-trained word vectors; Represents the word embedding vector representation of the sentence at the tth moment; After obtaining the character vector, word vector, and context representation, the mapped results are concatenated and fed into the next network; for a sentence consisting of t tokens, the sequence vector is output: Among them, t represents the current time, [;] represents connection, Represent the three embedding vectors at time t, X t Represents the output vector at the current time t.
4. A named entity recognition model integrating multi-head cross attention according to claim 1, characterized in that: The head and tail span representation layer is specifically the softmax function of MLP s and MLP e The output of is normalized to obtain the head-tail span representation of the entity. The specific formula is as follows: s(t)=softmax(MLP s (h t )) (2) e(t)=softmax(MLP e (h t )) (3) e Input the encoded representation into the classifier to detect whether the word is the beginning or end of the entity, and generate span representations carrying the entity head and tail information respectively; s(t) and e(t) are the head and tail span representations of the entity respectively; for such a tag pair (s(t), e(t)), each such tag pair is input into the following network to perform related tasks.
5. A named entity recognition model integrating multi-head cross attention according to claim 4, characterized in that: The process of the multi-head cross attention module is as follows: The (s(t), e(t)) tag pair generated by the shared feature representation module is represented in the form of Q, K, and V. If K and V represent the head information, Q represents the tail information. Conversely, if Q represents the head information, K and V represent the tail information. Further divide Q, K, and V into multiple heads to obtain Q_, K_, and V_; Calculate the attention scores of Q_, K_, and V_. The formula is as follows: Among them, d k represents the dimension of the attention head; The attention results of each head are spliced together, and the formula is as follows: MultiHead(s)=Concat(head1,...,head h )W s (6) Among them, i represents the current moment, MultiHead(s) represents the number of s A linear transformation is performed to obtain the final multi-head attention value, which is the beginning representation that incorporates the end information of the entity.
6. A named entity recognition model integrating multi-head cross attention according to claim 5, characterized in that: The specific process of the entity span classification module is as follows: 1) According to the input text sentence, obtain the head and tail span representations represented by MultiHead(s) and MultiHead(e) obtained in the previous step; 2) For each entity segment i, calculate the score of each entity category that the segment can constitute according to formula (7); r m Provides all possible segments that can constitute a named entity category score under the condition that the head is before the tail; s (i) and MultiHead e (i) indicates the head and tail of segment i, U m Indicates the posterior probability of the entity category of the current word being both the head and the tail, W m Indicates the posterior probability of the entity category of the current word being the head or tail, b m Indicates the prior probability of not knowing what entity category it is, r m (i) represents the category scores of all possible segments that currently constitute the named entity; 3) According to the score calculation formula (8), the category with the highest score is obtained as the category predicted for each span: y′(i)=argmaxr m (i) (8) 4) Use the Softmax function to calculate the probability value of the category score of each segment. The formula is as follows: 5) Calculate the loss of the span classification module for multiple entity fragments as follows: Among them, N represents the length of the sentence, C represents the number of entity tag types, and y represents the actual tag type of the current word. If the current category is c, then y ic =1, otherwise 0; p m (i c ) is the output of the neural network, and finally the loss loss of the span classification module is obtained. b .
7. A named entity recognition model integrating multi-head cross attention according to claim 6, characterized in that: The specific process of the entity boundary detection module is as follows: 1) According to the input text sentence, obtain the head and tail span representations represented by MultiHead(s) and MultiHead(e) obtained in the previous step; 2) Using the bi-affine mechanism, the features represented by the head and tail spans are combined to obtain the input features of the boundary detection module, as shown in the following formula: O(t)=U(s,e)+b (11) 3) Use the rectified linear unit (ReLU) activation function and the Softmax classifier to classify the input features to predict the boundary label, as follows: d(t)=softmax(O(t)) (12) 4) Calculate the loss between the true distribution d^(t) and the predicted distribution d() using the cross entropy loss function as follows: Since the model shares the same entity boundary when performing entity boundary detection and entity category judgment, the losses of the two tasks of entity boundary detection and entity span classification are jointly trained; During the training phase, the real entity boundary labels of the data are input into the model to train the entity boundary detection classifier to prevent the classifier from being affected by incorrect boundary detection during training; during the testing phase, the output of the boundary detection classifier is used to indicate which entity fragments should be considered when predicting the classification label.
8. A named entity recognition model integrating multi-head cross attention according to claim 7, characterized in that: The total loss of the named entity recognition model is defined as follows: Multi_Loss=loss b +αloss d (14) α is a hyperparameter, which is used as a mixing ratio parameter to control the introduction of information to control the importance of the two losses of entity boundary detection and entity category judgment. In the future, ablation experiments will be conducted on α to select a suitable α to improve model performance.
9. A method for named entity recognition, characterized in that: The method is implemented based on the named entity recognition model described in any one of claims 1 to 8, and the specific steps are as follows: 1) Initialize model parameters; 2) Traverse each sentence of the original dataset: 2.1) Use the BERT embedding module to obtain the contextual representation of the sentence 2.2) The character embedding module uses Char-CNN network coding to obtain the character vector of the sentence 2.3) Use the word embedding module to obtain the word vector of the sentence 2.4) Concatenate to get the input feature vector of the sentence 3) Traverse each input feature vector 3.1) Input feature vector Enter the Bi-LSTM layer and get the output vector ht; 3.2) Use two multi-layer perceptrons on the output vector ht to obtain the named entity start label s(t) and end label e(t); 4) Traverse each named entity start tag s(t) and end tag e(t): 4.1) Use the multi-head cross attention module to obtain the multi-head attention representation MultiHead s (i) and MultiHead e (i); 4.2) Enter the training loop of named entity recognition model parameters; 4.3) Input multi-head attention representation MultiHead s (i) and MultiHead e (i) Enter the dual affine network training and get the boundary loss loss b ; 4.4) Input multi-head attention representation MultiHead s (i) and MultiHead e (i) Enter the boundary detection module training and obtain the boundary loss loss d ; 4.5) Calculate multi-position loss Multi_Loss = loss b +αloss d ; 4.6) Calculate the gradient according to Multi_Loss and update the model parameters; 5) Return the trained named entity recognition model; 6) The named entity recognition model is used to predict the unlabeled text sentences and obtain the named entity label of each word.
Citation Information
Patent Citations
Electronic medical record similarity retrieval method fusing cross knowledge attention
CN114550856A
Entity relationship extraction method and system based on cross-granularity cross attention fusion
CN115391556A
Nested named entity recognition method based on multi-head three-affine attention mechanism
CN116090460A
Small sample named entity identification method for entity level information enhanced prototype representation
CN116451691A
Named entity recognition model training method, named entity recognition method and named entity recognition device
CN116579345A
