A multi-turn dialogue method, device and electronic equipment

By using a pre-trained neural network model, combined with labeled and unlabeled data, the current dialogue state and response content in multi-turn dialogues are predicted, solving the problem of inaccurate state tracking in existing technologies and improving the performance of multi-turn dialogues.

CN114911911BActive Publication Date: 2026-01-20CHINA MOBILE COMM LTD RES INST +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110180487.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-08
Publication Date
2026-01-20
Estimated Expiration
2041-02-08

AI Technical Summary

Technical Problem

In existing technologies, rule-based methods for state tracking have low accuracy, resulting in poor dialogue performance in multi-turn conversations.

Method used

By employing a pre-trained neural network model, the current dialogue state is predicted by receiving user input dialogue content and historical dialogue states. The response content is determined using the neural network model, including joint training with labeled and unlabeled data, to improve the accuracy of state tracking.

Benefits of technology

This improves the accuracy of state tracking, thereby enhancing the effectiveness of multi-turn dialogues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911911B_ABST
    Figure CN114911911B_ABST
Patent Text Reader

Abstract

The application provides a multi-round dialogue method, device and electronic equipment, and relates to the technical field of artificial intelligence. The multi-round dialogue method comprises the following steps: receiving first dialogue content input by a user in a multi-round dialogue process; predicting a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content and historical dialogue content; determining reply content corresponding to the first dialogue content based on the first current dialogue state; and outputting the reply content corresponding to the first dialogue content. The embodiment of the application predicts the first current dialogue state by using historical information of the dialogue, can improve the accuracy of state tracking, and thus can improve the dialogue effect of the multi-round dialogue.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a multi-turn dialogue method, device and electronic equipment. BACKGROUND

[0002] With the development of artificial intelligence, multi-turn dialogue technology plays an increasingly important role in the scene of machine and user interaction. Through multi-turn dialogue technology, the machine can realize dialogue with the user and answer the user's questions. In the process of machine and user dialogue, one round of dialogue cannot clearly express the user's appeal, and multiple rounds of dialogue between the machine and the user are needed to finally answer the user's question.

[0003] In the prior art, a rule-based method is often used for state tracking, so as to generate a reply sentence based on the current dialogue state. The rule-based method uses a single natural language understanding result as input, and uses artificially formulated rules to match the current dialogue state. Since the input is relatively single, the accuracy of state tracking is low, which leads to poor dialogue effect in multi-turn dialogue. SUMMARY

[0004] The embodiments of the present application provide a multi-turn dialogue method, device and electronic equipment to solve the problem that the rule-based method is used for state tracking in the prior art, the accuracy of state tracking is low, and the dialogue effect in multi-turn dialogue is poor.

[0005] To solve the above technical problems, the present application is implemented as follows:

[0006] In a first aspect, the embodiments of the present application provide a multi-turn dialogue method, which comprises:

[0007] receiving first dialogue content input by a user in a multi-turn dialogue process;

[0008] predicting a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content;

[0009] determining reply content corresponding to the first dialogue content based on the first current dialogue state;

[0010] outputting the reply content corresponding to the first dialogue content.

[0011] Optionally, the step of predicting a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content comprises:

[0012] input the first dialogue content, historical dialogue state corresponding to the first dialogue content and historical dialogue content into a pre-trained first neural network model for state tracking, and output a first dialogue state probability distribution;

[0013] predict a first current dialogue state based on the first dialogue state probability distribution;

[0014] determining the reply content corresponding to the first dialogue content based on the first current dialogue state comprises:

[0015] input the first current dialogue state into a pre-trained second neural network model for reply decoding, and output a first reply content probability distribution;

[0016] determine the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

[0017] Optionally, the first neural network model comprises a first neural network sub-model for encoding and a second neural network sub-model for state decoding, and the inputting of the first dialogue content, historical dialogue state corresponding to the first dialogue content and historical dialogue content into the pre-trained first neural network model for state tracking and the outputting of the first dialogue state probability distribution comprise:

[0018] input the first dialogue content, historical dialogue state corresponding to the first dialogue content and historical dialogue content into the first neural network sub-model, and output encoded content;

[0019] input the encoded content into the second neural network sub-model, and output the first dialogue state probability distribution.

[0020] Optionally, the training samples of the first neural network model and the second neural network model in the training process comprise labeled data and unlabeled data.

[0021] Optionally, the training process of the first neural network model and the second neural network model under the labeled data is as follows:

[0022] input second dialogue content, historical dialogue state corresponding to the second dialogue content and historical dialogue content into the first neural network model, and output a second dialogue state probability distribution, the second dialogue content belonging to labeled data;

