Graph Relation Extraction Method Based on Pre-training Model Enhancement

By adopting the group suspension labeling method based on the pre-trained model in the medical knowledge graph, the problems of large calculation amount and low representation efficiency in the existing technology are solved, efficient relationship extraction is achieved, and the accuracy and efficiency of the relationship extraction in the medical knowledge graph are improved. .

CN118428471BActive Publication Date: 2024-09-24湖南董因信息技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410876214.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-24
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

Existing medical knowledge graph relationship extraction methods require large amounts of calculations, low computational efficiency, and low floating mark representation efficiency, which hinders the research and implementation of algorithms.

Method used

The grouped floating mark method based on the pre-trained model is adopted. By grouping the floating marks, each group reuses the characteristics of a head entity and designs a specific attention mask to achieve efficient aggregation of the characteristics of entities and reduce the amount of calculation. Achieve high-precision relationship extraction.

Benefits of technology

High-precision relationship extraction is achieved with a small amount of calculation, and the efficiency and effect of relationship extraction are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118428471B
    Figure CN118428471B
Patent Text Reader

Abstract

The present invention discloses a graph relation extraction method based on pre-trained model enhancement, the method comprising: constructing a relation extraction model, including grouped suspended tags, a pre-trained language model and a relation prediction layer; pre-processing text data and initializing grouped suspended tags to obtain feature sequences of text and suspended tags; calculating attention masks; using the attention masks to control the propagation direction of the pre-trained language model features and extracting the features of suspended tag pairs; inputting the features of the suspended tag pairs into the relation prediction layer to obtain a relation probability vector; calculating the loss function for the relation probability vector, optimizing the loss function, training a relation extraction model, and using the relation extraction model to extract relations. The present invention proposes an entity pair representation method for grouped suspended tags, by grouping suspended tags, each group reuses the features of the head entity, and designs a specific attention mask to achieve efficient aggregation of entity pair features, thereby achieving high-precision relation extraction with less computational effort.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning and natural language processing, and in particular to a graph relationship extraction method based on pre-training model enhancement. Background Art

[0002] Relation extraction is a task in natural language processing that aims to identify and extract the relationship between entities from text. Given a piece of text and annotated entity pairs, the goal of the task is to determine the type or category of the relationship between these entities. Relation extraction has important applications and value in the fields of natural language processing and information extraction, including but not limited to the following aspects: knowledge graph construction, information retrieval and recommendation, event extraction and intelligence analysis, social network analysis, automatic question answering and intelligent assistants, etc.

[0003] Most of the current relationship extraction methods for medical knowledge graphs require the design of complex relationship extraction modules and complex processing of text features output by the language model, which results in large computational workload and low computational efficiency. A small number of methods can reduce the amount of computation to a certain extent by designing suspended tags. However, the existing suspended tag methods have the problem of low representation efficiency, which hinders the research and implementation of the algorithm. Therefore, how to design an entity extraction method that can efficiently represent entity features by improving its entity representation has academic research significance and industrial application significance. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention discloses a graph relationship extraction method based on pre-training model enhancement. The method can achieve efficient relationship extraction. Compared with the existing methods, the method innovatively proposes an entity pair representation method of grouped suspended marks. By grouping the suspended marks, each group reuses the features of a head entity, and designs a specific attention mask for the grouped suspended marks, efficient aggregation of entity pair features is achieved, and high-precision relationship extraction is achieved with less computation.

[0005] The object of the present invention is to achieve a graph relationship extraction method based on pre-training model enhancement through the following technical solution, the method comprising:

[0006] Step 1: Build a relation extraction model, including grouped floating tags, pre-trained language model, and relation prediction layer;

[0007] Step 2: preprocessing text data and initializing grouped suspended marks to obtain feature sequences of text and suspended marks;

[0008] Step 3, calculate the attention mask;

[0009] Step 4: Use the attention mask to control the propagation direction of the pre-trained language model features and extract the features of the suspended marker pairs;

[0010] Step 5: Input the features of the suspended tag pair into the relationship prediction layer to obtain the relationship probability vector;

[0011] Step 6: Calculate the loss function for the relationship probability vector, optimize the loss function, train the relationship extraction model, and use the relationship extraction model to perform relationship extraction.

[0012] The text data preprocessing and grouping suspension mark initialization to obtain the feature sequence of text and suspension mark include the following steps:

[0013] Step 201, segment the input text to obtain a segmentation sequence;

