CN-117194617-B - Training method and device for intention slot recognition model and electronic equipment
Abstract
The application provides a training method and device for an intention slot recognition model and electronic equipment, and relates to the field of man-machine conversation and natural language understanding. The method comprises the steps of inputting a training sample into an initial intention slot recognition model to obtain an intention prediction result and a slot prediction result corresponding to the training sample, obtaining a target slot prediction result from the slot prediction result based on labeling data of the training sample, wherein the target slot prediction result is a slot prediction result of related characters which are concerned by a service in the training sample, comparing the intention prediction result, the slot prediction result and the target slot prediction result with labeling data respectively to obtain a model total loss value, and training the initial intention slot recognition model based on the model total loss value to obtain a trained intention slot recognition model. The scheme can improve the slot recognition effect of the trained intention slot recognition model on the relevant characters focused by the service.
Inventors
- WU KAIYU
Assignees
- 北京罗克维尔斯科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20220525
Claims (11)
- 1. The training method of the intention slot recognition model is characterized by comprising the following steps of: inputting a training sample into an initial intention slot recognition model to obtain an intention prediction result and a slot prediction result corresponding to the training sample; Acquiring a target slot position prediction result from the slot position prediction result based on the labeling data of the training sample, wherein the target slot position prediction result is a slot position prediction result of a relevant character which is concerned with the service in the training sample; Comparing the intention prediction result, the slot position prediction result and the target slot position prediction result with labeling data of the training sample respectively to calculate an intention loss value, a slot position loss value and a target slot position loss value, and acquiring a model total loss value based on the intention loss value, the slot position loss value and the target slot position loss value, wherein the target slot position loss value is a loss value obtained by comparing and calculating a target slot position label and the target slot position prediction result, and the target slot position label is a slot position label of a relevant character which is concerned with business in the training sample; and training the initial intention slot position recognition model based on the model total loss value to obtain a trained intention slot position recognition model.
- 2. The method of claim 1, wherein the labeling data of the training sample includes an intent label and a slot label of the training sample, wherein the comparing the intent prediction result, the slot prediction result, and the target slot prediction result with the labeling data of the training sample to calculate an intent loss value, a slot loss value, and a target slot loss value, respectively, and obtaining a model total loss value based on the intent loss value, the slot loss value, and the target slot loss value comprises: comparing and calculating the intention label of the training sample with the intention prediction result to obtain an intention loss value; Comparing and calculating the slot position label of the training sample with the slot position prediction result to obtain a slot position loss value; Acquiring a target slot position label from the slot position label of the training sample; Comparing and calculating the target slot position label with the target slot position prediction result to obtain a target slot position loss value; And carrying out operation processing according to the intended loss value, the slot position loss value and the target slot position loss value to obtain the model total loss value.
- 3. The method of claim 2, wherein the computing according to the intended loss value, the slot loss value, and the target slot loss value to obtain the model total loss value comprises: And carrying out weighted calculation according to the intended loss value, the first weight of the intended loss value, the slot loss value, the second weight of the slot loss value, the target slot loss value and the third weight of the target slot loss value so as to obtain the model total loss value.
- 4. A method according to claim 3, characterized in that the first weight is obtained by: Dividing the training samples into N batches of samples, wherein N is an integer greater than 1; Inputting an ith batch of samples into an ith-1 th intention optimizing intention slot position identification model to obtain an ith intention prediction result of the ith batch of samples, wherein i is a positive integer less than or equal to N; acquiring an ith intent loss value based on the intent label of the ith batch sample and the ith intent prediction result, and adding the ith intent loss value to an intent loss value sequence; training the intent slot position recognition model subjected to the i-1 th intent optimization based on the i-th intent loss value to obtain an intent slot position recognition model subjected to the i-th intent optimization; after an intention slot recognition model subjected to the N-th intention optimization is obtained, carrying out average calculation on N intention loss values in the intention loss value sequence to obtain a first average value; And carrying out operation processing on the first average value to obtain the first weight.
- 5. A method according to claim 3, characterized in that the second weight is obtained by: Dividing the training samples into N batches of samples, wherein N is an integer greater than 1; Inputting a jth batch of samples into a j-1 th time slot position optimized intended slot position identification model to obtain a j-th slot position prediction result of the jth batch of samples, wherein j is a positive integer less than or equal to N, and the j-1 th time slot position optimized intended slot position identification model is the initial intended slot position identification model when j=1; Based on the slot label of the jth batch of samples and the jth slot prediction result, obtaining a jth slot loss value, and adding the jth slot loss value into a slot loss value sequence; training the intended slot position recognition model after the j-1 th slot position optimization based on the j-th slot position loss value to obtain an intended slot position recognition model after the j-th slot position optimization; after the intended slot position identification model after the N-th slot position optimization is obtained, carrying out average calculation on N slot position loss values in the slot position loss value sequence to obtain a second average value; and carrying out operation processing on the second average value to obtain the second weight.
- 6. A method according to claim 3, characterized in that the third weight is obtained by: Dividing the training samples into N batches of samples, wherein N is an integer greater than 1; Inputting an mth batch of samples into an intended slot recognition model after mth-1 target slot optimization, obtaining an mth slot prediction result of the mth batch of samples, and obtaining an mth target slot prediction result from the mth slot prediction result based on labeling data of the mth batch of samples, wherein m is a positive integer less than or equal to N; acquiring an mth target slot loss value based on the target slot label of the mth batch of samples and the mth target slot prediction result, and adding the mth target slot loss value into a target slot loss value sequence; training the intended slot position recognition model after the mth-1 target slot position optimization based on the mth target slot position loss value to obtain an intended slot position recognition model after the mth target slot position optimization; After an intention slot position identification model after the N-th target slot position optimization is obtained, carrying out average calculation on N target slot position loss values in the target slot position loss value sequence, and obtaining a third average value; And carrying out operation processing on the third average value to obtain the third weight.
- 7. An apparatus for training an intended slot recognition model, comprising: the first acquisition module is used for inputting a training sample into the initial intention slot position identification model to obtain an intention prediction result and a slot position prediction result corresponding to the training sample; The second acquisition module is used for acquiring a target slot position prediction result from the slot position prediction result based on the labeling data of the training sample, wherein the target slot position prediction result is a slot position prediction result of a relevant character which is concerned with the service in the training sample; The third acquisition module is used for comparing the intention prediction result, the slot position prediction result and the target slot position prediction result with the marking data of the training sample respectively to calculate an intention loss value, a slot position loss value and a target slot position loss value, and acquiring a model total loss value based on the intention loss value, the slot position loss value and the target slot position loss value, wherein the target slot position loss value is a loss value obtained by comparing and calculating a target slot position label and the target slot position prediction result, and the target slot position label is a slot position label of a character which is concerned with service in the training sample; and the training module is used for training the initial intention slot position recognition model based on the model total loss value so as to obtain a trained intention slot position recognition model.
- 8. The apparatus of claim 7, wherein the annotation data for the training sample comprises an intent tag and a slot tag for the training sample, and wherein the third obtaining module comprises: The first acquisition unit is used for comparing and calculating the intention label of the training sample with the intention prediction result to acquire an intention loss value; The second acquisition unit is used for comparing and calculating the slot position label of the training sample with the slot position prediction result to acquire a slot position loss value; the third acquisition unit is used for acquiring a target slot position label from the slot position labels of the training samples; the fourth acquisition unit is used for comparing and calculating the target slot position label and the target slot position prediction result to acquire a target slot position loss value; and a fifth obtaining unit, configured to perform an operation process according to the intended loss value, the slot loss value, and the target slot loss value, so as to obtain the model total loss value.
- 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 6 when the program is executed by the processor.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1 to 6.
- 11. A vehicle, characterized in that it comprises an electronic device according to claim 9.
Description
Training method and device for intention slot recognition model and electronic equipment Technical Field The application relates to the field of man-machine conversation and natural voice understanding, in particular to a training method and device for an intention slot recognition model and electronic equipment. Background The intention slot recognition model is mainly applied to specific scenes in a dialogue system, such as telephone scenes, music scenes, navigation scenes and the like, and the dialogue system can recognize intention and slot information based on dialogue content through the intention slot recognition model, so that feedback can be timely performed according to the recognized intention and slot information. In the related art, the intention slot recognition model is trained based on only fusion of the intention and the loss value of the slot, resulting in poor slot prediction of the resulting trained intention slot recognition model. Disclosure of Invention In order to solve the problems, the application provides a training method and device for an intention slot recognition model and electronic equipment. According to a first aspect of the present application, there is provided a training method of an intention slot recognition model, including: inputting a training sample into an initial intention slot recognition model to obtain an intention prediction result and a slot prediction result corresponding to the training sample; Acquiring a target slot position prediction result from the slot position prediction result based on the labeling data of the training sample, wherein the target slot position prediction result is a slot position prediction result of a relevant character which is concerned with the service in the training sample; Comparing the intention prediction result, the slot position prediction result and the target slot position prediction result with the labeling data of the training sample respectively to obtain a model total loss value; and training the initial intention slot position recognition model based on the model total loss value to obtain a trained intention slot position recognition model. In some embodiments of the present application, the labeling data of the training sample includes an intention label and a slot label of the training sample, and the comparing the intention prediction result, the slot prediction result and the target slot prediction result with the labeling data of the training sample respectively to obtain a model total loss value includes: comparing and calculating the intention label of the training sample with the intention prediction result to obtain an intention loss value; Comparing and calculating the slot position label of the training sample with the slot position prediction result to obtain a slot position loss value; the method comprises the steps of obtaining a target slot position label from the slot position label of the training sample, wherein the target slot position label is a slot position label of a relevant character concerned by business in the training sample; Comparing and calculating the target slot position label with the target slot position prediction result to obtain a target slot position loss value; And carrying out operation processing according to the intended loss value, the slot position loss value and the target slot position loss value to obtain the model total loss value. The calculating according to the intended loss value, the slot loss value and the target slot loss value to obtain the model total loss value includes: And carrying out weighted calculation according to the intended loss value, the first weight of the intended loss value, the slot loss value, the second weight of the slot loss value, the target slot loss value and the third weight of the target slot loss value so as to obtain the model total loss value. As a possible implementation, the first weight is obtained by: Dividing the training samples into N batches of samples, wherein N is an integer greater than 1; Inputting an ith batch of samples into an ith-1 th intention optimizing intention slot position identification model to obtain an ith intention prediction result of the ith batch of samples, wherein i is a positive integer less than or equal to N; acquiring an ith intent loss value based on the intent label of the ith batch sample and the ith intent prediction result, and adding the ith intent loss value to an intent loss value sequence; training the intent slot position recognition model subjected to the i-1 th intent optimization based on the i-th intent loss value to obtain an intent slot position recognition model subjected to the i-th intent optimization; after an intention slot recognition model subjected to the N-th intention optimization is obtained, carrying out average calculation on N intention loss values in the intention loss value sequence to obtain a first average value; And carrying out operation processing on the f