Question generation model training method and device

By creating initial question templates from triples in the knowledge base and performing back-translation, a mapping relationship is established to build a sample set for training the question generation model. This solves the problems of high human resource consumption and low accuracy in existing technologies, and achieves efficient question generation that can be adapted to different domains.

CN116204615BActive Publication Date: 2026-06-26BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
Filing Date
2022-12-29
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies require a large amount of human resources to build knowledge base question systems, and the accuracy of the generated questions is difficult to guarantee, especially in terms of poor adaptability to different fields.

Method used

By obtaining triples from the target knowledge base, an initial question template is created and back-translated to obtain an extended question template. A mapping relationship between triples and question templates is established, a sample set is constructed, and a question generation model is trained until the training stopping condition is met.

Benefits of technology

It improves sample construction efficiency without human intervention, adapts to the problem generation needs of different fields, saves manpower and resources, and improves problem generation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204615B_ABST
    Figure CN116204615B_ABST
Patent Text Reader

Abstract

The application provides a question generation model training method and device, wherein the question generation model training method comprises the following steps: obtaining a triple in a target knowledge base; creating an initial question template according to the triple, and performing back translation processing on the initial question template to obtain an extended question template; determining a mapping relationship between the triple and the initial question template and the extended question template based on a relationship contained in the triple; constructing a sample set based on the mapping relationship, and training a question generation model through the sample set until a target question generation model meeting a training stop condition is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for training a problem generation model. Background Technology

[0002] With the development of Internet technology, knowledge base question systems are being applied in more and more fields. To support the operation of a knowledge base question system, a large number of business-related questions need to be created in advance. In the process of creating questions, existing technologies usually use templates combined with manual work or simply use deep learning models to achieve automatic creation. Whether it is the template method or the deep learning method, a lot of human resources are required in the data preparation stage. Moreover, since manual intervention cannot effectively guarantee the accuracy of the subsequent generated questions, there is an urgent need for an effective solution to solve the above problems. Summary of the Invention

[0003] In view of this, embodiments of this application provide a problem generation model training method to address the technical deficiencies existing in the prior art. Embodiments of this application also provide a problem generation model training apparatus, a problem generation method, a problem generation device, a computing device, and a computer-readable storage medium.

[0004] According to a first aspect of the embodiments of this application, a method for training a problem generation model is provided, comprising:

[0005] Retrieve triples from the target knowledge base;

[0006] An initial question template is created based on the triples, and the initial question template is back-translated to obtain an extended question template.

[0007] The mapping relationship between the triples and the initial problem template and the extended problem template is determined based on the relationships contained in the triples;

[0008] A sample set is constructed based on the mapping relationship, and a problem generation model is trained using the sample set until a target problem generation model that meets the training stopping condition is obtained.

[0009] Optionally, creating an initial problem template based on the triples includes:

[0010] The triples are parsed to obtain the initial entities and initial relations within the triples;

[0011] The problem entity is determined based on the initial entity, and the problem relationship is determined based on the initial relationship;

[0012] The problem entity and the problem relationship are concatenated, and the initial problem template is generated based on the concatenation result.

[0013] Optionally, the back-translation process of the initial question template to obtain the extended question template includes:

[0014] Determine the initial text corresponding to the initial question template, and translate the initial text belonging to the first language to obtain the intermediate text belonging to the second language;

[0015] The intermediate text belonging to the second language is back-translated to obtain the target text belonging to the first language;

[0016] The extended question template is generated based on the target text.

[0017] Optionally, determining the mapping relationship between the triples and the initial problem template and the extended problem template based on the relations contained in the triples includes:

[0018] The initial problem template is parsed to obtain initial relationships, and the extended problem template is parsed to obtain extended relationships;

[0019] Extract the baseline relation contained in the triple, and determine the mapping relationship between the triple and the initial problem template and the extended problem template based on the baseline relation, the initial relation and the extended relation.

[0020] Optionally, determining the mapping relationship between the triples and the initial problem template and the extended problem template based on the baseline relationship, the initial relationship, and the extended relationship includes:

[0021] Determine whether the number of the triplets is greater than a preset threshold;

[0022] If so, select a target relationship from the initial relationship and the extended relationship, and determine the mapping relationship between the triple and the initial problem template and the extended problem template based on the association relationship between the target relationship and the baseline relationship;

[0023] If not, select at least two target relations from the initial relation and the extended relation, and determine the mapping relationship between the triple and the initial problem template and the extended problem template based on the association relationship between the at least two target relations and the baseline relation.

[0024] Optionally, after the step of back-translating the initial question template to obtain the extended question template is performed, the method further includes:

[0025] Determine whether the total number of the initial question template and the extended question template is less than a preset threshold.

[0026] If so, the initial text belonging to the first language is translated to obtain a translated text belonging to at least one third language; the translated text belonging to the at least one third language is back-translated to obtain at least one back-translated text belonging to the first language; an initial extended question template is generated based on the at least one back-translated text, and used as the extended question template.

[0027] If not, proceed with the step of determining the mapping relationship between the triples and the initial problem template and the extended problem template based on the relationships contained in the triples.

[0028] Optionally, constructing the sample set based on the mapping relationship includes:

[0029] Extract the target entity contained in the triple;

[0030] Based on the mapping relationship, the target entity is added to the initial question template and the extended question template, and a sample question is generated based on the addition result;

[0031] Establish the correspondence between the sample problem and the triple, and generate the sample set based on the establishment result.

[0032] Optionally, training the problem generation model using the sample set until a target problem generation model that meets the training stopping condition includes:

[0033] Select sample triples from the sample set and input them into the problem generation model for processing to obtain the prediction problem corresponding to the sample triples;

[0034] The loss value is calculated based on the sample problem corresponding to the sample triple and the prediction problem, and the parameters of the problem generation model are tuned according to the loss value.

[0035] If the parameter-tuned problem generation model meets the training stopping condition, the parameter-tuned problem generation model will be used as the target problem generation model.

[0036] The training stopping condition is that the number of iterations of the problem generation model is greater than or equal to a threshold; or the loss value of the problem generation model is less than a threshold.

[0037] Optionally, obtaining triples from the target knowledge base includes:

[0038] Select the target knowledge base that corresponds to the target domain;

[0039] Based on the entities and relationships corresponding to the target domain, the triples are extracted from the target knowledge base.

[0040] Optionally, determining the mapping relationship between the triples and the initial problem template and the extended problem template based on the relations contained in the triples includes:

[0041] Extract the baseline relationship from the triples;

[0042] Calculate the degree of matching between the baseline relationship and the initial problem module and the extended problem template;

[0043] Based on the matching degree calculation results, establish the mapping relationship between the triples and the initial question template and the extended question template.

[0044] According to a second aspect of the embodiments of this application, a problem generation model training apparatus is provided, comprising:

[0045] The acquisition module is configured to retrieve triples from the target knowledge base;

[0046] The creation module is configured to create an initial question template based on the triples and back-translate the initial question template to obtain an extended question template.

[0047] The determination module is configured to determine the mapping relationship between the triples and the initial problem template and the extended problem template based on the relationships contained in the triples;

[0048] The training module is configured to construct a sample set based on the mapping relationship and train a problem generation model using the sample set until a target problem generation model that meets the training stopping condition is obtained.

[0049] According to a third aspect of the embodiments of this application, a problem generation method is provided, comprising:

[0050] Get user input to generate instructions;

[0051] The target triplet carried in the problem generation instruction is input into the target problem model in the above method for processing to obtain the target problem;

[0052] In response to the question generation instruction, the target question is returned to the user.

[0053] According to a fourth aspect of the embodiments of this application, a problem generation apparatus is provided, comprising:

[0054] The instruction acquisition module is configured to acquire user-input questions and generate instructions.

