Knowledge question-answering method and system combining implicit reasoning and explicit reasoning

Through the combination of implicit reasoning and explicit reasoning, the scoring function and inverse relational path traceability method are used to solve the problem of delay and cost in specific domain knowledge questions and answers, and the interpretability and accuracy of the answers are improved. A low-cost, low-latency knowledge question and answer system was built.

CN119311824APending Publication Date: 2025-01-14HARBIN INST OF TECH AT WEIHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411368241.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The existing large language model has hallucinatory answers, lack of domain knowledge, lack of real-time knowledge and poor interpretability in knowledge questions and answers for specific domains, especially in the case of multi-hop reasoning and incompleteness or sparsity of knowledge graphs, resulting in answers. Generation delay and cost increase.

Method used

Using a combination of implicit reasoning and explicit reasoning, the complete path information from the subject entity to the candidate answer entity is obtained through the scoring function and the inverse relationship path traceability, and the judgment is made in combination with the large language model. If it is not enough to answer the question, it will enter the obvious , optimize the search and filtering process to reduce the number of calls to large language model and inference delays.

Benefits of technology

It realizes the problem of incompleteness and sparseness of knowledge graphs while reducing the number of calls to large language models and inference delays, improves the interpretability and accuracy of answers, reduces the number of iterative executions and calls to large language models, and builds A low-cost, low-latency knowledge Q&A system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311824A_ABST
    Figure CN119311824A_ABST
Patent Text Reader

Abstract

The invention provides a knowledge question-answering method and system combining implicit reasoning and explicit reasoning, and solves the technical problem that the incompleteness and sparsity of a knowledge graph cannot be effectively relieved while the calling times and reasoning delay of a large language model cannot be reduced in the prior art. The method comprises the steps of implicit reasoning, obtaining candidate answer entities by utilizing a scoring function, obtaining complete path information by utilizing a reverse relation path tracing method, judging whether a question is enough to be answered or not through cue words, if yes, outputting an answer, and if not, entering explicit reasoning; displaying reasoning, adding the subject entities into a candidate entity set, and performing retrieval and screening to obtain a candidate triple set; judging whether the question is enough to answer through the cue word, and if yes, outputting an answer; and otherwise, taking the screened entities as a new candidate entity set for iteration until the maximum reasoning step length is reached. The method can be widely applied to the technical field of knowledge questions and answers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of knowledge question answering, and more specifically, to a knowledge question answering method and system combining implicit reasoning with explicit reasoning. Background Art

[0002] In recent years, large language models (LLMs) represented by GPT, Llama, etc. have completely overturned the original knowledge question-answering technology. The massive amount of general and cross-language training data, huge model parameters and complex network structure enable LLMs to have a wide range of general knowledge reserves and strong language comprehension capabilities. At the same time, the ultra-long context input and excellent language generation capabilities enable LLMs to have unprecedented context perception and interactive dialogue capabilities. These excellent characteristics enable LLMs to demonstrate excellent practicality and broad application potential in general fields. However, when it comes to knowledge question-answering in specific fields, the inherent limitations of existing LLMs, such as hallucinated answers, lack of domain knowledge, lack of real-time knowledge, and poor interpretability, make the performance of knowledge question-answering that relies entirely on its own capabilities unsatisfactory.

[0003] By integrating domain knowledge graphs as external knowledge and guiding large language models to conduct knowledge question answering, the question answering performance of LLMs in specific knowledge domains can be significantly improved, effectively solving the problems faced by LLMs, such as hallucination answers, lack of domain knowledge, lack of real-time knowledge, and poor interpretability. At present, the most effective method is to iteratively perform beam search on the knowledge graph to explore the reasoning path related to the question until it extends from the question node to the answer node, in the hope of providing sufficient reasoning basis for LLMs to generate answers. However, when faced with complex problems that require multi-hop reasoning, the search process at each step and the calling process of LLMs in information screening significantly increase the delay and cost of answer generation. In addition, the lack of some relationships caused by the incompleteness or sparsity of the knowledge graph in real scenarios may lead to an increase in the length of the reasoning path or even the inability to obtain the final answer.