[0014] Step 202: insert " <e>" tag, insert after each entity< / e> " tag is used to mark the location of the entity and insert the start tag at the beginning of the word segmentation sequence" <cls>", insert the end marker at the end" <sep>”;

[0015] Step 203, use the word embedding model of the pre-trained language model Roberta-large to map the word segmentation sequence into a word vector sequence. The total number of entities is The mathematical expression of the word vector sequence obtained by mapping the word segmentation sequence is:

[0016]

[0017] in, Indicates the start mark" <cls>"The word vector of Indicates the end mark" <sep>"The word vector of Represents the word vector of the i-th word, Indicates the i-th" <e>"Tagged word vector, each" <e>"The content of the tag is fixed, so each" <e>” The token word vectors are the same;

[0018] Step 204, using the position embedding model of the pre-trained language model Roberta-large to obtain the position embedding sequence of the word segmentation sequence. For the word segmentation sequence described in step 203, the mathematical expression of the obtained position embedding sequence is:

[0019]

[0020] in, Indicates the start mark" <cls>"The position of the embedding, Indicates the end mark" <sep>"The position of the embedding, represents the position embedding of the i-th word, Indicates the i-th" <e>"Marked location embedded, each" <e>"The marker position is different, so each" <e>” The positional embedding of the markers is different;

[0021] Step 205: Map the word segmentation sequence to the word vector sequence and word segmentation sequence position embedding sequence Add elements by element to get the feature embedding sequence of the word segmentation sequence , the mathematical expression is:

[0022]

[0023] Step 206, generating a suspended mark feature; the feature of the i-th suspended mark is the i-th " <e>"The word vector of the tag Add the i-th" <e>"The location of the mark is embedded , the mathematical expression is:

[0024]

[0025] in, Represents the features of the i-th suspended marker;

[0026] Step 207, generating a suspended mark feature sequence; if the number of entities is m, there are m suspended marks, and the goal is to generate a suspended mark feature sequence containing m groups of suspended marks. The i-th group of suspended marks is generated by: taking the feature of the i-th suspended mark Put it at the beginning of the i-th group of suspension mark sequence, and other suspension marks are arranged in the order of appearance in the text from small to large after the i-th group of suspension mark sequence, where i=1,2,3,…,m; splice the m groups of suspension mark feature sequences together in order to get a length of Suspended marker feature sequence ;

[0027] Step 208: embed the features of the word segmentation sequence into the sequence and suspension marker feature sequences Putting them together, the mathematical expression is:

[0028]

[0029] in, A sequence of features representing text and hover markers.

[0030] The calculation of the attention mask comprises the following steps:

[0031] The feature embedding sequence of the word segmentation sequence The sequence length is , suspended marker feature sequence The sequence length is , the number of entities , generating a size of The matrix , the mathematical expression for assigning values ​​to the elements in the matrix is:

[0032]

[0033] in, is the attention mask, express The element at row i and column j.

[0034] The method of using the attention mask to control the propagation direction of the pre-trained language model features and extracting the features of the suspended marker pairs includes the following steps:

[0035] Step 401: The feature sequence of the text and the suspended mark Input the pre-trained language model Roberta-large and use the attention mask described above As the mask of Roberta-large forward propagation, the mathematical expression is:

[0036]

[0037] in, yes The output feature of the last hidden layer, d is The hidden layer dimensions of is the feature embedding sequence of the word segmentation sequence Sequence length, is the suspension marker characteristic sequence Sequence length;

[0038] Step 402, from The features of the last hidden layer output Select the features of each entity pair, the mathematical expression is as follows:

[0039]

[0040] in, The features of the floating mark pair representing the i-th entity and the j-th entity, Represents an operation that indexes from the 0th dimension of the target tensor.

[0041] The step of inputting the features of the suspended marker pair into the relationship prediction layer to obtain the relationship probability vector includes the following steps:

[0042] The features of the suspended mark pair of the i-th entity and the j-th entity , input the fully connected layer, and obtain the relationship prediction vector between the i-th entity and the j-th entity. The mathematical expression is:

[0043]

[0044] in, represents the relationship prediction vector between the i-th entity and the j-th entity, represents the weight matrix of the fully connected layer, represents the bias vector of the fully connected layer, C represents the number of relationship categories, d represents the dimension of the suspended tag pair feature, is an activation function used to normalize the vector into a probability distribution.

[0045] The method of calculating the loss function for the relationship probability vector, optimizing the loss function, training the relationship extraction model, and performing relationship extraction using the relationship extraction model includes the following steps:

[0046] Calculate the relationship prediction vector between the i-th entity and the j-th entity Relationship label with real The cross entropy loss between is expressed as:

[0047]

[0048] in, represents the true relationship label between the i-th entity and the j-th entity. If the i-th entity and the j-th entity have the k-th relationship, then ,otherwise , It represents the probability that the i-th entity and the j-th entity predicted by the model have the k-th category, which is the relationship prediction vector The index value of

[0049] Calculate the cross entropy loss for all entity pairs. The mathematical expression is as follows:

[0050]

[0051] in, represents the total cross entropy loss;

[0052] Using the Adam optimization algorithm Optimize and train the relationship extraction model.

[0053] Compared with the existing methods, the advantages of the method of the present invention are: the technology provides a graph relationship extraction method based on pre-trained model enhancement. The method innovatively proposes a method for representing entity pairs with grouped suspended tags. By grouping suspended tags, each group reuses the features of a head entity, and designs a specific attention mask for the grouped suspended tags, efficient aggregation of entity pair features is achieved, and high-precision relationship extraction is achieved with less computation. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0057] A knowledge graph is a collection of knowledge and its connections described in a structured form. It is a way of representing knowledge by organizing entities, attributes, and relationships into a graphical structure. It aims to better describe and understand the world's knowledge and concepts, and can be used to store, query, reason, and analyze knowledge. The design of a knowledge graph is not just about representing knowledge in the form of a graphical structure, but also about how to define its attributes and relationships, how to establish connections between them, and how to perform operations such as query, reasoning, and analysis. Such a design makes the knowledge graph a powerful tool for storing and manipulating large amounts of complex knowledge.

[0058] In this embodiment, there is a vast amount of medical knowledge on the Internet that can be used for medical consultation and health care, but traditional search engines cannot make reasonable judgments based on the actual situation of the patient and cannot meet the usage needs. Assuming that a large-scale medical knowledge graph is built, it is necessary to crawl a large amount of text data on the Internet and structure it. Relation extraction is a key link in text structuring. In the process of extracting relations from text, the graph relation extraction method enhanced by the pre-trained model is used in the medical field to extract medical-related relations. A reliable Chinese medical knowledge system is built, which can help solve people's needs for knowledge related to daily diseases and has high application value.

[0059] As the core of medical artificial intelligence, the Medical Knowledge Graph is essentially a semantic network that reveals the relationships between medical entities, and can formally describe things in the real world and their relationships. Usually, the medical knowledge graph is constructed on the basis of artificially constructed professional knowledge, by continuously expanding entities and relationships through algorithms and expert reviews, including medical concepts such as diseases, symptoms, drugs, and surgeries, and various medical relationships. In a wide range of medical scenarios, the medical knowledge graph has been proven to effectively provide medical knowledge support for algorithms and provide medical explanations for the algorithm's prediction results. In the foreseeable future, knowledge graphs will play a vital role in the field of medicine, which has strong knowledge attributes. Therefore, the graph relationship extraction method based on pre-trained model enhancement in the embodiment of the present invention can provide very important support for the relationship extraction of the medical knowledge graph.

[0060] Therefore, if Figure 1 As shown, a graph relationship extraction method based on pre-training model enhancement includes:

[0061] Step 1: Build a relation extraction model, including grouped floating tags, pre-trained language model, and relation prediction layer;

[0062] Step 2: preprocessing text data and initializing grouped suspended marks to obtain feature sequences of text and suspended marks;

[0063] Step 3, calculate the attention mask;

[0064] Step 4: Use the attention mask to control the propagation direction of the pre-trained language model features and extract the features of the suspended marker pairs;

[0065] Step 5: Input the features of the suspended tag pair into the relationship prediction layer to obtain the relationship probability vector;

[0066] Step 6: Calculate the loss function for the relationship probability vector, optimize the loss function, train the relationship extraction model, and use the relationship extraction model to perform relationship extraction.

[0067] The graph is a medical knowledge graph, the entities of the graph include diseases, symptoms, drugs, and surgeries, and the relationships of the graph include disease-symptom relationships, disease-drug relationships, disease-disease relationships, symptom-symptom relationships, and disease-surgery relationships.

[0068] The text data preprocessing and grouping suspension mark initialization to obtain the feature sequence of text and suspension mark include the following steps:

[0069] Step 201, segment the input text to obtain a segmentation sequence;

