Knowledge question answering model training method and system based on game-generating adversarial network
By using game generative adversarial networks and knowledge distillation technology in the knowledge question and answer system, the strategy of the answer generator is optimized, which solves the problems of high training sample acquisition cost, poor generalization ability and weak robustness of the existing system, and achieves a better solution. Efficient knowledge question and answer model training enhances the generalization ability and robustness of the system.
Patent Information
- Application Number
- CN202410818639.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-06-24
AI Technical Summary
Existing knowledge question and answer systems have high acquisition costs for training samples, poor generalization capabilities, and weak system robustness.
The knowledge question and answer model training method based on the game generative adversarial network is adopted. Game training is carried out by designing the environmental role Critic-agent, question generator Setter-agent and answer generator Player-agent. Combined with knowledge distillation technology, an enhanced learning framework is constructed to simulate knowledge. During the question and answer process, the answer generator strategy is optimized, and the system effect is evaluated through the test set.
It reduces sample collection costs, enhances system generalization capabilities, improves system robustness, and saves knowledge base iteration costs.
Smart Images

Figure CN118378692B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a knowledge question answering system, and in particular to a knowledge question answering model training method and system based on a game-generating adversarial network. Background Art
[0002] A knowledge base question and answer system refers to a question and answer system based on a knowledge data set. For related algorithms, please refer to the Chinese patent publication with publication number CN111563147B and the name "A method and device for entity linking in a knowledge question and answer system", which records: "A method and device for entity linking in a knowledge question and answer system. The method includes: obtaining entity mentions in a question; obtaining entities corresponding to each entity mention in the knowledge base to obtain preliminary entities; calculating feature information of each preliminary entity, wherein the feature information includes feature information of entity mentions matched by the preliminary entity, feature information of the preliminary entity and the question, and feature information of the adjacent relationship of the preliminary entity; based on the feature information of each knowledge base entity, selecting at least two preliminary entities as candidate entities; and determining the entity linking results corresponding to the entity mention in the question from the candidate entities". However, existing knowledge question and answer systems generally face problems such as high cost of obtaining training samples, poor generalization ability, and weak system robustness. Therefore, in response to these substantive problems, it is urgent to develop a new knowledge question and answer system training method and a corresponding system. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a knowledge question answering model training method and system based on a game-generating adversarial network, which can reduce the sample collection cost, enhance the system generalization ability, and improve the system robustness, in view of the shortcomings of the existing technology.
[0004] In order to solve the above technical problems, the present invention adopts the following technical solutions.
[0005] A knowledge question-answering model training method based on a game-generating adversarial network comprises the following steps: step S1, constructing an environment role Critic-agent, a question generator Setter-agent and an answer generator Player-agent; step S2, based on given knowledge points and objects, using a large language generation model to reversely construct question-answer sample pairs to form an initial training set; step S3, using the environment role Critic-agent as a judge of answer quality, and the environment role Critic-agent is used to score the answers given by the answer generator Player-agent; step S4, using the question generator Setter-agent to pose questions and form a game with the answer generator Player-agent; step S5, introducing knowledge distillation, and migrating knowledge from a pre-trained large model to a small model; step S6, constructing a test set to evaluate the system effect.
[0006] Preferably, step S2 includes the following steps: step S20, preparing knowledge points in different fields; step S21, setting related objects; step S22, based on given knowledge points and objects, generating a grammatical and semantic question description through a language model; step S23, generating corresponding natural language answers; step S24, constructing a training sample including knowledge points, objects, questions, and answers.
[0007] Preferably, in step S3, the environmental role Critic-agent evaluates the accuracy of the answer based on an evaluation function of an indicator.
[0008] Preferably, in step S4, the question generator Setter-agent and the answer generator Player-agent form a Nash equilibrium, and the Nash equilibrium condition is expressed as: i (A i , A j ) >= u i (A i , A * j ), where A i represents the strategy space of Agent i, u i (A i , A j ) represents the current benefit of Agent i facing Agent j. For any A i , A * j Agent j When other agents choose the optimal strategy, each agent should choose its own optimal strategy to form a Nash equilibrium point.
[0009] Preferably, the step S5 includes a distillation training process: step S50, inputting the sample into a preset teacher model to generate a soft label output as a training target; step S51, inputting the same sample into a preset student model for training to fit the soft label output of the teacher model; step S52, repeating the above steps to gradually improve the student model's ability to fit the teacher output; step S53, obtaining a compressed small student model that inherits the knowledge expression ability of the teacher model; step S54, obtaining a knowledge question and answer inference model based on the distillation framework.
[0010] Preferably, in step S6, the precision index Precision and the recall index Recall are introduced in the test set construction process: Precision = number of correct answers / number of retrieved answers; Recall = number of correct answers / total number of relevant answers.
[0011] Preferably, it is used to execute the above-mentioned knowledge question answering model training method based on game-generating adversarial network.
[0012] In the knowledge question-answering model training method based on the game-generating adversarial network disclosed in the present invention, firstly, three types of intelligent agents, namely, the environmental role Critic-agent, the question generator Setter-agent and the answer generator Player-agent, are designed for game training, and a reinforcement learning framework is constructed to simulate the game process of knowledge question-answering. The three types of intelligent agents form a training game through intensive interaction, so that the strategy of the answer generator Player-agent is continuously optimized, thereby enhancing the effect of knowledge question-answering. Afterwards, knowledge distillation is introduced for model compression, and a test set is constructed for system effect evaluation. Compared with the prior art, the method of the present invention can reduce the sample collection cost, enhance the system generalization ability, improve the system robustness and save the iteration cost of the knowledge base. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a flow chart of the knowledge question-answering model training method based on game-generating adversarial networks of the present invention. DETAILED DESCRIPTION
[0014] The present invention is described in more detail below with reference to the accompanying drawings and embodiments.
[0015] The present invention discloses a knowledge question answering model training method based on game generation adversarial network, see Figure 1 , which comprises the following steps:
[0016] Step S1, constructing the environment role Critic-agent, the question generator Setter-agent and the answer generator Player-agent;
[0017] Step S2, based on given knowledge points and objects, reversely construct question-answer sample pairs using a large language generation model to form an initial training set;
[0018] Step S3, using the environment role Critic-agent as a judge of the answer quality, and the environment role Critic-agent is used to score the answer given by the answer generator Player-agent;
[0019] Step S4, using the question generator Setter-agent to set questions and form a game with the answer generator Player-agent;
[0020] Step S5, introduce knowledge distillation to transfer knowledge from the pre-trained large model to the small model;
[0021] Step S6: construct a test set to evaluate the system effect.
[0022] In the above method, three types of agents are first designed for game training, namely, the environment role Critic-agent, the question generator Setter-agent, and the answer generator Player-agent, to construct a reinforcement learning framework to simulate the game process of knowledge question answering. The three types of agents include:
[0023] Critic-agent: acts as an environmental role, evaluates the quality of the answers generated by the player-agent, provides reward signals, and uses an indicator-based evaluation function to consider the accuracy, completeness, consistency, etc. of the answers;
[0024] Setter-agent: acts as a question generator, with the goal of designing questions of appropriate difficulty to form a Nash equilibrium with the player-agent. It can adjust the question-setting strategy and adjust the difficulty level for different players;
[0025] Player-agent: acts as an answer generator, with the goal of getting the highest expected reward for the questions asked by the setter. It uses a knowledge question-answering model and continuously learns to improve the accuracy of answers;
[0026] The three types of agents form a training game through intensive interaction, which continuously optimizes the strategy of the answer generator Player-agent, thereby enhancing the effect of knowledge question answering. Afterwards, knowledge distillation is introduced to compress the model, and a test set is constructed to evaluate the system effect. Compared with the prior art, the method of the present invention can reduce the sample collection cost, enhance the system generalization ability, improve the system robustness and save the iteration cost of the knowledge base.
[0027] Furthermore, the step S2 comprises the following steps:
[0028] Step S20, preparing knowledge points in different fields;
[0029] Step S21, setting related objects;
[0030] Step S22, based on the given knowledge points and objects, generate a grammatically and semantically correct question description through a language model;
[0031] Step S23, generating a corresponding natural language answer;
[0032] Step S24, constructing training samples including knowledge points, objects, questions, and answers.
[0033] Among them, knowledge points in different fields include but are not limited to historical events, scientific formulas, natural sciences, language and literature, etc. At the same time, related objects include but are not limited to specific historical figures, chemical elements, ancient poems, etc.
[0034] As a preferred method, in step S3, the environmental role Critic-agent evaluates the accuracy of the answer based on the evaluation function of the indicator. In a preferred embodiment of the present invention, after the environmental role Critic-agent is constructed, it is used as a judge of the quality of the answer, acts as an environmental role, evaluates the quality of the answer generated by the player-agent, and provides a reward signal. At the same time, an evaluation function based on the indicator is used to consider the accuracy, completeness, consistency, etc. of the answer.
[0035] In step S4 of this embodiment, the question generator Setter-agent and the answer generator Player-agent form a Nash equilibrium, and the Nash equilibrium condition is expressed as:
[0036] u i (A i , A j ) >= u i (A i , A * j );
[0037] Among them, A irepresents the strategy space of Agent i, u i (A i , A j ) represents the current benefit of Agent i facing Agent j. For any A i , A * j Agent j When other agents choose the optimal strategy, each agent should choose its own optimal strategy to form a Nash equilibrium point.
[0038] In the above algorithm, Agent refers to an individual entity or an agent of an individual entity in the system. In the context of the question generator and the answer generator, Agent can refer to different parts or roles in the system, and can also be understood as an independent operating unit in these two modules. In the Nash equilibrium condition of this embodiment, Agent i represents the question generator (Setter-agent), and Agent j represents the answer generator (Player-agent). The two represent the two main roles in the entire system, one responsible for generating questions and the other responsible for generating answers.
[0039] The above scenario is a relatively simple game scenario, in which there are two agents: the setter-agent and the player-agent. The setter is responsible for setting questions, and the player is responsible for answering questions. The strategy space between the setter and the player can be described as:
[0040] The strategy space A of the questioner i : The question setter can choose different questions to ask the answerers;
[0041] The answerer's strategy space A j : The respondent can choose different answers to answer the question asked by the questioner.
[0042] In this scenario, the benefits of the Setter-agent and the Player-agent can be defined as follows (for example):
[0043] If the respondent answers the question correctly, the questioner needs to pay 5 points and the respondent gets 5 points.
[0044] If the respondent answers the question asked by the questioner incorrectly, the questioner receives 1 point and the respondent loses 1 point.
[0045] The goal of this embodiment is to enable the questioner to maximize his profit by learning a set of strategies. Now link this example with the Nash equilibrium condition in the above embodiment, we have:
[0046] In this situation, the condition for the Setter-agent and the Player-agent to form a Nash equilibrium can be expressed as follows: For any strategy A of the Setter-agent i , the optimal strategy of the answerer is A j , the profit u obtained by the questioner i (A i , A j ) needs to be greater than or equal to the profit u of the questioner when facing the optimal strategy of the answerer i (A i , A * j ).
[0047] In practical applications, the question setter needs to choose a strategy that maximizes the benefit when the answerer adopts the optimal strategy. Therefore, through the learning process, the question setter needs to find a question-setting strategy that maximizes the benefit when the answerer adopts the optimal strategy, and even when the answerer reaches the optimal strategy, the question setter can ensure that he or she obtains the maximum profit.
[0048] In this embodiment, Setter-Agent, as a question generator, aims to design questions of moderate difficulty and form a Nash equilibrium with Player-Agent. Its goal is to create challenging questions by adjusting the question generation strategy and to be able to adapt to the characteristics of different players. In addition, Setter-Agent can also adjust the content and difficulty of the questions according to the characteristics of different player-agents, such as age, occupation, gender, etc., to make the questions more targeted and personalized.
[0049] In a preferred embodiment of the present invention, the Nash equilibrium condition is further described:
[0050] 1. For each Agent_i, Setter-Agent generates questions through strategies to ensure that Agent_i has no motivation to deviate from its selected strategy when other agents choose strategies;
[0051] 2. Nash equilibrium ensures a stable state in which no agent has an incentive to unilaterally change its strategy because doing so will not lead to a better outcome;
[0052] 3. The strategy space Ai represents the set of all possible strategies that Agent i can choose. The Nash equilibrium condition holds for any strategy Ai chosen by Agent_i when other agents play the game under optimal conditions;
[0053] 4. The role of the Setter-Agent is to dynamically adjust the question generation strategy, taking into account the characteristics of the Player-Agent. This ensures that the questions remain challenging while being relevant and engaging to the various individuals participating in the game;
[0054] In summary, Setter-Agent aims to generate strategically challenging problems and adhere to the Nash equilibrium conditions while adjusting to the unique characteristics of each Player-Agent to achieve a balance point.
[0055] In this embodiment, the Player-agent acts as an answer generator, with the goal of obtaining the highest expected reward for the questions raised by the setter. It adopts a knowledge question-answering model and continuously learns to improve the accuracy of answers.
[0056] As a preferred method, in step S5, knowledge distillation technology is used to transfer knowledge from a pre-trained large model to a small model, thereby obtaining a smaller and faster knowledge question-answering model. The knowledge distillation framework includes a teacher model and a student model. The teacher model is a large-scale model trained in advance, and the student model is a lightweight small model. The two are combined to perform a distillation training process:
[0057] Step S50, input the sample into a preset teacher model to generate a soft label output as a training target;
[0058] Step S51, input the same sample into the preset student model for training, so as to fit the soft label output of the teacher model;
[0059] Step S52, repeat the above steps to gradually improve the student model's ability to fit the teacher output;
[0060] Step S53, obtaining a compressed small student model that inherits the knowledge expression capability of the teacher model;
[0061] Step S54, based on the application of the distillation framework and process, a smaller and faster knowledge question answering inference model is obtained.
[0062] Furthermore, in step S6, the precision index and the recall index are introduced in the test set construction process:
[0063] Precision = number of correct answers / number of retrieved answers;
[0064] Recall = number of correct answers / total number of relevant answers.
[0065] Based on the above steps, a question-and-answer test set with different difficulty levels and fields is constructed to evaluate the model's answer accuracy, response speed, generalization ability and other indicators as a verification of the system's effectiveness.
[0066] On this basis, the present invention also relates to a knowledge question answering system based on a game-generating adversarial network, which is used to execute the knowledge question answering model training method based on a game-generating adversarial network described above. Compared with traditional knowledge question answering systems and methods, the present invention can quickly construct a large number of high-quality training samples, reduce the cost of manual annotation, and help increase the scale and coverage of data sets.
[0067] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the technical scope of the present invention should be included in the scope of protection of the present invention.
Claims
1. A knowledge question answering model training method based on game-generating adversarial networks, characterized in that: The steps include: Step S1, constructing the environment role Critic-agent, the question generator Setter-agent and the answer generator Player-agent; Step S2, based on given knowledge points and objects, reversely construct question-answer sample pairs using a large language generation model to form an initial training set; Step S3, using the environment role Critic-agent as a judge of the answer quality, and the environment role Critic-agent is used to score the answer given by the answer generator Player-agent; Step S4, using the question generator Setter-agent to set questions and form a game with the answer generator Player-agent; Step S5, introduce knowledge distillation to transfer knowledge from the pre-trained large model to the small model; Step S6, construct a test set to evaluate the system effect; The step S2 comprises the following steps: Step S20, preparing knowledge points in different fields; Step S21, setting related objects; Step S22, based on the given knowledge points and objects, generate a grammatically and semantically correct question description through a language model; Step S23, generating a corresponding natural language answer; Step S24, constructing a training sample including knowledge points, objects, questions, and answers; In step S4, the question generator Setter-agent and the answer generator Player-agent form a Nash equilibrium, and the Nash equilibrium condition is expressed as: u i (A i ,A j ) >= u i (A i ,A * j ); in, A i represent Agent i The strategy space, u i ( A i , A j ) indicates the current Agent i face Agent j The income at that time, for Any A i , A * j yes Agent j The optimal strategy is when other Agent When choosing the optimal strategy, each Agent You should choose your optimal strategy to form a Nash equilibrium point; The step S5 includes the distillation training process: Step S50, input the sample into a preset teacher model to generate a soft label output as a training target; Step S51, input the same sample into the preset student model for training, so as to fit the soft label output of the teacher model; Step S52, repeating steps S50 to S51, gradually improving the student model's ability to fit the teacher output; Step S53, obtaining a compressed small student model that inherits the knowledge expression capability of the teacher model; Step S54, obtaining a knowledge question answering inference model based on the distillation framework.
2. The knowledge question answering model training method based on game-generating adversarial networks according to claim 1, characterized in that: In step S3, the environmental role Critic-agent evaluates the accuracy of the answer based on the evaluation function of the indicator.
3. The knowledge question answering model training method based on game-generating adversarial networks according to claim 1, characterized in that: In step S6, the precision index and the recall index are introduced in the test set construction process: Precision = number of correct answers / number of retrieved answers; Recall = number of correct answers / total number of relevant answers.
Citation Information
Patent Citations
A method and apparatus for entity linking in a knowledge question answering system
CN111563147B
Problem generation method based on progressive multi-discriminator
CN109271483A
Intelligent question-answering method and related device
CN110019732A
Knowledge graph embedding compression method based on knowledge graph distillation
CN113987196A
Adversarial distillation method and device based on large language model and storage medium
CN117556887A
