Multi-choice question and answer method based on big language model knowledge fusion

CN118569219AActive Publication Date: 2024-08-30HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)

Patent Information

Application Number
CN202410718578.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-30
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

Existing multi-choice question and answer methods do not fully utilize external knowledge and fail to effectively screen the knowledge noise in the knowledge graph, resulting in knowledge acquisition bottlenecks and limited improvement in model performance.

Method used

A large language model is used to generate thought chains and a cross-attention network model combined with path awareness is used to integrate text and map information through meta-path encoding and self-learning scoring mechanisms to improve the richness and accuracy of knowledge representation and screen effective paths.

Benefits of technology

It provides a more reliable and rich knowledge base, improves the accuracy and efficiency of multiple-choice question and answer, reduces the dependence on annotated data, and reduces the cost of updating and maintaining the knowledge base.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569219A
    Figure CN118569219A
Patent Text Reader

Abstract

The invention discloses a multi-choice question and answer method based on big language model knowledge fusion, which comprises the following steps: constructing a big language model to input question statements, and generating knowledge related to input questions and options by the big language model according to the input question statements; constructing a path-aware cross attention network model, wherein the path-aware cross attention network model comprises a text encoder, a meta path encoder, a path-aware cross attention module and a self-learning scoring module; the path-aware cross attention module fuses a second text generated by the text encoder and a third text generated by the meta-path encoder; and the self-learning scoring module selects a path useful for questions and answers through a self-learning scoring mechanism. According to the multi-choice question and answer method, thinking chain knowledge generated by a large language model and the multi-choice question and answer model based on path perception are combined, the bottleneck of knowledge acquisition is solved, and the multi-choice question and answer method is more reliable and richer in knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a multiple-choice question-answering method based on large language model knowledge fusion. Background Art

[0002] Existing work attempts to use graph neural networks combined with pre-trained language models to perform bidirectional reasoning to make up for the shortcomings of the method of simply using knowledge vectors to enhance pre-trained language models. This bidirectional reasoning method is obviously more advantageous, and can introduce the node and relationship information of the graph into the language model. At the same time, by encoding the knowledge of the language model and passing it to the graph, the graph encoder can reason based on the contextual domain knowledge. The QA-GNN proposed by Yasunaga et al. is a question-answering reasoning method based on language model and knowledge graph, which improves the reasoning ability of the model through two key innovations. The entity relevance in the knowledge graph is calculated using the language model to evaluate the importance of related nodes relative to the given context. Then, the question-answering context representation is used as a real node in the graph, and a joint graph is constructed with the extracted subgraph. The question-answering text node is connected to other nodes through different types of edges, and the message passing based on the graph convolutional network is used to update the node representation and guide the convolution process. However, this method uses a pooled text representation, which limits the total amount of information that can be transmitted in the text representation vector, making the efficiency of message passing greatly reduced. The GreaseLM proposed by Zhang et al. efficiently obtains text semantic information and graph structural information by deeply interacting the graph neural network and the pre-trained language model at multiple levels. The model includes two main structures: a unimodal language model encoding layer and a cross-modal GREASELM layer. The language model encoding layer obtains the representation of the input text, and the GREASELM layer fuses the text representation of the language model layer with the graph representation of the subgraph. The GREASELM layer effectively captures the structural information in the mind map and the semantic constraints of the language by deeply interacting the pre-trained language model and the graph neural network at multiple levels, thereby improving the model's performance in multiple-choice question-answering tasks and its ability to handle complex problems. However, their interaction method only uses a multi-layer perceptron to fuse a node between the two representations, which is too simple and cannot fully capture the modal information of each other. Qi et al. proposed a model called JointLK, which further alleviates the limitations of existing knowledge-enhanced models in multiple-choice question-answering by combining the reasoning of the language model and the knowledge graph. JointLK performs joint reasoning between the pre-trained language model and the graph neural network through a novel dense bidirectional attention module, where each question token participates in the graph node, each node in the knowledge graph participates in the question token, and the two modal representations are mutually fused and updated through multi-step interactions. In addition, JointLK proposes a dynamic pruning module to recursively prune irrelevant graph nodes by using the attention weights generated by joint reasoning.

