A knowledge graph-based intelligent question answering method
By employing a bidirectional question-answering attention mechanism and multiple iterations of graph neural networks, the performance limitations of knowledge graph question-answering systems in multi-hop reasoning are addressed, resulting in more efficient intelligent question-answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NAVAL AVIATION UNIV
- Filing Date
- 2024-08-13
- Publication Date
- 2026-05-26
AI Technical Summary
Existing knowledge graph question answering systems struggle to perform multi-hop reasoning effectively when dealing with complex query problems, thus limiting performance improvements.
A bidirectional question-answering attention mechanism combined with multiple iterations of graph neural networks is adopted. The graph neural network is used to mine knowledge graph structure information, and the correlation between entities and questions and knowledge graph representation are updated during the iteration process to extract the most relevant set of answer entities.
It significantly improves performance in multi-hop question answering, especially for complex questions, and can more accurately return the set of answer entities that are strongly related to the question, thereby improving the accuracy and recall of the question answering system.
Smart Images

Figure CN118820442B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an intelligent question-answering method based on knowledge graphs, belonging to the field of artificial intelligence technology. Background Technology
[0002] A knowledge graph is a large-scale semantic network that represents entities and their relationships in the objective world in the form of a graph. Currently, popular general-purpose knowledge graphs include Freebase, Wikidata, and YAGO4, and knowledge graphs have also found industry applications in fields such as medicine, academia, and finance. Knowledge graphs contain massive amounts of knowledge entries, and these entries have complex topological relationships. For users, how to obtain the knowledge they need from this vast and complex knowledge graph is a problem that needs to be solved. To address this, this invention designs an intelligent question-answering system based on knowledge graphs. This system can understand the user's query intent based on the user's question and then provide the relevant entities from the knowledge graph as the answer to the user.
[0003] Traditional Knowledge Graph Question Answering (KGQA) primarily relies on semantic parsing and information retrieval methods. However, for complex queries, answers need to be obtained through reasoning within the knowledge graph, which is lacking in traditional methods. In the paper "Open domain question answering using early fusion of knowledge bases and text," H. Sun et al. proposed a GraftNet model, which employs a variant of graph convolutional networks to perform multi-hop reasoning on the knowledge graph based on the given question text to obtain the answer. In the paper "PullNet: Open domain question answering with iterative retrieval on knowledge bases and text," H. Sun et al. proposed a PullNet model, which creates a question-specific subgraph and then uses a graph neural network-based inferencer to determine which entities should be expanded into the subgraph as the answer. In the paper "Two-phase hypergraph based reasoning with dynamic relations for multi-hop KBQA", J. Han et al. proposed a 2HR-DR model, which first constructs a directed hypergraph, and then alternately updates relation representations and entity states through a directed hypergraph convolutional network to form interpretable reasoning paths across multiple triples. In the paper "Hypergraph transformer: Weakly-supervised multi-hop reasoning for knowledge-based visual question answering", Y. Heo et al. proposed a HyperTransformer model, which constructs a question hypergraph and a knowledge hypergraph perceiving the query, and then infers the answer by encoding the intrinsic relations between these two hypergraphs. In the paper "Explore modeling relation information and direction information in KBQA", X. Wang et al. proposed a RAID model, which transforms all relations in each subgraph into additional nodes to learn structural information and utilizes directional information to enhance directional reasoning ability, thus helping to find the correct answer. However, existing models all use graph neural networks to unilaterally mine deep information from knowledge graphs to perform reasoning and find answers, which limits the improvement of question-answering performance. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and propose an intelligent question-answering method based on knowledge graphs. Through a bidirectional question-answering attention mechanism, combined with multiple iterations of graph neural networks, the most relevant information to the question can be extracted from both the question and the knowledge graph, and a set of answer entities strongly related to the given question can be returned, thus achieving intelligent question answering.
[0005] This invention provides an intelligent question-answering method based on knowledge graphs, characterized by the following steps:
[0006] Step 1) Use graph neural networks to aggregate the neighbor node information of each entity in order to mine the structural information of the knowledge graph as the basis for intelligent question answering;
[0007] Step 2) Based on the graph neural network, design a bidirectional question answering attention mechanism. On the one hand, calculate the degree of association between aggregated entities and question representation to update the candidate answer entity set. On the other hand, update the knowledge graph-enhanced question representation according to the current candidate answer entity set.
[0008] Step 3) Through a bidirectional question-answering attention mechanism and combined with multiple iterations of graph neural networks, the most relevant information to the question is extracted from both the question and the knowledge graph, and a set of answer entities strongly related to the given question is returned to achieve intelligent question answering.
[0009] Preferably, step 1 includes the following specific steps:
[0010] For a knowledge graph KG = {(h,r,t)|h,t∈E,r∈R}, where E represents the entity set, R represents the relation set, and (h,r,t) represents the knowledge triple, given a natural language problem... Where q i This represents the i-th word, retrieving query results from entity set E, for natural language problems. Each word q i Through word embedding matrix Convert to word embedding Among them |V w | represents the size of the vocabulary, d represents the size of the word embedding, and then the word embeddings are... The hidden states are fed into a BiGRU model for processing, and the network output serves as the natural language problem. The problem indicates
[0011]
[0012] For each triple in the knowledge graph, first initialize the embeddings of the head and tail entities as follows: Relationship embedding initialization Then, the TransR model is used to perform knowledge graph embedding learning, and its loss function is:
[0013]
[0014] in,[·] + =max{0,·}, where T and T′ represent the sets of positive and negative triplet samples, respectively, and γ1 (γ1>0) is a boundary hyperparameter;
[0015] For an entity h in a knowledge graph KG, let N(h) be the set of neighboring entities of entity h. Equation (3) represents the information propagated from neighboring entity N(h) to entity h:
[0016]
[0017] Where σ(·) represents a nonlinear activation function, For trainable parameters, Let represent the hidden state vector of entity t at layer l, where
[0018] Introducing a gating mechanism vector To determine how much information Propagate to the next layer:
[0019]
[0020] in, These are trainable parameters;
[0021] The hidden state vector of entity h at level l+1 Can be derived from the previous and current update information The gated combination of the nonlinear transformation yields:
[0022]
[0023] in, These are trainable parameters.
[0024] Preferably, step 2) of calculating the correlation between aggregated entities and the question representation to update the candidate answer entity set includes the following specific steps:
[0025] According to the current With q (l) Calculate the degree of association between entity h and question Q:
[0026]
[0027] in These are trainable parameters;
[0028] according to Sort by high to low, and select the top |A| entities as the new candidate answer set. Where a (l) The hidden state vector c of the corresponding entity (l) It indicates that, according to the current and q (l) Calculate the knowledge graph summary vector
[0029] Preferably, step 2) of updating the knowledge graph-enhanced question representation based on the current candidate answer entity set specifically includes the following steps:
[0030]
[0031] in, and All of these are trainable parameters.
[0032] Knowledge graph summary vector m (l) This represents the current candidate answer A of the knowledge graph in response to question Q. (l) Based on this summary, the question representation of the knowledge graph is updated.
[0033]
[0034] in, These are trainable parameters.
[0035] For the knowledge graph augmentation problem, q represents... (l) The initialization is performed by using a BiLSTM model to represent the problem H. Q q is obtained using a self-attention mechanism (0) :
[0036]
[0037] For candidate answer A (l) For the initialization of the natural language problem Q, the topic entity is obtained through entity linking, and then all entities connected to it within h hops are collected as candidate answers.
[0038] Preferably, step 3) includes the following specific steps:
[0039] After L iterations, the final representation of the question and candidate answers is obtained: q = q (L) , The semantic similarity score between question q and candidate answer A is calculated using a multilayer perceptron:
[0040]
[0041] Based on equation (10), hinge loss is used as the training loss function:
[0042]
[0043] Among them, A + Let A represent the set of correct answers among the candidate answers. - This represents the set of negative answers randomly sampled from the candidate answer set, where γ is a parameter that adjusts the margin between positive and negative samples.
[0044] The overall loss function of the model consists of equations (2) and (11), as follows:
[0045]
[0046] in, Let E and R represent the model parameter set, respectively, and let λ1 and λ2 be regularization parameters used to prevent overfitting. Stochastic gradient descent is used to minimize the learning process.
[0047] During the testing phase, the first step is to obtain the set of candidate answers for a given question. Then, the semantic similarity score S(q,a) is calculated according to equation (10), and a margin δ is set to determine the final answer set:
[0048]
[0049] This invention utilizes a bidirectional question-answering attention mechanism, combined with multiple iterations of a graph neural network, to extract the most relevant information for answering questions from both the question and the knowledge graph, and returns a set of answer entities strongly related to a given question, thereby achieving intelligent question answering. Attached Figure Description
[0050] Figure 1 This is a flowchart of the knowledge graph intelligent question answering system provided by the present invention;
[0051] Figure 2 This is a bar chart comparing the proposed model with the baseline model on the PathQuestion question-answering dataset;
[0052] Figure 3 This is a bar chart comparing the proposed model with the baseline model on the question-answering dataset PathQuestion-Large;
[0053] Figure 4 This is a bar chart showing the ablation experiment of the proposed model on the question-answering dataset PathQuestion;
[0054] Figure 5 This is a bar chart showing the ablation experiment of the proposed model on the question-answering dataset PathQuestion-Large. Detailed Implementation
[0055] Example 1
[0056] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0057] This embodiment of an intelligent question-answering method based on knowledge graphs includes the following steps:
[0058] Step 1) Use graph neural networks to aggregate the neighbor node information of each entity in order to mine the structural information of the knowledge graph as the basis for intelligent question answering;
[0059] Step 2) Based on the graph neural network, a bidirectional question answering attention mechanism is designed. On the one hand, the degree of association between aggregated entities and question representation is calculated to update the candidate answer entity set, which can focus on the important aspects of the question. On the other hand, the knowledge graph-enhanced question representation is updated according to the current candidate answer entity set, which can focus on the important parts of the knowledge graph.
[0060] Step 3) Through a bidirectional question-answering attention mechanism and combined with multiple iterations of graph neural networks, the most relevant information to the question is extracted from both the question and the knowledge graph, and a set of answer entities strongly related to the given question is returned to achieve intelligent question answering.
[0061] For a knowledge graph KG = {(h,r,t)|h,t∈E,r∈R}, where E represents the entity set, R represents the relation set, and (h,r,t) represents a knowledge triple, given a natural language problem... Where q i Let represent the i-th word. The query system understands the question and then retrieves the query result from the entity set E through knowledge reasoning. For natural language problems... Each word q i Through word embedding matrix Convert to word embedding Where |V w | represents the size of the word vocabulary, d represents the size of the word embedding, and then the word embeddings v i q The hidden states are fed into a BiGRU model for processing, and the network output serves as the natural language problem. The problem indicates
[0062]
[0063] For each triple in the knowledge graph, first initialize the embeddings of the head and tail entities as follows: Relationship embedding initialization Then, the TransR model is used to perform knowledge graph embedding learning, and its loss function is:
[0064]
[0065] in,[·] + =max{0,·}, where T and T′ represent the sets of positive and negative triplet samples, respectively, and γ1 (γ1>0) is a boundary hyperparameter.
[0066] For an entity h in a knowledge graph KG, let N(h) be the set of neighboring entities of entity h. Equation (3) represents the information propagated from neighboring entity N(h) to entity h:
[0067]
[0068] Where σ(·) represents a nonlinear activation function (the same applies below), For trainable parameters, Let represent the hidden state vector of entity t at layer l, where
[0069] Introducing a gating mechanism vector To determine how much information Propagate to the next layer:
[0070]
[0071] in, These are trainable parameters.
[0072] Finally, the hidden state vector of entity h at layer l+1. Can be derived from the previous and current update information The gated combination of the nonlinear transformation yields:
[0073]
[0074] in, These are trainable parameters.
[0075] According to the current With q (l) Calculate the degree of association between entity h and question Q:
[0076]
[0077] in These are trainable parameters.
[0078] according to Sort by high to low, and select the top |A| entities as the new candidate answer set. Where a (l) The hidden state vector c of the corresponding entity (l) This indicates. Next, based on the current... and q (l) Calculate the knowledge graph summary vector
[0079]
[0080] in, and All of these are trainable parameters.
[0081] Knowledge graph summary vector m (l) This represents the current candidate answer A of the knowledge graph in response to question Q. (l) This is a summary. Based on this, the question representation of the knowledge graph is updated.
[0082]
[0083] in, These are trainable parameters.
[0084] For the knowledge graph augmentation problem, q represents... (l) The initialization is performed by using a BiLSTM model to represent the problem H. Q q is obtained using a self-attention mechanism (0) :
[0085]
[0086] For candidate answer A (l) For the initialization of the natural language problem Q, the topic entity is obtained through entity linking, and then all entities connected to it within h hops are collected as candidate answers.
[0087] After L iterations, the final representation of the question and candidate answers is obtained: q = q (L) , The semantic similarity score between question q and candidate answer A is calculated using a multilayer perceptron:
[0088]
[0089] Based on equation (10), hinge loss is used as the training loss function:
[0090]
[0091] Among them, A + Let A represent the set of correct answers among the candidate answers. - This represents the set of negative answers randomly sampled from the candidate answer set. γ is a parameter that adjusts the margin between positive and negative samples.
[0092] The overall loss function of the model consists of equations (2) and (11), as follows:
[0093]
[0094] in, Let E and R represent the model parameter set, where E and R represent the embedding representations of entities and relations in the knowledge graph (KG), respectively. λ1 and λ2 are regularization parameters used to prevent overfitting. Finally, stochastic gradient descent is used to minimize the learning process.
[0095] During the testing phase, the first step is to obtain the set of candidate answers for a given question. Then, the semantic similarity score S(q,a) is calculated according to equation (10), and a margin δ is set to determine the final answer set:
[0096]
[0097] Example 2
[0098] To evaluate the effectiveness of this invention, experiments were conducted using the classic question-answering datasets: PathQuestion (PQ) and PathQuestion-Large (PQL). PathQuestion extracts paths between entities using a subset of the Freebase database and then applies rules to generate realistic questions. PQ-2H and PQ-3H represent 2-hop and 3-hop questions, respectively, while PQ-M represents a combination of all questions. PathQuestion-Large is more challenging than PathQuestion because it uses a larger knowledge graph but provides fewer training instances. Similarly, PQL-2H and PQL-3H represent 2-hop and 3-hop questions, respectively. PQL-M is a mixed dataset.
[0099] The proposed model is compared with existing models: GraftNet, PullNet, 2HR-DR, HyperTransformer, and RAID, on the general datasets: PathQuestion and PathQuestion-Large. Evaluation metrics include Precision, Recall, and F1-score, explained in detail below:
[0100] Precision: The proportion of answer entities belonging to the golden answer set within the predicted answer set corresponding to the question. The final calculation is the average across all questions.
[0101] Recall: The proportion of answer entities in the predicted answer set that belong to the golden answer set for that question. The final calculation is the average across all questions.
[0102] F1-score: A combination of Precision and Recall, as shown in equation (14):
[0103]
[0104] Table 1: Numerical results (%) of the comparison experiment between the proposed model and the baseline model on the question-answering dataset PathQuestion.
[0105]
[0106] Table 2: Numerical results (%) of the comparative experiment between the proposed model and the baseline model on the question-answering dataset PathQuestion-Large.
[0107]
[0108] The comparative experimental results are shown in Tables 1 and 2. Figure 2 , 3 As shown in Tables 1 and 2. Figure 2 , 3 The experimental results show that the model of this invention achieved satisfactory performance on both datasets. Specifically, for the 2-hop, 3-hop, and mixed subsets of PathQuestion, the model of this invention improved the F1-score by 2.22%-8.9%, 3.75%-17.48%, and 4.89%-12.68% compared to the baseline model, respectively; for the 2-hop, 3-hop, and mixed subsets of PathQuestion-Large, our model improved the F1-score by 5.01%-36.48%, 6.17%-42.84%, and 5.73%-42.63% compared to the baseline model, respectively.
[0109] Based on the experimental results, an analysis was conducted. First, GraftNet and PullNet, by stacking multiple GNN layers during training, cause the node features to become overly smoothed, reducing the discriminative power of graph embeddings. This reduces their reasoning ability for distant nodes involved in multi-hop questions, resulting in poor performance in multi-hop question answering, and the performance deteriorates with the number of question hops. Second, 2HR-DR and HyperTransformer introduce hypergraph models to form interpretable reasoning paths across multiple triples, while RAID utilizes directional information to enhance directional reasoning ability. These three models model distant node relationships from different perspectives, thus improving their multi-hop question answering performance. In contrast, the model of this invention performs better because it uses graph neural networks to mine deep information in the knowledge graph while introducing a bidirectional question answering attention mechanism to focus on important aspects and parts of the question and the knowledge graph respectively, extracting the most relevant information to answer the question from both sides of the question and the knowledge graph. Through multiple iterations of BiQAatt-GNN, a set of answer entities strongly related to the given question can be returned.
[0110] Furthermore, to focus on the contribution of the bidirectional question-answering attention mechanism to the proposed model, the following ablation experiments were conducted:
[0111] (1) without question attention: do not execute equation (6), do not update the candidate answer set, and only use the original candidate answer set. The knowledge graph summary vector m is calculated according to equations (7) and (8). (l) And update the knowledge graph augmented question representation q (l+1) .
[0112] (2) w / o answer attention: Equations (7) and (8) are not executed, the knowledge graph augmented question representation is not updated, and only the original self-attention question representation q is used. (0) Update the candidate answer set according to equation (6).
[0113] Table 3: Numerical results (%) of the ablation experiment of the proposed model on the question-answering dataset PathQuestion.
[0114]
[0115] Table 4: Numerical results (%) of the ablation experiment of the proposed model on the question-answering dataset PathQuestion-Large
[0116]
[0117] Ablation experiments were conducted on the general datasets: PathQuestion and PathQuestion-Large. Evaluation metrics included Precision, Recall, and F1-score. The results of the ablation experiments are shown in Tables 3 and 4. Figure 4 , 5 As shown, when the model does not consider question attention, the F1-score for PathQuestion 2-hop, 3-hop, and mixed subsets decreases by 4.62%, 7.2%, and 4.89%, respectively; and the F1-score for PathQuestion-Large decreases by 8.72%, 11.06%, and 8.26%, respectively. When the model does not consider answer attention, the F1-score for PathQuestion 2-hop, 3-hop, and mixed subsets decreases by 2.22%, 3.75%, and 5.56%, respectively; and the F1-score for PathQuestion-Large decreases by 4.89%, 11.67%, and 11.28%, respectively.
[0118] Ablation experiments show that the bidirectional question-answering attention mechanism has a significant effect on improving model performance, and the effect becomes more pronounced as the number of question hops increases. This further demonstrates that the bidirectional question-answering attention mechanism can focus on important aspects and parts of both the question and the knowledge graph, and that both contribute to improving model performance.
Claims
1. A knowledge graph-based intelligent question answering method, characterized in that... Includes the following steps: Step 1) Use graph neural networks to aggregate the neighbor node information of each entity in order to mine the structural information of the knowledge graph as the basis for intelligent question answering; Step 2) Based on the graph neural network, design a bidirectional question answering attention mechanism. On the one hand, calculate the degree of association between aggregated entities and question representation to update the candidate answer entity set. On the other hand, update the knowledge graph-enhanced question representation according to the current candidate answer entity set. Step 3) Through a bidirectional question-answering attention mechanism and combined with multiple iterations of graph neural networks, extract the most relevant information to the question from both the question and the knowledge graph, and return a set of answer entities that are strongly related to the given question to achieve intelligent question answering; Step 2) of calculating the correlation between aggregated entities and question representations to update the candidate answer entity set includes the following specific steps: based on the current... and Computational Entity and the problem Degree of correlation: (6) in These are trainable parameters; according to Sort by high to low, select the top The entities as a new set of candidate answers ,in The hidden state vector of the corresponding entity It indicates that, according to the current and Calculate the knowledge graph summary vector ; Step 2) involves updating the knowledge graph-enhanced question representation based on the current candidate answer entity set, specifically including the following steps: (7) in, and All of these are trainable parameters; Knowledge Graph Summary Vector Characterize the knowledge graph for the problem The current candidate answer that is being responded to Based on this summary, the knowledge graph augmented problem representation is updated: : (8) in, ; For knowledge graph augmentation problems The initialization is performed by representing the problem using a BiLSTM model. Obtained using self-attention mechanism : (9) For candidate answers Initialization, targeting natural language problems Obtain its subject entity through entity links, and then collect it in All entities connected to it within the jump are considered as candidate answers. .
2. The intelligent question-answering method based on knowledge graphs according to claim 1, characterized in that... The specific steps of step 1) include: For knowledge graphs ,in Represents a set of entities. Represents a set of relations. Representing knowledge triples, given a natural language problem ,in Indicates the first One word, from the entity set Retrieving query results is crucial for natural language processing. , each word Through word embedding matrix Convert to word embedding ,in The size representing the vocabulary size. This indicates the size of the word embedding, and then the word embedding is... The data is fed into a BiGRU model for processing, and the hidden state output by the network is used as a natural language problem. The problem indicates : (1) For each triple in the knowledge graph, first initialize the embeddings of the head and tail entities as follows: , Relationship embedding is initialized as Then, the TransR model is used to perform knowledge graph embedding learning, and its loss function is: (2) in, , and These represent the sets of positive and negative triplet samples, respectively. It is a boundary hyperparameter; for knowledge graphs Entities in Set up entities The set of neighboring entities is Equation (3) represents the neighboring entity. To entity The message being disseminated: (3) in, This represents a nonlinear activation function. For trainable parameters, Representing entities In the The hidden state vector of the layer, where ; Introducing a gating mechanism vector To determine how much information Propagate to the next layer: (4) in, These are trainable parameters; entity In the Hidden state vector of layer Can be derived from the previous and current update information The gated combination of the nonlinear transformation yields: (5) in, These are trainable parameters.
3. The intelligent question-answering method based on knowledge graphs according to claim 2, characterized in that... The specific steps of step 3) include: go through After layer iterations, the final representation of the question and candidate answers is obtained: , The problem is solved using a multilayer perceptron. and candidate answers Semantic similarity score between them: (10) Based on equation (10), hinge loss is used as the training loss function: (11) in, This represents the set of correct answers among the candidate answers. This represents the set of negative answers randomly sampled from the set of candidate answers. It is a parameter that adjusts the margin between positive and negative samples; The overall loss function of the model consists of equations (2) and (11), as follows: (12) in, Represents the model parameter set, , Representing knowledge graphs The embedding representation of entities and relations is used, where λ1 and λ2 are regularization parameters to prevent overfitting, and stochastic gradient descent is used to minimize the learning process. During the testing phase, the first step is to obtain the set of candidate answers for a given question. Then, the semantic similarity score is calculated according to equation (10). And set a margin This determines the final set of answers: (13).