[0055] The processing module is configured to input the target triplet carried in the problem generation instruction into the target problem model in the above method for processing, so as to obtain the target problem;

[0056] The return module is configured to return the target question to the user in response to the question generation instruction.

[0057] According to a fifth aspect of the embodiments of this application, a computing device is provided, comprising:

[0058] Memory and processor;

[0059] The memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions to implement the steps of the above method.

[0060] According to a sixth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the above-described method.

[0061] The question generation model training method provided in this application, after obtaining the triples in the target knowledge base, can create an initial question template based on the triples. In order to improve the sample richness of the training question generation model, the initial question template can be back-translated to obtain an extended question template. Then, a mapping relationship is established between the relations contained in the triples and the initial and extended question templates, and a sample set is constructed based on the mapping relationship. Finally, the question generation model is trained based on the sample set until the training is completed, and the target question generation model is obtained. This method improves the efficiency of sample construction without human intervention, which not only saves a lot of manpower and resources, but also adapts to the question generation needs of different domains, thereby improving the efficiency of question generation in different domains. Attached Figure Description

[0062] Figure 1 This is a schematic diagram of a problem generation model training method provided in an embodiment of this application;

[0063] Figure 2 This is a flowchart of a problem generation model training method provided in one embodiment of this application;

[0064] Figure 3 This is a schematic diagram of a problem generation model provided in an embodiment of this application;

[0065] Figure 4 This is a schematic diagram of the structure of a problem generation model training device provided in one embodiment of this application;

[0066] Figure 5 This is a flowchart of a problem generation method provided in an embodiment of this application;

[0067] Figure 6 This is a schematic diagram of the structure of a problem generation device provided in an embodiment of this application;

[0068] Figure 7 This is a flowchart illustrating a question generation method applied to a classical poetry question generation scenario, provided by an embodiment of this application.

[0069] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation

[0070] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.

[0071] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.

[0072] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first.

[0073] First, the terminology used in one or more embodiments of the present invention will be explained.

[0074] Knowledge base: Stores structured knowledge, generally represented in the form of triples, such as (Person A, Height, 175cm) or (Company J, Founder, Person B). It refers to a knowledge base that aggregates knowledge from a specific domain. The knowledge is organized in unstructured natural language, but to facilitate computer processing and understanding, it is formalized and simplified using triples. The triples in a knowledge base are (entity, relation, entity).

[0075] KBQA: Knowledge Base Question Answering (KB-QA). KBQA is a question-answering system based on a knowledge graph. The basic process is to query the knowledge graph based on the question, and then generate an answer based on the information in the knowledge graph and return it to the user.

[0076] Question generation: Generate corresponding questions based on triples in the knowledge base. For example, the triple (Company J, Founder, Person B) can generate the question "Who founded Company J", and the corresponding answer is "Person B".

[0077] BERT (Bidirectional Encoder Representations from Transformers) is a bidirectional attention neural network model used for pre-training in natural language processing. It's based on the Transformer's bidirectional encoder representations; the BERT model is rooted in the Transformer and its name originates from the concept of "attention is all you need." The "bidirectional" aspect means that when processing a word, it considers information from both preceding and following words, thus capturing the semantic context.

[0078] A one-time problem is a problem for which a result can be obtained with a single query. It can be understood as a relation, such as "What is A's job title?"

[0079] This application provides a method for training a problem generation model. This application also relates to a problem generation model training apparatus, a problem generation method, a problem generation device, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.

[0080] In practical applications, the method of generating questions using templates and manual methods suffers from poor versatility, failing to apply a single template to all triples. Furthermore, the high cost and low efficiency of manual labor make it difficult to achieve efficient question generation. While using deep learning models can address the efficiency issue, this method requires high-quality labeled training data, which also consumes significant human resources. Moreover, if questions are generated for knowledge bases in new domains, data labeling must be redone. Therefore, an effective solution is urgently needed to address these problems.

[0081] See Figure 1The diagram illustrates the training method for the question generation model. After obtaining the triples from the target knowledge base, an initial question template can be created based on the triples. To improve the sample richness of the training question generation model, the initial question template can be back-translated to obtain an extended question template. Then, a mapping relationship is established between the relations contained in the triples and the initial and extended question templates. A sample set is constructed based on the mapping relationship. Finally, the question generation model is trained based on this sample set until the training is completed, thus obtaining the target question generation model. This method improves the efficiency of sample construction without human intervention, saving a lot of manpower and resources. It can also adapt to the question generation needs of different domains, thereby improving the efficiency of question generation in different domains.

[0082] Figure 2 The flowchart illustrates a problem generation model training method according to an embodiment of this application, which specifically includes the following steps:

[0083] Step S202: Obtain triples from the target knowledge base.

[0084] Specifically, a target knowledge base refers to a database that stores triples composed of entities and relations related to the target domain. In other words, the target knowledge base corresponds to the target domain. For example, in the field of poetry, the target knowledge base is a database that stores triples related to poetry; in the field of sports, the target knowledge base is a database that stores triples related to sports; and in the field of people, the target knowledge base is a database that stores triples related to people.

[0085] In practical applications, question generation may be involved in any domain. Due to the characteristics of different domains, the generated questions are all related to knowledge within that domain. Therefore, when creating corresponding questions for any domain, it is necessary to combine relevant knowledge within that domain. This embodiment uses the training of a target question generation model for the human domain as an example for illustration. The model training process for other domains can refer to the same or similar descriptions in this embodiment, and will not be elaborated further here.

[0086] Furthermore, the target knowledge base is a database that stores relevant knowledge data corresponding to the target domain. Correspondingly, a triple is constructed from the entities and relations stored in the target knowledge base, and the triple is also related to the target domain.

[0087] Furthermore, since triples are the foundation for constructing the sample set, when obtaining triples, it is necessary to combine the relationships between entities and relations in the target knowledge base to form triples. In this embodiment, the specific implementation method is as follows: select a target knowledge base corresponding to the target domain; extract triples from the target knowledge base based on the entities and relations corresponding to the target domain.

[0088] Specifically, in order to train a target question generation model that can generate target questions related to the target domain, a target knowledge base corresponding to the target domain will be selected, and then triples will be extracted from the target knowledge base by combining the entities and relations corresponding to the target domain.

[0089] During the extraction of triples, the target knowledge base may not be stored in the form of triples. In this case, entity data and relation data can be extracted from the target knowledge base based on the entities and relations corresponding to the target domain. Then, based on the association between entities and relations, the entity data and relation data can be integrated to obtain the triples corresponding to the target domain. This facilitates the subsequent construction of a sample set for training a target question generation model corresponding to the target domain.

[0090] For example, when training a question generation model that can generate questions in a corresponding person domain, in order to improve the accuracy of the trained question generation model, we can select a target knowledge base corresponding to the person domain to extract triples. Based on the extraction results, we can obtain triples related to the person as follows: {A, height, 175cm}{A, gender, male}{B, height, 180cm}{B, gender, male}{C, height, 165cm}{C, gender, female}, so as to facilitate the subsequent construction of rich samples based on the extracted triples to train the question generation model.

[0091] It should be noted that the target knowledge base contains a large number of triples. For ease of description, this embodiment only describes the process of constructing a sample set based on a portion of the triples. The process of constructing a sample set based on other numbers of triples can be found in the same or similar descriptions in this embodiment, and will not be elaborated on here.

[0092] Step S204: Create an initial question template based on the triples, and perform back-translation on the initial question template to obtain an extended question template.

[0093] Specifically, after obtaining the triples from the target knowledge base, in order to create a richer sample set based on the triples, an initial question template can be constructed based on the obtained triples. Then, an extended question template can be obtained by back-translating the initial question template, thereby increasing the richness of the question template. This will enable the number of samples to be increased based on the original triples, thereby improving the prediction ability of the trained model.