[0003] In summary, on the one hand, the current methods in the field of multiple-choice question answering generally do not make full use of external knowledge, and do not filter or screen the knowledge noise in the introduced knowledge graph. Previous studies often used graph neural networks to encode graph models, but the graph encoder is node-centric, and this encoding method naturally ignores the large amount of relational information in the graph. On the other hand, multiple-choice question answering requires a large amount of labeled data to train the model, but this data is difficult to obtain due to restrictions such as protocols and sources, or is expensive because it requires manual labeling. Obtaining labeled data is often a time-consuming and laborious task, which leads to the existing work still using old knowledge bases that have been used for a long time. These knowledge bases have low knowledge coverage and cannot provide sufficient domain knowledge background, which makes the current model results limited. Summary of the invention

[0004] In response to the above problems, the present invention provides a multiple-choice question-answering method based on large language model knowledge fusion, aiming to solve the bottleneck problem of knowledge acquisition and provide a more reliable and knowledge-rich multiple-choice question-answering method.

[0005] The technical solution of the present invention is as follows:

[0006] A multiple-choice question answering method based on large language model knowledge fusion, the method comprising the following steps:

[0007] Constructing a large language model to input a question sentence, and based on the input question sentence, the large language model can generate knowledge related to the input question and options. For multiple options of a question, the large language model generates a thought chain to explain the relationship between the question and the options and analyze the rationality of the options;

[0008] Splicing the thought chain generated by the large language model as external knowledge to the original question-answer text for pre-knowledge fusion;

[0009] A path-aware cross-attention network model is constructed, including a text encoder, a meta-path encoder, a path-aware cross-attention module and a self-learning scoring module. The text encoder receives an input of a first text, and generates a second text through encoding by the pre-trained language model. The first text is composed of thought chains, questions and corresponding options generated by the large language model; the meta-path encoder is used to encode the path extracted from the knowledge graph and form a third text; the path-aware cross-attention module fuses the second text and the third text, transfers the relational reasoning knowledge of the meta-path in the third text to the second text, and also integrates the thought chains, questions, corresponding options and contextual background knowledge in the second text into the third text; the self-learning scoring module selects a path that is useful for question answering through a self-learning scoring mechanism.

[0010] A further technical solution of the present invention is: the meta-path encoder encodes the node as a one-hot vector, represents each node as a 1×3 one-hot vector, and represents the relationship between the nodes as a 1×R one-hot vector, where R is the number of relationships.

[0011] A further technical solution of the present invention is: the specific expression of a one-hop meta-path in the meta-path encoder is: P1 = g θ ([φ(h), r, φ(t), δ h,t ]); The specific expression of the two-hop meta-path is: P2 = g θ ([φ(h), r1, φ(v1), r2, φ(t), δ h,t ]); where (h, r, t)∈E, (h, r1, v1)∈E, (v1, r2, t)∈E, h represents the head node, r represents the relationship, t represents the tail node, E represents the edge set in the knowledge graph, r1 represents the relationship between the first head node h and the first tail node v1, r2 represents the relationship between the second head node, that is, the first tail node v1, and the second tail node t, g θ represents a multilayer perceptron, φ() represents a one-hot encoder, δ h,t =f t -f h , f h 、f t They are the feature representations of the head and tail nodes in the meta-path respectively.

[0012] A further technical solution of the present invention is: the text encoder obtains the representation of the question-answer pair according to the pre-trained language model, splices the question-option text pairs, uses the spliced ​​text as the input pre-trained language model and obtains the second text representation after encoding by the pre-trained language model.

[0013] A further technical solution of the present invention is: the pre-trained language model includes RoBERTa-Large and SapBERT-base, and the representation of the question-answer pair is specifically expressed as: R lm =f enc (text([q;a i ])), where f enc represents the output representation of the last layer of the pre-trained language model, [;] represents the concatenation of the question text and the answer text, q represents the question text, a i Represents the i-th answer text for question text q.