[0023] predict a second current dialogue state based on the second dialogue state probability distribution;

[0024] input the second current dialogue state into the second neural network model, and output a second reply content probability distribution;

[0025] determine the reply content corresponding to the second dialogue content based on the second reply content probability distribution;

[0026] input the reply content corresponding to the second dialogue content, the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and output a third dialogue state probability distribution;

[0027] calculate a maximum likelihood estimation value based on the second reply content probability distribution, the second dialogue state probability distribution, the third dialogue state probability distribution, and the dialogue state label and the reply content label corresponding to the second dialogue content;

[0028] jointly train the first neural network model and the second neural network model based on the maximum likelihood estimation value.

[0029] Optionally, the training process of the first neural network model and the second neural network model under the unlabeled data is as follows:

[0030] input the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and output a fourth dialogue state probability distribution, the third dialogue content being unlabeled data;

[0031] predict a third current dialogue state based on the fourth dialogue state probability distribution;

[0032] input the third current dialogue state into the second neural network model, and output a third reply content probability distribution;

[0033] determine the reply content corresponding to the third dialogue content based on the third reply content probability distribution;

[0034] input the reply content corresponding to the third dialogue content, the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and output a fifth dialogue state probability distribution;

[0035] calculate the entropy values of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution, respectively;

[0036] jointly train the first neural network model and the second neural network model based on the calculated entropy values.

[0037] Optionally, the jointly training the first neural network model and the second neural network model based on the calculated entropy values comprises:

[0038] calculate the KL divergence of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution.

[0039] The first neural network model and the second neural network model are jointly trained based on the calculated KL divergence and the calculated entropy value.

[0040] In a second aspect, an embodiment of the present application provides a multi-turn dialogue device, the device comprising:

[0041] A receiving module configured to receive first dialogue content input by a user in a multi-turn dialogue process;

[0042] A predicting module configured to predict a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content;

[0043] A determining module configured to determine reply content corresponding to the first dialogue content based on the first current dialogue state;

[0044] An outputting module configured to output the reply content corresponding to the first dialogue content.

[0045] Optionally, the predicting module comprises:

[0046] A first output unit configured to input the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into a first neural network model pre-trained for state tracking, and output a first dialogue state probability distribution;

[0047] A predicting unit configured to predict a first current dialogue state based on the first dialogue state probability distribution;

[0048] The determining module is specifically configured to:

[0049] input the first current dialogue state into a second neural network model pre-trained for reply decoding, and output a first reply content probability distribution;

[0050] determine the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

[0051] Optionally, the first neural network model comprises a first neural network sub-model for encoding and a second neural network sub-model for state decoding, and the first output unit is specifically configured to:

[0052] input the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into the first neural network sub-model, and output encoded content;

[0053] input the encoded content into the second neural network sub-model, and output the first dialogue state probability distribution.

[0054] Optionally, the training samples of the first neural network model and the second neural network model in the training process include labeled data and unlabeled data.

[0055] Optionally, the training process of the first neural network model and the second neural network model under the labeled data is as follows:

[0056] inputting the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and outputting a second dialogue state probability distribution, the second dialogue content belonging to the labeled data;

[0057] predicting a second current dialogue state based on the second dialogue state probability distribution;

[0058] inputting the second current dialogue state into the second neural network model, and outputting a second reply content probability distribution;

[0059] determining the reply content corresponding to the second dialogue content based on the second reply content probability distribution;

[0060] inputting the reply content corresponding to the second dialogue content, the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and outputting a third dialogue state probability distribution;

[0061] calculating a maximum likelihood estimation value based on the second reply content probability distribution, the second dialogue state probability distribution, the third dialogue state probability distribution, and the dialogue state label and the reply content label corresponding to the second dialogue content;

[0062] jointly training the first neural network model and the second neural network model based on the maximum likelihood estimation value.

[0063] Optionally, the training process of the first neural network model and the second neural network model under the unlabeled data is as follows:

[0064] inputting the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and outputting a fourth dialogue state probability distribution, the third dialogue content belonging to the unlabeled data;

[0065] predicting a third current dialogue state based on the fourth dialogue state probability distribution;

[0066] inputting the third current dialogue state into the second neural network model, and outputting a third reply content probability distribution;

[0067] determine the reply content corresponding to the third dialogue content based on the third reply content probability distribution;

[0068] input the reply content corresponding to the third dialogue content, the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and output a fifth dialogue state probability distribution;

[0069] respectively calculate the entropy values of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution;

[0070] jointly train the first neural network model and the second neural network model based on the calculated entropy values.