[0094] The initial question template refers to the question template constructed based on the obtained triples. The constructed initial question template is universal for triples with the same relationship. In other words, the initial question template is a universal question template constructed based on the relationship of each triple. Correspondingly, the extended question template refers to the question template obtained after back-translating the initial question template. That is, the content obtained by translating the initial question template from the first language to the second language and then from the second language back to the first language is the extended question template.

[0095] In practice, different languages ​​may express the same concept in different ways. When a concept is translated into another language and then translated back into the original language, the concept may be expressed with similar semantic content, thus forming new content. That is, only the linguistic description has changed, but the concept itself remains the same. In other words, by back-translating the initial question template to obtain an extended question template, the question template is expanded. Although the meaning of the question template before and after back-translation may be the same or similar, their specific forms of expression (textual content) will differ. Subsequently, by combining the extended question template and the initial question template to construct a sample set, the number of samples can be increased, thereby enabling the question generation model to be trained with more samples and improving the model's predictive ability.

[0096] It should be noted that the initial question template and the expanded question template are the basis for the sample set for building the training model. Therefore, the question template only contains the relations involved in the triples and does not contain the entities in the triples. This allows for expansion of only the question template data, which can improve the efficiency of creating the sample set later.

[0097] Furthermore, in the process of constructing the initial question template based on triples, a triple typically contains two entities and one relation. Since the initial question template is the basis for subsequently constructing the sample set, it is necessary to combine the entities and relations contained in the triples to complete the template creation. In this embodiment, the specific implementation method is as follows:

[0098] The triples are parsed to obtain the initial entities and initial relations within the triples; the problem entities are determined based on the initial entities, and the problem relations are determined based on the initial relations; the problem entities and problem relations are concatenated, and an initial problem template is generated based on the concatenation result.

[0099] Specifically, the initial entity refers to the entity contained in the triple, and the initial relation refers to the relation contained in the triple; correspondingly, the problem entity refers to an entity selected from the initial entities that can be used to create the initial problem template, and the problem relation refers to the relation used to compose the initial problem template.

[0100] In practical applications, since each triple contains two entities and one relation, when selecting the problem entity from the two entities, either entity can be chosen as the problem entity. That is, the initial problem template is composed of an initial entity as the problem entity and a problem relation. This allows for the generation of two types of initial problem templates based on a single triple. Furthermore, considering the universality of the initial problem template for the same problem relation, after concatenating the problem entity and problem relation, the problem entity can be replaced based on the concatenation result to obtain the initial problem template.

[0101] For example, in the triple {A, Create, Company S}, when A is selected as the problem entity, Create is created as the problem relation. By concatenating the two, we get the problem "What did A create?" Then, by replacing the entity "A" in the problem, we get the problem template "What did entity A create?". When Company S is selected as the problem entity, Create is created as the problem relation. By concatenating the two, we get the problem "Who created Company S?" Then, by replacing the entity "Company S" in the problem, we get the problem template "Who created entity A?".

[0102] Based on this, after obtaining the triples in the target knowledge base, the triples can be parsed to obtain the initial entities and initial relations that make up the triples. Since there may be multiple initial entities, one can be selected as the question entity and the initial relation can be used as the question relation. Then, the initial entity and the question relation are concatenated, and the entities in the concatenation result are replaced to obtain the initial question template, which can be used to expand the sample set in the future.

[0103] In summary, by creating an initial problem template by selecting and assembling problem entities and problem relationships, we can not only save human resources but also increase the quantity requirements, which will be more conducive to the subsequent construction of sample sets and improve the predictive ability of the trained model.

[0104] Furthermore, after obtaining the initial question template, in order to improve the richness of the subsequent sample set construction, extended question templates can be created based on the initial question templates. This increases the number of question templates, making it easier to construct a richer sample set. In this embodiment, the process of creating extended question templates is as follows:

[0105] Determine the initial text corresponding to the initial question template, and translate the initial text belonging to the first language to obtain the intermediate text belonging to the second language; translate the intermediate text belonging to the second language back to obtain the target text belonging to the first language; generate an extended question template based on the target text.

[0106] Specifically, the initial text is the text content corresponding to the initial question template; the intermediate text is the text content obtained after translating the initial text; and the target text is the text content translated back from the intermediate text into the same language as the initial text. Among these, the initial text and the intermediate text are not in the same language, while the initial text and the target text are in the same language, that is, the first language and the second language are different, and the two can be translated into each other.

[0107] In practice, if only one question template is created for each relation, the number of initial question templates obtained may be small. If used to train the question generation model, it will cause insufficient training. Therefore, in order to ensure that the prediction effect of the subsequently trained question generation model meets the requirements, back-translation technology can be used to expand the samples. This not only saves human resources, but also quickly increases the number of samples and ensures the completeness of model training.

[0108] Based on this, in order to improve the richness of the question templates and the training efficiency of the question generation model, we can first determine the initial text corresponding to the initial question template; then, we can translate the initial text belonging to the first language to obtain the intermediate text belonging to the second language; and then we can translate the intermediate text belonging to the second language to obtain the target text in the same language as the initial text. The target text can then be used to create extended question templates, thus achieving the purpose of expanding the question templates.

[0109] Following the previous example, after obtaining the triples related to the characters, we can now select the entities and relations contained in each triple to create questions. The question corresponding to {A, height, 175cm} is "What is A's height?"; the question corresponding to {A, gender, male} is "What is A's gender?"; the question corresponding to {B, height, 180cm} is "What is B's height?"; the question corresponding to {B, gender, male} is "What is B's gender?"; the question corresponding to {C, height, 165cm} is "What is C's height?"; and the question corresponding to {C, gender, female} is "What is C's gender?". Then, by replacing and categorizing the entities in each question, we obtain the first initial question template S1 as "What is entity A's height?" and the second initial question template S2 as "What is entity A's gender?".

[0110] Furthermore, after obtaining the initial question templates S1 and S2, the first initial question template S1, "What is the height of entity A?", belonging to the Chinese language, can be translated into English to obtain the first initial question template S1 in English, "What is the height of entity A?"; the second initial question template S2, "What is the gender of entity A?", belonging to the Chinese language, can be translated into English to obtain the second initial question template S2 in English, "What is the gender of entity A?"; then, each initial question template in English can be translated into Chinese. The first initial question template S1 in English corresponds to the Chinese "What is the height of entity A?"; the second initial question template S2 in English corresponds to the Chinese "What are the sexual characteristics of entity A?". At this point, "What is the height of entity A?" is used as the first extended question template K1, and "What are the sexual characteristics of entity A?" is used as the second extended question template K2, in order to be used for subsequent training of the model by creating a sample set with triples.

[0111] In summary, by using back-translation technology to expand the problem template, we can not only save human resources, but also quickly increase the number of samples, ensuring the completeness of model training, and thus effectively guaranteeing the model's predictive ability.

[0112] Furthermore, considering the limited number of triples, using only the extended question template and the initial question template after a single back-translation process for subsequent sample set construction may result in insufficient samples, hindering effective model training. Therefore, to ensure sample richness, after obtaining the extended question template through back-translation, the total number of templates can be determined to decide whether to further increase the number of extended question templates, thereby improving sample richness. In this embodiment, the specific implementation is as follows:

[0113] Determine whether the total number of the initial question template and the extended question template is less than a preset threshold; if so, translate the initial text belonging to the first language to obtain a translated text belonging to at least one third language; perform back-translation on the translated text belonging to the at least one third language to obtain at least one back-translated text belonging to the first language; generate an initial extended question template based on the at least one back-translated text and use it as the extended question template; if not, proceed to step S206.

