Question generation method and device based on multi-source knowledge fusion

Through the multi-source knowledge fusion question generation method, the problem of poor fluency in question generation in the existing technology is solved. By obtaining multiple knowledge sources and filtering high-quality entity type information, more fluent and accurate questioning is generated.

CN120106222AActive Publication Date: 2025-06-06SUN YAT SEN UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510250100.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-06-06
Estimated Expiration
2045-03-04

AI Technical Summary

Technical Problem

The existing question generation methods cannot effectively cover a variety of semantic information, contextual relationships and various language expressions, resulting in poor fluency of generated questions.

Method used

Using a multi-source knowledge fusion method, by obtaining input subgraphs and open source data sets, the initial entity type information and question words are generated using a pre-set large pre-trained language model, and the target entity type information is filtered through multi-layer filters to generate auxiliary knowledge, and finally the target question is generated through the information fusion module and the decoder.

Benefits of technology

Through the integration of multi-source knowledge, additional knowledge sources are obtained to enhance the content of the input subgraph, filter high-quality entity type information, and integrate subgraphs and auxiliary knowledge, which significantly improves the fluency and accuracy of generating questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120106222A_ABST
    Figure CN120106222A_ABST
Patent Text Reader

Abstract

The invention discloses a question generation method and device based on multi-source knowledge fusion. The question generation method and device are used for solving the technical problem that the fluency of generated questions is poor due to an existing question generation method. The method comprises the steps of obtaining an input sub-graph and an open source data set; a preset large pre-training language model is adopted to generate multiple pieces of initial entity type information and input sub-graph interrogative words according to the input sub-graphs, the open source data set and the multiple preset manual construction examples; screening the multiple pieces of initial entity type information through a preset multi-layer filter, and outputting multiple pieces of target entity type information; according to the multiple pieces of target entity type information and the input sub-graph interrogative words, auxiliary knowledge is generated, and a preset information fusion module is adopted to output multiple complete representations according to the auxiliary knowledge and the input sub-graphs; and inputting the plurality of complete representations into a preset decoder to generate a target question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a question generation method and device based on multi-source knowledge fusion. Background Art

[0002] In recent years, with the rapid development of knowledge graph (KG) and natural language processing technology, knowledge base question generation (KBQG) has gradually become an important research direction. KBQG aims to extract information from knowledge graphs and generate relevant questions to provide a more natural interactive experience in dialogue systems and information retrieval, and has been widely used in academia and industry.

[0003] Research on KBQG can be divided into two categories. The first category is KBQG based on structural information. It initially relied heavily on manually crafted question templates for question generation. Subsequent improvements adopted a fully data-driven end-to-end approach, using neural networks to generate token sequences of natural language questions, focusing on generating multi-hop complex questions by effectively modeling rich structures. Another type of KBQG is KBQG enhanced with external knowledge. It enhances question generation by inputting external auxiliary knowledge (such as node attributes, question words, and entity types) into the KG subgraph and designing a fusion mechanism to integrate the auxiliary knowledge with the KG subgraph.

[0004] Existing question generation methods mainly focus on a single type of knowledge base, with insufficient reference knowledge. They cannot cover rich and diverse semantic information, contextual relationships, and various possible language expressions. As a result, the model may have logical incoherence, grammatical errors, or semantic ambiguity when generating questions, resulting in poor fluency of the generated questions. Summary of the invention

[0005] The present invention provides a question generation method and device based on multi-source knowledge fusion, which are used to solve the technical problem that the fluency of generated questions is poor due to the existing question generation method.

[0006] A first aspect of the present invention provides a question generation method based on multi-source knowledge fusion, comprising:

[0007] Get input subgraphs and open source datasets;

[0008] Using a preset large-scale pre-trained language model to generate a plurality of initial entity type information and input subgraph question words according to the input subgraph, the open source data set and a plurality of preset manually constructed examples;

[0009] Filtering the plurality of initial entity type information by presetting a multi-layer filter, and outputting a plurality of target entity type information;

[0010] Generate auxiliary knowledge according to the plurality of target entity type information and the input subgraph interrogative words, and use a preset information fusion module to output a plurality of complete representations according to the auxiliary knowledge and the input subgraph;

[0011] The plurality of complete representations are input into a preset decoder to generate a target question.

[0012] Optionally, the multiple initial entity type information includes multiple first initial entity type information and multiple second initial entity type information; the using a preset large-scale pre-trained language model to generate multiple initial entity type information and input subgraph question words according to the input subgraph, the open source data set and multiple preset artificially constructed examples includes:

[0013] Performing entity linking on the input subgraph and the open source dataset to generate a plurality of first initial entity type information;

[0014] The input subgraph and the plurality of preset manually constructed examples are input into the preset large-scale pre-trained language model, and a plurality of second initial entity type information and input subgraph question words are output.

