A reading comprehension method and system based on a bidirectional integrated matching network

CN117634608BActive Publication Date: 2026-10-09UNIV OF JINAN
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311283185.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-10-09
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

这个过程仅构建了不同序列之间的交互信息,忽略了单个序列的局部语义信息

Benefits of technology

[0032] This invention proposes a bidirectional ensemble matching network based on an attention mechanism, which aims to enhance the word vector representation of paragraph context and question-answer sequence pairs, construct the global interaction relationship between paragraph context and question-answer sequence pairs, and improve the performance of machine reading comprehension models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117634608B_ABST
    Figure CN117634608B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of artificial intelligence, and provides a reading comprehension method and system based on a bidirectional integrated matching network. First, the paragraph context and question-answer sequence pair are fused to enhance the word vector representation. Second, a linear integrated cooperative attention module and a convolution module are matched to match the global interaction relationship, thereby improving the performance of the machine reading comprehension model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a reading comprehension method and system based on a bidirectional integrated matching network. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] The goal of machine reading comprehension is to require machines to answer related questions by analyzing the context of a given paragraph. Multiple-choice reading comprehension is a typical example of machine reading comprehension tasks. Its data format consists of triplets containing paragraph context, a question, and a set of answer candidates. The machine is required to select the correct answer from the candidate set to provide the correct response to the question.

[0004] The encoding and representation of text content and the logical interactions between elements are key steps in multiple-choice reading comprehension, and there is currently a great deal of research on these two aspects.

[0005] (1) In the early stages, researchers used One-Hot word embeddings, where each word was represented as a sparse vector with 1 at the corresponding position and 0 at the other positions. However, this method could not represent the relationships between words. To overcome the shortcomings of One-Hot word embeddings, distributed word embeddings (Word2Vec, GloVe, Fasttext) encoded words into continuous low-dimensional vectors. However, this type of method could not effectively mine contextual information. To address the above challenges, pre-trained contextual word embeddings represented the contextual semantic features of words in a specific context based on the current sentence. Currently, the mainstream contextual word embedding methods include ELMo, GPT, BERT, XLNET, and ALBERT, which mostly use the Transformer architecture to generate contextual representations. However, they are all affected by the nature of Self-Attention, that is, each token is considered to have equal meaning, thus ensuring that they are converted into the same representation subspace. Therefore, this process only leads to the inference of a global relationship.

[0006] In fact, different tokens have different levels of importance for the question, and the global relationship described above cannot represent the entity information that is most beneficial to answering the question.

[0007] (2) Various matching networks have been proposed to capture the interaction between paragraph context, questions, and options. Bi-Directional Attention Flow (BIDAF) constructs multi-granular word embeddings and uses bidirectional attention flow to obtain question-aware paragraph context representations. Option Comparison Network (OCN) uses an attention mechanism to compare the differences between candidate options at the word level, thereby capturing the interaction between candidate options. Wrong Answer Ensemble (WAE) trains the model using a set of wrong answers and a set of correct answers, enabling the model to generalize the features of wrong answers, thereby eliminating wrong options from the answer candidate set. Dual Co-Matching Network (DCMN) integrates sentence selection and option comparison learning strategies. However, the three methods mentioned above require a large number of model parameters. DUal Multi-head Co-Attention (DUMA) considers the focus between each other from the perspective of paragraph context and question-answer sequence pairs, thereby calculating attention weights. However, Co-Attention calculates the attention weight of each token in one sequence to the target token in another sequence and aggregates the attention weights to form interaction information. This process only constructs the interaction information between different sequences, ignoring the local semantic information of a single sequence. Summary of the Invention

[0008] To address the technical problems existing in the background art, the present invention provides a reading comprehension method and system based on a bidirectional integrated matching network. By enhancing the word vector representation of paragraph context and question-answer sequence pairs, a global interaction relationship between paragraph context and question-answer sequence pairs is constructed, thereby improving the performance of machine reading comprehension models.

[0009] To achieve the above objectives, the present invention adopts the following technical solution:

[0010] The first aspect of this invention provides a reading comprehension method based on a bidirectional integrated matching network, comprising the following steps:

[0011] The encoder takes text data as input and outputs a global context representation of the text data.

[0012] An enhanced representation of word vectors is generated by fusing paragraph context and question-answer sequence pairs based on global context representation;

[0013] A linear ensemble network is used to construct the global interaction relationship between paragraph context and question-answer sequence pairs;

[0014] The global interaction relationship is input into the classifier, which outputs the probability score of each option.

[0015] Furthermore, the enhanced representation of word vectors generated by fusing paragraph context and question-answer sequence pairs is specifically as follows:

[0016] The global context representation is split into a text sequence of paragraph contexts and a text sequence of question-and-answer sequence pairs;

[0017] Max pooling is used to extract text sequences of paragraph context and question-answer sequence pairs, and each is condensed into a word vector that can represent global information.

[0018] Using a similarity function, we calculate the word-level content similarity between the condensed word vectors and the global context representation.

[0019] The content similarity is weighted with the corresponding original text sequence to generate an enhanced word vector representation.

[0020] Furthermore, the linear ensemble network includes two symmetrical ensemble layers, specifically a left ensemble layer and a right ensemble layer; the ensemble layer uses a convolutional module and a collaborative attention module to learn text sequence representations; the convolutional module extracts local semantic features of the text sequence, and the collaborative attention module constructs the interaction information of paragraph context and question-answer sequence pairs.

[0021] Furthermore, the left integration layer generates a question-and-answer-aware paragraph context representation, and the right integration layer generates a paragraph context-aware question-and-answer representation; the question-and-answer-aware paragraph context representation and the paragraph context-aware question-and-answer representation are connected to obtain the global interaction relationship between paragraph context and question-and-answer sequence pairs.

[0022] A second aspect of the present invention provides a reading comprehension system based on a bidirectional integrated matching network, comprising:

[0023] Text representation module: Acquires text data input into the encoder and outputs a global context representation of the text data;

[0024] Enhanced representation module: Based on global context representation, it fuses paragraph context and question-answer sequence pairs to generate enhanced representations of word vectors;

[0025] Global Interaction Module: Employs a linear ensemble network to construct global interaction relationships between paragraph context and question-answer sequence pairs;

[0026] Probability output module: Inputs the global interaction relationship into the classifier and outputs the probability score of each option.

[0027] A third aspect of the present invention provides a computer-readable storage medium.

[0028] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a reading comprehension method based on a bidirectional integrated matching network as described above.

[0029] A fourth aspect of the present invention provides a computer device.

[0030] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the reading comprehension method based on a bidirectional integrated matching network as described above.

[0031] Compared with the prior art, the beneficial effects of the present invention are:

[0032] This invention proposes a bidirectional ensemble matching network based on an attention mechanism, which aims to enhance the word vector representation of paragraph context and question-answer sequence pairs, construct the global interaction relationship between paragraph context and question-answer sequence pairs, and improve the performance of machine reading comprehension models.

[0033] This invention provides a method for enhancing word vector representation by fusing paragraph context and question-answer sequence pairs. It extracts the related content between paragraph context and question-answer sequence pairs, embeds the entity information most conducive to answering the question into the global context representation, and enhances the word vector representation of paragraph context and question-answer sequence pairs.

[0034] This invention provides a method for linearly integrating Co-Attention and Convolution to match global interaction relationships. It constructs a question-answering-aware paragraph context representation and a paragraph context-aware question-answering representation by linearly integrating local semantic features and interaction information, thereby constructing a comprehensive global interaction relationship.

[0035] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0036] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0037] Figure 1 This is an overall framework diagram of the bidirectional integrated matching network based on the attention mechanism according to an embodiment of the present invention;

[0038] Figure 2 This is a flowchart illustrating a method for linearly integrating Co-Attention and Convolution to match global interaction relationships according to an embodiment of the present invention.

[0039] Because the structure for building the global interaction relationship between paragraph context and question-and-answer sequence is a left-right symmetrical integration layer, only the method flowchart of the left integration layer is provided. Detailed Implementation

[0040] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0041] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0042] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0043] Example 1

[0044] like Figure 1 As shown, this embodiment provides a reading comprehension method based on a bidirectional ensemble matching network, which specifically includes the following steps:

[0045] S1: Obtain text data input into the encoder and output the global context representation of the text data;

[0046] Multiple choice reading comprehension is a typical task in machine reading comprehension. Its data format is a triple containing paragraph context, question and answer candidate set. The machine is required to select the correct answer from the answer candidate set so that the question has a correct answer.

[0047] Specifically, the text data is a sequence composed of paragraph context, question, and option, in the form of [CLS]Context[SEP]Question-Option[SEP]. Here, [CLS] is the symbol added at the beginning, [SEP] is the separator, Context is the paragraph context, Question is the question, and Option is the corresponding option.

[0048] S2: An enhanced representation of word vectors is generated by fusing paragraph context and question-answer sequence pairs based on global context representation;

[0049] In this embodiment, step S2 specifically includes:

[0050] S201: Decompose the global context representation E output by the encoder into a text sequence E of paragraph context. P =[E P1 E P2 ,…,E Pm The text sequence E of question-and-answer sequence pairs QA =[E Q1 E Q2 ,…,E Qn ].

[0051] S202: Max-pool the text sequences of paragraph context and question-answer sequence pairs, condensing each into a word vector that represents global information. The following formula is used:

[0052]

[0053]

[0054] in, These are word vectors that represent global information about the paragraph context and word vectors that represent the question-and-answer sequence, respectively. MaxPooling() is the maximum pooling function.

[0055] S203: Use a similarity function to calculate the word-level content similarity between the condensed word vectors and the global context representation. The formula is as follows:

[0056]

[0057]

[0058] Among them, S P S QA These represent the word-level content similarity of the concise question-and-answer sequence and paragraph context, respectively, and the global context. Similarity() is the similarity function.

[0059] S204: Weight the similarity values ​​with the corresponding original text sequences to embed related content between the paragraph context and the question-and-answer sequence into the original text sequences, generating enhanced word vector representations. The formula is as follows:

[0060]

[0061]

[0062] in, These are the enhanced paragraph context and question-and-answer sequence pairs, respectively.

[0063] S3: A linear ensemble network is used to construct the global interaction relationship between paragraph context and question-answer sequence pairs;

[0064] The linear ensemble network consists of two symmetrical ensemble layers: a left ensemble layer and a right ensemble layer. Each ensemble layer employs a convolutional module and a collaborative attention module to learn text sequence representations. The convolutional module extracts local semantic features of the text sequence, while the collaborative attention module constructs the paragraph context and the interaction information between question-and-answer sequence pairs.

[0065] In this embodiment, as Figure 2 As shown, step S3 employs a linear ensemble of Co-Attention and Convolution to match global interaction relationships, which includes:

[0066] This method comprises two symmetrical ensemble layers. Each ensemble layer employs a Convolution module and a Co-Attention module to learn text sequence representations, thereby constructing a comprehensive global interaction relationship between paragraph context and question-answer sequence. The Convolution module extracts local semantic features from the text sequence and mainly consists of three parts: a 1×1 convolutional layer, a fully connected layer, and an aggregation layer. The Co-Attention module constructs the interaction information between paragraph context and question-answer sequence pairs and mainly consists of three parts: attention calculation, normalization, and weighting.

[0067] The left-hand ensemble layer generates a question-and-answer-aware paragraph context representation, while the right-hand ensemble layer generates a paragraph context-aware question-and-answer representation. The question-and-answer-aware paragraph context representation and the paragraph context-aware question-and-answer representation are concatenated, and the result serves as the global interaction relationship between paragraph context and question-and-answer sequence pairs.

[0068] Specifically, the steps for constructing the paragraph context representation for question-answering awareness in the left-side integration layer are as follows:

[0069] S301: In the left integration layer, the text sequence of paragraph context is mapped to the same key vector (K) and value vector (V), and the text sequence of question-answer sequence pairs is mapped to query vector (Q).

[0070] S302: The Co-Attention module extracts the interaction information between the question and answer pairs and the paragraph context, specifically:

[0071] Step (1): Weight Q and K to generate an attention weight matrix. The formula is as follows:

[0072] Matrix i,j =Attention(Q,K)

[0073] Where Attention() is the attention calculation function, and Matrix i,j This is the attention weight matrix.

[0074] Step (2): Normalize the attention weight matrix. The formula is as follows:

[0075] Matrix i,j =Norm(Matrix) i,j )

[0076] Norm() is the normalization function.

[0077] Step (3): Weight the attention weight matrix with V to obtain the interaction information. The formula is as follows:

[0078]

[0079] Γ qo-p =Concate(e 1 ,e 2 ,...,e n )

[0080] Among them, e i For interaction information of a single token, Concate() is the concatenation function, Γ qo-p This provides interactive information for the question-and-answer session within the paragraph's context.

[0081] S303: The Convolution module extracts local feature details of Q, K, and V, specifically:

[0082] Step (1): The three vectors are convolved with a kernel size of 1×1 to generate three sets of feature vectors; the formula is as follows:

[0083] f Q ,f K ,f V =Conv(Q,K,V)

[0084] Where Conv() is a convolution function with a size of 1×1, f Q ,f K ,f V These are three sets of feature vectors generated by convolution of three vectors.

[0085] Step (2): Concatenate the representations of the three sets of feature vectors and input them into the fully connected layer to map the feature vectors and generate a feature map; the formula is as follows:

[0086] feature maps = FC(f Q ,f K ,f V )

