Playback incremental learning method based on double sample screening
Through the dual screening method of K-means algorithm and sample valuation model, representative samples were selected and dirty data were eliminated, which solved the problem of model performance degradation in incremental learning, and achieved performance optimization and accurate prediction in the case of imbalance between old and new data.
Patent Information
- Application Number
- CN202510581302.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-08-19
AI Technical Summary
The existing incremental learning methods may degrade when processing text data with dirty data. How to effectively filter out representative playback samples and eliminate dirty data has become the key to improving the performance of incremental text classification models.
Using a dual screening method based on the K-means algorithm and sample valuation model, representative samples were initially screened through the K-means algorithm, and then quadratic screening was performed through the sample valuation model, and the model was trained in combination with multiple loss functions to optimize performance.
Under limited training costs, more representative samples are selected to improve the overall performance of the model, solve the weight offset problem caused by imbalance between old and new data, and ensure that the model improves the accuracy of future data prediction while performing old tasks.
Smart Images

Figure CN120509448A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of network services and relates to a playback incremental learning method based on double sample screening. Background Art
[0002] In the past, text classification was primarily performed through manual labeling, but manual classification was inefficient and inaccurate. The rise of language models has brought new breakthroughs to text classification. By introducing advanced text classification models, traditional manual classification can be transformed into intelligent classification, where trained machine learning models automatically complete text classification. This process not only improves efficiency, reduces manual errors, but also significantly reduces costs. However, with the continuous increase in the amount of text data, traditional text classification models have also faced new challenges, especially the growing number of categories and the gradual increase in sample size. This has led to a significant increase in model training cost and time, placing considerable pressure on the continuous optimization of intelligent classification.
[0003] To address this problem, incremental learning, as a dynamic learning method, offers a new approach. It adapts to new data by gradually updating existing models without requiring complete retraining. Incremental learning not only effectively handles the surge in text data volumes but also flexibly responds to evolving categorization needs, significantly reducing training costs and time while improving system adaptability.
[0004] However, there are still some pressing challenges in applying incremental learning. Text data often contains a certain amount of dirty data (i.e., noisy or mislabeled data), and existing incremental learning methods mostly assume that the data is clean and accurate. This can lead to performance degradation when processing text data with dirty data. Therefore, how to select representative playback samples and effectively remove dirty data is key to improving the performance of incremental text classification models. Summary of the Invention
[0005] The purpose of the present invention is to address the above-mentioned problems, screen playback samples from known text data, and train a model to predict future data. A playback incremental learning method based on dual sample screening is proposed, which introduces a sample valuation model and a K-means algorithm to screen playback samples. First, a more representative portion of samples is screened out using the K-means algorithm, and then a second screening is performed using the sample valuation model. Through the above strategy, it can be ensured that the samples used by the incremental learning model during the training process represent the characteristics of the overall data as much as possible, while avoiding the degradation of model performance due to interference from dirty data.
[0006] The use steps of the method of the present invention are:
[0007] Step 1: Use new data and retained samples to train the text classification model. The specific method is to extract text features through the initial text classification model Bert model, then obtain the logical probability value of the text through the fully connected layer, and use cross-entropy to calculate L CLS Update model parameters. L CLS The function is defined as:
[0008]
[0009] Among them, N is the total number of samples, C is the total number of categories, and y i,c is an element in the label matrix, and the pi model is the probability value of category c predicted by sample i.
[0010] Step 2: Extract features using the trained text classification model and use K-Means clustering to preliminarily screen samples. Specifically, use the text classification model trained in step 1 to extract text features from new data samples, then perform K-Means clustering on the features of samples in each class, and select the sample closest to the cluster center. After clustering, the number of clusters is twice the total memory M divided by the number of categories C. Finally, each category will be preliminarily screened. samples.
[0011] Step 3: Train the sample valuation model. The sample valuation model consists of several linear layers and a hyperbolic tangent (Tanh) activation function. The sample valuation model further filters the samples initially filtered in step 2 and uses this feedback to train the sample valuation model.
[0012] The specific method is as follows: First, the samples in step 2 are valued through the sample valuation model. Each sample has a corresponding sample valuation and outputs the selection vector s to filter out Sample valuation corresponds to the sample; then, use the new data sample described in step 1 to train a new Bert text classification model, and get the accuracy rate of acc1, and use the filtered Samples are trained separately for another new Bert text classification model model, and the accuracy is acc2. Acc1, acc2 and s vector are used to calculate the estimated model sample loss L value , update the sample valuation model.
[0013] Step 4: Second screening of playback samples. Use the trained sample estimation model to screen the playback samples for the second time and store them in memory M.
[0014] The specific method is to train the sample valuation model for the samples that have been initially screened, and obtain the corresponding sample valuations, and select the one with the highest value. Samples. Store the samples in memory M.
[0015] Step 5: Delete some samples of the retained sample category. The samples are mixed with the retained samples to obtain a new total number of categories C0; each old category is deleted from the memory M samples to ensure that the overall memory does not exceed the threshold |M|.
[0016] The specific method is as follows: when training the initial text classification model in step 1, take the mean of all text features of each class to obtain the prototype of each sample (a representative sample of the category); when deleting samples, delete the sample farthest from the prototype according to the text features. samples.
[0017] Step 6: Based on the mixed samples, use the samples in memory M to initialize the text classification model again to complete incremental learning.
[0018] The specific method is to calculate L CLS At the same time, first retain the current model and freeze the model parameters, calculate the distance between the features of the current model and the frozen model to calculate the loss L SIM , calculate the loss L by calculating the feature distance of samples of different categories in the sample MGN , and then calculate the loss L by calculating the logit given by the initial text classification model and the current model for the sample PKD .
[0019] Calculate the total loss L using the following formula: total It is the linear weighted sum of the above four losses.
[0020] L total =L CLS +λ1L SIM +λ2L MGN +λ3L PKD
[0021] Among them, λ1, λ2, and λ3 are weights and are constants.
[0022] By training the encoder with multiple losses, we can solve the weight offset problem caused by the imbalance of the number of new and old samples, and further optimize the encoder to better predict future data.
[0023] The beneficial effects of the present invention are as follows: through the method of the present invention, through the dual screening of K-Means and the sample valuation model, more representative samples are screened out, so that under the condition of limited training cost, a model with better performance can be trained to make predictions for future data. The specific method is to first obtain a part of more representative samples through the K-Means clustering algorithm. Secondly, through the sample valuation model screening, some dirty data is screened out to obtain samples that are more valuable to the model for subsequent incremental model training. Finally, a variety of distillation methods are used to further ensure the performance of the model in the old tasks, while also solving the weight offset problem caused by the imbalance of new and old data, thereby improving the overall performance and accurately predicting future data. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 Replay incremental learning method based on double sample screening;
[0025] Figure 2 Sample valuation screening methods and model optimization. DETAILED DESCRIPTION
[0026] The following is a detailed description of a playback incremental learning method based on double sample screening, with reference to the accompanying drawings. Figure 1 and Figure 2 As shown, the following steps are included:
[0027] Step 1: Use new data and retained samples to train the text classification model. The specific method is to extract text features through the initial text classification model Bert, then obtain the logical probability value of the text through the fully connected layer, and use cross-entropy to calculate L CLS Update model parameters. L CLS The function is defined as:
[0028]
[0029] Among them, N is the total number of samples, C is the total number of categories, and y i,c is an element in the label matrix, and the pi model is the probability value of category c predicted by sample i.
[0030] The purpose of this step is to preliminarily train the text classification model so that the initial text classification model can adapt to the samples of new data and perform better on the samples of new data.
[0031] Step 2: In the sample screening module, the trained text classification model is used to extract features, and K-Means clustering is used to perform preliminary screening of samples. Specifically, the text classification model trained in step 1 is used to extract text features from new data samples, and then K-Means clustering is performed on the features of samples of each class, and the sample closest to the cluster center is selected. After clustering, the number of clusters is twice the total memory M divided by the number of categories C. Finally, each category will be preliminarily screened. samples.
[0032] Since the total memory M is limited, only the most representative samples of each category can be selected and stored in memory M. The samples stored in M are to better retain the performance of the model for the categories in memory M. When new category data arrives, it can more effectively prevent catastrophic forgetting.
[0033] Step 3: Train the sample valuation model. The sample valuation model consists of several linear layers and a hyperbolic tangent (Tanh) activation function. The sample valuation model further filters the samples initially filtered in step 2 and uses this feedback to train the sample valuation model.
[0034] The specific method is as follows: First, the samples in step 2 are valued through the sample valuation model. Each sample has a corresponding sample valuation and outputs the selection vector s to filter out Sample valuation corresponds to the sample; then, use the new data sample described in step 1 to train a new Bert text classification model, and get the accuracy rate of acc1, and use the filtered Samples are trained separately for another new Bert text classification model, and the accuracy is acc2. Acc1, acc2 and s vector are used to calculate the valuation model sample loss L Value , update the sample valuation model.
[0035] By comparing the performance of the Bert text classification model trained on new data samples with another Bert text classification model trained on the filtered samples obtained by the sample valuation model, that is, comparing the accuracy on the same validation set, we can intuitively see the performance of the sample valuation model. Using acc1, acc2, and the selection vector s, the sample valuation is calculated according to the following formula to obtain the reward. The loss function L of the sample valuation model is further calculated from the reward. Value Update sample valuation model.
[0036]
[0037] Through the sample valuation model, the sample valuation model can better screen out representative samples from the preliminary screening samples, thereby ensuring the accuracy of the initial text classification model.
[0038] Step 4: Second screening of playback samples. Use the trained sample estimation model to screen the playback samples for the second time and store them in memory M.
[0039] The specific method is to train the sample valuation model for the samples that have been initially screened, and obtain the corresponding sample valuations, and select the one with the highest value. Samples. Store the samples in memory M.
[0040] After training, the sample valuation model can effectively value the initially screened samples and find more representative samples through solid sample valuation. samples, and store these samples in memory M to ensure the accuracy of the categories in memory M of the initial text classification model.
[0041] Step 5: Delete some samples of the retained sample category. The samples are mixed with the retained samples to obtain a new total number of categories C0; each old category is deleted from the memory M samples to ensure that the overall memory does not exceed the threshold |M|.
[0042] The specific method is as follows: when training the initial text classification model in step 1, take the mean of all text features of each class to obtain the prototype of each sample; when deleting samples, delete the ones farthest from the prototype according to the text features. samples.
[0043] Step 6: Use the samples in memory M to retrain the initial text classification model through the knowledge distillation module to complete incremental learning.
[0044] The specific method is to calculate L CLS At the same time, first retain the current model and freeze the model parameters, calculate the distance between the features of the current model and the frozen model to calculate the loss L SIM , calculate the loss L by calculating the feature distance of samples of different categories in the sample MGN , and then calculate the loss L by calculating the logit given by the initial text classification model and the current model for the sample PKD .
[0045]
[0046] where x n is the sample, N is the number of samples, cos() is the cosine similarity, f(x n ) represents the text feature output of the frozen initial text classification model, g(x n ) represents the text feature output of the current model.
[0047]
[0048] Where I is the indicator function, when x n and x t The value is 1 if the categories are different, otherwise the value is 0.
[0049]
[0050]
[0051] Where C0 is the number of sample categories, u is the logical probability value of the frozen initial text classification model, u is the logical probability value of the current model, and A is a scalar.
[0052] Calculate the total loss L using the following formula: total It is the linear weighted sum of the above four losses.
[0053] L total =L CLS +λ1L SIM +λ2L MGN +λ3L PKD
[0054] Among them, λ1, λ2, and λ3 are weights and are constants.
[0055] By training the encoder with multiple losses, we can solve the weight offset problem caused by the imbalance of the number of new and old samples, and further optimize the encoder so that the model can better predict future data.
[0056] Example:
[0057] Experimental Setup: The Banking-ML dataset was used as the experimental dataset. The dataset contains 150 classes, with 15 classes used for incremental training. The Banking-ML benchmark is built on the Banking, M-CID-EN, and Liu57 datasets. The Banking and M-CID-EN datasets provide 77 and 16 classes, respectively. The data split for these classes follows the official datasets. Due to the severe long-tail distribution of classes in Liu57, only the top 57 frequent classes were used. Since Liu57 does not provide a data split, the data for each class in Liu57 was split into training / validation / test sets in a 3:1:1 ratio. Ultimately, the Banking-ML benchmark contains 150 classes. Each step learns 15 new classes. Model performance is evaluated using two metrics: the average accuracy of each incremental training round and the overall accuracy after training. Comparisons are made with other methods using the same dataset and settings.
[0058] The experimental results are shown in Table 1 below:
[0059] Table 1
[0060]
[0061] As shown in Table 1 above, compared to the baseline methods EEIL, EMAR, RP-CRE, and SCN, our method improves overall accuracy by 5.96%, 8.54%, 4.33%, and 0.68%, respectively. The average accuracy improves even more. As the table above demonstrates, our method outperforms the other baseline methods.
Claims
1. A playback incremental learning method based on double sample screening, characterized in that: The following steps are involved: Step 1: Train the text classification model using new data samples and retained samples; Step 2: Extract features through the trained text classification model and use clustering algorithms to perform preliminary screening of samples; Step 3: Filter the samples initially screened in step 2 through the sample valuation model, and train the sample valuation model through feedback; Step 4: Use the trained sample valuation model to screen the playback samples again; Step 5: Mix the sample obtained from the secondary screening with the retained sample; Step 6: Based on the mixed samples, construct a loss function to train the initial text classification model again to complete incremental learning.
2. The playback incremental learning method based on double sample screening according to claim 1 is characterized in that: The specific implementation of step 1 is as follows: The specific method is to extract text features through the initial text classification model Bert, then obtain the logical probability value of the text through the fully connected layer, and use the cross entropy to calculate the loss L CLS Update the initial text classification model parameters.
3. The playback incremental learning method based on double sample screening according to claim 2 is characterized in that: The preliminary screening is specifically implemented as follows: using the text classification model trained in step 1 to extract text features from new data samples, then clustering the text features of samples of each class, and selecting the samples closest to the cluster center; after clustering, the number of clusters in each cluster is twice the total memory M divided by the number of categories C.
4. The playback incremental learning method based on double sample screening according to claim 3 is characterized in that: The sample estimation model consists of a linear layer and a hyperbolic tangent Tanh activation function.
5. The playback incremental learning method based on double sample screening according to claim 4 is characterized in that: The specific implementation of step 3 is as follows: First, the samples in step 2 are estimated by the sample estimation model. Each sample has a corresponding sample estimation and outputs a selection vector s to filter out the samples. Sample valuation corresponds to the sample; then, use the new data sample described in step 1 to train a new Bert text classification model, and get the accuracy rate of acc1, and use the filtered Samples are trained separately for another new Bert text classification model, and the accuracy is acc2. Acc1, acc2 and s vector are used to calculate the valuation model sample loss L value , update the sample valuation model.
6. The playback incremental learning method based on double sample screening according to claim 5 is characterized in that: The specific implementation of step 4 is as follows: the samples selected initially are trained with the sample valuation model to obtain the corresponding sample valuations, and the sample with the highest valuation is selected. samples.
7. The playback incremental learning method based on double sample screening according to claim 6 is characterized in that: The step 5 is specifically implemented as follows: The samples are mixed with the retained samples to obtain a new total number of categories C0; each old category is deleted from the memory M samples to ensure that the overall memory does not exceed the threshold |M|; Each old class is deleted from the memory M Specifically, when training the initial text classification model in step 1, take the average of all text features of each class to obtain the prototype of each sample; when deleting samples, delete the ones farthest from the prototype according to the text features. samples.
8. The playback incremental learning method based on double sample screening according to claim 7 is characterized in that: The construction of the loss function is specifically implemented as follows: CLS At the same time, first retain the current model and freeze the model parameters, calculate the distance between the features of the current model and the frozen model to calculate the loss L SIM , calculate the loss L by calculating the feature distance of samples of different categories in the sample MGN , and then calculate the loss L by calculating the logit given by the initial text classification model and the current model for the sample PKD ; Total loss L total It is the linear weighted sum of the above four losses.