Knowledge enhancement method, system, device and medium based on machine reading comprehension
By evaluating confidence scores and performing graph structure fusion, the redundancy and noise problems in knowledge fusion in machine reading comprehension are solved, and the accuracy of answers and the reliability of the reasoning process are improved.
Patent Information
- Application Number
- CN202410796074.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-20
AI Technical Summary
Existing machine reading comprehension methods based on knowledge fusion have problems with information redundancy and noise, and fail to effectively consider the reliability and applicability of knowledge, as well as the modal differences between knowledge graphs and text information, resulting in low answer accuracy. .
By obtaining the question text and candidate answer text, perform encoding processing and splicing, calculate the similarity and then evaluate the confidence score. If the confidence is low, obtain the relevant knowledge text from the knowledge graph, perform graph structure fusion, calculate the weight and then weight the sum. Generate fused textual semantic vectors to predict answers.
It effectively solves the redundancy and noise problems in knowledge fusion, and improves the answer accuracy of machine reading comprehension and the reliability of the reasoning process.
Smart Images

Figure CN118364813B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language data processing, and specifically relates to a knowledge enhancement method, system, device, and medium based on machine reading comprehension. Background Art
[0002] Machine reading comprehension is a text-based intelligent question-answering technology. The machine predicts the answer from the corresponding text according to the given question. The predicted answer types include multiple-choice type, interval answer type and free generation type. Among them, the multiple-choice type selects the answer from multiple preset answer options, the interval answer type identifies the start and end positions of the answer from the paragraph to provide the answer, and the free generation type generates the answer by itself.
[0003] In order to avoid the situation where the provided text information is sometimes insufficient to support the machine reading comprehension model to answer questions, a machine reading comprehension model that combines external knowledge has been developed, such as a pre-trained language model based on Transformer. However, the existing machine reading comprehension methods based on knowledge fusion still have the following two problems:
[0004] (1) The retrieved knowledge is directly integrated with the text information as the model input, without considering the reliability and applicability of the knowledge and whether the context information is sufficient to support the model's answer. It is integrated into the pre-trained language model, which easily generates information redundancy and noise, and it is difficult to ensure the validity of the knowledge.
[0005] (2) Directly integrate the retrieved knowledge with the text information without considering that the knowledge graph and the text information belong to different modalities. For example, by converting the retrieved knowledge into text information for integration, the structured information of the original knowledge in the knowledge graph will be missing; for another example, considering the structured information in the knowledge graph, but using different semantic spaces to represent the graph and text separately, and then performing information interaction and integration, this will lead to the semantic gap problem. Summary of the invention
[0006] In order to solve the problems raised by the background technology, the present invention provides a knowledge enhancement method, system, device and medium based on machine reading comprehension.
[0007] The technical solution of the present invention is as follows:
[0008] The present invention provides a knowledge enhancement method based on machine reading comprehension, comprising the following steps:
[0009] S1: Obtain the question text, the first text of the answer to be found, and the candidate answer texts. All the candidate answer texts constitute a candidate answer text set;
[0010] S2: After encoding the question text, the first text and the candidate answer text respectively, they are concatenated to obtain a text semantic vector;
[0011] S3: After the text semantic vector is passed through the first multi-layer perceptron, the similarity between the first text and the candidate answer text is calculated to obtain the probability that the candidate answer text is the correct answer. The probabilities of all candidate answer texts constitute the probability distribution of the candidate answer texts.
[0012] S4: Evaluate the probability distribution of the candidate answer text and obtain the confidence score.
[0013] One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer;
[0014] One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and obtain the probability corresponding to the fitted correct answer label after iterative training of the prediction model, and use the probability corresponding to the fitted correct answer label as the confidence score;
[0015] S5: If the confidence score is less than the confidence threshold, then from the second text, according to the string matching rule, several knowledge texts related to the question text are obtained; the knowledge texts are respectively encoded to obtain several knowledge vectors;
[0016] The text semantic vector is integrated with the knowledge vector, specifically,
[0017] Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the linearly transformed features of each node are transferred to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained.
[0018] After calculating the weights of the text semantic vector and the updated knowledge vector respectively, the text semantic vector and the updated knowledge vector are weighted summed to obtain the fused text semantic vector;
[0019] According to the fused text semantic vector, the second multi-layer perceptron predicts the probability distribution of the answer, and takes the answer corresponding to the maximum probability in the probability distribution as the predicted answer;
[0020] If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
[0021] In S4, the probability corresponding to the fitted correct answer label is obtained, specifically,
[0022] According to the formula: , get the probability corresponding to the correct answer label,
[0023] According to the formula: , get the predicted probability,
[0024] According to the formula: , after comparing the probability corresponding to the correct answer label with the predicted probability, we get the loss value, and perform iterative training based on the loss value to get the probability corresponding to the fitted correct answer label.
[0025] In the formula, is the probability corresponding to the correct answer label during the training phase; Represents the predicted probability in the new training task; Represents the loss value of the new training task using the mean square error as the loss function; is the input sample; The answer label corresponding to the input sample; Represents the sample of the nth input; Represents the answer label corresponding to the nth input sample; are the parameters of the prediction model; and represents learnable parameters; Represents the text semantic vector obtained after L layers of Tranformer blocks; N represents the number of samples in the current round.
[0026] In S5, the fused text semantic vector is obtained, specifically,
[0027] According to the formula: , perform weighted summation of the text semantic vector and the updated knowledge vector to obtain the fused text semantic vector,
[0028] In the formula, is the fused text semantic vector, is the text semantic vector, For the updated diagram, is the confidence score and gate represents the gating mechanism.
[0029] In S5, according to the fused text semantic vector, the probability distribution of the answer is predicted by the second multi-layer perceptron, specifically,
[0030] According to the formula: , predict the probability distribution of the answer,
[0031] Where W2 and b2 are the learnable parameters of the second multilayer perceptron when the confidence score is less than the confidence threshold. is the fused text semantic vector, is the probability distribution of the answer when the confidence score is less than the confidence threshold.
[0032] In S5, according to the text semantic vector, the probability distribution of the answer is predicted by the first multi-layer perceptron, specifically,
[0033] According to the formula: , predict the probability distribution of the answer,
[0034] Where W1 and b1 are the learnable parameters of the first multilayer perceptron when the confidence score is not less than the confidence threshold. is the text semantic vector, is the probability distribution of the answer when the confidence score is not less than the confidence threshold.
[0035] In S5, according to the string matching rule, several knowledge texts related to the question text are obtained, specifically,
[0036] The question text is segmented to obtain several words. According to the string matching rules, the etymological forms of the several words are matched with the etymological forms of the knowledge text. If the match is successful, the successfully matched knowledge text is used as the knowledge text related to the question text.
[0037] The present invention also provides a knowledge enhancement system based on machine reading comprehension, comprising:
[0038] Acquisition module: used to acquire question text, first text to be found and candidate answer texts, all candidate answer texts constitute a candidate answer text set;
[0039] Preprocessing module: used to encode the question text, the first text and the candidate answer text respectively, and then concatenate them to obtain a text semantic vector;
[0040] The probability distribution composition module of the candidate answer text: after the text semantic vector is processed by the first multi-layer perceptron, the similarity between the first text and the candidate answer text is calculated, and the probability that the candidate answer text is the correct answer is obtained. The probabilities of all the candidate answer texts constitute the probability distribution of the candidate answer text;
[0041] Evaluation module: Evaluate the probability distribution of candidate answer texts to obtain confidence scores.
[0042] One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer;
[0043] One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and obtain the probability corresponding to the fitted correct answer label after iterative training of the prediction model, and use the probability corresponding to the fitted correct answer label as the confidence score;
[0044] Answer prediction module: if the confidence score is less than the confidence threshold, then several knowledge texts related to the question text are obtained from the second text according to the string matching rule; the knowledge texts are encoded respectively to obtain several knowledge vectors;
[0045] The text semantic vector is integrated with the knowledge vector, specifically,
[0046] Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the linearly transformed features of each node are transferred to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained.
[0047] After calculating the weights of the text semantic vector and the updated knowledge vector respectively, the text semantic vector and the updated knowledge vector are weighted summed to obtain the fused text semantic vector;
[0048] According to the fused text semantic vector, the second multi-layer perceptron predicts the probability distribution of the answer, and takes the answer corresponding to the maximum probability in the probability distribution as the predicted answer;
[0049] If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
[0050] The present invention also provides a knowledge enhancement device based on machine reading comprehension, comprising a processor and a memory, wherein the processor implements the knowledge enhancement method based on machine reading comprehension when executing a computer program stored in the memory.
[0051] The present invention also provides a knowledge enhancement medium based on machine reading comprehension, which is used to store a computer program, wherein the computer program implements the knowledge enhancement method based on machine reading comprehension when executed by a processor.
[0052] Beneficial effects: The present invention uses a confidence mechanism to calculate the confidence score of the current sample, thereby determining whether the current sample needs to integrate external knowledge to assist in answering, which can effectively solve the problems of knowledge redundancy and noise, and selectively predict the probability distribution of the answer based on the confidence evaluation result, and perform answer reasoning, which greatly improves the accuracy of the machine for reading comprehension questions, and the reasoning process is highly reliable;
[0053] The confidence evaluation method adopted by the present invention, on the one hand, has a strong reliability of the confidence score; on the other hand, the method of judging whether the model integrates knowledge based on the confidence evaluation result to assist the model in answering can effectively solve the redundancy and noise problems when integrating knowledge;
[0054] The present invention controls the fusion of text semantic vectors and updated knowledge vectors through weights, can selectively fuse knowledge, and thus effectively solve the problems of knowledge redundancy and noise, greatly improving the accuracy of machines for reading comprehension questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The figure is a flowchart of a knowledge enhancement method based on machine reading comprehension in an embodiment. DETAILED DESCRIPTION
[0056] The following examples are intended to illustrate the present invention rather than to further limit the present invention.
[0057] The present invention provides a knowledge enhancement method based on machine reading comprehension, such as Figure 1 As shown, the following steps are included:
[0058] S1: Obtain the question text, the first text of the answer to be found, and the candidate answer texts. All the candidate answer texts constitute a candidate answer text set.
[0059] S2: After encoding the question text, the first text and the candidate answer text respectively, they are concatenated to obtain a text semantic vector.
[0060] The question and the first text of the answer to be found are both written expressions in the form of human language, wherein the first text of the answer to be found may include one or more paragraphs. Based on the question text and the paragraph text, the candidate answer is obtained according to the string matching rules. Because the paragraph, question and candidate answer are usually a piece of text, before machine reading comprehension, the paragraph, question and candidate answer need to be preprocessed, for example, the paragraph, question and candidate answer are encoded and spliced using a pre-trained language model, and the text semantic vector is used as the input of the pre-trained language model.
[0061] The representation of text semantic vector is as follows:
[0062] ,
[0063] ,
[0064] ,
[0065] in, , , Represent the question text, paragraph text, and kth candidate answer text respectively; S is the text semantic vector; , , Represent the word embedding, position embedding, and part embedding of the ith word, respectively, and represent the semantic representation of word meaning, position, and part in the low-dimensional dense space; is the initial semantic vector of the i-th word; Represents the text semantic vector after each layer is updated by the stacked Transformer blocks.
[0066] S3: After the text semantic vector passes through the first multi-layer perceptron and calculates the similarity between the first text and the candidate answer text, the probability that the candidate answer text is the correct answer is obtained. The probabilities of all candidate answer texts constitute the probability distribution of the candidate answer text.
[0067] The present invention uses the candidate answer text as a reference to perform preliminary training on the first multi-layer perceptron to obtain the probability distribution of the candidate answer text.
[0068] S4: Evaluate the probability distribution of the candidate answer text and obtain the confidence score.
[0069] One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer.
[0070] Specifically,
[0071] According to the formula: , the probability of getting the correct answer with the highest probability;
[0072] According to the formula: , the probability of getting the second most likely correct answer;
[0073] According to the formula: , get the confidence score;
[0074] In the formula, Represents the probability of the correct answer with the highest probability; represents the probability of the second most likely correct answer; represents the input sample; represents the parameters of the first multi-layer perceptron; k is an element in the candidate answer text; represents probability; Represents the confidence score.
[0075] One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and after iterative training of the prediction model, obtain the probability corresponding to the fitted correct answer label, and use the probability corresponding to the fitted correct answer label as the confidence score.
[0076] Preferably, in S4, the probability corresponding to the fitted correct answer label is obtained, specifically,
[0077] According to the formula: , get the probability corresponding to the correct answer label,
[0078] According to the formula: , get the predicted probability,
[0079] According to the formula: , after comparing the probability corresponding to the correct answer label with the predicted probability, we get the loss value, and perform iterative training based on the loss value to get the probability corresponding to the fitted correct answer label.
[0080] In the formula, is the probability corresponding to the correct answer label during the training phase; Represents the predicted probability in the new training task; Represents the loss value of the new training task using the mean square error as the loss function; is the input sample; The answer label corresponding to the input sample; Represents the sample of the nth input; Represents the answer label corresponding to the nth input sample; are the parameters of the prediction model; and represents learnable parameters; Represents the text semantic vector obtained after L layers of Tranformer blocks; N represents the number of samples in the current round.
[0081] This operation introduces a new training task in the training phase to assist the first multi-layer perceptron in learning to predict the probability corresponding to the correct answer label as a confidence evaluation method to further optimize the parameters.
[0082] The confidence assessment method adopted by the present invention, on the one hand, has a strong reliability of the confidence score; on the other hand, the method of judging whether to integrate knowledge to assist in answering based on the confidence assessment result can effectively solve the redundancy and noise problems when integrating knowledge.
[0083] Regarding confidence, we have: ,
[0084] in, It is a manually defined threshold used to determine whether the confidence level is met. Specifically, When the confidence level is high enough, there is no need to integrate external knowledge to assist in answering. This means that current knowledge is not sufficient to support the answer and external knowledge needs to be integrated to assist in answering.
[0085] S5: If the confidence score is less than the confidence threshold, then several knowledge texts related to the question text are obtained from the second text according to the string matching rule; the knowledge texts are respectively encoded to obtain several knowledge vectors.
[0086] Considering that the paragraph text is not enough to answer the question, and external knowledge needs to be integrated to assist the answer, preferably, in S5, according to the string matching rule, the knowledge text related to the question text is obtained, specifically,
[0087] The question text is segmented to obtain several words. According to the string matching rules, the etymological forms of the several words are matched with the etymological forms of the knowledge text. If the match is successful, the successfully matched knowledge text is used as the knowledge text related to the question text.
[0088] For example, retrieve knowledge related to the problem from the knowledge graph ConceptNet.
[0089] After obtaining the knowledge text, since the knowledge graph is stored in the form of knowledge text triples, for a word in the question text , and obtain a set of knowledge triples related to it , it is encoded through the TransE algorithm and converted into a knowledge vector.
[0090] ,
[0091] in, d is the Euclidean distance; is a word in the question text; Representatives and A related set of knowledge triplets.
[0092] The text semantic vector is integrated with the knowledge vector, specifically,
[0093] In order to make full use of the structural information of the graph, the graph convolution algorithm can be used to aggregate adjacent knowledge texts and update each node to obtain broader neighborhood information.
[0094] Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the features of each node after linear transformation are passed to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained.
[0095] Specifically,
[0096] According to the formula: , update the node,
[0097] in, represents the node representation of the i-th node in the l+1 layer, is the activation function, For the The learnable parameters of the layer center node, For the The learnable parameters of the neighbor nodes of the layer center node, is the jth node in The node representation of the layer, Represents all nodes of the current subgraph.
[0098] According to the formula: , for pooling,
[0099] in, For the updated diagram, is the node representation of the i-th node in the last layer.
[0100] After respectively calculating the weights of the text semantic vector and the updated knowledge vector, the text semantic vector and the updated knowledge vector are weightedly summed to obtain a fused text semantic vector.
[0101] The calculation of the weights of the text semantic vector and the updated knowledge vector may be implemented using, but not limited to, a gating mechanism.
[0102] Preferably, in S5, the fused text semantic vector is obtained, specifically,
[0103] According to the formula: , perform weighted summation of the text semantic vector and the updated knowledge vector to obtain the fused text semantic vector,
[0104] In the formula, is the fused text semantic vector, is the text semantic vector, For the updated diagram, is the confidence score and gate represents the gating mechanism.
[0105] The present invention controls the fusion of text semantic vectors and updated knowledge vectors through weights, can selectively fuse knowledge, and thus effectively solve the problems of knowledge redundancy and noise, greatly improving the accuracy of machines for reading comprehension questions.
[0106] According to the fused text semantic vector, the probability distribution of the answer is predicted by the second multi-layer perceptron, and the answer corresponding to the maximum probability in the probability distribution is taken as the predicted answer.
[0107] Preferably, in S5, the probability distribution of the answer is predicted by a second multi-layer perceptron according to the fused text semantic vector, specifically,
[0108] According to the formula: , predict the probability distribution of the answer,
[0109] Where W2 and b2 are the learnable parameters of the second multilayer perceptron when the confidence score is less than the confidence threshold. is the fused text semantic vector, is the probability distribution of the answer when the confidence score is less than the confidence threshold.
[0110] If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
[0111] Specifically,
[0112] According to the formula: , predict the probability distribution of the answer,
[0113] Where W1 and b1 are the learnable parameters of the first multilayer perceptron when the confidence score is not less than the confidence threshold. is the text semantic vector, is the probability distribution of the answer when the confidence score is not less than the confidence threshold.
[0114] The present invention uses a confidence mechanism to calculate the confidence score of the current sample, thereby determining whether the current sample needs to integrate external knowledge to assist in answering. It can effectively solve the problems of knowledge redundancy and noise, and selectively predict the probability distribution of the answer based on the confidence evaluation results, and perform answer reasoning, which greatly improves the machine's accuracy for reading comprehension questions and the reasoning process is highly reliable.
[0115] The present invention also provides a machine reading comprehension system, comprising:
[0116] Acquisition module: used to acquire question text, first text to be found and candidate answer texts, all candidate answer texts constitute a candidate answer text set;
[0117] Preprocessing module: used to encode the question text, the first text and the candidate answer text respectively, and then concatenate them to obtain a text semantic vector;
[0118] The probability distribution composition module of the candidate answer text: after the text semantic vector is processed by the first multi-layer perceptron, the similarity between the first text and the candidate answer text is calculated, and the probability that the candidate answer text is the correct answer is obtained. The probabilities of all the candidate answer texts constitute the probability distribution of the candidate answer text;
[0119] Evaluation module: Evaluate the probability distribution of candidate answer texts to obtain confidence scores.
[0120] One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer;
[0121] One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and obtain the probability corresponding to the fitted correct answer label after iterative training of the prediction model, and use the probability corresponding to the fitted correct answer label as the confidence score;
[0122] Answer prediction module: if the confidence score is less than the confidence threshold, then several knowledge texts related to the question text are obtained from the second text according to the string matching rule; the knowledge texts are encoded respectively to obtain several knowledge vectors;
[0123] The text semantic vector is integrated with the knowledge vector, specifically,
[0124] Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the linearly transformed features of each node are transferred to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained.
[0125] After calculating the weights of the text semantic vector and the updated knowledge vector respectively, the text semantic vector and the updated knowledge vector are weighted summed to obtain the fused text semantic vector;
[0126] According to the fused text semantic vector, the second multi-layer perceptron predicts the probability distribution of the answer, and takes the answer corresponding to the maximum probability in the probability distribution as the predicted answer;
[0127] If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
[0128] The present invention also provides a machine reading comprehension device, comprising a processor and a memory, wherein the processor implements the knowledge enhancement method based on machine reading comprehension when executing a computer program stored in the memory.
[0129] The present invention also provides a machine reading comprehension medium for storing a computer program, wherein the computer program implements the knowledge enhancement method based on machine reading comprehension when executed by a processor.
Claims
1. A knowledge enhancement method based on machine reading comprehension, characterized in that: The following steps are involved: S1: Obtain the question text, the first text of the answer to be found, and the candidate answer texts. All the candidate answer texts constitute a candidate answer text set; S2: After encoding the question text, the first text and the candidate answer text respectively, they are concatenated to obtain a text semantic vector; S3: After the text semantic vector is passed through the first multi-layer perceptron, the similarity between the first text and the candidate answer text is calculated to obtain the probability that the candidate answer text is the correct answer. The probabilities of all candidate answer texts constitute the probability distribution of the candidate answer texts. S4: Evaluate the probability distribution of the candidate answer text and obtain the confidence score. One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer; One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and obtain the probability corresponding to the fitted correct answer label after iterative training of the prediction model, and use the probability corresponding to the fitted correct answer label as the confidence score; S5: If the confidence score is less than the confidence threshold, then from the second text, according to the string matching rule, several knowledge texts related to the question text are obtained; the knowledge texts are respectively encoded to obtain several knowledge vectors; The text semantic vector is integrated with the knowledge vector, specifically, Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the linearly transformed features of each node are transferred to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained. After calculating the weights of the text semantic vector and the updated knowledge vector respectively, the text semantic vector and the updated knowledge vector are weighted summed to obtain the fused text semantic vector; According to the fused text semantic vector, the second multi-layer perceptron predicts the probability distribution of the answer, and takes the answer corresponding to the maximum probability in the probability distribution as the predicted answer; If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
2. The knowledge enhancement method based on machine reading comprehension according to claim 1 is characterized in that: In S4, the probability corresponding to the fitted correct answer label is obtained, specifically, According to the formula: , get the probability corresponding to the correct answer label, According to the formula: , get the predicted probability, According to the formula: , after comparing the probability corresponding to the correct answer label with the predicted probability, we get the loss value, and perform iterative training based on the loss value to get the probability corresponding to the fitted correct answer label. In the formula, is the probability corresponding to the correct answer label during the training phase; Represents the predicted probability in the new training task; Represents the loss value of the new training task using the mean square error as the loss function; is the input sample; The answer label corresponding to the input sample; Represents the sample of the nth input; Represents the answer label corresponding to the nth input sample; are the parameters of the prediction model; and represents learnable parameters; Represents the text semantic vector obtained after L layers of Tranformer blocks; N represents the number of samples in the current round.
3. The knowledge enhancement method based on machine reading comprehension according to claim 1 is characterized in that: In S5, the fused text semantic vector is obtained, specifically, According to the formula: , perform weighted summation of the text semantic vector and the updated knowledge vector to obtain the fused text semantic vector, In the formula, is the fused text semantic vector, is the text semantic vector, For the updated diagram, is the confidence score and gate represents the gating mechanism.
4. The knowledge enhancement method based on machine reading comprehension according to claim 1 is characterized in that: In S5, according to the fused text semantic vector, the probability distribution of the answer is predicted by the second multi-layer perceptron, specifically, According to the formula: , predict the probability distribution of the answer, Where W2 and b2 are the learnable parameters of the second multilayer perceptron when the confidence score is less than the confidence threshold. is the fused text semantic vector, is the probability distribution of the answer when the confidence score is less than the confidence threshold.
5. The knowledge enhancement method based on machine reading comprehension according to claim 1, characterized in that: In S5, according to the text semantic vector, the probability distribution of the answer is predicted by the first multi-layer perceptron, specifically, According to the formula: , predict the probability distribution of the answer, Where W1 and b1 are the learnable parameters of the first multilayer perceptron when the confidence score is not less than the confidence threshold. is the text semantic vector, is the probability distribution of the answer when the confidence score is not less than the confidence threshold.
6. The knowledge enhancement method based on machine reading comprehension according to claim 1, characterized in that: In S5, according to the string matching rule, several knowledge texts related to the question text are obtained, specifically, The question text is segmented to obtain several words. According to the string matching rules, the etymological forms of the several words are matched with the etymological forms of the knowledge text. If the match is successful, the successfully matched knowledge text is used as the knowledge text related to the question text.
7. A knowledge enhancement system based on machine reading comprehension, characterized in that: include: Acquisition module: used to acquire question text, first text to be found and candidate answer texts, all candidate answer texts constitute a candidate answer text set; Preprocessing module: used to encode the question text, the first text and the candidate answer text respectively, and then concatenate them to obtain a text semantic vector; The probability distribution composition module of the candidate answer text: after the text semantic vector is processed by the first multi-layer perceptron, the similarity between the first text and the candidate answer text is calculated, and the probability that the candidate answer text is the correct answer is obtained. The probabilities of all the candidate answer texts constitute the probability distribution of the candidate answer text; Evaluation module: Evaluate the probability distribution of candidate answer texts to obtain confidence scores. One evaluation operation is to obtain a confidence score by subtracting the probability of the largest probability being the correct answer from the probability distribution of the candidate answer texts and the probability of the second most likely being the correct answer; One evaluation operation is to obtain the probability corresponding to the correct answer label based on the probability of the candidate answer text, compare the probability corresponding to the correct answer label with the predicted probability, and obtain the probability corresponding to the fitted correct answer label after iterative training of the prediction model, and use the probability corresponding to the fitted correct answer label as the confidence score; Answer prediction module: if the confidence score is less than the confidence threshold, then several knowledge texts related to the question text are obtained from the second text according to the string matching rule; the knowledge texts are encoded respectively to obtain several knowledge vectors; The text semantic vector is integrated with the knowledge vector, specifically, Several knowledge texts related to the question text are taken as nodes. The nodes are connected by edges to form neighbor nodes. After the graph is constructed, the linearly transformed features of each node are transferred to the neighbor nodes, and the nodes are updated. Based on the updated nodes, an updated subgraph is obtained. After the updated subgraph is pooled, an updated graph and an updated knowledge vector are obtained. After calculating the weights of the text semantic vector and the updated knowledge vector respectively, the text semantic vector and the updated knowledge vector are weighted summed to obtain the fused text semantic vector; According to the fused text semantic vector, the second multi-layer perceptron predicts the probability distribution of the answer, and takes the answer corresponding to the maximum probability in the probability distribution as the predicted answer; If the confidence score is not less than the confidence threshold, the probability distribution of the answer is predicted by the first multi-layer perceptron according to the text semantic vector, and the answer corresponding to the maximum probability in the probability distribution is used as the predicted answer.
8. A knowledge enhancement device based on machine reading comprehension, characterized in that: The method comprises a processor and a memory, wherein when the processor executes the computer program stored in the memory, the knowledge enhancement method based on machine reading comprehension as described in any one of claims 1 to 6 is implemented.
9. A knowledge enhancement medium based on machine reading comprehension, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the knowledge enhancement method based on machine reading comprehension as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Leveraging entity relations to discover answers using a knowledge graph
CN112214584A
Multi-item selection question-answering method based on semantic sorting and knowledge correction
CN112528003A
Extraction type reading understanding method based on external knowledge and fragment selection
CN114385803A
Knowledge reasoning method based on heterogeneous knowledge fusion
CN117235216A
Method and system for machine reading comprehension
US20220198149A1
