CN116483961A - Training method and device of dialogue model, storage medium and electronic equipment - Google Patents

Training method and device of dialogue model, storage medium and electronic equipment Download PDF

Info

Publication number
CN116483961A
CN116483961A CN202310343560.6A CN202310343560A CN116483961A CN 116483961 A CN116483961 A CN 116483961A CN 202310343560 A CN202310343560 A CN 202310343560A CN 116483961 A CN116483961 A CN 116483961A
Authority
CN
China
Prior art keywords
corpus
dialogue
model
request information
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310343560.6A
Other languages
Chinese (zh)
Inventor
陈首名
赵培
马志芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd, Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202310343560.6A priority Critical patent/CN116483961A/en
Publication of CN116483961A publication Critical patent/CN116483961A/en
Pending legal-status Critical Current

Links

Landscapes

  • Machine Translation (AREA)

Abstract

The application discloses a training method and device for a dialogue model, a storage medium and electronic equipment, and relates to the technical field of smart families, wherein the training method for the dialogue model comprises the following steps: acquiring historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system; under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained; training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.

Description

Training method and device of dialogue model, storage medium and electronic equipment
Technical Field
The application relates to the technical field of smart families, in particular to a training method and device for a dialogue model, a storage medium and electronic equipment.
Background
Natural language processing (Natural Language Processing, NLP) is an important direction in the field of artificial intelligence, an indispensable step in achieving artificial intelligence. In the natural language processing process, we need to have abundant data resource reserves on line, for example, in the man-machine conversation process, the corpus with the labeling information is needed to train the conversation model, however, the corpus with the labeling information is quite scarce, and the two main reasons are: 1) Corpus is scarce; 2) Some fields have little user interaction data, such as voice-controlled humidifiers. Because of the scarcity of the corpus with the labeling information, the intelligentization degree of the dialogue model is lower.
Aiming at the problems of low intelligentization degree of a dialogue model and the like caused by the scarcity of corpus in the related technology, no effective solution is proposed yet.
Disclosure of Invention
The embodiment of the application provides a training method and device for a dialogue model, a storage medium and electronic equipment, and aims to at least solve the problems that in the related technology, the intelligent degree of the dialogue model is low due to the scarcity of corpus.
According to an embodiment of the present application, there is provided a training method of a dialogue model, including: acquiring historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system; under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained; training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
In an exemplary embodiment, determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialog information includes: inputting the history dialogue information into a retraining judgment model; and acquiring a judging result corresponding to the request information, which is determined by the retraining judging model based on at least one of the response information, the request information and the emotion characteristics corresponding to the request information, wherein the judging result is used for indicating whether the request information of the target object needs to be subjected to generalization processing.
In an exemplary embodiment, obtaining the determined discrimination result corresponding to the request information by the retraining discrimination model based on at least one of the response information, the request information, and the emotional characteristic corresponding to the request information includes: under the condition that the retraining discriminant model determines that the dialogue system does not successfully analyze the request information, acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing; and under the condition that the retraining judging model determines that the dialogue system successfully analyzes the request information, acquiring a second sub-judging result which is output by the retraining judging model and indicates that the request information does not need to be subjected to generalization processing, wherein the judging result comprises the first sub-judging result and the second sub-judging result.
In an exemplary embodiment, obtaining the determined discrimination result corresponding to the request information by the retraining discrimination model based on at least one of the response information, the request information, and the emotional characteristic corresponding to the request information includes: under the condition that the historical dialogue information is multi-turn dialogue information, acquiring emotion changes and mood changes corresponding to a plurality of pieces of request information determined by the retraining judgment model, and acquiring emotion characteristics of the target object determined by the retraining judgment model according to the emotion changes and the mood changes; under the condition that the retraining discriminant model determines that the emotion characteristics accord with preset emotion characteristics, a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing is obtained; and under the condition that the retraining judgment model determines that the emotion characteristics do not accord with preset emotion characteristics, acquiring a second sub-judgment result of which the instruction output by the retraining judgment model does not need to generalize the request information.
In an exemplary embodiment, obtaining the determined discrimination result corresponding to the request information by the retraining discrimination model based on at least one of the response information, the request information, and the emotional characteristic corresponding to the request information includes: acquiring the occurrence times of similar request information determined by the retraining discriminant model in the multi-round dialogue information under the condition that the historical dialogue information is the multi-round dialogue information; acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing under the condition that the retraining discriminant model determines that the occurrence number is greater than a preset threshold value; and under the condition that the occurrence number is smaller than or equal to a preset threshold value, acquiring a second sub-discrimination result of the indication output by the retraining discrimination model without generalizing the request information.
In an exemplary embodiment, performing generalization processing on the request information to obtain a first generalized corpus, including: inputting the request information and the generalization conditions to a target GPT model so that the target GPT model generalizes the first generalization corpus according to the generalization conditions; and acquiring the first generalized corpus output by the target GPT model.
In one exemplary embodiment, training a dialog model of the dialog system according to the first generalized corpus includes: determining a feature vector of each first generalized corpus, and determining a plurality of center points of the feature vectors based on a mean algorithm; determining a first corpus label of the first generalized corpus according to the center point; training the dialogue model according to the first generalized corpus and the first corpus label.
In an exemplary embodiment, determining a first corpus label of the first generalized corpus from the center point includes: determining a distance of the center point from center points of a plurality of corpus sets, wherein the distance comprises at least one of: the Euclidean distance and the Manhattan distance, and the corpus labels in each corpus set are the same; determining a corpus set corresponding to the minimum distance from the plurality of distances; and determining a first corpus label of the first generalized corpus according to the corpus label of the corpus set corresponding to the minimum distance.
In an exemplary embodiment, training the dialogue model according to the first generalized corpus and a first corpus tag of the first generalized corpus includes: dividing the first generalized corpus into a training corpus and a verification corpus; under the condition that one training iteration is completed on the dialogue model according to the training corpus, calculating a loss value of the verification corpus according to a second corpus label of the verification corpus and a first corpus label of the verification corpus, which are determined by the dialogue model; and under the condition that the loss value is smaller than a preset loss value, stopping training the dialogue model.
In an exemplary embodiment, after training the dialogue model of the dialogue system according to the first generalized corpus, the method further comprises: acquiring an identification result of the trained dialogue model on the request information, wherein the identification result is used for indicating whether the request information is successfully identified; under the condition that the identification result indicates that the request information is not successfully identified, carrying out generalization processing on the request information to obtain a second generalization corpus; training a dialogue model of the dialogue system according to the first generalized corpus and the second generalized corpus.
According to another embodiment of the present application, there is further provided a training device for a dialogue model, and an obtaining module, configured to obtain historical dialogue information of a target object and a dialogue system, and determine whether to perform generalization processing on request information of the target object according to the historical dialogue information, where the historical dialogue information includes: the request information and the response information of the dialogue system; the generalization module is used for generalizing the request information of the target object under the condition that the request information is determined to be required to be subjected to generalization processing, so as to obtain a first generalization corpus; and the training module is used for training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
According to a further aspect of the embodiments of the present application, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described training method of a dialog model at run-time.
According to still another aspect of the embodiments of the present application, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the training method of the session model through the computer program.
In this embodiment of the present application, historical dialogue information of a target object and a dialogue system is obtained, and whether a generalization process is required to be performed on request information of the target object is determined according to the historical dialogue information, where the historical dialogue information includes: the request information and the response information of the dialogue system; under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained; training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model. According to the embodiment of the invention, the historical dialogue information is automatically judged, the speech information needing to be generalized can be determined, under the condition that the speech information needs to be generalized, the speech information is generalized, and the dialogue model is trained according to the generalized corpus.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a hardware environment of a training method of a dialogue model according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of training a dialog model according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a training system for a dialog model according to an embodiment of the present application;
FIG. 4 is a flow chart of a method of training a dialog model in accordance with an alternative embodiment of the present application;
fig. 5 is a block diagram of a training apparatus for a dialog model according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to one aspect of the embodiments of the present application, a method for training a dialog model is provided. The training method of the dialogue model is widely applied to full-house intelligent digital control application scenes such as intelligent Home (Smart Home), intelligent Home equipment ecology, intelligent Home (Intelligence House) ecology and the like. Alternatively, in the present embodiment, the training method of the session model described above may be applied to a hardware environment constituted by the terminal device 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal device 102 through a network, and may be used to provide services (such as application services and the like) for a terminal or a client installed on the terminal, a database may be set on the server or independent of the server, for providing data storage services for the server 104, and cloud computing and/or edge computing services may be configured on the server or independent of the server, for providing data computing services for the server 104.
The network may include, but is not limited to, at least one of: wired network, wireless network. The wired network may include, but is not limited to, at least one of: a wide area network, a metropolitan area network, a local area network, and the wireless network may include, but is not limited to, at least one of: WIFI (Wireless Fidelity ), bluetooth. The terminal device 102 may not be limited to a PC, a mobile phone, a tablet computer, an intelligent air conditioner, an intelligent smoke machine, an intelligent refrigerator, an intelligent oven, an intelligent cooking range, an intelligent washing machine, an intelligent water heater, an intelligent washing device, an intelligent dish washer, an intelligent projection device, an intelligent television, an intelligent clothes hanger, an intelligent curtain, an intelligent video, an intelligent socket, an intelligent sound box, an intelligent fresh air device, an intelligent kitchen and toilet device, an intelligent bathroom device, an intelligent sweeping robot, an intelligent window cleaning robot, an intelligent mopping robot, an intelligent air purifying device, an intelligent steam box, an intelligent microwave oven, an intelligent kitchen appliance, an intelligent purifier, an intelligent water dispenser, an intelligent door lock, and the like.
In this embodiment, a training method of a dialogue model is provided and applied to a computer terminal, and fig. 2 is a flowchart of the training method of the dialogue model according to an embodiment of the application, where the flowchart includes the following steps:
Step S202, obtaining historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system;
it should be noted that, the "request information" and the "response information" may be either voice or text information, which is not limited by the embodiment of the present invention.
For example, the historical dialog information may be a voice "User: air conditioner is set to 25 degrees (i.e. is request information), bot: good, you have been helped to set the air conditioner to 25 degrees +.! (i.e., as response information) ";
also, the word "User: popular songs, bot: to the best, I have not understood, please re-enter ";
also, "User" which may be voice: air conditioner was set to 25 degrees ", and the text" Bot: good, you have been helped to set the air conditioner to 25 degrees +.! The embodiment of the invention does not limit the history dialogue information.
Step S204, under the condition that the request information of the target object is determined to need to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained;
Step S206, training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
Through the steps, the historical dialogue information of the target object and the dialogue system is obtained, and whether the request information of the target object needs to be subjected to generalization processing is determined according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system; under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained; training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model, solving the problems of low intelligent degree and the like of the dialogue model due to scarcity of the corpus in the related technology, and realizing optimization of the dialogue model.
Optionally, there are multiple implementations in step S202, and an implementation manner is provided in the embodiment of the present invention: and inputting the historical dialogue information into a retraining judgment model, and acquiring a judgment result corresponding to the request information, which is determined by the retraining judgment model based on at least one of the response information, the request information and the emotion characteristics corresponding to the request information, wherein the judgment result is used for indicating whether the request information of the target object needs to be subjected to generalization processing.
That is, the training device for a dialogue model in the embodiment of the invention includes: retraining a judging model; and inputting the historical dialogue information into a retraining judgment model to determine whether the request information of the target object needs to be subjected to generalization processing or not through the retraining judgment model. It should be noted that, the retraining discriminant model is trained by machine learning using a plurality of sets of data, and each set of data in the plurality of sets of data includes: corpus and identification information for indicating whether the corpus is generalized.
The retraining discriminant model determines a discriminant result corresponding to the request information based on at least one of the response information, the request information, and emotional characteristics corresponding to the request information, and includes: the retraining discriminant model determines a score of the request information based on at least one of the response information, the request information and emotional characteristics corresponding to the request information; under the condition that the score is larger than a preset score, determining that the judging result indicates that the request information of the target object needs to be subjected to generalization treatment; and under the condition that the score is smaller than or equal to a preset score, determining that the judging result indicates that the generalization processing of the request information of the target object is not needed.
Optionally, the retraining discriminant model determines the generalization result by: under the condition that the retraining discriminant model determines that the dialogue system does not successfully analyze the request information, acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing; and under the condition that the retraining judgment model determines that the dialogue system successfully analyzes the request information, acquiring a second sub-judgment result which is output by the retraining judgment model and is used for indicating that generalization processing is not required for the request information.
For example, if the response information is "inexperienced, i don't understand, please re-input", determining that the dialogue system does not successfully parse the request information; when the response message is "good," you have been helped to set the air conditioner to 25 degrees-! In the case of "determine that the dialog system successfully parsed the request information.
It should be noted that, under the condition that the dialogue system does not successfully analyze the request information, the retraining discriminant model outputs a first score, where the first score is less than or equal to the preset score; and under the condition that the dialogue system successfully analyzes the request information, the retraining discriminant model outputs a second score, wherein the second score is larger than the preset score.
It should be noted that, when the request information is "help you set the air conditioner to the heating mode", the response information is "good", and the help you set the air conditioner to the cooling mode ", the dialogue system does not successfully analyze the request information, and at this time, it is required to determine whether to perform the generalization processing on the request information according to the mood change and the mood change of the target object or whether the target object repeats an instruction.
Optionally, determining a discrimination result corresponding to the request information includes: under the condition that the historical dialogue information is multi-turn dialogue information, acquiring emotion changes and mood changes corresponding to a plurality of pieces of request information determined by the retraining judgment model, and acquiring emotion characteristics of the target object determined by the retraining judgment model according to the emotion changes and the mood changes; under the condition that the retraining discriminant model determines that the emotion characteristics accord with preset emotion characteristics, a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing is obtained; and under the condition that the retraining judgment model determines that the emotion characteristics do not accord with preset emotion characteristics, acquiring a second sub-judgment result of which the instruction output by the retraining judgment model does not need to generalize the request information.
It should be noted that determining the emotion change and the mood change of the target object according to the plurality of request information includes: determining the emotion change of the target object according to the decibel changes of the plurality of request information; determining the mood change of the target object according to the text information of the plurality of request information, and further determining the mood features of the target object according to the mood change and the mood change, for example: qi generating, calm and happy.
For example, under the conditions that the decibel of the request information of the first round is 60, the decibel of the request information of the second round is 65, and the decibel of the request information of the third round is 75, the emotion of the target object is determined to be gradually violent, and at this time, the dialog system is determined to not successfully analyze the request information, so that generalization needs to be performed on the request information.
For example, when the first round of request information is "air conditioner set to 25 degrees", the second round of request information is "how you cannot hear my speaking, and the target object is determined to be poor in mood, the dialog system is determined to have not successfully analyzed the request information, and generalization of the request information is required.
In an exemplary embodiment, determining the discrimination result corresponding to the request information includes: acquiring the retraining discriminant model to determine the occurrence times of similar request information in the multi-round dialogue information under the condition that the historical dialogue information is the multi-round dialogue information; acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing under the condition that the retraining discriminant model determines that the occurrence number is greater than a preset threshold value; and under the condition that the occurrence number is smaller than or equal to a preset threshold value, acquiring a second sub-discrimination result of the indication output by the retraining discrimination model without generalizing the request information.
When the history dialogue information is multi-turn and the similar request information needs generalization, the similar request information is output.
It should be noted that, before determining the occurrence times of similar request information in the multi-turn dialogue information, determining a feature vector of each request information, determining the similarity of a first feature vector and a second feature vector, and determining that a first voice corresponding to the first feature vector is similar to a first voice corresponding to the second feature vector when the similarity is greater than a preset threshold, where the feature vector includes the first feature vector and the second feature vector.
In an exemplary embodiment, the generalizing the request information to obtain the first generalized corpus includes: inputting the request information and the generalization conditions to a target GPT model so that the target GPT model generalizes the first generalization corpus according to the generalization conditions; and acquiring the first generalized corpus output by the target GPT model.
It should be noted that, the target generic pretrained converter (GPT) model in the embodiment of the present invention may be an existing chatgpt model, or other corpus generating model, or an autonomously developed generalization model, which is not limited in the embodiment of the present invention.
It should be noted that the generalization conditions include, but are not limited to: number of generalizations, keywords generalization.
For example, the generalization condition may be "50 generalized corpuses corresponding to the output speech information", and the generalization condition may also be "generalized corpuses corresponding to the output speech information", where the number of generalized corpuses is 50, and the generalized corpuses include: xxx (first keyword), yyy (second keyword) ", and specific forms of generalization conditions are not limited in the embodiment of the present invention.
It should be noted that, performing the generalization processing on the request information to obtain a first generalized corpus includes: inputting the request information to a generalization corpus model so that a target generalization corpus model generalizes the first generalization corpus; and obtaining the first generalized corpus output by the generalized corpus model.
Alternatively, the above step S206 may be implemented by: determining a feature vector of each first generalized corpus, and determining a plurality of center points of the feature vectors based on a mean algorithm; determining a first corpus label of the first generalized corpus according to the center point; training the dialogue model according to the first generalized corpus and the first corpus label.
Specifically, a distance between the center point and the center points of the plurality of corpus sets is determined, wherein the distance comprises at least one of the following: the Euclidean distance and the Manhattan distance, and the corpus labels in each corpus set are the same; determining a corpus set corresponding to the minimum distance from the plurality of distances; and determining a first corpus label of the first generalized corpus according to the corpus label of the corpus set corresponding to the minimum distance.
In the embodiment of the invention, a clustering mode is adopted to determine the labels of the first generalized corpus, specifically, the center points of the feature vectors corresponding to the first generalized corpuses are determined, the corpus set closest to the center points is determined according to the distances between the center points and the center points of the corpus sets, and the corpus label corresponding to the closest corpus set is determined as the corpus label of the first generalized corpus.
In an exemplary embodiment, training the dialogue model according to the first generalized corpus and a first corpus tag of the first generalized corpus includes: dividing the first generalized corpus into a training corpus and a verification corpus; under the condition that one training iteration is completed on the dialogue model according to the training corpus, calculating a loss value of the verification corpus according to a second corpus label of the verification corpus and a first corpus label of the verification corpus, which are determined by the dialogue model; and under the condition that the loss value is smaller than a preset loss value, stopping training the dialogue model.
That is, in the process of training the dialogue model, the first generalized corpus is divided into a training corpus and a verification corpus, after the dialogue model is trained by the training corpus, the dialogue model is verified by the verification corpus, and the loss value of the verification corpus is calculated according to the second corpus label of the verification corpus and the first corpus label of the verification corpus, which are determined by the dialogue model, and the training of the dialogue model is stopped when the loss value is smaller than a preset loss value, and the training of the dialogue model is continued when the loss value is larger than the preset loss value, so that the intellectualization of the dialogue model is improved.
In an exemplary embodiment, after training a dialogue model of the dialogue system according to the first generalized corpus, obtaining a recognition result of the trained dialogue model on the request information, where the recognition result is used to indicate whether the request information is successfully recognized; under the condition that the identification result indicates that the request information is not successfully identified, carrying out generalization processing on the request information to obtain a second generalization corpus; training a dialogue model of the dialogue system according to the first generalized corpus and the second generalized corpus.
That is, after training the dialogue model, the recognition result of the trained dialogue model on the request information is obtained, and under the condition that the dialogue model still does not recognize the request information, it is determined that the dialogue model is not trained, so that further training is required to be performed on the dialogue model, specifically, the request information is subjected to generalization processing again, so as to obtain a second generalized corpus; training a dialogue model of the dialogue system according to the first generalized corpus and the second generalized corpus. And executing the steps circularly until the dialogue model identifies the request information.
In order to better understand the process of the training method of the session model, the following describes the implementation method flow of the training of the session model in combination with the alternative embodiment, but is not limited to the technical solution of the embodiment of the present application.
In this embodiment, a training method of a dialogue model is provided, and fig. 3 is a schematic diagram of a training system of a dialogue model according to an embodiment of the application, as shown in fig. 3, including:
the dialogue system, the data system connected with the dialogue system, the retraining discrimination system connected with the data system and the corpus generalization system connected with the retraining discrimination model;
The dialogue system is used for receiving the voice information of the target object and outputting reply information corresponding to the voice information;
the data system is used for recording the voice information of the target object and the reply information corresponding to the voice information output by the dialogue system;
the retraining judging system is used for judging whether the voice information of the target object needs to be generalized;
the corpus generalization system is used for generalizing the voice information.
In this embodiment, a training method of a dialogue model is provided, and fig. 4 is a flowchart of a training method of a dialogue model according to an alternative embodiment of the application, as shown in fig. 4, specifically including the following steps:
step S401: a user initiates a query request corpus (equivalent to the request information in the above embodiment) to a dialogue system, and the dialogue system generates reply information according to understanding of the query request corpus;
for example, the query request corpus is today's weather, and the reply information of the dialogue system is: today weather is sunny, 18-25 degrees.
Step S402: after the dialogue system outputs the reply information, the query request corpus of the user is stored in the data system;
Step S403: the retraining discriminant model determines whether the query request corpus needs to be subjected to corpus generalization according to the query request corpus of the user and the reply information of the dialogue system;
for example, determining the emotion and mood of the user according to the query request corpus of the user; whether the query request corpus of the user repeatedly inquires about the same thing; and determining whether the corpus of the query request needs to be generalized according to the emotion and the mood of the user and/or whether the corpus of the query request of the user repeatedly inquires about the same thing and/or the reply information of the dialogue system.
For example, there are such dialogue information:
user: your good-!
Bot: you good (first round);
user: the air conditioner was set to 25 degrees.
Bot: well, you have been helped to set the air conditioner to 25 degrees (second round);
user: i come a popular song.
Bot: to the best, I don't know, please reenter (third round);
in the User log, the above dialogue flow is obtained, the dialogue information of user+bot (first round), user+bot (second round), user+bot (third round) is input into the retraining judgment model, and the retraining judgment model determines whether the query request corpus of the User in the current round needs to be generalized or not.
Step S404: inputting a query request corpus to be generalized into a generalization model for corpus generalization, wherein the generalization model comprises but is not limited to: chatGPT model, other corpus generalization model;
step S405: determining feature vectors of the generalized corpus, and determining center points of a plurality of feature vectors based on a mean algorithm;
step S406: determining the distances between the center points of a plurality of feature vectors and the center points of the existing categories, and selecting the category closest to the center points as a label of the generalized corpus;
step S407: retraining a dialogue model according to the generalized corpus and the label;
step S408: the generalization and training steps are repeatedly executed until the dialog system can correctly identify the intention of the query request corpus.
Through the embodiment, the corpus which needs to be generalized in the dialogue process is automatically judged; generalizing the corpus to be generalized, and labeling the generalized corpus; from the corpus mining, corpus generalization, corpus labeling and model training needing generalization, the whole process is automatic without manual intervention, so that the problems of low intelligentization degree of a dialogue model and the like caused by scarcity of the corpus in the related technology are solved, and optimization of the dialogue model is realized.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present application.
FIG. 5 is a block diagram of a training apparatus for a dialog model, according to an embodiment of the present application; as shown in fig. 5, the training apparatus of the dialogue model includes:
the obtaining module 52 is configured to obtain historical dialogue information of a target object and a dialogue system, and determine whether to perform generalization processing on request information of the target object according to the historical dialogue information, where the historical dialogue information includes: the request information and the response information of the dialogue system;
The generalization module 54 is configured to, in a case where it is determined that the request information of the target object needs to be subjected to generalization, perform generalization on the request information to obtain a first generalized corpus;
the training module 56 is configured to train the dialogue model of the dialogue system according to the first generalized corpus, so as to obtain a trained dialogue model.
By the device, the historical dialogue information of the target object and the dialogue system is obtained, and whether the request information of the target object needs to be subjected to generalization processing is determined according to the historical dialogue information, wherein the historical dialogue information comprises the following components: the request information and the response information of the dialogue system; under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained; training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model, solving the problems of low intelligent degree and the like of the dialogue model due to scarcity of the corpus in the related technology, and realizing optimization of the dialogue model.
In one exemplary embodiment, the obtaining module 52 is configured to input the historical dialogue information into a retraining discriminant model; and acquiring a judging result corresponding to the request information, which is determined by the retraining judging model based on at least one of the response information, the request information and the emotion characteristics corresponding to the request information, wherein the judging result is used for indicating whether the request information of the target object needs to be subjected to generalization processing.
In an exemplary embodiment, the obtaining module 52, configured to obtain a determined discrimination result corresponding to the request information by using the retraining discrimination model based on at least one of the response information, the request information, and an emotional feature corresponding to the request information, includes: under the condition that the retraining discriminant model determines that the dialogue system does not successfully analyze the request information, acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing; and under the condition that the retraining judgment model determines that the dialogue system successfully analyzes the request information, acquiring a second sub-judgment result which is output by the retraining judgment model and is used for indicating that generalization processing is not required for the request information.
In an exemplary embodiment, the obtaining module 52 is configured to obtain, when the historical dialogue information is multiple rounds of dialogue information, emotion changes and mood changes corresponding to the plurality of pieces of request information determined by the retraining discriminant model, and obtain emotion features of the target object determined by the retraining discriminant model according to the emotion changes and the mood changes; under the condition that the retraining discriminant model determines that the emotion characteristics accord with preset emotion characteristics, a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing is obtained; and under the condition that the retraining judgment model determines that the emotion characteristics do not accord with preset emotion characteristics, acquiring a second sub-judgment result of which the instruction output by the retraining judgment model does not need to generalize the request information.
In an exemplary embodiment, the obtaining module 52 is configured to obtain, when the historical dialogue information is multiple rounds of dialogue information, the number of occurrences of similar request information determined by the retraining discriminant model in the multiple rounds of dialogue information; acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing under the condition that the retraining discriminant model determines that the occurrence number is greater than a preset threshold value; and under the condition that the occurrence number is smaller than or equal to a preset threshold value, acquiring a second sub-discrimination result of the indication output by the retraining discrimination model without generalizing the request information.
In an exemplary embodiment, the generalization module 54 is configured to input the request information and the generalization conditions to a target GPT model, so that the target GPT model generalizes the first generalization corpus according to the generalization conditions; and acquiring the first generalized corpus output by the target GPT model.
In an exemplary embodiment, a training module 56 is configured to determine a feature vector of each of the first generalized corpus, and determine a center point of a plurality of the feature vectors based on a mean algorithm; determining a first corpus label of the first generalized corpus according to the center point; training the dialogue model according to the first generalized corpus and the first corpus label.
In one exemplary embodiment, training module 56 is configured to determine a distance of the center point from a center point of the plurality of corpus sets, wherein the distance includes at least one of: the Euclidean distance and the Manhattan distance, and the corpus labels in each corpus set are the same; determining a corpus set corresponding to the minimum distance from the plurality of distances; and determining a first corpus label of the first generalized corpus according to the corpus label of the corpus set corresponding to the minimum distance.
In one exemplary embodiment, a training module 56 is configured to divide the first generalized corpus into a training corpus and a verification corpus; under the condition that one training iteration is completed on the dialogue model according to the training corpus, calculating a loss value of the verification corpus according to a second corpus label of the verification corpus and a first corpus label of the verification corpus, which are determined by the dialogue model; and under the condition that the loss value is smaller than a preset loss value, stopping training the dialogue model.
In an exemplary embodiment, the training module 56 is configured to obtain a recognition result of the request information by the trained dialogue model, where the recognition result is used to indicate whether to successfully recognize the request information; under the condition that the identification result indicates that the request information is not successfully identified, carrying out generalization processing on the request information to obtain a second generalization corpus; training a dialogue model of the dialogue system according to the first generalized corpus and the second generalized corpus.
Embodiments of the present application also provide a storage medium including a stored program, wherein the program performs the method of any one of the above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store program code for performing the steps of:
s1, acquiring historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system;
s2, under the condition that the request information of the target object is determined to need to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained;
and S3, training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, acquiring historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system;
s2, under the condition that the request information of the target object is determined to need to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained;
and S3, training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed across a network of computing devices, or they may alternatively be implemented in program code executable by computing devices, such that they may be stored in a memory device for execution by the computing devices and, in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be implemented as individual integrated circuit modules, or as individual integrated circuit modules. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.

