Method for training a dialogue model and method for outputting response information

By determining the latent vector of empathic intent in the sample dialogue and training it, intelligent response information is generated, which solves the problem of insufficient empathic ability of the response information in the existing model and realizes more intelligent response output.

CN115080739BActive Publication Date: 2025-10-24BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210728304.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2025-10-24
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

The existing dialogue models have poor empathy ability in outputting response information, resulting in the response information being not intelligent enough.

Method used

By obtaining sample conversations and sample response labels, the discriminant network in the model to be trained is used to determine the empathy intention latent vector corresponding to the sample conversation, generate response information, and train the model based on the response information and sample response labels to obtain a conversation model with empathy ability.

Benefits of technology

It improves the intelligence of the dialogue model's output response information and enhances the empathy of the response information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080739B_ABST
    Figure CN115080739B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for training a dialogue model and a method for outputting response information, and relates to the technical field of artificial intelligence, in particular to the technical field of natural language processing. The specific implementation scheme is as follows: obtaining a sample dialogue and a sample response label; determining a transference intention hidden vector corresponding to the sample dialogue through a discriminative network in a to-be-trained model; generating response information corresponding to the sample dialogue based on the transference intention hidden vector; and training the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model. The implementation manner can improve the intelligent degree of the response information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of artificial intelligence, in particular to the technical field of natural language processing. BACKGROUND

[0002] Natural language processing technology is an important research direction in the field of artificial intelligence. Among them, natural language processing technology refers to the technology of interacting with machines using natural language used in human communication, which is widely used in intelligent man-machine dialogue and other application scenarios.

[0003] In practice, it is found that in the application scenario of intelligent man-machine dialogue, it is usually necessary to train a dialogue model to output response information matched with user dialogue based on the trained dialogue model. However, the empathy ability of the response information output by the current dialogue model is poor, resulting in that the response information is not intelligent enough. SUMMARY

[0004] The present disclosure provides a method for training a dialogue model and a method for outputting response information.

[0005] According to an aspect of the present disclosure, a method for training a dialogue model is provided, comprising: obtaining a sample dialogue and a sample response label; determining an empathetic intention hidden vector corresponding to the sample dialogue through a discriminative network in a to-be-trained model; generating response information corresponding to the sample dialogue based on the empathetic intention hidden vector; training the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model.

[0006] According to another aspect of the present disclosure, a method for outputting response information is provided, comprising: obtaining a target dialogue; determining target response information based on the dialogue model trained by the method for training a dialogue model and the target dialogue; and outputting the target response information.

[0007] According to another aspect of the present disclosure, an apparatus for training a dialogue model is provided, comprising: a sample obtaining unit configured to obtain a sample dialogue and a sample response label; a hidden vector determining unit configured to determine an empathetic intention hidden vector corresponding to the sample dialogue through a discriminative network in a to-be-trained model; a response generating unit configured to generate response information corresponding to the sample dialogue based on the empathetic intention hidden vector; and a model training unit configured to train the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model.

[0008] According to another aspect of the present disclosure, there is provided an apparatus for outputting response information, comprising: a dialogue obtaining unit configured to obtain a target dialogue; a response determining unit configured to determine target response information based on a dialogue model trained by the method for training a dialogue model described above and the target dialogue; and a response output unit configured to output the target response information.

[0009] According to another aspect of the present disclosure, there is provided an electronic device, comprising: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the methods for training a dialogue model or the methods for outputting response information described above.

[0010] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute any one of the methods for training a dialogue model or the methods for outputting response information described above.

[0011] According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements any one of the methods for training a dialogue model or the methods for outputting response information described above.

[0012] According to the technology of the present disclosure, there is provided a method for training a dialogue model or a method for outputting response information, which can improve the intelligent level of the response information.

[0013] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0014] The accompanying drawings are used to better understand the present scheme, and do not limit the present disclosure. Among them:

[0015] Figure 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure can be applied;

