A document-level relation extraction method based on graph neural network and reasoning path

By using heterogeneous graph structure and path search algorithms in document-level relationship extraction, combined with neural network encoder and graph attention mechanism, the problem that graph neural network cannot capture long-distance node features and ignore inference path relationships is solved, and the performance of document-level relationship extraction is improved.

CN114818658BActive Publication Date: 2025-05-06HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210617790.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-01
Publication Date
2025-05-06
Estimated Expiration
2042-06-01

AI Technical Summary

Technical Problem

In document-level relationship extraction, existing graph neural networks can only focus on the local features of nodes, cannot effectively capture the features of long-distance nodes, and ignore the inference path relationship between entity nodes.

Method used

By converting the document into a heterogeneous graph structure, and using a path search algorithm to extract multiple inference paths between entity pairs, combining the neural network encoder and graph attention mechanism, node features are updated and global features of entity pairs are represented.

Benefits of technology

Improves the performance of document-level relationship extraction, can more effectively capture global features between entity nodes, and improves the performance of the model in relational classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114818658B_ABST
    Figure CN114818658B_ABST
Patent Text Reader

Abstract

The present invention proposes a document-level relationship extraction method based on a graph neural network and an inference path. The present invention aims to solve the problem that the commonly used graph model method in document-level relationship extraction can only focus on the characteristics of the local features of the entity and cannot well represent the global features between two entities. The specific steps of the present invention are: Step 1, converting an input document into a graph structure based on heuristic rules; Step 2, using a path search algorithm to extract multiple paths between different entity pairs in the constructed graph structure; Step 3, using a neural network encoder to encode the input document, and obtain a vector representation of the nodes in the graph, and using a graph neural network to update the vector representation of the nodes in the graph; Step 4, obtaining a vector representation of the path information between entity pairs in the graph structure; Step 5, judging the relationship between entity pairs, and using labeled data to train a deep learning model. The present invention belongs to the field of natural language processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a document-level relationship extraction method based on graph neural network and reasoning path. Background Art

[0002] The document-level relationship extraction task is to determine whether there are some predefined relationships among all entity pairs given a paragraph containing multiple sentences, the entities that appear in the paragraph, and the positions of the entities in the paragraph. Compared with sentence-level relationship extraction, document-level relationship extraction has the following technical difficulties: 1) Document-level relationships require a variety of different reasoning methods, including intra-sentence relationship extraction, reference reasoning, logical reasoning, and common sense reasoning. How to design a better document-level relationship extraction model to effectively synthesize useful information from longer context information and determine the relationship between entity pairs is the main challenge facing the task. 2) The computational cost of the model. In document-level relationship extraction, the number of potential entities with relationships is proportional to the square of the number of entities, and there are only a small number of entity pairs with relationships. How to efficiently extract the relationships in the document is an existing challenge.

[0003] Existing methods usually convert documents into graph structures. Depending on the graph structure, it is divided into isomorphic graphs and heterogeneous graphs. Isomorphic graphs only contain information about nodes and edges of the same type. Usually, this method requires external tools. For example, a syntactic parsing tool is used to obtain the syntactic dependency of each sentence in the document, and then the root nodes of the syntactic dependency of each sentence are spliced ​​together. Heterogeneous graphs contain information about nodes and edges of different types. Usually, the graph contains sentences, entities, and mentions of entities in the document. Then, some heuristic rules are used to construct the edge relationship between nodes.

[0004] Existing methods use graph neural networks to synthesize information in the graph. Specifically, graph neural networks use the features of the node's neighbor nodes to update direct features, and obtain node features containing graph context information through multiple iterations. Although this method can well represent the information of the interaction between nodes, it can only represent the local features of the nodes. When the distance between two nodes in the graph is far, the graph neural network cannot capture the features well. Moreover, the graph neural network does not explicitly consider the relationship between the reasoning paths of different entity nodes.

[0005] In summary, the research on document-level relationship extraction has the following shortcomings:

[0006] 1. The graph neural network widely used in document-level relationships can only focus on the local features of nodes. When two nodes are far apart, the performance of the model will be seriously affected;

[0007] 2. Graph neural networks do not explicitly consider the reasoning path between two nodes and ignore the reasoning relationship between solution nodes. Summary of the invention

[0008] The purpose of the present invention is to solve the problem that the current graph model for document-level relationship extraction in the field of natural language processing only considers the local features in the graph, and proposes a document-level relationship extraction method based on a graph neural network and an inference path. The method of the present invention represents the global features of two entity nodes in the graph by considering the inference path between the nodes in the graph, thereby improving the performance of document-level relationship extraction.

[0009] The present invention is implemented by the following technical scheme. The present invention proposes a document-level relationship extraction method based on graph neural network and reasoning path, and the method specifically includes:

[0010] Step 1: Convert an input document into a graph structure based on heuristic rules;

[0011] Step 2: Use the path search algorithm to extract multiple paths between different entity pairs in the constructed graph structure;

[0012] Step 3: Encode the input document using the neural network encoder and obtain the vector representation of the nodes in the graph, and use the graph neural network to update the vector representation of the nodes in the graph;

[0013] Step 4: Obtain the path information vector representation between entity pairs in the graph structure;

[0014] Step 5: Determine the relationship between entity pairs and use labeled data to train the deep learning model.

[0015] Furthermore, the graph structure converted in step 1 is a heterogeneous graph structure.

[0016] Furthermore, the path search algorithm in step 2 is based on a breadth-first search algorithm.

[0017] Furthermore, in step 2, the reasoning path between entities is simulated by considering the path information between two entity nodes in the graph structure.

[0018] Furthermore, in step 4, the attention mechanism is used to integrate multiple different path features to represent the global features between entity pairs in the graph.

[0019] Furthermore, in step five, the local features of the nodes output by the graph neural network and the global features of the paths between two entity pairs are used to jointly classify the relationships between entities.

[0020] Furthermore, the heterogeneous graph contains three types of nodes, namely sentence nodes, entity nodes and mention nodes; entities are connected with edges under the following conditions: 1) two mention nodes in the same sentence are connected to represent the intra-sentence relationship between the two mentions; 2) a mention node and its sentence node are connected to express the belonging relationship of the mention; 3) two mention nodes belonging to the same entity are connected; 4) all sentence nodes are connected to express the relationship between multiple sentences; 5) if a mention of an entity appears in a sentence, then the entity node and the sentence node are connected.

[0021] Furthermore, the breadth-first search algorithm is specifically as follows: a search space queue S is defined, and the head entity node is sent to the search space queue at the beginning, a node is taken out of the queue at each time step, and it is determined whether it is the tail entity node or the neighbor node of the tail entity node; 1) If it meets the conditions, the search path ends and the search path is retained as a possible reasoning path between entities; 2) If it does not meet the conditions, all its neighbor nodes that have not been checked are added to the queue; if the queue is empty, it means that the entire heterogeneous graph has been checked and the search ends.

[0022] Furthermore, in step three, the input text sequence is first converted into a word vector sequence, and the vector representation of the word, the entity type representation of the word, and the referential representation of the word are concatenated together to obtain an overall representation of the word. The words in the document are then sent to an encoder, and the encoder is a BiLSTM and a Transformer-based pre-trained model to learn the contextual representation of the word vector. After obtaining the contextual representation of the document, the vector representation of the nodes in the constructed heterogeneous graph is initialized. After obtaining the initialized representation of the heterogeneous graph nodes, the features of the nodes in the network are iteratively updated using a graph attention network, and the features of neighboring nodes are aggregated using a self-attention mechanism. These features are integrated to obtain the final output of the graph network.

[0023] Furthermore, in step 4, by extracting the reasoning path between two entity pairs, multiple related reasoning paths are obtained, and LSTM is used to encode the reasoning path. For a certain reasoning path, the implicit vector of the last iteration of LSTM is used to represent the characteristics of this path. The feature representation of all paths between an entity pair is obtained, and then the attention mechanism is used to fuse the features of multiple paths.

[0024] The beneficial effects of the present invention are:

[0025] In view of the fact that graph neural networks can only focus on local features of nodes in the graph, the present invention obtains global features between entity pairs in the graph by considering the reasoning paths between entity nodes in the graph. When classifying entity pair relationships, the vector representation of the path is used to supplement the vector representation of graph convolution features, thereby improving the performance of the model in document-level relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flowchart of path extraction and path feature representation in graph structure;

[0027] Figure 2 Different structural diagrams of neural network models. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of 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.

[0029] Embodiment 1

[0030] Combination Figure 1 and Figure 2 The present invention proposes a document-level relationship extraction method based on a graph neural network and an inference path, the method comprising:

[0031] Step 1: Convert an input document into a graph structure based on heuristic rules;

[0032] Step 2: Use the path search algorithm to extract multiple paths between different entity pairs in the graph structure;

[0033] Step 3: Encode the input document using the neural network encoder and obtain the vector representation of the nodes in the graph, and use the graph neural network to update the vector representation of the nodes in the graph;

[0034] Step 4: Obtain the path information vector representation between entity pairs in the graph structure;

[0035] Step 5: Determine the relationship between entity pairs and use labeled data to train the deep learning model.

[0036] The graph structure converted in step 1 is a heterogeneous graph structure. The input data in step 1 includes the content of the document, the entities appearing in the document, and the different positions where the entities appear in the document.