Claims (13)

1. A method for training a dialog model, comprising:
acquiring historical dialogue information of a target object and a dialogue system, and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, wherein the historical dialogue information comprises: the request information and the response information of the dialogue system;
under the condition that the request information of the target object is determined to be subjected to generalization processing, the request information is subjected to generalization processing, and a first generalization corpus is obtained;
training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
2. The method for training a dialogue model according to claim 1, wherein determining whether the request information of the target object needs to be generalized according to the history dialogue information comprises:
inputting the history dialogue information into a retraining judgment model;
and acquiring a judging result corresponding to the request information, which is determined by the retraining judging model based on at least one of the response information, the request information and the emotion characteristics corresponding to the request information, wherein the judging result is used for indicating whether the request information of the target object needs to be subjected to generalization processing.
3. The method according to claim 2, wherein acquiring the discrimination result corresponding to the request information determined by the retraining discrimination model based on at least one of the response information, the request information, and the emotional characteristics corresponding to the request information, comprises:
under the condition that the retraining discriminant model determines that the dialogue system does not successfully analyze the request information, acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing;
and under the condition that the retraining judging model determines that the dialogue system successfully analyzes the request information, acquiring a second sub-judging result which is output by the retraining judging model and indicates that the request information does not need to be subjected to generalization processing, wherein the judging result comprises the first sub-judging result and the second sub-judging result.
4. A training method for a dialogue model according to claim 2 or 3, wherein acquiring the training result corresponding to the request information determined by the retraining judgment model based on at least one of the response information, the request information, and the emotional characteristics corresponding to the request information, comprises:
Under the condition that the historical dialogue information is multi-turn dialogue information, acquiring emotion changes and mood changes corresponding to a plurality of pieces of request information determined by the retraining judgment model, and acquiring emotion characteristics of the target object determined by the retraining judgment model according to the emotion changes and the mood changes;
under the condition that the retraining discriminant model determines that the emotion characteristics accord with preset emotion characteristics, a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing is obtained;
and under the condition that the retraining judgment model determines that the emotion characteristics do not accord with preset emotion characteristics, acquiring a second sub-judgment result of which the instruction output by the retraining judgment model does not need to generalize the request information.
5. The method according to claim 2, wherein acquiring the discrimination result corresponding to the request information determined by the retraining discrimination model based on at least one of the response information, the request information, and the emotional characteristics corresponding to the request information, comprises:
acquiring the occurrence times of similar request information determined by the retraining discriminant model in the multi-round dialogue information under the condition that the historical dialogue information is the multi-round dialogue information;
Acquiring a first sub-discriminant result which is output by the retraining discriminant model and indicates that the request information needs to be subjected to generalization processing under the condition that the retraining discriminant model determines that the occurrence number is greater than a preset threshold value;
and under the condition that the occurrence number is smaller than or equal to a preset threshold value, acquiring a second sub-discrimination result of the indication output by the retraining discrimination model without generalizing the request information.
6. The method for training a dialogue model according to any one of claims 1 to 5, wherein the generalizing the request information to obtain a first generalized corpus includes:
inputting the request information and the generalization conditions to a target GPT model so that the target GPT model generalizes the first generalization corpus according to the generalization conditions;
and acquiring the first generalized corpus output by the target GPT model.
7. The method for training a dialogue model according to any one of claims 1-5, wherein training the dialogue model of the dialogue system according to the first generalized corpus comprises:
determining a feature vector of each first generalized corpus, and determining a plurality of center points of the feature vectors based on a mean algorithm;
Determining a first corpus label of the first generalized corpus according to the center point;
training the dialogue model according to the first generalized corpus and the first corpus label.
8. The method of claim 7, wherein determining a first corpus label of the first generalized corpus from the center point comprises:
determining a distance of the center point from center points of a plurality of corpus sets, wherein the distance comprises at least one of: the Euclidean distance and the Manhattan distance, and the corpus labels in each corpus set are the same;
determining a corpus set corresponding to the minimum distance from the plurality of distances;
and determining a first corpus label of the first generalized corpus according to the corpus label of the corpus set corresponding to the minimum distance.
9. The method of training a dialog model of claim 7, wherein training the dialog model based on the first generalized corpus and a first corpus tag of the first generalized corpus comprises:
dividing the first generalized corpus into a training corpus and a verification corpus;
under the condition that one training iteration is completed on the dialogue model according to the training corpus, calculating a loss value of the verification corpus according to a second corpus label of the verification corpus and a first corpus label of the verification corpus, which are determined by the dialogue model;
And under the condition that the loss value is smaller than a preset loss value, stopping training the dialogue model.
10. The method of training a dialog model of the dialog system of claim 7, wherein after training the dialog model of the dialog system based on the first generalized corpus, the method further comprises:
acquiring an identification result of the trained dialogue model on the request information, wherein the identification result is used for indicating whether the request information is successfully identified;
under the condition that the identification result indicates that the request information is not successfully identified, carrying out generalization processing on the request information to obtain a second generalization corpus;
training a dialogue model of the dialogue system according to the first generalized corpus and the second generalized corpus.
11. A training device for a dialog model, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring historical dialogue information of a target object and a dialogue system and determining whether the request information of the target object needs to be subjected to generalization processing according to the historical dialogue information, and the historical dialogue information comprises: the request information and the response information of the dialogue system;
The generalization module is used for generalizing the request information of the target object under the condition that the request information is determined to be required to be subjected to generalization processing, so as to obtain a first generalization corpus;
and the training module is used for training the dialogue model of the dialogue system according to the first generalized corpus to obtain a trained dialogue model.
12. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 10.
13. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 10 by means of the computer program.
CN202310343560.6A 2023-03-31 2023-03-31 Training method and device of dialogue model, storage medium and electronic equipment Pending CN116483961A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310343560.6A CN116483961A (en) 2023-03-31 2023-03-31 Training method and device of dialogue model, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310343560.6A CN116483961A (en) 2023-03-31 2023-03-31 Training method and device of dialogue model, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116483961A true CN116483961A (en) 2023-07-25