[0016] Figure 2 is a flowchart of one embodiment of the method for training a dialogue model according to the present disclosure;

[0017] Figure 3 is a schematic diagram of one application scenario of the method for training a dialogue model according to the present disclosure;

[0018] Figure 4 is a flowchart of another embodiment of the method for training a dialogue model according to the present disclosure;

[0019] Figure 5 is a flowchart of an embodiment of a method for outputting response information according to the present disclosure;

[0020] Figure 6 is a structural diagram of an embodiment of an apparatus for training a dialogue model according to the present disclosure;

[0021] Figure 7 is a structural diagram of an embodiment of a device for outputting response information according to the present disclosure;

[0022] Figure 8 It is a block diagram of an electronic device used to implement the method for training a dialogue model or the method for outputting response information according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0024] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0025] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0026] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can obtain sample conversations and sample response labels for training the conversation model, and send these sample conversations and sample response labels to server 105 via network 104. Server 105 then trains the conversation model based on these sample conversations and sample response labels. Terminal devices 101, 102, and 103 can then obtain the conversation model and, based on the conversation model, output target response information corresponding to the target conversation.

[0027] The terminal devices 101, 102, and 103 can be hardware or software. When the terminal devices 101, 102, and 103 are hardware, they can be various electronic devices including but not limited to mobile phones, computers, tablets, and the like. When the terminal devices 101, 102, and 103 are software, they can be installed in the above-mentioned electronic devices. They can be implemented as multiple software or software modules (for example, used to provide distributed services) or as a single software or software module. No specific limitation is made herein.

[0028] The server 105 can be a server that provides various services. For example, the server 105 can receive a sample dialogue and a sample response label sent by the terminal devices 101, 102, and 103 through the network 104, determine a transference intention hidden vector corresponding to the sample dialogue through a discrimination network in a to-be-trained model, generate response information corresponding to the sample dialogue based on the transference intention hidden vector, and train the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model. Then, the server 105 can send the dialogue model to the terminal devices 101, 102, and 103 through the network 104, so that the terminal devices 101, 102, and 103 output target response information corresponding to a target dialogue through the dialogue model.

[0029] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers or as a single server. When the server 105 is software, it can be implemented as multiple software or software modules (for example, used to provide distributed services) or as a single software or software module. No specific limitation is made herein.

[0030] It should be noted that the method for training a dialogue model or the method for outputting response information provided by the embodiments of the present disclosure can be executed by the terminal devices 101, 102, and 103 or the server 105, and the apparatus for training a dialogue model or the apparatus for outputting response information can be arranged in the terminal devices 101, 102, and 103 or the server 105. No specific limitation is made herein.

[0031] It should be understood that Figure 1 The number of terminal devices, networks, and servers in

[0032] With reference to Figure 2 , a flow 200 of one embodiment of the method for training a dialogue model according to the present disclosure is shown. The method for training a dialogue model of the present embodiment includes the following steps:

[0033] In step 201, a sample dialogue and a sample response label are obtained.

[0034] In this embodiment, the execution subject (such as the server 105 or the terminal device 101, 102, or 103 in FIG. 1) can obtain the sample dialogue and the sample response label for training the dialogue model from a locally stored or pre-connected electronic device. The sample dialogue can be a dialogue voice or dialogue text input by a user, and the sample response label can be a labeled response information corresponding to the dialogue voice or dialogue text input by the user. In addition, the number of sample dialogues is usually multiple, and each sample dialogue has a corresponding sample response label. Figure 1

[0035] In step 202, a transference intention hidden vector corresponding to the sample dialogue is determined by a discriminative network in the to-be-trained model.