[0004] Therefore, how to effectively alleviate the incompleteness and sparsity of knowledge graphs while reducing the number of LLMs calls and reasoning latency, thereby improving reasoning performance, is an urgent problem to be solved in the application of LLMs to domain knowledge question answering. At the same time, this is of great significance for building low-cost, low-latency knowledge question answering and information retrieval systems, especially for local deployment based on relatively weak and relatively small-scale open source language models, and for domain knowledge question answering systems with high requirements for data privacy and data security. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a knowledge question answering method that combines implicit reasoning with explicit reasoning to solve the existing technical problem that it is impossible to effectively alleviate the incompleteness and sparsity of the knowledge graph while reducing the number of large language model calls and reasoning delays.

[0006] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a knowledge question answering method combining implicit reasoning with explicit reasoning, including:

[0007] Implicit reasoning: Use the scoring function to score the vector representation of the subject entity, knowledge graph entity, and question text to obtain the candidate answer entity. Then use the reverse relationship path tracing method to obtain the complete path information from the subject entity to the candidate answer entity. Then use the prompt word to determine whether it is sufficient to answer the question. If so, output the answer. Otherwise, enter explicit reasoning.

[0008] Explicit reasoning: add the subject entity to the candidate entity set, retrieve all combinations of entities and corresponding relationships, and take the combination as a whole to obtain a candidate triple set after screening; judge whether it is sufficient to answer the question through the prompt word, and if so, output the answer; otherwise, take the screened entity as the new candidate entity set and iterate until the maximum reasoning step length is reached;

[0009] The reverse relationship path tracing method refers to, after determining the candidate answer entity, reversely tracing all the reasoning path information from the candidate answer entity back to the subject entity;

[0010] In the process of obtaining the complete path information from the topic entity to the candidate answer entity, the direction of the edge in the query path is not restricted.

[0011] Preferably, the set formula of candidate answer entities is:

[0012]

[0013] In the formula, e ans is the set of candidate answer entities, ε is the set of entities in the knowledge graph, a′ is the entity in the entity set in the knowledge graph, and e a‘ is the vector representation of the entity in the entity set in the knowledge graph, e t is the vector representation of the topic entity t, e q is the vector representation of the question text q.

[0014] Preferably, the formula of the scoring function is:

[0015]

[0016] In the formula, Re represents the real part of the complex number, e q is the vector representation of the question text, et is the vector representation of the subject entity, e a is the vector representation of other candidate answer entities in the knowledge graph, They are vector e q 、e t 、e a The kth column of , for the triple relationship (positive sample) that actually exists in the data set, is For the generated non-existent triple relationship (negative sample),

[0017] Preferably, the retrieval means, without limiting edges, using a graph database query language to retrieve all entities and corresponding relationships directly connected to the candidate entity, to obtain combinations of all entities and corresponding relationships;

[0018] The filtered entities refer to the entities in the set of candidate triples after filtering.

[0019] Preferably, obtaining the vector representation of the knowledge graph entity means obtaining the node vector representation of all entities from the knowledge graph and retrieving the vector representation of the corresponding entity according to the question.

[0020] Preferably, obtaining the vector representation of the subject entity means extracting the N entities with the highest relevance from the question text using a large language model as the subject entity.

[0021] Preferably, the complete path information includes triple information;

[0022] The prompt word is generated by the question and triple information;

[0023] The specific implementation method of judging whether the prompt word is sufficient to answer the question refers to requiring the large language model to judge whether the prompt word is sufficient to answer the question based on the triple information.

[0024] Preferably, obtaining the vector representation of the question text means converting the question text into a high-dimensional vector using a pre-trained text vector model, and then converting the vector into a vector with the same dimension as the vector representation of the graph entity using a neural network and an activation layer.

[0025] Preferably, screening means that the large language model screens out all combinations of entities and corresponding relationships that are most helpful in answering the question through prompt words to obtain a set of candidate triples.

[0026] A second aspect of an embodiment of the present application provides a knowledge question answering system combining implicit reasoning and explicit reasoning, including:

[0027] Implicit reasoning module, including knowledge graph representation learning module, pre-trained text vector module, answer entity scoring module, question embedding module and reverse relationship tracing module;

[0028] The knowledge graph representation learning module is used to obtain the node vector representation of all entities in the knowledge graph and obtain the vector representation of the knowledge graph entity;