[0015] Optionally, the screening of the plurality of initial entity type information by presetting a multi-layer filter to output a plurality of target entity type information includes:

[0016] respectively embedding and generating each of the first initial entity type information and each of the second initial entity type information, and outputting a first word embedding corresponding to each of the first initial entity type information and a second word embedding corresponding to each of the second initial entity type information;

[0017] Using a preset multi-layer filter to perform multi-layer similarity score calculation based on each of the first word embeddings and each of the second word embeddings, to determine a plurality of similarity scores between each of the first word embeddings and each of the second word embeddings;

[0018] Respectively summing a plurality of similarity scores between each of the first word embeddings and each of the second word embeddings, and outputting a summed similarity score between each of the first word embeddings and each of the second word embeddings;

[0019] Comparing each of the summed similarity scores with a preset similarity score threshold;

[0020] The first initial entity type information and the second initial entity type information corresponding to any summed similarity score greater than the preset similarity score threshold are used as target entity type information.

[0021] Optionally, the preset information fusion module includes a pooling layer, a global encoder and a residual layer; the preset information fusion module is used to output multiple complete representations according to the auxiliary knowledge and the input subgraph, including:

[0022] formatting the auxiliary knowledge and the input subgraph respectively to generate a linearized subgraph and a text sequence;

[0023] Using a global encoder to generate a plurality of hidden states according to the linearized subgraph and the text sequence;

[0024] Generate multiple entity representations, multiple question word representations, and multiple entity type representations according to the multiple hidden states through a pooling layer;

[0025] Integrate the plurality of entity representations, the plurality of question word representations, and the plurality of entity type representations based on a semantic and structural attention mechanism to generate a plurality of intermediate representations;

[0026] A residual layer is used to generate multiple complete representations according to the multiple intermediate representations and the multiple hidden states.

[0027] Optionally, the training process of the preset decoder is specifically as follows:

[0028] Get the subgraphs to be trained and the open source datasets;

[0029] Using a preset large-scale pre-trained language model to generate a plurality of entity type information to be trained and subgraph question words to be trained according to the subgraph to be trained, the open source data set and a plurality of preset artificially constructed examples;

[0030] Filtering the plurality of entity type information to be trained by presetting a multi-layer filter, and outputting a plurality of target entity type information to be trained;

[0031] Generate auxiliary knowledge to be trained according to the plurality of target entity type information to be trained and the subgraph question words to be trained, and use a preset information fusion module to output a plurality of complete representations to be trained according to the auxiliary knowledge to be trained and the subgraph to be trained;

[0032] Based on a preset cross entropy loss function, a plurality of the complete representations to be trained are used to perform model training on an initial decoder to determine the trained preset decoder.

[0033] Optionally, based on a preset cross entropy loss function, using a plurality of the complete representations to be trained to perform model training on an initial decoder, and determining the trained preset decoder, comprises:

[0034] Inputting the plurality of the to-be-trained complete representations into an initial decoder to generate a to-be-trained question sentence;

[0035] Substitute the question to be trained into a preset cross entropy loss function and derive it, and output the model gradient;

[0036] Based on an adaptive moment estimation optimization algorithm, the model parameters of the initial decoder are updated using the model gradient to determine an intermediate decoder;

[0037] Using the intermediate decoder to generate an intermediate question according to the plurality of complete representations to be trained;

[0038] Using the preset cross entropy loss function to calculate the loss value according to the intermediate question, determine the target loss value, and determine whether the target loss value converges;

[0039] If so, the intermediate decoder is used as the trained preset decoder.

[0040] A second aspect of the present invention provides a question generation device based on multi-source knowledge fusion, comprising:

[0041] The acquisition module is used to obtain input subgraphs and open source datasets;

[0042] An adopting module, configured to adopt a preset large pre-trained language model to generate a plurality of initial entity type information and input subgraph question words according to the input subgraph, the open source dataset and a plurality of preset manually constructed examples;

[0043] A screening module, used for screening the plurality of initial entity type information through a preset multi-layer filter, and outputting a plurality of target entity type information;

[0044] A fusion module, used to generate auxiliary knowledge according to the plurality of target entity type information and the input subgraph interrogative words, and output a plurality of complete representations according to the auxiliary knowledge and the input subgraph using a preset information fusion module;

[0045] The generating module is used to input the plurality of the complete representations into a preset decoder to generate a target question.

[0046] A third aspect of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the question generation method based on multi-source knowledge fusion as described in any one of the above items.

[0047] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the steps of the method for generating a question based on multi-source knowledge fusion as described in any one of the above.

[0048] A fifth aspect of the present invention provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, wherein when the program instructions are executed by a computer, the computer executes the steps of the question generation method based on multi-source knowledge fusion as described in any one of the above items.

[0049] It can be seen from the above technical solutions that the present invention has the following advantages:

[0050] The above technical solution of the present invention provides a question generation method based on multi-source knowledge fusion, first, obtaining an input subgraph and an open source data set; then, using a preset large-scale pre-trained language model to generate multiple initial entity type information and input subgraph question words according to the input subgraph, the open source data set and multiple preset artificial construction examples; filtering the multiple initial entity type information through a preset multi-layer filter, outputting multiple target entity type information; generating auxiliary knowledge according to the multiple target entity type information and the input subgraph question words, and using a preset information fusion module to output multiple complete question words according to the auxiliary knowledge and the input subgraph. preparation representation; finally, inputting the multiple complete representations into a preset decoder to generate a target question; based on the above scheme, based on an open source database and a preset large pre-trained language model, processing the input subgraph to obtain multiple initial entity type information and input subgraph question words, and combining a preset multi-layer filter, a preset information fusion module and a preset decoder to generate a target question according to the target entity type information, the input subgraph question words and the input subgraph, the present invention obtains additional knowledge from different knowledge sources, including an open source database and a preset large pre-trained language model, thereby enhancing the content of the input subgraph, thereby improving the fluency of the generated question. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0052] Figure 1 A flowchart of a method for generating a question based on multi-source knowledge fusion provided in the first embodiment of the present invention;

[0053] Figure 2 The overall framework diagram of the question generation method based on multi-source knowledge fusion provided in the first embodiment of the present invention;

[0054] Figure 3A flowchart of the steps of the training process of the preset decoder provided in the second embodiment of the present invention;

[0055] Figure 4 This is a structural block diagram of a question generation device based on multi-source knowledge fusion provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0056] The embodiment of the present invention provides a question generation method and device based on multi-source knowledge fusion, which are used to solve the technical problem that the fluency of generated questions is poor due to the existing question generation method.

[0057] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] See also Figure 1 , Figure 1 A flowchart of the steps of a question generation method based on multi-source knowledge fusion provided in Example 1 of the present invention.

[0059] The present invention provides a question generation method based on multi-source knowledge fusion, comprising:

[0060] Step 101: Obtain an input subgraph and an open source dataset.

[0061] The open source dataset is the open source dataset DBpedia.

[0062] Step 102: Use a preset large-scale pre-trained language model to generate multiple initial entity type information and input subgraph question words according to the input subgraph, an open source data set, and multiple preset manually constructed examples.

[0063] The multiple initial entity type information includes multiple first initial entity type information and multiple second initial entity type information.

[0064] Specifically, step 102 may include the following sub-steps S21-S22:

[0065] Step S21, performing entity linking on the input subgraph and the open source dataset to generate a plurality of first initial entity type information;

[0066] Step S22: input the input subgraph and multiple preset artificially constructed examples into a preset large-scale pre-trained language model, and output multiple second initial entity type information and input subgraph question words.

[0067] The preset large pre-trained language model is the large pre-trained language model LLaMA3 (Large Language ModelMeta AI 3).

[0068] The plurality of preset artificially constructed examples are a plurality of artificially constructed examples.