[0114] Specifically, the total number of templates refers to the sum of the initial question templates and the extended question templates; correspondingly, the preset quantity threshold refers to a value set based on the actual demand for the total number of templates. To improve sample richness and ensure that the total number of templates meets the preset requirements, when the number of triples is large, the number of text translations and back-translations can be reduced, i.e., the number of initial question templates or extended question templates can be reduced; when the number of triples is small, the number of text translations and back-translations can be increased, i.e., the number of initial question templates or extended question templates can be increased. Correspondingly, at least one third language specifically refers to a language other than the first and second languages, used to ensure that the back-translated text is different from the target text; correspondingly, the translated text specifically refers to the text corresponding to each third language; correspondingly, the back-translated text specifically refers to the text corresponding to the first language obtained after back-translating the translated text corresponding to each third language; correspondingly, the initial extended question template specifically refers to a question template created based on the back-translated text, used to add to the extended question template, and the initial extended question template has the same semantics as the extended question template and the initial question template but a different expression.

[0115] Based on this, after obtaining the initial problem template and the extended problem template, in order to improve the richness of the samples, the total number of templates of the initial problem template and the extended problem template is judged based on the preset number threshold. If the total number of templates is greater than or equal to the preset number threshold, it means that the current number of triples combined with the initial problem template and the extended problem template can create a sample set that meets the training requirements, and then step S206 can be executed.

[0116] If the total number of templates is less than the preset threshold, it means that the current number of triples combined with the initial question template and the extended question template cannot create a sample set that meets the training requirements. In this case, the initial text can be back-translated again. That is, the initial text belonging to the first language is translated to obtain the translated text belonging to at least one third language. Then, the translated text belonging to each third language is back-translated to obtain at least one back-translated text belonging to a third language. Finally, the initial extended question template can be created based on at least one back-translated text and added to the extended question template for subsequent mapping relationship establishment.

[0117] It should be noted that after adding the initial extended question template to the extended question template, the total number of templates can be checked again. That is, it can be checked whether the total number of templates, including the initial question template and the extended question templates added to the initial extended question template, is less than a preset number threshold. Then, the extended question templates can be expanded according to the judgment result until the number threshold is met before the mapping relationship is established.

[0118] Following the previous example, if the total number of initial and extended question templates is determined to be less than a preset threshold of 5, then the first initial question template S1 (which belongs to Chinese) can be translated into Korean to obtain the first initial question template H1 (which belongs to Korean). Similarly, the second initial question template S2 (which belongs to Chinese) can be translated into Korean to obtain the second initial question template H2 (which belongs to Korean). Then, each of the Korean initial question templates can be translated into Chinese to obtain the Chinese template S1 corresponding to the first initial question template H1 (which belongs to Korean). * And the Chinese template corresponding to the second initial problem template H2 is S2. * And template S1 * and S2 * The expressions in templates S1, S2, K1, and K2 are all different. Furthermore, since the total number of templates is determined to be 6, which is greater than the preset threshold of 5, subsequent processing operations can continue to achieve the purpose of creating a sample set by combining triples to train the model.

[0119] In summary, by judging the number of templates, the number of samples to be constructed can be accurately detected. If the number is less than expected, back-translation with a new language can be performed to increase the number of templates. This allows for the expansion of samples that meet the training requirements based on the triples and the total number of templates, ensuring that the prediction accuracy of the model trained with these samples is higher.

[0120] Step S206: Determine the mapping relationship between the triple and the initial problem template and the extended problem template based on the relationships contained in the triple.

[0121] Specifically, based on the initial and extended question templates constructed above, and since the question generation model trained subsequently is used to generate questions corresponding to the target domain, in order to ensure that the model can generate richer questions based on triples, the mapping relationship between each triple and each question template can be determined. This mapping relationship can be one triple corresponding to one question template, or one triple corresponding to multiple question templates. Based on this, multiple mapping relationships can be obtained, which facilitates the subsequent construction of a rich sample set.

[0122] In this process, since the initial problem template and the extended problem template only contain relations, the mapping relationship between the triples and the initial problem template and the extended problem template can be established by combining the relations in each triple, so as to facilitate the subsequent construction of a rich sample set by combining the mapping relationship.

[0123] Therefore, when determining the mapping relationship between triples and problem templates, considering the degree of association between triples and problem templates, the mapping relationship can be determined based on the relations contained in the triples. That is, extract the relations contained in each triple, then select the problem template containing the relation to establish the mapping relationship between the two, and so on, until all triples have established the mapping relationship with the problem template.

[0124] Furthermore, in the process of constructing the mapping relationship between triples and the question template, since this mapping relationship is the basis for the subsequent construction of the sample set, in order to ensure the accuracy of the mapping relationship, the relationship can be extracted from the question template and associated with the relationship in the triples to complete the establishment of the mapping relationship. In this embodiment, the specific implementation method is as follows:

[0125] Step S2062: Parse the initial problem template to obtain the initial relationship, and parse the extended problem template to obtain the extended relationship.

[0126] Specifically, the initial relation refers to the relation contained in each initial question template; the extended relation refers to the relation contained in each extended question template. Based on this, after obtaining the initial question template and the extended question template, the extended question template and the initial question template can be parsed respectively to obtain the initial relation and the extended relation, so that the mapping relationship between triples and question templates can be determined by matching the relation.

[0127] Step S2064: Extract the baseline relation contained in the triplet, and determine the mapping relationship between the triplet and the initial problem template and the extended problem template based on the baseline relation, the initial relation and the extended relation.

[0128] Specifically, the baseline relation refers to the relation contained in each triple. Based on this, after extracting the baseline relation of the triple, the baseline relation can be matched with the extended relation and the initial relation respectively. According to the matching results, the mapping relationship between the triple and the initial problem template and the extended problem template is established, so as to facilitate the creation of a rich sample set based on the mapping relationship and the triple and problem template.

[0129] Furthermore, since different target knowledge bases contain varying numbers of triples, if the number of triples is large, using augmentation to create samples may lead to overfitting of the trained model. Therefore, considering whether different numbers of triples are suitable for training the model after augmentation, this embodiment can select a reasonable method for creating mapping relationships by using a threshold when establishing the mapping relationship. The specific implementation method is as follows:

[0130] Determine if the number of triples exceeds a preset threshold;

[0131] If so, select the target relation from the initial relation and the extended relation, and determine the mapping relationship between the triples and the initial problem template and the extended problem template based on the association relationship between the target relation and the baseline relation;

[0132] If not, select at least two target relations from the initial relation and the extended relation, and determine the mapping relationship between the triples and the initial problem template and the extended problem template based on the association relationship between the at least two target relations and the baseline relation.

[0133] Specifically, selecting target relations in the initial and extended relations means choosing a subset of relations as target relations when there are a large number of relations, to be used for establishing mapping relations later, thereby reducing the number of samples. Selecting at least two target relations in the initial and extended relations means selecting multiple relations as target relations when there are a large number of relations, to be used for establishing mapping relations later, thereby enriching the number of samples.

[0134] Based on this, we first determine whether the number of triples exceeds a preset threshold. If so, it means that the target knowledge base contains a large number of triples. If we further expand the question template to establish a mapping relationship, a large number of training samples will be generated. If we train the model based on this, it may lead to model overfitting and greatly reduce the model training efficiency. Therefore, in order to solve the above problem, we can select a small part of the target relationship from the initial relationship and the expanded relationship to determine the association between the target relationship and the benchmark relationship. Then, based on the association relationship, we can determine the mapping relationship between some triples and the initial question template and the expanded question template, which makes it easier to create a reasonable number of samples in the future.

