A model training method, device and equipment
By calculating the class label probability and loss information of samples using the forward propagation algorithm, and then training the model using the backpropagation algorithm after pruning noisy labels, the overfitting problem caused by noisy labels is solved, and the robustness of the model and the training effect are improved.
Patent Information
- Application Number
- CN202211058124.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2042-08-30
AI Technical Summary
When there are many class labels on the samples and the distinctions are not obvious, noisy labeled samples are prone to causing model overfitting. Existing technologies are difficult to effectively handle noisy labels, resulting in poor model training performance.
By acquiring text data samples, the probability of category labels is calculated using the forward propagation algorithm to determine the loss information. Unnecessary category labels are pruned based on the loss information, and the model is trained using the backpropagation algorithm to obtain the trained target model.
It improves the model's robustness to noisy labeled samples, prevents difficult samples from being discarded, effectively handles multi-class labeling problems, and improves model training performance.
Smart Images

Figure CN115392386B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present document relates to the technical field of computer technology, and particularly relates to a model training method, device and equipment. BACKGROUND
[0002] A sample is necessary data for training a model. Not only original data necessary for training a model is needed in the sample, but also a category label corresponding to the sample is often needed, so as to perform loss calculation on a result predicted by the model and the category label, and adjust model parameters of the model. In actual application, one sample can include one category label or multiple different category labels. However, one or more category labels of the sample can also be an incorrect label. Thus, a noisy label of the sample is generated.
[0003] The sample with the noisy label is very common in daily business, especially in the case that multiple category labels of the sample exist and the multiple category labels are not very obvious (for example, in a human-computer interaction scene). Many incorrect labels (i.e., noisy labels) are generated in the process of marking some samples. If the sample with the noisy label is used to train a model, overfitting of an incorrect label is likely to occur. Therefore, a more optimal processing mechanism of the noisy label of the sample is needed to train a model with a better output effect on the sample with the noisy label. SUMMARY
[0004] An object of the embodiments of the present specification is to provide a more optimal processing mechanism of the noisy label of the sample, so as to train a model with a better output effect on the sample with the noisy label.
[0005] In order to achieve the above technical solutions, the embodiments of the present specification are implemented as follows:
[0006] The method provided by the embodiments of the present specification comprises: obtaining a text data sample used for training a target model, the text data sample being a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample comprising a first number of category labels, the first number being not more than a second number corresponding to category labels of samples used for training the target model, the target model being a model used for identifying user intent. The text data sample is input into the target model, a probability that the text data sample belongs to each of the second number of category labels is obtained through a forward propagation algorithm, and loss information corresponding to the text data sample is determined through a preset loss function corresponding to the target model based on the probability that the text data sample belongs to each of the second number of category labels and the first number of category labels contained in the text data sample. The first number of category labels contained in the text data sample is pruned based on the loss information corresponding to the text data sample, and a text data sample containing remaining category labels is obtained. The target model is trained based on the text data sample containing the remaining category labels through a back propagation algorithm, and a trained target model is obtained.
[0007] The device provided by the embodiments of the present specification comprises: a sample obtaining module that obtains a text data sample used for training a target model, the text data sample being a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample comprising a first number of category labels, the first number being not more than a second number corresponding to category labels of samples used for training the target model, the target model being a model used for identifying user intent. A loss determining module that inputs the text data sample into the target model, obtains a probability that the text data sample belongs to each of the second number of category labels through a forward propagation algorithm, and determines loss information corresponding to the text data sample through a preset loss function corresponding to the target model based on the probability that the text data sample belongs to each of the second number of category labels and the first number of category labels contained in the text data sample. A label pruning module that prunes the first number of category labels contained in the text data sample based on the loss information corresponding to the text data sample, and obtains a text data sample containing remaining category labels. A model training module that trains the target model based on the text data sample containing the remaining category labels through a back propagation algorithm, and obtains a trained target model.
[0008] The embodiment of the present specification provides a model training device. The model training device comprises a processor and a memory arranged to store computer executable instructions which, when executed, cause the processor to: obtain a text data sample for training a target model, the text data sample being a data sample converted from voice data input by a user in a human-computer interaction process, the text data sample comprising a first number of category labels, the first number being not more than a second number of category labels corresponding to samples for training the target model, the target model being a model for identifying user intent; input the text data sample into the target model, obtain a probability that the text data sample belongs to each of the second number of category labels through a forward propagation algorithm, and determine loss information corresponding to the text data sample through a preset loss function corresponding to the target model based on the probability that the text data sample belongs to each of the second number of category labels and the first number of category labels contained in the text data sample. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample is pruned to obtain a text data sample containing remaining category labels. Through a back propagation algorithm, the target model is trained based on the text data sample containing the remaining category labels to obtain a trained target model.
[0009] The embodiment of the present specification also provides a storage medium for storing computer executable instructions which, when executed by a processor, implement the following processes: obtaining a text data sample for training a target model, the text data sample being a data sample converted from voice data input by a user in a human-computer interaction process, the text data sample comprising a first number of category labels, the first number being not more than a second number of category labels corresponding to samples for training the target model, the target model being a model for identifying user intent; inputting the text data sample into the target model, obtaining a probability that the text data sample belongs to each of the second number of category labels through a forward propagation algorithm, and determining loss information corresponding to the text data sample through a preset loss function corresponding to the target model based on the probability that the text data sample belongs to each of the second number of category labels and the first number of category labels contained in the text data sample. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample is pruned to obtain a text data sample containing remaining category labels. Through a back propagation algorithm, the target model is trained based on the text data sample containing the remaining category labels to obtain a trained target model. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to make the technical solutions in the embodiments of the present specification or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present specification, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0011] Figure 1 For a model training method embodiment of the present specification;
[0012] Figure 2 For a structure diagram of a sample input page of the present specification;
[0013] Figure 3 For another model training method embodiment of the present specification;
[0014] Figure 4 For a schematic diagram of a model training process of the present specification;
[0015] Figure 5 For another model training method embodiment of the present specification;
[0016] Figure 6 For another model training method embodiment of the present specification;
[0017] Figure 7 For a model training device embodiment of the present specification;
[0018] Figure 8 For a model training device embodiment of the present specification. DETAILED DESCRIPTION
[0019] The embodiments of the present specification provide a model training method, device and equipment.
[0020] In order to make the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present specification. Obviously, the described embodiments are only some embodiments of the present specification, not all embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present specification.
[0021] Embodiment one
[0022] As Figure 1As shown, the embodiments of the present specification provide a model training method, the execution subject of the method can be a terminal device or a server, wherein the terminal device can be a mobile terminal device such as a mobile phone, a tablet computer, etc., and can also be a device such as a personal computer, the server can be an independent server, and can also be a server cluster composed of multiple servers, etc., the server can be a background server such as a financial service or a network shopping service, and can also be a background server of an application program, etc. The method can be applied to related scenarios provided with model training, etc., in the present embodiment, the server is taken as the execution subject for detailed description, for the case of the terminal device, please refer to the related content below, which will not be repeated here. The method can specifically include the following steps:
[0023] In step S102, a first sample for training a target model is obtained, the first sample includes a first number of category labels, and the first number does not exceed a second number of category labels corresponding to samples for training the target model.
[0024] The target model can be any model. In actual application, the target model can be a model related to one or more businesses. Different target models can be constructed based on different businesses. For example, if the business is an intent recognition business, i.e., the user's conversation intent is recognized or understood during human-computer interaction, the target model can be a model for recognizing the user's intent. If the business is an information recommendation business, the target model can be a model for information recommendation. If the business is a risk prevention and control business in a financial system, the target model can be a model for risk prevention and control of the financial system. If the business is a commodity transaction business, the target model can be a model for predicting the sales of a certain commodity, and so on. The target model can include multiple types, and different target models can be constructed in different ways. For example, a model for information recommendation can be constructed by a classification algorithm, or a model for risk prevention and control of a financial system can be constructed by a convolutional neural network algorithm, and so on. The first sample can be sample data that meets the model training requirements of the target model. For example, if the target model is a model for information recommendation, the first sample can include historical recommended information of a user and user actual selection behavior data, and so on. If the target model is a model for risk prevention and control of the financial system, the first sample can include relevant data generated during the user's execution of a certain business in the financial system. If the target model is a face recognition model, the first sample can be a face image. If the target model is a model for recognizing the user's intent, the first sample can be voice data or corresponding text data input by the user during human-computer interaction, and so on. In addition, the first sample can be one or multiple, and the specific setting can be based on actual conditions, which is not limited in the embodiments of the present specification. The category label can be a label of the sample. One sample can include multiple different category labels. For example, the first sample is an image, and the category label can be whether the image contains a cat or not. The image can also contain a dog. If the image contains a cat and a dog, the category label of the image can include two, one category label can be containing a dog, and the other category label can be containing a cat, and so on. The above is only an example of two category labels. In actual application, two or more category labels can also be included. The specific setting can be based on actual conditions, which is not limited in the embodiments of the present specification. The first quantity can be set according to actual conditions, and the specific value can be 2 or 10, and so on. The second quantity can be set according to actual conditions, and the specific value can be 20 or 50, and so on.
[0025] In implementation, a sample is necessary data for training a model, and not only the original data necessary for training the model, but also the category label corresponding to the sample is often needed, so as to calculate the loss between the result predicted by the model and the category label, and adjust the model parameters of the model. In actual application, a sample can include one category label or multiple different category labels, but one or more category labels of a sample can also be an incorrect label, so that a noisy label of a sample is generated. Noisy label samples are very common in daily business, especially when there are many category labels of a sample, and the distinction between different category labels is not very obvious. In the process of marking some samples, more incorrect labels (i.e., noisy labels) are generated. If a model is trained using samples with noisy labels, overfitting errors will easily occur. Generally, the model can be trained by, for example, a co-teachig-based model training rule, a co-teaching+based model training rule, and a cleanlab-based model training rule. However, the above methods are all to find samples with noisy labels from samples and discard samples with noisy labels in the process of training the model, that is, samples with large tail noise are discarded. On the one hand, many difficult samples can be discarded in the process of discarding samples with noisy labels, and on the other hand, for the case where there are many category labels of a sample, some labels of the sample are accurate and some labels of the sample are incorrect, and it is unreasonable to discard or retain them directly. Therefore, a more optimal processing mechanism for noisy labels of samples is needed to train a model with good output effect on samples with noisy labels. The embodiments of the present specification provide an implementable processing method, which can specifically include the following contents:
[0026] The first sample used for training the target model can be obtained in various ways. For example, an input page for training samples can be pre-set, which can include a data input box of the training sample, a determination button, a cancel button, and the like. When a certain training sample (i.e., the first sample) needs to be uploaded to the server, the data of the input page can be obtained, and the input page can be displayed. For example, Figure 2As shown, the user can input the data of the first sample in the data input box of the input page. In addition, based on the attributes of the target model and the related information of the business corresponding to the target model, a plurality of different category labels (i.e., a second number of category labels) can be set. The second number of category labels set can be all possible category labels to which the sample belongs. The second number of category labels can be selected according to the actual situation, and the second number of category labels is selected for the first sample input above, and the second number of category labels is labeled for the first sample. Then, the user can input the second number of category labels into the data input box while inputting the data of the first sample in the data input box. After the input is completed, the user can click the confirm button in the input page. At this time, the server can obtain the first sample, and the first sample can be obtained by the above method. Alternatively, the server can record the related data of a certain business, and the related data of the business can be labeled to obtain the second number of category labels. When the first sample needs to be obtained, the data meeting the specified requirements can be obtained from the above-mentioned related data of the business and the corresponding category labels, and the obtained data is used as the first sample, etc. In addition to the above method, the first sample can be obtained by a plurality of different methods, which can be set according to the actual situation, and the embodiments of the present specification are not limited.
[0027] In step S104, the first sample is input into the target model, the probability that the first sample belongs to each category label in the second number of category labels is obtained by the forward propagation algorithm, and based on the probability that the first sample belongs to each category label in the second number of category labels and the first number of category labels contained in the first sample, the loss information corresponding to the first sample is determined by the preset loss function corresponding to the target model.
[0028] The loss function can include a plurality of loss functions, such as a cross-entropy loss function, etc. The specific loss function can be set according to the actual situation, and the embodiments of the present specification are not limited.
[0029] In implementation, a certain number of samples can be obtained to train the target model, resulting in a pre-trained target model. Alternatively, a target model can be directly constructed using a corresponding algorithm and initialized. Then, the first sample can be input into the target model. Through the forward propagation algorithm, the first sample enters from the input layer of the target model, passes through the hidden layer, and finally transmits the processing result to the output layer. Through the output layer, the final output result can be obtained, which is the probability that the first sample belongs to each category label in the second number of category labels. Thus, the probability that the first sample's category label is each category label in the second number of category labels can be calculated using the target model. For example, the second number of category labels includes category label 1, category label 2, category label 3, category label 4, and category label 5. Through the target model, the probability that the first sample's category label is category label 1, category label 2, category label 3, category label 4, and category label 5 can be calculated. Then, the probability of the first sample belonging to each category label in the second number of category labels and the first number of category labels contained in the first sample can be input into the preset loss function corresponding to the target model to calculate the corresponding loss information, thereby obtaining the loss information corresponding to the first sample.
[0030] In step S106, based on the loss information corresponding to the first sample, the first number of category labels contained in the first sample are pruned to obtain the first sample containing the remaining category labels.
[0031] In practice, after obtaining the loss information corresponding to the first sample through the above method, based on the actual situation and considering that if the loss information corresponding to a certain category label is large, it indicates that the category label is more likely to be a noisy category label, a corresponding threshold can be preset. If the loss information corresponding to a certain category label is higher than the threshold, it indicates that the category label is more likely to be a noisy category label. At this time, the category labels with loss information higher than the threshold can be pruned, leaving only the category labels with loss information lower than the threshold, thus obtaining the first sample containing the remaining category labels.
[0032] In step S108, the target model is trained using the backpropagation algorithm based on the first sample containing the remaining class labels, resulting in the trained target model.
[0033] In implementation, after the first sample containing the remaining class labels is obtained in the above manner, the gradient of the preset target function with respect to each model parameter can be quickly calculated through a back-propagation algorithm, and finally, the local minimum of the preset loss function can be calculated based on the gradient value obtained above using, for example, a Stochastic Gradient Descent (SGD) algorithm, so as to obtain the corresponding weight, and the model parameter is updated based on the weight to train the target model, and finally the trained target model is obtained.
[0034] The embodiments of the present specification provide a model training method. By obtaining a first sample (the first sample includes a first number of class labels, and the first number is not more than a second number corresponding to the class labels of the sample used to train the target model) used to train the target model, then the first sample can be input into the target model, the probability of the first sample belonging to each class label of the second number of class labels is obtained through a forward propagation algorithm, and based on the probability of the first sample belonging to each class label of the second number of class labels and the first number of class labels contained in the first sample, the loss information corresponding to the first sample is determined through a preset loss function corresponding to the target model. Based on the loss information corresponding to the first sample, the first number of class labels contained in the first sample is pruned to obtain a first sample containing remaining class labels. Finally, the target model can be trained based on the first sample containing the remaining class labels through a back-propagation algorithm to obtain a trained target model. In this way, for the sample with noisy labels, a loss function that can process the sample with noisy labels at the label level is proposed, and it is particularly suitable for samples with multiple labels and a large number of label categories, which can greatly improve the robustness of the target model to the sample with noisy labels. In addition, through the above manner, the sample is processed in depth at the label level, preventing difficult samples from being discarded, and the problem of multiple class labels can be well handled.
[0035] Embodiment Two
[0036] As Figure 3As shown, the embodiment of the present specification provides a model training method, the execution subject of the method can be a terminal device or a server, wherein the terminal device can be a mobile terminal device such as a mobile phone, a tablet computer, etc., or a device such as a personal computer, the server can be an independent server, or a server cluster composed of multiple servers, etc., the server can be a background server of a financial service or a network shopping service, etc., or a background server of an application program, etc. The method can be applied to related scenarios with model training, etc., in the embodiment, the server is taken as the execution subject for detailed description, for the case of the terminal device, please refer to the related content below, which will not be repeated here. The method can specifically include the following steps:
[0037] In step S302, a first sample for training a target model is obtained, the first sample includes a first number of class labels, and the first number is not more than a second number of class labels corresponding to the samples for training the target model.
[0038] In step S304, the target model is trained based on a preset model training rule, and in the process of model training, the first sample is input into the target model, and the probability of the first sample belonging to each class label of the second number of class labels is obtained through a forward propagation algorithm, and the model training rule includes one or more of a co-teachig-based model training rule, a co-teaching+-based model training rule, and a cleanlab-based model training rule.
[0039] In implementation, considering that in actual application, the model can be trained based on the co-teachig-based model training rule, the co-teaching+-based model training rule, or the cleanlab-based model training rule, and the model is trained with noisy labels, therefore, the process of training the model based on the co-teachig-based model training rule, the co-teaching+-based model training rule, or the cleanlab-based model training rule can be improved, specifically, the target model can be trained based on the first sample, and based on the co-teachig-based model training rule, the co-teaching+-based model training rule, or the cleanlab-based model training rule, and in the process of model training, the first sample can be input into the target model, and the probability of the first sample belonging to each class label of the second number of class labels is obtained through a forward propagation algorithm, which can be referred to the related content above.
[0040] It should be noted that the one or more of the co-teachig-based model training rule, the co-teaching+ -based model training rule and the cleanlab-based model training rule are only one implementable way for model training of the target model, and a plurality of different model training rules can be used for model training of the target model, which can be set according to actual conditions, and the embodiments of the present specification do not limit this.
[0041] In step S306, based on the probability of the first sample belonging to each of the second number of class labels and the first number of class labels contained in the first sample, the loss information corresponding to the first sample is determined by a preset loss function corresponding to the target model.
[0042] The preset loss function corresponding to the target model can be a binary cross-entropy loss function BCELoss, a mean square error loss function MSELoss or a Focal Loss loss function, etc.
[0043] The specific processing process of step S306 can be referred to the related content in the foregoing embodiment one, which will not be repeated here.
[0044] In step S308, based on the loss information corresponding to the first sample, the first number of class labels contained in the first sample are sorted to obtain the first number of class labels arranged in descending order of loss information.
[0045] In step S310, based on the preset class label pruning rule, the first number of class labels arranged in descending order of loss information are pruned to obtain the first sample containing the remaining class labels.
[0046] In implementation, a corresponding threshold value can be set in advance to filter the first number of class labels arranged in descending order of loss information, and based on the preset class label pruning rule, the class label corresponding to the loss information arranged in front and greater than the threshold value is pruned from the first number of class labels to obtain the first sample containing the remaining class labels.
[0047] In actual application, the specific processing mode of step S310 can be various, and one optional processing mode is provided below, which can include the following contents: removing the positive label with loss information greater than the preset first loss threshold from the first number of class labels arranged in descending order of loss information, and removing the negative label with loss information greater than the preset second loss threshold from the first number of class labels arranged in descending order of loss information, to obtain the first sample containing the remaining class labels.
[0048] The positive label can be a class label used to label the first sample as a positive sample, and the negative label can be a class label used to label the first sample as a negative sample. For example, the first sample is an image, the positive label can be a label indicating that the image contains a certain object, and the negative label can be a label indicating that the image does not contain a certain object. The specific setting can also be based on actual conditions, and the embodiments of the present specification do not limit this.
[0049] In actual application, as shown in Figure 4 If the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, and the class label is presented as 0 or 1, the positive label with loss information greater than the preset first loss threshold is removed from the first number of class labels arranged in the order of loss information from large to small, and the negative label with loss information greater than the preset second loss threshold is removed from the first number of class labels arranged in the order of loss information from large to small. The specific processing method of the first sample containing the remaining class label can be various, and an optional processing method is provided below, which can specifically include the following steps A2 and step A4.
[0050] In step A2, from the first number of class labels arranged in the order of loss information from large to small, the class label presented as 1 arranged in the order of loss information from large to small is obtained, and the class label presented as 0 arranged in the order of loss information from large to small is obtained.
[0051] In step A4, the class label with loss information greater than the preset first loss threshold is removed from the obtained class label presented as 1 arranged in the order of loss information from large to small, and the class label with loss information greater than the preset second loss threshold is removed from the obtained class label presented as 0 arranged in the order of loss information from large to small, to obtain the first sample containing the remaining class label.
[0052] In implementation, as shown in Figure 4As shown, the largest k1 loss information corresponding to the category label can be removed from the obtained loss information arranged in descending order (i.e., the category label with loss information greater than the preset first loss threshold is removed from the obtained loss information arranged in descending order) (i.e., the category label with loss information greater than the preset second loss threshold is removed from the obtained loss information arranged in descending order), wherein k1 and k2 are hyperparameters, respectively representing the number of positive labels and negative labels in the first sample, and can be set according to specific conditions. For example, when the category label of the sample is more, the label of a certain category label is often missed, but the category label that has been labeled is usually more accurate, at this time, k1 can be set to 0, indicating that only the negative label with noise label is tolerated.
[0053] In step S312, the target model is trained based on the first sample containing the remaining category label by using a back propagation algorithm to obtain a trained target model.
[0054] The specific program code of the above processing process (for example, pytorch code) can be seen from the following content:
[0055]
[0056]
[0057] The embodiment of the present specification provides a model training method. By obtaining a first sample (the first sample includes a first number of category labels, and the first number is not more than a second number corresponding to the category labels of the sample for training a target model) for training the target model, the first sample can be input into the target model, the probability of the first sample belonging to each category label of the second number of category labels is obtained through a forward propagation algorithm, and based on the probability of the first sample belonging to each category label of the second number of category labels and the first number of category labels contained in the first sample, the loss information corresponding to the first sample is determined through a preset loss function corresponding to the target model. Based on the loss information corresponding to the first sample, the first number of category labels contained in the first sample is pruned to obtain a first sample containing remaining category labels. Finally, the target model is trained based on the first sample containing the remaining category labels through a back propagation algorithm to obtain a trained target model. In this way, for the sample with noisy labels, a loss function that can process the sample with noisy labels at the label level is proposed, and it is particularly suitable for samples with multiple labels and many label categories, which can greatly improve the robustness of the target model to samples with noisy labels. In addition, by processing the sample at the label level in the above manner, the difficult sample is prevented from being discarded, and the problem of multiple category labels can be well handled.
[0058] Embodiment three
[0059] Based on the foregoing embodiments, the following (including the current embodiment three and the subsequent embodiment four) explain the process of the above embodiments through a specific application scenario, which is a human-computer interaction scenario (such as a dialogue robot interacting with a user, the dialogue robot needs to understand and recognize the user's intention in the dialogue, and since there are many categories of user's intention, the label in it is easy to have noisy label). Based on this, the first sample described above is a text data sample. As shown in the following Figure 5 The embodiment of the present specification provides a model training method, which can be executed by a terminal device or a server. The terminal device can be a mobile terminal device such as a mobile phone or a tablet computer, or a personal computer or the like. The server can be a single server or a server cluster composed of multiple servers, or a server of the dialogue robot or the like. The method can specifically include the following steps:
[0060] In step S502, a text data sample for training a target model is obtained. The text data sample is obtained by converting voice data input by a user in a human-computer interaction process. The text data sample includes a first number of category labels, and the first number is not more than a second number corresponding to the category labels of the sample for training the target model. The target model is a model for recognizing user's intention.
[0061] The category label can be a label for user intent recognition of voice data input by a user in a human-computer interaction process. For example, the category label can be whether to perform a transfer, whether to perform a payment, whether to perform a face payment, or the like. The category label can be set according to actual conditions, and embodiments of the present specification do not limit the category label.
[0062] In implementation, in a human-computer interaction scenario, a dialogue robot interacts with a user. At this time, voice data input by the user in a dialogue process with the dialogue robot can be collected. In addition, based on attributes of a target model and related information of a human-computer interaction scenario corresponding to the target model, a plurality of different category labels (i.e., a second number of category labels) can be set. The second number of category labels can be all possible category labels of a sample. The second number of category labels can be selected according to actual conditions. The voice data can be converted into text data. The text data can be used as a sample, i.e., a text data sample is obtained. At this time, the second number of category labels can be labeled for the text data sample. Then, the second number of category labels labeled for the text data sample can be obtained after or instead of the text data sample. The second number of category labels can be set according to actual conditions, and embodiments of the present specification do not limit the second number of category labels.
[0063] In step S504, the text data sample is input into the target model. A probability that the text data sample belongs to each category label of the second number of category labels is obtained through a forward propagation algorithm. Based on the probability that the text data sample belongs to each category label of the second number of category labels and the first number of category labels included in the text data sample, loss information corresponding to the text data sample is determined through a preset loss function corresponding to the target model.
[0064] In implementation, a certain amount of text data samples can be acquired to train the target model to obtain a preliminarily trained target model, or the corresponding algorithm can be directly used to construct the target model, and the target model constructed can be initialized in a manner to obtain the target model. Then, the text data sample acquired above can be input into the target model, and through the forward propagation algorithm, the text data sample is input from the input layer of the target model, passes through the hidden layer (including, for example, convolution layer, pooling layer, full connection layer, etc.), and finally the processing result can be transmitted to the output layer. Through the output layer, the final output result can be obtained, which is the probability that the text data sample belongs to each class label in the second number of class labels. In this way, the probability that the class label of the text data sample is each class label in the second number of class labels can be calculated by the target model. Then, the probability that the text data sample belongs to each class label in the second number of class labels and the first number of class labels contained in the text data sample can be input into the preset loss function corresponding to the target model, and the corresponding loss information can be calculated to obtain the loss information corresponding to the text data sample.
[0065] In step S506, based on the loss information corresponding to the text data sample, the first number of class labels contained in the text data sample are pruned to obtain a text data sample containing remaining class labels.
[0066] In implementation, after obtaining the loss information corresponding to the text data sample in the above manner, the actual situation can be considered, and if the loss information corresponding to a certain class label is large, it indicates that the possibility of the class label belonging to the noisy class label is large. At this time, a corresponding threshold value can be set in advance, and if the loss information corresponding to a certain class label is higher than the threshold value, it indicates that the possibility of the class label belonging to the noisy class label is large. At this time, the class label with loss information higher than the threshold value can be pruned, and only the class label with loss information lower than the threshold value is left, that is, a text data sample containing remaining class labels is obtained.
[0067] In step S508, through the back propagation algorithm, the target model is trained based on the text data sample containing the remaining class labels to obtain a trained target model.
[0068] In implementation, after obtaining the text data sample containing the remaining class labels by the above manner, the gradient of the preset target function with respect to each model parameter can be quickly calculated by a back-propagation algorithm, and finally, the local minimum of the preset loss function can be calculated based on the gradient value obtained above using, for example, a Stochastic Gradient Descent (SGD) algorithm, so as to obtain the corresponding weight, and update the model parameter based on the weight to train the target model, and finally obtain the trained target model.
[0069] The embodiment of the present specification provides a model training method. By obtaining a text data sample for training a target model (the text data sample is a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample includes a first number of class labels, and the first number does not exceed a second number of class labels corresponding to the sample for training the target model, and the target model is a model for identifying user intent), the text data sample can be input into the target model, the probability of the text data sample belonging to each class label of the second number of class labels is obtained by a forward propagation algorithm, and based on the probability of the text data sample belonging to each class label of the second number of class labels and the first number of class labels contained in the text data sample, the loss information corresponding to the text data sample is determined by a preset loss function corresponding to the target model, the first number of class labels contained in the text data sample is processed by clipping based on the loss information corresponding to the text data sample, and a text data sample containing remaining class labels is obtained. Finally, the target model can be trained based on the text data sample containing the remaining class labels by a back-propagation algorithm to obtain a trained target model. In this way, for the text data sample with noisy labels, a loss function that can process the text data sample with noisy labels at the label level is proposed, and is particularly suitable for identifying user intent in a human-computer interaction process with multiple labels and a large number of label categories. The robustness of the target model to the text data sample with noisy labels can be greatly improved. In addition, the text data sample is processed at the label level by the above manner, which prevents difficult samples from being discarded and can well handle the problem of multiple class labels.
[0070] Embodiment Four
[0071] As Figure 6As shown, the embodiments of the present specification provide a model training method, the execution subject of the method can be a terminal device or a server, wherein the terminal device can be a mobile terminal device such as a mobile phone, a tablet computer, etc., or a device such as a personal computer, the server can be an independent server, or a server cluster composed of multiple servers, or a server of the above dialogue robot, etc. The method can specifically include the following steps:
[0072] In step S602, a text data sample for training a target model is obtained, the text data sample is a data sample obtained by converting voice data input by a user in a human-computer interaction process, and the text data sample includes a first number of category labels, the first number is not more than a second number corresponding to the category labels of the sample for training the target model, and the target model is a model for identifying user intent.
[0073] In step S604, the target model is trained based on a preset model training rule, and in the process of training the model, the text data sample is input into the target model, and the probability of the text data sample belonging to each category label in the second number of category labels is obtained by a forward propagation algorithm, and the model training rule includes one or more of a co-teachig-based model training rule, a co-teaching+ based model training rule, and a cleanlab-based model training rule.
[0074] The specific processing process of step S604 can be referred to the related content in the foregoing embodiments, which will not be repeated here.
[0075] In step S606, based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined by a preset loss function corresponding to the target model.
[0076] The preset loss function corresponding to the target model can be a binary cross-entropy loss function BCELoss, a mean square error loss function MSELoss, or a Focal Loss loss function, etc.
[0077] The specific processing process of step S606 can be referred to the related content in the foregoing embodiments, which will not be repeated here.
[0078] In step S608, based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample are sorted to obtain the first number of category labels arranged in descending order of loss information.
[0079] In step S610, based on the preset category label pruning rule, the first number of category labels arranged in descending order of loss information are pruned to obtain a text data sample containing remaining category labels.
[0080] In actual application, the specific processing mode of step S610 can be various, and the following provides an optional processing mode, which can specifically include the following contents: removing positive labels with loss information greater than a preset first loss threshold from the first number of category labels arranged in descending order of loss information, and removing negative labels with loss information greater than a preset second loss threshold from the first number of category labels arranged in descending order of loss information, to obtain a text data sample containing remaining category labels.
[0081] The positive label can be a category label used to label the text data sample as a positive sample, and the negative label can be a category label used to label the text data sample as a negative sample. For example, the positive label can be used to label that the text data sample contains the user's face payment intention, and the negative label can be used to label that the text data sample does not contain the user's face payment intention, etc. The specific setting can also be based on actual conditions, and the embodiments of the present specification are not limited thereto.
[0082] In actual application, if the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, and the category labels are presented as 0 or 1, the specific processing mode of removing positive labels with loss information greater than a preset first loss threshold from the first number of category labels arranged in descending order of loss information, and removing negative labels with loss information greater than a preset second loss threshold from the first number of category labels arranged in descending order of loss information, to obtain a text data sample containing remaining category labels can be various, and the following provides an optional processing mode, which can specifically include the following steps B2 and step B4 processing.
[0083] In step B2, from the first number of category labels arranged in descending order of loss information, the category labels presented as 1 arranged in descending order of loss information and the category labels presented as 0 arranged in descending order of loss information are obtained.
[0084] In step B4, the category labels with loss information greater than the preset first loss threshold are removed from the obtained category labels presented as 1 arranged in descending order of loss information, and the category labels with loss information greater than the preset second loss threshold are removed from the obtained category labels presented as 0 arranged in descending order of loss information, to obtain a text data sample containing remaining category labels.
[0085] In implementation, the largest k1 loss information corresponding category labels can be removed from the obtained loss information arranged in descending order of the category labels presented by 1 (i.e., the category labels with loss information greater than the preset first loss threshold are removed from the obtained loss information arranged in descending order of the category labels presented by 1), and the largest k2 loss information corresponding category labels can be removed from the obtained loss information arranged in descending order of the category labels presented by 0 (i.e., the category labels with loss information greater than the preset second loss threshold are removed from the obtained loss information arranged in descending order of the category labels presented by 0), where k1 and k2 are hyperparameters, respectively representing the number of positive labels and negative labels tolerating noisy labels in the text data sample, which can be set according to specific circumstances. For example, when the category labels of the text data sample are more, the situation of missing to label a certain category label often occurs, but the already labeled category labels are usually more accurate, at this time, k1 can be set to 0, indicating that only negative labels with noisy labels are tolerated.
[0086] In step S612, the target model is trained based on the text data sample containing the remaining category labels by using a back propagation algorithm, and a trained target model is obtained.
[0087] The embodiment of the present specification provides a model training method. By obtaining a text data sample for training a target model (the text data sample is a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample includes a first number of category labels, and the first number does not exceed a second number of category labels corresponding to a sample for training the target model, and the target model is a model for identifying user intent), the text data sample can be input into the target model. The probability of the text data sample belonging to each category label in the second number of category labels is obtained by a forward propagation algorithm, and based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined by a preset loss function corresponding to the target model. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample is pruned to obtain a text data sample containing remaining category labels. Finally, the target model can be trained based on the text data sample containing the remaining category labels by a back propagation algorithm to obtain a trained target model. In this way, for the text data sample with noisy labels, a loss function that can process the text data sample with noisy labels at the label level is proposed, and it is particularly suitable for identifying user intent in a human-computer interaction process with multiple labels and a large number of label categories. It can greatly improve the robustness of the target model to the text data sample with noisy labels. In addition, the above method processes the text data sample at the label level, prevents difficult samples from being discarded, and can well handle the problem of multiple category labels.
[0088] Embodiment five
[0089] The above is the model training method provided by the embodiment of the present specification. Based on the same idea, the embodiment of the present specification also provides a model training device, as shown in Figure 7 .
[0090] The model training device includes a sample acquisition module 701, a loss determination module 702, a label pruning module 703, and a model training module 704, wherein:
[0091] The sample acquisition module 701 acquires a first sample for training a target model. The first sample includes a first number of category labels, and the first number does not exceed a second number of category labels corresponding to a sample for training the target model.
[0092] The loss determination module 702 inputs the first sample into the target model, obtains a probability that the first sample belongs to each of the second number of class labels through a forward propagation algorithm, and determines loss information corresponding to the first sample through a preset loss function corresponding to the target model based on the probability that the first sample belongs to each of the second number of class labels and the first number of class labels contained in the first sample.
[0093] The label pruning module 703 performs pruning processing on the first number of class labels contained in the first sample based on the loss information corresponding to the first sample, to obtain a first sample containing remaining class labels.
[0094] The model training module 704 performs model training on the target model based on the first sample containing the remaining class labels through a back propagation algorithm, to obtain a trained target model.
[0095] In an embodiment of the present specification, the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, a mean square error loss function MSELoss, or a Focal Loss loss function.
[0096] In an embodiment of the present specification, the label pruning module 703 comprises:
[0097] The sorting unit sorts the first number of class labels contained in the first sample based on the loss information corresponding to the first sample, to obtain the first number of class labels arranged in descending order of loss information.
[0098] The label pruning unit performs pruning processing on the first number of class labels arranged in descending order of loss information based on a preset class label pruning rule, to obtain the first sample containing the remaining class labels.
[0099] In an embodiment of the present specification, the label pruning unit removes positive labels with loss information greater than a preset first loss threshold from the first number of class labels arranged in descending order of loss information, and removes negative labels with loss information greater than a preset second loss threshold from the first number of class labels arranged in descending order of loss information, to obtain the first sample containing the remaining class labels.
[0100] In an embodiment of the present specification, the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, and the class label is presented as 0 or 1.
[0101] The label pruning unit obtains, from the first quantity of class labels arranged in descending order of loss information, a class label presented as 1 arranged in descending order of loss information and a class label presented as 0 arranged in descending order of loss information; removes, from the obtained class label presented as 1 arranged in descending order of loss information, a class label with loss information greater than a preset first loss threshold, and removes, from the obtained class label presented as 0 arranged in descending order of loss information, a class label with loss information greater than a preset second loss threshold, to obtain a first sample containing remaining class labels.
[0102] In an embodiment of the present specification, the loss determination module 702 performs model training on the target model based on a preset model training rule, and inputs the first sample into the target model in the process of performing model training, to obtain, by a forward propagation algorithm, a probability that the first sample belongs to each class label in the second quantity of class labels.
[0103] The model training rule includes one or more of a co-teachig-based model training rule, a co-teaching+-based model training rule, and a cleanlab-based model training rule.
[0104] In an embodiment of the present specification, the similarity between the second quantity of class labels is greater than a preset similarity threshold.
[0105] In an embodiment of the present specification, the training device of the model includes:
[0106] A sample acquisition module acquires a text data sample for training a target model, the text data sample being a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample including a first quantity of class labels, the first quantity not exceeding a second quantity corresponding to class labels of samples for training the target model, and the target model being a model for recognizing user intent.
[0107] A loss determination module inputs the text data sample into the target model, obtains, by a forward propagation algorithm, a probability that the text data sample belongs to each class label in the second quantity of class labels, and determines, based on the probability that the text data sample belongs to each class label in the second quantity of class labels and the first quantity of class labels included in the text data sample, loss information corresponding to the text data sample by a preset loss function corresponding to the target model.
[0108] The label trimming module, based on the loss information corresponding to the text data sample, trims a first number of category labels contained in the text data sample to obtain a text data sample containing the remaining category labels;
[0109] The model training module trains the target model using backpropagation algorithm based on text data samples containing the remaining category labels, thus obtaining the trained target model.
[0110] This specification provides a model training apparatus. It acquires text data samples for training a target model (the text data samples are data samples obtained by converting user-input speech data during human-computer interaction; the text data samples include a first number of category labels, the first number not exceeding a second number corresponding to the category labels of the samples used to train the target model; the target model is a model for recognizing user intent). Then, the text data samples are input into the target model. A forward propagation algorithm is used to obtain the probability that the text data sample belongs to each of the second number of category labels. Based on the probability that the text data sample belongs to each of the second number of category labels and the first number of category labels contained in the text data sample, a preset loss function corresponding to the target model is used to determine the probability of the text data sample belonging to each of the second number of category labels. Based on the corresponding loss information of the text data sample, the first number of category labels contained in the text data sample are pruned to obtain a text data sample containing the remaining category labels. Finally, the target model is trained using the backpropagation algorithm based on the text data sample containing the remaining category labels to obtain the trained target model. Thus, for text data samples with noisy labels, a loss function that can process noisy text data samples at the label level is proposed. It is particularly applicable to the recognition of user intent in human-computer interaction with multiple labels and a large number of label categories. It can significantly improve the robustness of the target model to text data samples with noisy labels. In addition, by processing text data samples at the label level in the above way, difficult samples are prevented from being discarded, and the problem of multi-category labels can be handled well.
[0111] Example 6
[0112] The above describes the model training apparatus provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a model training device, such as... Figure 8 As shown.
[0113] The training device for the model can be a terminal device or server, as described in the above embodiments.
[0114] The training device of the model can have a large difference due to different configurations or performances, and can include one or more processors 801 and memories 802, and one or more storage applications or data can be stored in the memories 802. Among them, the memory 802 can be temporary storage or persistent storage. The application stored in the memory 802 can include one or more modules (not shown in the figure), and each module can include a series of computer executable instructions in the training device of the model. Further, the processor 801 can be configured to communicate with the memory 802 and execute a series of computer executable instructions in the memory 802 on the training device of the model. The training device of the model can also include one or more power supplies 803, one or more wired or wireless network interfaces 804, one or more input / output interfaces 805, and one or more keyboards 806.
[0115] In particular, in the present embodiment, the training device of the model includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs can include one or more modules, and each module can include a series of computer executable instructions in the training device of the model, and the one or more processors are configured to execute the one or more programs include the following computer executable instructions:
[0116] Obtain a first sample for training a target model, wherein the first sample includes a first number of class labels, and the first number is not more than a second number corresponding to the class labels of the sample for training the target model;
[0117] Input the first sample into the target model, obtain the probability that the first sample belongs to each class label in the second number of class labels through a forward propagation algorithm, and determine the loss information corresponding to the first sample through a preset loss function corresponding to the target model based on the probability that the first sample belongs to each class label in the second number of class labels and the first number of class labels included in the first sample;
[0118] Based on the loss information corresponding to the first sample, the first number of class labels included in the first sample is pruned to obtain a first sample including remaining class labels;
[0119] Through a back propagation algorithm, the target model is trained based on the first sample including the remaining class labels to obtain a trained target model.
[0120] In the embodiments of the present specification, the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, a mean square error loss function MSELoss, or a Focal Loss loss function.
[0121] In the embodiments of the present specification, the clipping processing of the first quantity of class labels contained in the first sample based on the loss information corresponding to the first sample to obtain the first sample containing the remaining class labels comprises:
[0122] The first quantity of class labels in the first sample are sorted based on the loss information corresponding to the first sample to obtain the first quantity of class labels in a descending order of loss information;
[0123] The first quantity of class labels in the descending order of loss information are clipped based on the preset class label clipping rule to obtain the first sample containing the remaining class labels.
[0124] In the embodiments of the present specification, the clipping processing of the first quantity of class labels in the descending order of loss information based on the preset class label clipping rule to obtain the first sample containing the remaining class labels comprises:
[0125] The positive label with loss information greater than a preset first loss threshold is removed from the first quantity of class labels in the descending order of loss information, and the negative label with loss information greater than a preset second loss threshold is removed from the first quantity of class labels in the descending order of loss information to obtain the first sample containing the remaining class labels.
[0126] In the embodiments of the present specification, the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, and the class label is presented as 0 or 1;
[0127] The removing of the positive label with loss information greater than a preset first loss threshold from the first quantity of class labels in the descending order of loss information, and the removing of the negative label with loss information greater than a preset second loss threshold from the first quantity of class labels in the descending order of loss information to obtain the first sample containing the remaining class labels comprises:
[0128] From the first quantity of class labels in the descending order of loss information, the class label presented as 1 in the descending order of loss information and the class label presented as 0 in the descending order of loss information are obtained;
[0129] The category label with loss information greater than a preset first loss threshold is removed from the category label presented as 1 in the obtained loss information arranged in descending order, the category label with loss information greater than a preset second loss threshold is removed from the category label presented as 0 in the obtained loss information arranged in descending order, and a first sample containing the remaining category labels is obtained.
[0130] In the embodiments of the present specification, the first sample is input into the target model to obtain, by a forward propagation algorithm, a probability that the first sample belongs to each of the second number of category labels, including:
[0131] The target model is trained based on a preset model training rule, and in the process of training the model, the first sample is input into the target model to obtain, by a forward propagation algorithm, a probability that the first sample belongs to each of the second number of category labels.
[0132] The model training rule includes one or more of a co-teachig-based model training rule, a co-teaching+-based model training rule, and a cleanlab-based model training rule.
[0133] In the embodiments of the present specification, the similarity between the second number of category labels is greater than a preset similarity threshold.
[0134] In addition, in particular in this embodiment, the training device of the model includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs can include one or more modules, and each module can include a series of computer executable instructions in the training device of the model, and the one or more programs configured to be executed by the one or more processors include computer executable instructions for:
[0135] Obtain a text data sample for training a target model, the text data sample being a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample including a first number of category labels, the first number not exceeding a second number corresponding to the category labels of the sample for training the target model, and the target model being a model for recognizing user intent;
[0136] inputting the text data sample into the target model, obtaining a probability that the text data sample belongs to each of the second number of class labels through a forward propagation algorithm, and determining loss information corresponding to the text data sample based on the probability that the text data sample belongs to each of the second number of class labels and the first number of class labels contained in the text data sample through a preset loss function corresponding to the target model;
[0137] performing pruning processing on the first number of class labels contained in the text data sample based on the loss information corresponding to the text data sample, to obtain a text data sample containing remaining class labels;
[0138] performing model training on the target model based on the text data sample containing the remaining class labels through a back propagation algorithm, to obtain a trained target model.
[0139] The embodiments of the present specification provide a model training device. By obtaining a text data sample used for training a target model (the text data sample is a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample includes a first number of class labels, and the first number does not exceed a second number of class labels corresponding to samples used for training the target model, and the target model is a model used for identifying a user intent), the text data sample can be input into the target model, a probability that the text data sample belongs to each of the second number of class labels can be obtained through a forward propagation algorithm, and loss information corresponding to the text data sample can be determined based on the probability that the text data sample belongs to each of the second number of class labels and the first number of class labels contained in the text data sample through a preset loss function corresponding to the target model. The first number of class labels contained in the text data sample can be pruned based on the loss information corresponding to the text data sample, to obtain a text data sample containing remaining class labels. Finally, the target model can be trained based on the text data sample containing the remaining class labels through a back propagation algorithm, to obtain a trained target model. Thus, for a text data sample with noisy labels, a loss function that can process the text data sample with noisy labels at the label level is proposed, and is particularly suitable for identifying a user intent in a human-computer interaction process with multiple labels and a large number of label categories. The robustness of the target model to the text data sample with noisy labels can be greatly improved. In addition, the text data sample is processed at the label level through the above manner, difficult samples are prevented from being discarded, and the problem of multiple class labels can be well handled.
[0140] Embodiment Seven
[0141] Further, based on the above Figures 1 to 6The method shown, one or more embodiments of the specification also provides a storage medium for storing computer executable instruction information, in a specific embodiment, the storage medium can be a U disk, a CD, a hard disk, etc., the computer executable instruction information stored in the storage medium can realize the following process when executed by the processor:
[0142] Obtain a first sample for training a target model, the first sample includes a first number of class labels, the first number does not exceed a second number corresponding to the class labels of the sample for training the target model;
[0143] Input the first sample into the target model, obtain the probability of the first sample belonging to each class label in the second number of class labels through the forward propagation algorithm, and based on the probability of the first sample belonging to each class label in the second number of class labels and the first number of class labels contained in the first sample, determine the loss information corresponding to the first sample through the preset loss function corresponding to the target model;
[0144] Based on the loss information corresponding to the first sample, the first number of class labels contained in the first sample is pruned to obtain a first sample containing remaining class labels;
[0145] Through the back propagation algorithm, the target model is trained based on the first sample containing the remaining class labels to obtain the trained target model.
[0146] In an embodiment of the specification, the preset loss function corresponding to the target model is a binary cross entropy loss function BCELoss, a mean square error loss function MSELoss or a Focal Loss loss function.
[0147] In an embodiment of the specification, based on the loss information corresponding to the first sample, the first number of class labels contained in the first sample is pruned to obtain a first sample containing remaining class labels, including:
[0148] Based on the loss information corresponding to the first sample, the first number of class labels contained in the first sample is sorted to obtain a first number of class labels arranged in descending order of loss information;
[0149] Based on the preset class label pruning rule, the first number of class labels arranged in descending order of loss information is pruned to obtain a first sample containing remaining class labels.
[0150] In the embodiments of the present specification, the first number of class labels arranged in descending order of loss information are pruned based on a preset class label pruning rule to obtain a first sample containing remaining class labels, including:
[0151] The positive label with loss information greater than a preset first loss threshold is removed from the first number of class labels arranged in descending order of loss information, and the negative label with loss information greater than a preset second loss threshold is removed from the first number of class labels arranged in descending order of loss information, to obtain a first sample containing remaining class labels.
[0152] In the embodiments of the present specification, the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, and the class label is presented as 0 or 1;
[0153] The positive label with loss information greater than a preset first loss threshold is removed from the first number of class labels arranged in descending order of loss information, and the negative label with loss information greater than a preset second loss threshold is removed from the first number of class labels arranged in descending order of loss information, to obtain a first sample containing remaining class labels, including:
[0154] From the first number of class labels arranged in descending order of loss information, the class label presented as 1 arranged in descending order of loss information and the class label presented as 0 arranged in descending order of loss information are obtained;
[0155] The class label with loss information greater than a preset first loss threshold is removed from the obtained class label presented as 1 arranged in descending order of loss information, and the class label with loss information greater than a preset second loss threshold is removed from the obtained class label presented as 0 arranged in descending order of loss information, to obtain a first sample containing remaining class labels.
[0156] In the embodiments of the present specification, the first sample is input into the target model to obtain the probability that the first sample belongs to each class label in the second number of class labels by a forward propagation algorithm, including:
[0157] The target model is trained based on a preset model training rule, and in the process of model training, the first sample is input into the target model to obtain the probability that the first sample belongs to each class label in the second number of class labels by a forward propagation algorithm;
[0158] The model training rules include one or more of a co-teachig-based model training rule, a co-teaching+ based model training rule, and a cleanlab-based model training rule.
[0159] In an embodiment of the present specification, the similarity between the second number of category labels is greater than a preset similarity threshold.
[0160] In addition, in another specific embodiment, the storage medium can be a U disk, an optical disk, a hard disk, etc., and the computer executable instruction information stored in the storage medium can realize the following flow when executed by the processor:
[0161] Obtain a text data sample for training a target model, the text data sample being a data sample obtained by converting voice data input by a user in a human-computer interaction process, the text data sample including a first number of category labels, the first number not exceeding a second number of category labels corresponding to samples for training the target model, the target model being a model for recognizing user intent;
[0162] Input the text data sample into the target model, obtain a probability that the text data sample belongs to each category label in the second number of category labels through a forward propagation algorithm, and determine loss information corresponding to the text data sample through a preset loss function corresponding to the target model based on the probability that the text data sample belongs to each category label in the second number of category labels and the first number of category labels included in the text data sample;
[0163] Based on the loss information corresponding to the text data sample, perform pruning processing on the first number of category labels included in the text data sample to obtain a text data sample including remaining category labels;
[0164] Perform model training on the target model based on the text data sample including the remaining category labels through a back propagation algorithm to obtain a trained target model.
[0165] The embodiment of the specification provides a storage medium, by acquiring a text data sample for training a target model (the text data sample is obtained by converting voice data input by a user in a human-computer interaction process, the text data sample includes a first number of category labels, and the first number does not exceed a second number corresponding to the category labels of the sample for training the target model, and the target model is a model for identifying user intent), then the text data sample can be input into the target model, the probability of the text data sample belonging to each category label in the second number of category labels is obtained through a forward propagation algorithm, and based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined through a preset loss function corresponding to the target model, the first number of category labels contained in the text data sample is pruned based on the loss information corresponding to the text data sample, and a text data sample containing remaining category labels is obtained. Finally, the target model can be trained based on the text data sample containing the remaining category labels through a back propagation algorithm to obtain a trained target model. In this way, for the text data sample with noisy labels, a loss function that can process the text data sample with noisy labels at the label level is proposed, and is particularly suitable for identifying user intent in a human-computer interaction process with multiple labels and a large number of label categories. The robustness of the target model to the text data sample with noisy labels can be greatly improved. In addition, the above method deeply processes the text data sample at the label level, prevents difficult samples from being discarded, and can well handle the problem of multiple category labels.
[0166] The above describes specific embodiments of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or possible.
[0167] In the 1990s, it was relatively easy to distinguish whether an improvement in a technology was a hardware improvement (e.g., an improvement in the circuit structure of a diode, transistor, switch, etc.) or a software improvement (an improvement in a method flow). However, as technology has evolved, many improvements in method flows today can be considered as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structures by programming the improved method flows into hardware circuits. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using hardware entity modules. For example, a programmable logic device (PLD) (e.g., a field programmable gate array (FPGA)) is an integrated circuit whose logic function is determined by user programming of the device. A digital system is "integrated" on a PLD by the designer programming the PLD, rather than by ordering a chip manufacturer to design and fabricate a custom integrated circuit chip. Moreover, instead of manually fabricating integrated circuit chips, this programming is now mostly implemented using "logic compiler" software, which is similar to software compilers used in program development, and the original code to be compiled is written in a specific programming language, which is called a hardware description language (HDL), and there are many such languages, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., and the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should be aware that, as long as the method flow is logically programmed in the above-mentioned hardware description languages and programmed into an integrated circuit, a hardware circuit implementing the logical method flow can be easily obtained.
[0168] The controller can be implemented in any suitable way, e.g. the controller can take the form of a microprocessor or processor and a computer readable medium storing computer readable program code, e.g. software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91 SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to being implemented in pure computer readable program code form, the controller can perfectly well be implemented by means of logic programmed into logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers, etc. to perform the same functions. The controller can thus be considered as a hardware component, and the means comprised therein for performing various functions can be considered as structures within the hardware component. Alternatively, or even, the means for performing various functions can be considered as both a software module implementing a method and a structure within a hardware component.
[0169] The systems, apparatuses, modules or units illustrated by the above embodiments can be implemented by computer chips or entities, or products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0170] For the sake of description, the above apparatuses are described in various units with functions respectively. Of course, the functions of each unit can be implemented in the same or multiple software and / or hardware when implementing one or more embodiments of the present specification.
[0171] Those skilled in the art will understand that the embodiments of the present specification can be provided as a method, a system or a computer program product. Therefore, one or more embodiments of the present specification can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of the present specification can take 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.
[0172] The embodiments of the present specification are described with reference to flowcharts and / or block diagrams of the method, device (system) and computer program product according to the embodiments of the present specification. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of 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 electronic devices to produce a machine, so that the instructions executed by the computer or other programmable electronic devices generate a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions of one or more flows and / or blocks Figure 1 The functions of one or more flows and / or blocks
[0173] These computer program instructions can also be stored in a computer readable storage medium that can direct the computer or other programmable electronic devices to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product including instruction devices that implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions of one or more flows and / or blocks Figure 1 The functions of one or more flows and / or blocks
[0174] These computer program instructions can also be loaded into a computer or other programmable electronic devices, so that a series of operation steps are performed on the computer or other programmable electronic devices to produce a computer implemented process, so that the instructions executed on the computer or other programmable electronic devices provide steps for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions of one or more flows and / or blocks Figure 1 The functions of one or more flows and / or blocks
[0175] In a typical configuration, the computing device includes one or more processors (CPU), input / output interface, network interface and memory.
[0176] The memory can include non-persistent memory in the computer readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of the computer readable medium.
[0177] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0178] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0179] Those skilled in the art will appreciate that embodiments of the present specification can be provided as methods, systems or computer program products. Therefore, one or more embodiments of the present specification can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of the present specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0180] One or more embodiments of the present specification can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the present specification can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media, including storage devices.
[0181] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0182] The above only describes the embodiments of the specification and is not used to limit the application. The specification can have various changes and modifications for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the specification shall be included in the scope of claims of the specification.
Claims
1. A method for training a model, the method comprising: Obtain text data samples for training a target model. The text data samples are data samples obtained by converting user-inputted speech data during human-computer interaction. The text data samples include a first number of category labels, which does not exceed a second number corresponding to the category labels of the samples used to train the target model. The target model is a model for recognizing user intent. The text data sample is input into the target model. The probability of the text data sample belonging to each category label in the second number of category labels is obtained through the forward propagation algorithm. Based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined through the preset loss function corresponding to the target model. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample are pruned to obtain a text data sample containing the remaining category labels; The target model is trained using the backpropagation algorithm based on text data samples containing the remaining category labels, resulting in the trained target model.
2. The method according to claim 1, wherein the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, a mean squared error loss function MSELLoss, or a FocalLoss loss function.
3. The method according to claim 1 or 2, wherein the step of cropping the first number of category labels contained in the text data sample based on the loss information corresponding to the text data sample to obtain a text data sample containing the remaining category labels includes: Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample are sorted to obtain the first number of category labels arranged in descending order of loss information; Based on the preset category label pruning rules, the first number of category labels arranged in descending order of loss information are pruned to obtain a text data sample containing the remaining category labels.
4. The method according to claim 3, wherein the step of cropping a first number of category labels arranged in descending order of loss information based on a preset category label cropping rule to obtain a text data sample containing the remaining category labels includes: Remove positive labels whose loss information is greater than a preset first loss threshold from a first number of category labels arranged in descending order of loss information, and remove negative labels whose loss information is greater than a preset second loss threshold from a first number of category labels arranged in descending order of loss information, to obtain a text data sample containing the remaining category labels.
5. The method according to claim 4, wherein the preset loss function corresponding to the target model is a binary cross-entropy loss function BCELoss, the category labels are presented as 0 or 1, and the step of removing positive labels with loss information greater than a preset first loss threshold from a first number of category labels arranged in descending order of loss information, and removing negative labels with loss information greater than a preset second loss threshold from a first number of category labels arranged in descending order of loss information, to obtain a text data sample containing the remaining category labels, includes: From the first number of category labels arranged in descending order of loss information, obtain the category labels represented by 1 and the category labels represented by 0, arranged in descending order of loss information. Remove category labels whose loss information is greater than a preset first loss threshold from the category labels presented as 1, which are arranged in descending order of the acquired loss information; remove category labels whose loss information is greater than a preset second loss threshold from the category labels presented as 0, which are arranged in descending order of the acquired loss information, to obtain a text data sample containing the remaining category labels.
6. The method according to claim 1, wherein inputting the text data sample into the target model and obtaining the probability that the text data sample belongs to each category label in the second number of category labels through a forward propagation algorithm includes: The target model is trained based on preset model training rules. During the model training process, the text data samples are input into the target model, and the probability of the text data samples belonging to each category label in the second number of category labels is obtained through the forward propagation algorithm. The model training rules include one or more of the following: model training rules based on co-teachingig, model training rules based on co-teaching+, and model training rules based on cleanlab.
7. The method according to claim 1, wherein the similarity between the second number of category labels is greater than a preset similarity threshold.
8. A training apparatus for a model, the apparatus comprising: The sample acquisition module acquires text data samples for training the target model. The text data samples are data samples obtained by converting user-inputted voice data during human-computer interaction. The text data samples include a first number of category labels, which does not exceed a second number corresponding to the category labels of the samples used to train the target model. The target model is a model for recognizing user intent. The loss determination module inputs the text data sample into the target model, obtains the probability of the text data sample belonging to each category label in the second number of category labels through the forward propagation algorithm, and determines the loss information corresponding to the text data sample based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample through the preset loss function corresponding to the target model. The label trimming module, based on the loss information corresponding to the text data sample, trims a first number of category labels contained in the text data sample to obtain a text data sample containing the remaining category labels; The model training module trains the target model using backpropagation algorithm based on text data samples containing the remaining category labels, thus obtaining the trained target model.
9. A training device for a model, the training device for the model comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to: Obtain text data samples for training a target model. The text data samples are data samples obtained by converting user-inputted speech data during human-computer interaction. The text data samples include a first number of category labels, which does not exceed a second number corresponding to the category labels of the samples used to train the target model. The target model is a model for recognizing user intent. The text data sample is input into the target model. The probability of the text data sample belonging to each category label in the second number of category labels is obtained through the forward propagation algorithm. Based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined through the preset loss function corresponding to the target model. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample are pruned to obtain a text data sample containing the remaining category labels; The target model is trained using the backpropagation algorithm based on text data samples containing the remaining category labels, resulting in the trained target model.
10. A storage medium for storing computer-executable instructions, which, when executed by a processor, perform the following process: Obtain text data samples for training a target model. The text data samples are data samples obtained by converting user-inputted speech data during human-computer interaction. The text data samples include a first number of category labels, which does not exceed a second number corresponding to the category labels of the samples used to train the target model. The target model is a model for recognizing user intent. The text data sample is input into the target model. The probability of the text data sample belonging to each category label in the second number of category labels is obtained through the forward propagation algorithm. Based on the probability of the text data sample belonging to each category label in the second number of category labels and the first number of category labels contained in the text data sample, the loss information corresponding to the text data sample is determined through the preset loss function corresponding to the target model. Based on the loss information corresponding to the text data sample, the first number of category labels contained in the text data sample are pruned to obtain a text data sample containing the remaining category labels; The target model is trained using the backpropagation algorithm based on text data samples containing the remaining category labels, resulting in the trained target model.
Citation Information
Patent Citations
Data processing method, electronic equipment and computer readable storage medium
CN113469202A
ICD code prediction method and system based on joint learning and denoising mechanism
CN114023412A