[0069] It should be noted that the present invention needs to perform knowledge enhancement on the entities in the input subgraph G. Specifically, the knowledge sources are the open source dataset DBpedia and the large pre-trained language model LLaMA3. The entities in the input subgraph G are linked to DBpedia, their entity types are queried, and the entity type T is formed. 1 ={t 1 ,...,t v ,...,t γ Then, multiple examples are constructed manually. LLaMA3 predicts entity types based on contextual learning and analysis of examples to form entity types T 2 ={t 1 ,...,t u ,...,t μ}, i.e., multiple second initial entity type information, and predict the interrogative word I (input subgraph interrogative word) of the input subgraph G.

[0070] Step 103: Filter multiple initial entity type information through preset multi-layer filters, and output multiple target entity type information.

[0071] Specifically, step 103 may include the following sub-steps S31-S35:

[0072] Step S31, respectively embedding and generating each first initial entity type information and each second initial entity type information, and outputting a first word embedding corresponding to each first initial entity type information and a second word embedding corresponding to each second initial entity type information;

[0073] Step S32: using a preset multi-layer filter to perform multi-layer similarity score calculation based on each first word embedding and each second word embedding, to determine multiple similarity scores between each first word embedding and each second word embedding;

[0074] Step S33, summing up the multiple similarity scores between each first word embedding and each second word embedding, and outputting the summed similarity score between each first word embedding and each second word embedding;

[0075] Step S34, comparing each summed similarity score with a preset similarity score threshold;

[0076] Step S35: taking any first initial entity type information or second initial entity type information corresponding to a summed similarity score greater than a preset similarity score threshold as target entity type information.

[0077] It should be noted that the present invention uses a multi-layer filter with N layers based on similarity to obtain 1 and T 2 Specifically, we first use the Glove model to obtain t v With t u That is, each first initial entity type information and each second initial entity type information are embedded and generated, and after obtaining the corresponding first word embedding and second word embedding, they are used as the input representation of the multi-layer filter.

[0078] Furthermore, the word embedding is input into a similarity-based multi-layer filter (pre-set multi-layer filter) to obtain the output vector of the kth layer, which is recorded as and , and then calculate the similarity score between them :

[0079] ;

[0080] in, for and The similarity score between The first word corresponding to the v-th first initial entity type information is embedded in the output vector of the k-th layer; The output vector of the second word embedding at the kth layer corresponding to the uth second initial entity type information; For element-level intersection, take the minimum value of the corresponding position; For the element set union, take the maximum value of the corresponding position; Modulo calculation.

[0081] Furthermore, the similarity scores of the k layers are combined to obtain the final similarity score (sum similarity score):

[0082] ;

[0083] in, for and The summed similarity score between ; is the weight parameter of the kth layer, satisfying ; N is the total number of layers of the preset multi-layer filter; for and The similarity score between .

[0084] Furthermore, it is rare that entity types from different sources are simultaneously incorrect, and therefore, high similarity scores between them can confirm each other's high quality, i.e., higher similarity scores indicate more accurate type information.

[0085] Exemplarily, assuming that the number of first initial entity type information is 3, the number of second initial entity type information is 3, and the number of layers of the preset multi-layer filter is 3, there will be 3*3=9 combinations for calculating the similarity scores, and each combination corresponds to three similarity scores. Then, the three similarity scores corresponding to the 9 combinations are summed up respectively, and the summed similarity scores corresponding to the 9 combinations are output.

[0086] Furthermore, the entity type components whose summed similarity scores are higher than the threshold (i.e., the first initial entity type information and the second initial entity type information corresponding to the summed similarity scores) are retained. When no entity type meets the requirements, "None" is assigned to the entity as the entity type. Finally, the entity type T (i.e., multiple target entity type information) and the subgraph question word I form the auxiliary knowledge K of the subgraph.

[0087] Step 104: Generate auxiliary knowledge based on multiple target entity type information and input subgraph question words, and use a preset information fusion module to output multiple complete representations based on the auxiliary knowledge and the input subgraph.

[0088] The preset information fusion module includes a pooling layer, a global encoder and a residual layer.

[0089] Specifically, step 104 may include the following sub-steps S41-S45:

[0090] Step S41, formatting the auxiliary knowledge and the input subgraph respectively to generate a linearized subgraph and a text sequence;

[0091] Step S42: using a global encoder to generate multiple hidden states according to the linearized subgraph and the text sequence;

[0092] Step S43: Generate multiple entity representations, multiple question word representations, and multiple entity type representations according to multiple hidden states through a pooling layer;

[0093] Step S44: Integrate multiple entity representations, multiple question word representations, and multiple entity type representations based on a semantic and structural attention mechanism to generate multiple intermediate representations;

[0094] Step S45: Use a residual layer to generate multiple complete representations based on multiple intermediate representations and multiple hidden states.

[0095] It should be noted that the present invention utilizes a preset information fusion module in the Transformer to establish semantic associations between subgraphs and auxiliary knowledge through a global encoder, a pooling layer, and a semantic and structure-based attention mechanism, thereby obtaining an information-complete representation; wherein the global encoder captures the global semantic information of the input subgraph.

[0096] Specifically, the input subgraph is formatted with auxiliary knowledge to obtain a linearized subgraph (linearized subgraph). The linearized subgraph and the corresponding text sequence X are input into the global encoder to obtain the hidden state of the lth layer:

[0097] ;

[0098] ;

[0099] ;

[0100] in, is the attention score of the i-th token and the j-th token at the l-th layer; is the hidden state of the i-th token at the l-1 layer; is the trainable parameter corresponding to the query matrix; is the trainable parameter corresponding to the key matrix; is the dimension of the query / key / value vector; m is the length of the linearized subgraph; n is the length of the text sequence; is the normalized attention score; j is the traversal sequence number; is the trainable parameter corresponding to the value matrix; is the hidden state of the i-th token at the l-th layer.

[0101] Furthermore, the hidden state of the lth layer Through the pooling layer, the corresponding entity representation is obtained , Relationship Representation , entity type representation , question words Among them, the entity representation is obtained as follows:

[0102] ;

[0103] in, For Entity The neighbor entity set of For Entity The hidden state at layer l; is the number of entities in the subgraph; pooling is the pooling layer; For Entity Entity representation at level l.

[0104] It is worth mentioning that the acquisition method of other representations is consistent with the acquisition method of the entity representation, and the present invention will not go into details.

[0105] Furthermore, the various representations are integrated using semantic and structural attention mechanisms, and then combined using residual layers to generate a complete representation for subsequent calculations:

[0106] ;

[0107] ;

[0108] ;

[0109] in, For Entity The attention score of the complementary semantics at layer l; For Entity Entity representation at level l; , , , , is a trainable parameter; For Entity Interrogative word representation at level l; For Entity Entity type representation at level l; is the dimension of the query / key / value vector; For Entity Supplementary semantic representation at layer l; For Entity The complete representation obtained at layer l.

[0110] Step 105: Input multiple complete representations into a preset decoder to generate a target question.

[0111] It should be noted that the present invention uses a BART-base decoder (Bidirectional and Auto-Regressive Transformers base decoder) to generate questions (target questions) according to multiple complete representations.

[0112] As a comparison of technical effects, we can refer to existing technologies. In recent years, with the rapid development of knowledge graphs (KG) and natural language processing technologies, knowledge base question and answer generation (KBQG) has gradually become an important research direction. KBQG aims to extract information from knowledge graphs and generate relevant questions to provide a more natural interactive experience in dialogue systems and information retrieval, and has been widely used in academia and industry.

[0113] Research on KBQG can be divided into two categories. The first category is KBQG based on structural information. It initially relied heavily on manually crafted question templates for question generation. Subsequent improvements adopted a fully data-driven end-to-end approach, using neural networks to generate token sequences of natural language questions, focusing on generating multi-hop complex questions by effectively modeling rich structures. Another type of KBQG is KBQG enhanced with external knowledge. It enhances question generation by inputting external auxiliary knowledge (such as node attributes, question words, and entity types) into the KG subgraph and designing a fusion mechanism to integrate the auxiliary knowledge with the KG subgraph.

[0114] Although KBQG has achieved certain research results, existing methods still face two major challenges: First, the limited sources of knowledge. Existing work fails to utilize diverse information sources or properly filter information, resulting in limited knowledge and poor fluency in generated questions. Second, the fusion of auxiliary knowledge is insufficient. Existing work lacks sufficient fusion modules to integrate auxiliary knowledge with subgraphs, resulting in semantic deviation between the generated results and subgraphs. Therefore, how to effectively integrate auxiliary knowledge from different sources to improve the quality of question and answer generation has become an urgent problem to be solved.

[0115] For the above questions, please refer to Figure 2 , the present invention proposes a question generation method based on multi-source knowledge fusion, and its overall framework is divided into three parts: knowledge enhancement, multi-layer filter, and information fusion module; the knowledge enhancement method, its core idea is to obtain additional knowledge from different sources, including open source databases and large language models, so as to enhance the content of the input subgraph. The multi-layer filter evaluates and selects auxiliary knowledge based on similarity to obtain high-quality information. The information fusion module aims to integrate auxiliary knowledge into the subgraph representation and provide the model with complete information input, so as to achieve accurate question generation. Through multi-source knowledge enhancement, the present invention can provide more comprehensive and real-time additional knowledge for the subgraph; the proposed multi-layer filter compares similarities from multiple fine-grained levels to better screen out accurate supplementary information; the proposed information fusion module fuses the subgraph and auxiliary knowledge from both semantic and structural aspects to better parse the potential information of the subgraph, thereby improving the fluency and accuracy of generated questions.

[0116] In summary, the present invention uses multi-layer filters to filter knowledge from different sources, thereby obtaining auxiliary knowledge with high relevance at multiple granularities; through a semantic and structural information fusion module, the input subgraph and auxiliary knowledge are effectively integrated to obtain a complete input representation, thereby significantly improving the quality of question-answer generation. The experimental results of the present invention on multiple data sets exceed those of multiple baseline models, verifying its effectiveness and generalization, and providing a reference for future research.

[0117] In an embodiment of the present invention, the present invention provides a question generation method based on multi-source knowledge fusion, first, obtaining an input subgraph and an open source data set; then, using a preset large-scale pre-trained language model to generate multiple initial entity type information and input subgraph question words according to the input subgraph, the open source data set and multiple preset artificial construction examples; filtering the multiple initial entity type information through a preset multi-layer filter, outputting multiple target entity type information; generating auxiliary knowledge according to the multiple target entity type information and the input subgraph question words, and using a preset information fusion module to output multiple complete representations according to the auxiliary knowledge and the input subgraph; and finally After that, multiple complete representations are input into a preset decoder to generate a target question; based on the above scheme, based on an open source database and a preset large pre-trained language model, the input subgraph is processed to obtain multiple initial entity type information and input subgraph question words, and a preset multi-layer filter, a preset information fusion module and a preset decoder are combined to generate a target question according to the target entity type information, the input subgraph question words and the input subgraph. The present invention obtains additional knowledge from different knowledge sources, including an open source database and a preset large pre-trained language model, thereby enhancing the content of the input subgraph, thereby improving the fluency of the generated question.

[0118] For better explanation, refer to Figure 3 , shows a flowchart of the steps of the training process of the preset decoder provided in the second embodiment of the present invention, and the process may include the following steps:

[0119] Step 301: Obtain a subgraph to be trained and an open source dataset.

[0120] Step 302: Use a preset large-scale pre-trained language model to generate multiple entity type information to be trained and subgraph question words to be trained according to the subgraph to be trained, an open source data set and multiple preset artificially constructed examples.

[0121] Step 303: Filter multiple entity type information to be trained through a preset multi-layer filter, and output multiple target entity type information to be trained.

[0122] Step 304: Generate auxiliary knowledge to be trained based on multiple target entity type information to be trained and subgraph question words to be trained, and use a preset information fusion module to output multiple complete representations to be trained based on the auxiliary knowledge to be trained and the subgraphs to be trained.

[0123] Step 305: Based on a preset cross entropy loss function, a plurality of complete representations to be trained are used to perform model training on the initial decoder to determine a trained preset decoder.

[0124] Specifically, step 305 may include the following sub-step S351:

[0125] Step S351, inputting a plurality of complete representations to be trained into an initial decoder to generate a question sentence to be trained;

[0126] Step S352: Substitute the question to be trained into the preset cross entropy loss function and derive it, and output the model gradient;

[0127] Step S353: Based on the adaptive moment estimation optimization algorithm, the model parameters of the initial decoder are updated using the model gradient to determine the intermediate decoder;

[0128] Step S354: using an intermediate decoder to generate an intermediate question sentence according to a plurality of complete representations to be trained;

[0129] Step S355: Use a preset cross entropy loss function to calculate the loss value according to the intermediate question, determine the target loss value, and determine whether the target loss value converges;

[0130] Step S356: If yes, use the intermediate decoder as the trained preset decoder.

[0131] It should be noted that the present invention uses an untrained BART-base decoder to generate problems, and substitutes the preset cross entropy loss function for derivation to obtain the model gradient, wherein the preset cross entropy loss function is specifically:

[0132] ;

[0133] Where L is the target loss value; is the conditional probability; is the word generated at time step t; is the word generated before time step t; For Entity The complete representation obtained at the Lth layer; X is the length of the generated question (the question to be trained).

[0134] Furthermore, the cross entropy loss function is minimized by the Adam optimization algorithm (adaptive moment estimation optimization algorithm), and the model parameters of the decoder are updated at the same time, and finally the trained decoder is used to generate the subgraph-related question X. Specifically, based on the adaptive moment estimation optimization algorithm, the model parameters of the initial decoder are updated using the model gradient to determine the intermediate decoder; then, the intermediate decoder and the preset cross entropy loss function are combined, and the target loss value is calculated according to multiple complete representations to be trained to determine whether it converges. If the target loss value does not converge, the intermediate decoder is used as the new initial decoder, and the execution of step 305 is jumped until the target loss value converges, and the intermediate decoder determined when the target loss value converges is used as the trained preset decoder.

[0135] In the embodiment of the present invention, the present invention uses a multi-layer filter to filter knowledge from different sources, thereby obtaining auxiliary knowledge with high relevance at multiple granularities; through a semantic and structural information fusion module, the input subgraph and auxiliary knowledge are effectively integrated to obtain a complete input representation, and the model training of the preset decoder is completed in combination with a preset cross entropy loss function, which can significantly improve the quality of question and answer generation. The experimental results of the present invention on multiple data sets exceed multiple baseline models, verifying its effectiveness and generalization, and providing reference for future research.

[0136] See also Figure 4 , Figure 4 This is a structural block diagram of a question generation device based on multi-source knowledge fusion provided in Embodiment 3 of the present invention.

[0137] The present invention provides a question generation device based on multi-source knowledge fusion, comprising:

[0138] An acquisition module 401 is used to acquire an input subgraph and an open source data set;

[0139] Adopting module 402, for using a preset large-scale pre-trained language model to generate a plurality of initial entity type information and input subgraph question words according to an input subgraph, an open source data set and a plurality of preset manually constructed examples;

[0140] A screening module 403 is used to screen multiple initial entity type information through a preset multi-layer filter and output multiple target entity type information;

[0141] A fusion module 404 is used to generate auxiliary knowledge according to multiple target entity type information and input subgraph question words, and output multiple complete representations according to the auxiliary knowledge and the input subgraph using a preset information fusion module;

[0142] The generating module 405 is used to input the multiple complete representations into the preset decoder to generate the target question.

[0143] Further, the multiple initial entity type information includes multiple first initial entity type information and multiple second initial entity type information; module 402 is used to:

[0144] Performing entity linking on the input subgraph and the open source dataset to generate a plurality of first initial entity type information;

[0145] The input subgraph and a plurality of preset manually constructed examples are input into a preset large-scale pre-trained language model, and a plurality of second initial entity type information and input subgraph question words are output.

[0146] Furthermore, the screening module 403 is specifically used for:

[0147] Embedding each first initial entity type information and each second initial entity type information is generated respectively, and outputting a first word embedding corresponding to each first initial entity type information and a second word embedding corresponding to each second initial entity type information;

[0148] Using a preset multi-layer filter to perform multi-layer similarity score calculation based on each first word embedding and each second word embedding, to determine a plurality of similarity scores between each first word embedding and each second word embedding;

[0149] Respectively summing a plurality of similarity scores between each first word embedding and each second word embedding, and outputting a summed similarity score between each first word embedding and each second word embedding;

[0150] Compare each summed similarity score with a preset similarity score threshold;

[0151] The first initial entity type information and the second initial entity type information corresponding to any summed similarity score greater than a preset similarity score threshold are used as target entity type information.

[0152] Furthermore, the preset information fusion module includes a pooling layer, a global encoder and a residual layer; the fusion module 404 is specifically used for:

[0153] Format the auxiliary knowledge and input subgraphs respectively to generate linearized subgraphs and text sequences;

[0154] A global encoder is used to generate multiple hidden states based on the linearized subgraph and text sequence;

[0155] Through the pooling layer, multiple entity representations, multiple question word representations, and multiple entity type representations are generated according to multiple hidden states;

[0156] Based on semantic and structural attention mechanisms, multiple entity representations, multiple question word representations, and multiple entity type representations are integrated to generate multiple intermediate representations.

[0157] A residual layer is used to generate multiple complete representations based on multiple intermediate representations and multiple hidden states.

[0158] In an optional device embodiment, it also includes:

[0159] The first module is used to obtain the subgraph to be trained and the open source dataset;

[0160] The second module is used to generate a plurality of entity type information to be trained and subgraph question words to be trained according to the subgraph to be trained, an open source data set and a plurality of preset manually constructed examples by using a preset large pre-trained language model;

[0161] The third module is used to filter multiple entity type information to be trained through a preset multi-layer filter, and output multiple target entity type information to be trained;

[0162] The fourth module is used to generate auxiliary knowledge to be trained according to multiple target entity type information to be trained and question words of subgraphs to be trained, and use a preset information fusion module to output multiple complete representations to be trained according to the auxiliary knowledge to be trained and the subgraphs to be trained;

[0163] The fifth module is used to perform model training on the initial decoder based on a preset cross entropy loss function using multiple complete representations to be trained, and determine a trained preset decoder.

[0164] Furthermore, the fifth module is specifically used for:

[0165] Inputting multiple complete representations to be trained into the initial decoder to generate questions to be trained;

[0166] Substitute the question to be trained into the preset cross entropy loss function and derive it, and output the model gradient;

[0167] Based on the adaptive moment estimation optimization algorithm, the model parameters of the initial decoder are updated using the model gradient to determine the intermediate decoder;

[0168] An intermediate decoder is used to generate an intermediate question according to multiple complete representations to be trained;

[0169] Use the preset cross entropy loss function to calculate the loss value according to the intermediate question, determine the target loss value, and judge whether the target loss value converges;

[0170] If so, the intermediate decoder is used as the trained preset decoder.

[0171] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0172] An embodiment of the present invention further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory; when the computer program is executed by the processor, the processor executes the steps of the question generation method based on multi-source knowledge fusion as described in the first embodiment above.