[0135] In practice, when selecting a small subset of target relations from the initial and extended relations, to ensure the richness of the selected objects and avoid overly singular target relations, the initial and extended relations can be merged first to obtain a set of relations to be selected. Then, a predetermined number of relations can be randomly selected from this set as target relations for later use. Alternatively, selection can be made separately from the two types of relations: a first number of relations can be randomly selected from the initial relations, and a second number from the extended relations, with the sum of the first and second numbers equal to a predetermined number. Finally, the first and second numbers of relations can be combined to form the predetermined number of target relations for later use. The predetermined number can be determined according to actual needs, such as 5% to 35% of the total number of initial and extended relations.

[0136] If not, it means that the target knowledge base contains a small number of triples. In this case, in order to avoid the number of triples affecting the richness of the sample set built later, all the initial relations and extended relations can be used as target relations, or most of the initial relations and extended relations can be selected as target relations. Based on this, the association between the target relations and the benchmark relations can be determined. Then, based on the association, the mapping relationship between some triples and the initial question template and the extended question template can be determined, which makes it easier to create a reasonable number of samples later.

[0137] In practice, when selecting the majority of relationships from the initial and extended relationships as target relationships, the initial and extended relationships can be merged first to obtain a set of relationships to be selected. Then, a set percentage of relationships can be randomly selected from the set of relationships to be selected as target relationships, such as 90%, 92%, or 85%, to facilitate subsequent use.

[0138] It should be noted that the value of the preset threshold can be selected according to the actual application scenario, and this embodiment does not impose any limitations on it.

[0139] Continuing with the previous example, by extracting the baseline relationships for each triple, we determine that the baseline relationships involved are "gender" and "height". Simultaneously, we extract relationships from the initial question template and the extended question template, determining the initial relationships as "gender" and "height", and the extended relationships as "height" and "sexual characteristics". Further, by matching the baseline relationships with the initial and extended relationships respectively, we establish mapping relationships between each triple and the four question templates based on the matching results. These mapping relationships are as follows: {A, height, 175cm}->S1 and K1; {A, gender, male}->S2 and K2; {B, height, 180cm}->S1 and K1; {B, gender, male}->S2 and K2; {C, height, 165cm}->S1 and K1; {C, gender, female}->S2 and K2. This facilitates the construction of samples to train the model by combining the above mapping relationships.

[0140] In summary, by comparing the number of triples to establish the correspondence between triples and the initial and extended problem templates, we can effectively ensure the rationality of the number of samples created subsequently, thereby enabling more effective model training.

[0141] Furthermore, when establishing mapping relationships, since the extended question template is obtained through back-translation, directly matching the triples and the question template may result in unsuccessful matching. To mitigate this impact, a matching degree calculation method can be used. In this embodiment, the specific implementation method is as follows:

[0142] Extract the baseline relationship from the triples;

[0143] Calculate the degree of matching between the baseline relationship and the initial problem module and the extended problem template;

[0144] Based on the matching degree calculation results, establish the mapping relationship between the triples and the initial problem template and the extended problem template.

[0145] Specifically, the matching degree refers to the degree of matching between the baseline relationship and each problem template. The higher the matching degree, the closer the triple is to the relationship contained in the problem template. Conversely, the lower the matching degree, the more different the triple is from the relationship contained in the problem template.

[0146] Based on this, after obtaining the initial problem template and the extended problem template, the baseline relationship can be extracted from the triples. Then, the matching degree between the baseline relationship and the initial problem template and the extended problem template is calculated. According to the matching degree calculation result, the triples with a matching degree greater than the preset matching degree threshold are selected to establish the mapping relationship between the triples and the initial problem template and the extended problem template. After the mapping relationship between each triple and the problem template is established, it can be used to construct the sample set.

[0147] In summary, by establishing the mapping relationship between each triple and the question template by calculating the matching degree, the accuracy of subsequent sample construction can be guaranteed, thereby enabling the training of the question generation model and improving the model's predictive ability.

[0148] Step S208: Construct a sample set based on the mapping relationship, and train the problem generation model using the sample set until a target problem generation model that meets the training stopping condition is obtained.

[0149] Specifically, after constructing the mapping relationship as described above, a sample set can be built based on this mapping relationship. The sample set is then used to generate a model for the problem until the target problem generation model that meets the training stopping condition is obtained.

[0150] Specifically, the sample set refers to the problem obtained by adding triples to the initial problem template or the extended problem template based on the mapping relationship, and the set of sample pairs constructed based on the problem and the triples; correspondingly, the target problem generation model refers to the model that, after training, can generate problems related to the target domain based on the triples.

[0151] In practice, the question generation model can use the pre-trained language model BERT. Since the pre-trained BERT model has already been trained on a large amount of text corpus, utilizing the text corpus information already learned by the BERT model can help expand the sentence structure for generating questions. Further training of the model using a sample set allows it to learn the mapping relationship between triples and questions, enabling the model to generate questions based on triples. See also... Figure 3The diagram shows that after inputting the triple {Zhou**, height, 175cm} into the trained BERT model, it can output questions such as "What is Zhou**'s height?", "Who is 175cm tall?", or "What is Zhou**'s height of 175cm?".

[0152] Furthermore, in order to construct samples that meet the usage requirements and support the training of the question generation model, the target entity contained in each triple is extracted. Then, the target entity is added to the question template with the mapping relationship of the triple, and a question is constructed based on this. Finally, the question and the triple are combined to obtain the samples that make up the sample set. In this embodiment, the specific implementation method is as follows:

[0153] Extract the target entities contained in the triples; add the target entities to the initial problem template and the extended problem template based on the mapping relationship, and generate sample problems based on the addition results; establish the correspondence between sample problems and triples, and generate a sample set based on the establishment results.

[0154] Specifically, the target entity refers to the entity contained in the triple that can be added to the initial question template or the extended question template with a mapping relationship; correspondingly, the sample question refers to the question obtained after adding the target entity to the initial question template or the extended question template; the correspondence relationship refers to the correspondence between the question and the triple, based on which the sample label and the sample can be determined, which facilitates the subsequent assembly of sample data to train the model.

[0155] Based on this, when constructing the sample set, target entities that can be added to the initial question template or extended question template can be extracted from the triples. The target entities can be added to the initial question template or extended question template that has a mapping relationship with the triples. The sample questions are generated based on the addition results. At the same time, the correspondence between the sample questions and the triples is established. After all the sample questions corresponding to the triples and the correspondence are established, the sample set for training the model can be generated based on the establishment results.

[0156] In summary, by constructing a sample set based on mapping relationships, it can be ensured that the constructed sample data meets the model training requirements and has a high degree of richness. Training the model based on this data can effectively improve the model's predictive ability.

[0157] Furthermore, once the sample set is constructed, the problem generation model can be trained based on the sample set. In this embodiment, the specific implementation method is as follows:

[0158] Select sample triples from the sample set and input them into the question generation model for processing to obtain the predicted questions corresponding to the sample triples; calculate the loss value based on the sample questions and the predicted questions corresponding to the sample triples, and adjust the parameters of the question generation model according to the loss value; when the adjusted question generation model meets the training stop condition, use the adjusted question generation model as the target question generation model; where the training stop condition is that the number of iterative training of the question generation model is greater than or equal to the number threshold; or the loss value of the question generation model is less than the loss value threshold.

[0159] Specifically, the predicted question specifically refers to the question generated by the question generation model after processing the triple. Based on this, after obtaining the sample set, sample triples can be selected from the sample set and input into the question generation model for processing to obtain the predicted questions output by the question generation model. At this time, in order to improve the prediction ability of the model, the loss value can be calculated based on the sample questions and the predicted questions corresponding to the sample triples, and the parameters of the question generation model can be adjusted according to the loss value; if there is still a prediction error in the adjusted question generation model, continue to select samples from the sample set for training; until the question generation model meets the training stop condition, the question generation model can be used as the target question generation model for generating questions in the target domain.

