CN-116226375-B - Training method and device for classification model suitable for text auditing
Abstract
The disclosure provides a training method and a training device for a classification model suitable for text auditing, relates to the technical field of artificial intelligence, and particularly relates to the technical field of deep learning and computers. The method comprises the steps of carrying out different types of predictions on text samples in an ith round of text sample set based on a pre-training language model to obtain enhanced text samples with different prediction types, obtaining labels and confidence of the enhanced text samples based on a first classification model after a jth round of training, screening the enhanced text samples according to the prediction types of the enhanced text samples and the labels and confidence of the enhanced text samples, updating the ith round of text sample set according to the screened enhanced text samples to obtain an (i+1) th round of text sample set, and training the first classification model to obtain a second classification model after the jth+1 round of training. The method and the device can avoid noise introduced during model training, fully mine generalization capability of the classification model, and are beneficial to improving accuracy of the classification model.
Inventors
- Wang Zanbo
- CAO YUHUI
- HUANG SHUO
- CHEN YONGFENG
Assignees
- 北京百度网讯科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20230106
Claims (15)
- 1. A method of training a classification model suitable for text review, comprising: Aiming at any text auditing type in a plurality of text auditing types, acquiring an ith round of text sample set and a jth round of trained first classification model corresponding to the text auditing type, wherein i and j are positive integers; performing different types of predictions on text samples in the ith round of text sample set based on a pre-training language model to obtain enhanced text samples of different prediction types, wherein the prediction types comprise mask prediction and renewal prediction; Acquiring labels and confidence of the enhanced text samples based on the first classification model; Screening the enhanced text samples according to the prediction types of the enhanced text samples, the labels and the confidence degrees of the enhanced text samples, and updating the ith round of text sample set according to the screened enhanced text samples to obtain an (i+1) th round of text sample set, wherein different prediction types correspond to different screening strategies; Training the first classification model according to the (i+1) -th round of text sample set, obtaining a j+1-th round of trained second classification model, and continuously obtaining the next round of text sample set to train the second classification model until training is finished to generate a target classification model; The predicting text samples in the ith round of text sample set based on the pre-training language model to obtain enhanced text samples with different prediction types comprises the following steps: Performing mask coverage on the text samples, and performing mask prediction on the text samples subjected to mask coverage based on the pre-training language model to generate enhanced text samples with the prediction type of mask prediction; and rewriting the text sample based on a preset prompt word, and performing continuous writing prediction on the rewritten text sample based on the pre-training language model to generate an enhanced text sample with a prediction type of continuous writing prediction.
- 2. The method of claim 1, wherein the masking the text samples and masking the masked text samples based on the pre-trained language model, generating enhanced text samples with a prediction type of masked prediction, comprises: performing mask coverage on the text sample according to a preset coverage proportion to generate a first text sample, wherein the first text sample comprises one or more masks; The first text sample is input into the pre-training language model, and the one or more masks in the first text sample are predicted based on the pre-training language model to generate an enhanced text sample with a prediction type of mask prediction.
- 3. The method of claim 1, wherein the text sample has a tag, the rewriting the text sample based on a preset hint word, and performing a renewal prediction on the rewritten text sample based on the pre-trained language model, generating an enhanced text sample with a prediction type of a renewal prediction, comprising: acquiring a second text sample, the label of which accords with the text auditing type, from the text sample; Rewriting the second text sample based on a preset prompting word to obtain a third text sample; splicing any two third text samples to obtain a fourth text sample; And renewing the fourth text sample based on the pre-training language model to generate an enhanced text sample with a prediction type being a renewed-writing prediction.
- 4. A method according to any one of claims 1-3, wherein the screening the enhanced text samples according to the prediction type of the enhanced text samples, the labels and the confidence of the enhanced text samples, and updating the ith round of text sample set according to the screened enhanced text samples to obtain the (i+1) th round of text sample set, includes: Responding to the prediction type of the enhanced text sample as mask prediction, screening the enhanced text sample based on the label and the confidence of the enhanced text sample, and generating a first enhanced text sample; responding to the prediction type of the enhanced text sample as a renewal prediction, screening the enhanced text sample based on the label of the enhanced text sample, and generating a second enhanced text sample; And adding the first enhanced text sample and the second enhanced text sample into the ith round of text sample set to obtain an (i+1) th round of text sample set.
- 5. A method as defined in claim 4, wherein the tag includes a tag that is compliant with the text review type and a tag that is not compliant with the text review type, the screening the enhanced text sample based on the tag and confidence of the enhanced text sample to generate a first enhanced text sample comprising: Obtaining a third enhanced text sample conforming to the text auditing type from M tags with highest confidence in the enhanced text sample, and a fourth enhanced text sample not conforming to the text auditing type from N tags with highest confidence in the enhanced text sample, wherein M, N is a positive integer; Determining the third enhanced text sample and the fourth enhanced text sample as the first enhanced text sample.
- 6. The method of claim 5, wherein the screening the enhanced text samples based on the labels of the enhanced text samples to generate a second enhanced text sample comprises: Merging the enhanced text samples to remove repeated enhanced text samples and obtain a fifth enhanced text sample; and determining the fifth enhanced text sample which is marked as conforming to the text audit type as the second enhanced text sample.
- 7. A training device for a classification model suitable for text review, comprising: The first acquisition module is used for acquiring an ith round of text sample set and a jth round of trained first classification model corresponding to a text auditing type aiming at any text auditing type in a plurality of text auditing types, wherein i and j are positive integers; The second obtaining module is used for carrying out different types of predictions on the text samples in the ith round of text sample set based on a pre-training language model so as to obtain enhanced text samples with different prediction types, wherein the prediction types comprise mask prediction and renewal prediction; a third obtaining module, configured to obtain a label and a confidence coefficient of the enhanced text sample based on the first classification model; The updating module is used for screening the enhanced text samples according to the prediction types of the enhanced text samples, the labels and the confidence degrees of the enhanced text samples, updating the ith round of text sample set according to the screened enhanced text samples to obtain an (i+1) th round of text sample set, wherein different prediction types correspond to different screening strategies; The training module is used for training the first classification model according to the (i+1) th round of text sample set, obtaining a second classification model after the (j+1) th round of training, and continuously obtaining the next round of text sample set to train the second classification model until training is finished to generate a target classification model; The second obtaining module is further configured to: Performing mask coverage on the text samples, and performing mask prediction on the text samples subjected to mask coverage based on the pre-training language model to generate enhanced text samples with the prediction type of mask prediction; and rewriting the text sample based on a preset prompt word, and performing continuous writing prediction on the rewritten text sample based on the pre-training language model to generate an enhanced text sample with a prediction type of continuous writing prediction.
- 8. The apparatus of claim 7, wherein the second acquisition module is further configured to: performing mask coverage on the text sample according to a preset coverage proportion to generate a first text sample, wherein the first text sample comprises one or more masks; The first text sample is input into the pre-trained language model, and the one or more masks in the first text sample are predicted based on the pre-trained language model to generate enhanced text samples.
- 9. The apparatus of claim 7, wherein the second acquisition module is further configured to: acquiring a second text sample, the label of which accords with the text auditing type, from the text sample; Rewriting the second text sample based on a preset prompting word to obtain a third text sample; splicing any two third text samples to obtain a fourth text sample; And renewing the fourth text sample based on the pre-trained language model to generate an enhanced text sample.
- 10. The apparatus of any of claims 7-9, wherein the update module is further to: Responding to the prediction type of the enhanced text sample as mask prediction, screening the enhanced text sample based on the label and the confidence of the enhanced text sample, and generating a first enhanced text sample; responding to the prediction type of the enhanced text sample as a renewal prediction, screening the enhanced text sample based on the label of the enhanced text sample, and generating a second enhanced text sample; And adding the first enhanced text sample and the second enhanced text sample into the ith round of text sample set to obtain an (i+1) th round of text sample set.
- 11. The apparatus of claim 10, wherein the tag includes a compliance with the text review type and a non-compliance with the text review type, the update module further to: Obtaining a third enhanced text sample conforming to the text auditing type from M tags with highest confidence in the enhanced text sample, and a fourth enhanced text sample not conforming to the text auditing type from N tags with highest confidence in the enhanced text sample, wherein M, N is a positive integer; Determining the third enhanced text sample and the fourth enhanced text sample as the first enhanced text sample.
- 12. The apparatus of claim 11, wherein the update module is further configured to: Merging the enhanced text samples to remove repeated enhanced text samples and obtain a fifth enhanced text sample; and determining the fifth enhanced text sample which is marked as conforming to the text audit type as the second enhanced text sample.
- 13. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
- 14. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the steps of the method according to any one of claims 1-6.
- 15. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-6.
Description
Training method and device for classification model suitable for text auditing Technical Field The present disclosure relates to the field of artificial intelligence, and in particular, to the field of deep learning and computer technology. Background In the related art, text auditing is an automated and intelligent system for judging whether a piece of text content complies with platform content specifications such as internet and media based on natural language processing technology. Common text review application scenarios include user signatures/nicknames, comments/messages, instant messaging text content, user posts, media information, merchandise information, video live video bullet screens, graphic information, and the like. The text auditing processing has various auditing types, massive user data is generated on the Internet every day, and heavy auditing tasks are required. The classification model can utilize a computer and natural language processing technology to realize automatic text content violation detection and recognition, and lead or assist manual auditing functions, thereby greatly reducing the working cost of related personnel. Therefore, how to improve the accuracy and generalization ability of classification models suitable for text review has become one of the important research directions. Disclosure of Invention The disclosure provides a training method and device for a classification model suitable for text auditing. According to an aspect of the present disclosure, there is provided a training method of a classification model suitable for text review, the method comprising: Aiming at any text auditing type in a plurality of text auditing types, acquiring an ith round of text sample set corresponding to the text auditing type and a jth round of trained first classification model, wherein i and j are positive integers; Based on a pre-training language model, carrying out different types of predictions on text samples in the ith round of text sample set so as to obtain enhanced text samples with different prediction types; Acquiring a label and a confidence coefficient of the enhanced text sample based on the first classification model; Screening the enhanced text samples according to the prediction type of the enhanced text samples, the labels and the confidence of the enhanced text samples, and updating the ith round of text sample set according to the screened enhanced text samples to obtain the (i+1) th round of text sample set; Training the first classification model according to the (i+1) th round of text sample set, obtaining a second classification model after the (j+1) th round of training, and continuously obtaining the next round of text sample set to train the second classification model until training is finished to generate a target classification model. According to the method and the device, noise can be prevented from being introduced during model training, the diversity of training data is improved, the boundary of model training is expanded, the generalization capability of the classification model is fully mined, and the accuracy of the classification model is improved. According to another aspect of the present disclosure, there is provided a training apparatus for a classification model suitable for text review, comprising: The first acquisition module is used for acquiring an ith round of text sample set corresponding to the text audit type and a jth round of trained first classification model aiming at any text audit type in a plurality of text audit types, wherein i and j are positive integers; The second acquisition module is used for carrying out different types of predictions on the text samples in the ith round of text sample set based on the pre-training language model so as to acquire enhanced text samples with different prediction types; the third acquisition module is used for acquiring the label and the confidence of the enhanced text sample based on the first classification model; The updating module is used for screening the enhanced text samples according to the prediction type of the enhanced text samples, the labels and the confidence of the enhanced text samples, and updating the ith round of text sample set according to the screened enhanced text samples to obtain the (i+1) th round of text sample set; The training module is used for training the first classification model according to the (i+1) th round of text sample set, obtaining a second classification model after the (j+1) th round of training, and continuing to obtain the next round of text sample set to train the second classification model until training is finished to generate a target classification model. According to another aspect of the present disclosure, there is provided an electronic device including at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to