Federal dampened class forgetting method and device, electronic equipment and storage medium
By using Fisher's information matrix to filter and weaken model parameters in federated learning, the problem of excessive performance degradation in federated pruning forgetting learning is solved, achieving efficient forgetting and significantly reducing resource consumption and recovery costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
- Filing Date
- 2026-02-05
- Publication Date
- 2026-05-05
AI Technical Summary
Existing federated pruning forgetting learning causes excessive damage to the model's performance in retaining categories after the forgetting algorithm is executed, and the model's performance recovery is slow.
By introducing the Fisher information matrix to measure the importance of parameters in the pre-trained global model, the model parameters to be weakened are selected and weakened. This adopts a 'soft modification' approach, which preserves the original knowledge of the model without changing its structure. The diagonal elements of the Fisher information matrix are used to measure the importance of parameters, and the model parameters to be weakened are selected based on their importance.
It greatly improves the efficiency of model forgetting, significantly reduces cost overhead, and the model can recover its performance with only a few fine-tunings after forgetting, significantly reducing the consumption of communication and computing resources.
Smart Images

Figure CN121638387B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of federated learning, specifically relating to a federated damping forgetting method, device, electronic device, and storage medium. Background Technology
[0002] Federated learning is a privacy-preserving distributed machine learning technique that involves several clients and a server. Clients help the server train a global model by sharing valuable information (such as gradients and model parameters trained on their local datasets) without sharing their local private data. Traditional centralized machine learning techniques, on the other hand, centralize all private datasets on a server for training.
[0003] In the federated learning paradigm, clients share information to help the server train the data. While federated learning uses this method to protect data privacy, the model trained on the server may still leak information from local data; that is, the model may indirectly remember the user's private data.
[0004] Due to the need for privacy protection and the right to be forgotten, information from some samples needs to be removed from the model, such as samples of the corresponding category or certain backdoor samples. The most direct and thorough method is to retrain the model from scratch. Although this technique can guarantee the complete deletion of data, it is impractical due to the high communication and computation costs. Therefore, machine forgetting technology has emerged. It mainly studies how to avoid the excessive overhead of retraining the model from scratch and remove the influence of target data from the model.
[0005] The core objective of machine forgetting technology is to remove knowledge of specific data from a trained model without retraining it from scratch, while minimizing the impact on the overall model performance. In a federated environment, there are three main categories: class forgetting, client-side forgetting, and sample-level forgetting. Current research primarily focuses on client-side and sample-level forgetting, neglecting class forgetting. This invention focuses on class forgetting.
[0006] In the field of federated forgetting, researchers have proposed various technical approaches. For example, Wang et al. used channel pruning to forget data of corresponding categories; Zhao et al. adjusted model weights through momentum decay mechanisms to achieve forgetting of clients or categories. Yasser H. Khalil et al. proposed a method to achieve federated forgetting by inverting weights.
[0007] Furthermore, Chinese patent document CN119849601A discloses a federated category forgetting learning method based on noise adversarial training, comprising four steps: noise adversarial training, calculating the influence of target data, forgetting training, and retraining. Noise adversarial training uses error maximization and knowledge distillation to train noisy data to disrupt the model's classification ability; the influence of target data is calculated from the gradient of the target data on the global model. Forgetting training mainly involves merging noisy data into the remaining dataset for training and adjusting parameters with the aid of influence. Retraining is the normal federated learning process performed on the remaining dataset.
[0008] This shows that some research progress has been made in this field in recent years, mainly focusing on improving the efficiency of forgetting algorithms and the effectiveness of data forgetting. However, existing channel pruning forgetting algorithms result in significant performance loss after execution and require a large number of communication rounds for recovery. Even with the same number of communication rounds during fine-tuning and pre-training, some categories cannot recover the performance of the model in the retained categories before forgetting.
[0009] Based on this, the present invention adopts a "soft modification" approach, that is, damping based on the importance of parameters. This choice is inspired by the successful application of damping methods in centralized learning by researchers such as Foster. The method of the present invention does not change the structure of the model, but weakens the weights of specific parameters. This preserves the original knowledge of the model to the greatest extent possible, laying a solid foundation for rapid recovery later. Summary of the Invention
[0010] The present invention aims to overcome at least one of the defects of the prior art and provide a federated damped forgetting method to solve the problems of excessive damage to the model's performance in the retained categories and slow model performance recovery in the current federated pruning forgetting learning.
[0011] The present invention also discloses an apparatus loaded with a federal damping forgetting method.
[0012] Technical terms involved in this invention:
[0013] Fisher information matrix: used to measure the importance of model parameters. It can measure the importance of certain model parameters for a dataset and the degree of mutual influence between model parameters. In this invention, the diagonal elements of the Fisher information matrix are used to approximate the Fisher information matrix. It is used to measure the importance of model parameters for different categories of data subsets on the local client during the forgetting process, and to select model parameters to be weakened on the server according to their importance and then weaken them.
[0014] Parameter reduction: For the selected model parameters to be reduced, the corresponding reduction strategy is executed, that is, the model parameters are multiplied by a reduction coefficient, which is less than or equal to 1;
[0015] Model pruning is a deep model optimization method. Deep neural networks have a large number of redundant parameters. Removing these parameters (i.e., removing these parameters from the model structure) has almost no impact on the model's performance. This is model pruning. In the field of forgetting learning, this technique is applied to the forgetting direction. The model parameters corresponding to the target data are regarded as redundant parameters and removed, which can successfully forget the target data.
[0016] Post-training: Forgetting algorithms typically consist of two steps. The first step is to perform the forgetting process, and the second step is to perform several rounds of federated learning on the remaining dataset to enhance the forgetting or recover the model's performance. This is called post-training or fine-tuning.
[0017] The detailed technical solution of this invention is as follows:
[0018] A federated damped forgetting method, applied to a federated learning system, includes a server and several clients communicating with the server; the method includes:
[0019] S1. Obtain a pre-trained global model. The pre-trained global model is obtained by training a given initial global model using the local dataset of the client based on the federated learning method. The local dataset is allocated based on the given training dataset and contains image samples of multiple different categories. Image samples of the same category in the local dataset of each client are used to construct a data subset of the corresponding category on the client.
[0020] S2. Randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. Construct a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and construct a retention class set from the data subsets belonging to the retention categories. Calculate the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, in order to filter the model parameters to be weakened and perform weakening. Then update the pre-trained global model based on the weakened model parameters.
[0021] S3. Use the image samples in the reserved class set of the local dataset to perform post-training on the updated pre-trained global model to obtain the target global model.
[0022] According to a preferred embodiment of the present invention, in step S2, calculating the Fisher information matrix of all parameters of the pre-trained global model on the forgotten class set and the retained class set respectively specifically includes:
[0023] Calculate the Fisher information matrix of all parameters of the pre-trained global model on all data subsets of the local dataset of each client, which includes the Fisher information matrix corresponding to the data subset belonging to the target forgetting category and the Fisher information matrix corresponding to the data subset belonging to the retention category;
[0024] Aggregate the Fisher information matrices corresponding to the data subsets belonging to the same category in all clients to obtain the global Fisher information matrices corresponding to all parameters of the pre-trained global model for each category. These matrices include the global Fisher information matrices corresponding to the target forgetting category and the global Fisher information matrices corresponding to the retention category.
[0025] The global Fisher information matrices corresponding to the target forgetting category are aggregated across categories to obtain the first target importance matrix;
[0026] The global Fisher information matrices belonging to the reserved categories are aggregated across categories to obtain the second target importance matrix.
[0027] According to a preferred embodiment of the present invention, in step S2, calculating the Fisher information matrix of all parameters of the pre-trained global model on all data subsets of the local dataset of each client specifically involves:
[0028]
[0029] In formula (2): Indicates the client About categories The first Fisher information matrix Each component measures the parameters of the pre-trained global model. For the client The importance of the data subset belonging to category c; This indicates that the pre-trained global model performs well on a single image sample. loss function on; It is the data set of the j-th batch in the data subset of client k with respect to category c; It is the number of image samples contained in the j-th batch of the dataset; It is the sum of the losses of all data in the current batch; This is the average loss for the current batch; It is the average loss with respect to model parameters The first-order partial derivative; This represents a size-adaptive square operation. It is the total number of batches of data subsets of category c for client k; This represents the summation of all batches of data for client k with respect to category c, divided by the total number of batches to obtain the average.
[0030] According to a preferred embodiment of the present invention, in step S2, the Fisher information matrices corresponding to the data subsets belonging to the same category in all clients are aggregated to obtain the global Fisher information matrices corresponding to all parameters of the pre-trained global model for each category, specifically as follows:
[0031]
[0032] In formula (3): This represents the global Fisher information matrix corresponding to category c obtained from aggregation; Indicates the total number of clients; Indicates the client The total number of image samples of category c in the uploaded local dataset; This represents the Fisher information matrix corresponding to category c uploaded by client k.
[0033] According to a preferred embodiment of the present invention, in step S2, the global Fisher information matrix corresponding to the target forgetting category is aggregated across categories, specifically as follows:
[0034]
[0035] In equation (4): This represents the first target importance matrix corresponding to the target forgetting category. Each component measures the parameters of the pre-trained global model. The importance of target forgetting categories; Indicates the category obtained from aggregation The i-th component in the global Fisher information matrix, where j ranges from 1 to m; This means selecting the maximum value from the i-th component of the global information matrix corresponding to the m forgotten target categories, and constructing it as the first target importance matrix.
[0036] According to a preferred embodiment of the present invention, in step S2, the global Fisher information matrix corresponding to the retained category is aggregated across categories, specifically as follows:
[0037]
[0038] In equation (5): This represents the second objective importance matrix corresponding to the retained categories; This represents the global Fisher information matrix corresponding to category c obtained from the aggregation. Indicate category The total number of image samples across all clients, i.e., the corresponding category in each client. The sum of the sample sizes; This indicates all categories that belong to the reserved category. The calculated results are then summed together.
[0039] According to a preferred embodiment of the present invention, step S2 further includes filtering model parameters to be weakened based on the first target importance matrix and the second target importance matrix:
[0040]
[0041] In equation (6): This represents the set of model parameters selected for weakening. This represents the first target importance matrix corresponding to the target forgetting category. One portion, This represents the second objective importance matrix corresponding to the retained category. Each component measures one of the parameters of the pre-trained global model. The importance of the forgetting and retention categories of the target; The set filtering parameters;
[0042] And / or, perform weakening on the selected model parameters based on the weakening coefficient:
[0043]
[0044]
[0045] In equations (7) and (8): The parameters of the pre-trained global model The corresponding weakening coefficient; These are hyperparameters used to control the degree of attenuation; For the first pre-trained global model One parameter; The parameters of the pre-trained global model after the weakening operation is performed.
[0046] In another aspect of the invention, an apparatus is provided for implementing the federally damped forgetting method as described above, the apparatus comprising:
[0047] The model acquisition module is used to acquire a pre-trained global model. The pre-trained global model is based on the federated learning method and is obtained by training a given initial global model using the client's local dataset. The local dataset is allocated based on the given training dataset and contains image samples of multiple different categories. Image samples of the same category in each client's local dataset are used to construct a data subset of the corresponding category on the client.
[0048] The model parameter reduction module is used to randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. It constructs a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and constructs a retention class set from the data subsets belonging to the retention categories. It calculates the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, so as to filter the model parameters to be reduced and perform reduction. Then, it updates the pre-trained global model based on the reduced model parameters.
[0049] The model post-training module is used to perform post-training on the updated pre-trained global model using image samples from the reserved class set of the local dataset to obtain the target global model.
[0050] In another aspect of the invention, an electronic device is also provided, comprising:
[0051] At least one processor; and
[0052] A memory that stores instructions that, when executed by the at least one processor, cause the at least one processor to perform the federally damped forgetting method as described above.
[0053] In another aspect of the invention, a machine-readable storage medium is also provided, which stores executable instructions that, when executed, cause the machine to perform the federally damped forgetting method as described above.
[0054] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0055] This invention provides a federated damped forgetting method that introduces a Fisher information matrix to measure the importance of the model parameters of the pre-trained global model to the forgetting class set and the retained class set, thereby selecting model parameters to be weakened and performing weakening. Compared with the federated pruning forgetting learning method, this invention studies how to perform class forgetting through parameter modification while minimizing the damage to the model's performance on the retained class set, which greatly improves the model's forgetting efficiency and significantly reduces cost. Attached Figure Description
[0056] Figure 1 This is a flowchart of the federal damping forgetting method described in this invention.
[0057] Figure 2 This is the experimental result showing how the accuracy of the initial global model in this invention changes with the number of communication rounds on the test set.
[0058] Figure 3 This is a comparison of the accuracy changes of the pre-trained global model on the test set before and after implementing the channel pruning and forgetting method for target class 0 in this invention.
[0059] Figure 4 This is a comparison of the accuracy changes of the pre-trained global model on the test set before and after implementing the federal damping forgetting method on target class 0 in this invention.
[0060] Figure 5 This is an experimental result showing the change in accuracy of the global forgetting model obtained after performing channel pruning forgetting on target class 0 in this invention on the test set during subsequent training as a function of fine-tuning rounds.
[0061] Figure 6 This is the experimental result of the accuracy of the global forgetting model obtained after performing the federal damping forgetting method on the target class 0 in this invention on the test set during post-training, as the number of fine-tuning rounds changes. Detailed Implementation
[0062] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0063] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0064] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0065] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0066] To solve the problems that the current federated pruning-based forgetting learning causes excessive damage to the performance of the model on the retained classes and the slow recovery of the model performance, the present invention provides a federated damping-based forgetting method. This method is inspired by the successful application of the damping method by researchers such as Foster in centralized learning, and a technical approach of "soft modification" is selected, that is, damping is carried out according to the importance of parameters. In the context of federated learning, by introducing the Fisher information matrix to measure the importance of the model parameters of the pre-trained global model for the forgotten class set and the retained class set, the model parameters to be weakened are screened and weakened, so as to retain the original knowledge of the model to the greatest extent without changing the model structure, realize the forgetting of the model for specific classes, greatly improve the forgetting efficiency, and significantly reduce the cost.
[0067] The following further describes the federated damping-based forgetting method of the present invention and its related devices in conjunction with specific embodiments.
[0068] Embodiment 1
[0069] This embodiment provides a federated damping-based forgetting method, which is applied to a federated learning system. The system includes a server side and a number of client sides communicatively connected to the server side. The method of the present invention can be applied to computer vision processing, speech processing, natural language processing, and large language models, including fields such as medical image analysis, blockchain, and vehicle-to-everything network, to further protect the data security of federated learning users.
[0070] Refer Figure 1 , the method includes:
[0071] S1. Obtain a pre-trained global model, which is obtained by training a given initial global model using the local datasets of the client sides based on the federated learning method; the local datasets are allocated based on a given training dataset, and each of them contains multiple image samples of different classes, and the image samples belonging to the same class in the local datasets of each client side are constructed into a data subset corresponding to the class on the client side.
[0072] Specifically, in the federated learning method, first, an initial global model is deployed on the server side , and then it is distributed to each client side. Each client side has a given local dataset for training the initial global model it receives . After completing the model training, the trained model parameters and the total amount of data in the local datasets are uploaded to the server side for aggregating and updating the model parameters. This process is repeated for multiple communication rounds to obtain the pre-trained global model .
[0073] Based on the above, this embodiment provides a standard dataset as the training dataset, such as the MNIST dataset or the CIFAR-10 dataset. This training dataset is distributed to each client according to the Dirichlet distribution to form their local dataset, thus simulating the non-independent and identically distributed nature of the training data.
[0074] It should be understood that a given training dataset contains data with multiple different class labels. The Dirichlet distribution is a probability distribution commonly used to generate non-independent identically distributed (Non-IID) dataset partitions, especially in federated learning. By adjusting its parameters, the heterogeneity of the data distribution across different clients can be controlled. The parameters of the Dirichlet distribution determine the degree of central tendency of the distribution. Larger parameter values result in a more uniform data distribution, while smaller parameter values lead to a more uneven distribution. By sampling from the Dirichlet distribution, the proportion of samples from each class for each client can be determined, thus yielding the total number of samples for each client.
[0075] Therefore, it is understandable that the total number of data samples and the composition ratio of various types of samples for each client may be the same or different.
[0076] Furthermore, in this embodiment, it is assumed that the given training dataset is the CIFAR-10 dataset. CIFAR-10 is a color image dataset that more closely approximates universal objects. It contains RGB color images of 10 categories: airplanes, cars, birds, cats, deer, dogs, frogs, horses, boats, and trucks. Each image is 32×32 pixels in size, and there are 6000 images in each category. These images are distributed to each client according to the Dirichlet distribution to form the local dataset for each client. At the same time, image samples belonging to the same category in each local dataset are used to construct the corresponding category data subset on each client.
[0077] For the initial global model In this embodiment, a standard CNN model is used as the initial global model. Such as the ResNet18 model. The initial global model... In a federated learning environment, an initial global model is trained using the FedAvg algorithm (Federated Averaging) on the local datasets of each client. Cross-entropy loss is used during local training. To optimize model parameters:
[0078]
[0079] In formula (1): Represents a single input sample. For input samples Tags; It is a scalar whose value is 0 or 1, and when the input sample When the true label is of class i, It is 1 if it is true, otherwise it is 0; Indicates the total number of categories. Represents the initial global model The probability that sample x belongs to class i.
[0080] Based on the above, the pre-trained global model is obtained. .
[0081] S2. Randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. Construct a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and construct a retention class set from the data subsets belonging to the retention categories. Calculate the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, in order to filter the model parameters to be weakened and perform weakening. Then update the pre-trained global model based on the weakened model parameters.
[0082] As described in S1, the local dataset contains multiple data subsets, each consisting of image samples of the same category. That is, each client processes the local dataset into multiple data subsets according to the category, and each data subset corresponds to a category.
[0083] Therefore, it is understandable that the given CIFAR-10 dataset contains 10 image categories. For ease of description, each image category is numbered sequentially as category 0 to category 9.
[0084] Based on the above, this embodiment can first randomly select one or more categories from the given training dataset as target forgetting categories, and the remaining categories as retention categories; then, it can construct a forgetting class set from the subsets of data belonging to the target forgetting categories in the local datasets of all clients. The subset of data belonging to the reserved category is constructed into a set of reserved categories. .
[0085] For example, assuming that category 0 is selected as the target forgotten category in this embodiment, then the remaining categories 1-9 are the retained categories. Then, a subset of data belonging to category 0 is selected from the local datasets of all clients to construct the forgotten category set. The remaining subsets of data belonging to categories 1 through 9 are used to construct a set of reserved classes. .
[0086] During the forgetting phase, the server will use the pre-trained global model obtained from the training. This is distributed to all clients. For each client, this embodiment introduces a Fisher information matrix and uses the diagonal elements of the Fisher information matrix instead of the Fisher information matrix to measure the pre-trained global model. The importance of all parameters for the forgotten target class and the retained class is used to filter the model parameters to be weakened.
[0087] Specifically, firstly, the pre-trained global model is computed on the data subset corresponding to each category for each client. The diagonal values of the Fisher information matrix for each model parameter are used as the Fisher information matrix for each model parameter, thus obtaining the importance of all model parameters for the data subsets corresponding to each category.
[0088] For the client In category The i-th component of the Fisher information matrix on the subset of data is:
[0089]
[0090] In formula (2): Indicates the client About categories The first Fisher information matrix Each component measures the pre-trained global model. parameters For the client The importance of the data subset belonging to category c; Represents the pre-trained global model In a single image sample loss function on; It is the data set of the j-th batch in the data subset of client k with respect to category c; It is the number of image samples contained in the j-th batch of the dataset; It is the sum of the losses of all data in the current batch; This is the average loss for the current batch; It is the average loss with respect to model parameters The first-order partial derivative; This represents a size-adaptive square operation. It is the total number of batches of data subsets of category c for client k; This represents the summation of all batches of data for client k with respect to category c, divided by the total number of batches to obtain the average.
[0091] The pre-trained global model can be calculated based on the above formula. All parameters are represented by Fisher information matrices on the data subsets of each category, including Fisher information matrices corresponding to the data subsets belonging to the target forgotten category and the data subsets belonging to the retained category. Each client uploads this calculation result and the number of image samples for each category to the server.
[0092] Then, after receiving Fisher information matrices corresponding to all categories from different clients, the server aggregates the Fisher information matrices corresponding to the same category by weighting the number of image samples of the corresponding category uploaded by each client, and obtains the global Fisher information matrix corresponding to that category.
[0093] For category c, its global Fisher information matrix is:
[0094]
[0095] In formula (3): This represents the global Fisher information matrix corresponding to category c obtained from aggregation; Indicates the total number of clients; Indicates the client The total number of image samples of category c in the uploaded local dataset; This represents the Fisher information matrix corresponding to category c uploaded by client k.
[0096] Based on the above formula, a pre-trained global model can be obtained on the server side. All model parameters correspond to a global Fisher information matrix for each category, which includes the global Fisher information matrix corresponding to the target forgotten category and the global Fisher information matrix corresponding to the retained category, used to characterize the importance of the model parameters.
[0097] Next, inter-class aggregation is performed on the global Fisher information matrix corresponding to the target forgetting category and the global Fisher information matrix corresponding to the retention category.
[0098] For the target forgetting category, this embodiment compares the values of the i-th component of the global Fisher information matrix corresponding to all target forgetting categories by selecting the maximum value, and then selects the maximum value as the final result. The final result obtained after comparing all components is used to construct the first target importance matrix corresponding to the target forgetting category, specifically:
[0099]
[0100] In equation (4): This represents the first target importance matrix corresponding to the target forgetting category. Each component measures the pre-trained global model. parameters The importance of target forgetting categories; Indicates the category obtained from aggregation The i-th component in the global Fisher information matrix, where j ranges from 1 to m; This means selecting the maximum value from the i-th component of the global information matrix corresponding to the m forgotten target categories, and constructing it as the first target importance matrix.
[0101] Understandably, in this embodiment, one or more categories are randomly selected from the given training dataset as the target forgetting categories; that is, the number of target forgetting categories is one or more. When the number of selected target forgetting categories is multiple, inter-class aggregation can be performed using the max method described above; when the number of selected target forgetting categories is one, the global Fisher information matrix of that target forgetting category is the first target importance matrix.
[0102] For the reserved categories, this embodiment performs inter-class aggregation on the global Fisher information matrix corresponding to the reserved categories by averaging:
[0103]
[0104] In equation (5): This represents the second objective importance matrix corresponding to the retained categories; This represents the global Fisher information matrix corresponding to category c obtained from the aggregation. Indicate category The total number of image samples across all clients, i.e., the corresponding category in each client. The sum of the sample sizes; This indicates all categories that belong to the reserved category. The calculated results are then summed together.
[0105] Understandably, in this embodiment, the categories remaining after removing the target forgotten categories are taken as retained categories. That is, the number of retained categories can be one or more. When there are multiple retained categories, inter-class aggregation can be performed by averaging as described above. When there is only one retained category, the global Fisher information matrix of that retained category is the second target importance matrix.
[0106] Based on the above, pre-trained global models can be obtained on the server side. The importance results of all model parameters on the target forgetting category, i.e., the first target importance matrix. And the importance results for the retained categories, namely the second objective importance matrix. .
[0107] Next, based on the set filtering parameters... Filter out the model parameters that need to be weakened:
[0108]
[0109] In equation (6): This represents the set of model parameters selected for weakening. This represents the first target importance matrix corresponding to the target forgetting category. One portion, This represents the second objective importance matrix corresponding to the retained category. Each component measures the pre-trained global model. parameters The importance of the forgetting and retention categories of the target; These are the filter parameters that are set.
[0110] Furthermore, the weakening coefficient and weakening formula are as follows:
[0111]
[0112]
[0113] In equations (7) and (8): Represents the pre-trained global model parameters The corresponding weakening coefficient; These are hyperparameters used to control the degree of attenuation; For pre-training global model The One parameter; Pre-trained global model after performing weakening operation The parameters.
[0114] Understandably, in order to calculate stability, in practice, a tiny number can be added to the denominator in equation (7) to prevent the denominator from being 0.
[0115] Based on the above, the selection and weakening of model parameters to be weakened are completed.
[0116] Finally, the server updates the pre-trained global model based on the weakened model parameters. To obtain the global forgetting model The global forgetting model at this point The accuracy of identifying the forgotten category of the selected target is close to 0%, while maintaining a certain ability to identify the retained category.
[0117] S3. Use the image samples in the reserved class set of the local dataset to perform post-training on the updated pre-trained global model to obtain the target global model.
[0118] That is, all image samples corresponding to the retained categories in the local datasets of all clients are used as post-training samples to improve the forgetting global model. Perform multiple rounds of federated training to recover the forgotten global model. It reduces performance loss in the retention category and enhances the forgetting effect in the target forgetting category.
[0119] The effectiveness of the method of the present invention will be verified by specific experiments below.
[0120] The CIFAR-10 dataset was used as the training dataset for the experiments. The CIFAR-10 dataset contains 60,000 32×32 color images in 10 image categories, with 6,000 images in each category, numbered sequentially from category 0 to category 9. Of these, 5,000 images were used for training and 1,000 images were used for testing.
[0121] ResNet-18 was chosen as the base model for the experiment, i.e., the initial global model. Its deep residual learning structure can effectively train deep networks and its effectiveness has been verified in a variety of vision tasks.
[0122] First, train the initial global model on the CIFAR-10 dataset. The experiment employed 30 rounds of global training and 4 rounds of local training, with 10 clients participating in the training. All clients participated in each round, with a learning rate of 0.01. The data distribution was non-independent and identically distributed, and the number of local training rounds and the learning rate were also similar. The aim of the experiment was to remove the influence of class 0 from the global model, i.e., to select class 0 as the target forgetting class, and the results will be presented progressively.
[0123] Initial global model A pre-trained global model was obtained after training. Experiments have shown that pre-trained global models... The accuracy rate on the test set was 80.99%. (See details...) Figure 2 This indicates that the ResNet18 model performs well on the CIFAR-10 dataset.
[0124] Subsequently, this experiment used two different federated forgetting methods to perform forgetting learning on category 0 of the CIFAR-10 dataset: one is the existing channel pruning forgetting method, and the other is the federated damping forgetting method of this invention.
[0125] It should be understood that existing channel pruning forgetting methods work as follows: During the forgetting phase, the client generates a local representation describing the relationship between each channel and each category. The server receives all the local representations uploaded by the client and then averages all representations to generate a global representation. Afterward, the server calculates TF (to measure the channel's contribution to the target forgotten category), IDF (to measure the channel's rarity across all categories), and TF-IDF (multiplying TF and IDF to obtain the correlation score between the channel and the target forgotten category). Then, channel pruning is performed, i.e., based on the TF-IDF score, some channels with high discriminative power with the target forgotten category are removed. Finally, the model enters the fine-tuning phase, i.e., the post-training process.
[0126] The experimental results are as follows: Figure 3 , Figure 4 As shown, the pre-trained global model After applying the forgetting operations of both the channel pruning forgetting method and the federated damping forgetting method, and before fine-tuning (post-training), the accuracy on the target forgotten category test set decreased to near 0%, indicating that both methods effectively eliminated the influence of the target forgotten category data. However, compared to the federated damping forgetting method, the channel pruning forgetting method resulted in a complete loss of performance on the retained categories.
[0127] For channel pruning forgetting methods, a global model is pre-trained before the forgetting operation. The accuracy on the retained-class test set (i.e., the test set obtained by removing the test data of the target forgotten class from the test set) is 80.37%. After the forgetting operation and before the fine-tuning operation, the accuracy of the model on the retained-class test set drops to 15.76%. However, in the federated damped forgetting method, after the forgetting operation and before the fine-tuning operation, the accuracy of the model on the retained-class test set is still 72.96%. Therefore, it can be seen that the federated damped forgetting method proposed in this invention retains relatively complete model performance.
[0128] Further participation Figure 5 , Figure 6 As shown, the pre-trained global model After the forgetting operation in the federated damping forgetting method, the model can recover its performance and even slightly improve after only one round of fine-tuning. However, after the forgetting operation in the channel pruning forgetting method, even after 30 rounds of fine-tuning, the model still cannot achieve the effect of only one round of fine-tuning in the federated damping forgetting method. Moreover, the model only reaches its pre-forgetting performance in the 21st round of fine-tuning. This proves that the method of the present invention can significantly reduce the communication and computational resource consumption of forgetting.
[0129] This invention investigates and evaluates how to perform forgetting-like processes through parameter modification, proposing a low-damage federated forgetting-like method. After successful forgetting, only minor fine-tuning is needed to successfully restore model performance. This is a significant achievement, greatly improving forgetting efficiency, significantly reducing costs, and making the algorithm more practical.
[0130] Furthermore, by comparing existing channel-pruning forgetting methods with the federated damping forgetting method of this invention, both methods effectively forget the target class. However, compared to the method proposed in this invention, the channel-pruning forgetting method requires over twenty communication rounds of fine-tuning to recover performance on the retained class, while the federated damping forgetting method of this invention only requires one communication round of fine-tuning to recover the model's performance on the retained class, thus fully achieving the objective of this invention.
[0131] Example 2
[0132] This embodiment provides an apparatus for implementing the federally damped forgetting method described above, the apparatus comprising:
[0133] The model acquisition module is used to acquire a pre-trained global model. The pre-trained global model is based on the federated learning method and is obtained by training a given initial global model using the client's local dataset. The local dataset is allocated based on the given training dataset and contains image samples of multiple different categories. Image samples of the same category in each client's local dataset are used to construct a data subset of the corresponding category on the client.
[0134] The model parameter reduction module is used to randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. It constructs a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and constructs a retention class set from the data subsets belonging to the retention categories. It calculates the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, so as to filter the model parameters to be reduced and perform reduction. Then, it updates the pre-trained global model based on the reduced model parameters.
[0135] The model post-training module is used to perform post-training on the updated pre-trained global model using image samples from the reserved class set of the local dataset to obtain the target global model.
[0136] Example 3
[0137] This embodiment also provides an electronic device, including at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the federalized damping forgetting method as described above.
[0138] In this embodiment, the electronic device may include, but is not limited to: personal computer, server computer, workstation, desktop computer, laptop computer, notebook computer, mobile computing device, smartphone, tablet computer, cellular phone, personal digital assistant (PDA), handheld device, messaging device, wearable computing device, consumer electronic device, etc.
[0139] Example 4
[0140] This embodiment also provides a machine-readable storage medium storing executable instructions that, when executed, cause the machine to perform the federalized damped forgetting method as described above.
[0141] Specifically, a system or apparatus equipped with a readable storage medium may be provided, on which software program code implementing the functions of any of the embodiments described above is stored, and the computer or processor of the system or apparatus can read and execute the instructions stored in the readable storage medium.
[0142] In this case, the program code itself, which can be read from the readable medium, can implement the functionality of any of the embodiments described above. Therefore, the machine-readable code and the readable storage medium storing the machine-readable code constitute a part of this specification. Embodiments of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROMs, CD-Rs, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer or the cloud via a communication network.
[0143] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied 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.
[0144] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0145] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0146] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solutions of the present invention, and are not intended to limit the specific implementation of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention should be included within the protection scope of the claims of the present invention.
Claims
1. A federated damped forgetting method, applied to computer vision processing, speech processing, natural language processing, and large language models, characterized in that, The method includes: S1. Obtain a pre-trained global model. The pre-trained global model is obtained by training a given initial global model using the local dataset of the client based on the federated learning method. The local dataset is allocated based on the given training dataset and contains image samples of multiple different categories. Image samples of the same category in the local dataset of each client are used to construct a data subset of the corresponding category on the client. S2. Randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. Construct a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and construct a retention class set from the data subsets belonging to the retention categories. Calculate the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, in order to filter the model parameters to be weakened and perform weakening. Then update the pre-trained global model based on the weakened model parameters. S3. Use image samples from the reserved class set of the local dataset to perform post-training on the updated pre-trained global model to obtain the target global model; In step S2, the Fisher information matrix of all parameters of the pre-trained global model is calculated on the forgotten class set and the retained class set, specifically including: Calculate the Fisher information matrix of all parameters of the pre-trained global model on all data subsets of the local dataset of each client, which includes the Fisher information matrix corresponding to the data subset belonging to the target forgetting category and the Fisher information matrix corresponding to the data subset belonging to the retention category; Aggregate the Fisher information matrices corresponding to the data subsets belonging to the same category in all clients to obtain the global Fisher information matrices corresponding to all parameters of the pre-trained global model for each category. These matrices include the global Fisher information matrices corresponding to the target forgetting category and the global Fisher information matrices corresponding to the retention category. The global Fisher information matrices corresponding to the target forgetting category are aggregated across categories to obtain the first target importance matrix; The global Fisher information matrix corresponding to the reserved category is aggregated between categories to obtain the second target importance matrix; S2 further includes filtering model parameters to be weakened based on the first target importance matrix and the second target importance matrix: In formula (6): This represents the set of model parameters selected for weakening. This represents the first target importance matrix corresponding to the target forgetting category. One portion, This represents the second objective importance matrix corresponding to the retained category. Each component measures one of the parameters of the pre-trained global model. The importance of the forgetting and retention categories of the target; The set filtering parameters; And / or, perform weakening on the selected model parameters based on the weakening coefficient: In equations (7) and (8): The parameters of the pre-trained global model The corresponding weakening coefficient; These are hyperparameters used to control the degree of attenuation; For the first pre-trained global model One parameter; The parameters of the pre-trained global model after the weakening operation is performed.
2. The federalized damping forgetting method according to claim 1, characterized in that, In step S2, the Fisher information matrix of all parameters of the pre-trained global model is calculated on all data subsets of the local dataset of each client, specifically as follows: In formula (2): Indicates the client About categories The first Fisher information matrix Each component measures the parameters of the pre-trained global model. For the client The importance of the data subset belonging to category c; This indicates that the pre-trained global model performs well on a single image sample. loss function on; It is the data set of the j-th batch in the data subset of client k with respect to category c; It is the number of image samples contained in the j-th batch of the dataset; It is the sum of the losses of all data in the current batch; This is the average loss for the current batch; It is the average loss with respect to model parameters The first-order partial derivative; This represents a size-adaptive square operation. It is the total number of batches of data subsets of category c for client k; This represents the summation of all batches of data for client k with respect to category c, divided by the total number of batches to obtain the average.
3. The federalized damping forgetting method according to claim 1, characterized in that, In step S2, the Fisher information matrices corresponding to data subsets belonging to the same category from all clients are aggregated to obtain global Fisher information matrices for all parameters of the pre-trained global model corresponding to each category. Specifically: In formula (3): This represents the global Fisher information matrix corresponding to category c obtained from aggregation; Indicates the total number of clients; Indicates the client The total number of image samples of category c in the uploaded local dataset; This represents the Fisher information matrix corresponding to category c uploaded by client k.
4. The federalized damping forgetting method according to claim 1, characterized in that, In step S2, the global Fisher information matrix corresponding to the target forgotten category is aggregated across categories, specifically as follows: In equation (4): This represents the first target importance matrix corresponding to the target forgetting category. Each component measures the parameters of the pre-trained global model. The importance of target forgetting categories; Indicates the category obtained from aggregation The i-th component in the global Fisher information matrix, where j ranges from 1 to m; This means selecting the maximum value from the i-th component of the global information matrix corresponding to the m forgotten target categories, and constructing it as the first target importance matrix.
5. The federalized damping forgetting method according to claim 1, characterized in that, In step S2, the global Fisher information matrix corresponding to the retained category is aggregated across categories, specifically as follows: In equation (5): This represents the second objective importance matrix corresponding to the retained categories; This represents the global Fisher information matrix corresponding to category c obtained from the aggregation. Indicates category The total number of image samples across all clients, i.e., the corresponding category in each client. The sum of the sample sizes; This indicates all categories that belong to the reserved category. The calculated results are then summed together.
6. An apparatus for implementing the federally damped forgetting method according to any one of claims 1 to 5, characterized in that, The device includes: The model acquisition module is used to acquire a pre-trained global model. The pre-trained global model is based on the federated learning method and is obtained by training a given initial global model using the client's local dataset. The local dataset is allocated based on the given training dataset and contains image samples of multiple different categories. Image samples of the same category in each client's local dataset are used to construct a data subset of the corresponding category on the client. The model parameter reduction module is used to randomly select one or more categories from the training dataset as target forgetting categories, and the remaining categories as retention categories. It constructs a forgetting class set from the data subsets belonging to the target forgetting categories in the local datasets of all clients, and constructs a retention class set from the data subsets belonging to the retention categories. It calculates the Fisher information matrix of all parameters of the pre-trained global model on the forgetting class set and the retention class set respectively, so as to filter the model parameters to be reduced and perform reduction. Then, it updates the pre-trained global model based on the reduced model parameters. The model post-training module is used to perform post-training on the updated pre-trained global model using image samples from the reserved class set of the local dataset to obtain the target global model.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory that stores instructions that, when executed by the at least one processor, cause the at least one processor to perform the federally damped forgetting method as described in any one of claims 1 to 5.
8. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores executable instructions that, when executed, cause the machine to perform the federally damped forgetting method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Federal category forgetting learning method based on noise adversarial training
CN119849601A
Federal forgetting learning method and device, equipment and medium
CN120354967A
Federal category forgetting method based on label reconstruction and collaborative compression
CN121212272A