[0160] Among them, the training stop condition is that the training stop condition is that the number of iterative training of the question generation model is greater than or equal to the number threshold; or the loss value of the question generation model is less than the loss value threshold; that is, when the number of training times of the question generation model reaches the preset number of times, stop training; or the loss value is less than the preset loss value threshold, stop training; in practical applications, the training stop condition can be selected according to the actual application scenario, and this embodiment does not make any limitations here.

[0161] Continuing with the above example, after determining the mapping relationship between the triple and the question template, extract the target entity "A" from {A, height, 175cm} and add it to the question templates S1 and K1 to obtain the questions corresponding to this triple as "What is A's height?" and "What is A's height?"; extract the target entity "A" from {A, gender, male} and add it to the question templates S2 and K2 to obtain the questions corresponding to this triple as "What is A's gender?" and "What are A's sexual characteristics?".

[0162] Extract the target entity "B" from {B, height, 180cm} and add it to the question templates S1 and K1 to obtain the questions corresponding to this triple as "What is B's height?" and "What is B's height?"; extract the target entity "B" from {B, gender, male} and add it to the question templates S2 and K2 to obtain the questions corresponding to this triple as "What is B's gender?" and "What are B's sexual characteristics?".

[0163] Extract the target entity "Bing" from {Bing, height, 165 cm} and add it to the question templates S1 and K1. The questions corresponding to this triple are "What is Bing's height?" and "What is Bing's height?"; Extract the target entity "Bing" from {Bing, gender, female} and add it to the question templates S2 and K2. The questions corresponding to this triple are "What is Bing's gender?" and "What is Bing's sexual characteristic?".

[0164] After that, combine each triple with the question corresponding to this triple to obtain a sample pair. For example, in sample pair S, the sample is {Jia, height, 175 cm}, and the question label is "What is Jia's height?". By integrating all the sample pairs containing samples and question labels, the sample set for training the model can be constructed. Finally, use the triple as the input for training the person question generation model, and the question corresponding to the triple as the label, and continuously train the person question generation model until the target person question generation model that meets the requirements is obtained.

[0165] The question generation model training method provided in this application, after obtaining the triples in the target knowledge base, at this time, initial question templates can be created according to the triples. In order to improve the sample richness of training the question generation model, at this time, the initial question templates can be back-translated to obtain extended question templates, and then establish the mapping relationship between the relationships included in the triples and the initial question templates and the extended question templates, and construct the sample set based on the mapping relationship. Finally, train the question generation model based on this sample set until the training is completed to obtain the target question generation model, which realizes improving the sample construction efficiency without manual participation, not only can save a lot of manpower and material resources, but also can adapt to the question generation requirements in different fields, thereby improving the question generation efficiency in different fields.

[0166] Corresponding to the above method embodiment, this application also provides an embodiment of a question generation model training device. Figure 4 The structure diagram of a question generation model training device provided by an embodiment of this application is shown. As Figure 4 shown, the device includes:

[0167] An acquisition module 402, configured to acquire triples in the target knowledge base;

[0168] A creation module 404, configured to create an initial question template according to the triples, and perform back-translation processing on the initial question template to obtain an extended question template;

[0169] A determination module 406, configured to determine the mapping relationship between the triples and the initial question template and the extended question template based on the relationships included in the triples;

[0170] Training module 408 is configured to construct a sample set based on the mapping relationship and train a problem generation model using the sample set until a target problem generation model that meets the training stopping condition is obtained.

[0171] In an optional embodiment, the creation module 404 is further configured to:

[0172] The triples are parsed to obtain the initial entity and initial relation in the triples; the problem entity is determined based on the initial entity, and the problem relation is determined based on the initial relation; the problem entity and the problem relation are concatenated, and the initial problem template is generated based on the concatenation result.

[0173] In an optional embodiment, the creation module 404 is further configured to:

[0174] Determine the initial text corresponding to the initial question template, and translate the initial text belonging to the first language to obtain the intermediate text belonging to the second language; perform back-translation on the intermediate text belonging to the second language to obtain the target text belonging to the first language; generate the extended question template based on the target text.

[0175] In an optional embodiment, the determining module 406 is further configured to:

[0176] The initial problem template is parsed to obtain an initial relation, and the extended problem template is parsed to obtain an extended relation; the baseline relation contained in the triple is extracted, and the mapping relationship between the triple and the initial problem template and the extended problem template is determined based on the baseline relation, the initial relation and the extended relation.

[0177] In an optional embodiment, the determining module 406 is further configured to:

[0178] Determine whether the number of triples is greater than a preset threshold; if yes, select a target relation from the initial relation and the extended relation, and determine the mapping relationship between the triples and the initial question template and the extended question template based on the association relationship between the target relation and the baseline relation; if no, select at least two target relations from the initial relation and the extended relation, and determine the mapping relationship between the triples and the initial question template and the extended question template based on the association relationship between the at least two target relations and the baseline relation.

[0179] In an optional embodiment, the problem generation model training apparatus further includes:

[0180] The quantity determination module is configured to determine whether the total number of the initial question template and the extended question template is less than a preset quantity threshold; if so, the initial text belonging to the first language is translated to obtain a translated text belonging to at least one third language; the translated text belonging to the at least one third language is back-translated to obtain at least one back-translated text belonging to the first language; an initial extended question template is generated based on the at least one back-translated text and used as the extended question template.

[0181] If not, execute the determination module 406.

[0182] In an optional embodiment, the training module 408 is further configured to:

[0183] Extract the target entity contained in the triple; add the target entity to the initial question template and the extended question template based on the mapping relationship, and generate sample questions based on the addition results; establish the correspondence between the sample questions and the triples, and generate the sample set based on the establishment results.

[0184] In an optional embodiment, the training module 408 is further configured to:

[0185] Sample triples are selected from the sample set and input into the question generation model for processing to obtain the prediction question corresponding to the sample triples. A loss value is calculated based on the sample question corresponding to the sample triples and the prediction question, and the parameters of the question generation model are tuned according to the loss value. If the tuned question generation model meets the training stopping condition, it is used as the target question generation model. The training stopping condition is either that the number of iterations of the question generation model is greater than or equal to a threshold, or that the loss value of the question generation model is less than a loss value threshold.

[0186] In an optional embodiment, the acquisition module 402 is further configured to:

[0187] Select the target knowledge base corresponding to the target domain; extract the triples from the target knowledge base based on the entities and relations corresponding to the target domain.

[0188] In an optional embodiment, the determining module 406 is further configured to:

[0189] Extract the baseline relation from the triples; calculate the matching degree between the baseline relation and the initial problem module and the extended problem template; establish the mapping relationship between the triples and the initial problem template and the extended problem template based on the matching degree calculation result.

[0190] The question generation model training device provided in this application, after obtaining triples from the target knowledge base, can create an initial question template based on the triples. To improve the sample richness of the training question generation model, the initial question template can be back-translated to obtain an extended question template. Then, a mapping relationship is established between the relations contained in the triples and the initial and extended question templates, and a sample set is constructed based on the mapping relationship. Finally, the question generation model is trained based on this sample set until the training is completed, thus obtaining the target question generation model. This device improves the efficiency of sample construction without human intervention, saving a lot of manpower and resources, and can adapt to the question generation needs of different domains, thereby improving the efficiency of question generation in different domains.

[0191] The above is a schematic scheme of a problem generation model training device according to this embodiment. It should be noted that the technical solution of this problem generation model training device and the technical solution of the aforementioned problem generation model training method belong to the same concept. Details not described in detail in the technical solution of the problem generation model training device can be found in the description of the technical solution of the aforementioned problem generation model training method. Furthermore, the components in the device embodiment should be understood as functional modules necessary to implement each step of the program flow or each step of the method; these functional modules are not actual functional divisions or separations. The device claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, and not as a physical device that primarily implements the solution through hardware.

