A method for forgetting learning based on elastic weight consolidation
By calculating the Fisher information matrix and modifying the loss function, the performance degradation caused by data deletion in machine learning models is solved, enabling the model to retain knowledge and quickly adapt to new tasks, while reducing the success rate of backdoor attacks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU POST QUANTUM CRYPTOGRAPHY TECH CO LTD
- Filing Date
- 2023-07-06
- Publication Date
- 2026-05-01
AI Technical Summary
Deleting data from a machine learning model can negatively impact its performance, causing it to forget previously learned information.
By calculating the Fisher information matrix of the dataset and modifying the loss function, and combining it with an optimization algorithm to minimize the loss function, the model weights are optimized to adapt to the new data distribution, thus achieving elastic weight consolidation forgotten learning.
After data deletion, the model can effectively retain previously learned knowledge, quickly adapt to new tasks, and reduce the success rate of backdoor attacks.
Smart Images

Figure CN116862018B_ABST
Abstract
Description
A forgetting learning method based on elastic weight consolidation Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a forgetting learning method based on elastic weight consolidation. Background Technology
[0002] Today's computer systems store vast amounts of personal data. Due to tremendous advancements in data storage and transmission technologies, the amount of data generated, recorded, and processed is exploding. Personal data, including users' digital footprints, reflects their real-world behavior, interactions, and communication patterns.
[0003] Other sources of this data include digital content created by online users to express their thoughts and opinions, such as interactive comments, blog posts, status updates, and knowledge sharing. Recently, personal data has also expanded to include data from wearable devices. This wealth of data has fueled the development of artificial intelligence (AI), such as deep learning. However, on the other hand, this data threatens user privacy and increases the risk of data breaches. For these reasons, some users may choose to have their data completely removed from a system, especially sensitive systems related to finance or healthcare. Meanwhile, recent laws and regulations have also granted users the "right to be forgotten," compelling internet service providers to remove all or part of a user's data from their systems upon request.
[0004] In the field of machine learning, data deletion is not limited to simply removing corresponding data records from the backend database; it should also include all entities that indirectly utilize this data. For example, machine learning models, as they perform high-level abstractions based on representations of given data. However, when we remove some data from a model, its performance can be negatively impacted. This is because neural networks adjust their weights and biases according to the distribution and characteristics of the data during training, gradually adapting to the training data. If we delete some data, the network's weights and biases may need to be readjusted to adapt to the new data distribution. However, this can also cause the network to forget previous knowledge, resulting in poor performance on previous tasks. Summary of the Invention
[0005] The purpose of this invention is to provide a forgetting learning method based on elastic weight consolidation to address the problem that the performance of a model may be negatively affected when some data is removed from the model.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] A forgetting learning method based on elastic weight consolidation includes the following steps:
[0008] S1. Initialize model parameters using the training dataset;
[0009] S2. Obtain the loss function from the samples and select an optimization algorithm to minimize the loss function until the model converges;
[0010] S3. Receive the deletion request and obtain the dataset to be deleted;
[0011] S4. Calculate the Fisher information matrix of the dataset and modify the loss function in conjunction with the dataset to be deleted;
[0012] S5. Use the optimization algorithm to minimize the loss function until the requirement is met, then output the model with the deleted dataset.
[0013] Further, step S2 includes the following steps:
[0014] S21. Initialize the number of iteration rounds;
[0015] S22. Input the dataset into the model and calculate the loss function for the dataset;
[0016] S23. Calculate the weights of the loss function on the model, update the model weights, and increment the iteration number by 1;
[0017] S24. Repeat steps S21 to S23 to minimize the loss function until the model converges, and then output the model.
[0018] Furthermore, step S21 involves inputting data in batches, and the batch size and step size are set and optimized before inputting.
[0019] Furthermore, the loss function is chosen as cross-entropy, and the optimization algorithm is chosen as stochastic gradient descent.
[0020] Further, step S4 includes the following steps:
[0021] S41. Input the dataset into the model and calculate the loss function;
[0022] S42. Calculate the gradient of the loss function with respect to each model weight, and use the squared gradient of each model weight as an element of the Fisher information matrix;
[0023] S43. Modify the loss function based on the Fischer information matrix obtained in step S42 and the dataset to be deleted.
[0024] Further, step S5 includes the following steps:
[0025] S51. Initialize the number of iteration rounds;
[0026] S52. Input the dataset to be deleted into the model and calculate the loss function of the dataset to be deleted;
[0027] S53. Calculate the loss function of the dataset to be deleted on the model weights, update the model weights, and increment the iteration number by 1;
[0028] S54. Repeat steps S51 to S53 until the desired result is achieved, and then output the model.
[0029] Furthermore, step S51 involves inputting data in batches, and the batch size and step size are set and optimized before inputting.
[0030] The present invention also provides a computer-readable storage medium storing a computer program, wherein when the computer program of the readable storage medium is executed by a processor, it is used to implement the steps of the method described in any of the preceding claims.
[0031] The beneficial effects of this invention are:
[0032] This invention is applicable to online learning scenarios, effectively preserving previously learned knowledge and pre-optimizing the loss function before deleting data, enabling rapid adaptation to new tasks. Attached Figure Description
[0033] Figure 1 is a flowchart of an embodiment of the present invention;
[0034] Figure 2 is a schematic diagram illustrating the effect of the present invention on a real dataset. Detailed Implementation
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] This invention provides a forgetting learning technique based on elastic weight consolidation, comprising the following steps:
[0037] Step S1: Collect handwritten data (MNIST) images from the internet via an internet service provider to form a training dataset D = (x i ,y i ) 1,2,...,n This includes user C's data D. C =(x j ,y j ) 1,2,...,mThis data is intended for later use in deleting data. The internet service provider's goal is to train a model that recognizes handwritten data; therefore, they chose the LeNet5 convolutional neural network and initialized its parameters w using a Gaussian distribution. 0 .
[0038] Step S21: The provider selects cross-entropy as the loss function, therefore Where p ic This represents the probability that sample i belongs to class c, as predicted by the neural network. We choose stochastic gradient descent (SGD) as the optimization algorithm, setting the batch size to b, the optimization step size to α, and the number of iterations t = 0.
[0039] Step S22: Input the dataset D into the model according to the batch size and calculate the loss function.
[0040] Step S23: Calculate the gradient of the loss function with respect to the model weights. And update the model weights according to the gradient, incrementing the iteration number by 1, i.e., w. t+1 =w t -αΔ t , t = t + 1.
[0041] Step S24: Repeat steps S22 to S23 to minimize the loss function until the model converges, and output the trained and optimized model w. * =w t .
[0042] Step S3: The Internet service provider obtains the deletion request and receives the dataset D to be deleted. C The deletion operation will then begin.
[0043] Step S41: The provider inputs samples from the training dataset D into the model and calculates the loss function L(w). * ;D);
[0044] Step S42, calculate L(w) * D) For the gradient of each model weight, the square of the gradient of each model weight is used as an element of the Fisher information matrix F.
[0045] Step S43: Modify the loss function based on the Fisher information matrix calculated in step S42. Where F j It is the diagonal element of F. It is w * The j-th component, w j It is the j-th component of the current model w. λ is the regularization coefficient, representing the importance of the remaining data relative to the deleted data.
[0046] Step S51: The Internet service provider resets t=0, selects stochastic gradient descent (SGD) as the optimization algorithm, sets the batch size to b′, and the optimization step size to α′.
[0047] Step S52: Deleting the dataset D C Input the batch size into the model and calculate the loss function for the dataset to be deleted.
[0048] Step S53: Calculate the gradient of the loss function of the dataset to be deleted with respect to the model weights. And update the model weights according to the gradient, incrementing the iteration number by 1, i.e., w. t+1 =w t -α′Δ t , t = t + 1.
[0049] Step S54: Repeat steps S52 to S53 3-5 times, denoted as w. - =w t Internet service providers output w - .
[0050] At this point, the internet service provider has completed user C's request, using the trained model w. * Delete dataset D C Simultaneously retain dataset D / D C Information obtained from model w - .
[0051] This invention also provides a computer-readable storage medium for a computer program, wherein when the computer program in the readable storage medium is executed by a processor, it is used to implement the steps of the method in steps S1 to S54.
[0052] This invention uses backdoor attack as the performance metric for the forgetting effect and the model's accuracy on the remaining dataset as the model's ability to retain old knowledge. Backdoor attacks are one of the main attacks against machine learning models. Backdoor attacks do not affect the model's performance on benign inputs; they only produce erroneous results when triggered by specific samples with triggers. We add fixed triggers to benign samples to induce the model to produce incorrect predictions, and then use a forgetting learning algorithm to forget them. A successful forgetting model should perform quite well on the test dataset, but this will reduce the success rate of backdoor attacks.
[0053] (1) Dataset introduction: The dataset used in this invention is the MNIST dataset. The MNIST dataset is a handwritten digit database collected and organized by the National Institute of Standards and Technology in the United States. The database consists of 250 handwritten digits from different people. Each image is a 28×28 grayscale image, containing 60,000 training samples and 10,000 test samples.
[0054] (2) Experimental results and analysis: Figure 1 shows that after our forgetting technique, the success rate of backdoor attack decreased from 99% to 0.18%, while the accuracy of the model changed from 97% before forgetting to 84%.
[0055] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A forgetting learning method based on elastic weight consolidation, comprising an internet service provider and a user, characterized in that: The method includes the following steps: S1, initializing model parameters by collecting image-based training datasets from internet service providers; S2, obtaining a loss function from samples by the internet service provider and selecting an optimization algorithm to minimize the loss function until the model converges; S3, receiving user deletion requests and obtaining the dataset to be deleted; S4, calculating the Fischer information matrix of the dataset and modifying the loss function in conjunction with the dataset to be deleted; step S4 includes the following steps: S41, inputting the dataset into the model and calculating the loss function; S42, calculating the gradient of the loss function with respect to each model weight and using the squared gradient of each model weight as an element of the Fischer information matrix; S43. Modify the loss function based on the Fischer information matrix obtained in step S42 and the dataset to be deleted; S5. Minimize the loss function using the optimization algorithm until the requirement is met, then output the model for deleting the dataset.
2. The forgetting learning method based on elastic weight consolidation as described in claim 1, characterized in that: Step S2 includes the following steps: S21, select a loss function and optimization algorithm based on the neural network prediction samples, and initialize the number of iteration rounds; S22, input the dataset into the model and calculate the loss function of the dataset; S23, calculate the weight of the loss function on the model, update the model weights, and increment the number of iteration rounds by 1; S24, repeat steps S22 to S23 to minimize the loss function until the model converges, and output the model.
3. The forgetting learning method based on elastic weight consolidation as described in claim 2, characterized in that: Step S21 involves inputting data in batches, and setting the batch size and optimizing the step size before inputting.
4. The forgetting learning method based on elastic weight consolidation as described in claim 2, characterized in that: The loss function is cross-entropy, and the optimization algorithm is stochastic gradient descent.
5. The forgetting learning method based on elastic weight consolidation as described in claim 1, characterized in that: Step S5 includes the following steps: S51, initialize the number of iteration rounds; S52, input the dataset to be deleted into the model and calculate the loss function of the dataset to be deleted; S53, calculate the loss function of the dataset to be deleted on the model weights, update the model weights, and increment the number of iteration rounds by 1; S54, repeat steps S51 to S53 until the desired result is achieved, and output the model.
6. The forgetting learning method based on elastic weight consolidation as described in claim 5, characterized in that: Step S51 involves inputting data in batches, and the batch size and step size are set and optimized before inputting.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program on the readable storage medium is executed by a processor, it is used to implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Machine learning data forgetting method based on mask gradient
CN116226654A