[0037] The path search algorithm in step 2 is based on the breadth-first search algorithm to extract the path of entity pairs in the graph. In step 2, the reasoning path between entities is simulated by considering the path information between two entity nodes in the graph structure.

[0038] In step 3, the neural network encoder used includes BiLSTM or a pre-trained model based on Transformer.

[0039] In step 4, the Attention mechanism is used to integrate the information of multiple paths between entity pairs. The attention mechanism is used to fuse the multi-hop reasoning path information between entity pairs to obtain a total path feature representation, so that the model can adaptively focus on the most likely reasoning path. The attention mechanism is used to integrate multiple different path features to represent the global features between entity pairs in the graph.

[0040] In step 5, the node representation and path features output by the graph neural network are used to classify the relationship. The relationship between the two entities is jointly determined by fusing the representation of the two entity nodes output by the graph neural network and the representation of the path between the two nodes. The local features of the nodes output by the graph neural network and the global features of the path between the two entity pairs are used to jointly classify the relationship between the entities.

[0041] In step 1, the document needs to be converted into a heterogeneous graph structure. Specifically, the graph contains three types of nodes, namely sentence nodes, entity nodes, and mention nodes. Entities are connected by edges when the following conditions are met. 1) Two mention nodes in the same sentence are connected to represent the intra-sentence relationship between the two mentions. 2) The mention node and the sentence node to which it belongs are connected to express the belonging relationship of the mention. 3) Two mention nodes belonging to the same entity are connected. 4) All sentence nodes are connected to express the relationship between multiple sentences. 5) If a mention of an entity appears in a sentence, then the entity node and the sentence node are connected.

[0042] In step 2, an algorithm based on breadth-first search is used to extract the reasoning path between entity pairs in the graph structure. Specifically, a search space queue S is defined, and the head entity node is sent to the search queue at the beginning. A node is taken out of the queue at each time step, and it is determined whether it is the tail entity node or the neighbor node of the tail entity node. 1) If it meets the conditions, the search path ends and the search path is retained as a possible reasoning path between entities. 2) If it does not meet the conditions, all its neighbor nodes that have not been checked are added to the queue. If the queue is empty, it means that the entire heterogeneous graph has been checked and the search ends.

[0043] In step 3, the neural network encoder is used to encode the input document. First, the input text sequence is converted into a word vector sequence, and the vector representation of the word, the entity type representation of the word (such as person, place, etc., if the word does not belong to the entity word, this representation is empty), and the reference representation of the word (the mention of the same entity has the same sequence number) are concatenated together to obtain a representation of the word as a whole, which is formally represented as:

[0044] x i --[E w (w i );E t (t i );E c (c i )]#(1)

[0045] where x i is the vector representation of the expanded word, E w is the original vector representation of the word, E t is the entity type representation of the word, E c is the referential representation of the word. Then the word in the document is fed into an encoder, typically a BiLSTM and a Transformer-based pre-trained model to learn the contextual representation of the word vector, expressed as:

[0046] [g1, g2, …, g n ]=Encoder([x1,x2,…,x n ])#(2)

[0047] After obtaining the contextual representation of the document, the vector representation of the nodes in the constructed heterogeneous graph is initialized. Specifically, the initial representation of the mention node is the average of the contextual representations of the words contained in the mention. The initial representation of the sentence node is the average of the contextual representations of the words contained in the sentence. The initial representation of the entity node is the average of the contextual representations of all mentions of the entity. Based on the above definition, the graph structure representing this document and the initial representation of this graph are obtained.

[0048] After obtaining the initial representation of the nodes in the heterogeneous graph, the features of the nodes in the network are iteratively updated using the graph attention network. In the lth iteration of the graph neural network, given the representation of the nodes obtained in all previous reasoning steps The previously learned node representations are concatenated and converted into a fixed-length representation as the input for the lth graph encoding.

[0049]

[0050] where v nis the initial representation of the node. Then the self-attention mechanism is used to aggregate the features of neighboring nodes. Assuming there is a c nodes are connected to node n, that is These neighbor nodes are represented as Then the representation of node n can be updated as:

[0051]

[0052] Where {K, V} is the number of nodes from neighboring nodes. The Key, Value matrix obtained by conversion. Through L iterative reasoning, we get L representations of each node Finally, a nonlinear multiplication is used to integrate this information to obtain the final output of the graph network, which is expressed as:

[0053]

[0054] In step 4, we obtain the path information vector representation between entity pairs in the graph structure. By extracting the reasoning path between two entity pairs, we obtain multiple related reasoning paths. Where N p Indicates the number of inference paths contained in . LSTM is used to encode the inference paths.

[0055]

[0056] in It is the feature vector representation of the mth node in the reasoning path. For a certain reasoning path, the implicit vector of the last iteration of LSTM is used to represent the characteristics of this path. (like Figure 2 right).