[0192] Corresponding to the above-described problem generation model training method, this embodiment provides a problem generation method that uses the target problem generation model trained by the above method for processing. See [link to relevant documentation]. Figure 5 The flowchart illustrates a problem generation method according to an embodiment of this application, which specifically includes the following steps:

[0193] Step S502: Obtain the question generation instruction input by the user.

[0194] Step S504: Input the target triplet carried in the problem generation instruction into the target problem model obtained by the above training method for processing to obtain the target problem.

[0195] Step S506: In response to the question generation instruction, return the target question to the user.

[0196] It should be noted that the question generation method provided in this embodiment uses the target question generation model trained by the above-mentioned question generation model training method to answer the questions raised by the user. The training process and related structure of the target question generation model can be found in the same or corresponding descriptions in the above embodiments, and will not be elaborated on in this embodiment.

[0197] Corresponding to the above method embodiments, this application also provides embodiments of a problem generation apparatus. Figure 6 A schematic diagram of a problem generation apparatus according to an embodiment of this application is shown. Figure 6 As shown, the device includes:

[0198] The instruction acquisition module 602 is configured to acquire user-input question generation instructions;

[0199] Processing module 604 is configured to input the target triplet carried in the problem generation instruction into the target problem model obtained by the above training method for processing, so as to obtain the target problem;

[0200] Return module 606 is configured to return the target question to the user in response to the question generation instruction.

[0201] The above is a schematic scheme of a problem generation device according to this embodiment. It should be noted that the technical solution of this problem generation device and the technical solution of the above-described problem generation method belong to the same concept. Details not described in detail in the technical solution of the problem generation device can be found in the description of the technical solution of the above-described problem generation method. Furthermore, the components in the device embodiment should be understood as functional modules necessary to implement each step of the program flow or each step of the method; these functional modules are not actual functional divisions or separations. A device claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, and not as a physical device that primarily implements the solution through hardware.

[0202] The following is in conjunction with the appendix Figure 7 Taking the application of the question generation method provided in this application in the scenario of generating questions about classical Chinese poetry as an example, the question generation method will be further explained. Figure 7 This application provides a flowchart illustrating a question generation method for a classical poetry question generation scenario, which includes the following steps:

[0203] Step S702: Obtain the triples from the poetry knowledge base.

[0204] This embodiment uses the scenario of generating classical Chinese poetry problems as an example for illustration. Accordingly, the poetry knowledge base specifically refers to a database that provides triples related to classical Chinese poetry. The triples included are: {Quiet Night Thoughts, author, Li Bai}{To Wang Lun, author, Li Bai}{Looking at Mount Tai, author, Du Fu}{Li Bai, courtesy name, Taibai}{Li Bai, dynasty, Tang Dynasty}{Du Fu, courtesy name, Zimei}{Du Fu, dynasty, Tang Dynasty}... It should be noted that all triples included in the poetry knowledge base are related to classical Chinese poetry, and the number of triples included can be set according to the actual application scenario. This embodiment will not elaborate on this further.

[0205] Step S704: Extract the poem relationships contained in the triples and create an initial question template based on the poem relationships.

[0206] It should be noted that each initial question template can be generalized for the same relation. That is, as long as the triple contains the relation that created the initial question template, the triple combined with the initial question template can create a poetry question.

[0207] Based on this, the poetic relationships contained in each triple are extracted, namely "author", "style name", "dynasty", etc.; then, a first initial question template is created based on the "author" poetic relationship: "Who is the author of entity A?"; a second initial question template is created based on the "style name" poetic relationship: "What is the style name of entity A?"; a third initial question template is created based on the "dynasty" poetic relationship: "In what dynasty was entity A born?"; in practical applications, since the knowledge base contains a large number of triples, and the relationships of each triple may not be the same, this embodiment describes the generation of three initial question templates for ease of description. The process of creating more question templates based on other relationships can refer to the same description in this embodiment, and will not be elaborated on here.

[0208] Step S706: Back-translate the initial question template to obtain the extended question template.

[0209] Specifically, based on the first initial question template "Who is the author of entity A?", the second initial question template "What is the font size of entity A?", and the third initial question template "In what dynasty was entity A born?", the first initial question template, the second initial question template, and the third initial question template are translated into Korean using a translation tool, resulting in:

[0210] The template for the first initial question in Korean is

[0211] The template for the second initial question in Korean is

[0212] The template for the third initial question in Korean is as follows: Next, the initial question templates from Korean are translated into Chinese using a translation tool. At this point, we obtain:

[0213] The Chinese equivalent of the first initial question template in Korean is "Who is the author of entity A?";

[0214] The Chinese equivalent of the second initial question template in Korean is "What is the character A in entity A?";

[0215] The Chinese equivalent of the Korean third initial question template is "In which era was entity A born?"

[0216] Finally, use "Who is the author of Entity A?" as the first extended question template, "What is the name of Entity A?" as the second extended question template, and "In which era was Entity A born?" as the third extended question template.

[0217] The generated question template includes six questions: 1. Who is the author of entity A?; 2. What is the font of entity A?; 3. In which dynasty was entity A born?; 4. Who is the writer of entity A?; 5. What is the font of entity A?; 6. In which era was entity A born? These questions are used to establish mapping relationships and train the question generation model.

[0218] Step S708: Based on the poetic relationships contained in the triples, determine the mapping relationship between the triples and the initial problem template and the extended problem template.

[0219] Specifically, the relationship between each triple and the corresponding poem / lyric is determined as "author", "style name", "dynasty", etc.; then, based on each poem / lyric relationship, a mapping relationship is established between each triple and the above six question templates, as follows:

[0220] {Quiet Night Thoughts, Author: Li Bai}->Who is the author of Entity A and who is the writer of Entity A;

[0221] {A Gift to Wang Lun, Author: Li Bai}->Who is the author of Entity A and who is the writer of Entity A;

[0222] {Looking at Mount Tai, Author, Du Fu} -> Who is the author of entity A and who is the writer of entity A;

[0223] {Li Bai, courtesy name, Taibai} -> What is the courtesy name of entity A and what is the courtesy name of entity A;

[0224] {Li Bai, Dynasty, Tang Dynasty}->In which dynasty was entity A born and in which era was entity A born?

[0225] {Du Fu, courtesy name, Zimei} -> What is the courtesy name of entity A and what is the courtesy name of entity A;

[0226] {Du Fu, Dynasty, Tang Dynasty} -> Which dynasty was Entity A born in and which era was Entity A born in...

[0227] Step S710, extract the target entity included in the triple, add the target entity to the question template that has a mapping relationship with the triple, and construct a poetry sample set based on the addition result.

[0228] Specifically, extract the target entity "Thoughts in the Silent Night" in the triple {Thoughts in the Silent Night, Author, Li Bai} and add it to the question templates "Who is the author of Entity A" and "Who is the writer of Entity A" respectively, obtaining two questions corresponding to the triple {Thoughts in the Silent Night, Author, Li Bai} which are "Who is the author of Thoughts in the Silent Night" and "Who is the writer of Thoughts in the Silent Night"; extract the target entity "Farewell to Wang Lun" in the triple {Farewell to Wang Lun, Author, Li Bai} and add it to the question templates "Who is the author of Entity A" and "Who is the writer of Entity A" respectively, obtaining two questions corresponding to the triple {Farewell to Wang Lun, Author, Li Bai} which are "Who is the author of Farewell to Wang Lun" and "Who is the writer of Farewell to Wang Lun"...; extract the target entity "Du Fu" in the triple {Du Fu, Dynasty, Tang Dynasty} and add it to the question templates "What dynasty was Entity A born in" and "Which era was Entity A born in" respectively, obtaining two questions corresponding to the triple {Du Fu, Dynasty, Tang Dynasty} which are "What dynasty was Du Fu born in" and "Which era was Du Fu born in".

