A method, system, device and medium for improving privacy based on federated learning

By decoupling the model into feature extractors and classifiers, and using the SAM optimizer and differential privacy mechanism in federated learning, the problem of excessive noise caused by differential privacy in federated learning is solved, and the model performance and generalization capabilities are improved. .

CN118350051BActive Publication Date: 2024-08-23JIANGXI PROVINCIAL CYBER SECURITY RES INST (JIANGXI PROVINCIAL INDUSTRIAL AND INFORMATION PROD SUPERVISION AND INSPECTION INST JIANGXI PROVINCIAL CONFIDENTIALITY TECH EVALUATION CENT)
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410774695.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-08-23
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

When federated learning uses differential privacy, it causes great distortion in local updates and affects the performance of the global model. The improvement effect of existing technology is limited, and personalized federated learning fails to deeply combine differential privacy and federated learning.

Method used

By decoupling the model into a feature extractor and a classifier, only sharing the feature extractor parameters, the SAM optimizer is used to add gradient perturbation to the local model, and the differential privacy mechanism is combined to add noise to reduce the impact of noise on the model.

Benefits of technology

It effectively reduces the impact of noise on the model, improves model performance, and maintains the classification characteristics of local data and the generalization ability of the global model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118350051B
    Figure CN118350051B
Patent Text Reader

Abstract

The present invention proposes a method, system, device and medium for improving privacy based on federated learning, the method comprising: building a federated learning training platform, setting up a server and a client; obtaining a sample data set, and distributing the sample data set to different clients; using the server to determine a global model, selecting clients to jointly conduct this round of model training, and sending the global model to the selected clients; the client updates the global model to the local model, uses local data to perform multiple rounds of iterative training on the updated local model, and calculates the update information to be uploaded; uses differential privacy to perturb the update information to achieve privacy protection processing, and uploads the processed update information to the server; the server performs weighted aggregation on the global model of the selected client according to the update information, and uses the aggregation result to update the global model; determines whether the global model meets the preset standard; if so, ends the operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security and machine learning technology, and more specifically to a privacy enhancement method, system, device and medium based on federated learning. Background Art

[0002] Federated learning (FL), as an emerging distributed machine learning paradigm, effectively solves the problem of data silos. Although federated learning can complete model training by collaborating with each client without sharing local data, there is still a risk of privacy leakage in federated learning. For example, attackers use the interactive information of the training process to infer members or data features in the client data, or reconstruct the client's private data. In order to alleviate such privacy leakage risks, differential privacy is used to protect the security of interactive information in the federated learning training process.

[0003] At present, in order to protect the privacy information of the client, the instance-level differential privacy scheme that protects each data instance of the client and the user-level differential privacy scheme that protects the interactive information between the client and the server are generally used. The two schemes protect the private transmission data in federated learning from different angles. Instance-level privacy protection can better protect the privacy information of a single data, while user-level differential privacy has better performance in actual application scenarios.

[0004] Due to the combination of federated learning and differential privacy, it mainly reduces the privacy of model update information by smoothing the model update information using the sensitivity threshold S and adding noise to the smoothed update information. However, due to the large differences in data distribution in the real world, there will inevitably be a large difference between the global optimal model and the client's local model. Therefore, when using the smoothing operation of differential privacy, federated learning will cause great distortion of local updates, and ultimately lead to a sharp decline in the expressiveness of the global model. In this regard, the relevant technology uses sparse technology and limits the norm of local updates to reduce the impact of differential privacy on federated learning, but the actual improvement effect is also very limited, and limiting the norm of local updates will reduce the expressiveness of the model to a certain extent.

[0005] In addition, related technologies also use personalized federated learning to divide the model into two parts: feature extractor and classifier. In actual training, the client implements differential privacy on the model update information of the feature extractor and interacts with the server to reduce the amount of noise. However, this method only applies differential privacy to personalized federated learning, and does not conduct in-depth analysis on the effective combination of differential privacy and federated learning. Summary of the invention

[0006] In response to the above problems, the purpose of the present invention is to provide a privacy enhancement method, system, device and medium based on federated learning, which effectively improves the expressiveness of the differential privacy federated learning algorithm by implementing a personalized federated learning method based on local SAM optimization of the local model.

[0007] In order to achieve the above-mentioned purpose, the present invention is implemented through the following technical scheme: a method for improving privacy based on federated learning, comprising the following steps:

[0008] S1: Build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model;

[0009] S2: Obtain a sample data set and distribute the sample data set to different clients according to the number of clients;

[0010] S3: Use the server to determine a global model, select a corresponding number of clients according to the specified sample rate to jointly conduct this round of model training, and send the global model to the selected clients;