[0014] A further technical solution of the present invention is that the path-aware cross-attention module adds a learnable embedding representation to the text representation of the text encoder and the meta-path encoder, and the specific expression is: where e lm and e kg are all learnable embedding representations, R lm is the text representation of the text encoder, R kg Represents the textual representation of a meta path encoder.

[0015] A further technical solution of the present invention is that the path-aware cross-attention module transfers the relational reasoning knowledge of the meta-path in the third text to the second text, specifically comprising: Make a linear change, multiply by and We get three vectors representing Q respectively. lm , K lm 、V lm : and are three randomly initialized vectors;

[0016] Use Q lm As the representation of the query vector and meta-path, multi-head attention is performed to obtain the context representation Z that learns the meta-path information lm , and after a linear layer and residual connection, the final language model representation, i.e., the second text representation, is obtained. The formula is: Z lm =MultiHead(Q lm , K kg ,V kg ), Among them, FFN is a feedforward neural network, LN is layer normalization, MultiHead is a multi-head attention layer, K kg 、V kg The representation of the meta-path is The vector representation obtained by linearly transforming the key vector and the value vector.

[0017] A further technical solution of the present invention is that the path-aware cross-attention module integrates the thought chain, questions, corresponding options and contextual background knowledge in the second text into the third text, specifically including:

[0018] The representation of the meta-path Make a linear change as follows: Represent the query vector, key vector and value vector of the meta path respectively;

[0019] The meta-path representation of the context representation is learned, and the formula is expressed as: kg =MultiHead(Q kg , Klm ,V lm ), Among them, FFN is a feedforward neural network, LN is layer normalization, and MultiHead is a multi-head attention layer.

[0020] A further technical solution of the present invention is: the self-learning scoring module selects a path that is useful for question answering through a self-learning scoring mechanism, specifically including: setting a one-dimensional learnable vector, taking this vector as a query vector, taking the linear changes of the meta-path vector as keys and values ​​respectively, calculating the attention weights according to the attention mechanism, thereby realizing weighted aggregation of the meta-path and obtaining a self-learning vector representation; after the vector representation is layer normalized and residual, it is scored by a multi-layer perceptron to obtain a meta-path score.

[0021] A further technical solution of the present invention is: the self-learning scoring module scores the pre-trained language model as follows: Among them, h <cls>for The first text representation in .

[0022] The present invention proposes a multiple-choice question-answering method based on knowledge fusion of a large language model. Aiming at the problem that the domain model of multiple-choice question-answering does not make full use of the external knowledge graph and does not filter or screen the knowledge noise in the introduced knowledge graph, the present invention starts from the relational information in the graph and introduces a meta-path encoding method to model the relational path in the knowledge graph. Specifically, firstly, the relational paths from all question nodes to answer nodes in the knowledge graph are extracted, represented in the form of meta-paths, and the edges are encoded in the form of unique hot encoding. In order to make full use of the relational information of the meta-path, the present invention introduces a bidirectional cross-attention mechanism to promote the information exchange between the text encoding representation and the meta-path encoding representation, integrate the reasoning information of the relational path into the pre-trained language model, and also integrate the contextual semantic information and domain background information into the path representation. At the same time, in order to screen the noisy path, the present invention introduces a self-learning path scoring mechanism to fully screen the effective information in the path and perform weighted scoring. And the joint score of the two representations is obtained by adding the scores of the text representation and the meta-path representation. At the same time, in order to obtain knowledge more stably and accurately, the present invention combines the generation capability of a large language model with the generation technology of a large language model to address the problems of high difficulty in acquiring knowledge in the field of multiple-choice question-answering, old knowledge bases and low coverage, and makes up for the shortcomings of slow updates and high construction costs of traditional knowledge bases by utilizing the generation technology of a large language model. The present invention combines the thought chain knowledge generated by a large language model with a multiple-choice question-answering model based on path perception to construct a multiple-choice question-answering model generated based on a large language model, which is committed to solving the bottleneck problem of knowledge acquisition and providing a more reliable and rich knowledge base for research and application in the field. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a schematic diagram of knowledge generation based on a large language model in an embodiment of the present invention;

