Knowledge graph multi-hop retrieval method fusing semantic analysis and graph embedding
Through the knowledge graph multi-hop retrieval method that integrates semantic analysis and graph embedding, the problem of insufficient efficiency and accuracy in complex queries and fuzzy matching of existing technologies is solved, and the more comprehensive utilization of knowledge graph information is achieved, and the accuracy and efficiency of question-and-answer are improved.
Patent Information
- Application Number
- CN202510092185.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-06-13
AI Technical Summary
Existing knowledge graph question and answer technologies are inefficient and accurate in handling complex queries and fuzzy matching, especially in knowledge graphs in scarce data or domain-specific fields, where the generalization ability and accuracy of the model are limited.
A knowledge graph multi-hop search method that combines semantic analysis and graph embedding is adopted, semantic analysis is performed through the RoBERTa model, graph embedding is performed in combination with graph convolution network, entity and relationships are represented by sparse matrices, and relationships are represented by TransformerEncoder model, and relationship feature scores and probability calculations are achieved to achieve the comprehensive utilization of knowledge graph information.
By integrating semantic space and graph embedding space, the more comprehensive utilization of knowledge graph information is achieved, and the accuracy and efficiency of question-and-answer questions are improved. Especially in applications in scarce data or specific fields, the generalization ability and accuracy of the model have been improved.
Smart Images