[0011] S4: The selected client receives the global model sent by the server, updates the global model to the local model, performs multiple rounds of iterative training on the updated local model using local data, and calculates the update information to be uploaded;

[0012] S5: Use differential privacy to perturb the update information to be uploaded to achieve privacy protection, and upload the processed update information to the server;

[0013] S6: After receiving the update information uploaded by all selected clients, the server performs weighted aggregation on the global models of the selected clients according to the update information, and updates the global model using the aggregation result;

[0014] S7: Determine whether the global model meets the preset standard; if so, end the operation; if not, return to step S3.

[0015] Further, the step S2 comprises:

[0016] Obtain a sample data set and distribute it to different clients according to independent and identical distribution based on the number of clients, simulating that each client has its own sample data set and does not directly share the sample data set with other clients.

[0017] Further, the step S3 comprises:

[0018] A global model is determined by the server side, and the global model parameter θ is divided into two parts: ;in represents the parameters of the feature extractor, Represents the parameters of the local classifier;

[0019] The global model is represented as ;in, It represents a feature extractor, which is used to extract data information of different distributions into the same feature space; Represents a personalized classifier, which is used to convert data in the feature space into specific labels. represents the Hadamard product;

[0020] The federated learning optimization objective function is as follows:

[0021]

[0022]

[0023] The optimization goal is to collaboratively learn a feature extractor , Represents the local data of the i-th client, represents the jth input sample in the i-th client data, represents the label of the jth input sample in the i-th client data, represents the parameters of the feature extractor, represents the parameters of the local classifier, represents the feature extractor, represents the personalized classifier, l represents the loss function, N represents the number of clients, represents the minimum value; each client can take advantage of the feature extractor Personalized classifier Personalized training;

[0024] The feature extractor of the global model is denoted as feature extractor , the feature extractor Send to the selected client.

[0025] Further, the step S4 comprises:

[0026] The selected client receives the feature extractor Finally, the local model is decoupled into a feature extractor and a personalized classifier, the personalized classifier is frozen, and the feature extractor is used to Update the local model’s feature extractor with the parameters Parameters;

[0027] Start the feature extractor The training process;

[0028] The training process includes:

[0029] Select a specified number of data samples from the local sample data set and use the formula Calculate its sample gradient ;in, is the loss function defined in the SAM optimizer, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for the local training round; using the formula Calculate the gradient perturbation added to the model parameters ;in, To control the hyperparameters of the disturbance, is the sample gradient of the sth round of the ith client in the tth global training round, The symbol for the gradient, represents the q-th power of its q-norm;

[0030] Perturb the gradient Add to the parameter information of the feature extractor to get the parameters of the new feature extractor ;

[0031] Based on the parameters of the newly obtained feature extractor and the data sample, the formula Update the sample gradient; where, is the sample gradient of the sth round of the ith client in the tth global training round, is the loss function defined in the SAM optimizer, is the gradient perturbation, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, It means to find the gradient;

[0032] Based on the updated sample gradient, according to the formula Update the parameters of the feature extractor;

[0033] in, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, is the learning rate, is the sample gradient of the sth round of the ith client in the tth global training round, Represents the i-th client in the t-th global training round +1 parameter of the feature extractor for local training epoch.

[0034] Further, the step S5 comprises:

[0035] Obtaining a norm value of the update information, and clipping the update information based on a comparison result between the norm value and a clipping threshold;

[0036] Obtain the Gaussian noise that needs to be added to the update information according to the differential privacy mechanism, and add the Gaussian noise to the cropped update information;

[0037] Upload the current update information to the server.

[0038] Further, the step S5 is specifically as follows:

[0039] Get the updated parameters of the feature extractor , recorded as update information; among them, are the parameters of the feature extractor before updating;

[0040] Select the pruning threshold C that ensures the optimal model and prune the update information. The pruning method is as follows:

[0041] ;

[0042] in, indicates that the update parameters have not changed, represents the 2-norm of the updated parameters, represents the clipping threshold, represents the threshold after clipping, Indicates finding the minimum value;

[0043] According to differential privacy, Gaussian noise is added to the pruned update information. The noise addition result of the update information is as follows:

[0044] ;

[0045] in, represents the threshold after clipping, represents Gaussian noise that follows a normal distribution, represents the noise factor, represents the clipping threshold, Represents the number of clients selected in each round, Represents the updated information after cropping and adding noise;

[0046] Based on the noise addition result of the update information, the current update information is uploaded to the server.

[0047] Further, performing weighted aggregation on the global model of the selected client according to the update information includes:

[0048] Using the formula Perform weighted aggregation on the global model; where represents the global learning rate, Represents the parameters of the feature extractor that are not updated in this round, Represents the number of selected clients. Represents the parameter information of the feature extractor updated by different clients, Represents the parameter information after update.

[0049] Furthermore, the preset standard is specifically:

[0050] The accuracy of the current global model reaches the specified accuracy and the current model training times reaches the preset global training rounds.

[0051] Correspondingly, the present invention also discloses a privacy enhancement system based on federated learning, comprising:

[0052] The platform building module is used to build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model;

[0053] A data processing module is used to obtain a sample data set and distribute the sample data set to different clients according to the number of clients;

[0054] The model delivery module is used to determine a global model using the server, select a corresponding number of clients according to the specified sample rate to jointly conduct this round of model training, and deliver the global model to the selected clients;

[0055] The model update training module is used for the selected client to update the global model to the local model after receiving the global model sent by the server, perform multiple rounds of iterative training on the updated local model using local data, and calculate the update information to be uploaded;

[0056] The noise adding module is used to use differential privacy to perturb the update information to be uploaded, implement privacy protection processing, and upload the processed update information to the server;

[0057] An aggregation update module, which is used to perform weighted aggregation on the global models of the selected clients according to the update information after the server receives the update information uploaded by all the selected clients, and update the global model using the aggregation result;

[0058] The judgment module is used to judge whether the global model meets the preset standards.

[0059] Accordingly, the present invention discloses a privacy enhancement device based on federated learning, comprising:

[0060] Storage, used to store the privacy-enhancing program based on federated learning;

[0061] A processor is used to implement the steps of the privacy enhancement method based on federated learning as described in any of the above items when executing the privacy enhancement program based on federated learning.

[0062] Correspondingly, the present invention discloses a readable storage medium, on which a privacy enhancement program based on federated learning is stored. When the privacy enhancement program based on federated learning is executed by a processor, the steps of the privacy enhancement method based on federated learning as described in any of the above items are implemented.

[0063] Compared with the prior art, the beneficial effect of the present invention is that the present invention discloses a privacy enhancement method, system, device and medium based on federated learning, which effectively reduces the amount of noise added to the update information and reduces the impact of noise on the model update. First, the present invention decouples the model into two parts: a feature extractor and a classifier. During the training process, the client only shares the parameters of the feature extractor with the server and keeps the classifier parameters locally. Therefore, the range of the client updating parameters is effectively narrowed, thereby reducing the impact of differential privacy. In addition, the present invention better utilizes the global model information in heterogeneous scenarios while retaining the classification characteristics of local data. Secondly, the present invention uses a sharp aware minimization (SAM) optimizer to train the local model. The main goal is to add gradient perturbations to the local model to make the training loss landscape of the local model flatter, thereby improving the performance of the model. Different from the typical combination of federated learning and SAM, the present invention uniquely applies SAM optimization to shared parameters, which not only effectively guarantees the generalization of shared parameters, but also maintains the personalization of the local model classifier. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0065] Figure 1 It is a method flow chart of a specific implementation mode of the present invention.

[0066] Figure 2 It is a system structure diagram of a specific implementation mode of the present invention.

[0067] In the figure, 1. Platform building module; 2. Data processing module; 3. Model distribution module; 4. Model update training module; 5. Noise addition module; 6. Aggregation update module; 7. Judgment module. DETAILED DESCRIPTION

[0068] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] See also Figure 1 As shown, this embodiment provides a privacy enhancement method based on federated learning, including:

[0070] S1: Build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model.

[0071] In a specific implementation, a federated learning training platform is built. Federated learning uses clients with different training data to jointly train to obtain the final global model. Therefore, federated learning mainly includes two parts: a server and multiple clients. First, a server is set up using the federated learning training platform, which is responsible for deploying all clients. In the actual training process, a model needs to undergo multiple rounds of training to obtain the final global model. It should be noted that in the federated learning training platform, the server determines and sends and receives the global model, the client has its own privacy data and performs local update training on the global model sent down.

[0072] S2: Obtain a sample data set, and distribute the sample data set to different clients according to the number of clients.

[0073] In a specific implementation, a sample data set is obtained and distributed to different clients according to independent and identical distribution according to the number of clients, simulating that each client has its own sample data set and does not directly share the sample data set with other clients.

[0074] S3: Use the server to determine a global model, select a corresponding number of clients according to the specified sample rate to jointly conduct this round of model training, and send the global model to the selected clients.

