Inplausible question and answer method and system based on fact retrieval and verification enhancement
Through the two-way reasoning method based on fact retrieval and verification, the problem of large search space and error accumulation in structured implication tree generation is solved, the interpretability and credibility of the question and answer system are improved, and an accurate structured reasoning chain is generated.
Patent Information
- Application Number
- CN202410960332.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-17
AI Technical Summary
Existing structured implication tree generation methods face the problems of excessive search space and accumulation of errors, resulting in combination failure and invalid steps, affecting the interpretability and credibility of the question answering system.
Adopting a bidirectional reasoning method based on fact retrieval and verification, irrelevant facts are filtered through the fact retrieval module. The bidirectional reasoning module uses an encoder-decoder architecture to generate a single-step proof step. The multi-view comparison learning module enhances the semantic distance, and the cross-validation module enhances the proof. step reliability, and generate the optimal structural tree by proving that the search module aligns the candidate trees.
It effectively reduces the search space, enhances the reliability of the single-step proof step, and improves the interpretability of the question and answer system and the accuracy of the structured reasoning chain.
Smart Images

Figure CN118733742A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and specifically relates to an explainable question-answering method and system based on fact retrieval and verification enhancement. Background Art
[0002] Intelligent question answering (QA) is a technology that enables computers to understand the semantics of an article and answer related questions. It is an important research task in the field of natural language processing (NLP) and an effective evaluation method for verifying the level of machine intelligence. It has broad application value in information retrieval, intelligent customer service, smart justice and other fields.
[0003] In recent years, with the rapid development of deep learning technology, especially the emergence of large language models represented by ChatGPT, the performance of intelligent question-answering tasks has been significantly improved, even surpassing human performance in some indicators. However, language models based on deep neural networks are essentially "black boxes", and with the continuous increase in the number of model parameters and the continuous improvement in complexity, the unexplainability of question-answering systems has become more prominent. Users usually know the answers given by the model "but not why", which seriously hinders the application of question-answering systems in key areas. Therefore, it is crucial to study the interpretability of question-answering systems, and providing a reasoning process from questions to answers can help improve the adjustability and credibility of the model.
[0004] The purpose of Explainable Question Answering (XQA) is to give a corresponding explanation while answering a question. Current related research focuses on three aspects: extracting keywords containing answers, generating multi-hop structured explanation chains, and generating free-form text explanations. Among them, structured implication trees can provide users with explanations in a clearer and richer form by showing the reasoning process from given facts to answers. At present, the generation of structured implication trees has been widely studied. Most of the existing related works use a step-by-step approach to generate structured reasoning chains. RLET designs an implication tree generation framework based on reinforcement learning, which iteratively performs single-step reasoning through sentence selection modules and deductive generation modules; NLProofs introduces an independent verification mechanism to verify the validity of proof steps to prevent invalid steps from generating hallucinations; MetGen proposes a modular-based implication tree generation method, and introduces backward reasoning to enhance the validity of proof steps.
[0005] Existing structure tree generation methods still face two challenges: (1) combination failure due to the large fact search space; (2) error accumulation and invalid steps. Current work mainly uses forward deductive reasoning to perform single-step reasoning. Deductive reasoning is a bottom-up forward reasoning method that requires iteratively searching known facts to generate intermediate conclusions until the target hypothesis is proved. As new reasoning conclusions are added to knowledge facts, the search space continues to expand in each iteration, which can easily lead to combination failure. In addition, the step-by-step generation method inherently has the problem of error accumulation. As the number of proof steps increases, the model may quickly generate invalid proofs, resulting in incorrect tree structures. Summary of the invention
[0006] In view of the problems of large search space and error accumulation faced by current structure tree generation, the present invention provides an explainable question-answering method and system based on fact retrieval and verification enhancement.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] An explainable question answering system based on fact retrieval and verification enhancement, including a fact retrieval module, a bidirectional reasoning module, a multi-view contrastive learning module, a cross-validation module and a proof search module;
[0009] The fact retrieval module is used to filter the candidate fact set constructed based on the context, and dynamically eliminate facts that are irrelevant to the target hypothesis (constructed by the question and the answer) to reduce the search space;
[0010] The bidirectional reasoning module uses the pre-trained language model T5-Large of the encoder-decoder architecture as a deductive and abductive reasoner, generates single-step proof steps in a deductive (bottom-up) and abductive (top-down) manner, and obtains the deductive and abductive candidate structure trees respectively through iterative calculation;
[0011] The multi-view contrastive learning module constructs a local contrastive loss using the target hypothesis and the golden fact sentence given in the training data at the encoder side of the deductive and abductive reasoner, and constructs a global contrastive loss using the candidate steps generated by the beam search algorithm, the golden steps in the original data, and the remaining target steps in the training batch at the decoder side;
[0012] The cross-validation module uses the golden steps in the training data to construct deductive and abductive data and train deductive and abductive scorers to enhance the reliability of a single proof step during bidirectional reasoning;
[0013] The proof search module aligns the candidate structure trees obtained by deductive reasoning and abductive reasoning, and searches in the jointly constructed graph to obtain the best structure tree, and obtains the reasoning steps from the context fact sentence to the target hypothesis.
[0014] The explainable question answering method of the explainable question answering system based on fact retrieval and verification enhancement includes the following steps:
[0015] Step 1: Preliminary filtering of the candidate fact set based on the context is performed through the fact retrieval module, and knowledge facts that are irrelevant to the hypothesis are dynamically eliminated;
[0016] Step 2: Generate a single proof step using the bidirectional reasoning module, where the deductive and abductive generators generate candidate steps in a bottom-up and top-down manner, respectively;
[0017] Step 3: Use the multi-view contrast learning module to shorten the semantic distance between the hypothesis and the golden fact, and enhance the reliability of the proof step from the perspective of similarity;
[0018] Step 4: Use the cross-validation module to mutually validate the deductive and abductive steps, and enhance the reliability of the proof steps from a supportive perspective;
[0019] Step 5: Align the candidate structure trees obtained by bidirectional reasoning through the proof search module, and design a fusion algorithm to obtain the optimal structure tree.
[0020] Furthermore, the step 1 preliminarily filters the candidate fact set through the fact retrieval module, and dynamically removes knowledge facts that are irrelevant to the hypothesis, specifically including the following steps:
[0021] Step 1.1, use the pre-trained language model ALBERT as the encoder to train the hypothesis H and the fact sent i Encode and use average pooling to obtain the sentence embedding representation h of hypothesis H and the sentence embedding representation f of each fact i ;
[0022] Step 1.2, use a multi-layer perceptron built by a fully connected neural network to obtain the relevance score of each fact. The calculation formula is as follows:
[0023]
[0024] Where σ is the sigmoid activation function, [·] represents the concatenation operation, and MLP fact It is a multilayer perceptron consisting of two layers of feedforward networks. Represents the relevance score of each sentence;
[0025] In the tree structure, if a fact has a smaller depth, that is, it is closer to the root node, then it should be closer to the target hypothesis than a fact with a larger depth. Therefore, a marginal ranking is used as the loss of the retriever during training, and the calculation formula is as follows:
[0026]
[0027] in, Is the depth of the golden tree less than The fact that - are the remaining irrelevant facts in the candidate fact set S, and N1 is is the number of pairs, N2 is the number of interference facts, is the marginal of the fact, ψ is the marginal loss, is the final loss; based on the above fact scoring, a threshold is designed to dynamically screen each set of candidate facts.
[0028] Furthermore, the step 2 generates a single proof step (including two leaf nodes and a generated intermediate conclusion) using a bidirectional reasoning module, wherein the deductive and abductive generators generate candidate steps in a bottom-up and top-down manner respectively, specifically including the following steps:
[0029] Step 2.1, using the pre-trained language model T5-Large with encoder-decoder architecture as the deductive and abductive reasoner to perform bottom-up and top-down single-step proof generation respectively;
[0030] Step 2.1.1, construct deductive and abductive training data from the proof steps of the golden tree respectively,
[0031] Step 2.1.2, construct deductive training data in a bottom-up manner: For deduction, it is constructed in a bottom-up manner. In addition to the hypothesis H and the fact set, the input of each step also includes the output of the previous step; then, the step generated at the current moment is used as part of the input of the next model, and the proof steps are continuously generated iteratively until the output hypothesis is terminated with the label "hypothesis";
[0032] Step 2.1.3, construct abductive training data in a top-down manner: For abduction, construct training data from the golden tree in a top-down manner, swap the root node of the deductive step with a leaf node to construct the abductive step, a leaf node in the abductive model output step is the intermediate conclusion generated by the abductive model in the previous step, then use this step as the input of the next abductive model and iterate to generate steps, and terminate when no intermediate conclusion is generated;
[0033] Step 2.2, construct deductive and abductive training data, and train deductive and abductive generators respectively. The calculation formula is as follows:
[0034]
[0035] Among them, G trepresents the proof steps generated at time t, S′ represents the filtered knowledge fact set, Encoder-Decoder represents the encoder and decoder of the sequence-to-sequence model, Represents all the abductive steps generated from time 1 to time t-1; Represents all the abductive steps generated from time 1 to time t-1; represents the deductive steps generated at time t; represents the abductive step generated at time t; during training, the conditional probability likelihood loss is maximized, where the loss calculation formula of the deductive generator is as follows:
[0036]
[0037] in, represents the training loss of the generator, z represents the total number of training data, and the step Each token in is represented as L represents the step length.
[0038] Furthermore, the step 3 uses a multi-view contrastive learning module to shorten the semantic distance between the hypothesis and the golden fact, and enhances the reliability of the proof steps from the perspective of similarity. Specifically, the following steps are included: a multi-view contrastive learning loss that integrates local and global information is designed at the encoder and decoder ends of deduction and abduction, so as to shorten the distance between the golden fact and the target hypothesis from the semantic representation level, so that the generated proof steps are closer to the hypothesis;
[0039] Step 3.1: Design local contrast information on the encoder side, encode the hypothesis H and the fact sentence to obtain the hypothesis sentence representation h' and each fact sentence representation f i ';
[0040] Step 3.1.1, construct positive and negative samples: take the leaf nodes of the golden tree given by the training data as positive examples, and then calculate the cosine similarity between the non-golden facts in the candidate fact set and the hypothesis. Facts with scores greater than a certain threshold are also considered positive examples, and the remaining facts in the fact set are negative examples;
[0041] Based on the above positive and negative samples, the local level contrast loss is constructed, and the calculation process is shown in the following formula:
[0042]
[0043] where f i ' + represents the embedding of the golden fact sentence, S′ gold is the set of golden facts, τ is a configurable temperature coefficient hyperparameter, and f i ′ is the embedding of all fact sentences, sim(·) is the similarity measurement function, and the calculation formula is as follows:
[0044]
[0045] Among them, x and y represent the embedding of two sentences respectively, x T Indicates transposing the embedding vector of sentence x;
[0046] Step 3.2, design the contrast loss of global information at the decoder side;
[0047] For the output of the generative model, the difference in semantic information between sentences cannot be completely separated by positive and negative sample labels. In other words, even negative samples are not necessarily irrelevant to the target output;
[0048] At the decoder side, a beam search algorithm is used to obtain u diverse output embeddings, and then the target output embedding and the outputs of the remaining samples in the current batch are combined to construct a comparison sample set W = {k1, k2, ..., k t}, and create sample pairs (k + ,k - )∈W, where k represents the embedding representation of each sample, + and - are determined by the ranking of the sample, which is obtained by calculating the sequence-level score with the target output to reflect the relative difference between the contrasting samples; the contrastive learning loss calculation process of global information is as follows:
[0049]
[0050] Among them, E x represents the embedding representation of the target output, is the embedding representation of the sample, represents the margin, and cos(·) represents the similarity calculation.
[0051] Furthermore, the step 4 uses a cross-validation module to mutually validate the deductive and abductive steps, and enhances the reliability of the proof steps from a supportive perspective. Specifically, the steps include: cross-validating the candidate steps generated by each step of the deductive and abductive reasoning module, and enhancing the reliability of a single proof step from a supportive perspective;
[0052] Step 4.1, convert the steps of the golden tree in the training data into abductive steps, and construct deductive pairs and abductive pairs respectively.
[0053] Step 4.2, jointly learn the deductive and abductive verifiers by fine-tuning the pre-trained ALBERT pre-trained language model. For each set of step pairs, it is represented as (x1, x2, y), and then the first two sentences are concatenated, and the relevance score calculated with the last sentence is used as the score of this step. The calculation process is shown in the following formula:
[0054]
[0055] Where σ is the sigmoid activation function, MLP ded and MLP abd They are multi-layer perceptrons for deduction and abduction, step ded and step abd They are deductive and abductive steps respectively; the golden proof step is regarded as a positive example, and the counterexample is constructed by randomly replacing one of the premises in the fact set with a non-golden fact. The positive and negative ratio is set to 1:1, and the loss function of the verifier adopts binary cross entropy loss.
[0056] Furthermore, the step 5 aligns the candidate structure trees obtained by the bidirectional reasoning through the proof search module, and designs a fusion algorithm to obtain the optimal structure tree, which specifically includes the following steps: aligning the trees obtained by the deductive and abductive generators respectively into a proof graph, and searching for the optimal structure tree according to the score of each node, wherein the nodes of the graph come from the nodes of the two candidate trees, and the edges are the premise nodes of each proof step pointing to the conclusion nodes.
[0057] Step 5.1, constructing an initial graph based on the deductive tree obtained by the deductive generator in step 2.2, wherein the leaf nodes and intermediate conclusion nodes of the deductive tree are used as nodes of the initial graph;
[0058] Step 5.2, then integrate the part of the attribution tree obtained by the attribution generator in step 2.2 with a confidence score greater than the threshold into the initial graph, expand the nodes and edges of the proof graph, and assign a score to each node; the leaf node score is set to 1.0, and the score of the intermediate conclusion node is the sum of the confidence score of the autoregressive language model and the cross-validator score;
[0059] Step 5.3, finally, based on the proof graph and the scores of each node, the best structure tree is extracted by exploring different paths on the graph.
[0060] An electronic device comprises at least one processor and at least one memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the explainable question-answering method based on fact retrieval and verification enhancement as described in any one of claims 1 to 6.
[0061] A non-transitory computer-readable storage medium storing computer instructions stores a computer program, which is executed by a processor to implement the fact retrieval and verification enhanced explainable question answering method.
[0062] Compared with the prior art, the present invention has the following advantages:
[0063] (1) The present invention proposes an explainable question-answering method and system based on fact retrieval and verification enhancement, which dynamically filters knowledge facts that are irrelevant to the target hypothesis through fact retrieval, effectively reducing the search space.
[0064] (2) The present invention designs a bidirectional proof generation method based on deductive-abductive reasoning, and proposes a cross-validation and multi-view comparative learning mechanism to enhance the reliability of a single proof step from the perspectives of support and similarity.
[0065] (3) By optimizing the learning of each subtask, the present invention can accurately generate a structured reasoning chain for answering questions, thereby enhancing the interpretability of the question-answering system. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 An overall architecture diagram of an explainable question-answering method based on enhanced fact retrieval and verification provided by an embodiment of the present invention;
[0067] Figure 2 Data samples used in the present invention;
[0068] Figure 3 It is a structural diagram of the fact retrieval module of the present invention;
[0069] Figure 4 It is a structural diagram of the bidirectional reasoning module of the present invention;
[0070] Figure 5 This is a structural diagram of the multi-view contrast learning module of the present invention;
[0071] Figure 6 A structure tree generation algorithm for the present invention;
[0072] Figure 7 A schematic diagram of the structure of an explainable question-answering system based on fact retrieval and verification enhancement provided by the present invention;
[0073] Figure 8 A schematic diagram of the overall structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0074] In order to gain a deeper understanding of the present invention, we will provide a comprehensive and detailed description of the present invention. However, the present invention has multiple implementations and is not limited to the specific examples listed herein. The presentation of these examples is intended to deepen the comprehensive understanding of the disclosure of the present invention.
[0075] like Figure 7 As shown in the structural diagram, the present invention provides an explainable question-answering system based on fact retrieval and verification enhancement, including a fact retrieval module, a bidirectional reasoning module, a multi-view comparative learning module, a cross-validation module and a proof search module.
[0076] The fact retrieval module is used to filter the candidate fact set constructed based on the context, and dynamically eliminate facts that are irrelevant to the target hypothesis (constructed by the question and the answer) to reduce the search space;
[0077] The bidirectional reasoning module uses the pre-trained language model T5-Large of the encoder-decoder architecture as a deductive and abductive reasoner, generates single-step proof steps in a deductive (bottom-up) and abductive (top-down) manner, and obtains the deductive and abductive candidate structure trees respectively through iterative calculation;
[0078] The multi-view contrastive learning module constructs a local contrastive loss using the target hypothesis and the golden fact sentence given in the training data at the encoder side of the deductive and abductive reasoner, and constructs a global contrastive loss using the candidate steps generated by the beam search algorithm, the golden steps in the original data, and the remaining target steps in the training batch at the decoder side;
[0079] The cross-validation module uses the golden steps in the training data to construct deductive and abductive data and train deductive and abductive scorers to enhance the reliability of a single proof step during bidirectional reasoning;
[0080] The proof search module aligns the candidate structure trees obtained by deductive reasoning and abductive reasoning, and searches in the jointly constructed graph to obtain the best structure tree, and obtains the reasoning steps from the context fact sentence to the target hypothesis.
[0081] Example 1
[0082] Figure 2 This is an example of the EntailmentBank structured explainable question answering dataset, which contains 1,840 entailment trees and 5,881 reasoning steps. Each tree shows that the question-answer pair is entailed by a small number of related sentences. On average, each entailment tree in the dataset has 7.6 nodes (including leaf nodes, intermediate nodes, and root nodes) and approximately 3.2 entailment steps.
[0083] like Figure 1 The figure shows an overall architecture diagram of an explainable question answering method based on fact retrieval and verification enhancement provided by an embodiment of the present invention. The explainable question answering dataset is further described in detail below in conjunction with the accompanying drawings:
[0084] Step 1: First, use the fact retrieval module to preliminarily filter the candidate fact set and dynamically remove knowledge facts that are irrelevant to the hypothesis. Figure 3 The present invention uses the pre-trained language model ALBERT as the encoder to train the hypothesis H and the fact sent i Encode and use average pooling to obtain the sentence embedding representation h of hypothesis H and the sentence embedding representation f of each fact iThen, a multi-layer perceptron constructed by a fully connected neural network is used to obtain the relevance score of each fact. The calculation formula is as follows:
[0085]
[0086] Where σ is the sigmoid activation function, [·] represents the concatenation operation, and MLP fact It is a multilayer perceptron consisting of two layers of feedforward networks. Represents the relevance score of each sentence. In the tree structure, if a fact has a smaller depth, that is, it is closer to the root node, then it should be closer to the target hypothesis than a fact with a larger depth. Therefore, a marginal ranking is used as the loss of the retriever during training, and the calculation formula is as follows:
[0087]
[0088] in Is the depth of the golden tree less than The fact that - are the remaining irrelevant facts in S, and N1 is is the number of pairs, N2 is the number of interference facts, is the marginal of the fact, ψ is the marginal loss, is the final loss. Based on the above fact scoring, a threshold is designed to dynamically screen each set of candidate facts.
[0089] Step 2, using the bidirectional reasoning module to generate a single proof step, Figure 4 This is the module structure diagram. The present invention uses the pre-trained language model T5-Large as a deductive and abductive reasoner, and executes bottom-up and top-down single-step proof step generation respectively. Specifically, first, the training data of deduction and abduction are respectively constructed from the proof steps of the golden tree. For deduction, it is constructed in a bottom-up manner. In addition to the hypothesis H and the fact set, the input of each step also includes the output of the previous step. Then the step generated at the current moment is used as part of the input of the next model, so as to continuously iterate and generate proof steps until the output hypothesis label "hypothesis" is terminated. For abduction, the training data is constructed from the golden tree in a top-down manner, and the root node of the deductive step is exchanged with a certain leaf node to construct the abduction step. A certain leaf node in the output step of the abduction model is the intermediate conclusion generated by the abduction model in the previous step. Then the step is used as the input of the abduction model in the next step and the step is iteratively generated. When no intermediate conclusion is generated, it is terminated. Deductive and abduction training data are constructed in the above manner, and deductive and abduction generators are trained respectively. The calculation formula is as follows:
[0090]
[0091] Among them, G t represents the proof steps generated at time t, S′ represents the filtered knowledge fact set, Encoder-Decoder represents the encoder and decoder of the sequence-to-sequence model, Represents all the abductive steps generated from time 1 to time t-1; Represents all the abductive steps generated from time 1 to time t-1; represents the deductive steps generated at time t; represents the abductive step generated at time t; during training, the conditional probability likelihood loss is maximized, where the loss calculation formula of the deductive generator is as follows:
[0092]
[0093] The steps Each token in is represented as z represents the total number of training data, represents the training loss of the generator, L represents the step length.
[0094] Step 3: Use the multi-view contrast learning module to shorten the semantic distance between the hypothesis and the golden fact, and enhance the reliability of the proof step from the perspective of similarity. Figure 5 The module structure diagram is shown in Figure 2. The present invention designs a multi-view contrast learning loss that integrates local and global information at the encoder and decoder ends of deduction and abduction, which shortens the distance between the golden fact and the target hypothesis from the semantic representation level, making the generated proof steps closer to the hypothesis. Specifically, first, local contrast information is designed at the encoder end, and the hypothesis H and the fact sentence are encoded to obtain the sentence representation h' of the hypothesis and the sentence representation f of each fact. i '. The positive and negative samples are constructed as follows: the leaf nodes of the golden tree given by the training data are taken as positive examples, and then the cosine similarity between the non-golden facts in the fact set and the hypothesis is calculated. Facts with scores greater than a certain threshold are also taken as positive examples, and the remaining facts in the fact set are negative examples;
[0095] Based on the above positive and negative samples, the local level contrast loss is constructed, and the calculation process is shown in the following formula:
[0096]
[0097] where f i ' + represents the embedding of the golden fact sentence, S′ gold is the set of golden facts, τ is a configurable temperature coefficient hyperparameter, and f i ′ is the embedding of all fact sentences, sim(·) is the similarity measurement function, and the calculation formula is as follows:
[0098]
[0099] Where x and y represent the embedding of two sentences respectively. T represents the transposition of the embedding vector of sentence x; then the contrast loss of global information is designed at the decoder end. First, u diverse output embeddings are obtained through the beam search algorithm, and then the contrast sample set W = {k1, k2, ..., k t}, and create sample pairs (k + ,k - )∈W, where k represents the embedding representation of each sample, + and - are determined by the ranking of the sample, which is obtained by calculating the sequence-level score with the target output, which can reflect the relative difference between the contrasting samples; the contrastive learning loss calculation process of global information is as follows:
[0100]
[0101] Among them, E x represents the embedding representation of the target output, is the embedding representation of the sample, represents the margin, and cos(·) represents the similarity calculation.
[0102] Step 4, using the cross-validation module to mutually verify the deductive and abductive steps, and enhance the reliability of the proof steps from a supportive perspective. The present invention cross-validates the candidate steps generated by each step of the deductive and abductive reasoner, and enhances the reliability of a single proof step from a supportive perspective. Specifically, each single step in the golden tree is converted into a single reasoning step in abductive form, and deductive pairs and abductive pairs are constructed respectively; then, the deductive and abductive verifiers are jointly learned by fine-tuning the pre-trained ALBERT pre-trained language model, and for each set of step pairs, it is represented as (x1, x2, y), and then the first two sentences are concatenated, and the correlation score calculated with the last sentence is used as the score of the step. The calculation process is shown in the following formula:
[0103] V ded (step ded )=σ(MLP ded ([x1;x2]))
[0104] V abd (step abd )=σ(MLP abd ([y;x2]))
[0105] Where σ is the sigmoid activation function, MLP ded and MLP abdThey are multi-layer perceptrons for deduction and abduction, step ded and step abd They are deductive and abductive steps respectively. The golden proof step is regarded as a positive example, and the counterexample is constructed by randomly replacing one premise in the fact set with a non-golden fact. The positive-negative ratio is set to 1:1, and the loss function of the verifier adopts binary cross entropy loss.
[0106] Step 5, using the proof search module to align the candidate structure trees obtained by bidirectional reasoning, and designing a fusion algorithm to obtain the optimal structure tree. The present invention aligns the trees obtained by the deductive and abductive generators in step 2 into a proof graph, and searches for the optimal structure tree according to the score of each node, wherein the nodes of the graph come from the nodes of the two candidate trees, and the edges are the premise nodes of each proof step pointing to the conclusion nodes. Specifically, first, an initial graph is constructed based on the deductive tree, and then the abductive trees with confidence levels greater than a threshold are integrated into the initial graph, the nodes and edges of the proof graph are expanded, and scores are assigned to each node. The leaf node score is set to 1.0, and the score of the intermediate conclusion node is the sum of the confidence score of the autoregressive language model and the cross-validator score. Finally, based on the proof graph and the scores of each node, the optimal structure tree is extracted by exploring different paths on the graph. The structured interpretation generation algorithm of the present invention is as follows: Figure 6 shown.
[0107] Example 2
[0108] An embodiment of the present invention provides an explainable question and answer device based on fact retrieval and verification enhancement, which specifically executes the above-mentioned embodiment process of an explainable question and answer method based on fact retrieval and verification enhancement. For details, please refer to the content of the above-mentioned embodiment of an explainable question and answer method based on fact retrieval and verification enhancement, which will not be repeated here.
[0109] This embodiment provides an electronic device, Figure 8 The overall structure diagram of the electronic device provided by the embodiment of the present invention includes: a processor, a memory, a communication bus and a communication interface; wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the methods provided by the above-mentioned method embodiments, for example, including: encoding questions, factual sentences and assumptions through a pre-trained language model, and outputting the semantic representation of the above-mentioned information; generating a single proof step by using a deductive and abductive reasoner; enhancing the reliability of a single proof step based on two-way cross-validation and multi-view comparative learning; searching for the best structured reasoning chain through alignment and fusion of structure trees.
[0110] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and other media that can store program codes.
[0111] The present embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above-mentioned method embodiments, for example, including: encoding questions, factual sentences, and hypotheses through a pre-trained language model, and outputting semantic representations of the above-mentioned information; generating a single proof step using deductive and abductive reasoners; enhancing the reliability of a single proof step based on two-way cross-validation and multi-view comparative learning; and searching for the best structured reasoning chain through alignment and fusion of structure trees.
[0112] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in the field. Although the illustrative specific embodiments of the present invention are described above to facilitate the understanding of the present invention by the technical personnel in the field, it should be clear that the present invention is not limited to the scope of the specific embodiments. For the ordinary technical personnel in the field, as long as various changes are within the spirit and scope of the present invention defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.
Claims
1. An explainable question answering system based on fact retrieval and verification enhancement, Features: It includes fact retrieval module, bidirectional reasoning module, multi-view contrastive learning module, cross-validation module and proof search module; The fact retrieval module is used to filter the candidate fact set constructed based on the context, and dynamically eliminate facts that are irrelevant to the target hypothesis to reduce the search space; The bidirectional reasoning module uses the pre-trained language model T5-Large of the encoder-decoder architecture as a deductive and abductive reasoner, generates single-step proof steps in a bottom-up deductive and top-down abductive manner, and obtains deductive and abductive candidate structure trees respectively through iterative calculation; The multi-view contrastive learning module constructs a local contrastive loss using the target hypothesis and the golden fact sentence given in the training data at the encoder side of the deductive and abductive reasoner, and constructs a global contrastive loss using the candidate steps generated by the beam search algorithm, the golden steps in the original data, and the remaining target steps in the training batch at the decoder side; The cross-validation module uses the golden steps in the training data to construct deductive and abductive data and train deductive and abductive scorers to enhance the reliability of a single proof step during bidirectional reasoning; The proof search module aligns the candidate structure trees obtained by deductive reasoning and abductive reasoning, and searches in the jointly constructed graph to obtain the best structure tree, and obtains the reasoning steps from the context fact sentence to the target hypothesis.
2. The explainable question answering method based on the explainable question answering system enhanced by fact retrieval and verification according to claim 1, Features: The following steps are involved: Step 1: Preliminary filtering of the candidate fact set based on the context is performed through the fact retrieval module, and knowledge facts that are irrelevant to the hypothesis are dynamically eliminated; Step 2: Generate a single proof step using the bidirectional reasoning module, where the deductive and abductive generators generate candidate steps in a bottom-up and top-down manner, respectively; Step 3: Use the multi-view contrast learning module to shorten the semantic distance between the hypothesis and the golden fact, and enhance the reliability of the proof step from the perspective of similarity; Step 4: Use the cross-validation module to mutually validate the deductive and abductive steps, and enhance the reliability of the proof steps from a supportive perspective; Step 5: Align the candidate structure trees obtained by bidirectional reasoning through the proof search module, and design a fusion algorithm to obtain the optimal structure tree.
3. The explainable question answering method based on the explainable question answering system enhanced by fact retrieval and verification according to claim 2, Features: The step 1 preliminarily filters the candidate fact set through the fact retrieval module, and dynamically removes knowledge facts that are irrelevant to the hypothesis, specifically including the following steps: Step 1.1, use the pre-trained language model ALBERT as the encoder to train the hypothesis H and the fact sent i Encode and use average pooling to obtain the sentence embedding representation h of hypothesis H and the sentence embedding representation f of each fact i ; Step 1.2, use a multi-layer perceptron built by a fully connected neural network to obtain the relevance score of each fact. The calculation formula is as follows: Where σ is the sigmoid activation function, [·] represents the concatenation operation, and MLP fact It is a multilayer perceptron consisting of two layers of feedforward networks. Represents the relevance score of each sentence; a marginal ranking is used as the loss of the retriever during training, and the calculation formula is as follows: in, Is the depth of the golden tree less than The fact that - are the remaining irrelevant facts in the fact set S, N 1 yes The number of pairs, N 2 is the number of interfering facts, is the marginal of the fact, ψ is the marginal loss, is the final loss; based on the above fact scoring, a threshold is designed to dynamically screen each set of candidate facts.
4. The method for explaining question answering based on fact retrieval and verification enhancement according to claim 2, Features: The step 2 generates a single proof step using a bidirectional reasoning module, wherein the deductive and abductive generators generate candidate steps in a bottom-up and top-down manner respectively, specifically including the following steps: Step 2.1, using the pre-trained language model T5-Large with encoder-decoder architecture as the deductive and abductive reasoner to perform bottom-up and top-down single-step proof generation respectively; Step 2.1.1, construct deductive and abductive training data from the proof steps of the golden tree respectively, Step 2.1.2, construct deductive training data in a bottom-up manner: For deduction, it is constructed in a bottom-up manner. In addition to the hypothesis H and the fact set, the input of each step also includes the output of the previous step; then, the step generated at the current moment is used as part of the input of the next model, and the proof steps are continuously generated iteratively until the output hypothesis is terminated with the label "hypothesis"; Step 2.1.3, construct abductive training data in a top-down manner: For abduction, construct training data from the golden tree in a top-down manner, swap the root node of the deductive step with a leaf node to construct the abductive step, a leaf node in the abductive model output step is the intermediate conclusion generated by the abductive model in the previous step, then use this step as the input of the next abductive model and iterate to generate steps, and terminate when no intermediate conclusion is generated; Step 2.2, construct deductive and abductive training data, and train deductive and abductive generators respectively. The calculation formula is as follows: Among them, Gt represents the proof steps generated at time t, S′ represents the filtered knowledge fact set, Encoder-Decoder represents the encoder and decoder of the sequence-to-sequence model. Represents all the abductive steps generated from time 1 to time t-1; Represents all the abductive steps generated from time 1 to time t-1; represents the deductive steps generated at time t; represents the abductive step generated at time t; during training, the conditional probability likelihood loss is maximized, where the loss calculation formula of the deductive generator is as follows: in, represents the training loss of the generator, z represents the total number of training data, and the step Each token in is represented as L represents the step length.
5. The method for explaining question answering based on fact retrieval and verification enhancement according to claim 2, Features: The step 3 uses a multi-view contrast learning module to shorten the semantic distance between the hypothesis and the golden fact, and enhances the reliability of the proof step from the perspective of similarity. Specifically, the following steps are included: Step 3.1: Design local contrast information on the encoder side, encode the hypothesis H and the fact sentence to obtain the hypothesis sentence representation h' and each fact sentence representation f i '; Step 3.1.1, construct positive and negative samples: take the leaf nodes of the golden tree given by the training data as positive examples, and then calculate the cosine similarity between the non-golden facts in the candidate fact set and the hypothesis. Facts with scores greater than a certain threshold are also considered positive examples, and the remaining facts in the fact set are negative examples; Based on the above positive and negative samples, the local level contrast loss is constructed, and the calculation process is shown in the following formula: in represents the embedding of the golden fact sentence, S′ gold is the set of golden facts, τ is a configurable temperature coefficient hyperparameter, and f i ′ is the embedding of all fact sentences, sim(·) is the similarity measurement function, and the calculation formula is as follows: Among them, x and y represent the embedding of two sentences respectively, x T Indicates transposing the embedding vector of sentence x; Step 3.2, design the contrast loss of global information at the decoder end: first, obtain u diverse output embeddings through the beam search algorithm, and then combine the target output embedding and the output of the remaining samples in the current batch to construct a contrast sample set W = {k 1 ,k 2 ,...,k t }, and create sample pairs (k + ,k - )∈W, where k represents the embedding representation of each sample, + and - are determined by the ranking of the sample, which is obtained by calculating the sequence-level score with the target output to reflect the relative difference between the contrasting samples; the contrastive learning loss calculation process of global information is as follows: Among them, E x represents the embedding representation of the target output, E k+ 、E k- is the embedding representation of the sample, represents the margin, and cos(·) represents the similarity calculation.
6. The method for explaining question answering based on fact retrieval and verification enhancement according to claim 2, Features: The step 4 uses a cross-validation module to mutually validate the deductive and abductive steps, and enhances the reliability of the proof step from a supportive perspective, specifically including the following steps: Step 4.1, convert the steps of the golden tree in the training data into abductive steps, and construct deductive pairs and abductive pairs respectively. Step 4.2, jointly learn the deductive and abductive verifiers by fine-tuning the pre-trained ALBERT pre-trained language model. For each set of step pairs, it is represented as (x1, x2, y), and then the first two sentences are concatenated, and the relevance score calculated with the last sentence is used as the score of this step. The calculation process is shown in the following formula: Where σ is the sigmoid activation function, MLP ded and MLP abd They are multi-layer perceptrons for deduction and abduction, step ded and step abd They are deductive and abductive steps respectively; the golden proof step is regarded as a positive example, and the counterexample is constructed by randomly replacing one of the premises in the fact set with a non-golden fact. The positive and negative ratio is set to 1:1, and the loss function of the verifier adopts binary cross entropy loss.
7. The method for explaining question answering based on fact retrieval and verification enhancement according to claim 2, Features: The step 5 aligns the candidate structure trees obtained by bidirectional reasoning through the proof search module, and designs a fusion algorithm to obtain the optimal structure tree, which specifically includes the following steps: Step 5.1, constructing an initial graph based on the deductive tree obtained by the deductive generator in step 2.2, wherein the leaf nodes and intermediate conclusion nodes of the deductive tree are used as nodes of the initial graph; Step 5.2, then integrate the attribution trees with confidence greater than the threshold into the initial graph, expand the nodes and edges of the proof graph, and assign scores to each node; the leaf node score is set to 1.0, and the score of the intermediate conclusion node is the sum of the confidence score of the autoregressive language model and the cross-validator score; Step 5.3, finally, based on the proof graph and the scores of each node, the best structure tree is extracted by exploring different paths on the graph.
8. An electronic device, Features: It includes at least one processor and at least one memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the explainable question-answering method based on fact retrieval and verification enhancement as described in any one of claims 2 to 7.
9. A non-transitory computer-readable storage medium storing computer instructions, Features: A computer program is stored thereon, and the computer program is used by a processor to execute the fact retrieval and verification enhanced explainable question answering method.
Citation Information
Patent Citations
Multi-hop question and answer-oriented multi-path reasoning method based on knowledge graph question and answer
CN115293151A
Neural reasoning path retrieval for multi-hop text comprehension
US20220222436A1
Cited By
Large model generation content information security enhancement-oriented system and method
CN119558403A