[0029] Pre-trained text vector module, used to convert question text into high-dimensional vectors;

[0030] The answer entity scoring module is used to obtain the k entities with the best scores as candidate answer entities;

[0031] The question embedding module is used to convert the question text into a vector with the same dimension as the vector representation of the knowledge graph entity, and capture the semantic relationship between the subject entity and the answer entity from the natural language question based on the vector representation of the question text;

[0032] The reverse relationship tracing module is used to reversely trace the complete reasoning path information from the candidate answer entity back to the subject entity;

[0033] Explicit reasoning module, including retrieval module and screening module;

[0034] A retrieval module is used to retrieve all entities and corresponding relationships directly connected to the candidate entity, and obtain a combination of all entities and corresponding relationships;

[0035] The screening module is used to screen out the combinations of N entities and corresponding relationships that are most helpful in answering questions and obtain a set of candidate triples.

[0036] The beneficial effects of the present application are as follows: the present invention provides a knowledge question-answering method and system that combines implicit reasoning with explicit reasoning. First, the implicit reasoning method based on the knowledge graph representation learning model TransE realizes the rapid and efficient acquisition of reasoning paths and answers. The entire implicit reasoning process only needs to call the large language model once, which greatly reduces the calling cost and reasoning delay of the large language model. At the same time, it can well solve the problem of being unable to obtain answers due to the incompleteness and sparsity of the knowledge graph. Among them, the reverse relationship path tracing method designed by the present invention can obtain all reasoning path information from the subject entity to the candidate answer entity. The obtained reasoning path information is more comprehensive and the results are more accurate, which greatly improves the interpretability and credibility of the answer; in the retrieval process, the direction of the edge is not restricted, which reduces the loss of valuable reasoning paths for answering questions due to limiting the direction of the edge, and ensures the integrity of the reasoning path.

[0037] Secondly, the present invention optimizes the existing explicit reasoning process based on beam search, and proposes to combine the relations and entities in each iteration process for scoring and screening together, which greatly reduces the number of calls to the large language model while improving the screening effect.

[0038] Finally, the present invention combines implicit reasoning with explicit reasoning, which can not only improve the accuracy of reasoning and reduce the performance requirements of the large language model itself, but also greatly reduce the number of iterative executions and large language model calls.

[0039] In summary, the knowledge question-answering method and system that combines implicit reasoning with explicit reasoning provided by the present invention calls the large language model less frequently, has a smaller delay in the reasoning process, obtains more comprehensive reasoning path information, and obtains more accurate answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0041] Figure 1 A schematic diagram of the overall process of a knowledge question answering method combining implicit reasoning and explicit reasoning provided in one embodiment of the present application;

[0042] Figure 2 An example diagram of a reverse relationship path tracing query process provided in an embodiment of the present application;

[0043] Figure 3 An overall framework diagram of a knowledge question-answering method that combines implicit reasoning with explicit reasoning provided in one embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0045] See also Figure 1 , a knowledge question answering method combining implicit reasoning and explicit reasoning provided in an embodiment of the present application, comprising:

[0046] S1: Get the subject entity.

[0047] Read the question text and use the large language model to obtain the topic entities in the question.

[0048] Specifically, the prompt words are used to require the large language model to extract the most relevant topic entities from the question text, and the obtained topic entities are sorted according to relevance and importance, and the N entities with the highest relevance are retained as topic entities. The knowledge graph representation learning model is used to convert these topic entities into vector representations of topic entities; then, vector retrieval is used to link the vector representations of the topic entities in the question to the entities in the knowledge graph: E topic ={e1,…e N}, these entities will serve as the starting nodes for the subsequent reasoning process.

[0049] In an optional embodiment, the prompt words used in the present invention are shown in Table 1:

[0050] Table 1: Tip words for extracting topic entities from question text

[0051]

[0052]

[0053] S2: Implicit reasoning: input the vector representation of the acquired subject entity, knowledge graph entity and question text into the answer entity scoring model to obtain the candidate answer entity, and use the reverse relationship path tracing method to obtain the complete path information from the subject entity to the candidate answer entity. Then use the large language model to determine whether it is sufficient to answer the question. If so, output the answer; otherwise, enter explicit reasoning.