Family

ID=87218667

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310343560.6A Pending CN116483961A (en) 2023-03-31 2023-03-31 Training method and device of dialogue model, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116483961A (en)

Similar Documents

Publication Publication Date Title
CN105654949B (en) A kind of voice awakening method and device
CN110262273A (en) A kind of home equipment control method, device, storage medium and smart home system
CN111880856B (en) Voice wakeup method and device, electronic equipment and storage medium
CN108364650B (en) Device and method for adjusting voice recognition result
US11333378B1 (en) Energy consumption artificial intelligence
CN111161726B (en) Intelligent voice interaction method, device, medium and system
WO2023168838A1 (en) Sentence text recognition method and apparatus, and storage medium and electronic apparatus
CN111178081B (en) Semantic recognition method, server, electronic device and computer storage medium
CN111128156A (en) Intelligent household equipment voice control method and device based on model training
CN111105786A (en) Multi-sampling-rate voice recognition method, device, system and storage medium
CN108932947B (en) Voice control method and household appliance
CN115356939A (en) Control command transmission method, control device, storage medium, and electronic device
CN108538290A (en) A kind of intelligent home furnishing control method based on audio signal detection
CN111524514A (en) Voice control method and central control equipment
CN112765981A (en) Text information generation method and device
CN116483961A (en) Training method and device of dialogue model, storage medium and electronic equipment
CN109145124B (en) Information storage method and device, storage medium and electronic device
CN114915514B (en) Method and device for processing intention, storage medium and electronic device
CN114925158A (en) Sentence text intention recognition method and device, storage medium and electronic device
CN110428814B (en) Voice recognition method and device
CN116415590A (en) Intention recognition method and device based on multi-round query
CN115547331A (en) Voice processing method, processing device, storage medium and electronic device
CN117689020B (en) Method and device for constructing intelligent home body based on large model and electronic equipment
CN112201250B (en) Semantic analysis method and device, electronic equipment and storage medium
CN115576216B (en) Information filling method and device based on voice control intelligent household appliance

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination