Blockchain and data augmentation based federated learning training method and system
By using a blockchain storage generator model and a differential privacy generative adversarial network, the problems of data privacy leakage and reduced availability in federated learning are solved, and secure and efficient training is achieved in Non-IID data scenarios.
Patent Information
- Application Number
- CN202211558006.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-12-06
AI Technical Summary
Existing federated learning suffers from risks of data privacy breaches, reduced data availability, and high communication overhead, especially in Non-IID data scenarios, where it is difficult to balance data privacy and availability.
We adopt a federated learning framework based on blockchain and generative models. We store the generator model through the blockchain and combine it with differential privacy generative adversarial networks for data augmentation to avoid direct data sharing. We also use the immutability and election mechanism of the blockchain to ensure the security and availability of the model.
While protecting data privacy, it mitigates the negative impact of Non-IID data on model performance, reduces the risk of privacy leaks, improves data availability, and reduces communication overhead.
Smart Images

Figure CN116484923B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of artificial intelligence, in particular to a federated learning training method and system based on blockchain and data enhancement. BACKGROUND
[0002] The statements in this section merely provide background information related to the present disclosure and do not necessarily constitute the prior art.
[0003] With the continuous maturity of artificial intelligence related technologies, more and more machine learning algorithms are applied to people's actual life, and computer vision, speech recognition, natural language processing, recommendation system and other technologies can be seen everywhere. Machine learning is a typical data-driven task, and the performance of the final model is closely related to the quantity and quality of the data set used when training the model. When training the model, a large amount of high-quality data samples are often needed as support.
[0004] In order to reduce the impact of non-independent and identically distributed training data on the final training model, researchers have conducted a series of studies, mainly from the aspects of data sharing and data enhancement. Data enhancement and data sharing both start from the data source to solve the Non-IID problem in FL. The difference is that the data enhancement scheme only uploads a small amount of labels or samples by the client, and ensures the privacy of the data through noise mixing or encoding and decoding. In addition, although the above scheme can alleviate the data Non-IID problem to a certain extent, the related scheme still has some defects:
[0005] 1. The method of directly sharing training data has a serious privacy threat, which is easy to cause data leakage problem, and has a great impact on the data owner and the related personnel involved in the data itself. In addition, the promulgation and implementation of relevant laws and regulations also put forward restrictions and constraints on this method, and the method faces the risk of illegal and irregular. 2. Although the data mixing method can ensure data privacy, the usability of the mixed data will be greatly reduced, and seeking a balance between data privacy and data usability is still an important problem at this stage. 3. In the method of generating a model based on federated learning training, multiple rounds of model parameter interaction are required between the participants and the center server, and the communication cost is huge. In addition, the transmission speed is greatly affected by the network condition in the data transmission process, and the federated learning training process has defects in the scene with poor network environment. SUMMARY
[0006] The present disclosure proposes a federated learning training method and system based on blockchain and data enhancement to solve the above problems, proposes a federated learning framework assisted by a blockchain and a generative model, which can protect the original data while mitigating the negative impact of Non-IID data on model performance, and each client of the federated learning does not need to bear the risk of privacy leakage caused by balancing Non-IID data.
[0007] According to some embodiments, the present disclosure adopts the technical scheme as follows:
[0008] The training method of the generative adversarial network based on the blockchain and the federated learning comprises:
[0009] Step 1: Each client participating in the federated learning processes a local data set to obtain an original training set, and pre-trains a generative adversarial network meeting differential privacy using the original training set;
[0010] Step 2: Each client jointly selects a packaging client, and sends the pre-trained generator model to the packaging client;
[0011] Step 3: After receiving the generator models of all clients, the packaging client packs the received generator models into a block and uploads the block to the blockchain, and the client downloads the block containing the generator models of all participants from the blockchain;
[0012] Step 4: The client generates new data, integrates the processed original training set and the newly generated data to build a new data set for the federated learning training task.
[0013] According to some embodiments, the present disclosure adopts the technical scheme as follows:
[0014] The training system of the generative adversarial network based on the blockchain and the federated learning comprises:
[0015] The model pre-training module is configured to process a local data set of each client participating in the federated learning to obtain an original training set, and pre-train a generative adversarial network meeting differential privacy using the original training set;
[0016] The block downloading module is configured to jointly select a packaging client by each client, and send the pre-trained generator model to the packaging client; after receiving the generator models of all clients, the packaging client packs the received generator models into a block and uploads the block to the blockchain, and the client downloads the block containing the generator models of all participants from the blockchain;
[0017] The model updating module is configured to generate new data by the data client, integrate the processed original training set and the newly generated data to build a new data set for the federated learning training task.
[0018] According to some embodiments, the present disclosure adopts the technical solutions as follows:
[0019] A computer readable storage medium, wherein a plurality of instructions are stored, the instructions are suitable for being loaded by a processor of a terminal device and performing the training method of the generative adversarial network based on the blockchain and federated learning.
[0020] According to some embodiments, the present disclosure adopts the technical solutions as follows:
[0021] A terminal device, comprising a processor and a computer readable storage medium, the processor is used to implement instructions; the computer readable storage medium is used to store a plurality of instructions, the instructions are suitable for being loaded by the processor and performing the training method of the generative adversarial network based on the blockchain and federated learning.
[0022] Compared with the prior art, the present disclosure has the beneficial effects that:
[0023] The present disclosure proposes a federated learning framework assisted by a blockchain and a generative model, which can alleviate the negative impact of Non-IID data on model performance while protecting original data, and each client of the federated learning does not need to bear the risk of privacy leakage caused by balancing Non-IID data.
[0024] The present disclosure avoids the problem of reduced data availability caused by processing data by adding noise and encoding and decoding in the previous method of solving Non-IID problems, thereby ensuring the final model performance of the federated learning model.
[0025] The present disclosure replaces the third-party agency originally required to store the generator model, and the generator trained by each client is packaged together and uploaded to the blockchain, and is securely stored by the blockchain, thereby eliminating the risk of malpractice by the third-party agency and ensuring the security of the generator model.
[0026] The blockchain of the present disclosure ensures that the model uploaded to the blockchain cannot be maliciously tampered with through an immutable block ledger, thereby providing high security assurance for the generator model uploaded by the client. In addition, the packaged client and the local client generated through election can perform model quality detection and other operations on the uploaded generator model, thereby realizing auditing and supervision of the model and minimizing the possibility of malpractice by each participant. BRIEF DESCRIPTION OF DRAWINGS
[0027] The drawings accompanying the specification of the present disclosure serve to provide a further understanding of the present disclosure, and the illustrative embodiments of the present disclosure and their descriptions serve to explain the present disclosure and do not constitute an improper limitation on the present disclosure.
[0028] Figure 1 A flowchart of a generator model training and transmission process for embodiments of the present disclosure;
[0029] Figure 2 A flowchart of client data generation and new data set construction for embodiments of the present disclosure;
[0030] Figure 3 A federal learning architecture diagram for embodiments of the present disclosure. DETAILED DESCRIPTION
[0031] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.
[0032] It should be noted that the following detailed description is illustrative only, and is intended to provide further description in order to provide a fuller enabling teaching of the present disclosure. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present disclosure pertains.
[0033] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments in accordance with the present disclosure. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, steps, operations, elements, components, and / or groups thereof, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof.
[0034] Technical term explanation:
[0035] GS-WGAN: GS-WGAN is a generative model training method that meets the definition of differential privacy proposed by Chen Dingfan et al. in 2020. The scheme combines differential privacy and generative adversarial network. Differential privacy can provide strict privacy protection, and generative adversarial network is used to fit the data distribution. The scheme can finally obtain a generative model with privacy protection, and based on the generative model, new data can be generated. The newly generated data has the characteristics of the original training data but does not disclose the sensitive information of the original data, and the data can be used for a series of subsequent operations and tasks. Based on this method, specific training tasks based on sensitive data can be completed without damaging data privacy. The scheme keeps the discriminator normal training, does not change the gradient when training the discriminator, only processes part of the gradient sent by the discriminator to the generator, avoids the additional information loss caused by operating other gradients, and realizes the high availability of data while ensuring data privacy.
[0036] FedAvg: FedAvg is a distributed framework proposed by McMahan et al., which allows multiple users to train a machine learning model simultaneously without sending any private raw data to the server during the training process. Each client participating in the training task performs local model training based on local data, and the center server is responsible for weighting the local model to obtain the global model. After multiple rounds of iterative training, a model close to the centralized machine learning result can be obtained, which effectively reduces the privacy risks brought by the aggregation of raw training data in traditional machine learning.
[0037] Embodiment 1
[0038] In an embodiment of the present disclosure, a training method of a generative adversarial network based on blockchain and federated learning is provided, comprising:
[0039] Step 1: Each client participating in federated learning processes the local data set to obtain an original training set, and pre-trains a generative adversarial network that meets differential privacy using the original training set.
[0040] Step 2: Each client selects a packaging client together, and sends the pre-trained generator model to the packaging client.
[0041] Step 3: After receiving all the generator models of the clients, the packaging client packs the received generator models into a block and uploads it to the blockchain, and the client downloads the block containing all the generator models of the participants from the blockchain.
[0042] Step 4: The client generates new data, integrates the processed original training set and the newly generated data to build a new data set for federated learning training tasks.
[0043] Specifically, the scheme is applicable to a federated learning scenario where multiple clients jointly train, mainly including four roles: each client C i participating in federated learning, a packaging client C s , a center server S, and a blockchain for storing generator models.
[0044] As an embodiment, the specific steps of the scheme are as follows:
[0045] Q1. Each client processes the local data set to avoid low data quality affecting the model training result.
[0046] Q2. Each client C i,∈[0,N) based on local data to pre-train the generative adversarial network GS-WGAN(g,d) that satisfies differential privacy, where GS-WGAN is a generative adversarial network that satisfies differential privacy, which includes two parts: generator g and discriminator d.
[0047] Q3. Each client selects a packaging client C through election s , and sends the locally trained generator model g i to the packaging client.
[0048] Q4. The packaging client C s receives all client generator models, packages them into a block, and uploads them to the blockchain. Clients download the block containing all zone participant generator models from the blockchain.
[0049] Q5. The client C i performs model similarity detection on the downloaded model, and uses the detected generator model g i to generate new data.
[0050] Q6. The client C i integrates the processed local original data set with the newly generated data, and shuffles all data samples to construct a new data set for the next federated learning training task.
[0051] Q7. The center server S randomly selects some clients to participate in the overall training of federated learning, and broadcasts the initialized global model parameters to the selected clients.
[0052] Q8. Each client trains locally based on the integrated data set to obtain model updates and uploads them to the center server S.
[0053] Q9. The center server S collects model updates from each client, aggregates the model using the FedAvg aggregation algorithm, and generates a new global model.
[0054] Q10. During the overall training of federated learning, steps 7-9 are iteratively executed.
[0055] Next, the specific details of the above scheme are described as follows:
[0056] In step Q1, the client C i needs to first perform data processing operations on the local data set D i , remove error samples and a large amount of duplicate data in the data set, and avoid the adverse effects of low-quality data sets on model training results. The processed local data set is representations.
[0057] In step Q2, each client C i uses the local dataset to train a GAN model and add noise to the GAN model training gradient, thereby obtaining a GS-WGAN model that satisfies the differential privacy property. The training process of the GAN is a process in which the generator g and the discriminator b constantly play against each other. First, the generator parameters θ g and the discriminator parameters θ d need to be initialized. Next, m samples {x0, x1, … x m-2 , x m-1} are collected from the local dataset , m noise samples {z0, z1, … z m-2 , z m-1} are sampled from the prior distribution noise, and m generated samples are generated by the generator g. The generator g is fixed, and the discriminator d is trained to accurately distinguish between real samples and generated samples. The discriminator parameters θ d are updated multiple times, and the generator parameters θ g are updated with a small learning rate. The generator is trained to minimize the difference between the generated samples and the real samples. Next, multiple rounds of iteration updates are performed, and the generator g and the discriminator d constantly play against each other. The ideal situation is that the discriminator cannot accurately determine the authenticity of the samples, i.e., the final sample discrimination probability is 50%.
[0058] In step Q3, each client C i selects a packaging client C s from all clients through election, and sends the trained generator model g i to the packaging client C s . At this time, the uploaded generator model of each client has learned the relevant features of the local dataset and can generate generated data with the same data distribution characteristics as . Next, the packaging client performs a series of operations such as model quality detection on the uploaded model.
[0059] In step Q4, as shown in Figure 1 , after receiving the trained generator models g i of all clients C i , the packaging client C s packages the models that pass the detection into a block and links it to the blockchain. The block stores the generator models {g0, g1, …, g N-1} corresponding to all clients. At this time, each client C iThe blocks containing all the generator models need to be downloaded from the blockchain.
[0060] In step Q5, the client C i performs a model similarity detection operation on the downloaded generator model. The Euclidean distance between the client C i 's generator model g i and the generator model g k of another client is calculated respectively:
[0061]
[0062] where d is the calculated distance value; g i is the generator model trained by the client C i ; g k is the generator model trained by another client except the client C i ; d is the jth parameter of the model g i ; d is the jth parameter of the model g k ; and n is the number of parameters contained in the model.
[0063] If the distance value is greater than the maximum threshold, the model g k is judged as a malicious model, and if the distance value is less than the minimum threshold, the model g k is judged as a similar model. Both of the above models cannot pass the detection and cannot perform the subsequent data generation task. A series of new data that do not exist in the original data set of other clients but can represent the data characteristics of other clients is generated using the model that passes the detection, and the data set composed of this part of data is denoted as .
[0064] In step Q6, as shown in Figure 2 , the client C i integrates the processed local original data set and the newly generated data set , and shuffles the entire data set to construct a new data set . The data in the current data set can represent the overall data characteristics of all clients.
[0065] In step Q7, the center server S randomly selects a subset containing n (0 < n < N) clients (these clients will participate in the overall process of federated learning), and distributes the initialized global model parameters ω t=0 (t represents the current round of federated training) to each selected client.
[0066] In step Q8, the client Ci receiving initial parameters ω from the center server S t=0 After that, based on the current local data set Optimizing the objective function to obtain the updated model parameters of itself and sending the model to the center server S.
[0067] In step Q9, the center server S collects the model parameters updated locally by each client and aggregates the model parameters updated locally by the client using an aggregation algorithm to obtain new global model parameters:
[0068]
[0069] where ω t+1 is the initial global model parameter of the next round of iteration. Agg is an aggregation function for aggregating the parameters in the parentheses, and FedAvg method can be selected here; is the parameter of the client C0 in the t+1th round
[0070] ; is the parameter of the client C1 in the t+1th round is the parameter of the client C n-2 in the t+1th round is the parameter of the client C n-1 in the t+1th round; and n is the total number of clients.
[0071] In step Q10, in the federated learning training scenario, each client C i needs to communicate parameters with the center server S in multiple rounds of iteration until the final model converges.
[0072] As an embodiment, as shown in the figure, the method for the federated learning training task is: Figure 3
[0073] S1: The center server randomly selects part of the clients to participate in the overall training of federated learning, and broadcasts the initialized global model parameters to the selected clients;
[0074] S2: Each client performs local training based on the integrated data set to obtain model updates, and uploads the model updates to the center server;
[0075] S3: The center server collects the model updates from each client, uses an aggregation algorithm to aggregate the models, and generates a new global model;
[0076] S4: In the overall training process of federated learning, steps S1-S3 are iteratively executed.
[0077] Embodiment 2
[0078] In an embodiment of the present disclosure, a training system of a blockchain and federated learning based generative adversarial network is provided, comprising:
[0079] A model pre-training module is configured to process local data sets of each client participating in federated learning to obtain an original training set, and pre-train a generative adversarial network satisfying differential privacy using the original training set.
[0080] A block downloading module is configured to select a packaging client by each client, and send the pre-trained generator model to the packaging client. After receiving the generator models of all clients, the packaging client packs the received generator models into a block and uploads the block to the blockchain. The client downloads the block containing the generator models of all participants from the blockchain.
[0081] A model updating module is configured to generate new data by the data client, integrate the processed original training set and the newly generated data to construct a new data set for federated learning training task.
[0082] The steps of the above system embodiment include first, each client participating in the federated learning training task pre-trains a generative adversarial network based on its own local data, and obtains a generator model after training. Next, each client selects a packaging client through an election method, and sends the generator obtained by local training to the packaging client. The packaging client performs quality detection and a series of operations on the generator model, and packs the qualified model into a block and uploads it to the blockchain. In this way, the blockchain saves the generator of all clients. Before federated learning training, each client downloads the block containing the generator models of all clients from the blockchain, and generates data representing the features of other clients using the generator locally. The data generated by each client generator is integrated with the local data to implement data enhancement operation, and the next federated learning task is performed based on the constructed new data set. The intervention of the blockchain makes the generator model of each client unnecessary to be sent to a third-party storage mechanism, avoiding the possibility of malpractice of the third-party storage mechanism. At the same time, the traceability of the uploaded model can be guaranteed, and the malice of the client can be judged by testing the generator and the generated data. If the client is malicious, it will be excluded from the federated learning training task, and certain punishment measures will be taken to ensure the safety of the overall process.
[0083] Embodiment 3
[0084] In an embodiment of the present disclosure, a computer readable storage medium is provided, wherein a plurality of instructions are stored, the instructions being adapted to be loaded and executed by a processor of a terminal device to implement the steps of the method for training a generative adversarial network based on a blockchain and federated learning.
[0085] Embodiment 4
[0086] In an embodiment of the present disclosure, a terminal device is provided, comprising a processor and a computer readable storage medium, the processor being configured to implement instructions; and the computer readable storage medium being configured to store a plurality of instructions, the instructions being adapted to be loaded and executed by the processor to implement the steps of the method for training a generative adversarial network based on a blockchain and federated learning.
[0087] The steps of the method described in Embodiments 2, 3 and 4 above are implemented.
[0088] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the flow Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0089] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable data processing apparatus to produce a computer implemented process, so that the instructions executed by the computer or other programmable data processing apparatus provide a process for implementing the flow Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0090] Although the specific embodiments of the present disclosure are described above with reference to the accompanying drawings, the present disclosure is not limited to the specific embodiments described above, and various modifications or changes can be made by those skilled in the art without creative labor, and these modifications or changes are still within the scope of the present disclosure.
Claims
1. A method for training a generative adversarial network based on blockchain and federated learning, characterized in that, The method comprises the following steps: Step 1: Each client participating in federated learning processes a local data set to obtain an original training set, and pre-trains a generative adversarial network meeting differential privacy by using the original training set; The pre-training method is that each client uses the local data set to train a model, and adds noise to the model training gradient to obtain a generative adversarial network model meeting the differential privacy property; Step 2: Each client selects a packaging client together, and sends the pre-trained generator model to the packaging client; Step 3: After receiving the generator models of all clients, the packaging client packs the received generator models into a block and uploads the block to a block chain, and the client downloads the block containing the generator models of all participants from the block chain; Step 4: The client generates new data, integrates the processed original training set and the newly generated data to construct a new data set for a federated learning training task; The method further comprises the following steps: before the client generates data, the client performs a model similarity detection operation on the downloaded generator model, and calculates the Euclidean distance between the client generator model and other client models respectively; If the distance value is greater than a maximum threshold value, the model is determined to be a malicious model, and if the distance value is less than a minimum threshold value, the model is determined to be a similar model; The malicious model and the similar model cannot pass the detection and cannot perform a data generation task. 2.The method of claim 1, wherein, The generative adversarial network comprises a generator and a discriminator. 3.The method of claim 1, wherein, The method for the federated learning training task is as follows: S1: The center server randomly selects part of the clients to participate in the overall training of federated learning, and broadcasts the initialized global model parameters to the selected clients; S2: Each client performs local training based on the integrated data set to obtain model updates, and uploads the model updates to the center server; S3: The center server collects the model updates from each client, performs model aggregation using an aggregation algorithm, and generates a new global model; S4: During the overall training of federated learning, steps S1-S3 are iteratively executed.
4. A training system of a generative adversarial network based on a blockchain and federated learning, specifically implementing the training method of the generative adversarial network based on the blockchain and the federated learning according to any one of claims 1-3, characterized in that, The method comprises the following steps: A model pre-training module is configured to process a local data set of each client participating in federated learning to obtain an original training set, and pre-train a generative adversarial network meeting differential privacy by using the original training set; A block downloading module is configured to select a packaging client together, and send the pre-trained generator model to the packaging client; After receiving the generator models of all clients, the packaging client packs the received generator models into a block and uploads the block to a block chain, and the client downloads the block containing the generator models of all participants from the block chain; A model updating module is configured to generate new data by a data client, integrate the processed original training set and the newly generated data to construct a new data set, and use the new data set for a federated learning training task.
5. A computer readable storage medium, characterized in that, A computer readable storage medium having stored therein a plurality of instructions, the instructions being adapted to be loaded and executed by a processor of a terminal device to implement the training method of the blockchain and federated learning based generative adversarial network according to any one of claims 1-3.
6. A terminal device, characterized by comprising: A computer readable storage medium having stored therein a plurality of instructions, the instructions being adapted to be loaded and executed by a processor to implement the training method of the blockchain and federated learning based generative adversarial network according to any one of claims 1-3.
Citation Information
Patent Citations
Federal continuous learning training method based on memory playback and differential privacy
CN115081532A
Teacher consensus aggregation learning method based on randomized response differential privacy technology
WO2022160623A1