[0024] Figure 2 Schematic diagram of the cross-attention network model structure of path perception in an embodiment of the present invention;

[0025] Figure 3 is a logical diagram of a cross-attention module for path perception in an embodiment of the present invention;

[0026] Figure 4 It is a logical schematic diagram of the self-learning scoring module in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0028] It should be mentioned before discussing the exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0029] The embodiment of the present invention is directed to a multiple-choice question answering method based on large language model knowledge fusion, the method comprising the following steps:

[0030] Constructing a large language model to input a question sentence, and based on the input question sentence, the large language model can generate knowledge related to the input question and options. For multiple options of a question, the large language model generates a thought chain to explain the relationship between the question and the options and analyze the rationality of the options;

[0031] In the specific implementation process, the large language model is a natural knowledge base. The massive text data and knowledge information in various fields used in its pre-training process can be used for knowledge generation. It firmly remembers the co-occurrence relationship between words, so it can be used as an external knowledge base. In addition, the generation and reasoning capabilities of the large language model also enable it to generate problem-related knowledge under given instructions without using an additional knowledge extractor to do the extraction work. At the same time, the emergence of thought chains can encourage the large language model to simulate the reasoning process to gradually analyze and give answers.

[0032] In one embodiment, Figure 1 As shown in the figure, Zero-shot Instruction is used to encourage the model to generate reasoning processes, and the thought chain generated by the large language model is used to assist the pre-trained language model in question answering. The specific process is as follows:

[0033] First, we construct a large model input instruction statement. According to the instructions used, the large model can generate knowledge that is more relevant to the input question and options. i , using large language models to generate thought chains CoT (i) The process can be expressed as: CoT (i) =f(I,Q,c i ), where I is the input instruction and f is the large language model. For each question with multiple options, the large language model is used to generate a thought chain to explain the relationship between the question and the options and analyze the rationality of the options.

[0034] Then, the thought chain generated by the large language model is used as external knowledge to enrich the original question-answer text. Knowledge pre-fusion is performed by splicing. Specifically, it can be expressed as:

[0035] A path-aware cross-attention network model is constructed, including a text encoder, a meta-path encoder, a path-aware cross-attention module and a self-learning scoring module. The text encoder receives an input of a first text, and generates a second text through encoding by the pre-trained language model. The first text is composed of thought chains, questions and corresponding options generated by the large language model; the meta-path encoder is used to encode the path extracted from the knowledge graph and form a third text; the path-aware cross-attention module fuses the second text and the third text, transfers the relational reasoning knowledge of the meta-path in the third text to the second text, and also integrates the thought chains, questions, corresponding options and contextual background knowledge in the second text into the third text; the self-learning scoring module selects a path that is useful for question answering through a self-learning scoring mechanism.

[0036] In the specific implementation process, the overall structure model of the proposed path-aware cross-attention network model (PCN) is as follows Figure 2 As shown in the figure. The model consists of four parts, namely, text encoder, path encoder, path-aware cross-attention module and self-learning scoring module. First, the text encoder accepts text input, which is composed of thought chains, questions and corresponding options generated by the large language model. The path encoder is used to encode the path extracted from the knowledge graph. After obtaining the representations encoded by the text and path encoders, the model fuses the two knowledge representations. By using the path-aware cross-attention mechanism (PACA) proposed in this chapter, the model transfers the relational reasoning knowledge in the meta-path to the text representation, and also integrates the contextual background knowledge in the text representation into the relational path. Finally, the model selects the path that is useful for question answering through a self-learning scoring mechanism.

[0037] A general knowledge graph can be represented as a multi-relation graph: , where G = (V, R, E) is the set of all concept nodes, V represents a node, and R is the set of all relationship types. It is a set of relationship edges linking two concept nodes. E represents the edge set in the knowledge graph. A simple edge can be represented as e=(h, r, t), where h represents the head node, r represents the relationship, and t represents the tail node.