[0070] Step 202, insert " before each entity in the word segmentation sequence <e> " tag, insert after each entity< / e> "Mark, used to mark the location of the entity and insert the start mark at the beginning of the word segmentation sequence" <cls>", insert the end marker at the end" <sep>”;

[0071] Step 203, use the word embedding model of the pre-trained language model Roberta-large to map the word segmentation sequence into a word vector sequence. The total number of entities is The mathematical expression of the word vector sequence obtained by mapping the word segmentation sequence is:

[0072]

[0073] in, Indicates the start mark" <cls>"The word vector of Indicates the end mark" <sep>"The word vector of Represents the word vector of the i-th word, Indicates the i-th" <e>"Tagged word vector, each" <e>"The content of the tag is fixed, so each" <e>” The token word vectors are the same;

[0074] Step 204, using the position embedding model of the pre-trained language model Roberta-large to obtain the position embedding sequence of the word segmentation sequence. For the word segmentation sequence described in step 203, the mathematical expression of the obtained position embedding sequence is:

[0075]

[0076] in, Indicates the start mark" <cls>"The position of the embedding, Indicates the end mark" <sep>"The position of the embedding, represents the position embedding of the i-th word, Indicates the i-th" <e>"Marked location embedded, each" <e>"The marker position is different, so each" <e>” The positional embedding of the markers is different;

[0077] Step 205: Map the word segmentation sequence to the word vector sequence and word segmentation sequence position embedding sequence Add elements by element to get the feature embedding sequence of the word segmentation sequence , the mathematical expression is:

[0078]

[0079] Step 206, generating a suspended mark feature; the feature of the i-th suspended mark is the i-th " <e>"The word vector of the tag Add the i-th" <e>"The location of the mark is embedded , the mathematical expression is:

[0080]

[0081] in, Represents the features of the i-th suspended marker;

[0082] Step 207, generating a suspended mark feature sequence; if the number of entities is m, there are m suspended marks, and the goal is to generate a suspended mark feature sequence containing m groups of suspended marks. The i-th group of suspended marks is generated by: taking the feature of the i-th suspended mark Put it at the beginning of the i-th group of suspension mark sequence, and other suspension marks are arranged in the order of appearance in the text from small to large after the i-th group of suspension mark sequence, where i=1,2,3,…,m; splice the m groups of suspension mark feature sequences together in order to get a length of Suspended marker feature sequence ;

[0083] Step 208: embed the features of the word segmentation sequence into the sequence and suspension marker feature sequences Putting them together, the mathematical expression is:

[0084]

[0085] in, A sequence of features representing text and hover markers.

[0086] RoBERTa-large is a variant of the BERT (Bidirectional Encoder Representations from Transformers) model developed by Facebook AI (now known as Meta AI). RoBERTa stands for "A Robustly Optimized BERT Pretraining Approach", which has made many improvements and optimizations based on BERT. Here are some key features of RoBERTa-large: (1) Model size: RoBERTa-large is larger than BERT-large, with 24 layers of Transformer encoders, 1024 hidden units per layer, and a total of 355M parameters. In contrast, BERT-large has 24 layers, 1024 hidden units per layer, and a total of 340M parameters. (2) Amount of pre-training data: RoBERTa uses a larger pre-training dataset, about 160GB of data, much more than BERT's 16GB. This includes datasets such as BookCorpus, English Wikipedia, CC-News, OpenWebText, and Stories. (3) Pre-training strategy: RoBERTa performs more optimizations during pre-training. For example, the Next Sentence Prediction (NSP) task in BERT was removed, and longer training sequences (longer sentences) were used. (4) Training time: RoBERTa was pre-trained for a longer period of time to ensure that the model better captures language patterns and contextual relationships. (5) Improved results: Due to the above optimizations, RoBERTa performs better than BERT on multiple natural language processing tasks, including text classification, question answering, and text generation.

[0087] The calculation of the attention mask comprises the following steps:

[0088] The feature embedding sequence of the word segmentation sequence The sequence length is , suspended marker feature sequence The sequence length is , the number of entities , generating a size of The matrix , the mathematical expression for assigning values ​​to the elements in the matrix is:

[0089]

[0090] in, is the attention mask, express The element at row i and column j.

[0091] One of the roles of the attention mask in the Transformer model is to control information propagation, that is, to determine which positions of information can influence each other.

[0092] The attention mechanism interacts each position with other positions when calculating the attention weights and assigns weights based on their relevance. By marking certain positions in the attention mask, we can control whether the model takes these positions into account when calculating the attention weights.

