A method for training a dialogue model, a dialogue method and device
By comparing predicted dialogue information with expert dialogue information based on intent correctness and domain relevance during dialogue model training, and adjusting the model to meet preset conditions, the problem of semantic mismatch in existing technologies is solved, and the accurate output of the dialogue model in multiple domains is achieved.
Patent Information
- Application Number
- CN202011026144.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2040-09-25
AI Technical Summary
Existing dialogue models are typically trained based on word similarity, which results in the predicted sentences having a significant difference in semantics from the standard answer and failing to output accurate dialogue information.
By acquiring the predicted dialogue information output by the dialogue model based on preset historical dialogue information, and comparing the predicted dialogue information with expert dialogue information based on the dimensions of intent correctness and domain relevance, comprehensive feedback information is obtained, and the model is adjusted based on this until the preset conditions are met.
It achieves accurate output of the dialogue model in multi-domain dialogue, improves the matching degree between predicted dialogue information and expert dialogue information, and outputs more accurate dialogue information.
Smart Images

Figure CN114254086B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of language processing, and in particular to a dialogue model training method, a dialogue method, a dialogue model training device, and a dialogue device. BACKGROUND
[0002] With the development of natural language processing technology, machine learning models can be used in the field of intelligent dialogue, and replies are made according to the user input sentences, so as to realize the effect of dialogue with the user. However, in the training process of the existing dialogue model, the model is usually trained based on the similarity between each word in the predicted sentence output by the dialogue model and the standard answer, while the actual semantics of the predicted sentence may be quite different from the standard answer. SUMMARY
[0003] In view of the above problems, the present application is proposed to provide a dialogue model training method, a dialogue method, a dialogue model training device, and a dialogue device which overcome the above problems or at least partially solve the above problems.
[0004] To solve the above problems, the present application discloses a dialogue model training method, comprising:
[0005] Obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information;
[0006] Comparing the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information;
[0007] Adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
[0008] Optionally, the step of comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information comprises:
[0009] Comparing the predicted dialogue information and the preset expert dialogue information based on the intent correctness dimension and the domain relevance dimension to obtain comprehensive feedback information.
[0010] Optionally, the step of comparing the predicted dialogue information and the preset expert dialogue information based on the intent correctness dimension and the domain relevance dimension to obtain comprehensive feedback information comprises:
[0011] Determining the similarity between the predicted dialogue information and the preset expert dialogue information to obtain intent correctness information;
[0012] The number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information are used to determine field relevance information of the predicted dialogue information.
[0013] The intention correctness information and the field relevance information are used to determine comprehensive feedback information.
[0014] Optionally, the step of comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information comprises:
[0015] The entity words contained in the historical dialogue information are used to determine a dialogue field corresponding to the historical dialogue information.
[0016] The dialogue field is used to determine weight information of each dimension.
[0017] Optionally, the step of adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed comprises:
[0018] The dialogue model is adjusted based on the comprehensive feedback information.
[0019] The steps of obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information, comparing the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information, and determining whether the comprehensive feedback information meets a preset condition are re-executed.
[0020] In the case where the comprehensive feedback information meets the preset condition, the dialogue model training is completed.
[0021] Optionally, the dialogue model comprises a sentence encoding layer, a context vector encoding layer, an action layer, and a decoding layer.
[0022] The step of obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information comprises:
[0023] The sentence encoding layer of the dialogue model encodes the preset historical dialogue information to output a sentence vector.
[0024] The context vector encoding layer of the dialogue model encodes the sentence vector to output a context vector.
[0025] The action layer of the dialogue model encodes the context vector to output an action vector.
[0026] The decoding layer of the dialogue model decodes the action vector to output predicted dialogue information.
[0027] The embodiment of the application further discloses a dialogue method, comprising:
[0028] obtaining user dialogue information input by a user;
[0029] obtaining dialogue feedback information output by a preset dialogue model for the user dialogue information; the dialogue model is obtained by obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information; the predicted dialogue information and preset expert dialogue information are compared based on at least two dimensions to obtain comprehensive feedback information; the dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition;
[0030] returning the dialogue feedback information to the user.
[0031] Optionally, the step of returning the dialogue feedback information to the user comprises:
[0032] checking whether content matching preset general dialogue information exists in the dialogue feedback information;
[0033] in the case that the content matching the preset general dialogue information exists in the dialogue feedback information, deleting the content matching the preset general dialogue information in the dialogue feedback information to obtain adjusted dialogue feedback information;
[0034] returning the adjusted dialogue feedback information to the user.
[0035] Optionally, the step of obtaining dialogue feedback information output by a preset dialogue model for the user dialogue information comprises:
[0036] obtaining dialogue feedback information output by the preset dialogue model for the user dialogue information and user historical dialogue information.
[0037] The embodiment of the application further discloses a dialogue model training device, comprising:
[0038] a predicted dialogue information obtaining module, configured to obtain predicted dialogue information output by the dialogue model based on preset historical dialogue information;
[0039] a comprehensive feedback information obtaining module, configured to compare the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information;
[0040] an adjusting module, configured to adjust the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
[0041] Optionally, the comprehensive feedback information obtaining module comprises:
[0042] The comprehensive feedback information acquisition sub-module compares the predicted dialogue information and the preset expert dialogue information based on the intention correctness dimension and the field correlation dimension to obtain comprehensive feedback information.
[0043] Optionally, the comprehensive feedback information acquisition sub-module comprises:
[0044] An intention correctness information determination unit is configured to determine the similarity between the predicted dialogue information and the preset expert dialogue information to obtain intention correctness information.
[0045] A field correlation information determination unit is configured to determine the field correlation information of the predicted dialogue information by using the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information.
[0046] A comprehensive feedback information determination unit is configured to determine the comprehensive feedback information by using the intention correctness information and the field correlation information.
[0047] Optionally, the comprehensive feedback information acquisition module comprises:
[0048] A dialogue field determination module is configured to determine the dialogue field corresponding to the historical dialogue information by using the entity words contained in the historical dialogue information.
[0049] A weight information determination module is configured to determine the weight information of each dimension by using the dialogue field.
[0050] Optionally, the adjustment module comprises:
[0051] An adjustment sub-module is configured to adjust the dialogue model based on the comprehensive feedback information.
[0052] A condition determination sub-module is configured to determine whether the comprehensive feedback information meets a preset condition by re-executing the step of acquiring the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information.
[0053] A model output sub-module is configured to complete the training of the dialogue model when the comprehensive feedback information meets the preset condition.
[0054] Optionally, the dialogue model comprises a sentence encoding layer, a context vector encoding layer, an action layer, and a decoding layer.
[0055] The predicted dialogue information acquisition module comprises:
[0056] The sentence vector output submodule is configured to encode the preset historical dialogue information by using the sentence encoding layer of the dialogue model, and output a sentence vector.
[0057] The context vector output submodule is configured to encode the sentence vector by using the context vector encoding layer of the dialogue model, and output a context vector.
[0058] The action vector output submodule is configured to encode the context vector by using the action layer of the dialogue model, and output an action vector.
[0059] The predicted dialogue information output submodule is configured to decode the action vector by using the encoding layer of the dialogue model, and output predicted dialogue information.
[0060] Embodiments of the present application also disclose a dialogue device, which is characterized in that comprising:
[0061] The user dialogue information acquisition module is configured to acquire user dialogue information input by a user.
[0062] The dialogue feedback information acquisition module is configured to acquire dialogue feedback information output by a preset dialogue model in response to the user dialogue information, wherein the dialogue model is configured to acquire predicted dialogue information output by the dialogue model based on preset historical dialogue information, compare the predicted dialogue information and preset expert dialogue information based on at least two dimensions, and obtain comprehensive feedback information; and the dialogue model is configured to adjust the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition.
[0063] The returning module is configured to return the dialogue feedback information to the user.
[0064] Optionally, the returning module comprises:
[0065] The searching submodule is configured to search whether there is content matching preset general dialogue information in the dialogue feedback information.
[0066] The deleting submodule is configured to delete the content matching the preset general dialogue information in the dialogue feedback information, and obtain adjusted dialogue feedback information, in a case where there is the content matching the preset general dialogue information in the dialogue feedback information.
[0067] The returning submodule is configured to return the adjusted dialogue feedback information to the user.
[0068] Optionally, the dialogue feedback information acquisition module comprises:
[0069] The dialogue feedback information acquisition submodule is configured to acquire dialogue feedback information output by a preset dialogue model in response to the user dialogue information and user historical dialogue information.
[0070] This application also discloses an apparatus, including:
[0071] One or more processors; and
[0072] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the apparatus to perform one or more methods as described in the embodiments of this application.
[0073] This application also discloses one or more machine-readable media storing instructions that, when executed by one or more processors, cause the processors to perform one or more methods as described in this application.
[0074] The embodiments of this application have the following advantages:
[0075] The training method for the dialogue model in this application involves obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information; comparing the predicted dialogue information with preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information; and adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets preset conditions, thus completing the training of the dialogue model. This allows for the evaluation of the overall similarity between the predicted dialogue information and the expert dialogue information based on multiple dimensions, enabling the obtained predicted dialogue information to better match the expert dialogue information. Consequently, the trained dialogue model can be applied to dialogues in multiple domains, providing users with more accurate dialogue information. Attached Figure Description
[0076] Figure 1 This is a flowchart illustrating the steps of a training method for a dialogue model according to an embodiment of this application.
[0077] Figure 2 This is a flowchart illustrating the steps of another embodiment of the training method for a dialogue model according to this application.
[0078] Figure 3 This is a schematic diagram of the structure of a dialogue model according to an embodiment of this application;
[0079] Figure 4 This is a schematic diagram illustrating the training of a dialogue model according to an embodiment of this application;
[0080] Figure 5 This is a flowchart illustrating the steps of one embodiment of a dialogue method according to this application.
[0081] Figure 6 This is a flowchart illustrating the steps of another embodiment of the dialogue method in this application.
[0082] Figure 7 is a structural block diagram of an embodiment of a training device of a dialogue model of the present application;
[0083] Figure 8 is a structural block diagram of an embodiment of a dialogue device of the present application. DETAILED DESCRIPTION
[0084] In order to make the above objectives, features and advantages of the present application more apparent and easy to understand, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0085] The embodiments of the present application obtain comprehensive feedback information by comprehensively evaluating the similarity between the predicted dialogue information output by the dialogue model and the preset expert dialogue information from the whole dialogue information based on multiple different dimensions in the process of training the dialogue model, and adjust the dialogue model based on the comprehensive feedback information, so that the completed dialogue model can be applied to dialogue in multiple fields and output more accurate dialogue information to the user. The dialogue model can be applied to multiple different application scenarios. For example, language teaching in an education scenario; oral dialogue test in an examination scenario; serving as a guide to introduce goods to users and processing users' pre-sale and after-sale service needs in a shopping scenario; feedback to users' query needs in the form of dialogue in a query scenario, etc.
[0086] Referring to Figure 1 , a step flowchart of an embodiment of a dialogue model training method of the present application is shown, which can specifically include the following steps:
[0087] Step 101, obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information;
[0088] In the embodiments of the present application, the dialogue model can be input with preset historical dialogue information, and obtain predicted dialogue information output by the dialogue model based on the dialogue information.
[0089] Specifically, since the user usually has multiple rounds of dialogue interaction on the same topic in the process of dialogue interaction with the dialogue model, each round of dialogue in the multiple rounds of dialogue is usually associated with the dialogue in the historical round. Therefore, the historical dialogue information can include the dialogue information input by the user currently, and the dialogue information in the historical dialogue round of the user and the dialogue party. In the case where the current dialogue round of the user is the first dialogue round, there can be no dialogue information in the historical dialogue round.
[0090] As an example of the present application, in the following historical dialogue information "User: My express delivery has been for several days, why not deliver; Dialogue party: Dear, I will help you to urge, and will deliver as soon as possible; User: OK, how many days can it arrive after delivery?" "User: My express delivery has been for several days, why not deliver; Dialogue party: Dear, I will help you to urge, and will deliver as soon as possible" can be the dialogue information of the historical dialogue turn between the user and the dialogue party, and "OK, how many days can it arrive after delivery?" can be the dialogue information input by the user at present.
[0091] The historical dialogue information can be input into the dialogue model, and the dialogue model can output predicted dialogue information based on the dialogue information of the historical dialogue turn between the user and the dialogue party in the historical dialogue information and the dialogue information input by the user at present, so as to reply to the dialogue information input by the user at present.
[0092] In a specific implementation, the dialogue model can be a bidirectional long short-term memory network model, a long short-term memory model, a Seq2Seq model, etc., and the present application does not limit this.
[0093] Step 102, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information;
[0094] In the embodiment of the present application, expert dialogue information can be preset. The expert dialogue information can be dialogue information artificially generated to reply to the historical dialogue information. The expert dialogue information can be used as a standard, and after obtaining the predicted dialogue information output by the dialogue model, whether the predicted dialogue information and the expert dialogue information are similar can be compared based on at least two dimensions, and comprehensive feedback information can be obtained.
[0095] The comprehensive feedback information can be feedback information obtained by comprehensively evaluating whether the predicted dialogue information and the expert dialogue information are similar based on at least two dimensions. The dimensions can be different ways of comparing the similarity between the predicted dialogue information and the expert dialogue information, for example, whether the intention expressed by the predicted dialogue information is similar to the expert dialogue information, whether the dialogue field corresponding to the predicted dialogue information has a high correlation degree with the dialogue field corresponding to the expert dialogue information, etc., and the present application does not limit this.
[0096] Therefore, the overall predicted dialogue information can be compared with the expert dialogue information in multiple dimensions, avoiding the case that only words in the predicted dialogue information are compared with the expert dialogue information, which may lead to a semantic inconsistency. Meanwhile, the similarity between the predicted dialogue information and the expert dialogue information can be evaluated in multiple dimensions, so that the predicted dialogue information obtained can better match the expert dialogue information, and thus the dialogue model can output more accurate dialogue information to the user.
[0097] In step 103, the dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
[0098] In the embodiment of the present application, whether the dialogue model is trained can be determined based on the similarity between the predicted dialogue information and the expert dialogue information, i.e., the comprehensive feedback information. Therefore, in the case that the comprehensive feedback information does not meet the prediction condition, the parameters in the dialogue model can be adjusted, and the predicted dialogue information is output again based on the adjusted dialogue model, and new comprehensive feedback information is obtained. In the case that the comprehensive feedback information meets the preset condition, it can be considered that the dialogue model can output predicted dialogue information with high similarity to the expert dialogue information, and thus the dialogue model training is completed.
[0099] Through the dialogue model training method of the embodiment of the present application, the predicted dialogue information output by the dialogue model based on the preset historical dialogue information is obtained; the predicted dialogue information and the preset expert dialogue information are compared based on at least two dimensions to obtain comprehensive feedback information; and the dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed. Therefore, the similarity between the overall predicted dialogue information and the expert dialogue information can be evaluated based on multiple dimensions, so that the predicted dialogue information obtained can better match the expert dialogue information, and thus the trained dialogue model can be applied to dialogue in multiple fields to output more accurate dialogue information to the user.
[0100] Reference Figure 2 FIG. 1 shows a step flowchart of an embodiment of a dialogue model training method of the present application, which can specifically include the following steps:
[0101] In step 201, the predicted dialogue information output by the dialogue model based on the preset historical dialogue information is obtained.
[0102] In the embodiment of the present application, the dialogue model can be input into the preset historical dialogue information, and the predicted dialogue information output by the dialogue model based on the dialogue information can be obtained.
[0103] Specifically, during the conversation interaction with the dialogue model, the user can usually have multi-round conversation interactions on the same topic. The conversation of each round in the multi-round conversation is usually associated with the conversation of the historical round. Thus, the historical conversation information can include the current input of the user and the conversation information of the historical conversation round of the user and the dialogue party. In the case of the current conversation round of the user being the first conversation round, there can be no conversation information of the historical conversation round. The conversation information of the dialogue party in the historical conversation round of the user and the dialogue party can be artificially generated, and can be generated by the dialogue model, which is not limited in the present application.
[0104] The historical conversation information can be input into the dialogue model, and the dialogue model can output predicted conversation information based on the conversation information of the historical conversation round between the user and the dialogue party in the historical conversation information and the current input of the user, so as to reply to the current input of the user.
[0105] Optionally, the general conversation information can be general and does not contain valid information. For example, "um", "good, dear", "good, good", "um, thank you for your understanding" and the like. In order to avoid the dialogue model learned by training from learning the general conversation information that does not contain valid information, so that the dialogue model cannot output predicted conversation information containing valid information. The historical conversation information can be preprocessed to delete the general conversation information contained in the historical conversation information. For example, after deleting the general conversation information in the historical conversation information, the adjusted historical conversation information is used to train the dialogue model.
[0106] In an embodiment of the present application, the structural diagram of the dialogue model can be as shown in Figure 3 The dialogue model includes a sentence encoding layer 301 (Sentence Encoder), a context vector encoding layer 302 (Context Encoder), an action layer 303 (Action Layer), and a decoding layer 304 (Decoder).
[0107] The step of obtaining the predicted conversation information output by the dialogue model based on the preset historical conversation information includes:
[0108] S11, the sentence encoding layer of the dialogue model encodes the preset historical conversation information, and outputs a sentence vector;
[0109] In an embodiment of the present application, the sentence encoding layer of the dialogue model can encode each sentence of the historical conversation information and correspondingly convert it into at least one sentence vector.
[0110] S12, the context vector encoding layer of the dialogue model encodes the sentence vector, and outputs a context vector;
[0111] In the embodiment of the present application, the context vector encoding layer can learn the context correlation between the sentence vectors, update its own loop state, and encode each sentence vector to output a corresponding context vector.
[0112] S13, the action layer of the dialogue model encodes the context vector, and outputs an action vector;
[0113] In the embodiment of the present application, the action layer can be used to further encode the context vector and output an action vector. The action vector can be regarded as an action performed by the dialogue model in response to the input historical dialogue information. The present application can feed back a comprehensive feedback information to the action performed by the dialogue model, and then adjust the dialogue model based on the comprehensive feedback information, so as to realize the reinforcement learning of the dialogue model.
[0114] In a specific implementation, the action layer can be a linear layer (Linear Layer). The action layer can perform linear operation on at least one context vector output by the context vector layer, and finally obtain an action vector.
[0115] S14, the encoding layer of the dialogue model decodes the action vector, and outputs predicted dialogue information.
[0116] In the embodiment of the present application, the encoding layer of the dialogue model decodes the action vector and outputs predicted dialogue information, so that the predicted dialogue information in response to the historical dialogue information can be obtained.
[0117] Step 202, comparing the predicted dialogue information and the preset expert dialogue information based on the intent correctness dimension and the domain related dimension, and obtaining a comprehensive feedback information;
[0118] In the embodiment of the present application, the expert dialogue information can be preset. The expert dialogue information can be artificially generated dialogue information in response to the historical dialogue information. As an example of the present application, the expert dialogue information can be information obtained by dialogue between the user and the artificial dialogue party. The expert dialogue information can be used as a standard. After obtaining the predicted dialogue information output by the dialogue model, whether the predicted dialogue information and the expert dialogue information are similar can be compared based on the intent correctness dimension and the domain related dimension, and a comprehensive feedback information can be obtained.
[0119] The intent correctness can be whether the predicted dialogue information correctly expresses an intent similar to the expert dialogue information. The domain relevance dimension can be whether a dialogue domain to which the predicted dialogue information belongs has a high correlation with a dialogue domain to which the expert dialogue information belongs.
[0120] Optionally, the domain relevance dimension can further include a domain consistency dimension and a domain coherence dimension. Specifically, the domain consistency dimension can be whether a dialogue domain to which the predicted dialogue information belongs has a high similarity with a dialogue domain to which the expert dialogue information belongs. The domain coherence dimension can be whether the predicted dialogue information expresses good coherence of the dialogue domain.
[0121] In this way, the predicted dialogue information can be compared with the expert dialogue information in multiple dimensions, avoiding comparison of only words in the predicted dialogue information with the expert dialogue information, which can lead to a situation of semantic inconsistency. Meanwhile, the similarity between the predicted dialogue information and the expert dialogue information can be evaluated in multiple dimensions, so that the predicted dialogue information obtained can better match the expert dialogue information, and thus the dialogue model can output more accurate dialogue information to the user.
[0122] In an embodiment of the present application, the step of comparing the predicted dialogue information and the preset expert dialogue information based on the intent correctness dimension and the domain relevance dimension to obtain comprehensive feedback information includes:
[0123] S21, determining a similarity between the predicted dialogue information and the preset expert dialogue information to obtain intent correctness information;
[0124] In the embodiment of the present application, if the predicted dialogue information and the preset expert dialogue information have a high similarity, it can be considered that the predicted dialogue information can correctly express an intent similar to the expert dialogue information. In this way, the similarity between the predicted dialogue information and the preset expert dialogue information can be determined to obtain the intent correctness information.
[0125] In a specific implementation, a text similarity between the predicted dialogue information and the expert dialogue information can be calculated, and the text similarity can be taken as the intent correctness information.
[0126] As an optional implementation of the present application, an ESIM (Enhanced LSTM for Natural Language Inference) model can be used to calculate the text similarity between the predicted dialogue information and the expert dialogue information.
[0127] S22, determine the domain relevance information of the predicted dialogue information by using the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information.
[0128] In the embodiments of the present application, if the entity words in the expert dialogue information appear more in the predicted dialogue information, it can be considered that the predicted dialogue information has a higher correlation degree with the expert dialogue information in the dialogue domain, so that the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information can be used to determine the domain relevance information of the predicted dialogue information.
[0129] In specific implementation, the entity words in the expert dialogue information and the predicted dialogue information can be extracted respectively, and it is determined whether the entity words in the predicted dialogue information also appear in the expert dialogue information. If the number of entity words appearing in both the predicted dialogue information and the expert dialogue information accounts for a larger proportion of the number of entity words in the expert dialogue information, it can be considered that the predicted dialogue information has a higher domain relevance, so that the domain relevance information can be obtained.
[0130] As an example of the present application, the domain relevance information R ER The following formula can be used for calculation:
[0131]
[0132] Wherein, the N both is the number of entity words appearing in both the predicted dialogue information and the expert dialogue information, the N y is the number of entity words in the expert dialogue information.
[0133] S23, determine the comprehensive feedback information by using the intent correctness information and the domain relevance information.
[0134] In the embodiments of the present application, the intent correctness information and the domain relevance information can be used to determine the comprehensive feedback information. Therefore, the comprehensive feedback information can feedback that the predicted dialogue information has better accuracy from multiple dimensions.
[0135] In a specific implementation, different weight information can be assigned to the intention correctness information and the field relevance information, and the intention correctness information, the field relevance information, and the weight information are used to calculate the comprehensive feedback information.
[0136] In an embodiment of the present application, the step of comparing the predicted dialogue information with the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information includes:
[0137] S31, determining the dialogue field corresponding to the historical dialogue information by using the entity word contained in the historical dialogue information.
[0138] In an embodiment of the present application, the historical dialogue information can involve multiple different dialogue fields. For example, a shopping field, a ticket booking field, a weather query field, a hotel booking field, etc. The historical dialogue information can not involve any specific dialogue field, and in this case, the historical dialogue information can be considered to belong to a general field.
[0139] In the case where the historical dialogue information involves a specific dialogue field, the historical dialogue information can usually contain an entity word associated with the dialogue field. Therefore, the dialogue field corresponding to the historical dialogue information can be determined by using the entity word contained in the historical dialogue information.
[0140] Optionally, the historical dialogue information can contain multiple entity words, and the entity words are respectively associated with different dialogue fields. In this case, the historical dialogue information can be considered to involve multiple specific dialogue fields. Therefore, the dialogue model trained by using the historical dialogue information involving multiple specific dialogue fields can usually have the effect of multi-field dialogue.
[0141] S32, determining the weight information of each dimension by using the dialogue field.
[0142] In an embodiment of the present application, since the dimensions that need to be focused on can be different for different dialogue fields, after the dialogue field corresponding to the historical dialogue information is determined, the weight information of each dimension can be determined by using the dialogue field. Therefore, the weight information of each dimension can be different for different dialogue fields, so that the comprehensive feedback information can better reflect whether the predicted dialogue information correctly expresses the similar semantics of the expert dialogue information, and realize fine-grained and specific dimension model optimization.
[0143] In practical implementation, when historical dialogue information is related to a specific dialogue domain, more attention can be paid to the domain association dimension and less to the intent correctness dimension. This allows for assigning higher weight to the domain association dimension and lower weight to the intent correctness dimension. Conversely, when historical dialogue information is not related to any specific dialogue domain, more attention can be paid to the intent correctness dimension and less to the domain association dimension. This allows for assigning lower weight to the domain association dimension and higher weight to the intent correctness dimension.
[0144] As an example of this application, when historical dialogue information is associated with a specific dialogue domain—that is, when the historical dialogue information contains at least one entity word associated with the specific dialogue domain—the weight of the domain association dimension can be set to 1, while the weight of the intent correctness dimension can be set to 0. In this case, the comprehensive feedback information is the domain association information. When the historical dialogue information is not associated with any specific dialogue domain—that is, when the historical dialogue information does not contain entity words associated with a specific dialogue domain but belongs to a general domain—the weight of the domain association dimension can be set to 0, while the weight of the intent correctness dimension can be set to 1. In this case, the comprehensive feedback information is the intent correctness information.
[0145] The comprehensive feedback information R can be determined using the following formula. MFIL Value:
[0146]
[0147] Among them, R ER For domain relevance information, R ESIM For the purpose of correctness information, N E The number of entity words associated with a specific dialogue domain.
[0148] In N E If the value is greater than 0, then the historical dialogue information belongs to a specific dialogue domain (domain-specific session), and the comprehensive feedback information R... MFIL This refers to the domain relevance information R. ER In the N E When = 0, the historical dialogue information belongs to the casual session domain, and the comprehensive feedback information R MFIL This refers to the intention correctness information R. ESIM .
[0149] Step 203: Based on the comprehensive feedback information, adjust the dialogue model until the comprehensive feedback information meets the preset conditions, and the dialogue model training is completed.
[0150] In an embodiment of the present application, the step of adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets the preset condition comprises:
[0151] S41, adjusting the dialogue model based on the comprehensive feedback information.
[0152] In the embodiments of the present application, the dialogue model can be adjusted based on the comprehensive feedback information to improve the prediction effect of the dialogue model.
[0153] In specific implementation, the dialogue model can be adjusted based on the policy gradient. Specifically, the dialogue model can be adjusted to make the comprehensive feedback information as optimal as possible, so that the dialogue model converges.
[0154] S42, re-executing the step of obtaining the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain the comprehensive feedback information, and determining whether the comprehensive feedback information meets the preset condition.
[0155] In the embodiments of the present application, after adjusting the dialogue model, the step of obtaining the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain the comprehensive feedback information, and determining whether the comprehensive feedback information meets the preset condition can be re-executed.
[0156] The preset condition can be that the comprehensive feedback information is better than the comprehensive feedback information of other training rounds in a preset number of training rounds, the comprehensive feedback information reaches a preset threshold, etc., which is not limited in the present application.
[0157] S43, the dialogue model training is completed when the comprehensive feedback information meets the preset condition.
[0158] In the embodiments of the present application, when the comprehensive feedback information meets the preset condition, it can be considered that the dialogue model has converged, and the dialogue model training is completed.
[0159] In the embodiment of the present application, since the comprehensive feedback information reflects whether the predicted dialogue information as a whole in a dialogue turn has high similarity with the expert dialogue information, it can be considered that the dialogue model is adjusted based on the dialogue turn level. Compared with the dialogue model adjusted based on the word level, the dialogue model can be adjusted from the predicted dialogue information as a whole of each dialogue turn, so that the dialogue model finally obtained can better output predicted dialogue information with high accuracy, and improve the effect of the dialogue model.
[0160] As an example of the present application, Figure 4 As a training schematic diagram of a dialogue model in the embodiment of the present application, after the dialogue model 401 obtains historical dialogue information, it can output predicted dialogue information 402, and then compare the predicted dialogue information 402 with expert dialogue information 403 based on three dimensions of intention correctness, field consistency and field coherence, to obtain comprehensive feedback information 404. Then, the dialogue model 401 can be adjusted based on the policy gradient and the comprehensive feedback information 404, to obtain an adjusted dialogue model 401. Then, the steps of obtaining historical dialogue information, outputting predicted dialogue information 402, comparing the predicted dialogue information 402 with expert dialogue information 403, obtaining comprehensive feedback information 404, and adjusting the dialogue model 401 can be repeatedly performed until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
[0161] Through the training method of the dialogue model in the embodiment of the present application, the predicted dialogue information output by the dialogue model based on preset historical dialogue information is obtained; the predicted dialogue information and preset expert dialogue information are compared based on the intention correct dimension and the field related dimension, to obtain comprehensive feedback information; and the dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed. Thus, the similarity between the predicted dialogue information as a whole and the expert dialogue information can be evaluated based on multiple dimensions, so that the predicted dialogue information obtained can better match the expert dialogue information, and the dialogue model trained can be applied to dialogue in multiple fields to output more accurate dialogue information to the user.
[0162] Referring to Figure 5 FIG. 1 shows a step flowchart of a dialogue method embodiment of the present application, which can specifically include the following steps:
[0163] Step 501, obtaining user dialogue information input by a user;
[0164] In the embodiment of the present application, user conversation information input by a user can be acquired. The user conversation information can be conversation information input by the user in a current conversation turn. The user conversation information can relate to one or more specific conversation fields, or can be a general field, i.e., not related to any specific conversation field.
[0165] In step 502, conversation feedback information output by a preset conversation model for the user conversation information is acquired. The conversation model acquires predicted conversation information output by the conversation model based on preset historical conversation information. The predicted conversation information and preset expert conversation information are compared based on at least two dimensions to obtain comprehensive feedback information. The conversation model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition.
[0166] In the embodiment of the present application, the user conversation information can be input into a preset conversation model. The conversation model can output conversation feedback information for the user conversation information. The conversation feedback information can be feedback of the conversation model to the user conversation information.
[0167] In the embodiment of the present application, the conversation model acquires predicted conversation information output by the conversation model based on preset historical conversation information. The predicted conversation information and preset expert conversation information are compared based on at least two dimensions to obtain comprehensive feedback information. The conversation model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition. Thus, the conversation model can be applied to conversations in multiple fields and output more accurate conversation information to a user.
[0168] In step 503, the conversation feedback information is returned to the user.
[0169] In the embodiment of the present application, conversation feedback information can be returned to the user, so that the effect of using the conversation model to have a conversation with the user can be achieved.
[0170] According to the conversation method of the embodiment of the present application, user conversation information input by a user is acquired, conversation feedback information output by a preset conversation model for the user conversation information is acquired, and the conversation feedback information is returned to the user. The conversation model acquires predicted conversation information output by the conversation model based on preset historical conversation information. The predicted conversation information and preset expert conversation information are compared based on at least two dimensions to obtain comprehensive feedback information. The conversation model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition. Thus, the conversation model can be used to have a conversation with a user in multiple fields, and the output conversation information can have good accuracy.
[0171] Reference Figure 6, a step flow chart of an embodiment of a dialogue method of the present application is shown, which can specifically include the following steps:
[0172] In step 601, user dialogue information input by a user is acquired.
[0173] In the embodiment of the present application, user dialogue information input by a user can be acquired. The user dialogue information can be dialogue information input by a user in a current dialogue round. The user dialogue information can relate to one or more specific dialogue fields, or can be a general field, i.e., not related to any specific dialogue field.
[0174] In step 602, dialogue feedback information output by a preset dialogue model for the user dialogue information and user historical dialogue information is acquired. The dialogue model acquires predicted dialogue information output by the dialogue model based on preset historical dialogue information, compares the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information, and adjusts the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition.
[0175] In the embodiment of the present application, before a user inputs user dialogue information in a current dialogue round, the user can have performed multiple rounds of dialogue with a dialogue party. The dialogue party can be the dialogue model or an artificial dialogue party.
[0176] Thus, when the dialogue model outputs dialogue feedback information, user historical dialogue information of a user and a dialogue party can be acquired, and the user dialogue information and the user historical dialogue information are input into a preset dialogue model. The dialogue model can output dialogue feedback information for the user dialogue information and the user historical dialogue information. The dialogue feedback information can be feedback of the dialogue model to the user dialogue information and the user historical dialogue information. Thus, the dialogue model can output dialogue feedback information associated between dialogue rounds, further improving the accuracy of dialogue feedback information output by the dialogue model.
[0177] In the embodiment of the present application, the dialogue model acquires predicted dialogue information output by the dialogue model based on preset historical dialogue information, compares the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information, and adjusts the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition. Thus, the dialogue model can be applied to dialogue in multiple fields, and output more accurate dialogue information to a user.
[0178] In step 603, the dialogue feedback information is returned to the user.
[0179] In the embodiment of the present application, the user can be returned the dialogue feedback information, so that the effect of dialogue with the user by using the dialogue model can be achieved.
[0180] In an embodiment of the present application, the step of returning the dialogue feedback information to the user comprises:
[0181] S51, checking whether the dialogue feedback information contains content matching the preset general dialogue information;
[0182] In the embodiment of the present application, the general dialogue information can be general and does not contain effective information. For example, "um", "good, dear", "good, good", "um, thank you for your understanding" and the like. In the training process, the dialogue model can delete the general dialogue information in the historical dialogue information as training corpus, so as to avoid the dialogue model from learning the general dialogue information not containing effective information. However, since there can still be some mood words in the historical dialogue information, the dialogue feedback information returned by the dialogue model can still contain general dialogue information not containing effective information.
[0183] Therefore, in order to avoid returning general dialogue information not containing effective information to the user, it can be checked whether the dialogue feedback information contains content matching the preset general dialogue information, so as to determine whether the dialogue feedback information contains general dialogue information.
[0184] S52, in the case that the dialogue feedback information contains content matching the preset general dialogue information, deleting the content in the dialogue feedback information to obtain adjusted dialogue feedback information;
[0185] In the embodiment of the present application, in the case that the dialogue feedback information contains content matching the preset general dialogue information, it can be considered that the dialogue feedback information contains general dialogue information. In this case, the content in the dialogue feedback information can be deleted to obtain adjusted dialogue feedback information.
[0186] S53, returning the adjusted dialogue feedback information to the user.
[0187] In the embodiment of the present application, the user can be returned the adjusted dialogue feedback information, so that the effect of dialogue with the user by using the dialogue model can be achieved, and the dialogue content contains effective information required by the user.
[0188] In the embodiment of the present application, if the dialogue feedback information only contains the general dialogue information, the dialogue feedback information containing only the general dialogue information can be fed back to the user, or the dialogue feedback information can not be returned to the user. The user can be asked to obtain more information, so as to feed back the dialogue feedback information containing effective information to the user.
[0189] By the dialogue method of the embodiment of the present application, the user dialogue information input by the user is obtained, the dialogue feedback information output by a preset dialogue model for the user dialogue information and the user historical dialogue information is obtained, and the dialogue feedback information is returned to the user. The dialogue model obtains predicted dialogue information output by the dialogue model based on preset historical dialogue information, compares the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information, and adjusts the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition. Therefore, the dialogue model can be used to carry out multi-field and multi-round dialogue with the user, and the output dialogue information can have good accuracy.
[0190] It should be noted that, for the method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited to the action order described, because according to the embodiments of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the embodiments of the present application.
[0191] Referring to Figure 7 , a structural block diagram of a training device embodiment of a dialogue model of the present application is shown, which can specifically include the following modules:
[0192] The predicted dialogue information acquisition module 701 is configured to acquire predicted dialogue information output by the dialogue model based on preset historical dialogue information.
[0193] The comprehensive feedback information acquisition module 702 is configured to compare the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information.
[0194] The adjustment module 703 is configured to adjust the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
[0195] In an embodiment of the present application, the comprehensive feedback information acquisition module includes:
[0196] The comprehensive feedback information acquisition sub-module compares the predicted dialogue information and preset expert dialogue information based on the intention correctness dimension and the field correlation dimension to obtain comprehensive feedback information.
[0197] In an embodiment of the present application, the comprehensive feedback information acquisition sub-module comprises:
[0198] The intention correctness information determination unit is configured to determine the similarity between the predicted dialogue information and the preset expert dialogue information to obtain intention correctness information.
[0199] The field correlation information determination unit is configured to determine the field correlation information of the predicted dialogue information by using the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information.
[0200] The comprehensive feedback information determination unit is configured to determine the comprehensive feedback information by using the intention correctness information and the field correlation information.
[0201] In an embodiment of the present application, the comprehensive feedback information acquisition module comprises:
[0202] The dialogue field determination module is configured to determine the dialogue field corresponding to the historical dialogue information by using the entity words contained in the historical dialogue information.
[0203] The weight information determination module is configured to determine the weight information of each dimension by using the dialogue field.
[0204] In an embodiment of the present application, the adjustment module comprises:
[0205] The adjustment sub-module is configured to adjust the dialogue model based on the comprehensive feedback information.
[0206] The condition determination sub-module is configured to determine whether the comprehensive feedback information meets a preset condition by re-executing the step of acquiring the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain the comprehensive feedback information.
[0207] The model output sub-module is configured to complete the training of the dialogue model when the comprehensive feedback information meets the preset condition.
[0208] In an embodiment of the present application, the dialogue model comprises a sentence encoding layer, a context vector encoding layer, an action layer, and a decoding layer.
[0209] The predicted dialogue information acquisition module comprises:
[0210] The sentence vector output submodule is configured to encode the preset historical dialogue information by using the sentence encoding layer of the dialogue model, and output a sentence vector.
[0211] The context vector output submodule is configured to encode the sentence vector by using the context vector encoding layer of the dialogue model, and output a context vector.
[0212] The action vector output submodule is configured to encode the context vector by using the action layer of the dialogue model, and output an action vector.
[0213] The predicted dialogue information output submodule is configured to decode the action vector by using the encoding layer of the dialogue model, and output predicted dialogue information.
[0214] Referring to Figure 8 , a structural block diagram of an embodiment of a dialogue device of the present application is shown, which can specifically include the following modules:
[0215] The user dialogue information acquisition module 801 is configured to acquire user dialogue information input by a user.
[0216] The dialogue feedback information acquisition module 802 is configured to acquire dialogue feedback information output by a preset dialogue model in response to the user dialogue information. The dialogue model is acquired by the dialogue model based on preset historical dialogue information. The predicted dialogue information and preset expert dialogue information are compared based on at least two dimensions to obtain comprehensive feedback information. The dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition.
[0217] The return module 803 is configured to return the dialogue feedback information to the user.
[0218] In an embodiment of the present application, the return module includes:
[0219] The search submodule is configured to search whether there is content in the dialogue feedback information that matches preset general dialogue information.
[0220] The deletion submodule is configured to delete the content in the dialogue feedback information that matches the preset general dialogue information to obtain adjusted dialogue feedback information in the case where there is content in the dialogue feedback information that matches the preset general dialogue information.
[0221] The return submodule is configured to return the adjusted dialogue feedback information to the user.
[0222] In an embodiment of the present application, the dialogue feedback information acquisition module includes:
[0223] The dialogue feedback information acquisition submodule is configured to acquire dialogue feedback information output by the preset dialogue model for the user dialogue information and the user historical dialogue information.
[0224] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts are described in the part of the method embodiment.
[0225] The device embodiment also provides a device, which comprises:
[0226] one or more processors; and
[0227] one or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the device to perform the method described in the embodiments of the present application.
[0228] The device embodiment also provides one or more machine-readable media having instructions stored thereon, when executed by one or more processors, cause the processor to perform the method described in the embodiments of the present application.
[0229] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between each embodiment can be referred to each other.
[0230] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0231] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one or more flows and / or blocks Figure 1 The device for implementing the functions specified in one or more flows and / or blocks
[0232] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flow Figure 1 one or more flows and / or blocks Figure 1 one or more blocks or multiple blocks.
[0233] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more flows and / or blocks Figure 1 one or more blocks or multiple blocks.
[0234] While preferred embodiments of the application have been described, those skilled in the art will appreciate that other modifications and variations are possible in light of the above teachings. It is, therefore, to be understood that within the scope of the application, equivalents can be substituted for elements recited herein. Further, those skilled in the art will appreciate that not all combinations of components recited herein are necessarily the most preferred combinations. It is therefore intended to cover in the appended claims all such changes and modifications that fall within the scope of the application.
[0235] Finally, it should be noted that, in this document, the term "only" is used to identify one entity or operation as distinct from another entity or operation, but does not necessarily require or imply that there is any such actual distinction between the entities or operations. Also, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element. The terms "a" and "an" are defined as taking the meaning of "one" or "one or more" unless this is explicitly stated.
[0236] The above detailed description of the training method of a dialogue model, the dialogue method, the training device of a dialogue model, and the dialogue device provided by the present application has been described in detail, and the principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges can be changed, and the above description of the present application should not be understood as a limitation.
Claims
1. A method for training a dialogue model, the method comprising: The method comprises the steps of: obtaining predicted dialogue information output by the dialogue model based on preset historical dialogue information; comparing the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information; the dimensions are different ways of comparing the similarity between the predicted dialogue information and the expert dialogue information; adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
2. The method of claim 1, wherein, The step of comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information comprises: comparing the predicted dialogue information and the preset expert dialogue information based on intent correctness dimension and field relevance dimension to obtain comprehensive feedback information.
3. The method of claim 2, wherein, The step of comparing the predicted dialogue information and the preset expert dialogue information based on intent correctness dimension and field relevance dimension to obtain comprehensive feedback information comprises: determining the similarity between the predicted dialogue information and the preset expert dialogue information to obtain intent correctness information; determining the field relevance information of the predicted dialogue information by using the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information; determining the comprehensive feedback information by using the intent correctness information and the field relevance information.
4. The method according to any one of claims 1 to 3, characterized in that, The step of comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information comprises: determining the dialogue field corresponding to the historical dialogue information by using the entity words contained in the historical dialogue information; determining the weight information of each dimension by using the dialogue field.
5. The method of claim 1, wherein, The step of adjusting the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed comprises: adjusting the dialogue model based on the comprehensive feedback information; re-executing the steps of obtaining the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions to obtain the comprehensive feedback information, and determining whether the comprehensive feedback information meets the preset condition; and in the case where the comprehensive feedback information meets the preset condition, the dialogue model training is completed.
6. The method of claim 1, wherein, The dialogue model comprises a sentence encoding layer, a context vector encoding layer, an action layer, and a decoding layer. The step of obtaining the predicted dialogue information output by the dialogue model based on the preset historical dialogue information comprises: the sentence encoding layer of the dialogue model encodes the preset historical dialogue information to output a sentence vector; the context vector encoding layer of the dialogue model encodes the sentence vector to output a context vector; the action layer of the dialogue model encodes the context vector to output an action vector; the decoding layer of the dialogue model decodes the action vector to output the predicted dialogue information.
7. A dialog method characterized by, The method comprises the steps of: obtaining user dialogue information input by a user; obtaining dialogue feedback information output by a preset dialogue model for the user dialogue information; The dialogue model outputs predicted dialogue information based on preset historical dialogue information; The predicted dialogue information and preset expert dialogue information are compared based on at least two dimensions to obtain comprehensive feedback information; The dialogue model is adjusted based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition; the dimensions are different ways of comparing the similarity between the predicted dialogue information and the expert dialogue information; The dialogue feedback information is returned to the user.
8. The method of claim 7, wherein, The step of returning the dialogue feedback information to the user includes: It is determined whether the dialogue feedback information contains content matching preset general dialogue information; In the case that the dialogue feedback information contains content matching the preset general dialogue information, the content matching the preset general dialogue information is deleted from the dialogue feedback information to obtain adjusted dialogue feedback information; The adjusted dialogue feedback information is returned to the user.
9. The method of claim 7, wherein, The step of obtaining dialogue feedback information output by the preset dialogue model for the user dialogue information includes: Dialogue feedback information output by the preset dialogue model for the user dialogue information and user historical dialogue information is obtained. 10.A device for training a dialogue model, the device comprising: It includes: A predicted dialogue information acquisition module is configured to acquire predicted dialogue information output by a dialogue model based on preset historical dialogue information; A comprehensive feedback information acquisition module is configured to compare the predicted dialogue information and preset expert dialogue information based on at least two dimensions to obtain comprehensive feedback information; The dimensions are different ways of comparing the similarity between the predicted dialogue information and the expert dialogue information; An adjustment module is configured to adjust the dialogue model based on the comprehensive feedback information until the comprehensive feedback information meets a preset condition, and the dialogue model training is completed.
11. The apparatus of claim 10, wherein, The comprehensive feedback information acquisition module includes: A comprehensive feedback information acquisition submodule is configured to compare the predicted dialogue information and preset expert dialogue information based on an intention correctness dimension and a field relevance dimension to obtain comprehensive feedback information.
12. The apparatus of claim 11, wherein, The comprehensive feedback information acquisition submodule includes: An intention correctness information determination unit is configured to determine the similarity between the predicted dialogue information and the preset expert dialogue information to obtain intention correctness information; A field relevance information determination unit is configured to determine the field relevance information of the predicted dialogue information by using the number of entity words in the expert dialogue information and the number of entities in the predicted dialogue information; A comprehensive feedback information determination unit is configured to determine comprehensive feedback information by using the intention correctness information and the field relevance information.
13. The device according to any one of claims 10 to 12, characterized in that The comprehensive feedback information acquisition module includes: A dialogue field determination module is configured to determine the dialogue field corresponding to the historical dialogue information by using the entity words contained in the historical dialogue information; A weight information determination module is configured to determine the weight information of each dimension by using the dialogue field.
14. The apparatus of claim 10, wherein, The adjustment module includes: An adjustment submodule is configured to adjust the dialogue model based on the comprehensive feedback information; The condition determining sub-module is configured to re-execute the step of obtaining the predicted dialogue information output by the dialogue model based on the preset historical dialogue information, comparing the predicted dialogue information and the preset expert dialogue information based on at least two dimensions, and obtaining comprehensive feedback information, and determining whether the comprehensive feedback information meets a preset condition. The model output sub-module is configured to complete the training of the dialogue model when the comprehensive feedback information meets the preset condition.
15. The apparatus of claim 10, wherein, The dialogue model comprises a sentence encoding layer, a context vector encoding layer, an action layer, and a decoding layer. The predicted dialogue information obtaining module comprises: The sentence vector output sub-module is configured to encode the preset historical dialogue information by using the sentence encoding layer of the dialogue model, and output a sentence vector. The context vector output sub-module is configured to encode the sentence vector by using the context vector encoding layer of the dialogue model, and output a context vector. The action vector output sub-module is configured to encode the context vector by using the action layer of the dialogue model, and output an action vector. The predicted dialogue information output sub-module is configured to decode the action vector by using the decoding layer of the dialogue model, and output predicted dialogue information.
16. A dialog apparatus characterized by comprising: The user dialogue information obtaining module is configured to obtain user dialogue information input by a user. The dialogue feedback information obtaining module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information. The dialogue model obtains predicted dialogue information output by the dialogue model based on preset historical dialogue information. The dialogue feedback information obtaining module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information. The dialogue model obtains predicted dialogue information output by the dialogue model based on preset historical dialogue information. The dialogue feedback information obtaining module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information. The dialogue feedback information obtaining module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information.
17. The apparatus of claim 16, wherein, The dialogue feedback information obtaining module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information. The return module comprises: The finding sub-module is configured to find whether there is content matching preset general dialogue information in the dialogue feedback information. The deleting sub-module is configured to delete the content matching the preset general dialogue information in the dialogue feedback information, to obtain adjusted dialogue feedback information, when there is content matching the preset general dialogue information in the dialogue feedback information.
18. The apparatus of claim 16, wherein, The return sub-module is configured to return the adjusted dialogue feedback information to the user. The dialogue feedback information obtaining module comprises:
19. An apparatus, comprising: The dialogue feedback information obtaining sub-module is configured to obtain dialogue feedback information output by a preset dialogue model for the user dialogue information and user historical dialogue information. The one or more processors are configured to perform the method of any one of claims 1-6 or 7-9. The one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform the method of any one of claims 1-6 or 7-9. 20. One or more machine -readable media having instructions stored thereon, that when executed by one or more processors, cause the processors to perform one or more of the methods of claims 1-6 or 7-9.
Citation Information
Patent Citations
Man-machine multi-round dialogue method oriented to travel field
CN109063035A
A method and device for optimizing a dialogue model
CN109635095A