[0038] The dimension of the node encoding in the meta-path has little effect on the prediction result, but it is closely related to the number of edges in the subgraph. The prediction accuracy of the model does not change much when the dimension of the node encoding in the subgraph is reduced; but as the number of edges in the subgraph decreases, the prediction accuracy of the model will decrease significantly. The present invention encodes the node as a one-hot vector. Since there are only three types of nodes: Q kg 、a kg 、e kg , Q kg Indicates the problem node, a kg represents the answer node, e kg In order to distinguish the node types, each node is represented as a 1×3 one-hot vector, and the relationship is also represented as a 1×R one-hot vector, where R is the number of relationships. Thus, it is easy to get the path representation. For a one-hop meta-path, it is represented as: P1=g θ ([φ(h), r, φ(t), δ h,t ]) where (h, r, t)∈E, a one-hop path can capture a more direct relationship, and a two-hop meta-path can capture a more distant relationship. The two-hop path is extracted and represented as: P2=g θ ([φ(h), r1, φ(v1), r2, φ(t), δ h,t ]), where (h, r, t)∈E, (h, r1, v1)∈E, (v1, r2, t)∈E, h represents the head node, r represents the relationship, t represents the tail node, E represents the edge set in the knowledge graph, r1 represents the relationship between the first head node h and the first tail node v1, r2 represents the relationship between the second head node, that is, the first tail node v1, and the second tail node t, g θ represents a multilayer perceptron, φ() represents a one-hot encoder, φ(h) represents a one-hot encoder for h, δ h,t =f t -f h , f h 、f t They are the feature representations of the head and tail nodes in the meta-path respectively.

[0039] During the training process, the model uses a random discarding method to prevent the model from overfitting the meta-paths in the training data. Specifically, during the training phase, the model randomly discards a portion of the meta-paths at a certain ratio θ. The meta-paths used for training can be expressed as: Drop represents a random drop function, which drops paths in a certain proportion from multiple paths, similar to dropout.

[0040] The text encoder obtains a representation of the question-answer pair according to the pre-trained language model, concatenates the question-option text pairs, uses the concatenated text as input to the pre-trained language model, and obtains a second text representation through encoding by the pre-trained language model.

[0041] Specifically, after obtaining the representation of the meta-path, this representation is information from the knowledge graph space. It is also necessary to obtain the representation of the question-answer pair based on the pre-trained language model. The embodiment concatenates the question-option text pairs, and uses the concatenated text as input to obtain the text representation through encoding of the pre-trained language model. Specific embodiment In order to obtain the domain text representation of the question-answer pairs of these two data sets, two pre-trained language models are introduced: RoBERTa-Large and SapBERT-base. By concatenating the thought chain generated by the large language model with the question-answer pair and inputting it into the pre-trained language model, the representation of the question-answer pair is obtained, which can be expressed as: R lm =f enc (text([q;a i ])), where f enc It represents the output representation of the last layer of the pre-trained language model, [;] represents the concatenation of the question text and the answer text, and q represents the question text.

[0042] By integrating the knowledge of the meta-path and the question-answer text, more accurate answers can be provided based on the contextual semantic information provided by the pre-trained language model and the inference knowledge provided by the meta-path. However, different data sources have different data formats and data quality, and need to be converted and standardized before they can be integrated. In addition, since different data sources may provide different answers, it is easy to cause contradictions and conflicts. Therefore, how to integrate the answers from different data sources is also a problem to be solved.

[0043] In order to distinguish the datasets from the two sources, the text representations of the two encoders are added with learnable embedding representations: where e lm and e kg are all learnable embedding representations, R lm is the text representation of the text encoder, R kg Text representation of the meta-path encoder. By adding this learnable type representation, the model can ensure that the modal source information is preserved in the feature vector during subsequent interactions.

[0044] In order to fully combine the reasoning information and context information, a path-aware self-attention mechanism is proposed, so that the text representation output by the pre-trained language model obtains the meta-path prior representation with reasoning logic and the relationship information between entities; on the other hand, the meta-path representation is also encoded according to the content of the text representation, thereby enhancing the meta-path information. The details of the structure are as follows Figure 3 As shown:

[0045] The path-aware cross-attention module transfers the relational reasoning knowledge of the meta-path in the third text to the second text. Specifically, the representation of the pre-trained language model Make a linear change, multiply and We get three vectors representing Q respectively. lm , K lm 、V lm ,

[0046] The path-aware cross-attention module integrates the thought chain, questions, corresponding options and contextual background knowledge in the second text into the third text. Specifically, the representation of the meta-path can be For linear changes, the formula is as follows:

[0047] Next, use Q lm As the query vector, we perform multi-head attention on the representation of the meta-path to obtain the context representation Z that has learned the meta-path information. lm , and after a linear layer and residual connection, the final language model representation, i.e., the second text representation, is obtained. The formula is: Z lm =MultiHead(Q lm , K kg ,V kg ), Among them, FFN is a feed-forward neural network and LN is layer normalization.

[0048] In the same way, the path-aware cross-attention module integrates the thought chain, questions, corresponding options and contextual background knowledge in the second text into the third text, and obtains the meta-path representation that learns the context representation, which is expressed as: Z kg =MultiHead(Q kg , K lm ,V lm ), Among them, FFN is a feedforward neural network, LN is layer normalization, and MultiHead is a multi-head attention layer.

[0049] The self-learning scoring module selects paths that are useful for question answering through a self-learning scoring mechanism, which specifically includes: setting a one-dimensional learnable vector, taking this vector as the query vector, taking the linear changes of the meta-path vector as the key and value respectively, and calculating the attention weight according to the attention mechanism, thereby realizing weighted aggregation of the meta-path and obtaining a self-learned vector representation; after layer normalization and residual, the vector representation is scored by a multi-layer perceptron to obtain a meta-path score.

[0050] Specifically, the meta-path related to the question can reflect the reasoning process of the model and improve the interpretability of the question and answer. However, not all extracted meta-paths contain valid reasoning information. Some meta-paths may contain reasoning information that is irrelevant to the question, and others may even have a negative impact on reasoning. Therefore, the model needs to analyze the validity of the path and extract valid meta-path information. The embodiment proposes a self-learning scoring method to dynamically select and score paths. Specifically, a one-dimensional learnable vector is set, and this vector is used as the query vector. The linear changes of the meta-path vector are used as the key and value, respectively. The attention weights are calculated according to the attention mechanism, thereby achieving weighted aggregation of the meta-path. The specific structure is as follows: Figure 4 Shown: Q L =E L W Q ; Where E L , W Q , W K , W V Both are vectors used for linear changes.

[0051] like Figure 4 As shown, Q L , K L 、V L They are query vector, key vector and value vector respectively. Then use Q L as the query vector and K L Calculate the multi-head attention to get the query weight, and add the weight to V L Perform weighted summation to obtain the self-learning vector representation Z' kg , Z' kg =MHA(Q L ,K L ,V L ), MHA() represents the multi-head attention mechanism, and finally, after layer normalization and residual connection, the final score of the meta-path is obtained, and the score is scored by the multi-layer perceptron. Residual connection and normalization help alleviate the gradient vanishing problem in deep networks, making it easier for gradients to propagate to earlier layers, and can also help accelerate the convergence process of the model.

[0052] MLP() stands for Multi-Layer Perceptron, i.e. multiple linear transformations.

[0053] For a question-option pair, the score is divided into two parts: language model score and meta-path score. The embodiment calculates the scores of these two parts respectively and adds the two scores to get the final score. After obtaining the meta-path score, the language model score is calculated as: where h <cls>for The first text representation in .

[0054] Finally, the score of a question-option pair is expressed as:

[0055] For a question-option pair, if it is correct, the final score is recorded as 1, otherwise the score is 0. During the training process, the parameters of the entire model are optimized, including the pre-trained language model and the meta-path encoder. The embodiment uses cross entropy loss to calculate the loss between the distribution predicted by the model and the correct label score:

[0056] During inference, the model first calculates the score for each question-option pair. Then take the option with the highest score among all the options as the option predicted to be true.