[0054] 1. Get the vector representation of the knowledge graph entity:

[0055] The knowledge graph representation learning model is used to obtain the node vector representation of all entities in the knowledge graph, and the vector representation of the knowledge graph entities is obtained.

[0056] Specifically, the knowledge graph representation learning model is used to obtain the node vector representation of all entities in the knowledge graph, which is stored in a vector database and retrieved from the vector database when used to obtain the vector representation of the knowledge graph entity. The knowledge graph representation learning model is pre-trained by the TransE model using the relationship prediction task.

[0057] Among them, the binary cross entropy loss function trained using the relationship prediction task is:

[0058]

[0059] In the formula, is the binary cross entropy loss function for relationship prediction task training, ω is the number of negative samples corresponding to each positive sample, (s, r, o) represents a triple, s is the head node, r is the relationship, and o is the tail node. is the set of true triplets and negative sample triplets, f is the predictor, y=1 is the positive sample label, indicating that the triplet exists, y=0 is the negative sample label, indicating that the triplet does not exist, Represents the number of relations in the training set.

[0060] It should be noted that the training process of the knowledge graph representation learning model and the acquisition process of entity vectors are pre-completed offline tasks. Before the system is deployed, the vector representations of all entities have been acquired and stored in the vector database. In practical applications, it is only necessary to retrieve the vector representation of the corresponding entity from the vector database, which can be used to control the delay in the reasoning process.

[0061] 2. Get the vector representation of the question text:

[0062] The question embedding model is used to obtain the vector representation of the question text.

[0063] Specifically, the question embedding model includes the following steps:

[0064] First, the pre-trained text vector model RoBERTa is used to convert the question text into a high-dimensional vector;

[0065] Then, a 4-layer fully connected neural network and a 1-layer ReLU activation layer are used to transform the vector representation of the question text into a vector with the same dimension d as the vector representation of the knowledge graph entity, that is,

[0066] 3. Get the candidate answer entity:

[0067] The vector representations of question text, topic entities, and knowledge graph entities are input into the answer entity scoring model to obtain the K entities with the best scores as candidate answer entities.

[0068] Specifically, in an optional embodiment, the scoring function of the answer entity scoring model is The tensor decomposition method is used to model the relationship between triples:

[0069]

[0070] In the formula, Re represents the real part of the complex number, e q is the vector representation of the question text, e t is the vector representation of the subject entity, e a is the vector representation of other candidate answer entities in the knowledge graph, They are vector e q 、e t 、e a For the three-tuple relationship (positive sample) that actually exists in the data set, that is, For the generated non-existent triple relationship (negative sample),

[0071] We also use the above binary cross entropy loss function to train the question embedding model on a large number of labeled question texts q, topic entities t, and corresponding answer entities a training dataset. The training process aims to minimize the difference between the scoring score and the target label, so that the question embedding model can effectively capture the semantic relationship from the topic entity to the answer entity from the natural language question. Among them, the label of the triple of the positive sample is 1, and the label of the triple of the negative sample is 0 otherwise.

[0072] During the reasoning process after deployment, we select the top K entities with the highest scores as candidate answer entities. The specific formula is as follows:

[0073]

[0074] In the formula, e ans is the set of candidate answer entities, ε is the set of entities in the knowledge graph, a′ is the entity in the entity set in the knowledge graph, and e a‘ is the vector representation of the entity in the entity set in the knowledge graph, e t is the vector representation of the topic entity t, e q is the vector representation of the question text q.

[0075] 4. Reverse relationship path tracing method:

[0076] The reverse relationship path tracing method is used to obtain the complete path information from the subject entity to the candidate answer entity, and then the fidelity of the candidate answer entity is verified to give an explanation for the answer.

[0077] Specifically, the existing implicit knowledge reasoning process based on representation learning relies on the knowledge graph representation model TransE and the answer entity scoring model to learn implicit knowledge from a large amount of training data. The candidate answer entities obtained may misjudge the facts to a certain extent and lack explainability.

[0078] In order to solve this problem, the present invention proposes to use a reverse relationship path tracing method to obtain the complete reasoning path information from the subject entity to the candidate answer entity, and then verify the fidelity of the candidate answer entity, thereby improving the answer and giving an explanation of the corresponding answer.

