A method and system for query graph generation in complex knowledge base question answering
By combining historical case screening and retrieval-based semantic parsing methods, the retrieval space for complex knowledge base question answering is reduced, improving question answering efficiency and performance, and solving the problem of low efficiency caused by excessive retrieval space in existing technologies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2026-03-06
AI Technical Summary
Existing question-answering methods for complex knowledge bases require searching all one-hop neighborhoods of the current node in the knowledge base at each step of reasoning, resulting in a huge retrieval space, low question-answering efficiency, and failure to effectively utilize historical cases.
The historical case filtering module selects the K questions with the highest semantic similarity to the target question from historical cases, constructs a set of candidate case relations, and updates the query graph by selecting only relations that intersect with the knowledge base neighborhood in the query graph generation module, thereby reducing the retrieval space in the reasoning process.
It significantly improves question-answering efficiency, reduces retrieval space, and increases the speed of query graph generation, while maintaining high performance.
Smart Images

Figure CN115858723B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of information technology and natural language processing technology, and specifically relates to a query graph generation method and system for complex knowledge base question answering. Background Technology
[0002] Knowledge base question answering plays a crucial role in online real-time question answering scenarios. In recent years, complex knowledge base question answering (i.e., answering complex questions based on knowledge bases) has received extensive research attention. Existing complex knowledge base question answering solutions can be mainly divided into two categories:
[0003] One type is based on information retrieval methods, which focus on reasoning on knowledge bases. First, the adjacent nodes and edges centered on the corresponding entities of the topic words are retrieved in the knowledge base, and relevant information is extracted as a knowledge base subgraph. Each node in the subgraph is used as a candidate answer and each edge is used as a candidate reasoning path. Feature vectors of questions and candidate answers are extracted based on machine learning or deep learning, and their similarity is scored to select the target answer.
[0004] The second category is semantic parsing-based methods, which focus on parsing semantic relationships in natural language questions and transforming them into query statements on a knowledge base. Semantic parsing-based methods use manually generated rules and deep language models to analyze the surface and deep semantic and syntactic relationships in the question, converting them into a mediating logical expression. Aligning the elements (entities, relations, etc.) in the mediating logical expression with the knowledge base yields a query statement that can be executed on the knowledge base. When parsing semantic relationships in natural language questions, this type of method can be further divided into retrieval-based semantic parsing methods and generative semantic parsing methods, depending on whether the parsing process requires reasoning on the knowledge base. Retrieval-based semantic parsing methods require progressive reasoning on the knowledge base to update the mediating logical expression. For the current entity node, it traverses the neighborhood of that node in the knowledge base to obtain candidate relations, and uses a semantic matching scoring model to select the relation with the highest score to expand the mediating logical expression. Generative semantic parsing methods pre-select relevant entities and relations from the knowledge base or historical cases, inputting them into a pre-trained language model to directly generate the target mediating logical expression.
[0005] Current highly interpretable semantic parsing models (i.e., retrieval-based semantic parsing methods) require retrieving all information within the one-hop neighborhood of the current node in the knowledge base at each inference step. This results in an extremely large retrieval space and very high retrieval costs for obtaining the most relevant relation, leading to low question-answering efficiency. Furthermore, current related technologies only consider information in the knowledge base during the reasoning process, neglecting the role of historical cases. Summary of the Invention
[0006] To address the aforementioned problems, this invention provides a query graph generation method and system for question answering in complex knowledge bases. This invention proposes a method that significantly reduces the retrieval space during the reasoning process by utilizing historical cases, and pre-screens the retrieved candidate relations, aiming to significantly improve the efficiency of question answering while keeping the impact on natural language question answering performance within an acceptable range.
[0007] The technical solution adopted in this invention is as follows:
[0008] A query graph generation method for complex knowledge base question answering includes the following steps:
[0009] Based on the semantic similarity between the purpose question and the historical question, the top-ranked historical questions are selected from the historical cases;
[0010] The relationships in the standard query graphs corresponding to the selected historical questions are used to form a set of candidate relationship sets for cases.
[0011] Based on the set of candidate relationship cases, a retrieval-based semantic parsing method is used to generate a query graph.
[0012] Furthermore, the historical cases are constructed using identically distributed data from the same dataset.
[0013] Furthermore, the step of selecting the top-ranked historical questions from historical cases involves retrieving the K historical questions with the highest semantic similarity scores to the target question from the historical cases.
[0014] Furthermore, by inputting the question into the [CLS] output vector obtained from the BERT model to represent the sentence representation of the natural language question, the semantic similarity between the target question and the historical question is obtained through the inner product of their sentence representation vectors.
[0015] Furthermore, let R q The set of candidate relations for the case. In the QGG method, when updating the query graph each time, the set consisting of all relations in the neighborhood of the current entity node i in the knowledge base is traversed. The step of generating the query graph based on the candidate relation set using a retrieval-based semantic parsing method includes: selecting only R... q and The query graph is updated by finding the relation with the highest score in the intersection of R; if R q and If the set does not contain any common relationship paths, i.e., the intersection is empty, then an exception will be made.
[0016] Furthermore, the exception handling involves selecting candidate paths according to the original QGG processing method.
[0017] A query graph generation system for question answering in complex knowledge bases, comprising:
[0018] The historical case filtering module is used to filter out the top-ranked historical questions from historical cases based on the semantic similarity between the target question and the historical questions.
[0019] The query graph generation module is used to form a set of candidate case relationships from the relationships in the standard query graphs corresponding to the selected historical questions, and to generate a query graph based on the set of candidate case relationships using a retrieval-based semantic parsing method.
[0020] A complex knowledge base question answering method utilizes the query graph generated by the method described above, converts the query graph into an executable query statement according to the syntax rules of knowledge base query statements, and executes the query on the knowledge base to obtain the answer to the target question.
[0021] The beneficial effects and advantages of the present invention are as follows:
[0022] 1) This invention proposes a model that combines historical cases with retrieval-based semantic parsing methods for complex knowledge base question answering, filling the gap in the utilization of historical cases in current mainstream retrieval-based semantic parsing methods.
[0023] 2) This invention is a retrieval-based semantic parsing method that parses natural language problems into mediating logical expressions through step-by-step reasoning. Unlike existing technologies, which only consider information in the knowledge base at each reasoning step and require retrieving all one-hop neighbors of the current node in the entire knowledge base, this invention innovatively combines historical information with the reasoning process using a historical case filtering module, thus constraining the retrieval space of the reasoning. Experiments demonstrate that the efficiency of this invention's method is significantly improved, and the retrieval space is significantly reduced. Attached Figure Description
[0024] Figure 1 It is a case-based query graph generation framework. Detailed Implementation
[0025] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0026] This invention proposes a complex knowledge base question answering model, namely case-based query graph generation (CQGG). This model not only uses information in the knowledge base to perform semantic parsing of natural language questions, but also uses historical cases to constrain the reasoning process in semantic parsing, thus eliminating a large amount of invalid semantic scoring calculations in the reasoning process.
[0027] This invention uses a query graph as the intermediate logical expression. CQGG mainly consists of two modules: a historical case filtering module and a query graph generation module. The historical case filtering module first filters out the top-ranked historical questions from a pre-constructed historical case set based on the similarity between the currently answered question and the historical questions, and then extracts the relational information of the standard query graphs corresponding to these questions from the historical cases as a pre-filtered relation set. The main framework of the query graph generation module follows the query graph generation framework of the retrieval-based semantic parsing method QGG (Yunshi Lan and Jing Jiang. Query Graph Generation for Answering Multi-hop Complex Questions from Knowledge Bases. ACL, 2020.). However, QGG needs to retrieve the relations of the current query graph's terminal node within the entire one-hop neighborhood of the corresponding node in the knowledge base each time it updates the query graph, and uses a semantic matching model to calculate the relevance, selecting the relation with the highest relevance to update the query graph. Compared to QGG, CQGG's query graph generation module, in order to improve generation efficiency, only retrieves the intersection of the pre-filtered relation set and the knowledge base neighborhood, significantly reducing the retrieval space.
[0028] The model of the present invention is as follows Figure 1 As shown. The overall framework of this model mainly consists of two parts: 1) a historical case filtering module; and 2) a query graph generation module. Accordingly, the method of this invention can be broken down into two main operations: historical case filtering and query graph generation.
[0029] 1. Historical Case Selection
[0030] The purpose of this module is to select cases similar to the target problem from historical cases. The problem is input into the BERT model (Jacob Devlin, Ming-Wei Chang, Kenton Lee, Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. NAACL-HLT(1)2019:4171-4186.) to obtain the [CLS] output vector to represent the sentence representation q of the natural language problem. i The semantic similarity between questions is obtained by the inner product of their sentence representation vectors:
[0031] Score(q i ,q j )=q i q j
[0032] Since there are very few similar cases among non-uniformly distributed data from different datasets, they are not suitable for use as historical cases. Therefore, this invention constructs historical cases using uniformly distributed data from the same dataset before screening historical cases, which is the standard "question-query graph" dictionary.
[0033] Based on the semantic similarity calculation method described above, the K questions with the highest relevance scores to the target question are retrieved from all historical cases. The relationships contained in the standard query graphs corresponding to these questions are then used to form a candidate relation set R for the cases. q The "standard query graph" refers to a query graph that, after being converted into a knowledge base query statement, can be correctly executed on the knowledge base to obtain the standard answer to the question.
[0034] 2. Query graph generation
[0035] The goal of this module is to generate a query graph corresponding to the problem. The previous module yielded a set R of candidate relation sets for the cases. q .
[0036] The query graph generation module adopts the retrieval-based semantic parsing method QGG's generation framework. Compared to the original QGG method, which traverses the set of all relations in the neighborhood of the current entity node i in the knowledge base every time the query graph is updated, this approach offers a more efficient alternative. CQGG only selects R q and The query graph is updated by finding the relation with the highest score in the intersection of the graphs. For example... Figure 1 As shown, S o This represents the initial state, where we begin identifying the central entity in the target problem. e This indicates the state where the central entity selection is complete, and the iterative generation of the query graph begins, S. a S represents the state after each iteration of the query graph expansion is completed. t Indicates the status of the query graph generation termination judgment being completed, A t The action represents the central entity identification action, A represents the query graph update action, which involves identifying and linking relational paths, i.e., selecting the relation with the highest semantic similarity score to the target question from the candidate relation set to expand the query graph, and T represents the termination judgment action for query graph generation. The generation process terminates when the semantic similarity between the updated query graph and the target question is not higher than that of the query graph before the update. Here, "central entity" refers to the entity in the knowledge base corresponding to the subject of the target question.
[0037] If R at this time q and If the set does not contain any common relationship paths (i.e., the intersection is empty), then exception handling is performed. Exception handling indicates that no matching relationship path was found among the candidate relationship paths for the case, and then candidate paths are selected according to the original QGG process.
[0038] 3. Implementing complex knowledge base question answering based on query graphs
[0039] The query graph generated in step 2 contains entity nodes existing in the target question, variable entity nodes implicit in the target question, answer entity nodes, aggregation functions (such as finding extreme values when there are multiple answer entities), and information on the relationships between entity nodes.
[0040] Using the query graph generated in step 2, the present invention can further convert the query graph into an executable query statement according to the syntax rules of the knowledge base query statement, execute the query on the knowledge base to obtain the answer to the "target question", that is, realize complex knowledge base question answering.
[0041] Experiments were conducted on the WebQSP and CWQ datasets to verify the effectiveness of the invention. Both WebQSP and CWQ are datasets built for the Freebase knowledge base; the former mainly contains simple questions, while the latter mainly consists of complex multi-hop questions.
[0042] The evaluation metrics for this technology are F1 score (representing performance), total query graph generation time during testing (including case selection, representing system efficiency), and the mean avg_cp_length of the total number of candidate relations (representing the size of the retrieval space). We primarily compare the performance and efficiency of the CQGG model method in this technology with the baseline model QGG, and also compare its performance with another retrieval-based semantic parsing method, TextRay. Specific results are shown in Table 1. It can be seen that, compared with QGG, the model method proposed in this invention improves question-answering efficiency by 3-4 times and reduces the retrieval space by 5-7 times with a slight performance loss, while maintaining competitive performance compared with other retrieval-based semantic parsing methods. This demonstrates the effectiveness of the proposed method.
[0043] Table 1: Comparison of Results from Major Models
[0044]
[0045] Another embodiment of the present invention provides a query graph generation system for complex knowledge base question answering, comprising:
[0046] The historical case filtering module is used to filter out the top-ranked historical questions from historical cases based on the semantic similarity between the target question and the historical questions.
[0047] The query graph generation module is used to form a set of candidate case relationships from the relationships in the standard query graphs corresponding to the selected historical questions, and to generate a query graph based on the set of candidate case relationships using a retrieval-based semantic parsing method.
[0048] Another embodiment of the present invention provides a complex knowledge base question answering method, which uses the query graph generated by the method of the present invention to convert the query graph into an executable query statement according to the syntax rules of the knowledge base query statement, and executes the query on the knowledge base to obtain the answer to the target question.
[0049] Another embodiment of the present invention provides an electronic device (computer, server, smartphone, etc.) including a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the steps of the method of the present invention.
[0050] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, disk, optical disk) storing a computer program that, when executed by a computer, implements the various steps of the method of the present invention.
[0051] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and to implement it accordingly. Those skilled in the art will understand that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the content disclosed in the embodiments of this specification; the scope of protection of the present invention is defined by the claims.
Claims
1. A method for generating a query graph for complex knowledge base question answering, characterized in that, The method comprises the following steps: selecting top-ranked historical questions from historical cases according to semantic similarity between the target question and the historical questions; forming a case candidate relation set by relations in a standard query graph corresponding to the selected historical questions; generating a query graph based on the case candidate relation set by using a retrieval semantic parsing method; the step of selecting top-ranked historical questions from historical cases is retrieving K historical questions with the highest semantic similarity scores from historical cases; Let R q be the set of case candidate relations, be the set of relations that the current entity node i traverses in the knowledge base neighborhood for each update of the query graph in the QGG method. Based on the case candidate relation set, the query graph is generated using the retrieval-based semantic parsing method, which includes: only selecting the relations with the highest scores in the intersection of R q and to update the query graph; if R q and do not contain any common relation path, i.e. the intersection is empty, an exception handling is performed.
2. The method of claim 1, wherein, the historical cases are constructed by using the same dataset of the same distribution data.
3. The method of claim 1, wherein, The [CLS] output vector of the BERT model is used to represent the sentence representation of the natural language question, and the semantic similarity between the target question and the historical questions is obtained by the inner product of the vector of the sentence representation.
4. The method of claim 1, wherein, The exception processing is to select a candidate path according to the original QGG processing mode.
5. A complex knowledge base question-answering oriented query graph generation system of the method according to any one of claims 1 to 4, characterized in that, The method comprises the following steps: a historical case screening module is configured to select top-ranked historical questions from historical cases according to semantic similarity between the target question and the historical questions; a query graph generation module is configured to form a case candidate relation set by relations in a standard query graph corresponding to the selected historical questions, and generate a query graph based on the case candidate relation set by using a retrieval semantic parsing method.
6. A complex knowledge base question answering method, characterized by, The query graph generated by the method of any one of claims 1-4 is converted into an executable query statement according to the syntax rules of the knowledge base query statement, and the query is executed on the knowledge base to obtain the answer to the target question.
7. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by a computer to implement the method of any one of claims 1-4, 6.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a computer to implement the method of any one of claims 1-4, 6.
Citation Information
Patent Citations
Ontology label knowledge graph-oriented sample query method
CN113569057A