[0057] Based on the multiple-choice question-answering method based on large language model knowledge fusion provided by the above embodiments, the multiple-choice question-answering domain model does not make full use of the external knowledge graph, and does not filter or screen the knowledge noise in the introduced knowledge graph. The present invention starts from the relationship information in the graph and introduces a meta-path encoding method to model the relationship path in the knowledge graph. Specifically: first, the relationship path from all question nodes to answer nodes in the knowledge graph is extracted, represented in the form of a meta-path, and the edge is encoded in the form of a unique hot encoding. In order to make full use of the relationship information of the meta-path, the present invention introduces a bidirectional cross-attention mechanism to promote the information exchange between the text encoding representation and the meta-path encoding representation, integrate the reasoning information of the relationship path into the pre-trained language model, and also integrate the contextual semantic information and domain background information into the path representation. At the same time, in order to screen the noisy path, the present invention introduces a self-learning path scoring mechanism to fully screen the effective information in the path and perform weighted scoring. And the joint score of the two representations is obtained by adding the scores of the text representation and the meta-path representation. At the same time, in order to obtain knowledge more stably and accurately, the present invention combines the generation capability of a large language model with the generation technology of a large language model to address the problems of high difficulty in acquiring knowledge in the field of multiple-choice question-answering, old knowledge bases and low coverage, and makes up for the shortcomings of slow updates and high construction costs of traditional knowledge bases by utilizing the generation technology of a large language model. The present invention combines the thought chain knowledge generated by a large language model with a multiple-choice question-answering model based on path perception to construct a multiple-choice question-answering model generated based on a large language model, which is committed to solving the bottleneck problem of knowledge acquisition and providing a more reliable and rich knowledge base for research and application in the field.

[0058] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.< / cls> < / cls>

Claims

1. A multiple-choice question answering method based on large language model knowledge fusion, characterized in that: The method comprises the following steps: Constructing a large language model to input a question sentence, and based on the input question sentence, the large language model can generate knowledge related to the input question and options. For multiple options of a question, the large language model generates a thought chain to explain the relationship between the question and the options and analyze the rationality of the options; Splicing the thought chain generated by the large language model as external knowledge to the original question-answer text for pre-knowledge fusion; A path-aware cross-attention network model is constructed, including a text encoder, a meta-path encoder, a path-aware cross-attention module and a self-learning scoring module. The text encoder receives an input of a first text, and generates a second text through encoding by the pre-trained language model. The first text is composed of thought chains, questions and corresponding options generated by the large language model; the meta-path encoder is used to encode the path extracted from the knowledge graph and form a third text; the path-aware cross-attention module fuses the second text and the third text, transfers the relational reasoning knowledge of the meta-path in the third text to the second text, and also integrates the thought chains, questions, corresponding options and contextual background knowledge in the second text into the third text; the self-learning scoring module selects a path that is useful for question answering through a self-learning scoring mechanism.

2. The multiple-choice question answering method based on large language model knowledge fusion according to claim 1 is characterized in that: The meta-path encoder encodes nodes as one-hot vectors, represents each node as a 1×3 one-hot vector, and represents the relationship between nodes as a 1×R one-hot vector, where R is the number of relationships.

3. The multiple-choice question answering method based on large language model knowledge fusion according to claim 2 is characterized in that: The specific expression of a one-hop meta-path in the meta-path encoder is: P1 = g θ ([φ(h),r,φ(t),δ h,t ]); The specific expression of the two-hop meta-path is: P2 = g θ ([φ(h),r1,φ(v1),r2,φ(t),δ h,t ]); where (h, r, t)∈E, (h, r1, υ1)∈E, (υ1, r2, t)∈E, h represents the head node, r represents the relationship, t represents the tail node, E represents the edge set in the knowledge graph, r1 represents the relationship between the first head node h and the first tail node v1, r2 represents the relationship between the second head node, that is, the first tail node v1, and the second tail node t, g θ represents a multilayer perceptron, φ() represents a one-hot encoder, δ h,t =f t -t h , f h 、f t They are the feature representations of the head and tail nodes in the meta-path respectively.