[0075] In the specific implementation, first, a global model is determined by the server. In this method, the goal of federated learning is to focus on learning data representation, that is, the information aggregated by the global model only contains the part extracted by the feature extractor, which can not only reduce the amount of information uploaded by the model itself, but also effectively reduce the differences in model parameters shared by different clients. This double guarantee promotes the effective combination of federated learning and differential privacy. In order to achieve this goal, the global model parameter θ is divided into two parts: ,in represents the parameters of the feature extractor, Represents the parameters of the local classifier.

[0076] Then, the global model is expressed as ;in, It represents a feature extractor, which is used to extract data information of different distributions into the same feature space; Represents a personalized classifier, which is used to convert data in the feature space into specific labels. Represents the Hadamard product.

[0077] Based on the setting of the global model, the federated learning optimization problem can be expressed as the following function:

[0078]

[0079]

[0080] The optimization goal is to collaboratively learn a feature extractor , Represents the local data of the i-th client, represents the jth input sample in the i-th client data, represents the label of the jth input sample in the i-th client data, represents the parameters of the feature extractor, represents the parameters of the local classifier, represents the feature extractor, represents the personalized classifier, l represents the loss function, N represents the number of clients, represents the minimum value; each client can take advantage of the feature extractor Personalized classifier The purpose of personalized training is to maximize the global benefit of the feature extractor while ensuring the effective use of local data.

[0081] Finally, the feature extractor of the global model is denoted as feature extractor , the feature extractor Send to the selected client.

[0082] In addition, it should be noted that before the feature extractor is sent down, all clients that can participate in the training need to be set to an activated state and wait for the server to call.

[0083] S4: The selected client receives the global model sent by the server, updates the global model to the local model, performs multiple rounds of iterative training on the updated local model using local data, and calculates the update information to be uploaded.

[0084] In a specific embodiment, the selected client receives the feature extractor Finally, the local model is decoupled into a feature extractor and a personalized classifier, the personalized classifier is frozen, and the feature extractor is used to Update the local model’s feature extractor with the parameters Parameters.

[0085] At this point, start the feature extractor The training process includes:

[0086] Select a specified number of data samples from the local sample data set and use the formula Calculate its sample gradient .in, is the loss function defined in the SAM optimizer, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round.

[0087] Using the formula Calculate the gradient perturbation added to the model parameters ,in, To control the hyperparameters of the disturbance, is the sample gradient of the sth round of the ith client in the tth global training round, The symbol for the gradient, represents the q-norm raised to the qth power.

[0088] Perturb the gradient Add to the parameter information of the feature extractor to get the parameters of the new feature extractor .

[0089] Based on the newly obtained feature extractor parameters and the same data sample, the formula Update the sample gradient. Among them, is the sample gradient of the sth round of the ith client in the tth global training round, is the loss function defined in the SAM optimizer, is the gradient perturbation, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, It means to find the gradient.

[0090] Based on the updated sample gradient, according to the formula Update the parameters of the feature extractor. Among them, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, is the learning rate, is the sample gradient of the sth round of the ith client in the tth global training round, Represents the i-th client in the t-th global training round +1 parameter of the feature extractor for local training epoch.

[0091] It should be noted that in the training method of personalized federated learning, the client only needs to upload the updated part of the feature extractor parameters, which reduces the noise of the updated parameters to a certain extent, but the noise of the updated information of the feature extractor is still not reduced. Therefore, the SAM optimizer is introduced here to alleviate the problem of reduced model performance caused by differential privacy. In SAM, the loss function of local training is defined as follows:

[0092] ;

[0093] in, The model parameters disturbed in this round of training, that is, before updating the local model, a certain amount of interference information is added to the model parameters to make the model training loss performance flatter. The traditional way to use SAM to help model training is to perform interference training on the entire local model. However, this step uses personalized federated learning, which does not directly use SAM to perform generalization analysis on the entire local model. Through the decoupling method, the client only shares part of the model data corresponding to the feature extractor. Therefore, SAM optimization is only applied in the training process of the feature extractor. The personalized learning algorithm used here is based on FedRep, and its training process is mainly divided into two parts: First, when the client receives the globally shared feature extractor parameters from the global feature extractor, it updates its local feature extractor parameters and freezes these parameters. Then, update the local personalized classifier. The classifier undergoes multiple rounds of updates as follows:

[0094]

[0095]

[0096] in represents the learning rate. Once the local personalized classifier is updated, this method starts the feature extractor update process. Note that during the feature extractor update, the local personalized classifier parameters remain frozen. Following the optimization strategy of SAM, the feature extractor in this step undergoes multiple rounds of optimization as shown below:

[0097]

[0098]

[0099]

[0100] Analyzing the above results, the phased training of the feature extractor and classifier not only effectively utilizes the feature representations from different clients, but also can learn personalized models from local data.