[0093] The method of using the attention mask to control the propagation direction of the pre-trained language model features and extracting the features of the suspended marker pairs includes the following steps:

[0094] Step 401: The feature sequence of the text and the suspended mark Input the pre-trained language model Roberta-large and use the attention mask described above As the mask of Roberta-large forward propagation, the mathematical expression is:

[0095]

[0096] in, yes The output feature of the last hidden layer, d is The hidden layer dimensions of is the feature embedding sequence of the word segmentation sequence Sequence length, is the suspension marker characteristic sequence Sequence length;

[0097] Step 402, from The features of the last hidden layer output Select the features of each entity pair, the mathematical expression is as follows:

[0098]

[0099] in, The features of the floating mark pair representing the i-th entity and the j-th entity, Represents an operation that indexes from the 0th dimension of the target tensor.

[0100] The step of inputting the features of the suspended marker pair into the relationship prediction layer to obtain the relationship probability vector includes the following steps:

[0101] The features of the suspended mark pair of the i-th entity and the j-th entity , input the fully connected layer, and obtain the relationship prediction vector between the i-th entity and the j-th entity. The mathematical expression is:

[0102]

[0103] in, represents the relationship prediction vector between the i-th entity and the j-th entity, represents the weight matrix of the fully connected layer, represents the bias vector of the fully connected layer, C represents the number of relationship categories, d represents the dimension of the suspended tag pair feature, is an activation function used to normalize the vector into a probability distribution.

[0104] The method of calculating the loss function for the relationship probability vector, optimizing the loss function, training the relationship extraction model, and performing relationship extraction using the relationship extraction model includes the following steps:

[0105] Calculate the relationship prediction vector between the i-th entity and the j-th entity Relationship label with real The cross entropy loss between is expressed as:

[0106]

[0107] in, represents the true relationship label between the i-th entity and the j-th entity. If the i-th entity and the j-th entity have the k-th relationship, then ,otherwise , It represents the probability that the i-th entity and the j-th entity predicted by the model have the k-th category, which is the relationship prediction vector The index value of

[0108] Calculate the cross entropy loss for all entity pairs. The mathematical expression is as follows:

[0109]

[0110] in, represents the total cross entropy loss;

[0111] Using the Adam optimization algorithm Optimize and train the relationship extraction model.

[0112] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on 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.< / e> < / e> < / e> < / e> < / e> < / sep> < / cls> < / e> < / e> < / e> < / sep> < / cls> < / sep> < / cls> < / e> < / e> < / e> < / e> < / e> < / sep> < / cls> < / e> < / e> < / e> < / sep> < / cls> < / sep> < / cls>

Claims