[0057] In this way, we get an entity {i h ,i t The characteristic representation of all paths between Then the attention mechanism is used to fuse the features of multiple paths.

[0058]

[0059]

[0060]

[0061] in, That is, the entity pair {i h ,i t} is a representation of the path characteristics.

[0062] In step five, the relationship between entity pairs is judged, and the labeled data is used to train the deep learning model.

[0063] The graph convolution representation features and path features are combined to classify the relationship between entity pairs as follows:

[0064]

[0065] Among them, MLP r It is a multi-layer perceptron. Document-level relation extraction is considered as a multi-classification task. The cost function of the model is expressed as follows:

[0066]

[0067] Embodiment 2

[0068] In this embodiment, steps 1, 2, 3, and 5 are the same as those in embodiment 1. In step 4 of this embodiment, a path information vector representation between entity pairs in the graph structure is obtained. In addition to using the nodes output by the graph neural network to represent the features of the nodes in the path, it is considered to directly use the initial representation of the node as the feature of the node in the path (such as Figure 2 left).

[0069] The above is a detailed introduction to the document-level relationship extraction method based on graph neural network and reasoning path proposed in the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A document-level relationship extraction method based on graph neural network and reasoning path, characterized in that: The method specifically comprises: Step 1: Convert an input document into a graph structure based on heuristic rules; Step 2: Using a path search algorithm to extract multiple paths between different entity pairs in the constructed graph structure; in step 2, the reasoning path between entities is simulated by considering the path information between two entity nodes in the graph structure; Step 3: Encode the input document using the neural network encoder and obtain the vector representation of the nodes in the graph, and use the graph neural network to update the vector representation of the nodes in the graph; Step 4: Obtain a vector representation of the path information between entity pairs in the graph structure; In step 4, the attention mechanism is used to integrate multiple different path features to represent the global features between entity pairs in the graph; Step 5: Determine the relationship between entity pairs and use labeled data to train the deep learning model. In step 5, the local features of the nodes output by the graph neural network and the global features of the path between the two entity pairs are used to classify the relationship between the entities.

2. The method according to claim 1, characterized in that The graph structure converted in step 1 is a heterogeneous graph structure.

3. The method according to claim 1, characterized in that The path search algorithm in step 2 is based on the breadth-first search algorithm.

4. The method according to claim 2, characterized in that: The heterogeneous graph contains three types of nodes, namely sentence nodes, entity nodes and mention nodes; entities are connected with edges under the following conditions: 1) two mention nodes in the same sentence are connected to represent the intra-sentence relationship between the two mentions; 2) a mention node and its sentence node are connected to express the belonging relationship of the mentions; 3) two mention nodes belonging to the same entity are connected; 4) all sentence nodes are connected to express the relationship between multiple sentences; 5) if a mention of an entity appears in a sentence, then the entity node and the sentence node are connected.

5. The method according to claim 1, characterized in that: The breadth-first search algorithm is specifically as follows: a search space queue S is defined, the head entity node is sent to the search space queue at the beginning, a node is taken out of the queue at each time step, and it is determined whether it is the tail entity node or the neighbor node of the tail entity node; 1) if it meets the conditions, the search path ends and the search path is retained as a possible reasoning path between entities; 2) If it does not meet the conditions, all its neighbor nodes that have not been checked are added to the queue; If the queue is empty, it means that the entire heterogeneous graph has been checked and the search ends.

6. The method according to claim 1, characterized in that In step three, the input text sequence is first converted into a word vector sequence, and the vector representation of the word, the entity type representation of the word, and the referential representation of the word are spliced ​​together to obtain an overall representation of the word. Then the words in the document are sent to an encoder, and the encoder is a BiLSTM and a Transformer-based pre-trained model to learn the contextual representation of the word vector. After obtaining the contextual representation of the document, the vector representation of the nodes in the constructed heterogeneous graph is initialized. After obtaining the initialized representation of the heterogeneous graph nodes, the features of the nodes in the network are iteratively updated using a graph attention network, and the self-attention mechanism is used to aggregate the features of neighboring nodes. These features are integrated to obtain the final output of the graph network.

7. The method according to claim 1, characterized in that In step 4, by extracting the reasoning path between two entity pairs, multiple related reasoning paths are obtained, and LSTM is used to encode the reasoning path. For a certain reasoning path, the implicit vector of the last iteration of LSTM is used to represent the characteristics of this path. The feature representation of all paths between an entity pair is obtained, and then the attention mechanism is used to fuse the features of multiple paths.

Citation Information

Patent Citations

  • Relation extraction method and system based on knowledge map

    CN108073711A

  • Inference type reading understanding method based on relational graph convolutional network

    CN111274800A