[0229] Finally, form a sample pair by combining each triple with the question (question label) corresponding to the triple, and construct a poetry sample set for training the model by integrating all the sample pairs.

[0230] Step S712, train the poetry question generation model with the poetry sample set until a target poetry question generation model that meets the training stop condition is obtained.

[0231] Specifically, when training the poetry question generation model, the triple can be used as the input of the model, and the question corresponding to the triple can be used as the label, and continuously train the model until a target poetry question generation model that meets the requirements is obtained.

[0232] Step S714, receive the poetry triple submitted by the user, and input the poetry triple into the target poetry question generation model for processing to obtain the target poetry question.

[0233] Specifically, when the poetry triple submitted by the user is {The Temple of Marquis Wu, Writer, Du Fu}, at this time, input this triple into the target poetry question generation model for processing, and the target poetry question "Who is the author of The Temple of Marquis Wu" or "Who is the writer of The Temple of Marquis Wu" output by the model can be obtained, and return this target poetry question to the user.

[0234] In summary, by utilizing back-translation technology and deep learning-based question generation models, a large amount of triple-question data can be automatically constructed. This not only saves manpower and resources but also effectively improves model training efficiency, thereby ensuring that the trained model can quickly adapt to the question generation needs of new domains.

[0235] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this application is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0236] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0237] In one embodiment of this application, the aforementioned components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.

[0238] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.

[0239] When the processor 820 executes computer-executable instructions, it implements the above-mentioned problem generation model training method or problem generation method.

[0240] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the technical solution of the problem generation model training method or problem generation method described above. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the problem generation model training method or problem generation method described above.

[0241] An embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used for a problem generation model training method or a problem generation method.

[0242] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solution of the problem generation model training method or problem generation method described above. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the problem generation model training method or problem generation method described above.

[0243] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0244] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0245] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0246] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0247] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.

Claims

1. A method for training a problem generation model, characterized in that, include: Retrieve triples from the target knowledge base; An initial question template is created based on the triples, and the initial question template is back-translated to obtain an extended question template. If the number of triples is greater than a preset threshold, a target relation is selected from the initial relation corresponding to the initial question template and the extended relation corresponding to the extended question template. Based on the association between the target relation and the baseline relation contained in the triple, the mapping relationship between the triple and the initial question template and the extended question template is determined. If the number of triples is not greater than a preset threshold, at least two target relations are selected from the initial relation and the extended relation, and the mapping relationship between the triples and the initial problem template and the extended problem template is determined based on the association relationship between the at least two target relations and the baseline relation. A sample set is constructed based on the mapping relationship, and a problem generation model is trained using the sample set until a target problem generation model that meets the training stopping condition is obtained.

2. The method according to claim 1, characterized in that, The step of creating an initial problem template based on the triples includes: The triples are parsed to obtain the initial entities and initial relations within the triples; The problem entity is determined based on the initial entity, and the problem relationship is determined based on the initial relationship; The problem entity and the problem relationship are concatenated, and the initial problem template is generated based on the concatenation result.

3. The method according to claim 1, characterized in that, The process of back-translating the initial question template to obtain the extended question template includes: Determine the initial text corresponding to the initial question template, and translate the initial text belonging to the first language to obtain the intermediate text belonging to the second language; The intermediate text belonging to the second language is back-translated to obtain the target text belonging to the first language; The extended question template is generated based on the target text.

4. The method according to claim 1, characterized in that, Also includes: The initial problem template is parsed to obtain initial relationships, and the extended problem template is parsed to obtain extended relationships; Extract the baseline relation contained in the triple, and determine the mapping relationship between the triple and the initial problem template and the extended problem template based on the baseline relation, the initial relation and the extended relation.

5. The method according to claim 3, characterized in that, After the step of back-translating the initial question template to obtain the extended question template is executed, the method further includes: Determine whether the total number of the initial question template and the extended question template is less than a preset threshold. If so, the initial text belonging to the first language is translated to obtain a translated text belonging to at least one third language; the translated text belonging to the at least one third language is back-translated to obtain at least one back-translated text belonging to the first language; an initial extended question template is generated based on the at least one back-translated text, and used as the extended question template. If not, proceed with the step of determining the mapping relationship between the triples and the initial problem template and the extended problem template based on the relationships contained in the triples.

6. The method according to claim 1, characterized in that, The construction of the sample set based on the mapping relationship includes: Extract the target entity contained in the triple; Based on the mapping relationship, the target entity is added to the initial question template and the extended question template, and a sample question is generated based on the addition result; Establish the correspondence between the sample problem and the triple, and generate the sample set based on the establishment result.

7. The method according to claim 1, characterized in that, The process of training the problem generation model using the sample set until a target problem generation model that meets the training stopping condition is obtained includes: Select sample triples from the sample set and input them into the problem generation model for processing to obtain the prediction problem corresponding to the sample triples; The loss value is calculated based on the sample problem corresponding to the sample triple and the prediction problem, and the parameters of the problem generation model are tuned according to the loss value. If the parameter-tuned problem generation model meets the training stopping condition, the parameter-tuned problem generation model will be used as the target problem generation model. The training stopping condition is that the number of iterations of the problem generation model is greater than or equal to a threshold; or the loss value of the problem generation model is less than a threshold.

8. The method according to claim 1, characterized in that, The acquisition of triples from the target knowledge base includes: Select the target knowledge base that corresponds to the target domain; Based on the entities and relationships corresponding to the target domain, the triples are extracted from the target knowledge base.

9. The method according to claim 1, characterized in that, Also includes: Extract the baseline relationship from the triples; Calculate the degree of matching between the baseline relationship and the initial problem template and the extended problem template; Based on the matching degree calculation results, establish the mapping relationship between the triples and the initial question template and the extended question template.

10. A problem generation model training device, characterized in that, include: The acquisition module is configured to retrieve triples from the target knowledge base; The creation module is configured to create an initial question template based on the triples and back-translate the initial question template to obtain an extended question template. The determination module is configured to, when the number of triples is greater than a preset threshold, select a target relation from the initial relation corresponding to the initial question template and the extended relation corresponding to the extended question template, and determine the mapping relationship between the triples and the initial question template and the extended question template based on the association relationship between the target relation and the benchmark relation contained in the triples; If the number of triples is not greater than a preset threshold, at least two target relations are selected from the initial relation and the extended relation, and the mapping relationship between the triples and the initial problem template and the extended problem template is determined based on the association relationship between the at least two target relations and the baseline relation. The training module is configured to construct a sample set based on the mapping relationship and train a problem generation model using the sample set until a target problem generation model that meets the training stopping condition is obtained.

11. A problem generation method, characterized in that, include: Get user input to generate instructions; The target triplet carried in the problem generation instruction is input into the target problem model in the method of any one of claims 1 to 9 for processing to obtain the target problem; In response to the question generation instruction, the target question is returned to the user.

12. A problem generation device, characterized in that, include: The instruction acquisition module is configured to acquire user-input questions and generate instructions. The processing module is configured to input the target triplet carried in the problem generation instruction into the target problem model in the method of any one of claims 1 to 9 for processing, so as to obtain the target problem; The return module is configured to return the target question to the user in response to the question generation instruction.

13. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 9 or 11.

14. A computer-readable storage medium storing computer instructions, characterized in that, When executed by a processor, this instruction implements the steps of the method according to any one of claims 1 to 9 or 11.