[0036] In this embodiment, the to-be-trained model can include a conditional variational autoencoder structure. In the model training phase, the conditional variational autoencoder structure can include a discriminative network and a prior network. The prior network can be generated based on the sample response label described above, and is used to describe the information distribution of the labeled response information, which can reflect the transference intention in the labeled response information. The transference intention here can be a sentimental response information corresponding to the dialogue voice or dialogue text input by the user. The discriminative network can be a network structure that needs to be trained, and the initial discriminative network can be determined by random generation or the like. In the process of model training, the network parameters of the discriminative network can be continuously adjusted to make the information distribution of the discriminative network continuously approach the information distribution of the prior network.

[0037] In addition, the execution subject can input the sample dialogue into the to-be-trained model in each round of model training iteration, and use the discriminative network in the to-be-trained model to generate a hidden vector corresponding to the sample dialogue, which is used to describe the transference intention of the sample dialogue, i.e., the transference intention hidden vector described above. The transference intention hidden vector can be an unobservable variable that describes the transference intention.

[0038] In step 203, response information corresponding to the sample dialogue is generated based on the transference intention hidden vector.

[0039] In this embodiment, after obtaining the transference intention hidden vector, the execution subject can use the transference intention hidden vector as a generation basis of the response information, and generate the response information corresponding to the sample dialogue based on the transference intention hidden vector. It can be understood that the generated response information is a response with transference ability. Optionally, the execution subject can also determine the emotional classification of the sample dialogue, the semantics of the dialogue, and other aspects of the dialogue information, and generate the response information based on the multi-aspect dialogue information and the transference intention hidden vector described above, so as to further improve the generation accuracy of the response information. ​

[0040] In step 204, the to-be-trained model is trained based on the response information and the sample response label, and a trained dialogue model is obtained.

[0041] In this embodiment, the execution subject can determine the difference between the response information and the sample response label. If the difference is large, the model parameters of the to-be-trained model are adjusted, and the above training process is repeated until the difference between the response information and the sample response label is less than a preset threshold, and the trained dialogue model is obtained.

[0042] The trained dialogue model is used to output response information corresponding to the dialogue with empathy. Moreover, the trained dialogue model can include a trained discriminative network. The model parameters of the to-be-trained model that need to be adjusted at least include network parameters of the discriminative network.

[0043] Continuing to refer to Figure 3 which shows a schematic diagram of one application scenario of the method for training a dialogue model according to the present disclosure. In the Figure 3 application scenario, the to-be-trained model can include a text encoder 302, an emotion classification module 303, a prior network 304 in a conditional variational autoencoder structure, a discriminative network 305 in the conditional variational autoencoder structure, and a response decoding module 308. When training the model, the execution subject can input a sample dialogue 301 into the text encoder 302, so that the text encoder 302 encodes the sample dialogue 301 to obtain a text vector. Then, the execution subject can determine the emotion category 306 corresponding to the sample dialogue 301 based on the text vector and the emotion classification module 303. Meanwhile, the execution subject can also input the text vector into the conditional variational autoencoder structure, so that the prior network 304 and the discriminative network 305 in the conditional variational autoencoder structure determine the empathy intention latent vector 307. Then, the execution subject can input the emotion category 306, the empathy intention latent vector 307, and the text vector into the response decoding module 308, so that the response decoding module 308 outputs the response information 309. Then, the execution subject can train the to-be-trained model based on the response information 309 and the sample response label corresponding to the sample dialogue 301, and obtain a dialogue model. Here, the text encoder 302 and the response decoding module 308 can adopt the encoding and decoding structure in the Transformer model (a neural network model based on the self-attention mechanism).

[0044] The method for training a dialogue model provided by the above embodiments of the present disclosure can determine the empathy intention latent vector corresponding to the sample dialogue through the discriminative network in the to-be-trained model, simulate the potential distribution of empathy intention by using the empathy intention latent vector, and thus train a dialogue model with empathy, thereby improving the intelligent degree of the response information output by the dialogue model.

[0045] With reference to the preceding Figure 4 Fig. 4 shows a flow 400 of another embodiment of the method for training a dialogue model according to the present disclosure. As shown in Fig. 4, the method for training a dialogue model of the present embodiment can comprise the following steps: Figure 4