[0173] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the question generation method based on multi-source knowledge fusion as described in the first embodiment above are implemented.

[0174] The embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the question generation method based on multi-source knowledge fusion as described in the first embodiment when the computer program / instruction is executed by a processor.

[0175] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0176] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0177] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question generation method based on multi-source knowledge fusion, characterized in that: include: Get input subgraphs and open source datasets; Using a preset large-scale pre-trained language model to generate a plurality of initial entity type information and input subgraph question words according to the input subgraph, the open source data set and a plurality of preset manually constructed examples; Filtering the plurality of initial entity type information by presetting a multi-layer filter, and outputting a plurality of target entity type information; Generate auxiliary knowledge according to the plurality of target entity type information and the input subgraph interrogative words, and use a preset information fusion module to output a plurality of complete representations according to the auxiliary knowledge and the input subgraph; The plurality of complete representations are input into a preset decoder to generate a target question.

2. The question generation method based on multi-source knowledge fusion according to claim 1 is characterized in that: The multiple initial entity type information includes multiple first initial entity type information and multiple second initial entity type information; the using a preset large pre-trained language model to generate multiple initial entity type information and input subgraph question words according to the input subgraph, the open source data set and multiple preset artificially constructed examples includes: Performing entity linking on the input subgraph and the open source dataset to generate a plurality of first initial entity type information; The input subgraph and the plurality of preset manually constructed examples are input into the preset large-scale pre-trained language model, and a plurality of second initial entity type information and input subgraph question words are output.