[0079] It is worth noting that in the existing forward reasoning method, the reasoning process is to iterate step by step from the subject entity to the answer entity. In contrast, the reverse relationship tracing method proposed in the present invention is to reversely trace all the reasoning path information from the candidate answer entity to the subject entity after determining the candidate answer entity. Since the starting and end entities of this method are predetermined, and the complex path decision and screening steps in the middle are omitted. Therefore, the present invention has significant advantages in efficiency and cost. In the actual deployment process, the path length for performing the retrieval is limited to 5 to further improve the retrieval efficiency.

[0080] In an optional embodiment, the reverse relationship path tracing method is implemented based on a query statement of a graph database.

[0081] For example, in the Neo4j graph database, Figure 2 The Cypher query code queries the complete path information between the candidate answer entity and the subject entity. Specifically, the large language model is used to read the question text, that is, "Where is the origin of the Moutai Prince Liquor?" to obtain the corresponding subject entity, that is, "Moutai Prince Liquor". Then, the vector representation of the knowledge graph entity, the vector representation of the question text, and the candidate answer entity are obtained in turn, and the answer entity scoring model is used to obtain the candidate answer entity "Guizhou" with the highest score. All the reasoning path information from the candidate answer entity "Guizhou" to "Moutai Prince Liquor" is reversely traced through the obtained candidate answer entity.

[0082] Specifically, the reverse relationship tracing process of entering the subject entity's node "Moutai Prince Liquor" and the candidate answer's node "Guizhou" is performed, and the complete path information of the subject entity "Moutai Prince Liquor" and the candidate answer "Guizhou" is queried through the Cypher query code, namely, Moutai Prince Liquor→Moutai→Guizhou; Moutai Prince Liquor→Moutai←Guizhou; Moutai Prince Liquor←Moutai→Guizhou; Moutai Prince Liquor←Moutai←Guizhou.

[0083] From the perspective of the query process, the existing path query method is different from the process of searching for unknown target nodes along the specified relationship from the initial node. The reverse relationship tracing method of the present invention queries all reasoning path information between two entities through Cypher statements on the premise of clarifying the starting node and the target node.

[0084] From the perspective of query purpose, the existing path query method is to obtain the desired target node, and its goal is to obtain the information of the target node; while the relationship path tracing method of the present invention is to obtain the complete reasoning path information between two known nodes, and its goal is to obtain the complete reasoning path and screen the candidate answer entities, ultimately improving the interpretability and credibility of the answer.

[0085] It is worth noting that the present invention does not limit the direction of the edge in the query path. In this way, the integrity of the acquired reasoning path can be guaranteed, and the loss of reasoning paths that are valuable for answering questions can be reduced due to limiting the direction of the edge.

[0086] In an optional embodiment, the complete reasoning path for answering the question "How to self-treat salmonella poisoning?" is: "Salmonella → <Disease Cause> → Gastrointestinal Food Poisoning → <Symptoms> → Fever ← <Treatment> ← Physical Cooling" is of great value. If the direction of the edge is restricted, the reasoning path will be missing, resulting in the missing or wrong correct answer, that is, the reasoning path of "Fever ← <Treatment> ← Physical Cooling" will be missing in this embodiment. In addition, for some candidate answer entities, there may not be a path from them to the subject entity. In this case, we delete it from the candidate answer entity.

[0087] 5. Use the large language model to determine whether it is sufficient to answer the question. If so, output the answer, otherwise enter explicit reasoning:

[0088] Based on the complete path information obtained by the reverse relationship path tracing method, the large language model is required to reason based on the triple information contained in the path information and its own knowledge through prompt instructions to determine whether it is sufficient to answer the question. If it can answer the question, the answer is output and the whole process ends. If it is not sufficient to answer the question, explicit reasoning is entered.

[0089] The large language model reasoning process uses both the triple information contained in the complete path information and the knowledge of the large language model itself. After obtaining multiple complete reasoning path information from the subject entity to the candidate answer entity, the corresponding (entity, relationship, entity) triple information is obtained through the complete reasoning path information.

