Training method of reply generation model, reply sentence generation method and device
By identifying and adjusting the matching between the training samples and reference fact labels of the candidate response generation model, the model training task was optimized, the problems of low flexibility and inconsistent response statements in template-based responses were solved, and efficient and accurate response information generation was achieved, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2023-10-18
- Publication Date
- 2026-07-24
AI Technical Summary
In existing technologies, template-based responses have low flexibility, poor user experience, and the responses output by the model may not be consistent with the facts, resulting in a poor user experience.
By acquiring training samples of the candidate response generation model, identifying whether the sample facts match the reference fact labels, determining the model training task as fact response consistency classification and response generation learning task, and adjusting the model parameters according to the training loss until training ends, the target response generation model is generated.
It improved the accuracy and efficiency of response information generation, reduced the workload of template configuration, and optimized the user experience.
Smart Images

Figure CN117370524B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and in particular to artificial intelligence fields such as natural language processing and deep learning. Background Technology
[0002] With the development of technology, users can obtain the information they want by talking to machines. Users can input their needs into the machine's input field, and the machine will generate corresponding responses based on the user's input and return them to the user.
[0003] In related technologies, template-based responses can be used to generate reply information for users. In this scenario, although template-based responses can provide users with corresponding reply information, they have low flexibility, poor user experience, and require pre-configuration of templates, which is a large workload.
[0004] Alternatively, a response generation model can be used to generate corresponding response information for the user. In this scenario, the response statements output by the model may be inconsistent with the facts, resulting in a poor user experience. Summary of the Invention
[0005] This disclosure proposes a training method for a response generation model, a response statement generation method, and an apparatus.
[0006] According to a first aspect of this disclosure, a training method for a response generation model is proposed. The method includes: acquiring a first training sample of a candidate response generation model to be trained, and sample dialogue context, sample facts, and reference fact labels in the first training sample; identifying whether the sample facts match the reference fact labels, and determining the model training task of the candidate response generation model in the current round based on the identification result, wherein the model training task is at least one of a fact-response consistency classification task and a response generation learning task; acquiring the training loss of the candidate response generation model under the model training task; adjusting the parameters of the candidate response generation model according to the training loss, and returning to acquire the next sample dialogue context to continue training the parameter-adjusted candidate response generation model until training ends, thereby obtaining a trained target response generation model.
[0007] According to a second aspect of this disclosure, a method for generating response statements is proposed. The method includes: obtaining a dialogue context input by a user and obtaining factual information corresponding to the dialogue context; obtaining a trained target response generation model and inputting the dialogue context and the factual information into the target response generation model; generating a target response statement for the dialogue context through the target response generation model, wherein the target response generation model is obtained based on the training method of the response generation model proposed in the first aspect above.
[0008] According to a third aspect of this disclosure, a training method for a response generation model is proposed. The method includes: a first acquisition module, used to acquire a first training sample of a candidate response generation model to be trained, and a sample dialogue context, sample facts, and reference fact labels in the first training sample; an identification module, used to identify whether the sample facts match the reference fact labels, and determine the model training task of the candidate response generation model in the current round based on the identification result, wherein the model training task is at least one of a fact-response consistency classification task and a response generation learning task; a second acquisition module, used to acquire the training loss of the candidate response generation model under the model training task; and a training module, used to adjust the parameters of the candidate response generation model according to the training loss, and return to acquire the next sample dialogue context to continue training the parameter-adjusted candidate response generation model until training ends, thereby obtaining a trained target response generation model.
[0009] According to the fourth aspect of this disclosure, a response statement generation apparatus is proposed. The apparatus includes: a third acquisition module, configured to acquire the dialogue context input by a user terminal and acquire factual information corresponding to the dialogue context; and a generation module, configured to acquire a trained target response generation model, input the dialogue context and the factual information into the target response generation model, and generate a target response statement for the dialogue context through the target response generation model, wherein the target response generation model is obtained based on the training apparatus for the response generation model proposed in the third aspect above.
[0010] According to a fifth aspect of this disclosure, an electronic device is proposed, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the training method of the response generation model proposed in the first aspect and / or the response statement generation method proposed in the second aspect.
[0011] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is proposed, wherein the computer instructions are used to cause the computer to execute the training method of the response generation model proposed in the first aspect and / or the response statement generation method proposed in the second aspect.
[0012] According to the fifth aspect of this disclosure, a computer program product is proposed, comprising a computer program that, when executed by a processor, implements the training method for the response generation model proposed in the first aspect and / or the response statement generation method proposed in the second aspect.
[0013] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0014] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0015] Figure 1 This is a flowchart illustrating a training method for a response generation model according to an embodiment of the present disclosure.
[0016] Figure 2 This is a flowchart illustrating a training method for a response generation model according to another embodiment of the present disclosure.
[0017] Figure 3 This is a schematic diagram of a response generation model according to an embodiment of the present disclosure;
[0018] Figure 4 This is a flowchart illustrating a method for generating response statements according to an embodiment of the present disclosure;
[0019] Figure 5 This is a schematic diagram of the structure of a training device for a response generation model according to an embodiment of the present disclosure;
[0020] Figure 6 This is a schematic diagram of the structure of a response statement generation device according to an embodiment of the present disclosure;
[0021] Figure 7 This is a schematic block diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0022] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0023] Data processing is a fundamental aspect of systems engineering and automatic control. Data is a form of expression of facts, concepts, or instructions, which can be processed manually or by automated devices. After data is interpreted and given meaning, it becomes information. Data processing involves the acquisition, storage, retrieval, processing, transformation, and transmission of data. The basic purpose of data processing is to extract and derive valuable and meaningful data from large amounts of potentially chaotic and difficult-to-understand data.
[0024] Deep learning (DL) is a new research direction in the field of machine learning. Deep learning learns the inherent patterns and hierarchical representations of sample data. The information gained during this learning process greatly helps in interpreting data such as text, images, and sound. Its ultimate goal is to enable machines to have analytical and learning capabilities like humans, and to recognize data such as text, images, and sound.
[0025] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus has a close relationship with linguistics, but also important differences. NLP is not simply the study of natural language in general, but rather the development of computer systems that can effectively achieve natural language communication.
[0026] Artificial Intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and application systems to simulate, extend, and expand human intelligence. It attempts to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. Since its inception, AI has seen its theories and technologies mature and its application areas expand. AI can simulate the information processes of human consciousness and thought.
[0027] Figure 1 This is a flowchart illustrating a training method for a response generation model according to an embodiment of the present disclosure, as shown below. Figure 1 As shown, the method includes:
[0028] S101, Obtain the first training sample of the candidate response generation model to be trained, as well as the sample dialogue context, sample facts, and reference fact labels in the first training sample.
[0029] In practice, users can input their needs through a human-computer interaction interface, and the machine will generate corresponding response statements based on the user's needs and provide them to the user.
[0030] In this way, the statements that users input through the human-computer interaction interface, which carry their needs, can be used as the context for the machine to generate corresponding responses.
[0031] In this embodiment of the disclosure, a response generation model can be used to generate a corresponding response statement for the dialogue input by the user. In this scenario, candidate response generation models that need to be trained can be marked as candidate response generation models to be trained.
[0032] Optionally, the candidate response generation model to be trained can be constructed based on the Unified Language Model (UniLM) in related technologies, or it can be constructed based on other neural networks; no specific limitation is made here.
[0033] In this embodiment of the disclosure, the samples used when training the candidate response generation model can be labeled as the first training samples, wherein the first training samples include the dialogue context, facts, and corresponding fact labels used to train the candidate response generation model.
[0034] In this scenario, the dialogue context included in the first training sample can be labeled as sample dialogue context, the facts included in the first training sample can be labeled as sample facts, and the corresponding fact labels can be labeled as reference fact labels of the first training sample.
[0035] Optionally, the first training sample can be input into the candidate response generation model, and the candidate response generation model can parse the sample dialogue context and sample facts in the first training sample to obtain the response information generated by the candidate response generation model.
[0036] S102, identify whether the sample facts match the reference fact labels, and determine the model training task for the current round of the candidate response generation model based on the identification results, wherein the model training task is at least one of the fact response consistency classification task and the response generation learning task.
[0037] In order to enable the trained response generation model to optimize the consistency between the generated response information and the factual information, in this embodiment of the disclosure, the candidate response generation model is provided with two training tasks: a factual response consistency classification task and a response generation learning task.
[0038] The fact-response consistency classification task can be understood as follows: the candidate response generation model classifies and identifies whether its output during the training process is consistent with the target information of the actual needs in the sample dialogue, and iteratively optimizes the candidate response generation model based on the classification results, thereby achieving the training of the fact-response consistency classification task.
[0039] Accordingly, the response generation learning task can be understood as the candidate response generation model learning to generate response information and iteratively optimizing the candidate response generation model based on the learning output, thereby achieving the training of the response generation task.
[0040] In this embodiment of the disclosure, the sample facts in the first training sample can be compared with the reference fact labels of the first training sample to identify whether the two match, thereby determining the task that the candidate response generation model needs to train in the corresponding training round, and marking it as the model training task of the candidate response generation model in the corresponding training round.
[0041] If the matching and recognition results of the sample facts and the reference fact labels meet the preset conditions for training the fact response consistency classification task, it can be determined that the model training task of the candidate response generation model in the corresponding training round is the fact response consistency classification task.
[0042] If the matching and recognition results of the sample facts and the reference fact labels meet the preset conditions for training the response generation task, it can be determined that the model training task of the candidate response generation model in the corresponding training round is the response generation task.
[0043] It should be noted that for the candidate response generation model, in any round of model training, it can be trained only on the fact-response consistency classification task, or only on the response generation task, or it can be trained on both the fact-response consistency classification task and the response generation task together. No specific limitation is made here.
[0044] S103, obtain the training loss of the candidate response generation model under the model training task.
[0045] Optionally, for any round of model training of the candidate response generation model, the model training task of the candidate response generation model under that training round can be obtained, and the training loss of the candidate response generation model under the model training task can be obtained, thereby obtaining the training loss of the candidate response generation model.
[0046] Optionally, in the scenario where the model training task of the candidate response generation model is the fact-response consistency classification task, the loss of the candidate response generation model under the fact-response consistency classification task can be obtained as the training loss of the candidate response generation model in the current training round.
[0047] Optionally, in scenarios where the training tasks of the candidate response generation model are fact-response consistency classification and response generation, the loss of the candidate response generation model under the fact-response consistency classification task and the loss of the candidate response generation model under the response generation task can be obtained separately, and the two losses can be integrated to obtain the training loss of the candidate response generation model in the current training round.
[0048] S104, adjust the parameters of the candidate response generation model based on the training loss, and return to obtain the next sample dialogue text to continue training the parameter-adjusted candidate response generation model until the training ends, and obtain the trained target response generation model.
[0049] In this embodiment of the disclosure, the model parameters of the candidate response generation model can be adjusted according to the training loss, and the next first training sample is obtained to continue training the candidate response generation model with adjusted parameters until the training ends, and the trained target response generation model is obtained.
[0050] Optionally, the training termination condition of the candidate response generation model can be set based on the training rounds. If the training rounds of the model after the current round of training meet the preset training termination condition, the model training can be terminated, and the candidate response generation model obtained in the current training round can be determined as the trained target response generation model.
[0051] Optionally, the training termination condition of the candidate response generation model can be set based on the model output results. If the output results of the candidate response generation model in the current training round meet the preset training termination condition, the model training can be terminated, and the candidate response generation model obtained in the current training round can be determined as the trained target response generation model.
[0052] The training method for the response generation model proposed in this disclosure involves obtaining a candidate response generation model to be trained, and a first training sample of the candidate response generation model. From the first training sample, the sample dialogue context, sample facts, and corresponding reference fact labels are obtained. The matching of the sample facts and reference facts is identified, and based on the matching identification result, the model training task of the candidate response generation model in the current training round is determined, thereby obtaining the training loss of the candidate response generation model under the model training task. Further, the model parameters of the candidate response generation model are adjusted according to the training loss, and the process returns to obtain the next first training sample to continue training the candidate response generation model with adjusted model parameters until training is completed and the trained target response generation model is obtained. In this disclosure, by training the candidate response generation model through a fact-response consistency classification task and a response generation learning task, the consistency between the response information generated by the model and the factual information is optimized while the response generation model is learning to generate responses. This reduces the possibility of machine errors caused by inconsistencies between the response information generated by the model and the factual information. As a result, the response information output by the trained target response generation model not only meets the requirements of human reading habits but also improves the accuracy of the response information. Compared with template-based responses in related technologies, there is no need to pre-configure response templates, which reduces the workload of obtaining response information and improves the efficiency of response information generation. This, in turn, improves the efficiency of responding to users and thus optimizes the user experience.
[0053] In the above embodiments, the acquisition of the model training loss of the candidate response generation model can be combined with... Figure 2 To understand further, Figure 2 This is a flowchart illustrating a training method for a response generation model according to another embodiment of the present disclosure, as shown below. Figure 2 As shown, the method includes:
[0054] S201, Obtain the first training sample of the candidate response generation model to be trained, as well as the sample dialogue context, sample facts, and reference fact labels in the first training sample.
[0055] In this embodiment of the disclosure, a training sample set of the candidate response generation model can be obtained, and the model training for the current round can be performed. The training samples for training the candidate response generation model in the current round can be determined from the obtained training sample set.
[0056] This involves obtaining historical reference facts and historical reference response statements from the preceding historical dialogue, and perturbing these statements to obtain perturbed response statements and perturbed facts.
[0057] Optionally, the dialogue text entered by the user within a historical time range can be marked as historical dialogue text, and corresponding factual information and response statements can be obtained for the historical dialogue text. Specifically, the factual information actually required by the historical dialogue text can be marked as historical reference facts of the historical dialogue text. Correspondingly, response statements that meet the user's needs in the historical dialogue text can be obtained and marked as historical reference response statements of the historical dialogue text.
[0058] In this scenario, historical reference response statements and historical reference facts can be perturbed based on a preset perturbation method. The perturbed historical reference response statements can be marked as perturbed response statements, and the perturbed historical reference facts can be marked as perturbed facts.
[0059] As an example, such as Figure 3 As shown, it can be done through Figure 3 The Masked Language Model (MLM) shown perturbs the historical reference facts and historical reference response statements to obtain perturbed facts of the historical reference facts and perturbed response statements of the historical reference response statements.
[0060] In this example, the historical dialogue context is labeled 'c', the historical reference facts are labeled 'k', and the historical reference response statements are labeled 'r'. This can be achieved through... Figure 3 The MLM model shown perturbs the historical reference fact labeled k, thereby obtaining the corresponding perturbed fact labeled k_r, and, through Figure 3 The MLM model shown perturbs the historical reference response statement labeled r, thereby obtaining the corresponding perturbed response statement and labeling it as r_r.
[0061] Optionally, historical reference facts and historical reference response statements are used as labels to generate a second training sample of historical dialogue context and historical reference facts, as well as a third training sample of historical dialogue context and perturbation facts.
[0062] Specifically, historical dialogue context can be used as sample dialogue context, historical reference facts can be used as sample facts, and historical reference facts and historical reference response statements can be used as labels for sample dialogue context and sample facts to generate corresponding training samples, and these training samples can be labeled as second training samples.
[0063] As an example, let c be the context of the sample dialogue, k be the historical reference facts and the sample facts, and r be the reference response statement. Then, k and r are used as the labels of c and k to obtain the second training sample (c,k)(k,r).
[0064] Accordingly, the historical dialogue context can be used as the sample dialogue context, the perturbation facts can be used as the sample facts, and the historical reference facts and historical reference response statements can be used as labels for the sample dialogue context and sample facts to generate corresponding training samples, and these training samples can be labeled as the third training samples.
[0065] As an example, let c be the context of the sample dialogue, k be the historical reference fact, k_r be the perturbation fact that serves as the sample fact, r be the reference response statement, and k and r be used as the labels for c and k_r, thus obtaining the third training sample (c,k_r)(k,r).
[0066] Optionally, a training sample set for the candidate response generation model is obtained based on the second and third training samples.
[0067] In this embodiment of the disclosure, after obtaining the second training sample and the third training sample, the second training sample and the third training sample can be combined to obtain the corresponding sample set, and the sample set is marked as the training sample set of the candidate response generation model.
[0068] In this scenario, training samples can be selected from the acquired training sample set for the current round of model training of the candidate response generation model, and marked as the first training samples of the candidate response generation model.
[0069] S202, identify whether the sample facts match the reference fact labels, and determine the model training task for the current round of the candidate response generation model based on the identification results, wherein the model training task is at least one of the fact response consistency classification task and the response generation learning task.
[0070] In this embodiment of the disclosure, the sample facts in the first training sample can be compared with the reference fact labels in the labels to identify whether the two match, thereby determining the model training task of the candidate response generation model in the current round.
[0071] In a scenario where the model training task includes at least one of a fact-response consistency classification task and a response generation learning task, in response to the identification of a match between the sample fact and the reference fact label, the model training task for the current round of the candidate response generation model is determined to be the fact-response consistency classification task and the response generation learning task.
[0072] This can be understood as follows: when the sample facts in the first training sample match the reference fact labels, the knowledge information in the sample facts input to the candidate response generation model to generate response information is the knowledge information required by the sample dialogue context. In this scenario, it can be determined that the model training task of the candidate response generation model in the current round is the fact response consistency classification task and the response generation learning task.
[0073] Accordingly, in response to the identification of a mismatch between the sample facts and the reference fact labels, the model training task for the current round of the candidate response generation model is determined to be the fact response consistency classification task.
[0074] This can be understood as follows: when the sample facts in the first training sample do not match the reference fact labels, the knowledge information in the sample facts generated by the candidate response generation model is not the knowledge information required by the sample dialogue context. In this scenario, it can be determined that the response information generated by the candidate response generation model based on the sample dialogue context and sample facts is not the correct response information required by the sample dialogue context. In this scenario, the candidate response generation model can be trained only on the fact response consistency classification task.
[0075] S203, obtain the training loss of the candidate response generation model under the model training task.
[0076] In a scenario where the model training task of the candidate response generation model is a fact-response consistency classification task and a response generation learning task, in response to the model training task being a fact-response consistency classification task and a response generation learning task, the first output response generated by the candidate response generation model based on the sample dialogue context and sample facts is obtained.
[0077] This can be understood as follows: when the model training task of the candidate response generation model includes two tasks, namely the fact-response consistency classification task and the response generation learning task, the loss of the candidate response generation task under the fact-response consistency classification task and the response generation learning task can be obtained, thereby obtaining the total training loss of the candidate response generation task.
[0078] The first training sample can be input into the candidate response generation model. Based on the sample dialogue context and sample facts in the first training sample, the candidate response generation model generates the corresponding response information and marks it as the first output response of the candidate response generation model.
[0079] Optionally, the candidate response generation model can be used to bidirectionally encode the sample dialogue context and sample facts to obtain the encoded feature vectors of the sample dialogue context and sample facts, and then unidirectionally encode the encoded feature vectors to obtain the third output response of the candidate response generation model, wherein the third output response is the first output response.
[0080] As an example, such as Figure 3 As shown, Figure 3 The candidate response generation model shown is built based on the Unified Language Model (UniLM). In this scenario, it can be achieved through... Figure 3The bidirectional encoding module shown performs bidirectional encoding on the sample dialogue context and sample facts in the first training sample to obtain the encoded feature vectors of the sample dialogue context and sample facts.
[0081] Furthermore, through Figure 3 The illustrated one-way encoding module performs one-way encoding on the encoding feature vectors of the sample dialogue context and the sample facts, thereby generating an output response to the sample dialogue context and marking this output response as the third output response.
[0082] In the scenario where the sample facts in the first training sample are historical reference facts from the preceding sample dialogue, Figure 3 The third output response of the candidate response generation model shown is the first output response.
[0083] Optionally, the first factual response consistency identifier carried in the first output response is obtained, and the first factual response consistency identifier is classified by the candidate response generation model to obtain the first consistency classification result of the candidate response generation model for the first output response.
[0084] In this embodiment of the disclosure, the first output response carries the response statement from the sample dialogue above, and also carries an identifier indicating whether the response statement is consistent with the reference fact label. The identifier carried in the first output response can be marked as the first fact response consistency identifier.
[0085] In this scenario, the first fact response consistency identifier can be classified by executing the fact response consistency classification task of the candidate response generation model, identifying whether the first fact response consistency identifier is an identifier that indicates the consistency of the first output response fact response, thereby obtaining the consistency classification result of the first fact response consistency identifier, and marking the consistency classification result as the first consistency classification result.
[0086] As an example, such as Figure 3 As shown, it can be done through Figure 3 The execution of the classification task (CLS) shown realizes the classification of the first fact response consistency identifier carried in the first output response, identifies whether the response information in the first output response carrying the first fact response consistency identifier is consistent with the reference fact label, and thus obtains the corresponding first consistency classification result.
[0087] In this embodiment of the disclosure, the first output response is generated by the candidate response generation model based on the sample dialogue context and historical reference facts that serve as sample facts. Therefore, the first fact response consistency identifier carried in the first output response is an identifier that indicates that the response information matches the fact information in the reference fact label.
[0088] Optionally, the response statement label of the sample dialogue is obtained to obtain a first loss value of the first output response based on the response statement label, and a first consistency label of the sample dialogue is obtained to obtain a second loss value of the first consistency classification result based on the first consistency label.
[0089] In this embodiment of the disclosure, the reference reply statement in the tag above the sample dialogue can be marked as the reply statement tag.
[0090] In this scenario, the first output response and response statement label of the candidate response generation model can be processed by the loss value acquisition algorithm in the relevant technology to obtain the loss value of the first output response based on the response statement label, which can be used as the first loss value of the candidate response generation model.
[0091] In this embodiment of the disclosure, the label information of the sample dialogue context and the sample facts carries label information of factual response consistency of the first output response, and this label information can be marked as the first consistency label.
[0092] In this scenario, the classification loss acquisition algorithm in related technologies can be used to process the first consistency label and the first consistency classification result to obtain the classification loss value of the first consistency classification result based on the first consistency label as the second loss value.
[0093] Optionally, the training loss of the candidate response generation model under the model training task is obtained based on the first loss value and the second loss value.
[0094] In this embodiment of the disclosure, the weights of the first loss value and the second loss value can be obtained respectively, and the first loss value and the second loss value can be weighted based on their respective weights to obtain the training loss of the candidate response generation model under the model training task including the fact-response consistency classification task and the response generation learning task.
[0095] In a scenario where the model training task of the candidate response generation model is a fact-response consistency classification task, in response to the model training task being a fact-response consistency classification task, the second output response generated by the candidate response generation model based on the sample dialogue context and sample facts is obtained.
[0096] Optionally, the candidate response generation model can be used to bidirectionally encode the sample dialogue context and sample facts to obtain the encoded feature vectors of the sample dialogue context and sample facts, and then unidirectionally encode the encoded feature vectors to obtain the third output response of the candidate response generation model, wherein the third output response is the second output response.
[0097] As an example, such as Figure 3 As shown, it can be done through Figure 3 The bidirectional encoding module shown performs bidirectional encoding on the sample dialogue context and sample facts in the first training sample to obtain the encoded feature vectors of the sample dialogue context and sample facts.
[0098] Furthermore, through Figure 3 The illustrated one-way encoding module performs one-way encoding on the encoding feature vectors of the sample dialogue context and the sample facts, thereby generating an output response to the sample dialogue context and marking this output response as the third output response.
[0099] In the scenario where the sample facts in the first training sample are perturbed facts that are historical reference facts in the preceding sample dialogue, Figure 3 The third output response of the candidate response generation model shown is the second output response.
[0100] Optionally, the second fact response consistency identifier carried in the second output response is obtained, and the second fact response consistency identifier is classified by the candidate response generation model to obtain the second consistency classification result of the candidate response generation model for the second output response.
[0101] In this embodiment of the disclosure, in addition to the response information generated by the candidate response generation model based on the sample dialogue context and sample facts, the second output response also carries a consistency identifier between the response information and the factual information. This identifier can be marked as the second factual response consistency identifier carried in the second output response.
[0102] In this scenario, the candidate response generation model can identify whether the indication information of the second fact response consistency identifier is inconsistent with the fact information based on the execution of the fact response consistency classification task, and then obtain the consistency classification result of the candidate response generation model for the second output response, and mark it as the second consistency classification result.
[0103] As an example, such as Figure 3 As shown, it can be done through Figure 3 The execution of the CLS task shown enables the classification of the second fact response consistency identifier carried in the second output response, and identifies whether the response information in the second output response carrying the second fact response consistency identifier is consistent with the reference fact label, thereby obtaining the corresponding second consistency classification result.
[0104] In this embodiment of the disclosure, the second output response is generated by the candidate response generation model based on the sample dialogue context and the perturbation facts that serve as sample facts. Therefore, the second fact response consistency identifier carried in the second output response is an identifier that indicates that the response information does not match the fact information in the reference fact label.
[0105] Optionally, a second consistency label is obtained from the context of the sample dialogue to obtain a third loss value based on the second consistency label for the second consistency classification result.
[0106] In this embodiment of the disclosure, there is corresponding consistency tag information in the tag information above the sample dialogue, and this tag information can be marked as the second consistency tag.
[0107] In this scenario, the classification loss value based on the second consistency label can be obtained by using the classification loss acquisition method in related technologies, and this loss value can be marked as the third loss value.
[0108] Optionally, the training loss of the candidate response generation model under the model training task can be obtained based on the third loss value.
[0109] In scenarios where the model training task is only the fact-response consistency classification task, the third loss value of the candidate response generation model under the fact-response consistency classification task is the training loss of the candidate response generation model under the model training task.
[0110] The training method for the response generation model proposed in this disclosure, if a match is found between the sample fact and the reference fact label, determines that the training task of the candidate response generation model is a fact-response consistency classification task and a response generation learning task. In this scenario, the loss of the candidate response generation model under the fact-response consistency classification task and the training loss of the candidate response generation model under the response generation learning task can be obtained, thus obtaining the total training loss of the candidate response generation model under the model training task. Correspondingly, if a mismatch is found between the sample fact and the reference fact label, determines that the training task of the candidate response generation model is a fact-response consistency classification task. In this scenario, the training loss of the candidate response generation model under the fact-response consistency classification task can be obtained as the total training loss of the candidate response generation model. In this disclosure, through training under the fact-response consistency classification task and the response generation learning task, the candidate response generation model optimizes the consistency between the model-generated response information and the factual information while performing response generation learning, reducing the possibility of machine errors caused by inconsistencies between the model-generated response information and the factual information. This allows the response information output by the trained target response generation model to improve the accuracy of the response information while satisfying the adaptability to human reading habits.
[0111] This disclosure also proposes a method for generating response statements, which can be combined with... Figure 4 understand, Figure 4 This is a flowchart illustrating a response statement generation method according to an embodiment of the present disclosure, as shown below. Figure 4 As shown, the method includes:
[0112] S401, obtain the dialogue context input by the user and obtain the corresponding factual information.
[0113] In this embodiment of the disclosure, the user can input a statement carrying the user's needs through the human-computer interaction interface, wherein the statement can be marked as the dialogue context input by the user.
[0114] In this scenario, user demand information carried in the dialogue can be obtained, and corresponding factual information can be retrieved based on the obtained user demand information.
[0115] S402, Obtain the trained target response generation model, and input the dialogue context and factual information into the target response generation model to generate the target response statement of the dialogue context.
[0116] In this embodiment of the disclosure, the trained response generation model can be labeled as the target response generation model, wherein the target response generation model is based on the above. Figures 1 to 3 The training method for the response generation model proposed in the embodiment is obtained.
[0117] In this scenario, the dialogue context and corresponding factual information input by the user can be fed into the target response generation model. The target response generation model performs bidirectional encoding on the dialogue context and factual information to obtain the corresponding encoded feature vectors. Then, it performs unidirectional encoding to generate the response statement, thereby obtaining the response statement generated by the target response generation model based on the dialogue context and factual information, which serves as the target response statement returned to the user.
[0118] The response generation method proposed in this disclosure, after obtaining the dialogue context input by the user and the corresponding factual information, can input the dialogue context and factual information into a trained target response generation model, and then output the target response statement for the dialogue context through the target response generation model. In this disclosure, the target response generation model is based on... Figures 1 to 3 The training method of the response generation model proposed in the embodiment enables the trained target response generation model to output response statements that are adapted to people's reading habits, while optimizing the consistency between response information and factual information in the response statements, improving the accuracy and efficiency of response statement generation, and optimizing the user experience.
[0119] Corresponding to the training methods of the response generation model proposed in the above embodiments, an embodiment of this disclosure also proposes a training device for the response generation model. Since the training device for the response generation model proposed in this disclosure corresponds to the training methods of the response generation model proposed in the above embodiments, the implementation methods of the above-mentioned training methods for the response generation model are also applicable to the training device for the response generation model proposed in this disclosure, and will not be described in detail in the following embodiments.
[0120] Figure 5 This is a schematic diagram of the structure of a training device for a response generation model according to an embodiment of the present disclosure, as shown below. Figure 5 As shown, the training device 500 for the response generation model includes a first acquisition module 51, a recognition module 52, a second acquisition module 53, and a training module 54, wherein:
[0121] The first acquisition module 51 is used to acquire the first training sample of the candidate response generation model to be trained, as well as the sample dialogue context, sample facts, and reference fact labels in the first training sample.
[0122] The identification module 52 is used to identify whether the sample facts match the reference fact labels, and to determine the model training task of the candidate response generation model in the current round based on the identification results. The model training task is at least one of the fact response consistency classification task and the response generation learning task.
[0123] The second acquisition module 53 is used to acquire the training loss of the candidate response generation model under the model training task.
[0124] Training module 54 is used to adjust the parameters of the candidate response generation model based on the training loss, and then return to obtain the next sample dialogue context to continue training the parameter-adjusted candidate response generation model until the training ends, thus obtaining the trained target response generation model.
[0125] In this embodiment of the disclosure, the identification module 52 is further configured to: in response to identifying a match between the sample fact and the reference fact label, determine that the model training task of the candidate response generation model in the current round is a fact-response consistency classification task and a response generation learning task. In response to identifying a mismatch between the sample fact and the reference fact label, determine that the model training task of the candidate response generation model in the current round is a fact-response consistency classification task.
[0126] In this embodiment of the disclosure, the second acquisition module 53 is further configured to: in response to the model training task being a fact-response consistency classification task and a response generation learning task, acquire a first output response generated by the candidate response generation model based on the sample dialogue context and sample facts; acquire a first fact-response consistency identifier carried in the first output response, and classify the first fact-response consistency identifier through the candidate response generation model to obtain a first consistency classification result of the candidate response generation model for the first output response; acquire the response statement label of the sample dialogue context to obtain a first loss value of the first output response based on the response statement label, and acquire the first consistency label of the sample dialogue context to obtain a second loss value of the first consistency classification result based on the first consistency label; and acquire the training loss of the candidate response generation model under the model training task based on the first loss value and the second loss value.
[0127] In this embodiment of the disclosure, the second acquisition module 53 is further configured to: in response to the model training task being a fact-response consistency classification task, acquire a second output response generated by the candidate response generation model based on the sample dialogue context and sample facts; acquire a second fact-response consistency identifier carried in the second output response, and classify the second fact-response consistency identifier through the candidate response generation model to obtain a second consistency classification result of the candidate response generation model for the second output response; acquire a second consistency label of the sample dialogue context to obtain a third loss value of the second consistency classification result based on the second consistency label; and acquire the training loss of the candidate response generation model under the model training task based on the third loss value.
[0128] In this embodiment of the disclosure, the second acquisition module 53 is further configured to: bidirectionally encode the sample dialogue context and sample facts using a candidate response generation model to obtain encoded feature vectors of the sample dialogue context and sample facts; and unidirectionally encode the encoded feature vectors to obtain a third output response output by the candidate response generation model, wherein the third output response is one of the first output response and the second output response.
[0129] In this embodiment of the disclosure, the first acquisition module 51 is further configured to: acquire historical reference facts and historical reference response statements in the context of a historical dialogue; perturb the historical reference response statements and historical reference facts to obtain perturbed response statements and perturbed facts of the historical reference facts; use the historical reference facts and historical reference response statements as labels to generate a second training sample of the context of the historical dialogue and the historical reference facts, and a third training sample of the context of the historical dialogue and the perturbed facts; and based on the second training sample and the third training sample, acquire a training sample set for the candidate response generation model.
[0130] The training apparatus for the response generation model proposed in this disclosure acquires a candidate response generation model to be trained, and a first training sample of the candidate response generation model. From the first training sample, it extracts the sample dialogue context, sample facts, and corresponding reference fact labels. It identifies whether the sample facts match the reference facts and determines the model training task of the candidate response generation model in the current training round based on the matching identification result, thereby obtaining the training loss of the candidate response generation model under the model training task. Further, it adjusts the model parameters of the candidate response generation model based on the training loss, and returns to acquire the next first training sample to continue training the candidate response generation model with adjusted model parameters until training ends and a trained target response generation model is obtained. In this disclosure, by training the candidate response generation model through a fact-response consistency classification task and a response generation learning task, the consistency between the response information generated by the model and the factual information is optimized while the response generation model is learning to generate responses. This reduces the possibility of machine errors caused by inconsistencies between the response information generated by the model and the factual information. As a result, the response information output by the trained target response generation model not only meets the requirements of human reading habits but also improves the accuracy of the response information. Compared with template-based responses in related technologies, there is no need to pre-configure response templates, which reduces the workload of obtaining response information and improves the efficiency of response information generation. This, in turn, improves the efficiency of responding to users and thus optimizes the user experience.
[0131] Corresponding to the response statement generation methods proposed in the above embodiments, an embodiment of this disclosure also proposes a response statement generation device. Since the response statement generation device proposed in this disclosure corresponds to the response statement generation methods proposed in the above embodiments, the implementation methods of the above response statement generation methods are also applicable to the response statement generation device proposed in this disclosure, and will not be described in detail in the following embodiments.
[0132] Figure 6 This is a schematic diagram of the structure of a response statement generation device according to an embodiment of the present disclosure, as shown below. Figure 6 As shown, the response statement generation device 600 includes a third acquisition module 61 and a generation module 62, wherein:
[0133] The third acquisition module 61 is used to acquire the dialogue context input by the user and acquire the factual information corresponding to the dialogue context.
[0134] Generation module 62 is used to acquire the trained target response generation model, input the dialogue context and factual information into the target response generation model, and generate the target response statement for the dialogue context through the target response generation model. The target response generation model is based on... Figures 1 to 3 The training apparatus for the response generation model proposed in the embodiment is obtained.
[0135] The response statement generation device proposed in this disclosure, after obtaining the dialogue context and corresponding factual information input by the user, can input the dialogue context and factual information into a trained target response generation model, and output the target response statement for the dialogue context through the target response generation model. In this disclosure, the target response generation model is based on... Figures 1 to 3 The training method of the response generation model proposed in the embodiment enables the trained target response generation model to output response statements that are adapted to people's reading habits, while optimizing the consistency between response information and factual information in the response statements, improving the accuracy and efficiency of response statement generation, and optimizing the user experience.
[0136] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0137] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0138] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded from storage unit 708 into random access memory (RAM) 703. RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0139] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 706, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0140] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as methods for training response generation models and / or methods for generating response statements. For example, in some embodiments, the methods for training response generation models and / or methods for generating response statements can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the methods for training response generation models and / or methods for generating response statements described above can be performed. Alternatively, in other embodiments, the computing unit 701 may be configured by any other suitable means (e.g., by means of firmware) to perform a training method for the response generation model and / or a response statement generation method.
[0141] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0142] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0143] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. 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 devices, magnetic storage devices, or any suitable combination of the foregoing.
[0144] To initiate interaction with a user account, 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 the user account; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user account can submit input to the computer. Other types of devices can also be used to initiate interaction with the user account; for example, feedback submitted to the user account can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user account can be received in any form (including voice input, speech input, or tactile input).
[0145] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user account computer with a graphical user interface or web browser through which a user account can interact with the implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0146] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0147] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0148] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for training a response generation model, wherein, The method includes: Obtain the first training sample of the candidate response generation model to be trained, as well as the sample dialogue context, sample facts, and reference fact labels in the first training sample; Identify whether the sample facts match the reference fact labels, and determine the model training task for the current round of the candidate response generation model based on the identification results, wherein the model training task is at least one of a fact response consistency classification task and a response generation learning task; Obtain the training loss of the candidate response generation model under the model training task; The parameters of the candidate response generation model are adjusted based on the training loss, and the next sample dialogue text is retrieved to continue training the parameter-adjusted candidate response generation model until the training ends, resulting in a well-trained target response generation model. The step of identifying whether the sample fact matches the reference fact label, and determining the model training task for the current round of the candidate response generation model based on the identification result, includes: In response to the identification that the sample fact matches the reference fact label, the model training task for the current round of the candidate response generation model is determined to be the fact response consistency classification task and the response generation learning task. In response to the identification that the sample fact does not match the reference fact label, the model training task for the current round of the candidate response generation model is determined to be the fact response consistency classification task.
2. The method according to claim 1, wherein, The step of obtaining the training loss of the candidate response generation model under the model training task includes: In response to the model training task being a fact-response consistency classification task and a response generation learning task, the first output response generated by the candidate response generation model based on the sample dialogue context and the sample facts is obtained; Obtain the first factual response consistency identifier carried in the first output response, and classify the first factual response consistency identifier through the candidate response generation model to obtain the first consistency classification result of the candidate response generation model for the first output response; Obtain the response statement tag of the sample dialogue to obtain the first loss value of the first output response based on the response statement tag, and obtain the first consistency tag of the sample dialogue to obtain the second loss value of the first consistency classification result based on the first consistency tag. Based on the first loss value and the second loss value, the training loss of the candidate response generation model under the model training task is obtained.
3. The method according to claim 2, wherein, The step of obtaining the training loss of the candidate response generation model under the model training task includes: In response to the model training task being a fact-response consistency classification task, the second output response generated by the candidate response generation model based on the sample dialogue context and the sample facts is obtained; Obtain the second fact response consistency identifier carried in the second output response, and classify the second fact response consistency identifier through the candidate response generation model to obtain the second consistency classification result of the candidate response generation model for the second output response; Obtain the second consistency label of the sample dialogue context to obtain the third loss value of the second consistency classification result based on the second consistency label; Based on the third loss value, the training loss of the candidate response generation model under the model training task is obtained.
4. The method according to claim 3, wherein, The step of obtaining the first output response generated by the candidate response generation model based on the sample dialogue context and the sample facts, and / or the step of obtaining the second output response generated by the candidate response generation model based on the sample dialogue context and the sample facts, includes: The candidate response generation model performs bidirectional encoding on the sample dialogue context and the sample facts to obtain the encoded feature vectors of the sample dialogue context and the sample facts. The encoded feature vector is unidirectionally encoded to obtain the third output response of the candidate response generation model, wherein the third output response is one of the first output response and the second output response.
5. The method according to claim 1, wherein, Before obtaining the first training sample of the candidate response generation model to be trained, and the sample dialogue context, sample facts, and reference fact labels in the first training sample, the process includes: Retrieve historical reference facts and historical reference responses from the context of historical dialogues; The historical reference response statement and the historical reference fact are perturbed respectively to obtain the perturbed response statement and the perturbed fact of the historical reference fact; Using the historical reference facts and the historical reference response statements as labels, a second training sample of the historical dialogue context and the historical reference facts, and a third training sample of the historical dialogue context and the perturbation facts are generated. Based on the second training sample and the third training sample, a training sample set for the candidate response generation model is obtained.
6. A method for generating response statements, characterized in that, The method includes: Obtain the context of the conversation input by the user and obtain the factual information corresponding to the context of the conversation; A trained target response generation model is obtained, and the dialogue context and factual information are input into the target response generation model. The target response generation model generates the target response statement of the dialogue context. The target response generation model is obtained based on the training method of the response generation model according to any one of claims 1-5.
7. A training apparatus for a response generation model, wherein, The device includes: The first acquisition module is used to acquire the first training sample of the candidate response generation model to be trained, as well as the sample dialogue context, sample facts, and reference fact labels in the first training sample. The identification module is used to identify whether the sample fact matches the reference fact label, and to determine the model training task of the candidate response generation model in the current round based on the identification result, wherein the model training task is at least one of the fact response consistency classification task and the response generation learning task. The second acquisition module is used to acquire the training loss of the candidate response generation model under the model training task. The training module is used to adjust the parameters of the candidate response generation model according to the training loss, and return to obtain the next sample dialogue context to continue training the candidate response generation model after parameter adjustment until the training ends, and obtain the trained target response generation model. The identification module is further configured to: In response to the identification that the sample fact matches the reference fact label, the model training task for the current round of the candidate response generation model is determined to be the fact response consistency classification task and the response generation learning task. In response to the identification that the sample fact does not match the reference fact label, the model training task for the current round of the candidate response generation model is determined to be the fact response consistency classification task.
8. The apparatus according to claim 7, wherein, The second acquisition module is further configured to: In response to the model training task being a fact-response consistency classification task and a response generation learning task, the first output response generated by the candidate response generation model based on the sample dialogue context and the sample facts is obtained; Obtain the first factual response consistency identifier carried in the first output response, and classify the first factual response consistency identifier through the candidate response generation model to obtain the first consistency classification result of the candidate response generation model for the first output response; Obtain the response statement tag of the sample dialogue to obtain the first loss value of the first output response based on the response statement tag, and obtain the first consistency tag of the sample dialogue to obtain the second loss value of the first consistency classification result based on the first consistency tag. Based on the first loss value and the second loss value, the training loss of the candidate response generation model under the model training task is obtained.
9. The apparatus according to claim 8, wherein, The second acquisition module is further configured to: In response to the model training task being a fact-response consistency classification task, the second output response generated by the candidate response generation model based on the sample dialogue context and the sample facts is obtained; Obtain the second fact response consistency identifier carried in the second output response, and classify the second fact response consistency identifier through the candidate response generation model to obtain the second consistency classification result of the candidate response generation model for the second output response; Obtain the second consistency label of the sample dialogue context to obtain the third loss value of the second consistency classification result based on the second consistency label; Based on the third loss value, the training loss of the candidate response generation model under the model training task is obtained.
10. The apparatus according to claim 9, wherein, The second acquisition module is further configured to: The candidate response generation model performs bidirectional encoding on the sample dialogue context and the sample facts to obtain the encoded feature vectors of the sample dialogue context and the sample facts. The encoded feature vector is unidirectionally encoded to obtain the third output response of the candidate response generation model, wherein the third output response is one of the first output response and the second output response.
11. The apparatus according to claim 7, wherein, The first acquisition module is further configured to: Retrieve historical reference facts and historical reference responses from the context of historical dialogues; The historical reference response statement and the historical reference fact are perturbed respectively to obtain the perturbed response statement and the perturbed fact of the historical reference fact; Using the historical reference facts and the historical reference response statements as labels, a second training sample of the historical dialogue context and the historical reference facts, and a third training sample of the historical dialogue context and the perturbation facts are generated. Based on the second training sample and the third training sample, a training sample set for the candidate response generation model is obtained.
12. A response statement generation device, characterized in that, The device includes: The third acquisition module is used to acquire the dialogue context input by the user and acquire the factual information corresponding to the dialogue context. A generation module is used to acquire a trained target response generation model, input the dialogue context and the factual information into the target response generation model, and generate a target response statement for the dialogue context through the target response generation model, wherein the target response generation model is obtained based on the training device of the response generation model according to any one of claims 7-11.
13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5 and / or claim 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5 and / or claim 6.
15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5 and / or claim 6.