[0101] S5: Use differential privacy to perturb the update information to be uploaded to achieve privacy protection processing, and upload the processed update information to the server.

[0102] In a specific implementation, first, the norm value of the update information is obtained, and the update information is clipped based on the comparison result of the norm value and the clipping threshold. Then, the Gaussian noise that needs to be added to the update information is obtained according to the differential privacy mechanism, and the Gaussian noise is added to the clipped update information. Finally, the current update information is uploaded to the server.

[0103] As an example, the specific process of this step is as follows:

[0104] 1. Get the updated parameters of the feature extractor , recorded as update information, are the parameters of the feature extractor before updating.

[0105] 2. Select the clipping threshold C that ensures the optimal model and clip the update information. The clipping method is as follows:

[0106] ;

[0107] in, indicates that the update parameters have not changed, represents the 2-norm of the updated parameters, represents the clipping threshold, represents the threshold after clipping, Indicates finding the minimum value.

[0108] 3. After cropping, we add Gaussian noise to the cropped local update to ensure user-level differential privacy, that is, according to differential privacy, Gaussian noise is added to the cropped update information. The noise addition result of the update information is as follows:

[0109] ;

[0110] in, represents the threshold after clipping, represents Gaussian noise that follows a normal distribution, represents the noise factor, represents the clipping threshold, Represents the number of clients selected in each round, Represents the updated information after cropping and adding noise.

[0111] It should be noted that the privacy guarantee added by Gaussian noise comes from differential privacy. The definition of differential privacy is as follows: if a random algorithm satisfy( )-Differential privacy, if for any adjacent dataset , any subset of the output , we can get: ,in, represents the privacy budget, It represents the probability of failure of the algorithm in preserving privacy.

[0112] 4. Based on the noise addition result of the update information, upload the current update information to the server.

[0113] It should be noted that the application of traditional differential privacy to federated learning will introduce too much noise, which may cause the final model to fail to converge. To address this, this method introduces the more adaptable Ruili differential privacy. Given a real number and privacy parameters If any adjacent dataset There is only one different record, random algorithm satisfy( )-RDP, then Rayleigh divergence and satisfy:

[0114]

[0115] in, represents the order of Rayleigh divergence, which is used to measure the difference between two probability distributions. Adding noise to the model output in this way depends on the sensitivity of the model update data, so the local update information is clipped before adding noise. The sensitivity involved here is defined as follows: is a function whose sensitivity is , where the maximization is performed over all pairs of adjacent datasets.

[0116] In addition, the purpose of introducing noise in federated learning is to better protect local privacy data from being leaked, but the introduction of noise also causes a significant decrease in the accuracy of the federated learning algorithm. Therefore, the personalized federated learning algorithm (PFL) is introduced. It can not only effectively learn global representations, but also obtain better local models based on the distribution characteristics of local data. In federated learning tasks such as image classification, the data representations between different clients show minimal differences. The data representation here specifically refers to the information processed by the feature extractor. The implementation of user-level differential privacy in federated learning is to ensure that it is difficult for attackers to identify the true information of a certain client's data. Therefore, the smaller the difference in the distribution of updated data between clients, the smaller the impact of differential privacy on the client.

[0117] S6: After receiving the update information uploaded by all selected clients, the server performs weighted aggregation on the global models of the selected clients according to the update information, and updates the global model using the aggregation result.

[0118] In a specific embodiment, the formula Perform weighted aggregation on the global model. represents the global learning rate, Represents the parameters of the feature extractor that are not updated in this round, Represents the number of selected clients. Represents the parameter information of the feature extractor updated by different clients, Represents the parameter information after update.

[0119] S7: Determine whether the global model meets the preset standard; if so, end the operation; if not, return to step S3.

[0120] In a specific implementation, it is determined whether the accuracy of the current global model reaches the specified accuracy and whether the number of current model training reaches the preset global training rounds. If so, the operation is terminated; if not, it returns to step S3.

[0121] The present invention discloses a method for improving privacy based on federated learning. Aiming at the problem of adding too much noise to the update information of the local client of traditional differential privacy federated learning, a method using a decoupled training model and local local SAM optimization is proposed. This method changes the local update information from uploading all to uploading only the feature extractor part, thereby reducing the amount of noise added to the entire model. In the local training stage, SAM optimization is introduced to reduce the impact of noise addition, thereby further improving the expressiveness of the model.

[0122] In a specific implementation, based on the above embodiment, the present invention further discloses a privacy enhancement method based on federated learning, and the specific steps are as follows:

[0123] 1) Build a federated learning algorithm platform, including a server and multiple clients. The server determines and sends and receives the global model. The client has its own private data and performs local update training on the global model.

[0124] 2) Obtain sample data sets and distribute them to different clients according to independent and identical distribution.

[0125] 3) The server determines a global model, selects a portion of the activated clients to update the global model in this round, and sends the global model to these clients.

[0126] 4) The client obtains the global model sent by the server. The global model received here is not the traditional entire model, but a part of the entire model, namely the feature extractor , and then update the feature extractor of the local model .

[0127] 5) The client trains the entire model in stages, first freezing the parameters of the updated feature extractor , train the local personalized classifier normally First, select a specified number of samples in the local data and calculate their sample gradients , and then update the local personalized classifier According to the specified local training round requirements, the above steps of calculating sample gradients and updating the local personalized classifier are continuously performed.

[0128] 6) The client trains the feature extractor of the local model , freeze the parameters of the local personalized classifier, and then update the parameters of the local feature extraction part. Select a specified number of samples in the local data and calculate their sample gradients , which is used to calculate the gradient perturbation added to the model parameters. The perturbation calculation formula is , and then add the calculation results to the parameter information of the feature extractor to obtain the parameters of the new feature extractor , using the newly obtained feature extractor parameters and the same data sample to calculate the gradient of the updated local model , using the calculated gradient to update the parameters of the local feature extractor .

[0129] 7) The client calculates the update information of the local model based on the training results .

[0130] 8) The client implements differential privacy protection C based on the updated information. First, the updated information is pruned using a pre-selected pruned threshold. , Secondly, add a certain amount of noise to the cropped information . Finally, the updated information will be processed Upload to the server.

[0131] 9) The server receives update information from each client and aggregates it , test the average performance of the model of each client. If it meets the expectation or reaches the specified global training round, the training is terminated. If it does not meet the expectation, repeat 3)-9).

[0132] A privacy enhancement method based on federated learning proposed in an embodiment of the present invention can effectively improve the expressiveness of the differential privacy federated learning algorithm. First, the method decouples the local model into two parts: a feature extractor and a personalized classifier. The data information exchanged between the client and the server is the client feature extractor update part. Secondly, the method performs training in stages during local training. The first step is to freeze the feature extractor parameters and train the parameters of the personalized classifier; the second step is to freeze the personalized classifier parameters and use the SAM optimizer to train the local feature extractor. Finally, differential privacy is used to perturb the update of the locally trained feature extractor parameters, and the interaction between the client and the server is completed.

[0133] In this embodiment, the model decoupling method is used to effectively reduce the noise directly added to the model parameters, ensuring the accuracy of the model parameters. At the same time, the personalized classifier is stored locally to effectively solve the problem of data heterogeneity, that is, a common feature classifier is learned through a federated learning algorithm, but the personalized classifier is always stored locally, which can effectively retain the classification characteristics of local data. Secondly, the feature extractor part of the local model is efficiently trained using the SAM optimizer, which can effectively reduce the impact of differential privacy noise. Ultimately, an efficient trade-off between data privacy and model effectiveness in federated learning is achieved.

[0134] See also Figure 2 As shown, the present invention also discloses a privacy enhancement system based on federated learning, which adopts any of the privacy enhancement methods based on federated learning described above. The system includes: a platform building module 1, a data processing module 2, a model delivery module 3, a model update training module 4, a noise adding module 5, an aggregation update module 6 and a determination module 7.

[0135] Platform building module 1 is used to build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model.

[0136] The data processing module 2 is used to obtain a sample data set and distribute the sample data set to different clients according to the number of clients.

[0137] The model delivery module 3 is used to determine a global model using the server, select a corresponding number of clients according to the specified sample rate to jointly perform this round of model training, and deliver the global model to the selected clients.

[0138] The model update training module 4 is used for the selected client to update the global model to the local model after receiving the global model sent by the server, perform multiple rounds of iterative training on the updated local model using local data, and calculate the update information to be uploaded.

[0139] The noise adding module 5 is used to use differential privacy to disturb the update information to be uploaded, realize privacy protection processing, and upload the processed update information to the server.

[0140] The aggregation update module 6 is used to perform weighted aggregation on the global models of the selected clients according to the update information after the server receives the update information uploaded by all the selected clients, and update the global model using the aggregation result.

[0141] The determination module 7 is used to determine whether the global model meets the preset standard.

[0142] The specific implementation of the privacy enhancement system based on federated learning in this embodiment is basically the same as the specific implementation of the privacy enhancement method based on federated learning mentioned above, and will not be repeated here.