4. The multiple-choice question answering method based on large language model knowledge fusion according to claim 1 is characterized in that: The text encoder obtains a representation of a question-answer pair according to a pre-trained language model, concatenates the question-option text pairs, uses the concatenated text as input to the pre-trained language model, and obtains a second text representation through encoding by the pre-trained language model.

5. The multiple-choice question answering method based on large language model knowledge fusion according to claim 4 is characterized in that: The pre-trained language models include RoBERTa-Large and SapBERT-base. The representation of the question-answer pair is specifically expressed as: lm =f enc (text([q;a i ])), where f enc represents the output representation of the last layer of the pre-trained language model, [;] represents the concatenation of the question text and the answer text, q represents the question text, a i Represents the i-th answer text for question text q.

6. The multiple-choice question answering method based on large language model knowledge fusion according to claim 1 is characterized in that: The path-aware cross-attention module adds the text representation of the text encoder and the meta-path encoder with a learnable embedding representation, which is specifically expressed as: where e lm and e kg are all learnable embedding representations, R lm is the text representation of the text encoder, R kg Represents the textual representation of a meta path encoder.

7. The missing mode generation method based on the diffusion model according to claim 6 is characterized in that: The path-aware cross-attention module transfers the relational reasoning knowledge of the meta-path in the third text to the second text, specifically comprising: Make a linear change, that is, multiply by and We get three vectors representing Q respectively. lm , K lm 、V lm : and are three randomly initialized vectors; Use Q lm As the representation of the query vector and meta-path, multi-head attention is performed to obtain the context representation Z that learns the meta-path information lm , and after a linear layer and residual connection, the final language model representation, i.e., the second text representation, is obtained. The formula is: Z lm =MultiHead(Q lm , K kg ,V kg ), Among them, FFN is a feedforward neural network, LN is layer normalization, MultiHead is a multi-head attention layer, K kg 、V kg The representation of the meta-path is The vector representation obtained by linearly transforming the key vector and the value vector.

8. The missing mode generation method based on the diffusion model according to claim 7 is characterized in that: The path-aware cross-attention module integrates the thought chain, questions, corresponding options and contextual background knowledge in the second text into the third text, specifically including: The representation of the meta-path Make a linear change as follows: Represent the query vector, key vector and value vector of the meta path respectively; The meta-path representation of the context representation is learned, and the formula is expressed as: kg =MultiHead(Q kg , K lm ,V lm ), Among them, FFN is a feedforward neural network, LN is layer normalization, and MultiHead is a multi-head attention layer.

9. The missing mode generation method based on the diffusion model according to claim 1, characterized in that: The self-learning scoring module selects a path that is useful for question answering through a self-learning scoring mechanism, which specifically includes: setting a one-dimensional learnable vector, taking this vector as a query vector, taking the linear changes of the meta-path vector as keys and values ​​respectively, calculating the attention weights according to the attention mechanism, thereby achieving weighted aggregation of the meta-path and obtaining a self-learning vector representation; after the vector representation undergoes layer normalization and residual, it is scored by a multi-layer perceptron to obtain a meta-path score.

10. The missing mode generation method based on the diffusion model according to claim 9, characterized in that: The score of the pre-trained language model by the self-learning scoring module is expressed as: Among them, h <cls>< / cls> for The first text representation in .

Citation Information

Patent Citations

  • Thinking chain reasoning method and device, equipment and storage medium

    CN117216219A

  • Question and answer method and device based on large model, electronic equipment and storage medium

    CN117312512A

  • Knowledge graph question and answer method based on sub-graph retrieval and query path ranking

    CN117786047A

  • Generation of optimized spoken language understanding model through joint training with integrated knowledge-language module

    US20220230628A1

Cited By

  • Scientific choice question automatic answering method based on large language model, medium and equipment

    CN119416743A

  • Multi-modal medical image report generation method and system based on medical thinking chain

    CN119418846A

  • Unbiased missing modal learning method based on multi-stage double diffusion network

    CN121117499A

  • Large language model structured multi-mode response method and device oriented to vertical field

    CN121168669A

  • Method and apparatus for inference of diffusion transformer networks

    WO2026076598A1