A reasoning method and device for knowledge graph multi-hop question answering and a storage medium
Patent Information
- Application Number
- CN202410408540.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-07
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2044-04-07
AI Technical Summary
[0005]针对上述现有技术的缺陷,本发明提供了一种用于知识图谱多跳问答的推理方法,针对不完整(缺失关系)的知识图谱进行多跳问答推理,提高问答任务的准确率
[0031]1、使用TuckER分解策略,能够捕捉知识图谱中更全面的特征,可以将语料库中的正例和负例三元组完全区分,并且TuckER获得完全表达能力所需的嵌入维度下限要小于其他的线性模型。
Smart Images

Figure CN118503366B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information retrieval technology, and in particular to a reasoning method, apparatus, and computer storage medium for multi-hop question answering of knowledge graphs. Background Technology
[0002] Common Knowledge Graph Question Answering (KGQA) tasks are categorized into single-hop and multi-hop forms. Multi-hop QA requires combining two or more facts to answer the question. Currently, reasoning in multi-hop QA still faces many difficulties and challenges, which can be summarized as follows: First, real-world KGs are sparsity; large KGs often suffer from missing relationships, leading to incomplete KGs. Second, in multi-hop KG QA, traditional methods often first identify the topic entity in the question and then find its hop-number neighbors in the KG as candidate answers. However, as the number of hops increases, the number of entity nodes reached may increase exponentially, introducing a large number of irrelevant entities, such as... Figure 1 The example shown is a multi-hop inference path. Due to the lack of links on the KG, it is not possible to directly reach the answer entity from the topic entity. The model needs to go through multi-hop inference, which not only increases the number of inference hops, but also introduces a large number of irrelevant nodes.
[0003] Knowledge Graph Embedding (KGE) uses existing facts in a knowledge graph (KG) to infer missing relations for knowledge graph completion. It leverages a knowledge representation model to learn a low-dimensional vector representation for each entity and relation in the knowledge graph. The goal of representation learning is to train a scoring function for triples (h, r, t) and map entities and relations to a vector space. Chinese patent CN114036275A proposes a multi-hop question-answering method for knowledge graph embedding based on a translation model. This method translates the vector space of the question embedding into the vector space of the entity embedding, addressing the inconsistency between the two and improving question-answering accuracy. Chinese patent CN114168719A proposes a multi-hop question-answering method for knowledge graph embedding based on an attention mechanism. This method performs attention calculations with all potential relations of the question node and incorporates the encoding of highly weighted relations into the question encoding. It then uses the answer to infer the question node and verify the accuracy of the answer. However, these methods perform significantly poorly in link prediction on large KGs.
[0004] To prevent the exponential explosion of multi-hop QA reasoning, Chinese patent CN113297369A proposes an intelligent question-answering system based on knowledge graph subgraph retrieval. This system retrieves matching knowledge graph subgraphs within the knowledge graph, then introduces entity and relation predicates to continue the retrieval, outputs the retrieved knowledge graph subgraphs, prunes them, and finally outputs the corresponding results. Chinese patent CN116719950A proposes an intelligent question-answering method and system based on knowledge graph subgraph retrieval. It converts keywords into more integrated graph data based on selection frequency, and borrows the graph data comparison process during retrieval to quickly locate keywords, greatly reducing the design complexity of the retrieval process and improving question-answering efficiency. However, the intermediate retrieval process of the above methods is usually unobservable, so reasoning on only some subgraphs can increase bias. Summary of the Invention
[0005] To address the shortcomings of the existing technology, this invention provides a reasoning method for multi-hop question answering of knowledge graphs. This method performs multi-hop question answering reasoning on incomplete (missing relationships) knowledge graphs, improving the accuracy of question answering tasks. Another objective of this invention is to provide a reasoning device for multi-hop question answering of knowledge graphs and a corresponding computer storage medium.
[0006] The technical solution of this invention is as follows: A reasoning method for multi-hop question answering in knowledge graphs, comprising the following steps:
[0007] Step 1: Convert the knowledge graph embedding into a link prediction task, and train the knowledge graph embedding model on the link prediction task.
[0008] Step 2: Use a deep learning language model to identify the subject entities of the question;
[0009] Step 3: Retrieve k-hop neighbor entities around the question topic entity, entities semantically similar to the question topic entity, and their surrounding k-hop neighbor entities from the knowledge graph as a relevance subgraph;
[0010] Step 4: Perform pruning operations on all entity nodes in the correlation subgraph to obtain a set of candidate answers;
[0011] Step 5: Calculate the knowledge graph embedding score and the link score for the candidate answers using the knowledge graph embedding scoring function and the link scoring function, respectively.
[0012] Step 6: Perform a composite score on the answer based on the knowledge graph embedding score and the link score, and select the optimal answer entity after sorting the composite scores.
[0013] Furthermore, in step one, the knowledge graph embedding model TuckER is used to predict links in the binary tensor representation of the knowledge graph, and the triplet scoring function is: Then, a knowledge graph embedding model is trained on a link prediction task, using the following loss function: Where e h and e t It is an entity vector, ω r It is a relation vector, d e and d r These are the vector dimensions of entities and relations, respectively. W is the core tensor obtained from model decomposition. n p represents the tensor product along the nth order modulus. (i) Let y be the predicted probability distribution of observed sample i belonging to a certain category, y be the true label distribution, and y(i) be the label of the i-th sample, with 1 for positive examples and 0 for negative examples.
[0014] Furthermore, the deep learning language model in step two is BERT+BiLSTM+CRF.
[0015] Furthermore, in step three, the entities that are semantically similar to the question's topic entity are found by querying the knowledge graph embedding vector to identify the three entities that are most semantically similar to the question's topic entity, where k = 3.
[0016] Furthermore, in step four, two deep learning language models, BiLSTM, are used to encode the question and the entities in the relevant subgraph, respectively. After pooling, an attention mechanism is used to interact with them, and the cosine similarity between the question vector and the entity vector in the relevant subgraph is calculated to obtain the candidate answer set D = max(cosine(q,a),n), where q is the question, a is the entity in the relevant subgraph, and n is the number of candidate answers.
[0017] Furthermore, step five includes: first, encoding the question using the deep learning language model RoBERTa, and replacing the triplet scoring function obtained in step one with the topic entity e, the question q, and the answer entity a. for Construct positive and negative samples for fine-tuning, and calculate a knowledge graph embedding score for each candidate answer. In addition, a scoring function for measuring the relevance of network learning is constructed. When there is an optimal connectivity link between the topic entity and the answer entity, the link scoring function is: When there is no optimal connectivity link between the topic entity and the answer entity, the link scoring function is: Re represents the real part of the complex number, w q To embed and obtain the question encoding vector, w e and w a The embedding encoding vectors for the topic entity and the candidate answer entity, R is used for relation encoding in knowledge graph embedding. (e,a)From the relation sequence (r1,r2,…,r) n The query chain consists of σ, where σ is the activation function and L(·) is the pre-trained language model. It refers to the set of relations that can reach the answer entity.
[0018] Furthermore, in step six, the composite score answer = arg max S a (e,q,a)+β*S R (R (e,a),q ), S a (e,q,a) represents the knowledge graph embedding score, S R (R (e,a),q The link score is given by β, where β is the weight.
[0019] The present invention also provides a reasoning device for multi-hop question answering in knowledge graphs, comprising:
[0020] Knowledge graph embedding module: Converts knowledge graph embedding into a link prediction task, and trains the knowledge graph embedding model on the link prediction task;
[0021] Question Topic Entity Recognition Module: Uses a deep learning language model to recognize question topic entities;
[0022] Subgraph retrieval module: Retrieves k-hop neighbor entities around the question topic entity, entities semantically similar to the question topic entity, and their surrounding k-hop neighbor entities in the knowledge graph as a relevance subgraph;
[0023] Candidate answer generation module: Performs pruning operations on all entity nodes in the relevance subgraph to obtain a set of candidate answers;
[0024] Answer scoring module: Calculates the knowledge graph embedding score and the link scoring function for the candidate answers, respectively; and,
[0025] Answer selection module: The answer is given a composite score based on the knowledge graph embedding score and the link score, and the optimal answer entity is selected after sorting the composite scores.
[0026] Furthermore, the knowledge graph embedding module uses the TuckER knowledge graph embedding model to predict links in the binary tensor representation of the knowledge graph, and the triplet scoring function is: Then, a knowledge graph embedding model is trained on a link prediction task, using the following loss function: Where e h and e t It is an entity vector, ω r It is a relation vector, d e and d rThese are the vector dimensions of entities and relations, respectively. W is the core tensor obtained from model decomposition. n p represents the tensor product along the nth order modulus. (i) Let y be the predicted probability distribution of observed sample i belonging to a certain category, y be the true label distribution, and y(i) be the label of the i-th sample, with 1 for positive examples and 0 for negative examples.
[0027] Furthermore, the answer scoring module first encodes the question using the RoBERTa deep learning language model, and then replaces the triplet scoring function obtained in step one with the topic entity e, the question q, and the answer entity a. for Construct positive and negative samples for fine-tuning, and calculate a knowledge graph embedding score for each candidate answer. In addition, a scoring function for measuring the relevance of network learning is constructed. When there is an optimal connectivity link between the topic entity and the answer entity, the link scoring function is: When there is no optimal connectivity link between the topic entity and the answer entity, the link scoring function is: Re represents the real part of the complex number, w q To embed and obtain the question encoding vector, w e and w a The embedding encoding vectors for the topic entity and the candidate answer entity, R is used for relation encoding in knowledge graph embedding. (e,a) From the relation sequence (r1,r2,…,r) n The query chain consists of σ, where σ is the activation function and L(·) is the pre-trained language model. It refers to the set of relations that can reach the answer entity.
[0028] The present invention also provides a computer storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, it implements the above-described reasoning method for multi-hop question answering of knowledge graphs.
[0029] This invention proposes an efficient multi-hop question-answering reasoning model for knowledge graphs. It employs a TuckER decomposition strategy to predict links in the binary tensor representation of the knowledge graph, and trains a knowledge graph embedding model on this task. The trained representation is then applied to downstream question-answering tasks. A deep learning language model is used to evaluate the relevance scores of the question and all nodes in the retrieved subgraph, and pruning is performed to narrow down the candidate answer range. Answer selection is then based on a comprehensive score combining triples and link mechanisms.
[0030] Compared with the prior art, the advantages of the technical solution provided by the present invention are as follows:
[0031] 1. Using the TuckER decomposition strategy, more comprehensive features in the knowledge graph can be captured. It can completely distinguish between positive and negative triples in the corpus, and the lower bound of the embedding dimension required for TuckER to obtain full expressive power is smaller than that of other linear models.
[0032] 2. The use of subgraph retrieval and pruning strategies narrows the range of candidate answers, alleviates the problem of exponential explosion of jump count during question-answering reasoning, and reduces the interference of irrelevant entities on answer reasoning.
[0033] 3. Use a link scoring strategy to score the existence of a connection link between the topic entity and the answer entity, thereby mitigating the shortcomings of simply using knowledge graph embedding for answer scoring. Attached Figure Description
[0034] Figure 1 This is an example of a multi-hop question-and-answer graph with missing links.
[0035] Figure 2 This is a schematic diagram of the reasoning method for multi-hop question answering in knowledge graphs according to the present invention.
[0036] Figure 3 Tensor decomposition graph for knowledge graph embedding model.
[0037] Figure 4 This is a module for subgraph retrieval and candidate answer generation.
[0038] Figure 5 This is a diagram of the reasoning architecture for a question-and-answer instance of the present invention.
[0039] Figure 6 The architecture for the question encoding model. Detailed Implementation
[0040] The present invention will be further described below with reference to embodiments. It should be understood that these embodiments are only for illustrating the present invention and are not intended to limit the scope of the present invention. After reading this description, any modifications of this description in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0041] Please combine Figure 1 As shown, the embodiment of the present invention is a reasoning method for multi-hop question answering in knowledge graphs. First, the public datasets for multi-hop question answering are downloaded. The MetaQA and WebQuestionsSP datasets are obtained from open source dataset websites. After data preprocessing, subsequent steps are performed.
[0042] The data preprocessing process involves preprocessing the downloaded source text data to ensure it is input into the model in a specified format. Due to the massive size of the WebQuestionsSP knowledge graph, to optimize it, the knowledge graph is limited to a subset of Freebase, using all neighboring entities within two hops of the question topic entity, and further pruning is performed to include only the relationships mentioned in the question-and-answer dataset. Additionally, to simulate multi-hop reasoning under missing links, half of the triples in MetaQA and WebQuestionsSP are randomly removed to simulate an incomplete knowledge graph.
[0043] The next steps include:
[0044] Step 1: Use the TuckER decomposition strategy to predict links in the binary tensor representation of the knowledge graph and train the knowledge graph embedding model.
[0045] Knowledge graph embedding is transformed into a link prediction task, avoiding the long-distance dependency problem caused by excessively long inference paths in multi-hop question-answering tasks, or the problem of not finding the answer entity due to missing knowledge graph relationships. A knowledge graph can be represented as a third-order binary tensor, where each element corresponds to a triplet fact in the knowledge graph, with a value of 1 representing a true fact and 0 representing a false or missing fact. The knowledge graph embedding model TuckER is a linear model based on binary tensor decomposition. This model can capture more comprehensive features in the knowledge graph, completely distinguishing between positive and negative triplets in the corpus. Furthermore, the lower bound of the embedding dimension required to obtain full expressive power is smaller than other linear models. The tensor decomposition diagram of the knowledge graph embedding model is shown below. Figure 3 As shown, where e h and e t It is the vector of the head entity and the tail entity, ω r It is a relation vector, d e and d r These are the vector dimensions of entities and relationships, respectively.
[0046] Triple scoring function for knowledge graph embedding model.
[0047]
[0048] Where W is the core tensor obtained from model decomposition, × n This represents the tensor product along the nth order modulus.
[0049] The knowledge graph embedding model is trained using the Bernoulli log-likelihood loss function.
[0050]
[0051] p (i)Let y(i) be the predicted probability distribution of observed sample i belonging to a certain category, y(i) be the true label distribution, and y(i) be the label of the i-th sample, with 1 for positive examples and 0 for negative examples.
[0052] Step 2: Use a deep learning language model to identify the subject entities of the question.
[0053] Identifying the main entities in a question serves two purposes: it provides the starting point for the reasoning path and allows for the selection of relevant candidate answers. Specifically, the deep learning language model BERT+BiLSTM+CRF is used to transform question main entity identification into a sequence labeling problem, with data labeled using the BIO method. The question is represented at a fine-grained word level and then input into the BERT+BiLSTM+CRF model, where positional encoding is used to extract features. Finally, the BERT+BiLSTM+CRF model outputs a prediction result for each word. The BERT+BiLSTM+CRF model is trained using the cross-entropy loss function.
[0054] Step 3: Perform subgraph retrieval based on the question's subject entity.
[0055] To mitigate the exponential explosion of hop counts during question-answering reasoning, subgraph retrieval is performed on the knowledge graph. Furthermore, to reduce interference from irrelevant entities in answer reasoning, candidate answers are generated from the retrieved subgraphs. The subgraph retrieval and candidate answer generation process is as follows: Figure 4 As shown, the subgraph retrieval method is as follows: The knowledge graph retrieves the 3-hop neighbors surrounding the question's topic entity as a relevance subgraph. Furthermore, since large knowledge graphs often have missing relationships, the question answer might be the tail entity pointed to by the missing relationship. Missing relationships may prevent the reasoning path from directly reaching the tail entity from the head entity. To make the model utilize the subgraph more fully, this step also queries the knowledge graph embedding vectors to find the 3 entity nodes most semantically similar to the question's topic entity, including them in the subgraph retrieval scope, and then finds the 3-hop neighbor nodes of these entity nodes.
[0056] Step 4: Prune the correlation subgraph to generate candidate answers.
[0057] The candidate answer generation method is as follows: all entity nodes in the question and the relevance subgraph are input into a BiLSTM model for encoding. The question encoding applies an attention mechanism to each node vector in the relevance subgraph and assigns a weight to each node vector. Then, features are extracted through pooling. Finally, the cosine similarity between the two vectors is calculated to evaluate the relevance of each entity node in the question and the relevance subgraph. The relevance subgraph is then pruned to obtain the candidate answer set.
[0058] D = max(cosine(q,a),n)
[0059] Where q is the question, a is the entity in the relevance subgraph, and n is the number of candidate answers.
[0060] Step 5: Calculate the answer scores for knowledge graph embeddings and links.
[0061] Answer scoring, based on knowledge graph embedding representation, question encoding, and a trained triplet scoring function, scores each entity in the candidate answer set and selects the optimal answer. Figure 5 As shown.
[0062] The question is encoded using the RoBERTa model to obtain a 768-dimensional vector. After fusing sentence feature information with CLS labels, a four-layer feedforward neural network is connected. Figure 6 This is a diagram of the question encoding model architecture. The topic entity e, question q, and answer entity a are replaced with the triplet scoring function obtained in step one. for By constructing positive and negative samples for fine-tuning, the final mapping is to the same vector space as the entities and relations in the knowledge graph, so that the encoding of the question in the complex space has a strong semantic relationship with the topic entities and the answer.
[0063]
[0064]
[0065] Where A is the set of correct answers. If a correct answer is in A, the score is greater than 0; otherwise, it is a negative sample and the score is less than 0.
[0066] Calculate a knowledge graph embedding score for each candidate answer.
[0067]
[0068] Where Re represents the real part of the complex number, w q To embed the question encoding vector, w e and w a is the embedding encoding vector for the topic entity and the candidate answer entity.
[0069] The advantage of question answering methods based on knowledge graph embedding is their strong link prediction ability for sparse graphs. This is because the method is less reliant on inference paths; even when inference paths are missing, the implicit relational paths existing in the knowledge graph can still achieve high confidence in the answer. However, simply using knowledge graph embedding for answer scoring weakens this advantage. This paper introduces a link scoring mechanism and constructs a scoring function to measure the relevance of network learning, overcoming the aforementioned scoring shortcomings.
[0070]
[0071] in σ represents the relation encoding in knowledge graph embedding, σ is the activation function, and L(·) is the pre-trained language model.
[0072] When there is an optimal connectivity link between the topic entity and the answer entity, the link scoring function is...
[0073]
[0074] When there is no optimal connectivity link between the topic entity and the answer entity, the link scoring function...
[0075]
[0076] Where R (e,a) Given a relation sequence (r1, r2, ..., r n ) form a query link, It refers to the set of relations that can reach the answer entity.
[0077] Step Six: Select the answer after comprehensive scoring.
[0078] Answers are scored using a combination of knowledge graph embedding scores and link scores, and the optimal answer entity is given after ranking.
[0079] answer = arg max S a (e,q,a)+β*S R (R (e,a),q )
[0080] Where β is a weight.
[0081] It should be noted that the specific methods of the above embodiments can form a computer program product. Therefore, the computer program product implemented in this application can be stored on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.).
[0082] Another embodiment of the present invention is a reasoning device for multi-hop question answering of knowledge graphs, which includes: a preprocessing module, a knowledge graph embedding module, a question topic entity recognition module, a subgraph retrieval module, a candidate answer generation module, an answer scoring module, and an answer selection module.
[0083] The preprocessing module performs the data preprocessing tasks described in the previous embodiments, inputting data into the model in a specified format. The knowledge graph embedding module implements step one of the previous embodiments, converting knowledge graph embedding into a link prediction task and training the knowledge graph embedding model on the link prediction task. The question topic entity recognition module implements step two of the previous embodiments, using a deep learning language model to identify question topic entities. The subgraph retrieval module implements step three of the previous embodiments, retrieving k-hop neighbors of the question topic entity, semantically similar entities, and their surrounding k-hop neighbors from the knowledge graph as a relevance subgraph. The candidate answer generation module implements step four of the previous embodiments, pruning all entity nodes in the relevance subgraph to obtain a set of candidate answers. The answer scoring module implements step five of the previous embodiments, calculating answer scores for candidate answers using both the knowledge graph embedding scoring function and the link scoring function. The answer selection module implements step six of the previous embodiments, performing a composite score on the answers based on the knowledge graph embedding score and the link score, ranking them, and selecting the optimal answer entity.
[0084] To verify the technical effects of the present invention, the following experiments were conducted.
[0085] Experimental environment
[0086] The experimental environment for this invention was as follows: Ubuntu 16.04, Intel Core i5-11400F processor, 32GB of RAM, four P100 GPUs with a total of 64GB of video memory. The experimental code for this invention was implemented using Python.
[0087] Experimental results
[0088] To better compare the advantages of different methods, this invention uses four comparative method experiments, including PullNet, which uses a graph-like convolutional network to extract answers from the constructed subgraph; EmbedKGQA, which first embeds the knowledge graph for knowledge graph question answering and uses candidate answer information to select the answer; LEGO, which uses a general latent execution-guided bottom-up search process to efficiently find good execution trajectories in a broad query space; and NRQA, which uses a neighbor interaction network to capture information about entity neighbor interactions to solve multi-hop question answering of incomplete knowledge graphs.
[0089] This invention uses Hits@1, a common evaluation metric in the knowledge graph field, to evaluate the experiment. This metric refers to the average proportion of triples with a ranking of less than or equal to 1 in link prediction, that is, ranking the correct answer first through the scoring function.
[0090] Table 1. Experimental results of this invention in multi-hop question answering on knowledge graphs.
[0091]
[0092] As shown in Table 1, this invention demonstrates superior performance compared to the other four methods. Tests were conducted on MetaQA datasets with varying hop counts, assessing the completeness of the knowledge graph. While EmbedKGQA, LEGO, and NRQA showed considerable performance (all exceeding 70) due to the ability of knowledge graph embedding to model relational composition, the answer entities are typically located within the question graph. This invention's unique subgraph retrieval and pruning strategy not only narrows the retrieval scope but also includes candidate answer entities within the subgraph as much as possible, resulting in superior experimental results compared to the aforementioned three models. Furthermore, PullNet's graph convolution strategy performs well on 2-hop datasets, but its subgraph construction method has limitations, excluding long-distance dependent answer nodes and causing an imbalance in 3-hop results. Therefore, this invention is adaptable to knowledge graph question-answering corpora with varying hop counts.
[0093] The WebQuestionsSP dataset was used to test the completeness of the knowledge graph. Since the number of training examples in the WebQuestionsSP dataset is relatively small compared to MetaQA, and it uses a large supporting knowledge base based on Freebase KG, not all entities involved in the knowledge graph can appear in the training set. This poses a challenge to multi-hop knowledge graph question answering. The TuckER decomposition used in this invention performs link prediction on the binary tensor representation of the knowledge graph. Even with only a small number of fine-tuned question examples, it can comprehensively capture the relevant and necessary information for the question, thereby inferring the multi-hop path required to answer the question. This further demonstrates the effectiveness of this invention in knowledge graph reasoning.
[0094] Therefore, the reasoning method for multi-hop question answering in knowledge graphs proposed in this invention can effectively perform multi-hop question answering reasoning in incomplete (missing relations) knowledge graphs, thereby improving the accuracy of question answering tasks.
Claims
1. A reasoning method for multi-hop question answering in knowledge graphs, characterized in that, Includes the following steps: Step 1: Convert knowledge graph embedding into a link prediction task. Train a knowledge graph embedding model on the link prediction task. Use the TuckER knowledge graph embedding model to predict links on the binary tensor representation of the knowledge graph. The triplet scoring function is: Then, a knowledge graph embedding model is trained on a link prediction task, using the following loss function: ,in and It is an entity vector. It is a relation vector. and These are the vector dimensions of entities and relations, respectively, and W is the core tensor obtained from the model decomposition. Denotes the tensor product along the nth order modulus. Let y be the predicted probability distribution of observed sample i belonging to a certain category, and y be the true label distribution. It is the label of the i-th sample, with 1 for positive examples and 0 for negative examples; Step 2: Use a deep learning language model to identify the subject entities of the question; Step 3: Retrieve k-hop neighbor entities around the question topic entity, entities semantically similar to the question topic entity, and their surrounding k-hop neighbor entities from the knowledge graph as a relevance subgraph; Step 4: Perform pruning operations on all entity nodes in the correlation subgraph to obtain a set of candidate answers; Step 5: Calculate the knowledge graph embedding score and link score for the candidate answers using the knowledge graph embedding scoring function and the link scoring function, respectively. This includes: first, encoding the question using the RoBERTa deep learning language model, and replacing the triplet scoring function obtained in Step 1 with the topic entity e, question q, and answer entity a. for We construct positive and negative samples for fine-tuning and calculate a knowledge graph embedding score for each candidate answer. In addition, a scoring function for measuring the relevance of network learning is constructed. When there is an optimal connected link between the topic entity and the answer entity, the link scoring function is: When there is no optimal connectivity link between the topic entity and the answer entity, the link scoring function is: , Represents the real part of a complex number. To embed the question encoding vector, and The embedding encoding vectors for the topic entity and the candidate answer entity, Encoding relations in knowledge graph embedding. From relational sequence The query chain is composed of For activation function, For pre-trained language models, It refers to the set of relations that can reach the answer entity; Step 6: Perform a composite score on the answer based on the knowledge graph embedding score and the link score, and select the optimal answer entity after sorting the composite scores.
2. The reasoning method for multi-hop question answering in knowledge graphs according to claim 1, characterized in that, In step three, entities semantically similar to the question's topic entity are found by querying the knowledge graph embedding vector to identify the three entities most semantically similar to the question's topic entity, where k=3.
3. The reasoning method for multi-hop question answering in knowledge graphs according to claim 1, characterized in that, In step four, two deep learning language models, BiLSTM, are used to encode the question and the entities in the relevant subgraph, respectively. After pooling, an attention mechanism is used for interaction, and the cosine similarity between the question vector and the entity vector in the relevant subgraph is calculated to obtain a set of candidate answers. q represents the question, a represents the entity in the relevance subgraph, and n represents the number of candidate answers.
4. The reasoning method for multi-hop question answering in knowledge graphs according to claim 1, characterized in that, The composite scoring in step six , Embed scoring into knowledge graphs. Score the link. For weights.
5. A reasoning device for multi-hop question answering in knowledge graphs, characterized in that, include: Knowledge graph embedding module: This module transforms knowledge graph embedding into a link prediction task. A knowledge graph embedding model is trained on this task, and the TuckER knowledge graph embedding model is used to predict links on the binary tensor representation of the knowledge graph. The triplet scoring function is as follows: Then, a knowledge graph embedding model is trained on a link prediction task, using the following loss function: ,in and It is an entity vector. It is a relation vector. and These are the vector dimensions of entities and relations, respectively, and W is the core tensor obtained from the model decomposition. Denotes the tensor product along the nth order modulus. Let y be the predicted probability distribution of observed sample i belonging to a certain category, and y be the true label distribution. It is the label of the i-th sample, with 1 for positive examples and 0 for negative examples; Question Topic Entity Recognition Module: Uses a deep learning language model to recognize question topic entities; Subgraph retrieval module: Retrieves k-hop neighbor entities around the question topic entity, entities semantically similar to the question topic entity, and their surrounding k-hop neighbor entities in the knowledge graph as a relevance subgraph; Candidate answer generation module: Performs pruning operations on all entity nodes in the relevance subgraph to obtain a set of candidate answers; Answer scoring module: The knowledge graph embedding scoring function and link scoring function are used to calculate the knowledge graph embedding score and link score for the candidate answers, respectively. This includes: firstly, encoding the question using the RoBERTa deep learning language model, and then replacing the triplet scoring function obtained in step one with the topic entity e, question q, and answer entity a. for We construct positive and negative samples for fine-tuning and calculate a knowledge graph embedding score for each candidate answer. In addition, a scoring function for measuring the relevance of network learning is constructed. When there is an optimal connected link between the topic entity and the answer entity, the link scoring function is: When there is no optimal connectivity link between the topic entity and the answer entity, the link scoring function is: , Represents the real part of a complex number. To embed the question encoding vector, and The embedding encoding vectors for the topic entity and the candidate answer entity, Encoding relations in knowledge graph embedding. From relational sequence The query chain is composed of For activation function, For pre-trained language models, It refers to the set of relations that can reach the answer entity; Answer selection module: The answer is given a composite score based on the knowledge graph embedding score and the link score, and the optimal answer entity is selected after sorting the composite scores.
6. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the reasoning method for multi-hop question answering of knowledge graphs as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Intelligent question and answer system based on knowledge graph subgraph retrieval
CN113297369A
Knowledge graph embedded multi-hop question and answer method,
CN114036275A
Knowledge graph embedding-based interpretable multi-hop question and answer method and system
CN114168719A
Intelligent question and answer method and system based on knowledge graph subgraph retrieval
CN116719950A