3. The question generation method based on multi-source knowledge fusion according to claim 2 is characterized in that: The method of screening the plurality of initial entity type information by presetting a multi-layer filter and outputting a plurality of target entity type information comprises: respectively embedding and generating each of the first initial entity type information and each of the second initial entity type information, and outputting a first word embedding corresponding to each of the first initial entity type information and a second word embedding corresponding to each of the second initial entity type information; Using a preset multi-layer filter to perform multi-layer similarity score calculation based on each of the first word embeddings and each of the second word embeddings, to determine a plurality of similarity scores between each of the first word embeddings and each of the second word embeddings; Respectively summing a plurality of similarity scores between each of the first word embeddings and each of the second word embeddings, and outputting a summed similarity score between each of the first word embeddings and each of the second word embeddings; Comparing each of the summed similarity scores with a preset similarity score threshold; The first initial entity type information and the second initial entity type information corresponding to any summed similarity score greater than the preset similarity score threshold are used as target entity type information.

4. The question generation method based on multi-source knowledge fusion according to claim 1 is characterized in that: The preset information fusion module includes a pooling layer, a global encoder and a residual layer; the preset information fusion module outputs multiple complete representations according to the auxiliary knowledge and the input subgraph, including: formatting the auxiliary knowledge and the input subgraph respectively to generate a linearized subgraph and a text sequence; Using a global encoder to generate a plurality of hidden states according to the linearized subgraph and the text sequence; Generate multiple entity representations, multiple question word representations, and multiple entity type representations according to the multiple hidden states through a pooling layer; Integrate the plurality of entity representations, the plurality of question word representations, and the plurality of entity type representations based on a semantic and structural attention mechanism to generate a plurality of intermediate representations; A residual layer is used to generate multiple complete representations according to the multiple intermediate representations and the multiple hidden states.