[0071] Optionally, the training process of the first neural network model and the second neural network model under the unlabeled data further includes:

[0072] calculate the KL divergence of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution;

[0073] jointly train the first neural network model and the second neural network model based on the calculated KL divergence and the calculated entropy values.

[0074] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program stored in the memory and executable on the processor, and the program, when executed by the processor, implements the steps of the multi-round dialogue method of the first aspect.

[0075] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the multi-round dialogue method of the first aspect.

[0076] In the embodiments of the present application, the first dialogue content input by a user in a multi-round dialogue process is received, a first current dialogue state is predicted according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content, the reply content corresponding to the first dialogue content is determined based on the first current dialogue state, and the reply content corresponding to the first dialogue content is output. In this way, the first current dialogue state is predicted by using the historical information of the dialogue, which can improve the accuracy of state tracking, thereby improving the dialogue effect of the multi-round dialogue. BRIEF DESCRIPTION OF DRAWINGS

[0077] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor under the premise of the drawings.

[0078] Figure 1 is a flow chart of a multi-round dialogue method provided by an embodiment of the present application;

[0079] Figure 2 is a structural schematic diagram of a state tracking model provided by an embodiment of the present application;

[0080] Figure 3 is a structural schematic diagram of a multi-round dialogue device provided by an embodiment of the present application;

[0081] Figure 4 is a structural schematic diagram of another multi-round dialogue device provided by an embodiment of the present application;

[0082] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0083] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0084] In the embodiments of the present application, a multi-round dialogue method, device and electronic device are proposed to solve the problem that the state tracking accuracy is low in the prior art by using a rule-based method, thereby leading to poor dialogue effect in multi-round dialogue.

[0085] Referring to Figure 1 , Figure 1 is a flow chart of a multi-round dialogue method provided by an embodiment of the present application, as shown in Figure 1 , the method comprises the following steps:

[0086] Step 101, receiving first dialogue content input by a user in a multi-round dialogue process.

[0087] The multi-round dialogue method can be applied to a dialogue system, and the dialogue system can be a dialogue system based on a partially observable Markov decision process (POMDP). The first dialogue content can be dialogue content input by a user to the dialogue system. The user can input the first dialogue content to the dialogue system in the form of voice, or the user can input the first dialogue content to the dialogue system in the form of text, and the embodiment is not limited in this regard. The first dialogue content can be dialogue content input in any round of the multi-round dialogue. For example, the user can input the first dialogue content to the dialogue system as: I want to book a ticket.

[0088] In step 102, a first current dialogue state is predicted according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content.

[0089] The historical dialogue state corresponding to the first dialogue content and the historical dialogue content can be a dialogue state and dialogue content of a round of dialogue before the first dialogue content, or can be a dialogue state and dialogue content of one round of dialogue before the first dialogue content. For example, the first dialogue content can be a dialogue of the tth round, and the historical dialogue state corresponding to the first dialogue content and the historical dialogue content can be a dialogue state and dialogue content of the (t-1)th round, i.e., a dialogue state and dialogue content of a previous round of dialogue of the first dialogue content. In the embodiment of the application, the historical dialogue state and the historical dialogue content are both illustrated by taking a dialogue state and dialogue content of a previous round of dialogue as an example.

[0090] In addition, the first current dialogue state can be predicted according to the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content by inputting the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into a first neural network model pre-trained for state tracking, outputting a first dialogue state probability distribution, and predicting the first current dialogue state based on the first dialogue state probability distribution.

[0091] For example, a dialogue state s of a dialogue round t t may be wherein, S represents a slot, n values are taken, and V represents a slot value corresponding to the slot S.

[0092] In step 103, a reply content corresponding to the first dialogue content is determined based on the first current dialogue state.

[0093] The determining of the reply content corresponding to the first dialogue content based on the first current dialogue state can be inputting the first current dialogue state into a second neural network model pre-trained for reply decoding, outputting a first reply content probability distribution, and determining the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

[0094] The outputting of the reply content corresponding to the first dialogue content.

[0095] The reply content corresponding to the first dialogue content can be output in a voice form or in a text form, and the embodiment is not limited in this regard.

[0096] In the embodiment, the first dialogue content input by a user in a multi-round dialogue process is received, a first current dialogue state is predicted according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content, a reply content corresponding to the first dialogue content is determined based on the first current dialogue state, and the reply content corresponding to the first dialogue content is output. In this way, the first current dialogue state is predicted by using the historical information of the dialogue, the accuracy of state tracking can be improved, and thus the dialogue effect of the multi-round dialogue can be improved.