[0143] The present invention also discloses a privacy enhancement device based on federated learning, comprising a processor and a memory; wherein, when the processor executes a privacy enhancement program based on federated learning stored in the memory, it implements the steps of the privacy enhancement method based on federated learning as described in any of the above items.

[0144] Furthermore, the privacy enhancement device based on federated learning in this embodiment may also include:

[0145] The input interface is used to obtain the privacy enhancement program based on federated learning imported from the outside, and save the obtained privacy enhancement program based on federated learning to the memory, and can also be used to obtain various instructions and parameters transmitted by external terminal devices, and transmit them to the processor, so that the processor can use the above various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface can specifically include but is not limited to a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, etc.

[0146] The output interface is used to output various data generated by the processor to the terminal device connected thereto, so that other terminal devices connected to the output interface can obtain various data generated by the processor. In this embodiment, the output interface may specifically include but is not limited to a USB interface, a serial interface, etc.

[0147] A communication unit is used to establish a remote communication connection between the privacy enhancement device based on federated learning and an external server, so that the privacy enhancement device based on federated learning can mount the image file to the external server. In this embodiment, the communication unit may specifically include but is not limited to a remote communication unit based on wireless communication technology or wired communication technology.

[0148] The keyboard is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.

[0149] A display for real-time display of relevant information about the privacy improvement process based on federated learning.

[0150] The mouse can be used to assist users in inputting data and simplify user operations.

[0151] The present invention also discloses a readable storage medium, wherein the readable storage medium includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable hard disk, a CD-ROM, or any other form of storage medium known in the technical field. The readable storage medium stores a privacy enhancement program based on federated learning, and when the privacy enhancement program based on federated learning is executed by a processor, the steps of the privacy enhancement method based on federated learning as described in any one of the above items are implemented.

[0152] In summary, the present invention effectively improves the expressiveness of the differential privacy federated learning algorithm by implementing a personalized federated learning method based on local SAM optimization of the local model.

[0153] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. As for the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0154] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0155] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0156] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0157] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.

[0158] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.

[0159] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0160] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0161] The above is a detailed introduction to the privacy enhancement method, system, device and readable storage medium based on federated learning provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A privacy enhancement method based on federated learning, characterized in that: The steps include: S1: Build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model; S2: Obtain a sample data set and distribute the sample data set to different clients according to the number of clients; S3: Use the server to determine a global model, select a corresponding number of clients according to the specified sample rate to jointly conduct this round of model training, and send the global model to the selected clients; S4: The selected client receives the global model sent by the server, updates the global model to the local model, performs multiple rounds of iterative training on the updated local model using local data, and calculates the update information to be uploaded; S5: Use differential privacy to perturb the update information to be uploaded to achieve privacy protection, and upload the processed update information to the server; S6: After receiving the update information uploaded by all selected clients, the server performs weighted aggregation on the global models of the selected clients according to the update information, and updates the global model using the aggregation result; S7: Determine whether the global model meets the preset standard; if so, end the operation; if not, return to step S3; The step S3 comprises: A global model is determined by the server side, and the global model parameter θ is divided into two parts: ;in represents the parameters of the feature extractor, Represents the parameters of the local classifier; The global model is represented as ;in, It represents a feature extractor, which is used to extract data information of different distributions into the same feature space; Represents a personalized classifier, which is used to convert data in the feature space into specific labels. represents the Hadamard product; The optimization objective function of the federated learning is as follows: ; The optimization goal is to collaboratively learn a feature extractor , Represents the local data of the i-th client, represents the jth input sample in the i-th client data, represents the label of the jth input sample in the i-th client data, represents the parameters of the feature extractor, represents the parameters of the local classifier, represents the feature extractor, represents the personalized classifier, l represents the loss function, N represents the number of clients, Indicates the minimum value; The feature extractor of the global model is denoted as feature extractor , the feature extractor Send it to the selected client; The step S4 comprises: The selected client receives the feature extractor Finally, the local model is decoupled into a feature extractor and a personalized classifier, the personalized classifier is frozen, and the feature extractor is used to Update the local model’s feature extractor with the parameters Parameters; Start the feature extractor The training process; The training process includes: Select a specified number of data samples from the local sample data set and use the formula Calculate its sample gradient ;in, is the loss function defined in the SAM optimizer, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round; Using the formula Calculate the gradient perturbation added to the model parameters ;in, To control the hyperparameters of the disturbance, is the sample gradient of the sth round of the ith client in the tth global training round, The symbol for the gradient, represents the q-th power of its q-norm; Perturb the gradient Add to the parameter information of the feature extractor to get the parameters of the new feature extractor ; Based on the parameters of the newly obtained feature extractor and the data sample, the formula Update the sample gradient; where, is the sample gradient of the sth round of the ith client in the tth global training round, is the loss function defined in the SAM optimizer, is the gradient perturbation, Represents the number of times the i-th client has passed in the t-th global training round The parameters of the local classifier for the local training round, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, It means to find the gradient; Based on the updated sample gradient, according to the formula Update the parameters of the feature extractor; where, Represents the i-th client in the t-th global training round The parameters of the feature extractor for each local training round, is the learning rate, is the sample gradient of the sth round of the ith client in the tth global training round, Represents the i-th client in the t-th global training round +1 parameter of the feature extractor for local training epoch.