[0087] Here, FC() is a fully connected function, and featuremaps are feature maps.

[0088] Step (3): Aggregate the weights of the feature map using a 3×3 convolution kernel to obtain local features. The formula is as follows:

[0089] Φ qo-p =Conv(feature maps)

[0090] Where Conv() is a convolution function with a size of 3×3, Φ qo-p These are local features.

[0091] S304: By linearly integrating local features and interaction information through two learnable parameters, a question-answering-aware paragraph context representation is generated. The formula is as follows:

[0092]

[0093] Where η and θ are two learnable parameters, E qo-p A paragraph context representation for question-and-answer awareness.

[0094] S305: In the right-hand integration layer, the text sequence of questions and answers is mapped to the same key vector (K) and value vector (V), and the text sequence of paragraph context is mapped to query vector (Q).

[0095] S306: The Co-Attention module extracts the interaction information between paragraph context and question-and-answer.

[0096] Step (1): Weight Q and K to generate an attention weight matrix.

[0097] Matrix i,j =Attention(Q,K)

[0098] Where Attention() is the attention calculation function, and Matrix i,j This is the attention weight matrix.

[0099] Step (2): Normalize the attention weight matrix.

[0100] Matrix i,j =Norm(Matrix) i,j )

[0101] Norm() is the normalization function.

[0102] Step (3): Weight the attention weight matrix with V to obtain the interaction information.

[0103]

[0104] Γ p-qo =Concate(e 1 ,e 2 ,...,e n )

[0105] Among them, e i For interaction information of a single token, Concate() is the concatenation function, Γ p-qo This provides interactive information for the question-and-answer session within the paragraph's context.

[0106] S307: The Convolution module extracts local feature details of Q, K, and V.

[0107] Step (1): The three vectors are convolved with a kernel size of 1×1 to generate three sets of feature vectors;

[0108] f Q ,f K ,f V =Conv(Q,K,V)

[0109] Where Conv() is a convolution function with a size of 1×1, f Q ,f K ,f V These are three sets of feature vectors generated by convolution of three vectors.

[0110] Step (2): Connect the representations of the three sets of feature vectors and input them into the fully connected layer to map the feature vectors and generate a feature map;

[0111] feature maps = FC(f Q ,f K ,f V )

[0112] Here, FC() is a fully connected function, and feature maps are feature maps.

[0113] Step (3): Use a 3×3 convolution kernel to aggregate the weights of the feature map to obtain local features.

[0114] Φ p-qo =Conv(feature maps)

[0115] Where Conv() is a convolution function with a size of 3×3, Φ p-qo These are local features.

[0116] S308: By linearly integrating local features and interaction information through two learnable parameters, a paragraph context-aware question-and-answer representation is generated.

[0117]

[0118] Where η and θ are two learnable parameters, E p-qo This is a context-aware question-and-answer representation for paragraphs.

[0119] S309: Connect the question-and-answer-aware paragraph context representation and the paragraph context-aware question-and-answer representation, the result of which is the global interaction relationship between paragraph context and question-and-answer sequence.

[0120] S4: Input the global interaction relationship into the classifier and output the probability score of each option.

[0121] The classifier performs a linear transformation on the global interaction relationship and outputs the probability score of each option.

[0122] In this embodiment, the bidirectional ensemble matching network of the present invention comprises two parts: First, it fuses paragraph context and question-answer sequence pairs to enhance word vector representation. Specifically, it generates word-level content similarity between paragraph context and global context representation, and weights this similarity with question-answer sequence pairs to generate enhanced question-answer sequence pair representations; it also generates word-level content similarity between question-answer sequence pairs and global context representation, and weights this similarity with paragraph context to generate enhanced paragraph context representations. Second, it linearly integrates Co-Attention and Convolution to match global interaction relationships. Specifically, it linearly integrates local semantic information of question-answer sequence pairs and paragraph context, as well as interaction information between question-answer sequences and paragraph context, to generate question-answer-aware paragraph context representations; it also linearly integrates local semantic information of paragraph context and question-answer sequence pairs, as well as interaction information between paragraph context and question-answer sequence pairs, to generate paragraph context-aware question-answer representations; and it connects the question-answer-aware paragraph context representations with the paragraph context-aware question-answer representations to generate global interaction relationships.

[0123] Example 2

[0124] This embodiment provides a reading comprehension system based on a bidirectional integrated matching network, which specifically includes:

[0125] Text representation module: Acquires text data input into the encoder and outputs a global context representation of the text data;

[0126] Enhanced representation module: Based on global context representation, it fuses paragraph context and question-answer sequence pairs to generate enhanced representations of word vectors;