[0090] In an optional embodiment, the complete reasoning path information "Hanjiang Liquor→Brand→Moutai→Manufacturer→Moutai Company→Address→Moutai Town, Guizhou" can be used to extract triple information such as "(Hanjiang Liquor, Brand, Moutai)", "(Moutai, Manufacturer, Moutai Company)", and "(Moutai Company, Address, Moutai Town, Guizhou)". The question is combined with the triple information to construct the prompt words shown in Table 2. Among them, some examples are added to the prompt words to better guide the large language model to understand and clarify the task and ensure the consistency of the output format.

[0091] Table 2: Combination of question and triple information to generate task prompt words

[0092]

[0093]

[0094] Through the prompt words shown in Table 2, the large language model is required to evaluate whether it can use these triple information and its own knowledge to answer the corresponding question. If it can answer, it will answer "yes", output the answer and end the whole process. If there is not enough information to answer the question, it will answer "no", indicating that the program cannot get the answer in the implicit reasoning stage, and then enter the explicit reasoning stage.

[0095] The present invention can answer questions by calling the large language model only once, which greatly reduces the delay of reasoning and the cost of calling the large language model. At the same time, it can effectively alleviate the problem of increasing the length of the reasoning path and failing to obtain the final answer due to the incompleteness and sparsity of the knowledge graph.

[0096] S3: Explicit reasoning, adding the subject entity to the candidate entity set, retrieving all entities and corresponding relationship combinations, and then filtering to obtain a set of candidate triples. The large language model is then used to determine whether it is sufficient to answer the question. If so, the answer is output, otherwise the filtered entities are used as new candidate entity sets for iteration until the maximum reasoning step is reached.

[0097] 1. Add the subject entity to the candidate entity set, retrieve all entities and corresponding relationships directly connected to the candidate entity, and obtain the combination of all entities and corresponding relationships:

[0098] Specifically, in an optional embodiment, the subject entity obtained in S1 is added to the candidate entity set, and starting from each candidate entity in the candidate entity set, all entities and corresponding relationships directly connected to the candidate entity are retrieved to obtain all entity and corresponding relationship combinations. In each iterative retrieval process, the candidate entity set determined after the previous iterative retrieval is completed is Each candidate entity in is a central node, and the nodes directly connected to it and the corresponding relationships are queried through the graph database query language in Table 3. The retrieval process does not limit the direction of the edge.

[0099] Table 3: Neighborhood search Cypher query example code

[0100]

[0101] 2. Screen all combinations of entities and corresponding relationships as a whole to obtain a set of candidate triples:

[0102] Specifically, through prompt instructions, the large language model is required to screen out the N combinations of entities and corresponding relationships (triplet information) that are most helpful in answering questions, and obtain a set of candidate triplets. During the screening process, the combination of entities and corresponding relationships (triplets) is screened as a whole. By screening in this way, the relevance of triples to questions can be better judged, the accuracy of explicit reasoning can be improved, and the number of calls to the large language model can be reduced by 50%, further reducing the delay of the explicit reasoning process and the cost of calling the large language model.

[0103] Among them, the screening process refers to the simplification of the relationships and entities retrieved in the current step of the retrieval process, and only retains the relationships and entities that are helpful in answering the question. This method can effectively control the complexity of the entire retrieval process and the explicit reasoning process. This method uses a large language model to sort the relevance of the retrieved relationships, entities and questions, and the prompt words used are shown in Table 4. The screening process of the present invention is different from the existing screening method, that is, the process of performing relationship screening and entity screening separately. The present invention screens the combination of entities and relationships (triples) as a whole, which can better judge the relevance of the triples to the questions, and can also reduce the number of calls to the large language model by 50%, further reducing the reasoning delay.

[0104] Table 4: Triplet screening prompt words

[0105]

[0106]

[0107]

[0108] 3. Use the large language model to determine whether it is sufficient to answer the question. If so, output the answer. Otherwise, use the filtered entities as new candidate entity sets for iteration until the maximum inference step is reached:

[0109] Specifically, through prompt instructions, the large language model is required to reason based on the current candidate triple information and its own knowledge and determine whether it can answer the question. If the question can be answered, the answer is output and the whole process ends. If it is not enough to answer the question, the screened entities are used as new candidate entity sets and the explicit reasoning process is performed again until the question can be answered or the maximum number of reasoning steps is reached and the answer is "no".

