A method, system and storage medium for question generation
By combining a question generation model and a discrimination system with reinforcement learning, question knowledge information pairs that meet preset requirements are generated, which solves the problem of insufficient training data in question answering systems, realizes efficient training and fault localization of the system, and improves the performance of question answering systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-03-24
AI Technical Summary
The question-answering system lacks effective data during the training phase, making it difficult to obtain training data. Furthermore, existing testing methods are not very reliable and cannot effectively locate system faults.
Questions are generated by a question generation model and judged by a discrimination system. Rewards are output, and the question generation model is updated by reinforcement learning. Question knowledge information pairs that meet the preset requirements are generated as training data to realize the training and fault location of the question-answering system.
It provides effective training data, improves the training quality of the question-answering system, and can accurately locate system faults, thereby enhancing the performance of the question-answering system.
Smart Images

Figure CN115510205B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer applications, and in particular to a method, system, and storage medium for generating questions. Background Technology
[0002] With the rapid development of Machine Reading Comprehension (MRC) and intelligent question answering systems, question generation has received increasing attention. Question generation is an important subtask in text generation, aiming to generate relevant and fluent questions based on input data (text, knowledge bases, images, etc.). Consequently, question generation models have emerged, which can provide more training data for question answering systems, reduce manual annotation costs, and improve system performance.
[0003] During the training phase of a question-answering system, the richer and higher quality the training data, the better. However, data is generally not easy to obtain and effective data is lacking. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, system, and storage medium for generating questions, aiming to generate a question to be used as effective training data for training a question-answering system model.
[0005] In a first aspect, embodiments of this application provide a method for generating questions, the method comprising:
[0006] Based on knowledge information, questions are generated using a question generation model;
[0007] Based on the question generation model, the question is generated and the discrimination result and question knowledge information pair are obtained through the discrimination system.
[0008] The target reward is obtained by processing the discrimination result through the discrimination system.
[0009] The discrimination system returns the question knowledge information pair and the target reward to the question generation model;
[0010] The question knowledge information pairs whose target rewards meet the preset requirements in the question knowledge information pairs returned to the question generation model are used as training data;
[0011] Based on the training data, the question generation model is trained and updated using reinforcement learning.
[0012] Generate new questions using the updated question generation model.
[0013] Optionally, the discrimination system includes:
[0014] Question answering system, knowledge base information-question similarity model, and grammatical correctness judgment model;
[0015] The questions generated based on the question generation model are used to obtain discrimination results through the discrimination system, specifically including:
[0016] The knowledge base information-question similarity model obtains a first reward by judging the similarity between the knowledge information input to the question generation model and the question generated by the question generation model;
[0017] The grammar error judgment model obtains a second reward by judging whether the grammar of the input question is correct;
[0018] The question-answering system queries the answers to the questions generated by the question generation model, and obtains a third reward by judging whether the answers match the knowledge information;
[0019] The step of processing the discrimination result through the discrimination system to obtain the target reward specifically includes:
[0020] The target reward is obtained based on the first reward, the second reward, and the third reward.
[0021] Optionally, obtaining the target reward based on the first reward, the second reward, and the third reward includes:
[0022] A weighted average is calculated based on the first reward, the second reward, and the third reward, and the weighted average is used as the target reward.
[0023] Optionally, the knowledge information is stored in the knowledge base of the question-and-answer system, and the knowledge information is a set of information with a head and tail entity and a definite relationship between the entities.
[0024] Optionally, the question includes:
[0025] A question whose answer matches the knowledge information, or a question whose answer does not match the knowledge information.
[0026] Optionally, the question-knowledge information pairs that meet the preset requirements include:
[0027] The corresponding target reward is the maximum value within the range of the target reward.
[0028] Secondly, embodiments of this application provide a system for generating questions, the system comprising:
[0029] A question generation model and a discrimination system, wherein the discrimination system includes a question-answering system, and the question-answering system includes a knowledge base;
[0030] The question generation model is used to generate questions based on knowledge information.
[0031] The question-answering system is used to obtain questions from the question generation model, and the question-answering system belongs to the discrimination system;
[0032] The discrimination system is used to obtain discrimination results based on questions generated by the question generation model; to obtain a target reward by processing the discrimination results and to generate question knowledge information pairs; and to return the question knowledge information pairs and the target reward to the question generation model; wherein, the question knowledge information pairs whose target rewards meet preset requirements in the question knowledge information pairs returned to the question generation model are used as training data.
[0033] The question generation model is also used to train and update the model based on the training data through reinforcement learning; and to generate new questions using the updated question generation model.
[0034] Optionally, the discrimination system further includes:
[0035] Knowledge base information - question similarity model and grammatical correctness judgment model;
[0036] The knowledge base information-question similarity model is used to obtain a first reward by judging the similarity between the knowledge information input to the question generation model and the question generated based on the question generation model;
[0037] The grammar correctness judgment model is used to obtain a second reward by judging whether the grammar of the input question is correct;
[0038] The question-answering system is used to query the answers to the questions generated by the question generation model, and to obtain a third reward by judging whether the answers match the knowledge information.
[0039] The discrimination system is specifically used for:
[0040] The target reward is obtained based on the first reward, the second reward, and the third reward.
[0041] Optionally, the discrimination system is specifically used for:
[0042] The target reward is the weighted average of the first reward, the second reward, and the third reward.
[0043] Thirdly, embodiments of this application provide a computer storage medium storing code, wherein when the code is executed, a device running the code implements the question generation method described in any of the implementations of the first aspect.
[0044] This application provides a method, system, and storage medium for question generation. When executing the method, firstly, based on the knowledge base of the question-answering system, complete knowledge information from the knowledge base is obtained. This knowledge information is then input as an answer into a question generation model to generate a question. The question is then input into a discrimination system to obtain an answer based on the knowledge information. Simultaneously, the discrimination system outputs a reward based on the discrimination result and generates a question-answer knowledge information pair. Then, the question-answer knowledge information pair and the reward are returned to the question generation model as training data. The question generation model is updated through reinforcement learning, enabling it to continuously generate specific questions. Thus, the reward output from the discrimination system and the question-answer knowledge information pair are used to train the question generation model using reinforcement learning, continuously generating new questions and question-answer knowledge information pairs as training data. The generated questions and the answers queried from the discrimination system form question-answer pairs, which can serve as effective training data for the question-answering system. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 A flowchart for generating questions to update the model;
[0047] Figure 2 A flowchart for determining whether a target reward meets preset requirements;
[0048] Figure 3 This is a flowchart illustrating the decision-making process within the question-and-answer system.
[0049] Figure 4 A schematic diagram of the system structure for generating a type of question;
[0050] Figure 5 A schematic diagram illustrating the target reward and question knowledge information pairs generated by the discrimination system. Detailed Implementation
[0051] In existing technologies, during the training phase of various models in a question-answering system, the more training data available, the better the quality. However, data is generally difficult to obtain, and effective data is often lacking. Furthermore, after a question-answering system is deployed, methods for testing its effectiveness can be divided into manually constructing a subset of data for testing or conducting on-the-ground testing. The former is unreliable due to the diversity and volume of data, while the latter generally has potential problems and cannot be tested using this method. Therefore, finding a suitable method is crucial for pinpointing the faults of a question-answering system.
[0052] Based on this, this application proposes a method, system, and storage medium for question generation. Questions are generated through a question generation model trained using reinforcement learning. The question and its corresponding answer pair are then used as effective training data for the question-and-answer system. Simultaneously, the question serves as location data for fault detection in the question-and-answer system. The specific method is as follows:
[0053] First, based on the knowledge base of the question-answering system, complete knowledge information is obtained from the knowledge base. This knowledge information is then used as the answer input to the question generation model to generate questions. These questions are then input into a discrimination system to obtain answers based on the knowledge information, forming question-knowledge information pairs. Simultaneously, the discrimination system outputs a reward based on the discrimination result. The question-knowledge information pairs and the reward are then returned to the question generation model as training data. Reinforcement learning is used to update the question generation model, enabling it to continuously generate specific types of questions. Thus, the reward output from the discrimination system and the question-knowledge information pairs are used to train the question generation model using reinforcement learning. This continuously generates new questions and question-knowledge information pairs as training data. The generated questions and the answers retrieved from the discrimination system form question-answer pairs, which can serve as effective training data for the question-answering system. Furthermore, these question-answer pairs can help locate model faults within the question-answering system.
[0054] See Figure 1 As shown, implementing this invention includes the following steps:
[0055] Step 101: Based on knowledge information, generate questions using a question generation model.
[0056] The knowledge information is stored in the knowledge base of the question-answering system. The knowledge information is a set of information with head and tail entities and definite relationships between entities. It can be represented as a triple structure such as entity-relationship-entity. If there is one entity relationship between two entities, the relationship is called a one-hop relationship. If there are at least two entity relationships between the entities, or if the entities have at least one entity relationship, the relationship is called a multi-hop relationship. The knowledge information used in this application can be knowledge information with one-hop relationships or knowledge information with multi-hop relationships.
[0057] A knowledge base (KB) is a special type of database used for knowledge management, specifically for the collection, organization, and extraction of knowledge within a relevant domain. The knowledge in a knowledge base originates from domain experts and is a collection of domain knowledge needed to solve problems, including basic facts, rules, and other relevant information. The representation of a knowledge base is an object model, often called an ontology, containing classes, subclasses, and entities. It is a knowledge-based system containing a series of knowledge representing facts of the objective world and an inference engine, relying on certain rules and logical forms to infer new facts. Common knowledge bases include Freebase and DBpedia. Since the trained question generation model is ultimately used to generate training samples for the question-answering system, the knowledge base used here should correspond to the knowledge base involved in the final question-answering system. Depending on the application scenario and subject matter, those skilled in the art can independently choose a knowledge base and further design the specific data structure and retrieval method used by the knowledge base; this specification does not impose specific limitations on this. This application primarily focuses on a knowledge base-based question-answering system, but it can also be applied to other types of question-answering systems.
[0058] Question generation models include machine learning models that can output corresponding questions based on input knowledge information. Specifically, they can employ neural networks for question generation, such as Seq2seq and transformers with attention mechanisms, or large-scale pre-trained models like BERT and Roberta. Those skilled in the art can choose according to specific application needs, and no limitations are imposed here.
[0059] Step 102: Based on the question generation model, the question is used to obtain the discrimination result and question knowledge information pair through the discrimination system.
[0060] The question generation model utilizes knowledge information to generate questions, specifically through structural adjustments and content additions. Structural adjustments refer to modifying the structure of the question. For example, the original question, "Is the student's height 1.7m?", can be transformed into "What is 1.7m to the student?", "Whose height is 1.7m?", "Whose height is 1.7m?", etc. Content addition involves adding interrogative words, conjunctions, and distractor words to the knowledge information. Distractor words are words related to the knowledge information and can be provided by a pre-trained model within the question generation model. Pre-trained models can be Bert, Roberta, etc., while the question generation model can be a deep learning-based model, such as seq2seq or transformer. The specific types of question generation and pre-trained models can be determined by those skilled in the art based on the application scenario and are not limited here. Examples of questions generated by the question model include: "Whose height is 1.7m?", "What is 1.7m to the student?", "What is the student's height?", "The student is a boy, what is his height?", etc.
[0061] The discrimination system mainly consists of three parts: a knowledge base information-question similarity model, a grammatical correctness judgment model, and a question-answering system. This application primarily uses these three modules. Other models, such as a semantic repetition model, can also be added to the discrimination system to discriminate questions without negatively impacting the application; therefore, they are not discussed here.
[0062] The knowledge base information-question similarity model is mainly used to determine the similarity between the knowledge information input to the question generation model and the questions generated by the question generation model. For example, if the input knowledge information is "student-height-1.7m", the generated questions could be: "What is the student's height?", "What is the student's weight?", or "What is the student's height?". Taking these three questions as examples, they are input into the knowledge base information-question similarity model and compared with the knowledge base information. The similarity and the reward obtained, from highest to lowest, are: "What is the student's height?", "What is the student's height?", and "What is the student's weight?". The grammar correctness judgment model is mainly used to determine whether the grammar of the input questions is correct. For example, if the input knowledge information is "student-height-1.7m", the generated questions could be: "Who is 1.7m tall?", ... Using the three questions "Who is 1.7m tall?" and "Whose height is 1.7m?" as examples, the grammar judgment model determines that the grammar of "Who is 1.7m tall?" and "Whose height is 1.7m?" are incorrect, resulting in lower rewards, while the grammar of "Whose height is 1.7m?" is correct, resulting in higher rewards. The question-answering system then queries the answers to the questions generated by the question generation model, judging whether the answers match the knowledge information. For example, if the input knowledge information is "student-height-1.7m", the question generated by the question generation model could be "How tall is the student?". The answers to the generated questions in the question-answering system could be "1.7m" and "50kg". Taking these two answers as examples, it is determined that "1.7m" matches the knowledge information, while "50kg" does not.
[0063] The judgment process for a question-answering system is as follows: The system queries the answer corresponding to the question generated by the question generation model and determines whether the answer matches the knowledge information. During the matching process, two scenarios may occur: First, the question-answering system's knowledge base contains two or more answers with similar meanings that can answer the question generated by the question generation model; second, the question-answering system's knowledge base contains only one answer that can answer the question generated by the question generation model. For the second scenario, the answer can be directly judged against the knowledge information. For the first scenario, the specific matching methods between the answer and the knowledge information can be twofold: First, when constructing the knowledge graph, words with similar meanings are recorded and a fixed vocabulary is formed according to the mapping relationship. When querying an answer, the vocabulary is searched. Second, a word similarity model is set in the question-answering system to judge the similarity between the answer retrieved by the system and the knowledge information. When the similarity meets a threshold, the answer is considered a match for the knowledge information. The threshold can be set by those skilled in the art based on the application scenario and actual situation, and is not limited here.
[0064] Existing question-answering systems can be broadly categorized into three types based on their data sources and answering methods: Web Question Answering (WebQA) systems. WebQA systems rely on search engines, understanding and analyzing the user's question intent before using the search engine to find relevant answers across the entire internet and providing them to the user. Typical examples include the early AskJeves and AnswerBus question-answering systems.
[0065] Knowledge-Based Question Answering (KBQA) systems combine existing knowledge bases or database resources (such as Freebase, DBpedia, Yago, Zhishi.me, etc.) with information from unstructured text sources like Wikipedia and Baidu Baike. They use information extraction methods to extract valuable information, construct a knowledge graph as the backend support for the question answering system, and then combine this with knowledge reasoning and other methods to provide users with answers that demonstrate deeper semantic understanding.
[0066] Community Question Answering (CQA) systems, also known as social media-based question answering systems, rely on users providing answers to most questions. The system searches social media for questions that are semantically similar to the user's question and returns the answer to the user.
[0067] This application focuses on a knowledge base-based question-answering system, and designs a method for generating questions. The generated questions and other data information can be applied to various question-answering systems to provide them with training data samples. The subject of this application can also be other types of question-answering systems, which are not limited here.
[0068] The question-answering system in this application may include core modules such as question type identification, named entity recognition, entity linking, knowledge querying, and answer ranking. For example, if the question-answering system contains these modules, the process of obtaining the answer is as follows: the question type identification module extracts the type features of the question; the named entity recognition module extracts the mention from the question; the entity linking module maps the mention to an entity in the knowledge base; the knowledge query module queries the knowledge base for that entity to obtain a subgraph centered on that entity node, and extracts corresponding nodes or edges from the extracted subgraph according to certain rules or templates. Feature vectors representing the question and candidate knowledge information are obtained, and these are sorted by the answer ranking module to obtain the final answer. The question-answering system then matches this answer with the knowledge information.
[0069] The system performs judgments using three components: a knowledge base information-question similarity model, a grammar correctness judgment model, and a question-answering system. Based on the reward range of each component, a reward is given that matches the judgment, i.e., the result. For example, the reward range for the knowledge base information-question similarity model is [0, 1]. This means that the reward is 1 when the similarity between the input knowledge information and the question generated by the question generation model is highest, and 0 when it is lowest. The reward range for the grammar correctness judgment model is also [0, 1]. The reward is 1 if the input question is grammatically correct, and 0 if it is grammatically incorrect. The question-answering system queries the answer to the question generated by the question generation model and judges whether the answer matches the knowledge information. If they match, the reward is 0; if they do not match, the reward is 1. The aforementioned value ranges can be set by those skilled in the art according to actual circumstances and are not limited here. The discrimination system generates question-knowledge information pairs, where the question refers to the question generated by the question generation model based on the knowledge information in the question-answering system's knowledge base, and the knowledge information is the knowledge information corresponding to the question.
[0070] Step 103: Calculate the discrimination result using the discrimination system to obtain the target reward.
[0071] The target reward is derived from a series of calculations performed on the judgment result. These calculations can be performed mathematically or using a program algorithm. For mathematical calculations, the target reward can be obtained by calculating the arithmetic mean of the three corresponding sub-rewards in the judgment result. Alternatively, different weights can be assigned to the three different sub-rewards based on their importance, and the summation can yield the target reward. Any calculation method that reflects the relationship between the sub-rewards and derives the target reward can be used in this application to calculate the target reward, and no limitation is imposed here. The target reward can also be obtained using a program algorithm, such as writing a program with certain calculation rules and applying it to the judgment system. The judgment system inputs the sub-rewards into the program to obtain the target reward. No limitation is imposed here on the programming language and software used in the program.
[0072] Step 104: The discrimination system returns the question knowledge information pair and the target reward to the question generation model.
[0073] The question-knowledge information pair and the target reward can be combined into a question-knowledge information-reward pair, which is then returned to the question generation model in the form of a question-knowledge information-reward pair.
[0074] Step 105: Use the question knowledge information pairs whose target rewards meet the preset requirements in the question knowledge information pairs returned to the question generation model as training data.
[0075] The preset requirement can be a threshold set by those skilled in the art for the target reward based on actual circumstances. For example, if the discrimination system includes three modules: a knowledge base information-question similarity model, a grammar correctness judgment model, and a question-answering system, with the reward value range of the knowledge base information-question similarity model being [0, 1], the reward value range of the grammar correctness judgment model being [0, 1], and the question-answering system querying the answer corresponding to the question generated by the question generation model, determining whether the answer matches the knowledge information, a reward of 0 if they match, and a reward of 1 if they do not match, and the calculation method for the target reward being set as the arithmetic average of the corresponding sub-rewards of these three modules, then the preset range of the target reward is [0, 1], and the preset requirement can be set to 1. That is, when the target reward is 1, the preset requirement is met, and question knowledge information pairs with a target reward of 1 will be used as training data; when the target reward is not 1, the preset requirement is not met, and the corresponding question knowledge information pairs will not be used as training data to update the question generation model.
[0076] The question generation model employs a reward mechanism. Question knowledge pairs with high target rewards are given positive rewards and used as training data to update the model. Question knowledge pairs with low target rewards are given negative rewards, which can be understood as penalties. These pairs are not used as training data to update the model, but they still allow the model to learn negative information about question generation and avoid generating questions from such knowledge pairs.
[0077] Step 106: Based on the training data, train the question generation model using reinforcement learning and update the question generation model.
[0078] This application employs reinforcement learning to train a question generation model, updating it to generate new questions. Reinforcement learning involves an agent learning through trial and error, using rewards gained from interacting with the environment to guide its behavior. The goal is to maximize the agent's reward. In reinforcement learning, the reinforcement signals provided by the environment evaluate the quality of the action (usually a scalar signal), rather than instructing the reinforcement learning system (RLS) on how to generate the correct action. Because the external environment provides limited information, the RLS must learn through its own experience. In this way, the RLS acquires knowledge in an action-evaluation environment, improving its action plans to adapt to the environment. In this application, the "agent" refers to the question generation model, and the reinforcement signals provided by the environment refer to question knowledge pairs returned to the question generation model whose target reward meets preset requirements.
[0079] Step 107: Generate new questions using the updated question generation model.
[0080] In this embodiment, based on the knowledge base of the question-answering system, complete knowledge information from the knowledge base is obtained. This knowledge information is then used as the answer input to the question generation model to generate questions. The questions are then input into the discrimination system to obtain answers based on the knowledge information, forming question-answer knowledge information pairs. Simultaneously, the discrimination system outputs rewards based on the discrimination results. The question-answer knowledge information pairs and the rewards are then returned to the question generation model as training data. Reinforcement learning is used to update the question generation model, enabling it to continuously generate new questions. This method achieves question generation, and the generated questions, along with the answers retrieved from the discrimination system, form question-answer pairs that can serve as effective training data for the question-answering system. Furthermore, those skilled in the art can identify faulty models in the question-answering system based on questions that have answers in the knowledge base but cannot be correctly answered by the system, thus eliminating potential problems. The question-answering system can contain several models in a sequential order: a question intent model, a named entity recognition model, a query model, and a similarity model. The question intent model categorizes user intents into different types, such as relational queries, attribute queries, comparisons, and judgments. It designs sentence templates for matching and judgment, or identifies intents through entity links and attribute matching. For example, if an entity and attribute are directly matched, the attribute value or relation name is returned; alternatively, intents are labeled using graph computation methods. In this embodiment, it can be understood as learning from input sentence representations to complete intent classification. The named entity recognition model extracts the aforementioned entities from unstructured input text and can identify more categories of entities according to business needs. Named entities generally refer to entities in the text that have specific meaning or strong referentiality, such as entities in three main categories (entity, time, and number) and seven subcategories (person names, place names, organization names, time, date, currency, and percentage). The query model uses query languages such as SPARQL, Cypher, and PGQL to retrieve answers to questions from a knowledge base. The similarity model calculates the similarity of the information retrieved by the query model, finds the information with the highest similarity, and outputs it as the answer to the question. In addition to question intent models, named entity recognition models, query models, and similarity models, question answering systems may also contain other models. These models can be set up by those skilled in the art according to the application scenario and actual situation, and are not limited here.
[0081] For example, taking a question-answering system that contains a question intent model, a named entity recognition model, a query model, and a similarity model as an example, a question is input into the question-answering system based on knowledge information in the system's knowledge base. The system searches for and outputs an answer in the knowledge base, but the answer does not match the knowledge information. In this case, the question will be judged as a question that has an answer in the system but cannot be answered correctly. Based on this question and the answer returned by the question-and-answer system, those skilled in the art can determine that the question-and-answer system is malfunctioning. They can manually examine the execution of each module within the system, such as: first, checking whether the question intent model correctly identifies the question intent; if not, the question intent model is malfunctioning; if correct, then checking the named entity recognition model; checking whether the named entity recognition model extracts entities correctly; if not, the named entity recognition model is malfunctioning; if correct, then checking the query model; checking whether the query model retrieves the correct information; if not, the query statement used by the query model is incorrect; if correct, then checking the similarity model; and finally, checking whether the similarity calculation performed by the similarity model is correct; if not, after ruling out errors in the code (input / output, etc.), the similarity model is malfunctioning, and the troubleshooting is complete.
[0082] Figure 2 A flowchart for determining whether a target reward meets preset requirements. For example... Figure 2 As shown, step 105 in the method provided in the previous embodiment can be implemented using the following steps:
[0083] Step 201: Determine whether the target reward corresponding to the question knowledge information pair returned to the question generation model meets the preset requirements. If it does, proceed to step 202; otherwise, proceed to step 203.
[0084] If the target reward meets the preset requirements, it means that the generated question knowledge information meets the requirements for training data of the question generation model. If the question knowledge information meets the requirements, the quality of the questions generated by the question generation model trained based on this question knowledge information will be higher, and the corresponding reward will also be higher.
[0085] Step 202: If the target reward meets the preset requirements, the corresponding question knowledge information is used to generate the input question in the system.
[0086] Step 203: If the target reward does not meet the preset requirements, the corresponding question knowledge information pair is deleted, and the question generation model continues to generate questions based on the next knowledge information.
[0087] Step 203 mentions that if the target reward does not meet the preset requirements, the corresponding question-knowledge information pair will be deleted. This is because the question generation model, under reinforcement learning training, generates a large number of questions and correspondingly a large number of question-knowledge information pairs. If unsuitable question-knowledge information pairs are not deleted, it will waste system resources and cause data redundancy, leading to a longer model training time. Step 203 also mentions that the question generation model continues to generate questions based on the next piece of knowledge information. This is because if this step is not performed, and instead the knowledge information corresponding to the question in the current question-knowledge information pair is sent to the question generation model, and the model continues to generate questions based on this knowledge information, a dead loop will occur. That is, the question generation model will be unable to generate a suitable question for a certain piece of knowledge information, leading to wasted resources. The question generation model needs diversified training, allowing it to be trained on different types of knowledge information to achieve better training results. The target reward not meeting the preset requirements means that the question generated corresponding to the knowledge information does not meet the requirements. Alternatively, it can be selected that training is required to generate questions for this knowledge information within a set threshold number of times. It is understood that if the target reward meets the preset requirements, the knowledge information corresponding to the question can be trained to continue generating questions within a set threshold number of times. The set threshold number of times can be set by those skilled in the art according to the application scenario and actual situation. It is not set here. The purpose of setting the threshold number of times is to avoid wasting computing resources.
[0088] In this embodiment, step 105 of the method provided in the previous embodiment is further optimized. By deleting question knowledge information pairs whose target rewards do not meet preset requirements, the waste of system resources and data redundancy are reduced, which could slow down the model training speed. Simultaneously, the knowledge information corresponding to the questions in the question knowledge information pairs whose target rewards do not meet preset requirements is sent to the question generation model. The question generation model continues to generate questions based on the aforementioned knowledge information, allowing the question generation model to be trained more comprehensively. Furthermore, it should be noted that the main body of this embodiment can be a pre-packaged judgment module or computer program, etc. The specific implementation method can be set according to the needs of those skilled in the art and is not limited here.
[0089] The proposed solution described above includes a grammar correctness assessment model, a knowledge base information-question similarity model, and a question-answering system. To further optimize the solution, a grammar correctness assessment model and a knowledge base information-question similarity model can be added within the question-answering system to enable internal discrimination. Figure 3The flowchart for the judgment within the question-answering system, such as Figure 3 As shown, the discrimination of a question-answering system can also include the following steps:
[0090] Step 301: Input the question into the question-and-answer system;
[0091] Step 302: The grammar correctness judgment model inside the question-answering system judges the question;
[0092] Step 303: The question-answering system uses its internal knowledge base information and question similarity model to determine the question.
[0093] Step 304: Optimize the question based on the judgment result.
[0094] Optimizing questions can be done based on the grammar accuracy assessment model within the question-answering system, or it can be based on the question similarity model within the system's knowledge base. For example, given the knowledge information as "student-height-1.7m", the generated question is "Who is 1.7m tall?". The grammar accuracy assessment model within the question-answering system will assess this question and output a reward based on the result. In this case, the assessment result indicates that the question's grammar is incorrect, resulting in a low reward. The question-answering system receives the assessment result from its internal grammar accuracy assessment model and determines whether the question needs to be input into a question correction model for correction. In the example above, the question "Who is 1.7m tall?" needs to be input into the question correction model for correction. Specific correction methods can include: word order rearrangement, adding or removing words, or supplementing the question based on knowledge information.
[0095] It should be noted that in this embodiment, a grammar correctness judgment model and a knowledge base information-question similarity model are added inside the question-answering system. This does not affect the grammar correctness judgment model, the knowledge base information-question similarity model, or the question-answering system's judgment process for questions. The grammar correctness judgment model determines whether the input question is grammatically correct and outputs a corresponding reward. The knowledge base information-question similarity model determines the similarity between the knowledge information input to the question generation model and the question generated by the question generation model and outputs a corresponding reward. The question-answering system queries the answer corresponding to the question generated by the question generation model, determines whether the answer matches the knowledge information, and outputs a corresponding reward. In this embodiment, adding a grammar correctness model and a knowledge base information-question similarity model inside the question-answering system does not affect the question-answering system's judgment of the input question from the question generation model or the generation of corresponding rewards.
[0096] In this embodiment, by optimizing questions that do not meet the requirements, the question-answering system's internal judgment and optimization of questions are achieved. The question-answering system itself can be trained based on its internal judgment process, making the system's judgment of questions more accurate. This results in higher accuracy when questions are input from the question generation model into the judgment system, leading to more accurate rewards for the corresponding question knowledge information pairs. Consequently, the training of the question generation model becomes more accurate and efficient, ultimately enabling the generation of questions in the question-answering system that have corresponding answers but cannot be answered correctly. These questions allow technicians to locate the fault in the question-answering system and can also serve as effective training data for training the sub-models of the question-answering system.
[0097] Figure 4 A schematic diagram of the system structure for generating a question, such as Figure 4 As shown, the present invention also provides a system for generating questions, comprising:
[0098] Question generation model 100 and discrimination system 300, wherein the discrimination system includes question answering system 200, and question answering system 200 includes knowledge base 201;
[0099] The question generation model 100 is used to generate questions based on knowledge information using the question generation model:
[0100] The question-answering system 200 is used to obtain questions from the question generation model, and the question-answering system belongs to the discrimination system.
[0101] The discrimination system 300 is used to obtain a discrimination result based on the question generated by the question generation model; to perform calculations on the discrimination result to obtain a target reward; and to generate question knowledge information pairs, and return the question knowledge information pairs and the target reward to the question generation model; wherein, the question knowledge information pairs whose target rewards meet the preset requirements in the question knowledge information pairs returned to the question generation model are used as training data.
[0102] The question generation model 100 is also used to train and update the model based on the training data through reinforcement learning; and to generate new questions using the updated question generation model.
[0103] This invention provides a question generation system. The system generates questions based on knowledge information using a question generation model 100, and inputs these questions into a discrimination system 300 for discrimination to obtain a result. The discrimination system 300 processes the discrimination result, obtains a target reward, and generates question knowledge information pairs. The question knowledge information pairs and the target reward are then returned to the question generation model 100. Specifically, question knowledge information pairs whose target rewards meet preset requirements are used as training data. The question generation model 100 is further used to train and update itself based on the training data using reinforcement learning; the updated question generation model 100 then generates new questions.
[0104] In the optional implementation, Figure 5 A diagram illustrating the target reward and question knowledge information pairs generated by the system, such as... Figure 5 As shown, the discrimination system 300 includes: a knowledge base information-question similarity model 302, a grammar correctness judgment model 301, and a question-answering system 200. Based on the questions generated by the question generation model 100, the discrimination system 300 obtains a discrimination result, specifically including: the knowledge base information-question similarity model 302 determines the similarity between the knowledge information input to the question generation model and the questions generated by the question generation model, obtaining a first reward; the grammar correctness judgment model 301 determines whether the grammar of the input question is correct, obtaining a second reward; the question-answering system 200 queries the answer corresponding to the question generated by the question generation model, and determines whether the answer matches the knowledge information, obtaining a third reward; the discrimination system processes the discrimination result to obtain a target reward, specifically including: calculating a weighted average of the first reward, the second reward, and the third reward to obtain the target reward, while the discrimination system generates question knowledge information pairs.
[0105] The question generation system described above can generate questions, including potential unanswerable questions for question-and-answer systems, enabling those skilled in the art to analyze and locate the causes of faults and train the question-and-answer system to use it.
[0106] This application also provides corresponding devices and computer-readable storage media for implementing the solutions provided in this application.
[0107] The device includes a memory and a processor. The memory stores instructions or code, and the processor executes the instructions or code to cause the device to perform a question generation method according to any embodiment of this application.
[0108] In practical applications, the computer-readable storage medium can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0109] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0110] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0111] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0112] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0113] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating questions, characterized in that, The method includes: Based on knowledge information, an initial question is generated using a question generation model, and the structure of the initial question is adjusted and the content is added to obtain a new question. The new question is input into the discrimination system, and the discrimination system obtains a target reward and a question knowledge information pair; wherein, the target reward is obtained by calculating a weighted average of multiple rewards output by the discrimination system; the question knowledge information pair includes the new question and the knowledge information. The question knowledge information pairs that meet the preset requirements for the target reward are determined as training data; Based on the training data, the question generation model is trained using reinforcement learning to obtain an updated question generation model, which is then used to generate new questions.
2. The method according to claim 1, characterized in that, The discrimination system includes: a question-answering system, a knowledge base information-question similarity model, and a grammatical correctness judgment model; the target reward is obtained through the following methods: The knowledge base information-question similarity model obtains a first reward by judging the similarity between the knowledge information and the new question. The grammar error judgment model obtains a second reward by judging whether the grammar of the new question is correct; The question-and-answer system determines whether the answer to the new question matches the knowledge information and then receives a third reward. A weighted average is calculated based on the first reward, the second reward, and the third reward, and the weighted average is used as the target reward.
3. The method according to claim 2, characterized in that, The knowledge information is stored in the knowledge base of the question-and-answer system. The knowledge information is a set of information with a head and tail entity and a definite relationship between the entities.
4. The method according to claim 1, characterized in that, The question knowledge information pair for which the target reward meets the preset requirements includes: the question knowledge information pair for which the target reward is the maximum value.
5. A system for generating questions, characterized in that, include: Question generation model and discrimination system; The question generation model is used to generate questions based on knowledge information. The question-answering system is used to generate initial questions based on knowledge information using a question generation model, and to adjust the structure and add content to the initial questions to obtain new questions; The discrimination system is used to input the new question into the discrimination system and obtain a target reward and question knowledge information pair through the discrimination system; wherein, the target reward is obtained by calculating a weighted average of multiple rewards output by the discrimination system; the question knowledge information pair includes the new question and the knowledge information; and the question knowledge information pair whose target reward meets the preset requirements is determined as training data. The question generation model is further used to train the question generation model through reinforcement learning based on the training data to obtain an updated question generation model, so as to generate new questions according to the updated question generation model.
6. The system according to claim 5, characterized in that, The discrimination system includes: a question-answering system, a knowledge base information-question similarity model, and a grammatical correctness judgment model; The knowledge base information-question similarity model is used to obtain a first reward by judging the similarity between the knowledge information and the new question. The grammar correctness judgment model is used to obtain a second reward by judging whether the grammar of the new question is correct; The question-and-answer system is used to obtain a third reward by determining whether the answer to the new question matches the knowledge information. The discrimination system is specifically used to: calculate a weighted average based on the first reward, the second reward, and the third reward, and use the weighted average as the target reward.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an implementation program for question generation, which, when executed by a processor, implements the steps of the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Dialogue type problem generation method based on enhanced dynamic reasoning
CN109992657A
Question and answer pair generation method, device and equipment and computer readable storage medium
CN113010679A