[0127] Global Interaction Module: Employs a linear ensemble network to construct global interaction relationships between paragraph context and question-answer sequence pairs;

[0128] Probability output module: Inputs the global interaction relationship into the classifier and outputs the probability score of each option.

[0129] Example 3

[0130] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the reading comprehension method based on a bidirectional integrated matching network as described above.

[0131] Example 4

[0132] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the reading comprehension method based on a bidirectional integrated matching network as described above.

[0133] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A reading comprehension method based on a bidirectional ensemble matching network, characterized in that, include: The encoder takes text data as input and outputs a global context representation of the text data. An enhanced representation of word vectors is generated by fusing paragraph context and question-answer sequence pairs based on global context representation; A linear ensemble network is used to construct the global interaction relationship between paragraph context and question-answer sequence pairs; The global interaction relationship is input into the classifier, and the probability score of each option is output. The paragraph context and question-answer sequence pairs are integrated to enhance the word vector representation. Specifically, the content similarity between the paragraph context and the global context representation at the word level is generated and weighted with the question-answer sequence pairs to generate an enhanced question-answer sequence pair representation; the content similarity between the question-answer sequence pairs and the global context representation at the word level is generated and weighted with the paragraph context to generate an enhanced paragraph context representation. The linear ensemble network comprises two left-right symmetrical ensemble layers. It linearly integrates Co-Attention and Convolution to match global interaction relationships. Specifically, it linearly integrates the local semantic information of question-answer sequence pairs and paragraph context, as well as the interaction information of question-answer sequence - to paragraph context, to generate a question-answer-aware paragraph context representation; it linearly integrates the local semantic information of paragraph context and question-answer sequence pairs, as well as the interaction information of paragraph context - to question-answer sequence pairs, to generate a paragraph context-aware question-answer representation; and it connects the question-answer-aware paragraph context representations to generate global interaction relationships.

2. The reading comprehension method based on a bidirectional integrated matching network as described in claim 1, characterized in that, The process of fusing paragraph context and question-answer sequence pairs to generate enhanced word vector representations is as follows: The global context representation is split into a text sequence of paragraph contexts and a text sequence of question-and-answer sequence pairs; Max pooling is used to extract text sequences of paragraph context and question-answer sequence pairs, and each is condensed into a word vector that can represent global information. Using a similarity function, calculate the word-level content similarity between the condensed word vectors and the global context representation; The content similarity is weighted with the corresponding original text sequence to generate an enhanced word vector representation.

3. The reading comprehension method based on a bidirectional integrated matching network as described in claim 1, characterized in that, The integrated layer uses convolutional modules and collaborative attention modules to learn text sequence representations.

4. The reading comprehension method based on a bidirectional integrated matching network as described in claim 3, characterized in that, The convolution module extracts local semantic features of the text sequence, and the collaborative attention module constructs the interaction information of paragraph context and question-answer sequence pairs.

5. A reading comprehension system based on a bidirectional integrated matching network, characterized in that, include: Text representation module: Acquires text data input into the encoder and outputs a global context representation of the text data; Enhanced representation module: Based on global context representation, it fuses paragraph context and question-answer sequence pairs to generate enhanced representations of word vectors; Global Interaction Module: Employs a bidirectional ensemble matching network to construct global interaction relationships between paragraph context and question-answer sequence pairs; Probability output module: Inputs the global interaction relationship into the classifier and outputs the probability score of each option; The paragraph context and question-answer sequence pairs are integrated to enhance the word vector representation. Specifically, the content similarity between the paragraph context and the global context representation at the word level is generated and weighted with the question-answer sequence pairs to generate an enhanced question-answer sequence pair representation; the content similarity between the question-answer sequence pairs and the global context representation at the word level is generated and weighted with the paragraph context to generate an enhanced paragraph context representation. The linear ensemble network consists of two left-right symmetrical ensemble layers. It linearly integrates Co-Attention and Convolution to match global interaction relationships. Specifically, it linearly integrates the local semantic information of question-answer sequence pairs and paragraph context, as well as the interaction information of question-answer sequence - to paragraph context, to generate a question-answer-aware paragraph context representation; it linearly integrates the local semantic information of paragraph context and question-answer sequence pairs, as well as the interaction information of paragraph context - to question-answer sequence pairs, to generate a paragraph context-aware question-answer representation; and it connects the question-answer-aware paragraph context representations to generate global interaction relationships.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the reading comprehension method based on a bidirectional integrated matching network as described in any one of claims 1-4.

7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the reading comprehension method based on a bidirectional integrated matching network as described in any one of claims 1-4.