2. The method for improving privacy based on federated learning according to claim 1, characterized in that: The step S2 comprises: Obtain a sample data set and distribute it to different clients according to independent and identical distribution based on the number of clients, simulating that each client has its own sample data set and does not directly share the sample data set with other clients.

3. The method for improving privacy based on federated learning according to claim 1, characterized in that: The step S5 comprises: Obtaining a norm value of the update information, and clipping the update information based on a comparison result between the norm value and a clipping threshold; Obtain the Gaussian noise that needs to be added to the update information according to the differential privacy mechanism, and add the Gaussian noise to the cropped update information; Upload the current update information to the server.

4. The method for improving privacy based on federated learning according to claim 3, characterized in that: The step S5 is specifically as follows: Get the updated parameters of the feature extractor , recorded as update information; among them, are the parameters of the feature extractor before updating; Select the pruning threshold C that ensures the optimal model and prune the update information. The pruning method is as follows: ; in, indicates that the update parameters have not changed, represents the 2-norm of the updated parameters, represents the clipping threshold, represents the threshold after clipping, Indicates finding the minimum value; According to differential privacy, Gaussian noise is added to the pruned update information. The noise addition result of the update information is as follows: ; in, represents the threshold after clipping, represents Gaussian noise that follows a normal distribution, represents the noise factor, represents the clipping threshold, Represents the number of clients selected in each round, Represents the updated information after cropping and adding noise; Based on the noise addition result of the update information, the current update information is uploaded to the server.

5. The method for improving privacy based on federated learning according to claim 4, characterized in that: The weighted aggregation of the global model of the selected client according to the update information includes: Using the formula Perform weighted aggregation on the global model; where represents the global learning rate, Represents the parameters of the feature extractor that are not updated in this round, Represents the number of selected clients. Represents the parameter information of the feature extractor updated by different clients, Represents the parameter information after update; The preset standards are specifically: The accuracy of the current global model reaches the specified accuracy and the current model training times reaches the preset global training rounds.

6. A privacy enhancement system based on federated learning, characterized in that: The system adopts the privacy enhancement method based on federated learning as described in any one of claims 1 to 5, and the system includes: The platform building module is used to build a federated learning training platform, set up a server and multiple clients, use the server to deploy all clients, and use clients with different training data to conduct multiple rounds of training to obtain the final global model; A data processing module is used to obtain a sample data set and distribute the sample data set to different clients according to the number of clients; The model delivery module is used to determine a global model using the server, select a corresponding number of clients according to the specified sample rate to jointly conduct this round of model training, and deliver the global model to the selected clients; The model update training module is used for the selected client to update the global model to the local model after receiving the global model sent by the server, perform multiple rounds of iterative training on the updated local model using local data, and calculate the update information to be uploaded; The noise adding module is used to use differential privacy to perturb the update information to be uploaded, implement privacy protection processing, and upload the processed update information to the server; An aggregation update module, which is used to perform weighted aggregation on the global models of the selected clients according to the update information after the server receives the update information uploaded by all the selected clients, and update the global model using the aggregation result; The judgment module is used to judge whether the global model meets the preset standards.

7. A privacy enhancement device based on federated learning, characterized in that: include: Storage, used to store the privacy-enhancing program based on federated learning; A processor, configured to implement the steps of the privacy enhancement method based on federated learning as described in any one of claims 1 to 5 when executing the privacy enhancement program based on federated learning.

8. A readable storage medium, characterized in that: The readable storage medium stores a privacy enhancement program based on federated learning, and when the privacy enhancement program based on federated learning is executed by a processor, the steps of the privacy enhancement method based on federated learning as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Federated learning global model training method based on differential privacy and quantization

    CN113591145B

  • Personalized federal learning method applied to privacy calculation

    CN115660107A

  • Federal learning model training privacy protection method and system based on hybrid strategy

    CN116167084A

  • Lightweight user privacy protection system and method based on federal learning

    CN118013585A

  • User-level Privacy Preservation for Federated Machine Learning

    US20230047092A1