5. The question generation method based on multi-source knowledge fusion according to claim 1 is characterized in that: The training process of the preset decoder is specifically as follows: Get the subgraphs to be trained and the open source datasets; Using a preset large-scale pre-trained language model to generate a plurality of entity type information to be trained and subgraph question words to be trained according to the subgraph to be trained, the open source data set and a plurality of preset artificially constructed examples; Filtering the plurality of entity type information to be trained by presetting a multi-layer filter, and outputting a plurality of target entity type information to be trained; Generate auxiliary knowledge to be trained according to the plurality of target entity type information to be trained and the subgraph question words to be trained, and use a preset information fusion module to output a plurality of complete representations to be trained according to the auxiliary knowledge to be trained and the subgraph to be trained; Based on a preset cross entropy loss function, a plurality of the complete representations to be trained are used to perform model training on an initial decoder to determine the trained preset decoder.

6. The question generation method based on multi-source knowledge fusion according to claim 5 is characterized in that: The method of performing model training on an initial decoder based on a preset cross entropy loss function using a plurality of the complete representations to be trained, and determining the trained preset decoder, comprises: Inputting the plurality of the to-be-trained complete representations into an initial decoder to generate a to-be-trained question sentence; Substitute the question to be trained into a preset cross entropy loss function and derive it, and output the model gradient; Based on an adaptive moment estimation optimization algorithm, the model parameters of the initial decoder are updated using the model gradient to determine an intermediate decoder; Using the intermediate decoder to generate an intermediate question according to the plurality of complete representations to be trained; Using the preset cross entropy loss function to calculate the loss value according to the intermediate question, determine the target loss value, and determine whether the target loss value converges; If so, the intermediate decoder is used as the trained preset decoder.

