Knowledge graph triple verification method based on multi-hop reasoning
Through the knowledge graph triple verification method based on multi-hop reasoning, small-scale data sets and multi-hop reasoning models are used to verify the triple confidence in the knowledge graph, which solves the data quality problem and improves the overall quality and verification of the knowledge graph. accuracy.
Patent Information
- Application Number
- CN202410680729.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-08-30
AI Technical Summary
There are uneven data quality, outliers and noise problems in the knowledge graph, which affect the integrity and completeness of the triples, leading to a decline in the quality of the knowledge graph, and making it difficult to ensure the credibility of the verification triples.
A knowledge graph triplet verification method based on multi-hop reasoning is adopted, and a small-scale knowledge graph data set is obtained for negative example generation and model training, and technologies such as two-hop approximate attention propagation prediction layer, relationship graph neural network and GGNN are used to establish Triplet confidence prediction model for multi-hop reasoning, verifying newly added triplet confidence.
It effectively improves the confidence verification of triples in the knowledge graph, ensures the overall quality of the knowledge graph, and improves the accuracy and reliability of verification.
Smart Images

Figure CN118569367A
Abstract
Description
Technical Field
[0001] The present invention relates to a knowledge graph triple verification method based on multi-hop reasoning, and belongs to the technical field of knowledge graphs. Background Art
[0002] Knowledge graph is one of the basic trends driving the next generation of technology. It has now developed into a new form of knowledge representation. Knowledge graph is widely used in intelligent analysis and graph structure applications. Knowledge graph is usually composed of triples (h, r, t), whose elements include head entity, relationship entity and tail entity. The authenticity of quantified triples is expressed by credible probability. It uses triples to describe the relationship and facts in the real world. It describes the relationship between entities in the real world. Entities act as nodes and different relationships act as edges, thus forming a network with a large amount of knowledge. Due to the uneven quality of data sources, the complex logic of semi-structured and unstructured data, and the existence of some outliers, noise and incomplete data information that affect the integrity and perfection of the overall domain knowledge graph triples, the accumulation of errors in the triples composed in the knowledge graph will affect the quality of the knowledge graph and the effectiveness of the generated knowledge graph construction. Therefore, in the process of merging external triples into the existing knowledge graph, verifying the credibility level of triple knowledge is crucial to building a comprehensive knowledge graph. This method uses the knowledge graph triple dataset to train the model, which can be used to verify whether the triples are correct. Triple datasets or knowledge graphs from other sources with the same ontology features as this method can use this model to verify the correctness of related triples. Summary of the invention
[0003] The purpose of the present invention is to propose a knowledge graph triple verification method based on multi-hop reasoning to address the technical problems mentioned in the above background technology, which can better verify the confidence of triples in the knowledge graph and thus ensure the quality of the entire knowledge graph. The technical solution is as follows:
[0004] A knowledge graph triple verification method based on multi-hop reasoning performs the following steps:
[0005] Step S1: Obtain a small-scale knowledge graph triple dataset that has been constructed and generate negative examples;
[0006] Step S2: establishing a triple knowledge graph dataset and an initialized triple confidence prediction model for multi-hop reasoning based on the data generated in step S1;
[0007] Step S3: Use the data set in step S2 to train and test the triplet confidence prediction model for multi-hop reasoning;
[0008] Step S4: Use the model trained in step S3 to verify the confidence values of the newly added triples, and use the verified triples to build a knowledge graph.
[0009] Furthermore, the preprocessing in step S1 includes the following steps:
[0010] Step S11: Obtain a small-scale knowledge graph triple dataset that has been constructed, which contains an entity relationship set E and a corresponding relationship set R, and has been annotated. The entity relationship dataset ER = {m1,m,…,m n},m k =(h k ,r k ,t k );
[0011] Step S12: Generate negative examples for the small-scale knowledge graph triple dataset. The negative example generation is divided into two parts: entity negative example generation and relationship negative example generation. The entity negative example generates negative samples for the head entity and the tail entity of each triple. For the same relationship, when When , the relationship and tail entity remain unchanged and the head entity is randomly replaced; on the contrary, when When , keep the relationship and head entity unchanged, and randomly replace the tail entity; the newly added triples should not be the negative sample triples that have been generated, that is, there are no repeated individuals; the relationship negative example is generated for each triple, and a negative example of the relationship is generated. At this time, the head entity and the tail entity are fixed, and the relationship is randomly replaced, but it is ensured that the newly added triples are not repeated.
[0012] Step S13: Merge the knowledge graph triple dataset and the negative examples as the dataset used in this method. The resulting dataset is ER = {m1, m, ..., m n},m k =(h k , r k , t k , V), where V represents four prediction results: correct entity, head entity error, relationship error and tail entity error.
[0013] Furthermore, the initialization of the multi-hop reasoning triple confidence prediction model in step S2 is established by the following steps:
[0014] Step S21: Using the entity feature extraction method of the two-step approximate attention propagation prediction layer (TAAPPNP), the two-hop method of the entity graph node is introduced into the relationship between the head entity and the tail entity, and between the tail entity and the head entity to measure the resource flow relationship between the entity nodes. The calculation method is expressed as: π ppr (i x )=(1-β)A β ((1-α)A α π ppr (i x )+αi x )+βi x , where α and β represent the two-hop and one-hop convergence coefficients respectively. In the knowledge graph containing entity relationships, one hop refers to the head node and two hops refers to the tail node. The feature representation of the node is obtained by calculating the resource flow of the head and tail nodes, and the ResourceGATRank (Resource Gate Attention Rank) model with an attention mechanism is used to improve the problem that there may be isolated nodes in the graph, which leads to the non-convergence of the final feature expression. The calculation method is expressed as: π′ ppr (i x )=a i,i Θπ ppr (i x )+∑ j∈N(i) a i,j Θπ ppr (i x ), after multiple iterations, the final result converges to the following expression: π ppr (i x )=[1-(1-β)(1-α)A β A α ] -1 [α(1-β)A β +βI β ]i x , when β = 0, it degenerates into the APPNP (Approximate personalized propagation of neural predictions) model. The multi-hop relationship between entities describes the relationship between entities and is used to express the importance of resource feature values in entities.
[0015] Step S22: Use graph neural network to enhance the effectiveness of data features in represents the set of neighbor nodes of node i with relationship r; ci,r is a regularization constant, c i,r The value of W r (1) is an explicit transformation function, which uses a regularized method to decompose this matrix, thereby reducing the overfitting of the model during training:
[0016] Step S23: Use GGNN (Gated Graph Neural Network) to obtain entity path information features. The network uses GRU (Gate Recurrent Unit) gating to calculate the feature information in the hidden layer: The node v first aggregates information from its neighboring nodes, It is a submatrix of the adjacency matrix A of the graph, which represents the connection between adjacent nodes. The update function of GRU uses the information from each node's neighbors and the previous time step to update the hidden state of the node. In essence, GGNN is used to generate an output sequence to represent the characteristics of the node path output. Since the output sequence is related to the characteristic relationship between each node, GGNN gathers the characteristics of the entity path to a large extent to enhance the effect of graph verification;
[0017] Step S24: The improved APPNP entity multi-hop feature inference layer, the RGCN (Relational data with Graph Convolutional Network) entity relationship feature layer and the GGNN path inference layer (Path Graph GRU Networks, PGGN) are used as the graph neural network inference layer. During the training process, the graph neural network inference layer first obtains the entity feature values from three levels. The verification calculation is as follows: e1 = ResourceGATRank (G), e2 = RGCN (G), e3 = GGNN (G). After initializing the graph neural network, for each triple (h i ,e i ,t i ), the final verification result is obtained through the following calculation: 4i =h i +r i -t i , e i =[h 1i ,t 1i ,h 2i ,t 2i ,h 3i ,t 3i ,e 4i ],s i =σ(fnn(ei )), where s i ∈[0,1],s i =0 means it is not a triple in this knowledge graph; s i =1 means that this triple is the triple in this knowledge graph, s i The value of represents the confidence of this triple in the knowledge graph. Where fnn is a three-layer nonlinear neural network, which is expressed as fnn(x)=W2σ(W1x+b1)+b2.
[0018] Furthermore, the method for training a triplet confidence prediction model for multi-hop reasoning in step S3 includes the following steps:
[0019] Step S31: Divide the data set into a training set, a test set and a validation set. This part mainly uses the training set and the test set to train and test the triple confidence prediction model of multi-hop reasoning.
[0020] Step S32: During the training process, the training set is used for training, and the loss function used is the cross entropy function, which is used for the gradient update of the model:
[0021] Step S33: Use the test set to evaluate the model performance.
[0022] Furthermore, the verification test of the newly added triple confidence value in step S4 includes the following steps:
[0023] Step S41: pre-process the domain text data, that is, perform relationship classification after word segmentation and entity extraction to form the corresponding triple m′ k =(h′ k ,r k ′,t′ k );
[0024] Step S42: input the triplet of step S41 into the model trained in step S2 to obtain the corresponding classification confidence value;
[0025] Step S43: Filter out triples with high confidence that conform to the knowledge graph, add them to the knowledge graph database, and form a verified knowledge graph.
[0026] Beneficial effects:
[0027] 1) The knowledge graph triple verification method based on multi-hop reasoning in the present invention can better verify the confidence of triples in the knowledge graph, thereby ensuring the quality of the entire knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of the process of the present invention;
[0029] Figure 2 It is a structural diagram of the triple confidence prediction model in the present invention;
[0030] Figure 3 It is a physical feature calculation graph in the present invention;
[0031] Figure 4 It is the relationship-path feature calculation graph in the present invention;
[0032] Figure 5 It is the relationship path feature calculation graph in the present invention; DETAILED DESCRIPTION
[0033] In order to make the technical means, creative features, objectives and effects of the present invention easier to understand, the present invention is further described below in conjunction with specific illustrations and embodiments.
[0034] like Figure 1-5 As shown in FIG. 1 , a knowledge graph triple verification method based on multi-hop reasoning performs the following steps:
[0035] Step S1: Obtain a small-scale knowledge graph triple dataset that has been constructed and generate negative examples;
[0036] Step S2: establishing a triple knowledge graph dataset and an initialized triple confidence prediction model for multi-hop reasoning based on the data generated in step S1;
[0037] Step S3: Use the data set in step S2 to train and test the triplet confidence prediction model for multi-hop reasoning;
[0038] Step S4: Use the model trained in step S3 to verify the confidence values of the newly added triples, and use the verified triples to build a knowledge graph.
[0039] The preprocessing in step S1 includes the following steps:
[0040] Step S11: Obtain a small-scale knowledge graph triple dataset that has been constructed, which contains an entity relationship set E and a corresponding relationship set R, and has been annotated, where the entity relationship dataset ER = {m1, m, ..., m n},m k =(h k , r k , t k );
[0041] Step S12: Generate negative examples for the small-scale knowledge graph triple dataset. The negative example generation is divided into two parts: entity negative example generation and relationship negative example generation.
[0042] Step S13: Merge the knowledge graph triple dataset and the negative examples as the dataset used in this method to form ER = {m1, m, ..., m n},m k =(h k , r k , t k , V), where V represents four prediction results: correct entity, head entity error, relationship error and tail entity error.
[0043] The following steps are used to establish the triple confidence prediction model for the initialized multi-hop reasoning in step S2:
[0044] Step S21: Use the entity feature extraction method of the two-hop approximate attention propagation prediction layer to introduce the entity graph node two-hop method into the relationship between the head entity and the tail entity, and between the tail entity and the head entity to measure the resource flow relationship between the entity nodes. The calculation method is expressed as: π ppr (i x )=(1-β)A β ((1-α)A α π ppr (i x )+αi x )+pi x , where α and β represent the two-hop and one-hop convergence coefficients respectively. In the knowledge graph containing entity relationships, one hop refers to the head node and two hops refers to the tail node. The feature representation of the node is obtained by calculating the resource flow of the head and tail nodes, and the ResourceGATRank model with attention mechanism is used to improve the problem that there may be isolated nodes in the graph, which leads to the non-convergence of the final feature expression. The calculation method is expressed as: π′ ppr (i x )=a i,i Θπ ppr (i x )+∑ j∈N(i) a i,j Θπ ppr (i x ), after multiple iterations, the final result converges to the following expression: π ppr (i x )=[1-(1-β)(1-α)A β A α ] -1 [α(1-β)A β +βI β ]i x , when β = 0, it degenerates into the APPNP model. The multi-hop relationship between entities describes the relationship between entities and is used to express the importance of resource feature values among entities;
[0045] Step S22: Use graph neural network to enhance the effectiveness of data features in represents the set of neighbor nodes of node i with relationship r; c i,r is a regularization constant, c i,r The value of W r (1) is an explicit transformation function, which uses a regularized method to decompose this matrix, thereby reducing the overfitting of the model during training:
[0046] Step S23: Use GGNN to obtain entity path information features. The network uses GRU gating to calculate the feature information in the hidden layer: The node v first aggregates information from its neighboring nodes, It is a submatrix of the adjacency matrix A of the graph, which represents the connection between adjacent nodes. The update function of GRU uses the information from each node's neighbors and the previous time step to update the hidden state of the node. In essence, GGNN is used to generate an output sequence to represent the characteristics of the node path output;
[0047] Step S24: The improved APPNP entity multi-hop feature inference layer, the RGCN entity relationship feature layer and the GGNN path inference layer are used as the graph neural network inference layer. During the training process, the graph neural network inference layer first obtains the entity feature values from the three levels. The verification calculation is as follows: e1 = ResourceGATRank (G), e2 = RGCN (G), e3 = GGNN (G). After initializing the graph neural network, for each triple (h i , e i , t i ), the final verification result is obtained through the following calculation: 4i =h i +r i -t i , e i =[h 1i , t 1i ,h 2i , t 2i ,h 3i , t 3i , e 4i ],s i =σ(fnn(e i )), where s i ∈[0, 1], s i =0 means it is not a triple in this knowledge graph; s i=1 means that this triple is the triple in this knowledge graph, s i The value of represents the confidence level of this triple in the knowledge graph.
[0048] The method for training a triplet confidence prediction model for multi-hop reasoning in step S3 includes the following steps:
[0049] Step S31: Divide the data set into a training set, a test set and a validation set. This part mainly uses the training set and the test set to train and test the triple confidence prediction model of multi-hop reasoning.
[0050] Step S32: During the training process, the training set is used for training, and the loss function used is the cross entropy function, which is used for the gradient update of the model: Determine the settings of hyperparameters such as the number of convergence iterations, entity and relationship embedding dimensions, etc.
[0051] Step S33: Use the test set to evaluate the model performance.
[0052] The verification test of the newly added triple confidence value in step S4 includes the following steps:
[0053] Step S41: pre-process the domain text data, that is, perform relationship classification after word segmentation and entity extraction to form the corresponding triple m′ k =(h′ k ,r k ′,t′ k );
[0054] Step S42: input the triplet of step S41 into the model trained in step S2 to obtain the corresponding classification confidence value;
[0055] Step S43: Filter out triples with high confidence that conform to the knowledge graph, add them to the knowledge graph database, and form a verified knowledge graph.
[0056] Embodiment: In view of the common data missing and redundancy problems in the industrial field, a large amount of process text data of automobile industry production and manufacturing was collected, and a large amount of relevant triple data was obtained through knowledge relationship extraction, which served as the data source for confidence assessment and verification of knowledge graph triples. In order to solve the errors that may occur in the extraction process, careful manual screening and inspection work was carried out, and finally a knowledge graph corpus containing 10,869 high-quality triples was formed, covering 6,200 entities and 4 types of relationships. Some negative examples were generated, and the positive and negative samples were respectively used as training sets and test sets in a ratio of 7:3. Then the positive and negative examples were evenly mixed to obtain the current data set. An id2name dictionary was established for the entities and relationships in the data set to facilitate the Embedding index tagging of entities and relationships.
[0057] The training process of the triple confidence prediction model for multi-hop reasoning includes:
[0058] S1: Initialize weights: Establish embeddings for each entity and relationship, and initialize the weight matrices in the three graphs. The matrices are initialized using random numbers generated by Gaussian distribution X~N(0,1), and the optimizer selects the Adam optimizer.
[0059] S2: Set the training hyperparameters to 10 epochs, the embedding dimension of entities and relations to 50, the two-hop parameters α and β to 0.65 and 0.9 respectively, the dropout value of the model to 0.2, the number of layers of the PGGN module to 10, the number of heads to 3, the output layer dimension to 10, and the learning rate to 10 -2 ~10 -3 , and train the model with these hyperparameter settings.
[0060] S3: The model is tested using the test set and compared with several other models (TransD, TransE, TransH, TransR, InterHT, PairRE, TranS, TripleRE) for performance evaluation. The performance comparison results of multiple models are shown in Table 1.
[0061] As shown in Table 1, by comparing different models, it can be clearly seen that the triple confidence model based on multi-hop nodes proposed by this method performs best in multiple indicators such as recall rate, precision rate and Macro-F1 score. Compared with the baseline model, the overall performance is improved by about 10% to 20%, which strongly proves that the model has significant predictive advantages in industrial knowledge graph triple verification.
[0062] Table 1
[0063] Model Macro-F1 Accuracy Recall TransD 0.4755 0.6251 0.4744 TransE 0.5542 0.7381 0.5621 TransH 0.4588 0.6005 0.4564 TransR 0.5233 0.6941 0.5281 InterHT 0.5564 0.7395 0.5633 PairRE 0.4897 0.6463 0.4922 TranS 0.5141 0.6821 0.5193 TripleRE 0.5541 0.7373 0.5616 This method model 0.711 0.7455 0.7294
[0064] The verification process of the triple confidence prediction model for multi-hop reasoning includes:
[0065] S1: Preprocess the industrial dataset and generate negative examples to synthesize the required dataset.
[0066] S2: Load the model, set the hyperparameters and train the model.
[0067] S3: The three-dimensional feature vectors of the query entity are combined into a fused feature vector, which is then input into a multi-layer neural network and mapped to the output space through nonlinear transformation to obtain the predicted value. Finally, the predicted value is normalized using the softmax function to obtain the final probability distribution.
[0068] Table 2 shows several sample results of the verification, where part_of indicates that the head entity is a part of the tail entity, part_failure indicates a part failure, attr_failure indicates a performance failure, testing_tool indicates a testing tool, TC, HE, RE, and TE indicate correct classification, head entity error, relationship error, and tail entity error, respectively. It can be seen that this method has a significant effect.
[0069] Table 2
[0070]
[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the principles and spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A knowledge graph triple verification method based on multi-hop reasoning, characterized by: Perform the following steps: Step S1: Obtain a small-scale knowledge graph triple dataset that has been constructed and generate negative examples; Step S2: establishing a triple knowledge graph dataset and an initialized triple confidence prediction model for multi-hop reasoning based on the data generated in step S1; Step S3: Use the data set in step S2 to train and test the triplet confidence prediction model for multi-hop reasoning; Step S4: Use the model trained in step S3 to verify the confidence value of the newly added triples, and use the verified triples to build a knowledge graph.
2. The knowledge graph triple verification method according to claim 1, characterized in that: The preprocessing in step S1 includes the following steps: Step S11: Obtain a small-scale knowledge graph triple dataset that has been constructed, which contains an entity relationship set E and a corresponding relationship set R, and has been annotated. The entity relationship dataset ER = {m1,m,…,m n },m k =(h k ,r k ,t k ); Step S12: Generate negative examples for the small-scale knowledge graph triple dataset. The negative example generation is divided into two parts: entity negative example generation and relationship negative example generation. The final annotated dataset is ER = {m1,m,…,m n },m k =(h k ,r k ,t k ,V), where V represents four prediction results: correct entity, wrong head entity, wrong relation and wrong tail entity; Step S13: Merge the knowledge graph triple dataset and the negative examples as the dataset used in this method.
3. The knowledge graph triple verification method according to claim 1, characterized in that: The following steps are used to establish the triple confidence prediction model for the initialized multi-hop reasoning in step S2: Step S21: Use the entity feature extraction method of the two-hop approximate attention propagation prediction layer to introduce the entity graph node two-hop method into the relationship between the head entity and the tail entity, and between the tail entity and the head entity to measure the resource flow relationship between the entity nodes. The calculation method is expressed as: π ppr (i x )=(1-β)A β ((1-α)A α π ppr (i x )+αi x )+βi x , where α and β represent the two-hop and one-hop convergence coefficients respectively. In the knowledge graph containing entity relationships, one hop refers to the head node and two hops refers to the tail node. The feature representation of the node is obtained by calculating the resource flow of the head and tail nodes, and the ResourceGATRank model with attention mechanism is used to improve the problem that there may be isolated nodes in the graph, which leads to the non-convergence of the final feature expression. The calculation method is expressed as: After multiple iterations, the final result converges to the following expression: ppr (i x )=[1-(1-β)(1-α)A β A α ] -1 [α(1-β)A β +βI β ]i x , when β = 0, it degenerates into the APPNP model. The multi-hop relationship between entities describes the relationship between entities and is used to express the importance of resource feature values among entities; Step S22: Use graph neural network to enhance the effectiveness of data features in represents the set of neighbor nodes of node i with relationship r; c i,r is a regularization constant, c i,r The value of W r (1) is an explicit transformation function, which uses a regularized method to decompose this matrix, thereby reducing the overfitting of the model during training: Step S23: Use GGNN to obtain entity path information features. The network uses GRU gating to calculate the feature information in the hidden layer: The node v first aggregates information from its neighboring nodes, It is a submatrix of the adjacency matrix A of the graph, which represents the connection between adjacent nodes. The update function of GRU uses the information from each node's neighbors and the previous time step to update the hidden state of the node. In essence, GGNN is used to generate an output sequence to represent the characteristics of the node path output. Step S24: The improved APPNP entity multi-hop feature inference layer, the RGCN entity relationship feature layer and the GGNN path inference layer are used as the graph neural network inference layer. During the training process, the graph neural network inference layer first obtains the entity feature values from the three levels. The verification calculation is as follows: e1 = ResourceGATRank (G), e2 = RGCN (G), e3 = GGNN (G). After initializing the graph neural network, for each triple (h i ,e i ,t i ), the final verification result is obtained through the following calculation: 4i =h i +r i -t i , e i =[h 1i ,t 1i ,h 2i ,t 2i ,h 3i ,t 3i ,e 4i ],s i =σ(fnn(e i )), where s i ∈[0,1],s i =0 means it is not a triple in this knowledge graph; s i =1 means that this triple is the triple in this knowledge graph, s i The value of represents the confidence level of this triple in the knowledge graph.
4. The knowledge graph triple verification method according to claim 1, characterized in that: The method for training and testing the triplet confidence prediction model for multi-hop reasoning in step S3 adopts the following steps: Step S31: Divide the data set into a training set, a test set and a validation set. This part mainly uses the training set and the test set to train and test the triple confidence prediction model of multi-hop reasoning. Step S32: During the training process, the training set is used for training, and the loss function used is the cross entropy function, which is used for the gradient update of the model: Step S33: Use the test set to evaluate the model performance.
5. The knowledge graph triple verification method according to claim 1, characterized in that: The verification test of the newly added triple confidence value in step S4 includes the following steps: Step S41: pre-process the domain text data, that is, perform relationship classification after word segmentation and entity extraction to form corresponding triples m ′ k =(h ′ k ,r k ′ ,t ′ k ); Step S42: input the triplet of step S41 into the model trained in step S2 to obtain the corresponding classification confidence value; Step S43: Filter out triples with high confidence that conform to the knowledge graph, add them to the knowledge graph database, and form a verified knowledge graph.
Citation Information
Cited By
Knowledge graph-based self-interpretation multi-hop reasoning and dynamic optimization method and system
CN121189497A
Self-explaining multi-hop reasoning and dynamic optimization method and system based on knowledge graph
CN121189497B