[0097] Optionally, the predicting of the first current dialogue state according to the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content comprises:

[0098] The first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content are input into a first neural network model pre-trained for state tracking, and a first dialogue state probability distribution is output.

[0099] The first current dialogue state is predicted based on the first dialogue state probability distribution.

[0100] The determining of the reply content corresponding to the first dialogue content based on the first current dialogue state comprises:

[0101] The first current dialogue state is input into a second neural network model pre-trained for reply decoding, and a first reply content probability distribution is output.

[0102] The reply content corresponding to the first dialogue content is determined based on the first reply content probability distribution.

[0103] The first neural network model can adopt a recurrent neural network (RNN) structure. The first neural network model can include a first neural network sub-model for encoding and a second neural network sub-model for state decoding. The first dialogue state probability distribution can be a probability distribution of the first current dialogue state in a vocabulary. As a simple example, there are 10 words in the vocabulary, and each word can be a dialogue state. The first dialogue state probability distribution can include a probability value of each of the 10 words as the first current dialogue state. The first current dialogue state can be predicted based on the first dialogue state probability distribution, that is, the dialogue state with the maximum probability value in the first dialogue state probability distribution is determined as the first current dialogue state.

[0104] In addition, the second neural network model can be a model of a response decoder layer. The second neural network model can adopt an RNN structure. For example, the second neural network model can be a long short-term memory (LSTM) network structure, or the second neural network model can be a gate recurrent unit (GRU) network structure. The embodiment is not limited to the network structure of the second neural network model. The first current dialogue state can be represented as a vector. The second neural network model can output a first response content probability distribution based on the input first current dialogue state. The first response content probability distribution can be a probability distribution of a response content in a vocabulary. As a simple example, there are 15 words in the vocabulary, and each word can be a response content. The first response content probability distribution can include a probability value of each of the 15 words as the response content corresponding to the first dialogue content.

[0105] In this embodiment, the first current dialogue state is predicted by the first neural network model, and the response content corresponding to the first dialogue content is determined by the second neural network model. Compared with a rule-based method, the embodiment does not need to define rules manually, saves manual cost, and improves the accuracy of state tracking.

[0106] Optionally, the first neural network model includes a first neural network sub-model for encoding and a second neural network sub-model for state decoding. The first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content are input into the first neural network model pre-trained for state tracking, and a first dialogue state probability distribution is output, including:

[0107] input the first dialogue content, the historical dialogue state corresponding to the first dialogue content and the historical dialogue content into the first neural network sub-model, and output encoded content;

[0108] input the encoded content into the second neural network sub-model, and output a first dialogue state probability distribution.

[0109] The first neural network sub-model can be a model of an encoder layer, and can adopt an RNN structure. For example, the first neural network sub-model can be an LSTM network structure or a GRU network structure. The second neural network model is not limited in the embodiment. The first neural network sub-model can be used to encode input data, so that the dialogue system can understand the input data. The encoded content output by the first neural network sub-model can be represented by a vector.

[0110] In addition, the second neural network sub-model can be a model of a belief span decoder layer, and can adopt an RNN structure. For example, the second neural network sub-model can be an LSTM network structure or a GRU network structure. The second neural network model is not limited in the embodiment. The second neural network sub-model can output a first dialogue state probability distribution based on the input encoded content.

[0111] In this embodiment, the first dialogue content, the historical dialogue state corresponding to the first dialogue content and the historical dialogue content are input into the first neural network sub-model to output encoded content. The encoded content is input into the second neural network sub-model to output a first dialogue state probability distribution. The two sub-models are used to predict the first dialogue state probability distribution, and the accuracy is high.

[0112] Optionally, the training samples of the first neural network model and the second neural network model in the training process include labeled data and unlabeled data.

[0113] The first neural network model and the second neural network model can be supervised trained by the labeled data, and unsupervised trained by the unlabeled data.

[0114] In this embodiment, the training samples of the first neural network model and the second neural network model in the training process include labeled data and unlabeled data. The training is performed in a semi-supervised manner, which can reduce the use of labeled data, fully utilize a large amount of unlabeled data, and further improve the accuracy of the model in predicting the dialogue state.

[0115] Optionally, the training process of the first neural network model and the second neural network model under the labeled data is as follows:

[0116] inputting the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and outputting a second dialogue state probability distribution, the second dialogue content belonging to the labeled data;

[0117] predicting a second current dialogue state based on the second dialogue state probability distribution;

[0118] inputting the second current dialogue state into the second neural network model, and outputting a second reply content probability distribution;

[0119] determining the reply content corresponding to the second dialogue content based on the second reply content probability distribution;