[0110] After each iteration of the retrieval process and the screening process, the triple information in all the inference path information obtained so far will be integrated, and then the information reasoning and answer generation process similar to step 6 will be performed. First, the large language model is required to evaluate whether it can use the triple information obtained from all previous iterative retrieval processes and screening processes and its own knowledge to answer the corresponding question. If it can answer, it will answer "yes" and give the correct answer, and terminate the reasoning. If there is not enough information to answer the question, the answer is "no", and the entities in the filtered candidate triple set are used as the new candidate set, and the process of steps 7 to 9 is performed again until the question can be answered or the maximum number of inference steps is reached.

[0111] A second aspect of an embodiment of the present application provides a knowledge question answering system combining implicit reasoning and explicit reasoning, including:

[0112] Implicit reasoning module, including knowledge graph representation learning module, pre-trained text vector module, answer entity scoring module, question embedding module and reverse relationship tracing module;

[0113] The knowledge graph representation learning module is used to obtain the vector representation of the nodes of all entities in the knowledge graph, and obtain the vector representation of the nodes of all entities in the knowledge graph;

[0114] Pre-trained text vector module, used to convert question text into high-dimensional vectors;

[0115] The answer entity scoring module is used to obtain the k entities with the best scores as candidate answer entities;

[0116] The question embedding module is used to convert the question text into a vector with the same dimension as the vector representation of the knowledge graph entity, and capture the semantic relationship between the subject entity and the answer entity from the natural language question based on the vector representation of the question text;

[0117] The reverse relationship tracing module is used to reversely trace the complete reasoning path information from the candidate answer entity back to the subject entity;

[0118] Explicit reasoning module, including retrieval module and screening module;

[0119] A retrieval module is used to retrieve all entities and corresponding relationships directly connected to the candidate entity, and obtain a combination of all entities and corresponding relationships;

[0120] The screening module is used to screen out the combinations of N entities and corresponding relationships that are most helpful in answering questions and obtain a set of candidate triples.

[0121] Specific implementation example: simulate a knowledge question-answering process that combines implicit reasoning with explicit reasoning.

[0122] See also Figure 3 , Implicit reasoning: Use the large language model to read the question "Where is the production address of Hanjiang wine?" to get the subject entity "Hanjiang wine" and link it to the entity in the knowledge graph: E topic ={e1,…e N}, we get the vector representation e of the subject entity t ;

[0123] The vector representation of knowledge graph entities is obtained by using the knowledge graph representation learning model TransE based on knowledge graph. a ;

[0124] The pre-trained text vector model RoBERTa is used to convert the question text into a vector with the same dimension as the vector representation of the knowledge graph entity, and the vector representation of the question text is obtained. q ;

[0125] The vector representation of the subject entity is e t , vector representation of knowledge graph entities a and the vector representation of the question text e q Input Answer Entity Scoring Model The k entities with the highest scores are obtained: Kweichow Moutai Town 0.8, Moutai Company 0.1, etc.

[0126] Then, the reverse relationship path tracing method was used to obtain all reasoning paths, including: 1. Hanjiang Liquor → Brand → Moutai → Manufacturer → Moutai Company → Address → Moutai Town, Guizhou; 2. Hanjiang Liquor → Brand → Moutai → Manufacturer → Moutai Company, etc.

[0127] Use the large language model to reason and determine whether the information is sufficient to answer the question. If so, output the answer: Kweichow Moutai Town; otherwise, enter explicit reasoning.

[0128] Explicit reasoning: Add the subject entity "Hanjiang Liquor" to the candidate entity set and use the large language model to search and filter. Specifically, retrieve the triple information related to "Hanjiang Liquor" and filter it to obtain the triple information <Hanjiang Liquor, Brand, Moutai>, which is not enough to answer the question "Where is the production address of Hanjiang Liquor?" The filtered entity is used as a new candidate entity set, and continue to reason to obtain the triple information <Moutai, manufacturer, Moutai Company>, which is not enough to answer the question. Continue iterative reasoning until you get <Moutai Company, Address, Moutai Town, Guizhou>, and output the answer: Moutai Town, Guizhou.