7. A question generation device based on multi-source knowledge fusion, characterized in that: include: The acquisition module is used to obtain input subgraphs and open source datasets; An adopting module, configured to adopt a preset large pre-trained language model to generate a plurality of initial entity type information and input subgraph question words according to the input subgraph, the open source dataset and a plurality of preset manually constructed examples; A screening module, used for screening the plurality of initial entity type information through a preset multi-layer filter, and outputting a plurality of target entity type information; A fusion module, used to generate auxiliary knowledge according to the plurality of target entity type information and the input subgraph interrogative words, and output a plurality of complete representations according to the auxiliary knowledge and the input subgraph using a preset information fusion module; The generating module is used to input the plurality of the complete representations into a preset decoder to generate a target question.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the question generation method based on multi-source knowledge fusion as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the question generation method based on multi-source knowledge fusion as described in any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, wherein when the program instructions are executed by a computer, the computer is caused to execute the question generation method based on multi-source knowledge fusion as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Model training method, dialogue generation method and device, equipment and medium

    CN110188182A

  • Intelligent dialogue method and device based on financial knowledge graph, and electronic equipment

    CN113988071A

  • Knowledge graph question and answer method and system based on Sparql statement generation

    CN115827844A

  • Drug repositioning method and system fusing multi-source knowledge graph

    WO2024138803A1