[0120] inputting the reply content corresponding to the second dialogue content, the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and outputting a third dialogue state probability distribution;

[0121] calculating a maximum likelihood estimation value based on the second reply content probability distribution, the second dialogue state probability distribution, the third dialogue state probability distribution, and the dialogue state label and the reply content label corresponding to the second dialogue content;

[0122] jointly training the first neural network model and the second neural network model based on the maximum likelihood estimation value.

[0123] The second current dialogue state can be determined as the dialogue state with the maximum probability value in the second dialogue state probability distribution based on the second dialogue state probability distribution. The reply content corresponding to the second dialogue content can be determined as the reply content with the maximum probability value in the second reply content probability distribution based on the second reply content probability distribution. The dialogue state label can be a label set for the dialogue state in the labeled data, and the reply content label can be a label set for the reply content in the labeled data.

[0124] In addition, the maximum likelihood estimation value can be calculated by a maximum likelihood function, and the first neural network model and the second neural network model can be jointly trained by taking the maximum likelihood estimation value as a loss value. For example, the maximum likelihood estimation value L1 can be calculated by the maximum likelihood function in the following manner:

[0125]

[0126] wherein A can represent a supervised training process on labeled data. P(R t |R t-1 ,U t ,S t ) can be a probability value corresponding to a reply content label corresponding to the second dialogue content in the second reply content probability distribution, P θ (S t |R t-1 ,U t ,S t-1 ) can be a probability value corresponding to a dialogue state label corresponding to the second dialogue content in the second dialogue state probability distribution, can be a probability value corresponding to a dialogue state label corresponding to the second dialogue content in the third dialogue state probability distribution. R t-1 is the last round of reply content, U t is the current round of user input dialogue, S t-1 is the last round of dialogue state, S t is the current dialogue state, R t is the current round of reply content.

[0127] In this embodiment, for supervised training on labeled data, the first neural network model and the second neural network model are jointly trained based on the calculated maximum likelihood estimate value, and the accuracy of the trained model is high, so that the accuracy of predicting the dialogue state using the trained model is high.

[0128] Optionally, the training process of the first neural network model and the second neural network model under the unlabeled data is as follows:

[0129] inputting third dialogue content, historical dialogue state corresponding to the third dialogue content, and historical dialogue content into the first neural network model, outputting a fourth dialogue state probability distribution, wherein the third dialogue content belongs to unlabeled data;

[0130] predicting a third current dialogue state based on the fourth dialogue state probability distribution;

[0131] inputting the third current dialogue state into the second neural network model, outputting a third reply content probability distribution;

[0132] determining a reply content corresponding to the third dialogue content based on the third reply content probability distribution;

[0133] input the reply content corresponding to the third dialogue content, the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and output a fifth dialogue state probability distribution;

[0134] respectively calculate the entropy values of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution;

[0135] jointly train the first neural network model and the second neural network model based on the calculated entropy values.

[0136] The third current dialogue state can be determined based on the fourth dialogue state probability distribution, that is, the dialogue state with the maximum probability value in the fourth dialogue state probability distribution is determined as the third current dialogue state. The reply content corresponding to the third dialogue content can be determined based on the third reply content probability distribution, that is, the reply content with the maximum probability value in the third reply content probability distribution is determined as the reply content corresponding to the third dialogue content.

[0137] In addition, the first neural network model and the second neural network model can be jointly trained based on the calculated entropy values. For example, the first neural network model and the second neural network model can be jointly trained by taking the calculated entropy values as loss values, and the way of calculating the entropy values L2 of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution can be as follows:

[0138]

[0139] wherein U can represent an unsupervised training process on unlabeled data, β is a first preset coefficient, p i is the fourth dialogue state probability distribution, i is a positive integer, and N is the total number of possible dialogue states in the dialogue state probability distribution. q i is the fifth dialogue state probability distribution.

[0140] It should be noted that in statistics, the occurrence of an event can be described quantitatively by probability, and entropy is a statistical quantitative description, which describes the degree of uncertainty of information. The calculation formula is as follows:

[0141]

