Method, device and equipment for detecting poisoning attacks in federated learning
By receiving terminal device side model parameters for aggregation and inversion, a poisoning patch is generated to determine whether the federated learning model is poisoned, which solves the problem of lack of effective detection methods in the existing technology, improves detection efficiency and model performance, and ensures data security.
Patent Information
- Application Number
- CN202011463000.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-12-11
AI Technical Summary
The existing technology lacks an effective federated learning poisoning attack detection method, resulting in a high success rate for malicious participants to attack the federated learning model and the inability to effectively prevent poisoning attacks.
By receiving the parameters of the terminal device side model, performing aggregation processing and inversion, generating poisoning patches, and judging whether the aggregated model is a normal model, it improves the efficiency of poisoning attack detection and ensures data security and privacy.
It realizes poisoning attack detection on federated learning models, improves detection efficiency and accuracy, ensures the security and privacy of local data on terminal devices, and improves model performance through collaborative training.
Smart Images

Figure CN112528281B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a method, device and equipment for detecting poisoning attacks in federated learning. Background Art
[0002] Federated Learning is an emerging basic technology of artificial intelligence. It was first proposed by Google in 2016. It was originally used to solve the problem of local model update for Android mobile terminal users. Its design goal is to carry out efficient machine learning between multiple participants or multiple computing nodes under the premise of ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legality and compliance. Among them, the machine learning algorithms that can be used in federated learning are not limited to neural networks, but also include important algorithms such as random forests. However, researchers have found that federated learning is vulnerable to attacks by internal participants, called poisoning attacks. The attacker can pretend to be a benign participant and upload poisoned updates to the server so that he can easily affect the performance of the global model.
[0003] Currently, the industry lacks effective methods to detect poisoning attacks on federated learning, which makes it impossible to prevent malicious participants from attacking federated learning models, making the success rate of malicious participants attacking federated learning models high. Therefore, how to detect poisoning attacks on federated learning has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of this application is to provide a method, device and equipment for detecting poisoning attacks in federated learning in response to the above-mentioned deficiencies in the prior art, so as to solve the problem that there is no method for detecting poisoning attacks in federated learning in the prior art, so as to improve the efficiency of finding poisoned backdoors, thereby achieving the purpose of preventing malicious participants from attacking the federated learning model.
[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for detecting a model poisoning attack in federated learning, characterized in that the method comprises:
[0007] Receiving model parameters of a terminal device side model sent by at least one terminal device participating in federated learning;
[0008] Performing aggregation processing according to the model parameters of the terminal device side models to obtain an aggregated model on the server side;
[0009] Inverting the aggregation model to obtain an inversion data set of the aggregation model; generating a poisoning patch according to the inversion data set of the aggregation model;
[0010] According to the poisoned patch, it is determined whether the aggregated model is a normal model.
[0011] Optionally, inverting the aggregation model to obtain an inversion data set of the aggregation model includes:
[0012] The aggregation model is inverted using a preset first objective function to obtain an inversion data set of the aggregation model.
[0013] Optionally, generating a poison patch according to the inversion data set of the aggregation model includes:
[0014] A poisoned patch is generated according to the inversion dataset of the aggregate model and the damaged neurons in the aggregate model.
[0015] Optionally, before generating the poisoning patch based on the inversion data set of the aggregate model and the damaged neurons in the aggregate model, the method further includes:
[0016] A preset second objective function is used to obtain damaged neurons in the aggregation model; wherein the damaged neurons will be abnormally activated under specific inputs.
[0017] Optionally, performing aggregation processing according to the model parameters of the terminal device side models to obtain the aggregated model on the server side includes:
[0018] The preset model aggregation function is used to aggregate the model parameters of each terminal device side model to obtain an aggregate model on the server side.
[0019] Optionally, determining whether the aggregate model is a normal model according to the poisoned patch includes:
[0020] Determine a patch evaluation index value of the poisoned patch; and determine whether the aggregate model is a normal model according to the patch index value.
[0021] Optionally, determining whether the aggregation model is a normal model according to the patch evaluation index value includes:
[0022] If the patch evaluation index value is less than a preset threshold, it is determined that the aggregation model is a normal model.
[0023] Optionally, determining whether the aggregation model is a normal model according to the patch evaluation index value includes:
[0024] If the patch evaluation index value is greater than or equal to a preset threshold, it is determined that the aggregation model is a poisoned model.
[0025] In a second aspect, an embodiment of the present application further provides a model poisoning attack detection device for federated learning, the device comprising: a receiving module, an aggregation module, an inversion module, a generation module and a determination module;
[0026] The receiving module is used to receive model parameters of a terminal device side model sent by at least one terminal device participating in federated learning;
[0027] The aggregation module is used to perform aggregation processing according to the model parameters of the terminal device side models to obtain an aggregate model on the server side;
[0028] The inversion module is used to invert the aggregation model to obtain an inversion data set of the aggregation model;
[0029] The generating module is used to generate a poisoning patch according to the inversion data set of the aggregation model;
[0030] The determination module is used to determine whether the aggregate model is a normal model according to the poisoned patch.
[0031] Optionally, the aggregation module is specifically used to:
[0032] The aggregation model is inverted using a preset first objective function to obtain an inversion data set of the aggregation model.
[0033] Optionally, the generating module is specifically used to:
[0034] A poisoned patch is generated according to the inversion dataset of the aggregate model and the damaged neurons in the aggregate model.
[0035] Optionally, the generating module is further used to:
[0036] A preset second objective function is used to obtain damaged neurons in the aggregation model; wherein the damaged neurons will be abnormally activated under specific inputs.
[0037] Optionally, the generating module is further used to:
[0038] The preset model aggregation function is used to aggregate the model parameters of each terminal device side model to obtain an aggregate model on the server side.
[0039] Optionally, the determining module is specifically configured to:
[0040] Determine a patch evaluation index value of the poisoned patch; and determine whether the aggregate model is a normal model according to the patch evaluation index value.
[0041] Optionally, the determining module is further used to:
[0042] If the patch evaluation index value is less than a preset threshold, it is determined that the aggregation model is a normal model.
[0043] Optionally, the determining module is further used to:
[0044] If the patch evaluation index value is greater than or equal to a preset threshold, it is determined that the aggregation model is a poisoned model.
[0045] In the third aspect, an embodiment of the present application also provides an electronic device, including a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the program instructions to perform the steps of the method provided in the embodiment of the first aspect.
[0046] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method provided in the embodiment of the first aspect are executed.
[0047] The beneficial effects of this application are:
[0048] The present application provides a method, device and equipment for detecting model poisoning attacks in federated learning, the method comprising: receiving model parameters of a terminal device side model sent by at least one terminal device participating in federated learning; performing aggregation processing according to the model parameters of each terminal device side model to obtain an aggregate model on the server side; inverting the aggregate model to obtain an inversion data set of the aggregate model; generating a poison patch according to the inversion data set of the aggregate model; and determining whether the aggregate model is a normal model according to the poison patch. In this method, an inversion data set is obtained by inverting the aggregate model obtained on the server side, and a poison patch is generated according to the inversion data set, so that it is determined whether the aggregate model is a normal model according to the generated poison patch. In this way, there is no need to generate a poison patch according to a local data set in the terminal device to determine whether the aggregate model obtained on the server side is a normal model, thereby ensuring the efficiency of detecting model poisoning attacks in federated learning, and also ensuring the security and privacy of local data in each terminal device.
[0049] In addition, after determining that the aggregate model is a normal model based on the patch evaluation index value, the parameters of the aggregate model are sent to each terminal device participating in federated learning, so that a better performance model can be obtained through collaborative training, thereby improving the recognition accuracy of multiple participating terminal devices and improving the availability of federated learning. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of a method for detecting a model poisoning attack in federated learning provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of a framework structure of federated learning provided in an embodiment of the present application;
[0054] Figure 4 A flowchart of another method for detecting a model poisoning attack in federated learning provided in an embodiment of the present application;
[0055] Figure 5 A framework diagram of a method for detecting a model poisoning attack in federated learning provided in an embodiment of the present application;
[0056] Figure 6 A framework diagram of another federated learning model poisoning attack detection method provided in an embodiment of the present application;
[0057] Figure 7 A schematic diagram of the structure of a federated learning model poisoning attack detection device provided in an embodiment of the present application.
[0058] Icon: 100 - electronic device; 101 - processor; 102 - memory. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0060] The present application provides the following multiple embodiments to detect backdoor poisoning attacks on federated learning models. By performing model inversion on the aggregated model, an artificially synthesized training data set is obtained. Then, possible poisoning patches are searched in the training data set, and the found patches are tested to determine whether the aggregated model is poisoned, thereby effectively improving the efficiency of finding poisoning attack detection. The following is an explanation through multiple embodiments.
[0061] Figure 1 The following is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may be, for example, a server. For ease of description, the following embodiments of the present application are described by taking the electronic device as a server as an example. Figure 1 As shown, the server 100 includes: a processor 101 and a memory 102 .
[0062] Among them, the memory 102 is used to store programs, and the processor 101 calls the program stored in the memory 102 to execute the model poisoning attack detection method for federated learning provided in the following embodiment. The specific implementation method and technical effect are similar. The model poisoning attack detection method for federated learning provided in this application will be described in detail through multiple specific embodiments as follows.
[0063] Figure 2 The following is a flow chart of a method for detecting a model poisoning attack in federated learning provided in an embodiment of the present application; the method can be implemented by a processor in the server provided in the above embodiment. Figure 2 As shown, the method includes:
[0064] S201. Receive model parameters of a terminal device-side model sent by at least one terminal device participating in federated learning.
[0065] Figure 3 A schematic diagram of a framework structure of federated learning provided in an embodiment of the present application; Figure 3 As shown, federated learning is a machine learning environment whose goal is to train a high-quality centralized model while the training data remains distributed across a large number of terminal devices.
[0066] For example, there are K terminal devices participating in federated learning, namely terminal device 1, terminal device 2, terminal device 3, terminal device 4, ..., terminal device K, where each terminal device obtains an initial training model from the server, so that each terminal device uses local data to perform model training, and after several rounds of training, the model training parameters obtained by each terminal device are uploaded to the server. The server aggregates the K received model parameters to obtain the latest model, and sends the latest global model parameters to each terminal device.
[0067] For example, in some embodiments, the model parameters of the terminal device side model sent by multiple terminal devices participating in federated learning may be received by the server, for example, as follows:
[0068] 1) Initialize the server side and set the current t=0 so that multiple terminal devices participating in federated learning obtain the initial training model from the server, such as the VGG16 (Visual Geometry Group) model, the AlexNet (a neural network) model, etc.
[0069] In another possible implementation, the initial training models of multiple terminal devices participating in the federated learning may also be manually set.
[0070] 2) Initialize multiple terminal devices participating in federated learning so that they can use local data for model training, set the number of rounds E, learning rate ε, and the amount of data B for each round of training on the terminal device side.
[0071] For example, there are K terminal devices participating in federated learning, and F (F≤K) of them are selected to use the local data set D i (i≤F) to train and obtain the local training model L t i +1.
[0072] 3) After E rounds of training, the trained model parameters are uploaded to the server so that the server can promptly receive the model parameters of the terminal device side model sent by the F terminal devices participating in the federated learning.
[0073] S202: Aggregate the model parameters of the models on each terminal device side to obtain an aggregate model on the server side.
[0074] In some embodiments, after receiving the model parameters of the terminal device side model sent by multiple terminal devices participating in federated learning, the server can perform aggregation processing based on the model parameters of each terminal device side model to obtain an aggregated model on the server side.
[0075] For example, 1) the goals of the benign participants in the terminal are:
[0076]
[0077] Among them, (x j ,y j ) are D i The data and labels in the dataset, P[G t+1 (x j )=y j ] is G t+1 Model calculation data x j The predicted value and the true label y j The same success rate, w i for The weight parameters of the model, for The weight parameter after model optimization, G t+1 It is the server-side model after aggregation.
[0078] 2) The goals of the malicious actor in the terminal are:
[0079]
[0080] Among them, (x j ,y j ) are D i The data and labels in the dataset, w i for The weight parameters of the model, for The weight parameter of the model, φ is the added poisoning patch, R is the added poisoning attack method, R(x j ,φ) is the poisoned data generated by the poisoning attack method R and the patch φ, τ is the label of the attack target, P[G t+1 (R(x j ,φ))=τ] is G t+1 The model calculates the success rate that the predicted value of the poisoned data is the same as the poisoned label τ, G t+1 It is the server-side model after aggregation.
[0081] It should be noted that the added poisoning attack methods R may include: BadNets (a reverse graffiti neural network) poisoning attack: when the original network structure is unknown, by modifying the pixel values in the training image, the neural network can behave abnormally during the test phase; AIS (Accessory Injection strategy) and BIS (Blended Injection strategy) poisoning attacks: without knowing the attacked model or its training data, the attacker can add a small amount of poisoned samples to implement targeted attacks.
[0082] Model aggregation is performed based on the model parameters uploaded by each terminal device. The aggregation formula is as follows:
[0083]
[0084] Among them, G t+1 is the aggregation model after server-side aggregation, G t is the aggregated model after the previous round of training aggregation, For the local training model, 1 / F is the weight scaling. The weight scaling 1 / F can be used to ensure that the backdoor survives averaging.
[0085] S203, inverting the aggregation model to obtain an inversion data set of the aggregation model.
[0086] Optionally, after obtaining the aggregation model, the server side updates the global model according to the aggregation parameters of the aggregation model to obtain the latest model, and sends the latest global model parameters to multiple terminal devices participating in federated learning, effectively ensuring the security and privacy of local data in each terminal device. At the same time, it can also achieve the effect of collaborative training through multiple participating terminal devices to obtain a model with better performance.
[0087] In this embodiment, after obtaining the aggregation model on the server side, the aggregation model is inverted to obtain an inversion data set of the aggregation model. Inversion means: using the known model and label to reversely deduce the image method of the model training set: initially set a noise, and continuously optimize the noise image through the model confidence and the target label, so that the confidence of the noise image for the target label is continuously improved, and when fitting, a noise image similar to the original image can be obtained.
[0088] It should be noted that the inversion dataset obtained by inverting the aggregation model is not the local data of the multiple terminal devices participating in federated learning, which effectively ensures the security and privacy of the local dataset in each terminal device.
[0089] S204: Generate a poison patch according to the inversion data set of the aggregation model.
[0090] Optionally, a neural network scanning technology based on AI (Artificial Intelligence) can be used to determine whether the training model has been attacked by a backdoor. First, it is necessary to obtain a trained neural network and find damaged neurons based on the training data set. Then, a poisoning patch is generated based on the damaged neurons and the training data set. The poisoning patch is then evaluated so that it is possible to determine whether the model is a poisoned model based on the evaluation indicators. It is mainly used for the training of a single model and requires a large amount of local training data. However, when using this technology, when detecting model poisoning attacks in federated learning, it is impossible to obtain local data from multiple terminal devices, resulting in the inability to detect poisoning attacks on aggregated models.
[0091] In this embodiment, after the inversion data set of the aggregate model is obtained, a poisoning patch may be generated according to the inversion data set of the aggregate model.
[0092] It should be noted that this embodiment generates poisoning patches based on the inversion data set, which is different from the AI-based neural network scanning technology that finds damaged neurons based on the local training data set. In other words, compared with the general intrusion detection model, by generating poisoning patches based on the inversion data set of the aggregation model, the security and privacy of the local data of each terminal device is effectively guaranteed.
[0093] S205: Determine whether the aggregated model is a normal model according to the poisoned patch.
[0094] In this embodiment, after generating a poison patch based on the inversion data set of the aggregate model, it is possible to further determine whether the aggregate model is a normal model based on the poison patch, thereby greatly improving the efficiency of finding the poisoned backdoor. In addition, the method also ensures data security and privacy.
[0095] In summary, an embodiment of the present application provides a method for detecting model poisoning attacks in federated learning, the method comprising: receiving model parameters of a terminal device side model sent by at least one terminal device participating in federated learning; performing aggregation processing according to the model parameters of each terminal device side model to obtain an aggregate model on the server side; inverting the aggregate model to obtain an inversion data set of the aggregate model; generating a poison patch according to the inversion data set of the aggregate model; and determining whether the aggregate model is a normal model according to the poison patch. In this method, an inversion data set of the aggregate model obtained on the server side is obtained by inverting the aggregate model obtained on the server side, and a poison patch is generated according to the inversion data set, so that it is determined whether the aggregate model obtained is a normal model according to the generated poison patch. In this way, there is no need to generate a poison patch according to the local data set in the terminal device to determine whether the aggregate model obtained on the server side is a normal model, thereby ensuring the efficiency of detecting model poisoning attacks in federated learning, and also ensuring the security and privacy of local data in each terminal device.
[0096] Optionally, the aggregation model is inverted to obtain an inversion data set of the aggregation model, including:
[0097] The aggregation model is inverted using a preset first objective function to obtain an inversion data set of the aggregation model.
[0098] For example, the preset first objective function is as follows:
[0099]
[0100] Among them, f is the aggregation model G on the server side t+1 The probability of being classified as τ.
[0101] Specifically, after the model aggregation is obtained, the above-mentioned preset first objective function can be used to invert the aggregation model to obtain the inversion data set D of the aggregation model. MI (X MI ,Y MI ).
[0102] Optionally, according to the inversion data set of the aggregate model, the damaged neurons in the aggregate model are found, specifically including:
[0103] For example, the preset second objective function is as follows:
[0104] c com =max(NSF(c,θ,τ)-NSF(c,μ,τ)) (5)
[0105] Among them, c is a neuron, c com is the damaged neuron, NSF is the state equation of the neuron, θ and μ are the sampled values of the inverted dataset image and the image with the patch added, respectively.
[0106] Specifically, since damaged neurons may be abnormally activated under specific inputs, a preset second objective function may be used to obtain damaged neurons in the aggregation model.
[0107] Optionally, a poison patch is generated based on the inversion dataset of the aggregate model, including:
[0108] The poisoned patches were generated based on the inversion dataset of the aggregate model and the damaged neurons in the aggregate model.
[0109] For example, using damaged neurons and the inversion dataset D MI (X MI ,Y MI )Get the poison patch:
[0110] M=argmax M (g(x MI ;c com ;M;τ)·Δ) (6)
[0111] Where M is the poisoned patch generated using the gradient of the damaged neuron, c com is the damaged neuron, g is the probability of the aggregate model inversion dataset under the current damaged neuron plus the patch being classified as the target class τ, and Δ is the hyperparameter setting for the patch.
[0112] Optionally, aggregation processing is performed on model parameters of each terminal device side model to obtain an aggregate model on the server side, including: using a preset model aggregation function to aggregate model parameters of each terminal device side model to obtain an aggregate model on the server side.
[0113] For example, the model aggregation function used is as follows:
[0114]
[0115] Among them, G t+1 is the aggregation model after server-side aggregation, G t is the aggregated model after the previous round of training aggregation, is the local training model, and 1 / F is the weight scaling.
[0116] Specifically, the training of the deep neural network is distributed among K participating terminal devices. In each round of t iterations, the server randomly selects a subset of F participants and sends them the current joint model G t , the selected participants train a new local model based on the data set stored in the local terminal device The terminal device will The data is sent to the server, so that the server updates and calculates the global aggregation model based on the received information, so that the obtained aggregation model is G t+1 .
[0117] Figure 4 A flow chart of another method for detecting a model poisoning attack in federated learning provided in an embodiment of the present application; Figure 4 As shown, in the above step S205: determining whether the aggregate model is a normal model according to the poisoned patch specifically includes:
[0118] S401: Determine a patch evaluation index value of a poisoned patch.
[0119] To detect outliers, a patch evaluation metric based on the median absolute deviation to identify poisoned patches can be used.
[0120] First, the absolute deviations between all data points and the median are calculated. The median of these absolute deviations is called the MAD and provides a reliable measure of dispersion.
[0121] Then, the patch evaluation index value of the data point is defined as the absolute deviation of the data point divided by the MAD, as shown below:
[0122]
[0123] Where df is the patch evaluation index value. MAD can be calculated using the following formula:
[0124]
[0125] Among them, MAD is the median of absolute deviation, mask is the mask of the poisoned patch, filled with 0 and 1, there are N masks in N types of data sets, and l is the index of the mask.
[0126] If the value of mask is smaller, it means that the possibility of poisoning is greater. The patch evaluation index value df is introduced, and the minimum value of mask minus the absolute median difference is the absolute deviation MAD.
[0127] S402: Determine whether the aggregated model is a normal model according to the patch evaluation index value.
[0128] In some embodiments, after obtaining the patch evaluation index value, it is possible to further determine whether the aggregate model is a normal model based on the patch evaluation index value df. For example, if the patch evaluation index value is set to be greater than or equal to a preset threshold, the aggregate model is determined to be a poisoned model.
[0129] For example, if the calculated patch evaluation index value df is 3 and the preset threshold is 2, it can be judged that the patch evaluation index value is greater than the preset threshold, that is, 3>2, and the aggregation model is determined to be a poisoned model.
[0130] Optionally, determining whether the aggregate model is a normal model according to the patch evaluation index value includes: if the patch evaluation index value is less than a preset threshold, determining that the aggregate model is a normal model.
[0131] In one possible implementation, for example, the calculated patch evaluation index value df is 1, and the preset threshold is 2, then it can be judged that the patch evaluation index value is less than the preset threshold, that is, 1<2, and the aggregation model is determined to be a normal model. The parameters of the aggregation model are sent to each participating terminal device, so that multiple participating terminal devices can obtain a model with better performance through collaborative training, thereby improving the recognition accuracy of the participating terminal devices and improving the availability of federated learning.
[0132] Optionally, determining whether the aggregate model is a normal model according to the patch evaluation index value includes: if the patch evaluation index value is greater than or equal to a preset threshold, determining that the aggregate model is a poisoned model.
[0133] In another possible implementation, for example, if the calculated patch evaluation index value is greater than or equal to a preset threshold, it can be determined that the aggregate model is a poisoned model, which can improve the efficiency of backdoor poisoning detection.
[0134] The following is a description of the model poisoning attack detection process of the federated learning of the present application in combination with a specific data set example. The specific implementation process and technical effects are mentioned above and will not be repeated below.
[0135] Figure 5 A framework diagram of a model poisoning attack detection method for federated learning provided in an embodiment of the present application; Figure 5 As shown in the figure, there are 16 terminal devices participating in federated learning, but only 5 terminal devices are shown in the figure. The data set in each terminal device is the MNIST (Mixed National Institute of Standards and Technology database) data set (MNIST is a picture data set of handwritten digits), and the selected training model is AlexNet. The specific process is as follows:
[0136] 1) Initialize the server and set the current t=0
[0137] 2) Initialize each terminal device and use the selected AlexNe model to train the MNIST data set in these five terminal devices.
[0138] The number of training rounds set on the terminal device side is E=10, the learning rate ε=0.1, and the amount of data per training round is B=16.
[0139] 3) Select the local data set D from 4 terminal devices i (i≤4) to train and obtain the local training model
[0140] For example, the terminal device target of benign participation is as exemplified in the above formula (1).
[0141] The target of the terminal device involved in the malicious operation is as exemplified by the above formula (2).
[0142] 4) The model parameters obtained by training the selected four terminal devices are uploaded to the server, and the model is aggregated in the server. The aggregation formula is the above formula (3).
[0143] 5) After aggregation, the aggregation model G is obtained t+1 , and perform model inversion on the aggregate model to obtain the inversion dataset D MI (X MI ,Y MI ), the objective function of the model inversion is the above formula (4).
[0144] 6) Find the damaged neurons in the aggregation model. The damaged neurons will be abnormally activated under specific inputs. The objective function is the above formula (5).
[0145] 7) Invert the data set D based on the obtained model MI (X MI ,Y MI ), the poisoned patch is obtained according to the damaged neurons and the inversion data set, and the calculation formula is the above formula (6).
[0146] 8) After obtaining the poisoned patch, determine the patch evaluation index value of the poisoned patch, and the calculation formula is the above formula (7) and formula (8).
[0147] For example, the value of the patch evaluation index can be used to determine whether the aggregate model is a normal model. If the value of the patch evaluation index is less than a preset threshold, the aggregate model is determined to be a normal model, and the aggregate model can be sent to the five terminal devices participating in federated learning.
[0148] If the patch evaluation index value is greater than or equal to the preset threshold, the aggregation model is determined to be a poisoned model.
[0149] Figure 6 A framework diagram of another federated learning model poisoning attack detection method provided in an embodiment of the present application; Figure 6 As shown in the figure, there are 16 terminal devices participating in federated learning, but only 5 terminal devices are shown in the figure. The data set in each terminal device is the CIFAR10 data set (a computer vision data set for universal object recognition), and the selected training model is AlexNet. The specific process is as follows:
[0150] 1) Initialize the server and set the current t=0
[0151] 2) Initialize each terminal device and use the selected VGG16 model to train the CIFAR10 dataset in these five terminal devices.
[0152] The number of training rounds set on the terminal device side is E=30, the learning rate ε=0.01, and the amount of data per training round is B=32.
[0153] 3) Select the local data set D from 4 terminal devices i (i≤4) for training to obtain the local training model
[0154] For example, the terminal device target for benign participation is as exemplified in the above formula (1).
[0155] The target of the terminal device maliciously participating is as exemplified by the above formula (2).
[0156] 4) The model parameters obtained by training the selected four terminal devices are uploaded to the server, and the model is aggregated in the server. The aggregation formula is the above formula (3).
[0157] 5) After aggregation, the aggregation model G is obtained t+1 , and perform model inversion on the aggregate model to obtain the inversion dataset D MI (X MI ,Y MI ), the objective function of the model inversion is the above formula (4).
[0158] 6) Find the damaged neurons in the aggregation model. The damaged neurons will be abnormally activated under specific inputs. The objective function is the above formula (5).
[0159] 7) Invert the data set D based on the obtained model MI (X MI ,Y MI), the poisoned patch is obtained according to the damaged neurons and the inversion data set, and the calculation formula is the above formula (6).
[0160] 8) After obtaining the poisoned patch, determine the patch evaluation index value of the poisoned patch, and the calculation formula is the above formula (7) and formula (8).
[0161] For example, based on the patch evaluation index value, determine whether the aggregation model is a normal model. If the patch evaluation index value is less than the preset threshold, the aggregation model is determined to be a normal model, and the aggregation model can be sent to the five terminal devices participating in federated learning.
[0162] If the patch evaluation index value is greater than or equal to the preset threshold, the aggregation model is determined to be a poisoned model.
[0163] The following describes the device and storage medium used to perform the model poisoning attack detection of federated learning provided in this application. The specific implementation process and technical effects are mentioned above and will not be repeated below.
[0164] Figure 7 A schematic diagram of a model poisoning attack detection device for federated learning provided in an embodiment of the present application; Figure 7 As shown, the device includes: a receiving module 701, an aggregation module 702, an inversion module 703, a generation module 704 and a determination module 705;
[0165] A receiving module 701 is used to receive model parameters of a terminal device side model sent by at least one terminal device participating in federated learning;
[0166] Aggregation module 702, used to perform aggregation processing according to the model parameters of the models on each terminal device side to obtain an aggregate model on the server side;
[0167] An inversion module 703 is used to invert the aggregation model to obtain an inversion data set of the aggregation model;
[0168] A generating module 704, for generating a poisoning patch according to an inversion data set of an aggregate model;
[0169] The determination module 705 is used to determine whether the aggregated model is a normal model according to the poisoned patch.
[0170] Optionally, the aggregation module 702 is specifically configured to:
[0171] The aggregation model is inverted using a preset first objective function to obtain an inversion data set of the aggregation model.
[0172] Optionally, the generating module 704 is specifically configured to:
[0173] The poisoned patches were generated based on the inversion dataset of the aggregate model and the damaged neurons in the aggregate model.
[0174] Optionally, the generating module 704 is further used for:
[0175] The preset second objective function is used to obtain damaged neurons in the aggregation model; wherein the damaged neurons will be abnormally activated under specific inputs.
[0176] Optionally, the generating module 704 is further used for:
[0177] The preset model aggregation function is used to aggregate the model parameters of the models on each terminal device side to obtain the aggregated model on the server side.
[0178] Optionally, the determination module 705 is specifically configured to:
[0179] Determine a patch evaluation index value of the poisoned patch; and determine whether the aggregate model is a normal model according to the patch evaluation index value.
[0180] Optionally, the determination module 705 is further configured to:
[0181] If the patch evaluation index value is less than the preset threshold, the aggregation model is determined to be a normal model.
[0182] Optionally, the determination module 705 is further configured to:
[0183] If the patch evaluation index value is greater than or equal to the preset threshold, the aggregate model is determined to be a poisoned model.
[0184] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0185] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0186] Optionally, the present application also provides a program product, such as a computer-readable storage medium, including a program, which is used to execute the above method embodiment when executed by a processor.
[0187] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device 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 devices or units, which can be electrical, mechanical or other forms.
[0188] 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.
[0189] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0190] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
Claims
1. A method for detecting model poisoning attacks in federated learning, characterized in that: The method comprises: Receiving model parameters of a terminal device side model sent by at least one terminal device participating in federated learning; Performing aggregation processing according to the model parameters of the terminal device side models to obtain an aggregated model on the server side; Inverting the aggregation model to obtain an inversion data set of the aggregation model includes: using a preset first objective function to invert the aggregation model to obtain an inversion data set of the aggregation model, wherein the preset first objective function used is as follows: Among them, f is the aggregation model G on the server side t+1 The probability of being classified as τ; generating a poisoning patch based on an inversion dataset of the aggregate model; According to the poisoned patch, it is determined whether the aggregated model is a normal model.
2. The method according to claim 1, wherein generating a poison patch according to the inversion data set of the aggregate model comprises: A poisoned patch is generated according to the inversion dataset of the aggregate model and the damaged neurons in the aggregate model.
3. The method according to claim 2, before generating the poisoned patch based on the inversion data set of the aggregate model and the damaged neurons in the aggregate model, further comprises: A preset second objective function is used to obtain damaged neurons in the aggregation model; wherein the damaged neurons will be abnormally activated under specific inputs.
4. According to any one of claims 1 to 3, the step of performing aggregating processing based on the model parameters of the terminal device side models to obtain the aggregated model on the server side comprises: The preset model aggregation function is used to aggregate the model parameters of the terminal device side models to obtain the aggregated model on the server side.
5. According to any one of claims 1 to 3, determining whether the aggregate model is a normal model based on the poisoned patch comprises: Determining a patch evaluation index value of the poisoned patch; According to the patch evaluation index value, it is determined whether the aggregation model is a normal model.
6. The method according to claim 5, wherein determining whether the aggregate model is a normal model according to the patch evaluation index value comprises: If the patch evaluation index value is less than a preset threshold, it is determined that the aggregation model is a normal model.
7. The method according to claim 5, characterized in that The determining, according to the patch evaluation index value, whether the aggregation model is a normal model comprises: If the patch evaluation index value is greater than or equal to a preset threshold, it is determined that the aggregation model is a poisoned model.
8. A model poisoning attack detection device for federated learning, characterized in that: The device comprises: a receiving module, an aggregation module, an inversion module, a generation module and a determination module; The receiving module is used to receive model parameters of a terminal device side model sent by at least one terminal device participating in federated learning; The aggregation module is used to perform aggregation processing according to the model parameters of the terminal device side models to obtain an aggregate model on the server side; The inversion module is used to invert the aggregation model to obtain the inversion data set of the aggregation model, including: using a preset first objective function to invert the aggregation model to obtain the inversion data set of the aggregation model, wherein the preset first objective function used is as follows: Among them, f is the aggregation model G on the server side t+1 The probability of being classified as τ; The generating module is used to generate a poisoning patch according to the inversion data set of the aggregation model; The determination module is used to determine whether the aggregate model is a normal model according to the poisoned patch.
9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as claimed in claims 1-7.