[0046] Step 401: obtaining a sample dialogue and a sample response label.

[0047] In the present embodiment, the detailed description of step 401 can refer to the detailed description of step 201, which will not be repeated here.

[0048] Step 402: generating a prior network based on the sample response label.

[0049] In the present embodiment, the execution subject can determine the emotional response information in the sample response label for reflecting the empathy intention, and generate the information distribution corresponding to the emotional response information using the conditional variational autoencoder structure to obtain the prior network.

[0050] Step 403: generating an empathy intention hidden vector corresponding to the sample dialogue through the discriminative network in the to-be-trained model and the prior network.

[0051] In the present embodiment, in the process of training the to-be-trained model, the execution subject can generate the empathy intention hidden vector through the conditional variational autoencoder structure composed of the discriminative network in the to-be-trained model and the prior network.

[0052] In the present embodiment, the detailed description of step 403 can refer to the detailed description of step 202, which will not be repeated here.

[0053] Step 404: determining an emotional category and a text vector corresponding to the sample dialogue.

[0054] In the present embodiment, the to-be-trained model can further comprise an emotional classification module, and the execution subject can determine the emotional category corresponding to the sample dialogue based on the emotional classification module. In addition, the to-be-trained model can further comprise an encoding module, and the execution subject can determine the text vector corresponding to the sample dialogue based on the encoding module.

[0055] In some optional implementations of the present embodiment, determining the emotional category and the text vector corresponding to the sample dialogue can comprise: encoding the sample dialogue to obtain the text vector corresponding to the sample dialogue; and classifying the text vector to obtain the emotional category corresponding to the sample dialogue.

[0056] ​In this implementation, the execution entity can input a sample conversation into the training model, causing the text encoding module in the training model to encode the sample conversation to obtain the aforementioned text vector. The execution entity can then input the aforementioned text vector into the aforementioned sentiment classification module, which then performs sentiment classification on the text vector to obtain the sentiment category corresponding to the sample conversation.

[0057] Step 405: Concatenate the empathy intention latent vector and the emotion category to obtain the empathy parameter.

[0058] In this embodiment, the execution entity can concatenate the empathy intention latent vector and the emotion category to obtain empathy parameters. Empathy parameters are used to describe the emotional response to a sample conversation. By training the model with empathy parameters, the trained conversation model can output responses that demonstrate empathy. Furthermore, it can be understood that the emotion category here can serve as a coarse-grained empathy parameter, while the empathy intention latent vector can serve as a fine-grained empathy parameter. The empathy parameters generated based on these two can more accurately reflect empathy intent.

[0059] Step 406: Generate response information corresponding to the sample conversation based on the empathy parameter and the text vector.

[0060] In this embodiment, the execution entity may input the empathy parameters and the text vectors into a decoding module in the trained model, so that the decoding module generates a response message based on the empathy parameters and the text vectors. Optionally, the text vectors may be attention vectors generated using a self-attention mechanism, thereby facilitating understanding of important textual content in the sample conversation and further improving the accuracy of the response message.

[0061] Step 407: Based on the response information, the sample response label and the prior network, the network parameters of the discriminant network are adjusted to obtain a trained discriminant network.

[0062] In this embodiment, the execution entity can adjust the network parameters of the discriminant network based on the difference between the response information and the sample response labels, in a direction that approximates the information distribution in the prior network, until the difference between the response information and the sample response labels is less than a threshold, thereby obtaining a trained discriminant network. It is understood that the information distribution corresponding to the trained discriminant network is relatively small compared to the information distribution in the prior network. The difference between the information distribution corresponding to the discriminant network and the information distribution in the prior network can be determined using information divergence.

[0063] In some optional implementations of the embodiment, the network parameters of the discrimination network are adjusted based on the response information, the sample response label, and the prior network to obtain the trained discrimination network, including: in response to the difference information between the response information and the sample response label not satisfying the preset difference condition, adjusting the network parameters of the discrimination network based on the network parameters in the prior network until the difference information between the response information and the sample response label satisfies the preset difference condition, to obtain the trained discrimination network.