[0142] wherein p(x i represents a random event x iThe greater the probability, the smaller the uncertainty, and the smaller the entropy. In the process of training with unlabeled data, the model with better prediction effect has smaller class overlap, so in the unsupervised learning of the model, the classes of the unlabeled data can be separated as much as possible, rather than uniform probability distribution corresponding to each class. The way to measure the degree of class overlap can use information entropy calculation. In unsupervised training, the entropy is introduced into the objective function as a regularization term, which can improve the prediction effect of the first neural network model and the second neural network model.

[0143] In this embodiment, for the unsupervised training of the unlabeled data, the first neural network model and the second neural network model are jointly trained based on the calculated entropy value. By introducing the entropy value that can be used to measure the degree of class overlap into the model training process, the accuracy of the trained model is higher, so the accuracy of the trained model for predicting the dialogue state is higher.

[0144] Optionally, the joint training of the first neural network model and the second neural network model based on the calculated entropy value comprises:

[0145] calculating the KL divergence of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution;

[0146] jointly training the first neural network model and the second neural network model based on the calculated KL divergence and the calculated entropy value.

[0147] The joint training of the first neural network model and the second neural network model based on the calculated KL divergence and the calculated entropy value can be that the sum of the calculated KL divergence and the calculated entropy value is taken as the loss value for jointly training the first neural network model and the second neural network model. For example, the way to calculate the KL divergence L3 of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution can be as follows:

[0148]

[0149] Wherein, a is a second preset coefficient.

[0150] In addition, the unlabeled data can be data that the dialogue state is not labeled, and the reply content is labeled. In the process of training with unlabeled data, the log loss value L4 can be calculated based on the reply content label corresponding to the third dialogue content. The first neural network model and the second neural network model can be jointly trained based on the entropy value L2, the KL divergence L3 and the log loss value L4. The log loss value L4 can be obtained in the following way:

[0151]

[0152] Among them, P(R) t |R t-1 U t ,S t ) can be the probability value corresponding to the reply content tag of the third dialogue content in the probability distribution of the third reply content.

[0153] In addition, the joint training of the first neural network model and the second neural network model based on the entropy value L2, KL divergence L3 and log loss value L4 can be performed by using the sum of the calculated entropy value L2, KL divergence L3 and log loss value L4 as the loss value to jointly train the first neural network model and the second neural network model.

[0154] In this implementation, for unsupervised training of unlabeled data, the KL divergence of the fourth and fifth dialogue state probability distributions is introduced into the model training process. The difference between the two dialogue state prediction results is used to judge the model training effect. The trained model has high accuracy, thus the accuracy of predicting dialogue states using the trained model is high.

[0155] As a specific implementation, the dialogue method in this embodiment of the invention can be applied to a dialogue system. The dialogue system may include a semi-supervised state tracking model. By inputting the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into the semi-supervised state tracking model, the response content corresponding to the first dialogue content can be obtained. Figure 2 As shown, a semi-supervised state tracking model can include a first neural network sub-model, a second neural network sub-model, and a second neural network model. The second neural network model can also be trained using database knowledge. During semi-supervised training of the semi-supervised state tracking model, the model can be divided into a feedforward network and a feedback network based on different inputs. In the semi-supervised training process, the input to the feedforward network is the response content R from the previous round. t-1 The dialogue U input by the current user t The previous dialogue state S t-1 The output of the feedforward network is the current dialogue state S. t The probability distribution of the dialogue state and the current response R t The probability distribution of the response content; the input to the feedforward network is the response content R from the previous round. t-1 The dialogue U input by the current user t The previous dialogue state S t-1 , and the current response R output by the feedforward network t The output of the back feed network is the current dialogue state S. t The probability distribution of the dialogue state.

[0156] The loss function L for training the semi-supervised state tracking model can be represented as follows:

[0157]

[0158] Wherein, A can represent a supervised training process for labeled data, and U can represent an unsupervised training process for unlabeled data. The meanings of A and U in the loss function L are that if it is supervised training, the calculation item carrying A is used to calculate the loss function; if it is unsupervised training, the calculation item carrying U is used to calculate the loss function. The calculation item carrying A∪U represents that the calculation item is used to calculate the loss function in the supervised training and the unsupervised training process.

[0159] In this embodiment, for semi-supervised model training, in the supervised training, the maximum likelihood function is used to calculate the maximum likelihood estimate value for training, and the accuracy of the model is high; in the unsupervised training, the minimum value of information entropy is used for training, and the smaller the entropy is, the smaller the confusion degree of the model is, and the higher the information accuracy is.

[0160] Referring to Figure 3 , Figure 3 is a structural schematic diagram of a multi-round dialogue device provided by an embodiment of the present application, as Figure 3 shown, the multi-round dialogue device 200 includes:

[0161] The receiving module 201 is configured to receive first dialogue content input by a user in a multi-round dialogue process.

[0162] The prediction module 202 is configured to predict a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content.

[0163] The determination module 203 is configured to determine reply content corresponding to the first dialogue content based on the first current dialogue state.

[0164] The output module 204 is configured to output the reply content corresponding to the first dialogue content.