Figure CN120144736A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knowledge graph question answering, and specifically to a multi-hop retrieval method for knowledge graphs that combines semantic parsing and graph embedding. Background Art
[0002] With the advent of information technology and the big data era, knowledge graphs, as an effective knowledge management tool, have been widely used in multiple fields such as information retrieval, recommendation systems, and intelligent question answering. Knowledge graphs represent various complex relationships between entities through a graphical structure, providing the possibility for machines to understand and process human knowledge.
[0003] Knowledge graphs are usually constructed in the form of a series of triples, including entities, relations, and values. Through this structured representation, various relationships and attributes in the real world can be simulated. Currently, the retrieval methods for knowledge graphs rely on exact matching and basic graph query techniques, which are often inadequate when dealing with complex queries and fuzzy matching. There are mainly two types of knowledge graph question answering techniques for complex questions: semantic analysis-based and information retrieval-based. The semantic analysis-based method converts the question sentence into a structured logical form, and finally into query statements such as sparql and Cypher, which are executed in the database to obtain answers.
[0004] The information retrieval-based method starts from the topic entity of the question sentence, and through multi-hop retrieval, calculates the semantic relevance between different candidate paths and the question description to obtain the final answer. The semantic analysis-based method is difficult to generate accurate query statements in the question answering of complex questions, and the current information retrieval methods often only use semantic matching or graph embedding, without making full use of the information of the knowledge graph.
[0005] The semantic parsing-based method uses pre-trained models to generate query statements, and the accuracy cannot be well guaranteed. This is because pre-trained models are usually trained on general datasets, and they may not be optimized for specific domains or specific query contexts, resulting in difficulty in understanding complex query intents or capturing subtle semantic differences in specific application scenarios. In addition, pre-trained models often rely on a large amount of data input. When encountering knowledge graphs with scarce data or special domains, the generalization ability and accuracy of the models will be greatly reduced.
[0006] When the information retrieval-based method maps the question sentence and the entities and relations in the knowledge graph to the same space, it fails to effectively distinguish the different natures of entities and relations. Simply relying on the semantic space or the graph embedding space for matching makes the system unable to fully utilize the respective features of entities and relations, reducing the relevance of the retrieval results. Summary of the Invention
[0007] The purpose of the present invention is to provide a knowledge graph multi-hop retrieval method that fuses semantic parsing and graph embedding to solve the problems presented in the above background art.
[0008] To achieve the above object, the present invention provides the following technical solution: A knowledge graph multi-hop retrieval method that fuses semantic parsing and graph embedding, including the following steps;
[0009] Step 1, construct a knowledge graph; assign unique numbers to all entities and relationships in the knowledge graph. Assume that in the knowledge graph G, there are entities E = {e 1 , e 2 , …, e N} and relationships R = {r 1 , r 2 , …, r M}. Entities and relationships will be mapped to numbers id(e i ) and id(r j ), where e i ∈ E and r j ∈ R, and all ids start from 1. Add meaningless entities e 0 and relationships r 0 , and both ids represent 0.
[0010] Step 2, perform semantic parsing of the question and capture the semantic information of the question sentence and relationships; use RoBERTa as the semantic parsing model.
[0011] Step 3, perform graph embedding based on the graph convolutional network; perform feature learning on the entities in the graph through the graph convolutional network to update the embedding representation of the entities. GCN aggregates information for each entity through the adjacency matrix and learns the relationships and context information between entities.
[0012] Step 4, represent the entities and relationships in the knowledge graph in the form of a sparse matrix; the row indices of the sparse matrices S subj , S obj , S rel represent the numbers of the triples. Each row of S subj uses a one-hot vector to represent the head entity of the triple, each row of S obj uses a one-hot vector to represent the tail entity of the triple, and each row of S rel uses a one-hot vector to represent the relationship of the triple.
[0013] Step 5, model construction. The question semantics Sem q is enhanced through a linear layer to obtain q query , q query = linear(Sem q );
[0014] Step 6: Obtain the initial entity e init The top k entity relationships r of the adjacency relationship of k According to the obtained r k Index to obtain the corresponding relationship semantics r sem_k Meanwhile, establish the mask matrix r of r k ; mask
[0015] Step 7: Use q query As the query volume, relationship semantics r sem_k As the key and value, pass through the TransformerEncoder model to output the feature scores of each relationship, and finally output the probability through the relu activation and softmax layers; The TransformerEncoder module first obtains the query, key, and value through linear transformation, then inputs them into the multi-head attention network to calculate the attention scores in parallel, and then performs residual connection and feed-forward network. Here, attn_output is added to value. After addition, it passes through a Dropout layer and a Layer Normalization layer to form a new input value, and the probability is calculated to obtain the final output probability.
[0016] Step 8: According to the relationship index r k Put the relationship probability r probs Into the relationship matrix r, and obtain the entity inference probability of the current step according to the coefficient matrix multiplication;
[0017] Step 9: Judge whether the number of inference steps t is greater than or equal to the preset maximum number of steps t max , if yes, proceed to the next step; if no, increase the number of steps t by 1, and update the initial entity e init To the entity with the highest probability in the entity inference probability e prob , and return to Step 5;
[0018] Step 10: Skip number probability prediction. After enhancing the question through a linear layer, make a difference with the relationship semantics Sem rel , flatten and input it into the classifier to obtain the probability hop of the skip number prediction selector ;
[0019] Step 11: Entity prediction. Multiply the entity probability at the i-th step By the probability at this step And accumulate the probabilities of different steps to obtain the probability of entity j as e p1 ; Take the top 3k entities with the highest probability in e p1 , and obtain the corresponding graph embedding e according to the overall embedding e emb emb3k , map the question Sem q Into the embedding space q through linear transformationemb and take q emb the difference from e emb3k is input into the TransformerEncoder module, and the feature scores of each relationship are output. Finally, the probability result is output through the relu activation and the softmax layer 3k According to the entity index, result 3k is restored to a vector with the length of the total number of entities to obtain e p2
[0020] Step Twelve, output the result. The final entity probability is e p = e p1 ⊙e p2 and output e p the entity with the highest probability in e
[0021] Step Thirteen, model training, explore whether there is a better possibility based on the ε-greedy strategy
[0022] Furthermore, in Step Thirteen, set an ε value at the beginning of training, decrease ε with the number of iterations, generate a random number and compare it with ε. Each time a decision is made, randomly draw a number ξ from the uniform distribution U(0,1). If 0 < ξ < ε, then perform the exploration behavior; otherwise, perform normal calculation
[0023] Based on the loss function, combine the probability error of entity prediction, and the norm error between the problem semantics and the relationship semantics. When the final predicted answer is not the actual answer, the loss function includes the MSE error between the probability of entity prediction and the actual probability, and the norm between the problem semantics and the semantics r maxi of the relationship with the highest probability. When the final predicted answer is not the actual answer, the value of the loss function is 0
[0024] Set different weights for the answer entity and the non-answer entity
[0025]
[0026]
[0027] where w i , e reali , e prei are the weight, true probability, and predicted probability of the i-th entity respectively, Sem q is the problem semantics, r maxi represents the semantics of the relationship with the highest probability in the i-th relationship jump, e per represents the entity with the highest predicted probability, and loss represents the final loss function
[0028] Compared with the prior art, the beneficial effects of the present invention are
[0029] (1) By integrating the semantic space (capturing the deep semantics of questions and relationships) and the graph embedding space (representing the structured information of entities and relationships), the comprehensive utilization of knowledge graph information is achieved. The semantic space helps to more accurately understand and parse complex question intents, while the graph embedding space provides a structural representation of the relationships between entities. The combination of the two can better simulate the human cognitive process.
[0030] (2) The loss function designed in the present invention includes two parts: the probability error of entity prediction and the norm error of question semantics and relationship semantics. The former ensures the accuracy of the final answer, and the latter promotes a good match between the question and the relationships in the knowledge graph. By setting a higher weight for the answer entity, the importance of the correct answer is further strengthened, prompting the model to pay more attention to key information. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is the flowchart of question answering for the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0033] Embodiment:
[0034] Please refer to Figure 1 , the present invention provides a technical solution: a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding;
[0035] This embodiment proposes an innovative integration strategy aimed at improving the efficiency and accuracy of knowledge graph multi-hop question answering by integrating semantic parsing and graph embedding technologies. This embodiment believes that effective multi-hop question answering should be a process of searching for the entity closest to the meaning of the question in the graph embedding space along the relationship semantic path based on the semantic features of the question. The main features of this embodiment are:
[0036] (1) Semantic-guided path search: Using relationship semantics to guide path exploration and dynamically determining the number of hops according to the semantic content of the question.
[0037] (2) Introducing a probability evaluation mechanism for graph embedding: Introducing the probability evaluation between the question and the entity in the graph embedding space to enhance the relevance and reliability of candidate answers.
[0038] (3) Optimize the loss function design: The specially designed loss function takes into account both the exploration efficiency of the semantic path and the accuracy of the answer, thereby promoting the model to continuously optimize its reasoning ability during training.
[0039] 1. The overall process is as Figure 1 shown, and the knowledge graph is combined to assist in answering the posed questions.
[0040] 2. Specific steps
[0041] In this embodiment, it is assumed that the initial entity has been recognized. The research starts from the initial entity according to the question sentence and explores the final answer entity of the question in the knowledge graph.
[0042] 2.1 Data processing
[0043] First, assign unique numbers to all entities and relationships. Assume that in the knowledge graph G, there are entities E = {e 1 , e 2 , …, e N} and relationships R = {r 1 , r 2 , …, r M}. Entities and relationships will be mapped to numbers id(e i ) and id(r j ), where e i ∈ E and r j ∈ R, and all ids start from 1. Add meaningless entities e 0 and relationships r 0 , and both ids represent 0.
[0044] (1) Semantic parsing
[0045] The core goal of semantic parsing is to accurately capture the deep semantic information of the question sentence and the relationship (r). By deeply understanding the true intention of the question sentence and the type of relationship involved, the system can more accurately locate the relevant knowledge graph entities, thereby improving the efficiency and accuracy of the multi-hop question answering task. RoBERTa (Robustly Optimized BERT Pretraining Approach) is a deep bidirectional transformer model trained on large-scale text data, with strong semantic understanding ability and domain adaptability. In this embodiment, RoBERTa is used as an example of the semantic parsing model:
[0046] Sem rel = RoBERT encoder (r) (1)
[0047] w 1 , w 2 ,..., w n= RobertaTokenizer(q) (2)
[0048]
[0049] Sem rel : Semantic representation of the relationship; Sem q : Semantic representation of the question;
[0050] RoBERTa encoder : RoBERTa encoder; RobertaTokenizer: RoBERTa tokenizer;
[0051] r: relationship; q: question; n: number of words; w i : the i-th word;
[0052] (2) Graph embedding
[0053] The purpose of graph embedding is to map entities and relationships in the knowledge graph to a low-dimensional space so that the semantic information of the nodes in the graph can be effectively captured. In this embodiment, a graph convolutional network (GCN, Graph Convolutional Network) is used as an example of graph embedding, and the features of the nodes (entities) in the graph are learned through GCN to update the embedding representation of the nodes. GCN aggregates information for each node through the adjacency matrix, thereby learning the relationships and context information between the nodes.
[0054] e emb ,r emb = GCN(triplets)
[0055] where triplets are the triples in the knowledge graph, e emb ,r emb are the obtained entity embedding and relationship embedding respectively.
[0056] (3) Sparse matrix construction
[0057] The entities and relationships in the knowledge graph are represented in the form of a sparse matrix. This representation method can not only effectively store the data of large-scale knowledge graphs but also improve the computing efficiency. The sparse matrix S subj ,S obj ,S rel The row index of represents the number of the triple, and S subj each row represents the head entity of the triple with a one-hot vector, S obj each row represents the tail entity of the triple with a one-hot vector, and S rel each row represents the relationship of the triple with a one-hot vector.
[0058] 2.2 Model construction
[0059] Setp1: Question Semantics Sem q After linear layer enhancement, we get q query ,q query = linear(Sem q );
[0060] Setp2: Get the initial entity e init The first k entity relations r of the adjacent relations k , if the number of adjacent relations is less than k, they are supplemented with 0. The choice of k value needs to ensure that all relations of each entity are accommodated as much as possible, and r k The relational index in is unique. k The index obtains the corresponding relational semantics r sem_k , and establish r k The mask matrix r mask The mask matrix r mask Let 1 represent r k The corresponding position is the real relationship, and 0 indicates that the corresponding position is a meaningless 0 index.
[0061] Setp3:q query As the query quantity, the relational semantics r sem_k As keys and values, the feature scores of each relationship are output through the TransformerEncoder module, and finally the probability is output through the relu activation and softmax layer. sem_k There are meaningless relationships, through the dot multiplication mask matrix r mask Set the probability of meaningless positions to zero.
[0062] a) TransformerEncoder module. First, the query, key and value are obtained through linear transformation:
[0063] Q=q query W Q ,K=r sem_k W K ,V=r sem_k W V
[0064] Then input the multi-head attention network and calculate the attention scores in parallel:
[0065]
[0066] attn_output = Concat(head 1 ,head 2 ,…,head h )W O
[0067] where d k is the dimension of the key vector, softmax is used to normalize the attention scores, and each attention head head i = Attention(Q i , K i , V i ), and W O is the output weight matrix.
[0068] Next, a residual connection and a feed-forward network are performed. The main purpose of the residual connection is to avoid the problems of vanishing gradients and exploding gradients, thereby helping to train deeper networks. Here, attn_output (the output of the attention mechanism) is added to value (the output of the previous layer). After addition, it passes through a Dropout layer and a Layer Normalization layer to form a new input value. The feed-forward neural network is used to perform further non-linear transformations on the output of the multi-head self-attention mechanism to enhance the expressive power of the model. The feed-forward neural network consists of two linear transformations and an activation function:
[0069] value = norm1(value + dropout(attn_output))
[0070] ff_output = linear2(activation(linear1(value)))
[0071] value = norm2(value + dropout(ff_output))
[0072] output = linear3(value)
[0073] where norm1 is Layer Normalization, dropout is the Dropout function, attn_output is the output of the multi-head attention mechanism, linear1, linear2, and linear3 are linear layers, and activation is the activation function.
[0074] b) Probability calculation module
[0075] probs = softmax(relu(output))
[0076] r probs = probs ⊙ r mask
[0077] where r probs is the probability of the final output.
[0078] Step4: Inference module. According to the relation index r k Put the relation probability r probs into the relation matrix r. The relation matrix r is a one-dimensional row vector with the length of r equal to the number of relations (including the meaningless relation 0), and x 1 is the one-hot representation of the initial entity. According to the matrix multiplication of the parsing coefficient matrix, the entity inference probability e of the current step is obtained prob :
[0079]
[0080] Step5: Determine whether the number of inference steps t is greater than or equal to the preset maximum number of steps t max . If yes, go to the next step; if no, increase the number of steps t by 1, and update the initial entity e init to the entity with the highest probability in the entity inference probability e prob , and go back to Step1.
[0081] Step6: Skip number probability prediction. After enhancing the question through a linear layer, take the difference with the relation semantics Sem rel and flatten it and input it into the classifier to obtain the probability hop of the skip number prediction selector :
[0082] q hop = linear(Sem q )
[0083] h 1 = ReLU(W 1 (q hop - Sem rel ) + b 1 )
[0084] h 2 = ReLU(W 2 h 1 + b 2 )
[0085] hop selector = softmax(W 3 h 2 + b 3 )
[0086] where W 1 , W 2 , W 3 are weight matrices, and b 1 , b 2 , b 3 are biases.
[0087] Step7: Entity prediction. The entity probability at the i-th step Multiply by the probability of this step and accumulate the probabilities of different steps to obtain the probability of entity j Then the probabilities of all entities e p1 =[eprob 0 ,eprob 1 ,…,eprob j ,…,eprob n-1 ,eprob n (n is the maximum id of the entities). Since the overall number of entities is huge, it increases the calculation of meaningless entities with small probabilities. Take the top 3k entities with medium probabilities in e p1 and obtain the corresponding graph embedding e emb according to the overall embedding e emb3k . Map the question Sem q into the embedding space q emb through a linear transformation, and take the difference between q emb and e emb3k as the input to the TransformerEncoder to output the feature scores of each relationship. Finally, pass through the relu activation and softmax layers to output the probability result 3k . Restore result 3k to a vector with the length of the total number of entities according to the entity index to obtain e p2 .
[0088] Step8: Output the result. The final entity probability is e p =e p1 ⊙e p2 , and output the entity with the highest probability in e p .
[0089] 2.3 Model Training
[0090] 2.3.1 ε-greedy Strategy
[0091] The ε-greedy (epsilon-greedy) strategy is a commonly used exploration vs. exploitation trade-off method in reinforcement learning. It allows the agent to choose a random action with a certain probability to explore the environment when taking an action, and choose the optimal action according to the current policy at other times to exploit the known information. In this way, the ε-greedy strategy can balance the relationship between exploring new knowledge and exploiting existing knowledge during the learning process.
[0092] Implementation of the ε-greedy Strategy
[0093] (1) Initialize the ε value:
[0094] Set a relatively high ε value (e.g., 0.9 or higher) at the initial stage of training, which means the agent will explore with a relatively high probability.
[0095] (2) Gradually decrease ε with the number of iterations:
[0096] As the number of training iterations increases, gradually reduce the ε value. This can be achieved through linear decay, exponential decay, or other forms. The purpose is to make the agent rely more on the learned knowledge over time and reduce the probability of blind exploration.
[0097] (1) Generate a random number and compare it with ε:
[0098] At each decision-making step, randomly draw a number ξ from the uniform distribution U(0, 1). If 0 < ξ < ε, perform the exploration behavior (i.e., generate a random probability probs for Step4 and select a random action); otherwise, perform the exploitation behavior (calculate normally and select the currently estimated optimal action).
[0099] 2.3.2 Loss Function Design
[0100] The loss function combines the probability error of entity prediction, and the norm errors of the question semantics and relation semantics. When the final predicted answer is not the actual answer, the loss function includes the MSE error between the probability of entity prediction and the actual probability, and the norm of the question semantics and the semantics r maxi of each relation with the highest probability; when the final predicted answer is not the actual answer, the loss function value is 0. To increase the importance of the answer, different weights are set for the answer entity and non-answer entities:
[0101]
[0102] where w i , e reali , e prei are the weight, true probability, and predicted probability of the i-th entity respectively,
[0103] Sem q is the question semantics, r maxi represents the semantics of the relation with the highest probability in the i-th relation hop,
[0104] e per represents the entity with the highest predicted probability, and loss represents the final loss function.
[0105] In this embodiment, a question-answering framework for multi-hop path exploration is designed by integrating the semantic space and the knowledge graph's graph embedding space. At the same time, the question semantics, relation semantics, the mapping of the question in the embedding space, and the embedding representation of the entity are applied to question answering.
[0106] In this embodiment, a loss function that combines process relationship semantic matching and final answer matching is designed to clarify the model optimization direction and improve the training efficiency and final performance.
[0107] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding, characterized in that: The following steps are involved: Step 1: Build a knowledge graph; Step 2: semantically analyze the question and capture the semantic information of the question and relations; Step 3: Graph embedding based on graph convolutional network; Step 4: Represent the entities and relationships in the knowledge graph in the form of a sparse matrix; Step 5: Model construction, problem semantics Sem q After linear layer enhancement, we get q query , q query =linear(No q ); Step 6: Get the initial entity e init The first k entity relations r of the adjacent relations k , according to the obtained r k The index obtains the corresponding relational semantics r sem_k , and establish r k The mask matrix r mask ; Step 7, q query As the query quantity, the relational semantics r sem_k As keys and values, the TransformerEncoder model outputs the feature scores of each relationship, and finally outputs the probability through the relu activation and softmax layer; Step 8: According to the relationship index r k The relationship probability r probs Put the relationship matrix r into it, and obtain the entity reasoning probability of the current step according to the coefficient matrix multiplication; Step 9: Determine whether the number of inference steps t is greater than or equal to the preset maximum number of steps t max If yes, proceed to the next step; if no, the step number t increases by 1 and the initial entity e init Updated to entity inference probability e prob The entity with the highest probability returns to step 5; Step 10: Hop count probability prediction. After the problem is enhanced through the linear layer, it is combined with the relational semantic Sem rel Make the difference, flatten it and input it into the classifier to get the probability of hop count prediction selector ; Step 11: Entity prediction: the entity probability of the i-th step The probability of this step Multiply and accumulate the probability of being out of sync, and the probability of entity j is e p1 , based on e p1 And calculate e p2 ; Step 12: Output the result. The final entity probability is e p =e p1 ⊙e p2 , output e p The entity with the highest probability; Step 13: Model training, exploring whether there are better possibilities based on the ε-greedy strategy.
2. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 1, all entities and relations in the knowledge graph are assigned unique numbers. Assume that there is an entity E in the knowledge graph G = {e1, e2, …, e N } and the relation R = {r1,r2,…,r M }, entities and relationships will be mapped to IDs (e i ) and id(r j ), where e i ∈E and r j ∈R, and all ids start from 1, adding meaningless entity e0 and relationship r0, and the ids are all 0.
3. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 2, RoBERTa is used as the semantic parsing model.
4. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized in that: In step three, the graph convolutional network is used to learn the features of the entities in the graph and update the embedded representation of the entities. GCN aggregates information for each entity through the adjacency matrix and learns the relationships and contextual information between entities.
5. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 4, the sparse matrix S subj ,S obj ,S rel The row index of S represents the number of triples. subj Each row uses a one-hot vector to represent the head entity of the triple, S obj Each row uses a one-hot vector to represent the tail entity of the triple, S rel Each row uses a one-hot vector to represent the relationship of the triple.
6. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 7, the TransformerEncoder module first obtains the query, key, and value through linear transformation, then inputs the multi-head attention network, calculates the attention score in parallel, and then performs residual connection and feedforward network. Here, attn_output is added to value, and after addition, it passes through a Dropout layer and a Layer Normalization layer to form a new input value, and the probability of the final output is obtained through probability calculation.
7. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 11, take e p1 The top 3k entities with medium probability are embedded according to the overall emb Get the corresponding graph embedding e emb3k , the problem Sem q After linear transformation, it is mapped into the embedding space q emb , and take q emb With e emb3k The difference is input into the TransformerEncoder module to output the feature scores of each relationship, and finally the probability result is output through the relu activation and softmax layer. 3k , according to the entity index, result 3k Restore it to a vector with a length equal to the total number of entities, and get e p2 .
8. According to claim 1, a knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding is characterized by: In step 13, an ε value is set at the beginning of training, and ε is reduced with the number of iterations. Random numbers are generated and compared. Each time a decision is made, a number ξ is randomly drawn from the uniform distribution U(0,1). If 0<ξ<ε, exploration behavior is performed, otherwise, normal calculation is performed.
9. The knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding according to claim 8 is characterized by: Based on the loss function combining the probability error of entity prediction, the norm error of question semantics and relationship semantics, when the final predicted answer is not the actual answer, the loss function includes the MSE error between the probability of entity prediction and the actual probability, and the semantic error between question semantics and each relationship with the highest probability. maxi norm; when the final predicted answer is not the actual answer, the loss function value is 0.
10. The knowledge graph multi-hop retrieval method integrating semantic parsing and graph embedding according to claim 9 is characterized in that: Set different weights for answer entities and non-answer entities; Where n, w i , e reali , e prei are the number of words, the weight of the i-th entity, the true probability, the predicted probability, and Sem q is the question semantics, r maxi represents the semantics of the relation with the highest probability in the i-th step relation jump, e per It represents the entity with the highest predicted probability, and loss represents the final loss function.
Citation Information
Cited By
Text data structured processing method and system based on semantic recognition
CN120851025A
Text data structurization processing method and system based on semantic recognition
CN120851025B