An expert relearning reasoning question-answering method combining gating networks
By combining expert relearning methods with gating networks, the contribution of question text and knowledge graph representation is dynamically adjusted, which solves the problem of limited interaction in the LM+KG question answering method and achieves more accurate answer prediction and better generalization ability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KUNMING UNIV OF SCI & TECH
- Filing Date
- 2023-02-13
- Publication Date
- 2026-05-26
AI Technical Summary
In existing LM+KG question answering methods, the interaction between language representation and knowledge graph representation is limited, and existing methods ignore the influence of different knowledge sources on answer prediction, resulting in limited prediction accuracy.
We employ an expert relearning reasoning question-answering method that combines gating networks. By preprocessing language models to encode question text and answer options, we retrieve knowledge graph subgraphs, use graph neural networks for multi-round message passing, and dynamically learn attention weights for different representations through expert networks to accurately predict answers.
It improves the accuracy and generalization ability of question answer prediction, and the experimental results show excellent performance on public datasets, outperforming existing methods.
Smart Images

Figure CN116795958B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically relating to an expert relearning reasoning question-answering method that combines gating networks. Background Technology
[0002] In recent years, with the continuous development of question-answering systems, question-answering tasks not only require machines to understand the question context and the question itself, but also to perform relational reasoning on question entities and entity relationships by referencing external knowledge. Typically, large pre-trained language models (LMs) can acquire implicit knowledge (textual relationships, etc.) from unstructured text encoding during fine-tuning. Pre-trained language models have achieved significant results in many question-answering tasks, but their performance in structured reasoning remains poor. Furthermore, structured knowledge graphs (KGs) represent knowledge of relationships between entities and have multilateral relationships, where entities are represented as nodes and their relationships as edges. While knowledge graphs are more suitable for structured reasoning, they cannot obtain the semantic features of unstructured text. Therefore, how to effectively utilize both unstructured and structured knowledge sources for reasoning remains an important open problem. One key research direction is to combine language models and knowledge graphs (LM+KG) to complete question-answering tasks, using LMs to encode the question context and constructing graph neural networks to perform structured knowledge reasoning from external knowledge graphs. Related methods typically follow a retrieval and modeling paradigm. First, the process involves obtaining the topic entities (KG entities mentioned in the given problem context) and their few-hop neighbors. Then, a subgraph is retrieved from the KG, and the retrieved subgraph is modeled and inferred using a carefully designed graph neural network module. Finally, prediction is performed using a multilayer perceptron.
[0003] However, the LM+KG question-and-answer method still has the following problems.
[0004] The interaction between language representation and knowledge graph representation is limited. Existing LM+KG methods employ a framework where the question context (question text and answer options) and the knowledge subgraph are independently encoded by a pre-trained language model and a GNN in the initial steps, and then fused later to compute the final prediction probability. Current research methods use concatenation, summation, and element-wise multiplication of the two modal representations for fusion, inputting the fused representation vector into a fully connected layer to predict the answer. However, the limited interaction between the question text representation and the knowledge graph representation in these methods may fail to simulate complex question-knowledge relationships, leading to limited prediction accuracy.
[0005] Existing methods focus more on the reasoning process of knowledge graph subgraphs. After constructing the knowledge graph reasoning subgraph for the question task, a multilayer perceptron (MLP) is used to directly predict the answer to the question. However, this only performs answer prediction in a coarse-grained manner and ignores the influence of different knowledge sources on answer prediction, which limits the accuracy of answer prediction. Summary of the Invention
[0006] To address the aforementioned technical issues, this invention designs an expert relearning reasoning question-answering method combined with a gating network. This method not only integrates the question text representation and the reasoned knowledge graph representation, but also dynamically learns the attention weights of the question text representation and the reasoned knowledge graph representation on the question, accurately predicting the answer. First, a preprocessing language model is used to encode the question text and answer options, obtaining question and answer entity representations. The question text and answer options are then connected to form the question context. Next, knowledge graph subgraphs related to the question text and answer options are retrieved from the knowledge graph. The question context is represented using a language model, and question context nodes are initialized. These nodes are then linked to the subgraphs to form a reasoning graph. A pre-trained language model is used to calculate the relevance between the question context and each node in the knowledge graph subgraph, scoring and reasoning for each entity in the subgraph. The question context representation, question context node representation, and the reasoned knowledge graph representation are then integrated, and an expert network (multilayer perceptron and ReLU activation function) is used to further learn the combinatorial characteristics of each representation form. By using a gating network (softmax layer), different expert combination weights are generated, resulting in attention weights for the question in different representations. The results of the expert network are then used to more accurately predict the answer score.
[0007] To achieve the above-mentioned technical effects, the present invention is implemented through the following technical solution: an expert relearning reasoning question-answering method combined with gating networks, comprising the following steps:
[0008] Step 1: Read the question text and answer options, concatenate the question text and answer options to obtain the question context; then use a language model to combine them into f. head (f enc The function f(x) is used, where the encoder f enc Map the text input (x) to the context representation h LM Above, h LM The output representation of the [CLS] tags appended to the input sequence (x) is used to obtain the representation of the QA context, and the subgraph G related to the question text and question answer options is retrieved from the knowledge graph. sub ;
[0009] Furthermore, Step 1 includes the following steps:
[0010] Step 1.1: The model's input consists of the complete question text and answer options. A pre-trained language model is used to preprocess the question text and answer options, adding [CLS] tags and concatenating the question text and answer options to form the question context [q; a]. This context is then processed by the encoder f. enc Map the input [q; a] in this article to the problem context representation h. LM superior;
[0011] Step 1.2: Match the knowledge base G with the topic entities marked in the question text and question answer options above, and select ConmeceptNet as the knowledge base; use the path lookup method to find the 3-hop neighbors between each topic entity to form G. sub ;
[0012] Step 2: Introduce a problem context node z to represent the problem context, and... and Represented as the knowledge graph entity set mentioned in the question; and z is connected to the topic entity V. q,a Thus, the reasoning graph G is obtained from two sources of knowledge. T ; Use a pre-trained language model to compute the problem context nodes and G T The relevance score of other nodes in G is used as the basis for each G. T Additional features of nodes, thereby adaptively capturing problem context nodes and G. T The relationships between other nodes;
[0013] Furthermore, Step 2 includes the following steps:
[0014] Step 2.1: Introduce a problem context node z to represent the problem context, and... and Represented as the knowledge graph entity set mentioned in the question; and z is connected to the topic entity V. q,a (V q,a :=V q ∪V a (z) represents all entities that appear in the question or answer selection. LM =f enc (text(z))) forms a reasoning graph G for answer reasoning. T ;
[0015] Step 2.2: First, use the pre-trained language model to analyze each subgraph node v∈V. subThe relevance is scored under the QA context; for each node v, the QA context text text(z) is concatenated with the KG entity text text(v), and the relevance score is calculated as shown in Figure 1:
[0016] ρ v =f head (f enc [text(z);text(v)]) (1)
[0017] This represents the probability of text(v) calculated by LM;
[0018] Step 3: Then G T Multi-round message passing is performed on the attention-based GNN module; it represents nodes through iterative message passing between neighbors on the graph; and at each layer of the graph neural network, the representation of each node t is updated.
[0019] Furthermore, Step 3 includes the following steps:
[0020] Step 3.1: Node representation is achieved using iterative message passing between neighbors in the graph, and each node t∈V is updated at each layer of the graph neural network using Equation 2. T The representation of
[0021]
[0022] Where N t Let m represent the neighborhood of node t. st ∈R D It records the messages from each neighbor node from s to t, while α st It is an attention weight that will weigh each message m st Extend from s to t; then, pass the message through a two-layer MLP, f n :R D →R D And perform batch normalization; for each node t∈V T This invention uses a linear transformation f h To set This transformation embeds its initial node into R. D ;
[0023] Step 3.2: For information transmission (m st ) and attention (α) st First, we need to obtain the embedding type u of each node t. t And the embedding relationship r from node s to node t st The calculation method is as follows:
[0024] u t =f u (u t ),r st =f r (e st ,u s ,u t (3)
[0025] u s ,u t∈ {0,1} |T| e st ∈{0,1} |R| Both are single-hop vectors, representing the node type of s and the relationship type of edge (s,t) of t, respectively; It is a linear transformation, f r :R |R|+2|T| →R D It is a two-layer MLP; then the message from s to t is calculated as follows:
[0026]
[0027] Where f m :R 2.5D →R D It is a linear transformation;
[0028] Step 3.3: Attention is used to capture the strength of the association between two nodes, ideally based on their node type, relationship, and node relevance score; this paper first embeds the relevance score of each node t, as shown in formula 5:
[0029] ρ t =f ρ (ρ t (5)
[0030] in It is an MLP;
[0031] Step 3.4: Calculate the attention weight α from node s to node t. st This invention calculates the query vector (q) and the key vector (k), as shown in formulas 6 and 7, and calculates the attention weight α using the query vector (q) and the key vector (k). st The calculation formula is as shown in Figure 8:
[0032]
[0033]
[0034]
[0035] Where f q :R 2D →R D and f k :R 3D →R D It is a linear transformation; it yields the updated representation of each node.
[0036] Step 4: Integrating the knowledge graph after reasoning (G T The system uses an expert network (multilayer perceptron and ReLU activation function) to learn the combination characteristics of each representation form, and uses a gated network (softmax layer) to generate different expert combination weights, thereby obtaining the attention weights of different representation forms for the question. Finally, the results of the expert network are used to more accurately predict the answer score.
[0037] Furthermore, Step 4 includes the following steps:
[0038] Step 4.1: First, integrate the problem context, the problem context node representation, and the reasoning graph G. T The node representation is shown in formula 9:
[0039]
[0040] in g represents Pooling;
[0041] Step 4.2: Input the fused information into each expert module. Through a multilayer perceptron, continuously learn the latent knowledge of each knowledge source to obtain the output e of each expert. p (o), the formula is shown in 10:
[0042] e p (o)=MLP(o) (10)
[0043] Where p is the number of experts;
[0044] Step 4.3: Analyze the problem context, the representation of problem context nodes, and the reasoning graph G. T The nodes represent these three inputs, perform different aggregations, and obtain the final vector representation O(log n). LM O GNN O g The calculation formulas are shown in Figures 11, 12, and 13. Simultaneously, a separate gating network β is added for the expert (e), which dynamically controls the contribution of the three input information types to the predicted answer through a softmax layer. The calculation method is shown in Figures 11, 12, and 13.
[0045]
[0046]
[0047]
[0048] Where w is the weight matrix, b is the bias value, and E is the total number of experts in this representation;
[0049] Step 4.4: Given a question q and an answer choice a, calculate the probability of the final answer choice by reasoning about the question text and the question answer options, and use the cross-entropy loss optimization model. The calculation method is shown in Formula 14. The answer with the highest probability is the final answer to the question.
[0050] p(a|q)∝exp(Linear([O LM ||O GNN ||O g (14)
[0051] The beneficial effects of this invention are:
[0052] This invention combines an expert relearning reasoning question-answering model with a gating network. It uses a pre-trained language model for scoring and preprocessing to obtain the question context and reasoning graph. Finally, through an expert network, it deeply learns the semantic features of two representation forms and dynamically adjusts the contribution of the two representation forms to answer prediction using a gating network. Experimental results demonstrate that the proposed method is highly effective for question-answer prediction. By comprehensively considering the different contributions of the question text representation and the reasoned knowledge graph representation to answer prediction, the prediction accuracy can be improved. Experiments on public datasets also show good results, indicating that the method is not only applicable to fixed question-answer prediction but also has a certain generalization ability. Attached Figure Description
[0053] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is an overall model diagram of the present invention;
[0055] Figure 2 This is a model diagram of the knowledge graph node relevance scoring module of the present invention;
[0056] Figure 3 This is an overall flowchart of the present invention;
[0057] Figure 4 This is a graph showing the experimental results for the number of GNN layers;
[0058] Figure 5 This is a graph showing the experimental results for the number of Expert parameters. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0060] Example 1
[0061] See Figures 1 to 3 As shown, an expert relearning reasoning question-answering method combining gating networks is described, and the specific steps of the method are as follows:
[0062] Step 1: For the question "Question: A revolving door is convenient for two-direction travel, but also serves as a security measure at what? Answer: A. bank* B. library C. department store D. mall E. New York", and the answer options, based on... Figure 1 As shown in the model, the question text and answer options are read, concatenated, and the question context [q; a] is obtained. Then, a language model is used to combine them into f. head (f enc The function f(x) is used, where the encoder f enc Map the text input (x) to the context representation h LM Above, h LM The output representation of the [CLS] tags appended to the input sequence (x) is used to obtain the representation of the QA context, and the subgraph G related to the question text and question answer options is retrieved from the knowledge graph. sub .
[0063] Step 1.1: Use a pre-trained language model to preprocess the question text and answer options, adding [CLS] tags and concatenating the question text and answer options to form the question context [q; a]. Then, use the encoder f... enc Map the input [q; a] in this article to the problem context representation h. LMsuperior.
[0064] Step 1.2: Match the knowledge base G with the topic entities marked in the question text and answer options (for this invention, we choose to use ConmeceptNet as the knowledge base). Using a pathfinding method, find the 3-hop neighbors between each topic entity to form G. sub .
[0065] Step 2: Introduce a problem context node z to represent the problem context, and... and Let z be represented as the knowledge graph entity set mentioned in the question, and connect z to the topic entity V. q,a ( (to represent all entities appearing in the question or answer selection), thus obtaining the reasoning graph G from two knowledge sources. T Using a pre-trained language model to compute the problem context nodes and G... T The relevance score of other nodes in G is used as the basis for each G. T Additional features of nodes, thereby adaptively capturing problem context nodes and G. T The relationships between other nodes.
[0066] Step 2.1: Introduce a problem context node z to represent the problem context, and... and Let z be represented as the knowledge graph entity set mentioned in the question, and connect z to the topic entity V. q,a (V q,a :=V q ∪V a (z) represents all entities that appear in the question or answer selection. LM =f enc (text(z))) forms a reasoning graph G for answer reasoning. T .
[0067] Step 2.2: First, use the pre-trained language model to analyze each subgraph node v∈V. sub The relevance is scored under the QA context. For each node v, the QA context text text(z) is concatenated with the KG entity text text(v), and the relevance score is calculated as shown in (1):
[0068] ρ v =f head (f enc [text(z);text(v)]) (1)
[0069] This represents the probability of text(v) calculated by LM.
[0070] Step 3: Then G T Multi-round message passing is performed on an attention-based GNN module. It represents nodes through iterative message passing between neighbors in the graph. And at each layer of the graph neural network, the representation of each node t is updated.
[0071] Step 3.1: Node representation is achieved using iterative message passing between neighbors in the graph, and each node t∈V is updated at each layer of the graph neural network using formula (2). T The representation of
[0072]
[0073] Where N t Let m represent the neighborhood of node t. st ∈R D It records the messages from each neighbor node from s to t, while α st It is an attention weight that will weigh each message m st Extend from s to t. Then, pass the message through a two-layer MLP, f n :R D →R D Then perform batch processing and normalization. For each node t∈V T This invention uses a linear transformation f h To set This transformation embeds its initial node into R. D .
[0074] Step 3.2: For information transmission (m st ) and attention (α) st First, we need to obtain the embedding type u of each node t. t And the embedding relationship r from node s to node t st The calculation method is as follows (3):
[0075] u t =f u (u t ),r st =f r (e st ,u s ,u t (3)
[0076] u s ,u t∈ {0,1} |T| e st ∈{0,1}|R| Both are single-hop vectors, representing the node type of s and t and the relationship type of edge (s,t), respectively. It is a linear transformation, f r :R |R|+2|T| →R D It is a two-layer MLP. The message from s to t is then calculated as follows:
[0077]
[0078] Where f m :R 2.5D →R D It is a linear transformation.
[0079] Step 3.3: Attention is used to capture the strength of the association between two nodes, ideally based on their node type, relationship, and node relevance score. This paper first embeds the relevance score of each node t, as shown in formula (5):
[0080] ρ t =fρ(ρ t (5)
[0081] in It is an MLP.
[0082] Step 3.4: Calculate the attention weight α from node s to node t. st This invention calculates the query vector (q) and the key vector (k), as shown in formulas (6) and (7), and calculates the attention weight α using the query vector (q) and the key vector (k). st The calculation formula is as follows (8):
[0083]
[0084]
[0085]
[0086] Where f q :R 2D →R D and f k :R 3D →R D It is a linear transformation. It yields the updated representation of each node.
[0087] Step 4: Integrating the knowledge graph after reasoning (G TThe system uses an expert network (multilayer perceptron and ReLU activation function) to learn the combinatorial properties of each representation, including the question text representation. A gating network (softmax layer) is then used to generate different expert combination weights, resulting in attention weights for different representations related to the question. Finally, the results from the expert network are used to more accurately predict the answer score.
[0088] Step 4.1: First, integrate the problem context, the problem context node representation, and the reasoning graph G. T The nodes are represented by the formula shown in (9):
[0089] o = [z LM ||z GNN ||z g (9)
[0090] in g represents Pooling.
[0091] Step 4.2: Input the fused information into each expert module. Through a multilayer perceptron, continuously learn the latent knowledge of each knowledge source to obtain the output e of each expert. p (o), the formula is shown in (10):
[0092] e p (o)=MLP(o) (10)
[0093] Where p represents the number of experts.
[0094] Step 4.3: Analyze the problem context, the representation of problem context nodes, and the reasoning graph G. T The nodes represent these three inputs, perform different aggregations, and obtain the final vector representation O(log n). LM O GNN O g The calculation formulas are shown in (11), (12), and (13). A separate gating network β is added to the expert (e), which dynamically controls the contribution of the three input information types to the predicted answer through a softmax layer. The calculation methods are shown in (11), (12), and (13).
[0095]
[0096]
[0097]
[0098] Where w is the weight matrix, b is the bias value, and E is the total number of experts in this representation.
[0099] Step 4.4: Given a question q and an answer choice a, calculate the probability of the final answer choice by reasoning about the question text and the question answer options, and use the cross-entropy loss optimization model. The calculation method is shown in formula (14). The answer with the highest probability is the final question answer.
[0100] p(aq)∝exp(Linear([O LM O GNN O g ]))(14)
[0101] In this invention, a preprocessing language model is first used to encode the question text and answer options to obtain question and answer entity representations. The question text and answer options are then connected to form a question context. Next, a knowledge graph subgraph related to the question text and answer options is retrieved from the knowledge graph. The question context is represented using a language model, and question context nodes are initialized. These nodes are then linked to the subgraph to form a reasoning graph. A pre-trained language model is used to calculate the relevance between the question text and each node in the knowledge graph, thereby scoring and reasoning for each entity in the subgraph. Finally, the question context representation, question context node representation, and the reasoned knowledge graph representation are fused. An expert network (multilayer perceptron and ReLU activation function) is used to further learn the combinatorial properties of each representation. A gating network (softmax layer) is used to generate different expert combination weights, thus obtaining the attention weights for different representations of the question. The results of the expert network are then used to more accurately predict the answer score.
[0102] Example 2
[0103] To verify the effectiveness of this invention, the CommonsenseQA dataset, a public question reasoning evaluation dataset, was used. Simultaneously, to verify the generalization ability of this invention, the OpenBookQA question answering technology evaluation dataset was used. The dataset's question texts cover multiple fields, including science and technology, society, current affairs, and daily life. The CommonsenseQA dataset in this paper is a five-option multiple-choice QA task, containing a total of 12,102 questions, with 18,241 questions in the test set, 2,442 questions in the validation set, and 2,381 questions in the openBookQA dataset. The OpenBookQA dataset is a four-option multiple-choice QA task, containing 5,957 questions, with 4,957 questions in the test set, 500 questions in the validation set, and 500 questions in the openBookQA dataset. Dataset statistics are shown in Table 1.
[0104] Table 1. Statistics of the experimental dataset
[0105]
[0106] During the model training process, the roles of the validation set and the test set are as follows: after the model has trained on a batch of data, the model is used to calculate the probability of the answer options in the question text in the validation set, and the accuracy is used to test the model's performance; finally, the model with the highest accuracy is saved, and the model's performance is tested using the test set data after training is completed.
[0107] The parameters of this invention are set as follows: the dimension of the GNN module is set to 200, the number of GNN layers is set to 5, the number of Experts is 3, and the dropout rate of each GNN layer
[27] is 0.2. The parameters of the model are optimized by RAdam, the batch size is 128, the gradient norm is 1.0, and the learning rates of the LM and GNN modules are 1e-5 and 1e-3, respectively.
[0108] In the question-answer reasoning task, to better compare with the baseline, all experimental results were calculated using the same method as the baseline, with accuracy as the evaluation metric, as shown in formula (15). The higher the accuracy, the better the prediction performance.
[0109]
[0110] Where TP represents the total number of samples in which the model correctly predicts the answer to the question, TN represents the total number of samples in which the model incorrectly predicts the answer to the question, FP represents the total number of samples in which the model correctly predicts the answer to the question, and FN represents the total number of samples in which the model incorrectly predicts the answer to the question.
[0111] To verify the effectiveness and generalization ability of this invention, experimental results were compared on two public question-answering datasets based on accuracy. Simultaneously, this invention was compared with question-answering inference models from recent years to demonstrate its superior performance. The CommonseQA dataset was processed using RoBERTa-large, and the openBookQA dataset was processed using both RoBERTa-large and ArishodRoBERTa. For fair comparison, the same language model was used in all baselines and the proposed model. The proposed model shows significant improvements on both the CommonseQA and OpenBookQA datasets, exceeding RoBERTa by 5.55% and 5.89%, respectively, and exceeding the current state-of-the-art (SOTA) model QA-GNN in the LM+KG framework by 2.08% and 0.11%, respectively. Specifically, on the OpenBookQA dataset, the AristoRoBERTa data processing method resulted in a 5.6% improvement over RoBERTa and a 1.23% improvement over the QA-GNN model. Experimental results are shown in Tables 2 and 3.
[0112] Table 2 Performance Comparison Experiment of CommonseQA Internal Segmentation
[0113]
[0114] Table 3. Test Accuracy Comparison Experiment of OpenBookQA
[0115]
[0116] Experimental results demonstrate the effectiveness of the proposed method. This question-answering approach, combining expert relearning reasoning with gated networks, can more deeply mine and utilize latent knowledge during the reasoning process. This allows for dynamic adjustment of the contribution of the question text representation and the post-reasoning knowledge graph representation to answer prediction, resulting in more accurate answer prediction. Experiments on the public datasets CommonseQA and OpenBookQA validate the method's performance, showing it to be effective on specific question-answer datasets and possessing a certain degree of generalization ability.
[0117] This invention performs multi-round message passing on a graph neural network and combines expert relearning inference. To verify the effectiveness of the parameter selection in the proposed expert relearning inference question-answering method combined with a gating network, a parameter selection experiment was conducted. The impact of the number of GNN layers (L) and the number of experts (k) on the performance of the proposed method was investigated.
[0118] The impact of the number of GNN layers: by Figure 4 The data shows that the performance of our proposed method continuously increases with the number of GNN layers, reaching its optimal value (78.62%) when L=5. Performance begins to decline when L>5. As the number of layers increases, the model transitions from underfitting to overfitting.
[0119] The impact of the number of Experts: by Figure 5 The data shows that the computational complexity increases with the number of Experts. The optimal value (78.62%) of the proposed method is reached when p = 3. When p > 3, the complexity increases, performance begins to fluctuate, and model accuracy decreases.
[0120] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0121] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. An expert relearning reasoning question-answering method combining gating networks, characterized in that, Includes the following steps: Step 1: Read the question text and answer options, concatenate the question text and answer options to obtain the question context; then use a language model to combine them into a coherent sentence. Function, where encoder Enter text Mapping to context representation superior, To append to the input sequence The output representation marked with [CLS] is used to obtain a representation of the QA context, and subgraphs related to the question text and question answer options are retrieved from the knowledge graph. ; Step 2: Introduce a problem context node to represent the problem context. ,Will and Represented as the knowledge graph entity set mentioned in the question; and Connect to the subject entity Thus, a reasoning diagram is obtained from two sources of knowledge. ; Use a pre-trained language model to compute the problem context nodes and The relevance score of other nodes in the middle is used as the relevance score for each node. Additional features of nodes, thereby adaptively capturing problem context nodes and The relationships between other nodes; Step 3: Then Multi-round message passing is performed on the attention-based GNN module; it represents nodes through iterative message passing between neighbors on the graph; and updates each node at each layer of the graph neural network. The representation of ; Step 4: Integrating the knowledge graph after reasoning The text representation of the problem is further learned through an expert network multilayer perceptron and ReLU activation function. The combination characteristics of each representation form are then learned. By using a gated network softmax layer, different expert combination weights are generated, thereby obtaining the attention weights of different representation forms for the problem. Finally, the results of the expert network are used to more accurately predict the answer score. The specific steps in Step 4 are as follows: Step 4.1: First, integrate the problem context, the problem context node representation, and the reasoning graph. The nodes are represented by the formula shown in (9): (9) in , express Pooling; Step 4.2: Input the fused information into each expert module. Through a multilayer perceptron, continuously learn the latent knowledge of each knowledge source to obtain the output of each expert. The formula is shown in (10): (10) Where p is the number of experts; Step 4.3: Analyze the problem context, the representation of problem context nodes, and the reasoning graph. The nodes represent these three inputs, perform different aggregations, and obtain the final vector representation. , , The calculation formulas are shown in (11), (12), and (13); and are also for experts. A separate gating network was added. The softmax layer dynamically controls the contribution of the three types of input information to the predicted answer, and the calculation methods are shown in (11), (12), and (13): , (11) , (12) , (13) in, It is a weight matrix. It is the bias value. The total number of experts for this representation format; Step 4.4: Given a question q and an answer choice a, calculate the probability of the final answer choice by reasoning about the question text and the question answer options, and use the cross-entropy loss optimization model. The calculation method is shown in formula (14). The answer with the highest probability is the final question answer. (14)。 2. The expert relearning reasoning question-answering method combining gating networks according to claim 1, characterized in that, The specific steps in Step 1 are as follows: Step 1.1: The model's input consists of the complete question text and answer options. A pre-trained language model is used to preprocess the question text and answer options, adding [CLS] tags and concatenating the question text and answer options to form the question context [q; a]. This context is then processed by the encoder. Map the text input [q; a] to the question context representation. superior; Step 1.2: Match the knowledge base G with the topic entities marked in the question text and question answer options; using path lookup, find the 3-hop neighbors of each topic entity to form... .
3. The expert relearning reasoning question-answering method combining gating networks according to claim 2, characterized in that, The knowledge base used is ConceptNet.
4. The expert relearning reasoning question-answering method combining gating networks according to claim 1, characterized in that, The specific steps in Step 2 are as follows: Step 2.1: Introduce a problem context node to represent the problem context. ,Will and Represented as the knowledge graph entity set mentioned in the question; and Connect to the subject entity This forms a reasoning diagram used for answer reasoning. ; Step 2.2: First, use the pre-trained language model to analyze each subgraph node. Scoring is performed based on relevance within the QA context; for each node QA context text With KG entity text Connect them and calculate the correlation score as shown in (1): (1) Indicates calculated by LM The probability of.
5. The expert relearning reasoning question-answering method combining gating networks according to claim 4, characterized in that, The , to represent all entities that appear in the question or answer selection.
6. The expert relearning reasoning question-answering method combining gating networks according to claim 1, characterized in that, The specific steps in Step 3 are as follows: Step 3.1: Node representation is achieved using iterative message passing between neighbors in the graph, and each node is updated at each layer of the graph neural network using formula (2). The representation of : (2) in Represents a node The neighborhood, Records each neighbor node from arrive The news, and It is a attention weight that will affect each message from Extended to Then, the message is passed through a two-layer MLP. And perform batch processing and normalization; for each node Using linear transformation To set The transformation maps its initial node embedding to ; Step 3.2: Regarding information transmission and attention First, we need to obtain each node. Embedded type and from the node To the node Embedding relationship The calculation method is as follows (3): (3) |T| , Both are single-hop vectors, representing respectively and Node types and edges Relationship type; It is a linear transformation. It is a two-layer MLP; then the computation is performed from arrive The message is: (4) in It is a linear transformation; Step 3.3: Attention is used to capture the strength of the association between two nodes, ideally based on their node type, relationship, and node relevance score; first, embed each node. The correlation score is given by the formula shown in (5): (5) in It is an MLP; Step 3.4: Calculate the node from To the node attention weights The query vector was calculated. and key vector The formulas are shown in (6) and (7), and the results are obtained by querying the vector. and key vector Calculate attention weights The calculation formula is as follows (8): (6) (7) , (8) in and It is a linear transformation; it yields the updated representation of each node.