[0165] Optionally, as Figure 4 shown, the prediction module 202 includes:

[0166] The first output unit 2021 is configured to input the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into a first neural network model pre-trained for state tracking, and output a first dialogue state probability distribution.

[0167] The prediction unit 2022 is configured to predict a first current dialogue state based on the first dialogue state probability distribution.

[0168] The determination module 203 is specifically configured to:

[0169] input the first current dialogue state into a pre-trained second neural network model for reply decoding, and output a first reply content probability distribution;

[0170] determine the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

[0171] Optionally, the first neural network model comprises a first neural network sub-model for encoding and a second neural network sub-model for state decoding, and the first output unit 2021 is specifically configured to:

[0172] input the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into the first neural network sub-model, and output encoded content;

[0173] input the encoded content into the second neural network sub-model, and output a first dialogue state probability distribution.

[0174] Optionally, the training samples of the first neural network model and the second neural network model in the training process comprise labeled data and unlabeled data.

[0175] Optionally, the training process of the first neural network model and the second neural network model under the labeled data is as follows:

[0176] input the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and output a second dialogue state probability distribution, the second dialogue content belonging to the labeled data;

[0177] predict a second current dialogue state based on the second dialogue state probability distribution;

[0178] input the second current dialogue state into the second neural network model, and output a second reply content probability distribution;

[0179] determine the reply content corresponding to the second dialogue content based on the second reply content probability distribution;

[0180] input the reply content corresponding to the second dialogue content, the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model, and output a third dialogue state probability distribution;

[0181] The maximum likelihood estimate is calculated based on the probability distribution of the second reply content, the probability distribution of the second dialogue state, the probability distribution of the third dialogue state, and the dialogue state label and reply content label corresponding to the second dialogue content.

[0182] The first neural network model and the second neural network model are jointly trained based on the maximum likelihood estimate.

[0183] Optionally, the training process of the first neural network model and the second neural network model on the unlabeled data is as follows:

[0184] The third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content are input into the first neural network model, and the fourth dialogue state probability distribution is output. The third dialogue content belongs to unlabeled data.

[0185] Predict the third current dialogue state based on the probability distribution of the fourth dialogue state;

[0186] The third current dialogue state is input into the second neural network model, and the probability distribution of the third response content is output.

[0187] The response content corresponding to the third dialogue content is determined based on the probability distribution of the third response content.

[0188] Input the reply content corresponding to the third dialogue content, the third dialogue content, the historical dialogue state corresponding to the third dialogue content, and the historical dialogue content into the first neural network model, and output the probability distribution of the fifth dialogue state.

[0189] Calculate the entropy values ​​of the probability distributions of the fourth and fifth dialogue states, respectively.

[0190] The first neural network model and the second neural network model are jointly trained based on the calculated entropy value.

[0191] Optionally, the training process of the first neural network model and the second neural network model on the unlabeled data further includes:

[0192] Calculate the KL divergence of the probability distribution of the fourth dialogue state and the probability distribution of the fifth dialogue state;

[0193] The first neural network model and the second neural network model are jointly trained based on the calculated KL divergence and the calculated entropy value.

[0194] Multi-turn dialogue devices can achieve Figure 1 The various processes implemented in the method embodiments can achieve the same technical effect, and will not be described again here to avoid repetition.

[0195] As Figure 5 shown in the above method embodiments, the present application also provides an electronic device 300, comprising a processor 301, a memory 302, and a program stored in the memory 302 and executable on the processor 301, wherein the program is executed by the processor 301 to implement the processes of the above multi-round dialogue method embodiments and achieve the same technical effects. For the sake of brevity, the details are not repeated here.

[0196] The present application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the processes of the above multi-round dialogue method embodiments and achieve the same technical effects. For the sake of brevity, the details are not repeated here. The computer readable storage medium can be, for example, a ROM, a RAM, a magnetic disk, or an optical disk.

[0197] It should be noted that in this document, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, so that processes, methods, articles, or devices that include a series of elements not only include those elements, but also include other elements not explicitly listed, or inherent to such processes, methods, articles, or devices. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.

[0198] From the above description of the embodiments, those skilled in the art can clearly understand that the above method embodiments can be implemented by means of software and a necessary general hardware platform, of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a number of instructions for causing a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the various embodiments of the present application.

[0199] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above specific embodiments, which are merely illustrative and not limiting. Those skilled in the art can make many modifications to the present application without departing from the spirit and scope of the present application, and all such modifications are intended to be within the scope of the present application.

Claims