1. A graph relationship extraction method based on pre-training model enhancement, characterized in that: The method comprises: Step 1: Build a relation extraction model, including grouped floating tags, pre-trained language model, and relation prediction layer; Step 2: preprocessing text data and initializing grouped suspended marks to obtain feature sequences of text and suspended marks; Step 3, calculate the attention mask; Step 4: Use the attention mask to control the propagation direction of the pre-trained language model features and extract the features of the suspended marker pairs; Step 5: Input the features of the suspended tag pair into the relationship prediction layer to obtain the relationship probability vector; Step 6, calculate the loss function for the relationship probability vector, optimize the loss function, train the relationship extraction model, and use the relationship extraction model to extract the relationship; The graph is a medical knowledge graph, the entities of the graph include diseases, symptoms, drugs, and surgeries, and the relationships of the graph include disease-symptom relationships, disease-drug relationships, disease-disease relationships, symptom-symptom relationships, and disease-surgery relationships; The text data preprocessing and grouping suspension mark initialization to obtain the feature sequence of text and suspension mark include the following steps: Step 201, segment the input text to obtain a segmentation sequence; Step 202, insert " before each entity in the word segmentation sequence <e> " tag, insert after each entity< / e> "Mark, used to mark the location of the entity and insert the start mark at the beginning of the word segmentation sequence" <cls>", insert the end marker at the end" <sep> ”;< / sep> < / cls> Step 203, use the word embedding model of the pre-trained language model Roberta-large to map the word segmentation sequence into a word vector sequence. The total number of entities is The mathematical expression of the word vector sequence obtained by mapping the word segmentation sequence is: ; in, Indicates the start tag" <cls>"The word vector of Indicates the end mark" <sep>"The word vector of Represents the word vector of the i-th word, Indicates the i-th" <e>"Tagged word vector, each" <e>"The content of the tag is fixed, so each" <e> ” The token word vectors are the same;< / e> < / e> < / e> < / sep> < / cls> Step 204, using the position embedding model of the pre-trained language model Roberta-large to obtain a position embedding sequence of the word segmentation sequence, the mathematical expression of the position embedding sequence obtained for the word segmentation sequence is: ; in, Indicates the start mark" <cls>"The position of the embedding, Indicates the end mark" <sep>"The position of the embedding, represents the position embedding of the i-th word, Indicates the i-th" <e>"Marked location embedded, each" <e>" The marker position is different, so each" <e> ” The positional embedding of the markers is different;< / e> < / e> < / e> < / sep> < / cls> Step 205: Map the word segmentation sequence to the word vector sequence and word segmentation sequence position embedding sequence Add elements by element to get the feature embedding sequence of the word segmentation sequence , the mathematical expression is: ; Step 206, generating a suspended mark feature; the feature of the i-th suspended mark is the i-th " <e>"The word vector of the tag Add the i-th" <e>"The location of the mark is embedded , the mathematical expression is:< / e> < / e> ; in, Represents the features of the i-th suspended marker; Step 207, generating a suspended mark feature sequence; if the number of entities is m, there are m suspended marks, and the goal is to generate a suspended mark feature sequence containing m groups of suspended marks. The i-th group of suspended marks is generated by: taking the feature of the i-th suspended mark Put it at the beginning of the i-th group of suspension mark sequence, and other suspension marks are arranged in the order of appearance in the text from small to large after the i-th group of suspension mark sequence, where i=1,2,3,…,m; splice the m groups of suspension mark feature sequences together in order to get a length of Suspended marker feature sequence ; Step 208: embed the features of the word segmentation sequence into the sequence and suspension marker feature sequences Putting them together, the mathematical expression is: ; in, A sequence of features representing text and hover marks; The calculation of the attention mask comprises the following steps: The feature embedding sequence of the word segmentation sequence The sequence length is , suspended marker feature sequence The sequence length is , the number of entities , generating a size of The matrix , the mathematical expression for assigning values ​​to the elements in the matrix is: ; in, is the attention mask, express The element at row i and column j; The method of using the attention mask to control the propagation direction of the pre-trained language model features and extracting the features of the suspended marker pairs includes the following steps: Step 401: The feature sequence of the text and the suspended mark Input the pre-trained language model Roberta-large and use the attention mask described above As the mask of Roberta-large forward propagation, the mathematical expression is: ; in, yes The output feature of the last hidden layer, d is The hidden layer dimensions of is the feature embedding sequence of the word segmentation sequence Sequence length, is the suspension marker characteristic sequence Sequence length; Step 402, from The features of the last hidden layer output Select the features of each entity pair, the mathematical expression is as follows: ; in, The features of the floating mark pair representing the i-th entity and the j-th entity, Represents an operation that indexes from the 0th dimension of the target tensor.

2. The graph relationship extraction method based on pre-training model enhancement according to claim 1 is characterized in that: The step of inputting the features of the suspended marker pair into the relationship prediction layer to obtain the relationship probability vector includes the following steps: The features of the suspended mark pair of the i-th entity and the j-th entity , input the fully connected layer, and obtain the relationship prediction vector between the i-th entity and the j-th entity. The mathematical expression is: ; in, represents the relationship prediction vector between the i-th entity and the j-th entity, represents the weight matrix of the fully connected layer, represents the bias vector of the fully connected layer, C represents the number of relationship categories, d represents the dimension of the suspended mark pair feature, and the dimension of the suspended mark pair feature is The hidden layer dimensions of are equal, is an activation function used to normalize the vector into a probability distribution.

3. The graph relationship extraction method based on pre-training model enhancement according to claim 2 is characterized in that: The method of calculating the loss function for the relationship probability vector, optimizing the loss function, training the relationship extraction model, and performing relationship extraction using the relationship extraction model includes the following steps: Calculate the relationship prediction vector between the i-th entity and the j-th entity Relationship with real label The cross entropy loss between is expressed as: ; in, represents the true relationship label between the i-th entity and the j-th entity. If the i-th entity and the j-th entity have the k-th relationship, then ,otherwise , It represents the probability that the i-th entity and the j-th entity predicted by the model have the k-th category, which is the relationship prediction vector The index value of Calculate the cross entropy loss for all entity pairs. The mathematical expression is as follows: ; in, represents the total cross entropy loss; Using the Adam optimization algorithm Optimize and train the relationship extraction model.