[0064] In the implementation, the execution subject can determine the difference value between the response information and the sample response label, and if the difference value is greater than a preset threshold, it is determined that the difference information between the response information and the sample response label does not satisfy the preset difference condition, and the network parameters of the discrimination network are adjusted towards the direction of approximating the information distribution in the prior network until the difference value between the response information and the sample response label is less than or equal to the preset threshold, to obtain the trained discrimination network.

[0065] At step 408, the trained dialogue model is determined based on the trained discrimination network.

[0066] In the embodiment, the trained dialogue model can include the trained discrimination network and does not include the prior network described above. In the application stage of the dialogue model, the empathy intention hidden vector corresponding to the dialogue can be generated by the discrimination network.

[0067] The method for training a dialogue model provided by the above embodiments of the disclosure can also generate response information jointly based on the emotion category, the text vector, and the empathy intention hidden vector, thereby improving the accuracy of the response information. In addition, in the process of training the model, the prior network and the discrimination network in the conditional variational autoencoder structure can be used to generate the empathy intention hidden vector, and the discrimination network can be trained based on the response information, the sample response label, and the prior network, so that the discrimination network can generate the empathy intention hidden vector more accurately, thereby improving the empathy ability of the dialogue model.

[0068] With reference to Figure 5 FIG. 5 shows a flow 500 of one embodiment of a method for outputting response information according to the disclosure. The method for outputting response information of the embodiment includes the following steps:

[0069] At step 501, a target dialogue is obtained.