[0129] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0130] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A knowledge question answering method combining implicit reasoning and explicit reasoning, characterized in that: The following steps are involved: Implicit reasoning: Use the scoring function to score the vector representation of the subject entity, knowledge graph entity, and question text to obtain the candidate answer entity. Use the reverse relationship path tracing method to obtain the complete path information from the subject entity to the candidate answer entity. Use the prompt word to determine whether it is sufficient to answer the question. If so, output the answer; otherwise, enter explicit reasoning; Explicit reasoning: add the subject entity to the candidate entity set, retrieve all combinations of entities and corresponding relationships, take the combination as a whole, and filter to obtain a set of candidate triples; judge whether the prompt word is sufficient to answer the question, and if so, output the answer; Otherwise, the filtered entities are used as new candidate entity sets for iteration until the maximum inference step is reached; The reverse relationship path tracing method refers to, after determining the candidate answer entity, reversely tracing all reasoning path information from the candidate answer entity back to the subject entity; In the process of obtaining the complete path information from the subject entity to the candidate answer entity, the direction of the edge in the query path is not restricted.

2. A knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: The set formula of the candidate answer entity is: In the formula, e αns is the set of candidate answer entities, ε is the set of entities in the knowledge graph, a′ is the entity in the entity set in the knowledge graph, and e a ' is the vector representation of the entity in the entity set in the knowledge graph, e t is the vector representation of the topic entity t, e q is the vector representation of the question text q.

3. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: The formula of the scoring function is: In the formula, Re represents the real part of the complex number, e q is the vector representation of the question text, e t is the vector representation of the subject entity, e a is the vector representation of other candidate answer entities in the knowledge graph, are vectors e q 、e t 、e a The kth column of , for the triple relationship (positive sample) that actually exists in the data set, is For the generated non-existent triple relationship (negative sample), 4. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: The retrieval refers to retrieving all entities and corresponding relationships directly connected to the candidate entity using a graph database query language without limiting edges, and obtaining combinations of all entities and corresponding relationships; The filtered entity refers to an entity in the filtered candidate triple set.

5. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: Obtaining the vector representation of the knowledge graph entity refers to obtaining the node vector representation of all entities from the knowledge graph and retrieving the vector representation of the corresponding entity according to the question.

6. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: Acquiring the vector representation of the subject entity refers to extracting the N entities with the highest relevance from the question text using a large language model as the subject entity.

7. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: The complete path information includes triple information; The prompt word is generated by the question and the triple information; The specific implementation method of judging whether the prompt word is sufficient to answer the question refers to requiring the large language model to judge whether the prompt word is sufficient to answer the question based on the triple information.

8. The knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1, characterized in that: Obtaining the vector representation of the question text refers to converting the question text into a high-dimensional vector using a pre-trained text vector model, and then converting the vector into a vector having the same dimension as the vector representation of the graph entity using a neural network and an activation layer.

9. A knowledge question answering method combining implicit reasoning and explicit reasoning as claimed in claim 1 or 4, characterized in that: The screening refers to that the large language model screens out the combinations of all entities and corresponding relationships that are most helpful in answering the question through the prompt words, and obtains a set of candidate triples.

10. A knowledge question answering system combining implicit reasoning and explicit reasoning, characterized in that: include: Implicit reasoning module, including knowledge graph representation learning module, pre-trained text vector module, answer entity scoring module, question embedding module and reverse relationship tracing module; The knowledge graph representation learning module is used to obtain the node vector representation of all entities in the knowledge graph and obtain the vector representation of the knowledge graph entity; Pre-trained text vector module, used to convert question text into high-dimensional vectors; The answer entity scoring module is used to obtain the k entities with the best scores as candidate answer entities; The question embedding module is used to convert the question text into a vector with the same dimension as the vector representation of the knowledge graph entity, and capture the semantic relationship between the subject entity and the answer entity from the natural language question based on the vector representation of the question text; The reverse relationship tracing module is used to reversely trace the complete reasoning path information from the candidate answer entity back to the subject entity; Explicit reasoning module, including retrieval module and screening module; A retrieval module is used to retrieve all entities and corresponding relationships directly connected to the candidate entity, and obtain a combination of all entities and corresponding relationships; The screening module is used to screen out the combinations of N entities and corresponding relationships that are most helpful in answering questions and obtain a set of candidate triples.