Interactive generation model training method, and generative interaction implementation method and device
The iterative optimization of generative dialogue systems ensures safety by aligning responses with human safety norms, addressing output risks through a two-stage optimization process that enhances compliance and reduces inappropriate responses.
Patent Information
- Application Number
- JP2024098811
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-30
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Generative dialogue systems face challenges in ensuring output safety, as they may generate inappropriate or harmful responses due to noise, bias, and errors in training data, which can lead to legal or moral liabilities and profit impairment.
An interactive generative model training method that iteratively optimizes the model to align responses with target safety norms by alternately repeating safety norm updates and model optimizations, using a two-stage optimization process involving supervised learning and reinforcement learning to enhance output safety.
The method continuously improves the safety of generated responses by aligning them with human safety values, reducing the risk of inappropriate outputs and enhancing compliance with safety standards across various content areas and application scenes.
Smart Images

Figure 2024120027000001
Abstract
Description
[Technical field]
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to interactive generative model training and generative dialogue realization methods and devices in the fields of deep learning, natural language processing, and intelligent dialogue. [Background technology]
[0002] A generative dialogue system is a method that uses deep learning technology to directly generate responses based on dialogue input. With the development of artificial intelligence technology, generative dialogue systems are widely applied in different scenarios as a new natural language processing task. However, in practical applications, generative dialogue systems also face some challenges and risks, such as output safety issues. Summary of the Invention [Problem to be solved by the invention]
[0003] The present disclosure provides an interactive generative model training, generative dialogue realization method and apparatus. [Means for solving the problem]
[0004] The interactive generative model training method is In response to determining that an update has been made to the safety norm, the updated safety norm is set as a target safety norm, and an interactive input corresponding to the current optimization is determined based on the target safety norm, the update being an update to the original safety norm when it is determined that the interactive generative model after the closest one optimization does not meet the online requirements; and optimizing the interactive generative model based on the interactive input so that responses generated by the interactive generative model conform to the principles of the target safety norm, wherein the interactive generative model is used to generate responses corresponding to the interactive input.
[0005] The method for realizing generative dialogue is as follows: obtaining a dialogue input to be processed; The method includes a step of using an interactive generative model to generate a response corresponding to the pending interactive input, the interactive generative model being an interactive generative model that matches online requirements obtained by N iterative optimizations, where N is a positive integer greater than 1, each optimization including, in response to determining that an update has been generated in a safety criterion, optimizing the interactive generative model based on the determined interactive input according to a principle that the response generated by the interactive generative model matches a target safety criterion, the target safety criterion being the safety criterion after the update, the determined interactive input being an interactive input corresponding to the current optimization determined based on the target safety criterion, and the update being an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not match the online requirements.
[0006] The interactive generative model training apparatus includes a preprocessing module and a model optimization module, The pre-processing module is used to determine, in response to determining that an update has been generated in the safety norm, the updated safety norm as a target safety norm, and determine an interactive input corresponding to the current optimization based on the target safety norm, the update being an update to the original safety norm when it is determined that the interactive generative model after the closest one optimization does not meet the online requirements; The model optimization module is used to optimize the interactive generative model based on the interactive input so that responses generated by the interactive generative model conform to the principles of the target safety norm, and the interactive generative model is used to generate responses corresponding to the interactive input.
[0007] The generative dialogue realization device includes an input acquisition module and a response generation module; the input acquisition module is used to acquire dialogue input to be processed; The response generation module is used to generate a response corresponding to the pending dialogue input using an interactive generative model, the interactive generative model being an interactive generative model that matches online requirements obtained by N iterative optimizations, where N is a positive integer greater than 1, and each optimization includes, in response to determining that an update has been generated in a safety criterion, optimizing the interactive generative model based on the determined dialogue input according to a principle that the response generated by the interactive generative model matches a target safety criterion, the target safety criterion is the safety criterion after the update, the determined dialogue input is a dialogue input corresponding to the current optimization determined based on the target safety criterion, and the update is an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not match the online requirements.
[0008] Electronic devices include: At least one processor; a memory in communication with the at least one processor; The memory stores instructions executable by the at least one processor that, when executed by the at least one processor, cause the at least one processor to perform the method.
[0009] A non-transitory computer readable storage medium having computer instructions stored thereon that cause a computer to perform the method.
[0010] The computer program product comprises computer programs / instructions which, when executed by a processor, implement the method.
[0011] It should be understood that the contents described herein are not intended to identify key or important features of the embodiments of the present disclosure, nor should they be used to limit the scope of the present disclosure. Other features of the present disclosure can be readily understood throughout the following specification. [Brief description of the drawings]
[0012] The drawings are for a better understanding of the present application, but do not limit the present application. [Figure 1] 1 is a flowchart of an embodiment of the interactive generative model training method of the present disclosure. [Diagram 2] FIG. 1 is a schematic diagram of a conventional interactive generative model training and working method. [Diagram 3] FIG. 2 is a schematic diagram of an iterative optimization scheme for safety disciplines and safety systems of the present disclosure. [Figure 4] FIG. 2 is a schematic diagram of the relationship between the baseline model and the target model of the present disclosure. [Diagram 5] FIG. 2 is a schematic diagram of the global optimization scheme for the safety system of the present disclosure. [Figure 6] 2 is a flowchart of an embodiment of the method for realizing generative dialogue of the present disclosure. [Figure 7] FIG. 7 is a structural schematic diagram of an embodiment 700 of the interactive generative model training apparatus of the present disclosure. [Figure 8] FIG. 8 is a structural schematic diagram of the configuration of the generation-type dialogue realization device 800 of the present disclosure. [Figure 9] 9 shows a schematic block diagram of an electronic device 900 in which embodiments of the present disclosure can be implemented. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Hereinafter, the embodiments of the present application will be described based on the drawings. In order to facilitate retention, various details of the embodiments of the present application are included, and they should be regarded as merely examples. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of simplicity, the following description omits the description of well-known functions and structures.
[0014] Furthermore, the term "and / or" in this specification describes only the relation between related objects and indicates that three types of relations can exist, for example, A and / or B can indicate three cases: only A exists, A and B exist simultaneously, or only B exists. It should be noted that the sign " / " generally indicates that the related objects before and after it are in an "or" relation.
[0015] 1 is a flowchart of an embodiment of the interactive generative model training method of the present disclosure. As shown in FIG. 1, the method includes the following specific implementations:
[0016] In step 101, in response to determining that an update has been generated in the safety norm, the updated safety norm is set as a target safety norm, and an interactive input (query) corresponding to the current optimization is determined based on the target safety norm, where the update is an update to the original safety norm when it is determined that the interactive generative model after the closest optimization does not meet the online requirements.
[0017] In step 102, the interactive generative model is optimized based on the interactive input according to the principle that the response generated by the interactive generative model conforms to the target safety norm, and the interactive generative model is used to generate a response corresponding to the interactive input.
[0018] A generative dialogue system generates responses based on a deep learning model, i.e., a dialogue-based generative model, but the dialogue-based generative model is usually obtained after learning language rules and knowledge from a large number of training samples (corpora). As shown in FIG. 2, FIG. 2 is a schematic diagram of the training and working method of a conventional dialogue-based generative model. Accordingly, the dialogue-based generative model may be influenced by noise, bias, errors, etc. present in the corpus, causing inappropriate or harmful responses, which may damage the user's feelings, trust, or interests, and may even cause legal or moral liability. Therefore, how to improve the output safety of the dialogue-based generative model is an issue that needs to be urgently solved.
[0019] In practical applications, the interactive generation model faces content limitations and the need to simultaneously face various possible task forms, such as chat, information question and answer, text translation, text creation, code creation, etc., rather than a single, formatted dialogue input. This determines that the input and output of the model may be any text form, and its safety solution also needs to consider various possibilities simultaneously, making it difficult to achieve the ideal state in one go.
[0020] Accordingly, in the above-mentioned method embodiment, a gradual iterative optimization method of the interactive generative model is provided, through alternating iteration and continuous optimization of the two parts of the safety norm and the interactive generative model, the output safety of the interactive generative model can be continuously improved, and finally the responses generated by the interactive generative model can be aligned with human safety values, etc.
[0021] The target of safety norms is to define standards that meet human safety values, and the most core function of the norms is to answer what answers are safe.
[0022] Preferably, the safety norms may include evaluation norms of at least one evaluation dimension each corresponding to a different combination, and any combination is respectively composed of one content area and one application scene, the content area being a safety content area for generative interaction, and the application scene being an application scene for generative interaction.
[0023] For example, content areas can include politics, law, pornography, morality and values, etc., and application scenes can include chatting, information questions and answers, text translation, text creation, code creation, etc. In the same content area, safety standards are different in different application scenes, so it is necessary to combine the two to subdivide safety norms.
[0024] One content area and one application scene can constitute one combination, and accordingly, assuming that there are three content areas (the numbers are for illustrative purposes only), namely content area 1, content area 2, and content area 3, and three application scenes, namely application scene 1, application scene 2, and application scene 3, the following combinations can be obtained: content area 1+application scene 1, content area 1+application scene 2, content area 1+application scene 3, content area 2+application scene 1, content area 2+application scene 2, content area 2+application scene 3, content area 3+application scene 1, content area 3+application scene 2, and content area 3+application scene 3.
[0025] Each combination can correspond to evaluation criteria of one or more evaluation dimensions, for example, corresponding to one evaluation dimension, namely whether it is safe or not, or corresponding to three evaluation dimensions, respectively, namely whether it is safe or not, whether the knowledge is accurate or not, and whether the content is rich or not. No matter how many evaluation dimensions are corresponding to it, the evaluation dimension of whether it is safe or not usually exists, that is, it is the most basic, and the other evaluation dimensions are all further optimized on this basis.
[0026] For each combination, different evaluation dimensions can correspond to different evaluation criteria. For example, for the combination of content area 1 + application scene 1, assume that there are two evaluation dimensions, which are whether it is safe and whether the knowledge is accurate, and then the two evaluation dimensions correspond to different evaluation criteria, i.e., the evaluation criteria that need to be met when the evaluation is safe and the evaluation criteria that need to be met when the evaluation is knowledge accurate.
[0027] As can be seen from the above, the above processing method can respectively establish corresponding evaluation criteria for different content domains, different application scenes, and different evaluation dimensions, so as to improve the accuracy of subsequent processing results, etc.
[0028] The safety norm and the safety system are alternately iterated and constantly optimized, in which the safety system may include an interactive generation model and a detection model, and may be optimized under the guidance of the safety norm.
[0029] Fig. 3 is a schematic diagram of the iterative optimization method of the safety norm and the safety system disclosed in the present invention. As shown in Fig. 3, in the initial stage, an expert can determine a version of the safety norm based on experience, etc., and then optimize the safety system based on the safety norm. After optimizing the safety system, the expert can evaluate whether the interactive generation model therein meets the online requirements, if not, the safety norm can be updated based on the safety defects (exposed safety problems) existing in the safety system evaluated by the expert, for example, the expert can carry out a simulation attack on the safety system to determine the existing safety defects, and after the safety norm is updated, the optimization of the safety system can be performed again based on the updated safety norm, and the above process can be repeated continuously.
[0030] Preferably, the occurrence of an update to the safety norm can include one or any combination of the following: adding a combination and an evaluation norm of at least one corresponding evaluation dimension, adding an evaluation dimension and a corresponding evaluation norm for the original combination, and adjusting the original evaluation norm. That is, the evaluation norm of the combination and at least one corresponding evaluation dimension can be newly added to the safety norm, and one or more evaluation dimensions and corresponding evaluation norms can be newly added for some or some original combinations, and the original evaluation norm (e.g., subdivision) can also be adjusted, which is very flexible and convenient.
[0031] For ease of explanation, the updated safety norm is called the target safety norm, and the dialogue input corresponding to the current optimization (i.e., optimization performed on the safety system) can be determined based on the target safety norm.
[0032] Preferably, a first set of dialogue inputs can be obtained, and the dialogue inputs therein are dialogue inputs corresponding to the current optimization, the first set of dialogue inputs includes at least dialogue inputs corresponding to combinations for which an update has been generated, the first set of dialogue inputs meets a predetermined condition that the proportion of the number of dialogue inputs of the first type is greater than the proportion of the number of dialogue inputs of the second type, the first type of dialogue inputs are dialogue inputs corresponding to combinations for which an update has been generated, and the second type of dialogue inputs are dialogue inputs corresponding to combinations for which an update has not been generated.
[0033] For example, assuming that the safety norm includes nine combinations, which are combination 1 to combination 9, and updating combination 1 and combination 2, the first dialogue input set may include more dialogue inputs corresponding to combination 1 and combination 2, may include a relatively small amount of dialogue inputs corresponding to other combinations, or may not directly include dialogue inputs corresponding to other combinations. For example, assuming that combination 1 is law + information question and answer, the corresponding dialogue input may be problem information related to the law.
[0034] Through the above process, it is possible to realize focused optimization of the contents updated according to the safety standard, thereby improving the optimization effect and the optimization efficiency.
[0035] The dialogue inputs in the first dialogue input set can be obtained by being selected from user utterances of dialogue product services that have already been publicly deployed, by being provided by experts based on safety norms, by being automatically generated by a model, etc., and the specific manner is not limited.
[0036] Based on the interaction inputs in the first interaction input set, the safety system can be optimized according to a principle whereby responses generated by the interactive generative model conform to a target safety norm.
[0037] Preferably, some or all of the dialogue inputs are selected from the first dialogue input set to form a second dialogue input set, which meets the predetermined condition, and an dialogue generative model is used to generate responses corresponding to each dialogue input in the second dialogue input set to form the first response set; the dialogue generative model and the detection model are optimized based on the first response set and the target safety norm; some or all of the dialogue inputs are selected from the first dialogue input set to form a third dialogue input set, which meets the predetermined condition, and the optimized dialogue generative model is used to generate responses corresponding to each dialogue input in the third dialogue input set to form the second response set; the optimized dialogue generative model can be re-optimized based on the second response set and the optimized detection model, and the detection model performs safety detection on the generated responses.
[0038] The safety system includes an interactive generative model and a detection model, and whether optimizing the optimized interactive generative model or optimizing the optimized detection model, the ultimate purpose is to improve the output safety of the interactive generative model.
[0039] The interactive generative model may be a pre-trained and obtained model, for example, a large-scale language model based on Transformer, which is trained and obtained based on a large number of training samples and contains abundant knowledge, but the generated response may be a safety risk and must be consistent with human safety values, after which it can be actually deployed online, and accordingly, the pre-trained interactive generative model can be optimized by the method described in the present disclosure.
[0040] The detection model may be used to perform safety detection on the responses generated by the interactive generative model to determine whether a safety risk, etc. exists.
[0041] As can be seen from the above, the above optimization method is a two-stage optimization method. In the first stage, the interactive generative model and the detection model are optimized, and the optimized interactive generative model and the optimized detection model are obtained. In the second stage, the optimized detection model is used to re-optimize the optimized interactive generative model. That is, in one iterative optimization process, two optimizations for the interactive generative model can be realized, and the two optimizations adopt different implementation methods to further improve the optimization effect, etc.
[0042] The following provides a detailed description of the specific implementation of the first and second steps.
[0043] 1) First stage A part or all of the dialogue inputs can be selected from the first dialogue input set to form a second dialogue input set, and the second dialogue input set must meet the predetermined condition, i.e., the proportion of the number of the first type dialogue inputs therein is greater than the proportion of the number of the second type dialogue inputs therein. Since the latter involves manual labeling, in order to reduce the amount of work, etc., the second dialogue input set usually includes only a part of the dialogue inputs in the first dialogue input set, and the specific number is not limited.
[0044] Then, the interactive generation model can be used to generate replies corresponding to each dialogue input in the second dialogue input set, respectively, to constitute a first reply set, and preferably, the first reply set can include M replies generated respectively for each dialogue input in the second dialogue input set, where M is a positive integer greater than 1, and the specific value can be determined according to actual needs, that is, multiple replies can be generated respectively for each dialogue input in the second dialogue input set.
[0045] Further, the interactive generation model and the detection model can be optimized based on the first response set and the target safety criterion. Preferably, the following processing can be performed for any dialogue input in the second dialogue input set, the processing includes taking the dialogue input as a dialogue input to be processed, obtaining each candidate response corresponding to the dialogue input to be processed and a manual labeling result of each candidate response, the number of the candidate responses is M or more, the candidate responses include responses generated for the dialogue input to be processed and / or responses manually modified for the responses generated for the dialogue input to be processed, the manual labeling results of any candidate responses include labeling results after manually performing safety labeling on the candidate response based on the target safety criterion, constructing training samples based on the dialogue input to be processed, each candidate response, and the manual labeling results of each candidate response, and optimizing the interactive generation model and the detection model using the training samples.
[0046] Also, preferably, for any candidate response, the labeling result after performing the safety labeling can include evaluation labels corresponding to different evaluation dimensions of the labeled candidate response based on evaluation criteria of different evaluation dimensions of combinations corresponding to dialogue inputs waiting to be manually processed, and the evaluation labels either match the corresponding evaluation criteria (Yes) or do not match the corresponding evaluation criteria (No).
[0047] Each of the dialogue inputs in the second dialogue input set can be treated as a dialogue input to be processed, and can be processed in the same manner. Specifically, suppose six responses are generated for a dialogue input to be processed, which are responses 1 to 6, and then multiple candidate responses can be generated based on the six responses, and the specific number is not limited, and can be, for example, six or more. Usually, the candidate responses should include various safety status responses as much as possible, for example, the evaluation labels of each evaluation dimension are all responses that match the corresponding evaluation criteria, the partial evaluation labels match the corresponding evaluation criteria, and the remaining evaluation labels are responses that do not match the corresponding evaluation criteria, and the evaluation labels of each evaluation dimension are all responses that do not match the corresponding evaluation criteria, etc. Also, some or all of the responses in the six responses can be directly used as candidate responses, or certain modifications can be made to some or all of the six responses to obtain the required safety status response, etc.
[0048] The above process can be called a safety data labeling process, and the purpose of the safety data labeling is to provide data support for the interactive generative model and the detection model, so as to optimize the interactive generative model and the detection model.
[0049] Preferably, a first type of training sample and a second type of training sample can be constructed respectively, the first type of training sample can be used to adopt a supervised learning method to optimize the interactive generative model, and the second type of training sample can be used to adopt a supervised learning method to optimize the detection model.
[0050] That is, appropriate training sample construction methods are adopted for the interactive generative model and the detection model, respectively, and model optimization is performed accordingly, so as to improve the model optimization effect.
[0051] Preferably, the method for constructing the first type of training sample includes selecting a candidate response that meets the following condition from each candidate response, wherein the condition is that the evaluation labels of different evaluation dimensions all meet corresponding evaluation criteria, and constituting each selected candidate response and the waiting dialogue input as one first type training sample.
[0052] For example, assume that the number of candidate replies is 12, and two of them meet the condition that "the evaluation labels of different evaluation dimensions all match the corresponding evaluation criteria", then these two candidate replies can respectively constitute the dialogue input to be processed and the training sample, and two training samples can be obtained.
[0053] For each dialogue input in the second dialogue input set, a training sample, i.e., a first type of training sample, can be generated by the above-mentioned method, and the generated first type of training sample can be used to optimize the dialogue generation model. Specifically, the dialogue generation model scores the candidate answers in the first type of training sample, calculates a negative log-likelihood loss according to the scoring, and minimizes the loss by using a gradient descent method, so that the dialogue generation model tends to generate corresponding candidate answers in the first type of training sample for the dialogue input in the first type of training sample, and achieves the purpose of model optimization.
[0054] In addition, for the waiting dialogue input, a total score for each candidate response can be obtained, and the higher the total score, the higher the security; the detection model can include classification detection models corresponding to different evaluation dimensions from the overall detection model; the second type of training sample can include a first subtype training sample and a second subtype training sample, and the first subtype training sample can include two candidate responses with different total scores, a waiting dialogue input, and a sample label, and the sample label is used to indicate the candidate response with the higher overall score among the two candidate responses; the second subtype training sample can include one candidate response, a waiting dialogue input, and one evaluation label for the candidate response; and accordingly, optimizing the detection model can include optimizing the overall detection model using the first subtype training sample, and optimizing the classification detection model using the second subtype training sample including the evaluation label of the evaluation dimension corresponding to the classification detection model, for any classification detection model. The overall detection model and each classification detection model may all be Transformer-based models.
[0055] For example, assuming there are 12 candidate replies, each of which corresponds to three evaluation labels, the overall score of each candidate reply can be determined based on the three evaluation labels. A possible implementation method can be to set different weights for different evaluation labels, for example, the weight corresponding to the evaluation dimension of whether it is safe is the highest, and the weights of the other evaluation dimensions are all lower than this evaluation dimension. If the evaluation label is Yes (matches the corresponding evaluation criterion), then the value can be 1; otherwise, the value can be 0. Accordingly, for any candidate reply, the overall score of the candidate reply can be calculated based on the values of the three evaluation labels and their corresponding weights.
[0056] In order to better optimize the interactive generative model and make it more likely to generate a safe response, the number of detection models may be multiple, i.e., it may include one overall detection model and classification detection models corresponding to different evaluation dimensions, thereby providing judgment signals from aspects such as overall safety and different evaluation dimensions, which are used to optimize the interactive generative model, and accordingly improving the optimization effect, etc.
[0057] In addition, as can be seen from the above, in the above processing method, appropriate optimization methods are respectively adopted for the comprehensive detection model and the classification detection model, so as to further improve the optimization effect and the like.
[0058] Wherein, for the overall detection model, a first subtype of training sample can be constructed, which can include two candidate replies with different overall scores, a dialogue input to be processed, and a sample label, and the sample label is used to indicate the candidate reply with the higher overall score among the two candidate replies.
[0059] For example, assuming there are 12 candidate replies, multiple first subtype training samples can be constructed by combining two and two, and each first subtype training sample can include two candidate replies with different overall scores, a dialogue input waiting to be processed, and a sample label to indicate which of the two candidate replies has a higher overall score.
[0060] For each dialogue input in the second dialogue input set, a training sample of a first subtype can be constructed by the above-mentioned method, and the constructed training sample of the first subtype can be used to optimize the overall detection model, which can similarly adopt negative log-likelihood loss and gradient descent methods, thereby allowing the overall detection model to learn how to distinguish between the good and bad quality of different candidate replies.
[0061] Each training sample of the second subtype may include one candidate response, a pending dialogue input, and one rating label for the candidate response.
[0062] Also, for each dialogue input in the second dialogue input set, a training sample of the second subtype can be constructed respectively by the above-mentioned method.
[0063] Accordingly, the second subtype of training samples can be used to optimize classification detection models corresponding to different evaluation dimensions, respectively. For example, assuming that there are evaluation dimension 1, evaluation dimension 2, and evaluation dimension 3, the second subtype of training samples including evaluation labels corresponding to evaluation dimension 1 can be used to optimize the classification detection model corresponding to evaluation dimension 1, the second subtype of training samples including evaluation labels corresponding to evaluation dimension 2 can be used to optimize the classification detection model corresponding to evaluation dimension 2, and the second subtype of training samples including evaluation labels corresponding to evaluation dimension 3 can be used to optimize the classification detection model corresponding to evaluation dimension 3.
[0064] 2) Second stage After completing the first stage optimization, the second stage optimization can be performed, that is, the optimized detection model can be borrowed to re-optimize the optimized interactive generative model.
[0065] First, a part or all of the dialogue inputs can be selected from the first dialogue input set to form a third dialogue input set, and the third dialogue input set needs to meet the predetermined condition, i.e., the proportion of the number of the first type dialogue inputs therein is greater than the proportion of the number of the second type dialogue inputs therein. In order to improve the optimization effect, the third dialogue input set can include all the dialogue inputs in the first dialogue input set.
[0066] The optimized generative interactive model may then be used to generate responses corresponding to each of the dialogue inputs in the third set of dialogue inputs to form a second set of responses. Preferably, the second set of responses may include one response generated for each of the dialogue inputs in the third set of dialogue inputs.
[0067] Furthermore, the optimized interactive generative model can be re-optimized based on the second answer set and the optimized detection model. Preferably, the optimized detection model can be used to perform safety detection for each answer in the second answer set, respectively, and the optimized interactive generative model can be re-optimized based on the safety detection result of each answer by adopting a reinforcement learning method. The adopted reinforcement learning algorithm can be a proximal policy optimization (PPO) algorithm, etc.
[0068] That is, the detection model can be adopted as the judge to re-optimize the optimized interactive generative model, so as to further improve the optimization effect of the interactive generative model.
[0069] Preferably, the detection model may include a classification detection model corresponding to the overall detection model and different evaluation dimensions, and accordingly, for any answer in the second answer set, the following processing may be performed, in which the processing obtains a classification detection result corresponding to the returned overall detection result and the different classification detection model, respectively, combines the overall detection result and the different classification detection result to determine a reward corresponding to the answer, and uses the answer, the dialogue input corresponding to the answer, and the reward to construct a training sample; similarly, for each answer in the second answer set, a training sample may be constructed by the same method, and further, the constructed training sample may be used to re-optimize the optimized interactive generation model.
[0070] For example, for a certain response a, an overall detection result (which may be in the form of a score) and classified detection results corresponding to different evaluation dimensions can be obtained, and then a predetermined fusion algorithm can be used to fuse the overall detection result and the different classified detection results, thereby determining a reward corresponding to response a, and the specific form of the fusion algorithm can be determined according to actual needs.
[0071] Accordingly, a training sample can be constructed using the response a, the dialogue input corresponding to the response a, and the reward corresponding to the response a, and similarly, training samples corresponding to other responses can be obtained, and each training sample can be used to re-optimize the optimized dialogue-based generative model.
[0072] In addition, preferably, the optimized interactive generative model can be used as a baseline model, and a target model exactly the same as the baseline model can be generated; further, the target model can be optimized using training samples based on a Kullback-Leibler (KL) variance constraint introduced between the baseline model and the target model; and the optimized target model can be again used as an optimized interactive generative model.
[0073] That is, two interactive generative models, which are respectively an optimized interactive generative model (i.e., a baseline model) and a target model, can be maintained by maintenance. Figure 4 is a schematic diagram of the relationship between the baseline model and the target model in the present disclosure. As shown in Figure 4, the baseline model can be regarded as being maintained and unchanged in the re-optimization process, and before optimizing the target model, the target model is exactly the same as the baseline model, and when optimizing the target model using training samples, the optimization process is relatively difficult and it is easy to cause extreme situations such as the model generating garbled characters. Therefore, in order to ensure that the target model is not too far from the baseline model, the KL variance between one baseline model and the target model can be additionally introduced to constrain it, and the optimized target model can be the required re-optimized interactive generative model.
[0074] In conjunction with the above introduction, Fig. 5 is a schematic diagram of the overall optimization method of the safety system disclosed herein. As shown in Fig. 5, optimization 1 therein shows the process of optimizing the interactive generative model and the detection model, and optimization 2 shows the process of using the optimized detection model to re-optimize the optimized interactive generative model, where in optimization 1, the response output of the interactive generative model may pass through the detection model, or may not pass through the detection model, or may be directly manually labeled.
[0075] After optimizing the safety system for each time using the method shown in FIG. 5, the expert can re-evaluate whether the latest acquired interactive generative model meets the online requirements; if not, the safety norms can be updated, and the safety system can be re-optimized based on the updated safety norms; if so, the latest acquired interactive generative model can be actually deployed online; and after actually being deployed online, if necessary, the interactive generative model can be further continuously optimized using the method described in the present disclosure.
[0076] Accordingly, Figure 6 is a flow chart of an embodiment of the method for realizing the generative dialogue of the present disclosure. As shown in Figure 6, the specific implementation manner includes:
[0077] In step 601, a dialogue input waiting to be processed is obtained.
[0078] In step 602, an interactive generative model is used to generate a response corresponding to a pending interactive input, the interactive generative model being an interactive generative model that matches the online requirements obtained by N iterative optimizations, where N is a positive integer greater than 1, and each optimization includes optimizing the interactive generative model based on the determined interactive input in response to determining that an update has been generated in the safety criterion, according to the principle that the response generated by the interactive generative model matches a target safety criterion, the target safety criterion is the safety criterion after the update, the determined interactive input is an interactive input corresponding to the current optimization determined based on the target safety criterion, and the update is an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not match the online requirements.
[0079] As can be seen from the above, by adopting the method described in the embodiments of the above-mentioned method, through alternating iteration of the two parts, safety norms and the interactive generative model, it is possible to continuously optimize and constantly improve the output safety of the interactive generative model, and accordingly, the trained interactive generative model can be used to generate responses, and the safety of the generated responses can be improved.
[0080] The interactive generative model may be an interactive generative model that meets online requirements, ie, obtained by a method corresponding to the embodiment shown in FIG.
[0081] For the sake of simplicity, the embodiments of the above methods are described as a combination of a series of operations, but those skilled in the art should recognize that the present disclosure is not limited by the described operation sequence, since some steps may use other sequences or may be performed simultaneously according to the present disclosure. Next, all of the embodiments described herein belong to preferred embodiments, and the related operations and modules are not necessarily essential to the present disclosure. In addition, some embodiments may not have detailed parts, and the relevant descriptions in other embodiments may be referred to.
[0082] The above is a description of a method embodiment, and the following will further illustrate the solution described in this disclosure through an apparatus embodiment.
[0083] 7 is a structural schematic diagram of the configuration of the embodiment 700 of the interactive generative model training apparatus of the present disclosure. As shown in FIG. 7, it includes a pre-processing module 701 and a model optimization module 702.
[0084] In response to determining that an update has been generated in the safety norm, the pre-processing module 701 is used to determine the updated safety norm as a target safety norm and determine an interactive input corresponding to the current optimization based on the target safety norm, where the update is an update made to the original safety norm when it is determined that the interactive generative model after the closest optimization does not meet the online requirements.
[0085] The model optimization module 702 is used to optimize the interactive generative model based on the interactive input according to the principle that the responses generated by the interactive generative model conform to target safety criteria, and the interactive generative model is used to generate responses corresponding to the interactive input.
[0086] The solution described in the above-mentioned device embodiment adopts a gradual iterative interactive generative model optimization method, and through alternating iteration of two parts, safety norms and the interactive generative model, continuously optimizes and constantly improves the output safety of the interactive generative model, so that the response generated by the interactive generative model is ultimately consistent with human safety values.
[0087] Preferably, the safety norms may include evaluation norms of at least one evaluation dimension corresponding to different combinations, each of which is composed of one content area and one application scene, the content area being a safety content area for generative interaction, and the application scene being an application scene for generative interaction, and accordingly, an update to the safety norms may include one or any combination of adding a new evaluation norm for the combination and at least one corresponding evaluation dimension, adding a new evaluation dimension and a corresponding evaluation norm for the original combination, and adjusting the original evaluation norm.
[0088] Preferably, the pre-processing module 701 can obtain a first set of dialogue inputs, in which the dialogue inputs correspond to the current optimization, the first set of dialogue inputs including at least dialogue inputs corresponding to combinations for which updates have been generated, the first set of dialogue inputs meeting a predetermined condition that the proportion of the number of dialogue inputs of the first type is greater than the proportion of the number of dialogue inputs of the second type, the first type of dialogue inputs being dialogue inputs corresponding to combinations for which updates have been generated, and the second type of dialogue inputs being dialogue inputs corresponding to combinations for which updates have not been generated.
[0089] The dialogue inputs in the first dialogue input set can be selected from user utterances of an already publicly deployed dialogue product service, provided by experts based on safety norms, automatically generated by a model, etc.
[0090] Preferably, the model optimization module 702 selects some or all of the dialogue inputs from the first dialogue input set to construct a second dialogue input set, which meets the predetermined condition, uses an dialogue generative model to generate responses corresponding to each dialogue input in the second dialogue input set, respectively, to construct a first response set, optimizes the dialogue generative model and the detection model based on the first response set and the target safety norm, selects some or all of the dialogue inputs from the first dialogue input set to construct a third dialogue input set, which meets the predetermined condition, uses the optimized dialogue generative model to generate responses corresponding to each dialogue input in the third dialogue input set, respectively, to construct a second response set, and can re-optimize the optimized dialogue generative model based on the second response set and the optimized detection model, and the detection model performs safety detection on the generated responses.
[0091] That is, a two-stage optimization method can be adopted: in the first stage, the interactive generative model and the detection model are optimized, and the optimized interactive generative model and the optimized detection model are obtained; in the second stage, the optimized detection model is borrowed to re-optimize the optimized interactive generative model.
[0092] Preferably, the first response set may include M responses generated for each dialogue input in the second dialogue input set, where M is a positive integer greater than 1, and the model optimization module 702 may perform the following process for any dialogue input in the second dialogue input set, where the dialogue input is a dialogue input waiting to be processed, and obtain each candidate response corresponding to the dialogue input waiting to be processed and a manual labeling result of each candidate response, where the number of candidate responses is greater than or equal to M, the candidate responses include responses generated for the dialogue input waiting to be processed and / or responses manually modified from the responses generated for the dialogue input waiting to be processed, and the manual labeling results of any candidate responses include labeling results after manually performing safety labeling on the candidate response based on a target safety norm, and construct a training sample based on the dialogue input waiting to be processed, each candidate response, and the manual labeling result of each candidate response, and optimize the dialogue generation model and the detection model using the training sample.
[0093] Also, preferably, for any candidate response, the labeling result after performing the safety labeling can include evaluation labels corresponding to different evaluation dimensions of the labeled candidate response based on evaluation criteria of different evaluation dimensions of combinations corresponding to dialogue inputs waiting to be manually processed, and the evaluation labels either match the corresponding evaluation criteria or do not match the corresponding evaluation criteria.
[0094] Preferably, the model optimization module 702 can respectively construct a first type of training sample and a second type of training sample, use the first type of training sample to adopt a supervised learning manner to optimize the interactive generative model, and use the second type of training sample to adopt a supervised learning manner to optimize the detection model.
[0095] Wherein, preferably, the manner in which the model optimization module 702 constructs the first type of training sample includes selecting a candidate response that meets the following condition from each candidate response, the condition being that the evaluation labels of different evaluation dimensions all meet corresponding evaluation criteria, and constituting each selected candidate response and the waiting dialogue input as a first type of training sample.
[0096] For each dialogue input in the second dialogue input set, a training sample, i.e., a first type training sample, can be generated by the above-mentioned method, and the generated first type training sample can be used to optimize the dialogue generation model.
[0097] Preferably, the model optimization module 702 can further obtain an overall score for each candidate reply, respectively, where the higher the overall score, the higher the safety; the detection model can include classification detection models corresponding to different evaluation dimensions from the overall detection model; the second type of training samples can include a first subtype training sample and a second subtype training sample, where the first subtype training sample can include two candidate replies with different overall scores, a dialogue input waiting to be processed, and a sample label, where the sample label is used to indicate the candidate reply with the higher overall score among the two candidate replies; the second subtype training samples can include one candidate reply, a dialogue input waiting to be processed, and one evaluation label for the candidate reply; accordingly, optimizing the detection model can include optimizing the overall detection model using the training samples of the first subtype, and for any classification detection model, optimizing the classification detection model using training samples of the second subtype including evaluation labels of the evaluation dimensions corresponding to the classification detection model, respectively.
[0098] In addition, preferably, the second response set can include one response generated for each dialogue input in the third dialogue input set. The model optimization module 702 can use the optimized detection model respectively to perform safety detection for each response in the second response set, and based on the safety detection result of each response, the optimized dialogue generation model can be re-optimized by adopting a reinforcement learning method.
[0099] Preferably, the detection model may include a classification detection model corresponding to the overall detection model and different evaluation dimensions, and accordingly, the model optimization module 702 may perform the following processing for any response, respectively, which is to obtain the classification detection results corresponding to the returned overall detection result and different classification detection models, combine the overall detection result and the different classification detection results, and determine the reward corresponding to the response, the response, the dialogue input corresponding to the response, and the reward to construct a training sample; similarly, for each response in the second response set, a training sample may be constructed by this method, and further, the constructed training sample may be used to re-optimize the optimized interactive generative model.
[0100] Preferably, the model optimization module 702 can take the optimized interactive generative model as a baseline model, generate a target model that is exactly the same as the baseline model, and optimize the target model using training samples based on the KL variance constraint introduced between the baseline model and the target model, and the optimized target model is again the optimized interactive generative model.
[0101] 8 is a structural schematic diagram of the configuration of the generation-type dialogue realization device 800 of the present disclosure. As shown in FIG. 8, it includes an input acquisition module 801 and a response generation module 802.
[0102] The input acquisition module 801 is used to acquire dialogue input to be processed.
[0103] The response generation module 802 is used to generate a response corresponding to a pending response input using an interactive generative model, the interactive generative model being an interactive generative model that matches online requirements obtained by N iterative optimizations, where N is a positive integer greater than 1, each optimization including, in response to determining that an update has been generated in a safety criterion, optimizing the interactive generative model based on the determined interactive input according to the principle that the response generated by the interactive generative model matches a target safety criterion, the target safety criterion being the safety criterion after the update, the determined interactive input being an interactive input corresponding to the current optimization determined based on the target safety criterion, and the update being an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not match the online requirements.
[0104] As can be seen from the above, by adopting the solution described in the embodiment of the above-mentioned device, by alternating the two parts of the safety norm and the interactive generative model, it is possible to continuously optimize and constantly improve the output safety of the interactive generative model, and accordingly, the trained interactive generative model can be used to generate responses, and the safety of the generated responses can be improved.
[0105] For the specific workflow of the device embodiment shown in FIG. 7 and FIG. 8, reference may be made to the relevant description of the method embodiment described above, and the description will be omitted.
[0106] In short, the method described in the present disclosure provides a multi-dimensional incremental iterative interactive generative model security solution, which can improve the output security of the interactive generative model, and can be applied to various application scenes and content areas, etc., and has wide applicability.
[0107] The solutions described in this disclosure relate to the field of artificial intelligence technology, and can be particularly applied to fields such as large-scale models, deep learning, and natural language processing. Artificial intelligence is a discipline that studies the simulation of certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.) by computers, and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing, while artificial intelligence software technologies mainly include several directions such as computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, and knowledge graph technology.
[0108] The dialogue inputs and responses in the above embodiments of the present disclosure are not directed to a specific user and do not reflect the personal information of a specific user. In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the relevant user personal information all comply with relevant laws and regulations and do not violate public order and morals.
[0109] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.
[0110] 9 shows a schematic block diagram of an electronic device 900 for implementing embodiments of the present disclosure. The electronic device is intended to represent various types of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various types of mobile devices, such as personal digital assistants, mobile phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the practice of the present disclosure as described herein and / or claimed.
[0111] 9, the device 900 includes a computing unit 901, which can perform various appropriate operations and processes based on a computer program stored in a read-only memory (ROM) 902 or loaded from a storage unit 908 into a random access memory (RAM) 903. The RAM 903 can also store various programs and data required for the device 900 to operate. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0112] Several components in device 900 are connected to an I / O interface 905, including input units 906 such as a keyboard, mouse, etc., output units 907 such as various types of displays, speakers, etc., storage units 908 such as disks, optical disks, etc., and communication units 909 such as a network card, modem, wireless communication transceiver, etc. The communication units 909 enable device 900 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks.
[0113] The computing unit 901 is a general-purpose and / or dedicated processing component with various processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, computing units that execute various machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 executes various methods and processes described above, such as the methods described in this disclosure. For example, in some embodiments, the methods described in this disclosure can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 908. In some embodiments, some or all of the computer program is loaded and / or installed in the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, it can perform one or more steps of the methods described in this disclosure above. Alternatively, in other embodiments, the computing unit 901 can be configured to execute the methods described in this disclosure via any other suitable manner (e.g., by firmware).
[0114] Various implementations of the systems and techniques described herein may be realized in digital electronic circuitry systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system on a chip systems (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include being implemented in one or more computer programs that may be executed and / or interpreted by a programmable system that includes at least one programmable processor, which may be a special purpose or general purpose programmable processor, and that may receive data and instructions from and transmit data and instructions to a storage system, at least one input device, and at least one output device.
[0115] The program codes for implementing the methods of the present disclosure can be written using any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing apparatus such that the functions / operations specified in the flowcharts and / or block diagrams are implemented when the program codes are executed by the processor or controller. The program codes can be executed entirely on the machine, partially on the machine, partially on the machine as a separate software package and partially on a remote machine, or entirely on a remote machine or server.
[0116] In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use with or in combination with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the above. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 of the above.
[0117] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user, and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other types of devices can also be used to provide interaction with a user, for example, feedback provided to the user can be any form of sensing feedback (e.g., visual feedback, auditory feedback, or haptic feedback) and can receive input from the user in any form (including acoustic input, speech input, and haptic input).
[0118] The systems and techniques described herein may be implemented in a computing system including a back-end component (e.g., a data server), or a computing system including a middleware component (e.g., an application server), or a computing system including a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user interacts with an implementation of the systems and techniques described herein), or in a computing system including any combination of such back-end, middleware, and front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0119] The computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship between the client and the server is created by computer programs running on corresponding computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server for combining blockchains.
[0120] It should be understood that steps can be rearranged, added, or deleted using various types of flows shown above. For example, each step described in the present disclosure can be performed in parallel, sequentially, or in a different order, but is not limited herein as long as the technical solution disclosed in the present disclosure can achieve the desired results.
[0121] The above specific implementation methods do not constitute a limitation of the protection scope of the present disclosure. Those skilled in the art can make various modifications, combinations, subcombinations, and substitutions based on design requirements and other factors. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. 1. A method for interactive generative model training, comprising: In response to determining that an update has been made to the safety norm, the updated safety norm is set as a target safety norm, and an interactive input corresponding to the current optimization is determined based on the target safety norm, the update being an update to the original safety norm when it is determined that the interactive generative model after the closest one optimization does not meet the online requirements; optimizing the interactive generative model based on the interactive input such that responses generated by the interactive generative model conform to the principles of the target safety norm, the interactive generative model being used to generate responses corresponding to the interactive input; An interactive generative model training method.
2. The safety norms include at least one evaluation dimension evaluation norm corresponding to different combinations, and each combination is composed of one content area and one application scene, the content area is a safety content area for generative interaction, and the application scene is an application scene of generative interaction; The update to the safety rule includes one or any combination of: adding a new evaluation rule of at least one evaluation dimension corresponding to the combination; adding a new evaluation dimension and a corresponding evaluation rule for the original combination; and adjusting the original evaluation rule. The method of interactive generative model training according to claim 1 .
3. The step of determining an interaction input corresponding to the current optimization based on the target safety norm includes: obtaining a first set of dialogue inputs, and determining a dialogue input therein as a dialogue input corresponding to a current optimization; the first set of interaction inputs includes at least an interaction input corresponding to a combination for which an update was generated; The first set of dialogue inputs meets a predetermined condition that a ratio of a number of dialogue inputs of a first type is greater than a ratio of a number of dialogue inputs of a second type, the first type of dialogue input being a dialogue input corresponding to a combination for which an update has been generated, and the second type of dialogue input being a dialogue input corresponding to a combination for which an update has not been generated. The interactive generative model training method of claim 2 .
4. The step of optimizing the interactive generative model includes: selecting some or all of the dialogue inputs from the first dialogue input set to form a second dialogue input set, the second dialogue input set meeting the predetermined condition; generating responses corresponding to each of the dialogue inputs in the second dialogue input set using the dialogue generative model to construct a first answer set, and optimizing the dialogue generative model and a detection model based on the first answer set and the target safety norm; selecting some or all of the dialogue inputs from the first dialogue input set to form a third dialogue input set, the third dialogue input set meeting the predetermined condition; generating responses corresponding to each of the dialogue inputs in the third dialogue input set using the optimized dialogue generation model to construct a second set of responses; and re-optimizing the optimized dialogue generation model based on the second set of responses and the optimized detection model, wherein the detection model performs safety detection on the generated responses. The interactive generative model training method of claim 3.
5. the first set of responses includes M responses generated for each dialogue input in the second set of dialogue inputs, where M is a positive integer greater than 1; optimizing the interactive generative model and the detection model based on the first answer set and the target safety norm, The method includes the steps of performing the following processes for any dialogue input in the second dialogue input set, the processes including: taking the dialogue input as a dialogue input to be processed, obtaining each candidate response corresponding to the dialogue input to be processed and a manual labeling result of each candidate response, the number of the candidate responses being M or more, the candidate responses including responses generated for the dialogue input to be processed and / or responses manually modified from the responses generated for the dialogue input to be processed, the manual labeling results of any candidate responses including labeling results after manually performing safety labeling on the candidate responses based on the target safety norm, constructing training samples based on the dialogue input to be processed, each candidate response, and the manual labeling results of each candidate response, and optimizing the interactive generation model and the detection model using the training samples. The interactive generative model training method of claim 4.
6. For any candidate response, the labeling result after performing the safety labeling includes evaluation labels corresponding to different evaluation dimensions of the candidate response, which are manually labeled based on evaluation criteria of different evaluation dimensions of a combination corresponding to the pending dialogue input, and the evaluation labels indicate whether the candidate response meets the corresponding evaluation criteria or does not meet the corresponding evaluation criteria. The interactive generative model training method of claim 5.
7. constructing a training sample based on the pending dialogue input, each candidate response, and a manual labeling result of each candidate response, and optimizing the interactive generative model and the detection model using the training sample, constructing a first type of training sample and a second type of training sample, respectively; optimizing the interactive generative model using the first type of training samples and adopting a supervised learning approach; and optimizing the detection model using the second type of training samples by employing a supervised learning scheme. The interactive generative model training method of claim 6.
8. The step of constructing the first type of training samples comprises: selecting, from each of the candidate responses, a candidate response that meets the following criteria: The condition is that the evaluation labels of different evaluation dimensions all meet the corresponding evaluation criteria, and each selected candidate response and the waiting dialogue input are configured as one first type training sample; The interactive generative model training method of claim 7.
9. The method comprises: obtaining an overall score for each of the candidate responses, the higher the overall score, the higher the security; The detection model includes a comprehensive detection model and classification detection models corresponding to different evaluation dimensions, respectively; the second type of training samples includes a first subtype of training samples and a second subtype of training samples, the first subtype of training samples includes two candidate replies with different overall scores, the dialogue input to be processed, and a sample label, the sample label being used to indicate the candidate reply with the higher overall score of the two candidate replies, the second subtype of training samples includes one candidate reply, the dialogue input to be processed, and one rating label of the candidate reply; The step of optimizing the detection model includes optimizing the overall detection model using the training samples of the first subtype, and optimizing the classification detection model for any of the classification detection models using training samples of the second subtype including evaluation labels of evaluation dimensions corresponding to the classification detection model. The interactive generative model training method of claim 7.
10. the second set of responses includes a response generated for each dialogue input in the third set of dialogue inputs; re-optimizing the optimized interactive generative model based on the second answer set and the optimized detection model, performing safety detection for each answer in the second answer set using each of the optimized detection models; and re-optimizing the optimized interactive generation model by adopting a reinforcement learning method based on the safety detection result of each answer; The interactive generative model training method according to any one of claims 4 to 8.
11. The detection model includes a comprehensive detection model and classification detection models each corresponding to a different evaluation dimension; The step of re-optimizing the optimized interactive generation model by adopting a reinforcement learning method according to the safety detection result of each response is included in the step of: For each optional response, the following process is performed: The process includes the steps of obtaining the returned overall detection result and a classification detection result corresponding to a different classification detection model, combining the overall detection result and the different classification detection result to determine a reward corresponding to the response, and using the response, the dialogue input corresponding to the response, and the reward to construct a training sample; and re-optimizing the optimized interactive generative model using the training samples. The method of interactive generative model training according to claim 10.
12. The step of re-optimizing the optimized interactive generation model using the training sample includes: A step of generating a target model that is identical to the optimized interactive generative model as a baseline model; optimizing the target model using the training samples based on a Kulbeck-Label variance constraint introduced between the baseline model and the target model, and re-optimizing the optimized target model as an optimized interactive generative model. The method of interactive generative model training according to claim 11.
13. A method for realizing generative dialogue, comprising: obtaining a dialogue input to be processed; using an interactive generative model to generate a response corresponding to the pending interactive input, the interactive generative model being an interactive generative model that matches online requirements obtained by N iterative optimizations, N being a positive integer greater than 1, each optimization including, in response to determining that an update has been generated in a safety criterion, optimizing the interactive generative model based on the determined interactive input according to a principle that the response generated by the interactive generative model matches a target safety criterion, the target safety criterion being the safety criterion after the update, the determined interactive input being an interactive input corresponding to the current optimization determined based on the target safety criterion, and the update being an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not match the online requirements. A method for realizing generative dialogue.
14. An interactive generative model training apparatus, comprising: It includes a pre-processing module and a model optimization module. The pre-processing module is used to determine, in response to determining that an update has been generated in the safety norm, the updated safety norm as a target safety norm, and determine an interactive input corresponding to the current optimization based on the target safety norm, the update being an update to the original safety norm when it is determined that the interactive generative model after the closest one optimization does not meet the online requirements; The model optimization module is used to optimize the interactive generative model based on the interactive input such that a response generated by the interactive generative model conforms to the principles of the target safety norm, and the interactive generative model is used to generate a response corresponding to the interactive input. The method for realizing generative dialogue according to claim 13.
15. The safety norms include at least one evaluation dimension evaluation norm corresponding to different combinations, and each combination is composed of one content area and one application scene, the content area is a safety content area for generative interaction, and the application scene is an application scene of generative interaction; The update to the safety rule includes one or any combination of: adding a new evaluation rule of at least one evaluation dimension corresponding to the combination; adding a new evaluation dimension and a corresponding evaluation rule for the original combination; and adjusting the original evaluation rule. The method for realizing generative dialogue according to claim 14.
16. The pre-processing module obtains a first dialogue input set, and defines dialogue inputs therein as dialogue inputs corresponding to the current optimization, the first dialogue input set including at least dialogue inputs corresponding to combinations for which updates have been generated, the first dialogue input set satisfies a predetermined condition that a ratio of the number of dialogue inputs of a first type is greater than a ratio of the number of dialogue inputs of a second type, the first type of dialogue input is a dialogue input corresponding to a combination for which updates have been generated, and the second type of dialogue input is a dialogue input corresponding to a combination for which updates have not been generated. The method for realizing generative dialogue according to claim 15.
17. The model optimization module selects some or all of the dialogue inputs from the first dialogue input set to construct a second dialogue input set, the second dialogue input set meeting the predetermined condition, and uses the dialogue generative model to generate responses corresponding to each dialogue input in the second dialogue input set to construct a first response set; optimizes the dialogue generative model and the detection model according to the first response set and the target safety norm; selects some or all of the dialogue inputs from the first dialogue input set to construct a third dialogue input set, the third dialogue input set meeting the predetermined condition, and uses the optimized dialogue generative model to generate responses corresponding to each dialogue input in the third dialogue input set to construct a second response set; and re-optimizes the optimized dialogue generative model according to the second response set and the optimized detection model, and the detection model performs safety detection on the generated responses. The method for realizing generative dialogue according to claim 16.
18. the first set of responses includes M responses generated for each dialogue input in the second set of dialogue inputs, where M is a positive integer greater than 1; The model optimization module performs the following process for any dialogue input in the second dialogue input set, respectively, the process including: taking the dialogue input as a dialogue input to be processed, obtaining each candidate response corresponding to the dialogue input to be processed and a manual labeling result of each candidate response, the number of the candidate responses being M or more, the candidate responses including responses generated for the dialogue input to be processed and / or responses manually corrected from the responses generated for the dialogue input to be processed, the manual labeling results of any candidate responses including labeling results after manually performing safety labeling on the candidate responses based on the target safety norm, constructing training samples based on the dialogue input to be processed, each candidate response, and the manual labeling results of each candidate response, and optimizing the interactive generation model and the detection model using the training samples. The method for realizing generative dialogue according to claim 17.
19. For any candidate response, the labeling result after performing the safety labeling manually includes evaluation labels respectively corresponding to different evaluation dimensions of the labeled candidate response according to evaluation criteria of different evaluation dimensions of the combinations corresponding to the dialogue inputs to be processed, and the evaluation labels are either in accordance with the corresponding evaluation criteria or not in accordance with the corresponding evaluation criteria.
20. The method for realizing generative dialogue according to claim 18.
20. The model optimization module respectively constructs a first type of training sample and a second type of training sample, uses the first type of training sample to adopt a supervised learning manner to optimize the interactive generative model, and uses the second type of training sample to adopt a supervised learning manner to optimize the detection model.
20. The method for realizing generative dialogue according to claim 19.
21. The model optimization module selects a candidate answer that meets the following condition from each candidate answer, the condition being that the evaluation labels of different evaluation dimensions all meet corresponding evaluation criteria, and each selected candidate answer and the to-be-processed dialogue input constitute a first type of training sample; 21. The method for realizing generative dialogue according to claim 20.
22. The model optimization module is further used to obtain a total score for each candidate response, where the higher the total score, the higher the security; The detection model includes a comprehensive detection model and classification detection models corresponding to different evaluation dimensions, respectively; the second type of training samples includes a first subtype of training samples and a second subtype of training samples, the first subtype of training samples includes two candidate replies with different overall scores, the dialogue input to be processed, and a sample label, the sample label being used to indicate the candidate reply with the higher overall score of the two candidate replies, the second subtype of training samples includes one candidate reply, the dialogue input to be processed, and one rating label of the candidate reply; the model optimization module optimizes the overall detection model using the training samples of the first subtype, and optimizes the classification detection model for any of the classification detection models using training samples of the second subtype including evaluation labels of evaluation dimensions corresponding to the classification detection model, respectively; 21. The method for realizing generative dialogue according to claim 20.
23. the second set of responses includes a response generated for each dialogue input in the third set of dialogue inputs; Using the detection model after optimization of the model optimization module respectively to perform safety detection for each answer in the second answer set, and adopting a reinforcement learning method to re-optimize the optimized interactive generation model according to the safety detection result of each answer; A method for realizing a generative dialogue according to any one of claims 17 to 21.
24. The detection model includes a comprehensive detection model and classification detection models each corresponding to a different evaluation dimension; The model optimization module performs the following process for any response, respectively, in which the process includes obtaining classification detection results corresponding to the returned overall detection result and different classification detection models, combining the overall detection result and the different classification detection results to determine a reward corresponding to the response, constructing a training sample using the response, an interaction input corresponding to the response, and the reward, and re-optimizing the optimized interactive generative model using the training sample.
24. The method for realizing generative dialogue according to claim 23.
25. The model optimization module uses the optimized interactive generative model as a baseline model, generates a target model that is exactly the same as the baseline model, and optimizes the target model using the training samples based on a Kulbeck-Label variance constraint introduced between the baseline model and the target model, and uses the optimized target model as a re-optimized interactive generative model.
25. The method for realizing generative dialogue according to claim 24.
26. A generative dialogue realization device, comprising: an input acquisition module and a response generation module; the input acquisition module is used to acquire dialogue input to be processed; The response generation module is used to generate a response corresponding to the pending dialogue input using an interactive generative model, the interactive generative model being an interactive generative model that meets online requirements obtained by N iterative optimizations, N being a positive integer greater than 1, each optimization including, in response to determining that an update has been generated in a safety criterion, optimizing the interactive generative model based on the determined dialogue input according to a principle that the response generated by the interactive generative model meets a target safety criterion, the target safety criterion being the safety criterion after the update, the determined dialogue input being a dialogue input corresponding to the current optimization determined based on the target safety criterion, and the update being an update to the original safety criterion when it is determined that the interactive generative model after the closest optimization does not meet the online requirements. A generative dialogue realization device.
27. An electronic device, At least one processor; a memory in communication with the at least one processor; said memory storing instructions executable by said at least one processor, said instructions, when executed by said at least one processor, causing said at least one processor to perform a method according to any one of claims 1 to 9 and 11 to 13; electronic equipment.
28. A computer program comprising: The computer program, when executed by a processor, implements the method according to any one of claims 1 to 9 and 11 to 13. Computer program.
Citation Information
Patent Citations
Chat system and chat program
JP2022093814A
Retraining a conversation system based on negative feedback
US20200364511A1
Information processing system and information processing method
WO2020202731A1
Information processing device, information processing method, and program
WO2021070732A1
Method and apparatus for self-supervised extractive question answering
WO2023098971A1
Cited By
Corpus construction method and device, equipment, storage medium and product
CN120234389A
Training sample generation method of intelligent shopping guide dialogue robot and related device
CN120562550A