[0070] In the embodiment, an execution subject (such as the server 105 or the terminal device 101, 102, or 103 in Figure 1 may obtain a target dialogue input by a user in real time. The target dialogue can be a voice dialogue, a text dialogue, or the like input by the user, which is not limited in the embodiment.

[0071] At step 502, the target response information is determined based on the trained dialogue model and the target dialogue.

[0072] In this embodiment, the execution subject can input the target dialogue into the dialogue model to enable the trained discriminative network in the dialogue model to generate the empathy intention hidden vector, the emotion category, and the text vector of the target dialogue, and determine the target response information based on the empathy intention hidden vector, the emotion category, and the text vector. The target response information can include response voice, response text, etc., which is not limited in this embodiment.

[0073] At step 503, the target response information is output.

[0074] In this embodiment, the execution subject can output the target response information to realize a round of dialogue with the user. If the target dialogue input by the user is detected again, steps 501 to 503 can be repeatedly executed to realize multi-round human-computer interaction dialogue.

[0075] The method for outputting response information provided by the above embodiments of the disclosure can output target response information with empathy ability by using the dialogue model, and improves the intelligent degree of the target response information.

[0076] Further reference Figure 6 , as an implementation of the method shown in the above figures, the disclosure provides an embodiment of a device for training a dialogue model, which corresponds to the method embodiment shown in Figure 6 , and the device can be applied in terminal equipment, servers, and other electronic devices.

[0077] As shown in Figure 6 , the device 600 for training a dialogue model in this embodiment includes a sample obtaining unit 601, a hidden vector determining unit 602, a response generating unit 603, and a model training unit 604.

[0078] The sample obtaining unit 601 is configured to obtain sample dialogues and sample response labels.

[0079] The hidden vector determining unit 602 is configured to determine an empathy intention hidden vector corresponding to the sample dialogue by a discriminative network in the to-be-trained model, wherein the empathy intention hidden vector is used to describe the empathy intention of the sample dialogue.

[0080] The response generating unit 603 is configured to generate response information corresponding to the sample dialogue based on the empathy intention hidden vector.

[0081] The model training unit 604 is configured to train the to-be-trained model based on the response information and the sample response label, to obtain a trained dialogue model; and the trained dialogue model is used to output response information corresponding to a dialogue.

[0082] In some optional implementations of the present embodiment, the response generation unit 603 is further configured to: determine a sentiment category and a text vector corresponding to the sample dialogue; splice the empathy intention hidden vector and the sentiment category to obtain an empathy parameter; and generate the response information corresponding to the sample dialogue based on the empathy parameter and the text vector.

[0083] In some optional implementations of the present embodiment, the response generation unit 603 is further configured to: encode the sample dialogue to obtain a text vector corresponding to the sample dialogue; and perform sentiment classification on the text vector to obtain a sentiment category corresponding to the sample dialogue.

[0084] In some optional implementations of the present embodiment, the hidden vector determination unit 602 is further configured to: generate a prior network based on the sample response label; and generate the empathy intention hidden vector corresponding to the sample dialogue by the discriminative network in the to-be-trained model and the prior network.

[0085] In some optional implementations of the present embodiment, the model training unit 604 is further configured to: adjust the network parameters of the discriminative network based on the response information, the sample response label and the prior network, to obtain a trained discriminative network; and determine the trained dialogue model based on the trained discriminative network.

[0086] In some optional implementations of the present embodiment, the model training unit 604 is further configured to: in response to the difference information between the response information and the sample response label not satisfying a preset difference condition, adjust the network parameters of the discriminative network based on the network parameters in the prior network, until the difference information between the response information and the sample response label satisfies the preset difference condition, to obtain the trained discriminative network.

[0087] It should be understood that the units 601 to 604 described in the apparatus 600 for training a dialogue model respectively correspond to the respective steps in the method described with reference to Figure 2 Therefore, the operations and features described above with respect to the method for training a dialogue model are equally applicable to the apparatus 600 and the units contained therein, and will not be described here again.

[0088] Further reference is made to Figure 7 As an implementation of the method shown in the above figures, the present disclosure provides one embodiment of an apparatus for outputting response information, which implements the method described above. Figure 5The method embodiments shown correspondingly, the device can be applied to terminal equipment, server and other electronic equipment.

[0089] As Figure 7 shown, the device for outputting response information 700 of the embodiment includes a dialogue obtaining unit 701, a response determining unit 702 and a response output unit 703.

[0090] The dialogue obtaining unit 701 is configured to obtain a target dialogue.

[0091] The response determining unit 702 is configured to determine target response information based on the dialogue model trained by the above method for training a dialogue model and the target dialogue.

[0092] The response output unit 703 is configured to output the target response information.

[0093] It should be understood that the units 701 to 703 described in the device for outputting response information 700 respectively correspond to each step in the method described with reference to Figure 5 . Therefore, the operations and features described above for the method for outputting response information are also applicable to the device 700 and the units contained therein, and will not be described here again.

[0094] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0095] Figure 8 A schematic block diagram of an example electronic device 800 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 laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.

[0096] As Figure 8As shown, the device 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0097] A plurality of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, and the like; an output unit 807, such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, an optical disk, and the like; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0098] The computing unit 801 can be various general-purpose and / or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, and the like. The computing unit 801 performs various methods and processes described above, such as the method for training a dialog model or the method for outputting response information. For example, in some embodiments, the method for training a dialog model or the method for outputting response information can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method for training a dialog model or the method for outputting response information described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the method for training a dialog model or the method for outputting response information by any other appropriate means, such as by means of firmware.

[0099] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0100] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, or entirely on a remote machine or server.

[0101] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0102] To provide for interaction with a user, the systems and techniques described here 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 and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0103] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0104] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server can arise by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0105] It should be understood that various forms of flow shown above can be used, with steps reordered, added, or removed. For example, steps recited in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology of the present disclosure are achieved.

[0106] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the spirit and principles of the disclosure. Accordingly, the disclosure is not limited to the specific embodiments described above.

Claims