1. A multi-turn dialogue method, characterized in that, The method comprises: receiving first dialogue content input by a user during a multi-round dialogue process; predicting a first current dialogue state according to the first dialogue content, a historical dialogue state corresponding to the first dialogue content, and historical dialogue content; determining reply content corresponding to the first dialogue content based on the first current dialogue state; outputting the reply content corresponding to the first dialogue content; The method comprises: inputting the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into a first neural network model pre-trained for state tracking to output a first dialogue state probability distribution; predicting a first current dialogue state based on the first dialogue state probability distribution; The method comprises: inputting the first current dialogue state into a second neural network model pre-trained for reply decoding to output a first reply content probability distribution; determining the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

2. The method of claim 1, wherein, The first neural network model comprises a first neural network sub-model for encoding and a second neural network sub-model for state decoding, and the method comprises: inputting the first dialogue content, the historical dialogue state corresponding to the first dialogue content, and the historical dialogue content into the first neural network sub-model to output encoded content; inputting the encoded content into the second neural network sub-model to output the first dialogue state probability distribution.

3. The method of claim 1, wherein, The training samples of the first neural network model and the second neural network model in the training process comprise labeled data and unlabeled data.

4. The method of claim 3, wherein, The training process of the first neural network model and the second neural network model under the labeled data is as follows: inputting second dialogue content, a historical dialogue state corresponding to the second dialogue content, and historical dialogue content into the first neural network model to output a second dialogue state probability distribution, the second dialogue content belonging to labeled data; predicting a second current dialogue state based on the second dialogue state probability distribution; inputting the second current dialogue state into the second neural network model to output a second reply content probability distribution; determining reply content corresponding to the second dialogue content based on the second reply content probability distribution; inputting the reply content corresponding to the second dialogue content, the second dialogue content, the historical dialogue state corresponding to the second dialogue content, and the historical dialogue content into the first neural network model to output a third dialogue state probability distribution; calculating a maximum likelihood estimation value based on the second reply content probability distribution, the second dialogue state probability distribution, the third dialogue state probability distribution, and dialogue state labels and reply content labels corresponding to the second dialogue content; jointly training the first neural network model and the second neural network model based on the maximum likelihood estimation value.

5. The method of claim 3, wherein, The training process of the first neural network model and the second neural network model under the unlabeled data is as follows: inputting third dialogue content, historical dialogue states corresponding to the third dialogue content, and historical dialogue content into the first neural network model, and outputting a fourth dialogue state probability distribution, wherein the third dialogue content belongs to unlabeled data; predicting a third current dialogue state based on the fourth dialogue state probability distribution; inputting the third current dialogue state into the second neural network model, and outputting a third reply content probability distribution; determining reply content corresponding to the third dialogue content based on the third reply content probability distribution; inputting the reply content corresponding to the third dialogue content, third dialogue content, historical dialogue states corresponding to the third dialogue content, and historical dialogue content into the first neural network model, and outputting a fifth dialogue state probability distribution; calculating entropy values of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution respectively; jointly training the first neural network model and the second neural network model based on the calculated entropy values.

6. The method of claim 5, wherein, The jointly training the first neural network model and the second neural network model based on the calculated entropy values comprises: calculating KL divergences of the fourth dialogue state probability distribution and the fifth dialogue state probability distribution; jointly training the first neural network model and the second neural network model based on the calculated KL divergences and the calculated entropy values.

7. A multi-turn dialogue apparatus, characterized by, The apparatus comprises: a receiving module configured to receive first dialogue content input by a user in a multi-round dialogue process; a predicting module configured to predict a first current dialogue state based on the first dialogue content, historical dialogue states corresponding to the first dialogue content, and historical dialogue content; a determining module configured to determine reply content corresponding to the first dialogue content based on the first current dialogue state; an outputting module configured to output the reply content corresponding to the first dialogue content; the predicting module comprises: a first output unit configured to input the first dialogue content, historical dialogue states corresponding to the first dialogue content, and historical dialogue content into a first neural network model pre-trained for state tracking, and output a first dialogue state probability distribution; a predicting unit configured to predict a first current dialogue state based on the first dialogue state probability distribution; the determining module is specifically configured to: input the first current dialogue state into a second neural network model pre-trained for reply decoding, and output a first reply content probability distribution; determine the reply content corresponding to the first dialogue content based on the first reply content probability distribution.

8. An electronic device, comprising: comprises: A processor, a memory, and a program stored on the memory and executable on the processor, the program, when executed by the processor, implementing the steps of the multi-turn dialogue method as claimed in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer readable storage medium, and when executed by the processor, the program implements the steps of the multi-turn dialogue method as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Mobile customer service conversation management method based on state tracking and strategy guidance

    CN108282587A