1. A method for training a dialogue model, comprising: obtaining a sample dialogue and a sample response label; generating a prior network based on the sample response label; generating an empathetic intention hidden vector corresponding to the sample dialogue through a discriminative network in a to-be-trained model and the prior network, wherein the empathetic intention hidden vector is used to describe an empathetic intention of the sample dialogue; determining a sentiment category and a text vector corresponding to the sample dialogue, splicing the empathetic intention hidden vector and the sentiment category to obtain an empathetic parameter, wherein the empathetic parameter is used to describe a sentiment response to the sample dialogue, and generating response information corresponding to the sample dialogue based on the empathetic parameter and the text vector; training the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model, wherein the trained dialogue model is used to output response information corresponding to a dialogue.

2. The method of claim 1, wherein, The determination of the sentiment category and the text vector corresponding to the sample dialogue comprises: encoding the sample dialogue to obtain a text vector corresponding to the sample dialogue; performing sentiment classification on the text vector to obtain a sentiment category corresponding to the sample dialogue.

3. The method of claim 1, wherein, The training of the to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model comprises: adjusting network parameters of the discriminative network based on the response information, the sample response label and the prior network to obtain a trained discriminative network; and determining the trained dialogue model based on the trained discriminative network.

4. The method of claim 3, wherein, The adjustment of the network parameters of the discriminative network based on the response information, the sample response label and the prior network to obtain a trained discriminative network comprises: in response to difference information between the response information and the sample response label not satisfying a preset difference condition, adjusting the network parameters of the discriminative network based on network parameters in the prior network until the difference information between the response information and the sample response label satisfies the preset difference condition, and obtaining the trained discriminative network.

5. A method for outputting response information, comprising: obtaining a target dialogue; determining target response information based on a dialogue model trained by the method for training a dialogue model according to any one of claims 1 to 4 and the target dialogue; and outputting the target response information.

6. An apparatus for training a dialogue model, comprising: a sample obtaining unit configured to obtain a sample dialogue and a sample response label; a hidden vector determining unit configured to generate a prior network based on the sample response label; generate an empathetic intention hidden vector corresponding to the sample dialogue through a discriminative network in a to-be-trained model and the prior network, wherein the empathetic intention hidden vector is used to describe an empathetic intention of the sample dialogue; The response generation unit is configured to determine a sentiment category and a text vector corresponding to the sample dialogue; splice the empathy intention hidden vector and the sentiment category to obtain an empathy parameter, wherein the empathy parameter is used to describe a sentiment response corresponding to the sample dialogue; and generate response information corresponding to the sample dialogue based on the empathy parameter and the text vector. The model training unit is configured to train a to-be-trained model based on the response information and the sample response label to obtain a trained dialogue model; and the trained dialogue model is used to output response information corresponding to a dialogue.

7. The apparatus of claim 6, wherein, The response generation unit is further configured to: encode the sample dialogue to obtain a text vector corresponding to the sample dialogue; and perform sentiment classification on the text vector to obtain a sentiment category corresponding to the sample dialogue.

8. The apparatus of claim 6, wherein, The model training unit is further configured to: adjust network parameters of the discriminative network based on the response information, the sample response label, and the prior network to obtain a trained discriminative network; and determine the trained dialogue model based on the trained discriminative network.

9. The apparatus of claim 8, wherein, The model training unit is further configured to: in response to difference information between the response information and the sample response label not satisfying a preset difference condition, adjust network parameters of the discriminative network based on network parameters in the prior network until the difference information between the response information and the sample response label satisfies the preset difference condition, to obtain the trained discriminative network.

10. An apparatus for outputting response information, comprising: a dialogue acquisition unit configured to acquire a target dialogue; a response determination unit configured to determine target response information based on a dialogue model trained by the method for training a dialogue model according to any one of claims 1 to 4 and the target dialogue; and a response output unit configured to output the target response information.

11. An electronic device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 4.

12. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method according to any one of claims 1 to 4.

13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Model training method, dialogue generation method and device, equipment and medium

    CN110188182A

  • Intelligent dialogue generation method and device, computer equipment and computer storage medium

    CN110990543A