Split-shuffle-based federated learning method, device, equipment and medium
By employing a federated learning approach based on local differential privacy and split-shuffle, and utilizing the RSA authentication mechanism and split-shuffle technique, this approach addresses the challenge of balancing privacy protection and model performance in existing technologies, achieving both higher privacy protection and better model performance.
Patent Information
- Application Number
- CN202211074718.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-02
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-09-02
AI Technical Summary
Existing federated learning methods based on differential privacy suffer from decreased model performance while ensuring privacy protection, making it difficult to balance the relationship between privacy protection and model performance.
We employ a federated learning approach that combines local differential privacy and split shuffling. We ensure the security of gradient information through an RSA public and private key authentication mechanism, and perform split shuffling on the authentication server to break the intrinsic link between gradient information and the client, thereby reducing the privacy budget and increasing the strength of privacy protection.
While providing differential privacy protection, it reduces the negative impact on model performance, improves the performance and security of machine learning models, and enhances privacy protection capabilities.
Smart Images

Figure CN115442036B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data security technology, and in particular to a federated learning method, apparatus, computer equipment and storage medium based on local differential privacy and split shuffling. Background Art
[0002] In real life, due to industry competition, privacy security, and complex administrative procedures, data often exists in the form of isolated islands between different institutions in most industries. And because data in reality is mostly distributed in different places, for example, many large multinational companies will establish data centers around the world to store data, so it is almost impossible to integrate data from various places and institutions. In order to solve the above problems, researchers have proposed the concept of federated learning. Federated learning is a machine learning framework that has received widespread attention in recent years. It can effectively help multiple institutions to complete data use and machine learning model training efficiently and conveniently. In a federated learning model, there is a server and multiple participants. The complete federated learning process of a round is as follows: In the first step, the server first initializes a model and sends the model parameters to each participant. In the second step, the participants use these parameters to build a model locally, then use local data to train the model, and send the gradient information of the trained model to the server. In the third step, after receiving the gradient information sent by each participant, the server processes the gradient information and updates the model. After completing one round, it starts from the second step and enters the next round, repeating continuously. In this way, the model can be trained using multi-party data without data exchange.
[0003] However, there are also user privacy security issues in federated learning. During the interactive process of federated learning, the gradient information of the model may be intercepted by malicious users and the private data of the participating nodes may be inferred; or malicious attackers may tamper with or replace the user's gradient information to launch poisoning attacks and destroy the model on the federated learning server side. Therefore, in order to prevent the leakage of gradient information, improve the security of federated learning, and ensure the privacy of user data, differential privacy technology and signature verification technology can be added to the federated learning process. Differential privacy protection is a privacy protection technology based on data distortion. It blurs the data and conceals sensitive data information by adding noise to the data, making the data impossible to restore. The existing federated learning process based on differential privacy is as follows: participants use local data to train the model. Before uploading the gradient information, they add noise that satisfies differential privacy to the gradient information, thereby providing differential privacy protection for the gradient information and achieving resistance to intrusions by external attackers such as background knowledge attacks; and signature verification technology ensures the security of user gradient information by using the RSA signature verification method.
[0004] Existing federated learning methods based on differential privacy still have certain problems. Since noise needs to be added to the gradient information, the performance of the trained model will decrease. Adding more noise can improve the privacy protection ability of the model, but it will also lead to worse model performance. Among the existing federated learning methods based on differential privacy, most of them cannot strike a good balance between privacy protection and model performance. How to train a high-performance model while ensuring strong privacy protection is still a challenging problem. Summary of the invention
[0005] The purpose of the present invention is to solve the above-mentioned defects in the prior art and provide a federated learning method, apparatus, computer device and storage medium based on local differential privacy and split shuffling.
[0006] The first object of the present invention can be achieved by adopting the following technical solutions:
[0007] A federated learning method based on local differential privacy and split shuffle, the federated learning method comprising the following steps:
[0008] S1, initialization phase: The federated learning server sends the initial model parameter θ0 to the federated learning client. The federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own id, and then receives the model parameter θ0 sent by the federated learning server and initializes the model locally.
[0009] S2. Model training: The federated learning client uses local data to train the model. After completing the model training, it uses the privacy protection algorithm Φ to process the gradient information g of the model to generate the privacy protection gradient g′. It then uses the RSA private key sk to encrypt the privacy protection gradient g′ to obtain the ciphertext c. It then concatenates the ciphertext c, the privacy protection gradient g′ and its own id to form a message M and sends it to the authentication server.
[0010] S3. Gradient information authentication and processing: After receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g′ to confirm that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradients g′ of all federated learning clients, randomly select the privacy-preserving gradients g′ of k clients, split and shuffle the privacy-preserving gradients g′ of k clients, obtain the gradient set G, and send it to the federated learning server;
[0011] S4. Gradient information aggregation: The federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, the new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iteration rounds, the federated learning method ends.
[0012] Furthermore, the model represents most common machine learning algorithms, such as convolutional neural network algorithms, fully connected neural network algorithms, etc. Since which specific algorithm to adopt depends on the specific task, and at the same time, the method described in the present invention is applicable to most common machine learning algorithms, so in the present invention, the common machine learning algorithms are collectively referred to as the model.
[0013] Furthermore, the process of step S1 is as follows:
[0014] S1a. The federated learning client uses a prime number generator to generate two large prime numbers (p, q), and calculates their product N = p × q;
[0015] S1b. The federated learning client calculates the least common multiple L of parameter p - 1 and parameter q - 1; according to parameter L, parameter E is obtained, where parameter E needs to satisfy that the greatest common divisor with parameter L is 1, and 1 < E < L; then parameter D is obtained, where parameter D needs to satisfy (E × D) mod L = 1, and 1 < D < L, where mod() represents the modulo operation;
[0016] S1c. The federated learning client obtains the RSA public key pk = <E, N> and the RSA private key sk = <D, N> based on the above parameters, and sends the RSA public key pk to the authentication server for registration. By registering in the authentication server, the security problem that the gradient information sent by the federated learning client is tampered with or intercepted by malicious attackers is solved;
[0017] S1d. The authentication server maintains a list P to store the RSA public key pk and id of the federated learning client. When the authentication server receives the RSA public key pk sent by the federated learning client, it assigns an id to this federated learning client, sends the id to the federated learning client, and stores the id and the RSA public key pk in the list P;
[0018] S1e. The federated learning server initializes the model, and the model parameter is θ0, and sends the model parameter θ0 to the federated learning client; after receiving the model parameter θ0, the federated learning client constructs a model locally.
[0019] Furthermore, the process of step S2 is as follows:
[0020] S2a, the federated learning client uses local data to train the model and expresses the gradient of the trained model as g = (g1, g2, …, g n ), where g i Represents the real value of the i-th dimension of the gradient information g;
[0021] S2b, convert the real number of each dimension in the model gradient information g into [-c·10 ρ ,c·10 ρ ], where c represents the range of the integer domain, and ρ represents the precision of the real number. When converting a real number, only ρ digits after the decimal point are retained;
[0022] S2c, calculate r and the interval [-c·10 ρ ,c·10 ρ The score of each integer in ] is calculated as follows:
[0023]
[0024] Among them, y represents the interval [-c·10 ρ ,c·10 ρ ], and y≠r; d(r,y) represents the Euclidean distance between r and y; α represents the privacy parameter, which is used to control the privacy protection strength;
[0025] S2d, calculation interval [-c·10 ρ ,c·10 ρ ] The probability of each integer being selected as the output is calculated as follows:
[0026]
[0027] in, represents the interval [-c·10 ρ ,c·10 ρ ]; r′ represents the interval [-c·10 ρ ,c·10 ρ ] is the integer selected as the output, r′≠r;
[0028] S2e, according to the probability of each integer being selected calculated in step S2d, select the integer from the interval [-c·10 ρ ,c·10 ρ] to replace the original value in the gradient information g. Since the integers that are closer to the original value in space have a larger score when calculating the scores of each integer in the interval, they have a greater probability of being selected to replace the original value. This can retain more information about the local model of the federated learning client and reduce the impact of adding too much noise on the federated learning server model. After replacing all the values in the gradient information g, the privacy-preserving gradient g′ is obtained.
[0029] S2f, the federated learning client uses the RSA private key sk=<D,N> , calculate the ciphertext c of the privacy-preserving gradient g′ used for authentication server verification = (g′) D mod N;
[0030] S2g, the federated learning client concatenates the ciphertext c, the privacy-preserving gradient g′ and its own id to obtain the message M=<c,g′,id> , send message M to the authentication server.
[0031] Furthermore, the process of step S3 is as follows:
[0032] S3a. The authentication server receives the message sent by the federated learning client and parses it into M=<c,g′,id> , obtain the RSA public key pk of the corresponding federated learning client from the list P according to the id value;
[0033] S3b, the authentication server resolves the RSA public key to pk=<E,N> , and use the following formula to decrypt the ciphertext c to get the plaintext m:
[0034] m=(c) E mod N
[0035] S3c, compare m and g′. If the two are the same, it means that the privacy-preserving gradient g′ sent by the federated learning client has not been replaced or tampered with, which ensures the correctness of the privacy-preserving gradient g′.
[0036] S3d. After the privacy protection gradient verification of all federated learning clients is completed, the authentication server randomly selects the privacy protection gradients g′ of k federated learning clients from all federated learning clients. Assuming there are B clients in total, the probability of selection is k / B, and the privacy protection gradients g′ of the unselected federated learning clients are discarded.
[0037] S3e. The authentication server splits and shuffles the privacy protection gradients of the k federated learning clients. The split and shuffle process destroys the inherent connection of the privacy protection gradients of each federated learning client. While ensuring that the federated learning server can obtain the correct privacy protection gradient, it avoids the federated learning server from performing a comprehensive analysis of the privacy protection gradients belonging to a federated learning client in each iteration, and analyzing the relevant information of the local data used by the federated learning client for model training.
[0038] S3f. The authentication server combines the split and shuffled privacy-preserving gradients into a set, denoted as G, and sends the set G to the federated learning server.
[0039] Furthermore, the process of splitting and shuffling in step S3e is as follows:
[0040] First, the values in the privacy-preserving gradient g′ are split, and only the dimension information of each value is retained. Then, the relative position of each value is shuffled and reordered. In this process, the dimension of each value in the gradient information does not change, but the relative position of each value in the same dimension is reordered. The k different values in the same dimension are represented as Among them, 1≤j≤k, Represents the jth value among k values of dimension i.
[0041] Furthermore, the process of step S4 is as follows:
[0042] S4a, the federated learning server receives the privacy-preserving gradient set G sent by the authentication server and starts aggregation. According to the dimension information of each value in the set, the average value of the gradient of each dimension is obtained to obtain the average gradient The aggregation formula is as follows:
[0043]
[0044] in, Represents the average gradient The value of the i-th dimension in , since the aggregated value is the sum and average of the privacy-preserving gradients, the split shuffle operation has no negative impact on the performance of the model on the federated learning server side. On the contrary, since the internal connection of the gradient information is destroyed, the overall privacy budget of the scheme is smaller, and the overall privacy protection strength of the scheme is improved;
[0045] S4b, using average gradient Update the model parameter θ0 to get the new model parameter θ1. The formula is as follows:
[0046]
[0047] Among them, γ represents the model learning rate set on the federated learning server, which is used to control the optimization rate of model parameters;
[0048] S4c, the federated learning server sends the model parameter θ1 to each federated learning client and starts a new round of iteration. When the total number of iterations reaches the preset total number of iterations, the federated learning method ends.
[0049] The second object of the present invention is achieved by the following technical solutions:
[0050] A federated learning device based on local differential privacy and split shuffling, the federated learning device comprising:
[0051] Initialization module: The federated learning server sends the initial model parameter θ0 to the federated learning client. The federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own ID, and then receives the model parameter θ0 sent by the federated learning server and initializes the model locally.
[0052] In the model training module, the federated learning client uses local data to train the model. After completing the model training, it uses the privacy protection algorithm Φ to process the gradient information g of the model to generate the privacy protection gradient g′. It then uses the RSA private key sk to encrypt the privacy protection gradient g′ to obtain the ciphertext c. It then concatenates the ciphertext c, the privacy protection gradient g′ and its own id to form a message M and sends it to the authentication server.
[0053] Gradient information authentication module: after receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g′ to confirm that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradients g′ of all federated learning clients, randomly select the privacy-preserving gradients g′ of k clients, split and shuffle the privacy-preserving gradients g′ of k clients, obtain the gradient set G, and send it to the federated learning server;
[0054] Gradient information aggregation module, the federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, the new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iterations, the federated learning method ends.
[0055] The third object of the present invention is achieved through the following technical solutions:
[0056] A computer device includes a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the above-mentioned federated learning method based on local differential privacy and split shuffling is implemented.
[0057] The fourth object of the present invention is achieved by the following technical solutions:
[0058] A storage medium stores a program, which, when executed by a processor, implements the above-mentioned federated learning method based on local differential privacy and split shuffling.
[0059] Compared with the prior art, the present invention has the following advantages and effects:
[0060] 1. Better model performance. The present invention uses local differential privacy of the exponential mechanism to better implement differential privacy protection for gradient information. In the prior art, most differential privacy schemes implement differential privacy protection by adding noise, but this method requires careful design of the noise size, which can easily lead to excessive noise addition and excessive deviation from the original value, thereby affecting the performance of the model. The present invention uses an exponential mechanism to implement differential privacy protection for gradient information. In the present invention, a real value is converted into an integer, and then a probability is calculated for each number in a pre-set integer interval, and the probability of each integer in the interval is selected, so that the final output result is closer to the original gradient information, reducing the negative impact of the difference between the output result and the original gradient information on the model performance. While providing differential privacy protection, the performance of the machine learning model can be made closer to the model trained using the original gradient information.
[0061] 2. Higher security. The present invention uploads the privacy-protected gradient information to the authentication server for authentication, thereby ensuring the correctness of the gradient information. In the prior art, most of the client's gradient information is not verified for correctness before being uploaded to the federated learning server, and it is impossible to avoid the possibility of the gradient information being tampered with or replaced by malicious attackers. When subjected to poisoning attacks by malicious attackers, the correctness of the gradient information cannot be guaranteed. The present invention verifies the gradient information sent by the federated learning client using a trusted authentication server, thereby ensuring that the gradient information will not be replaced or tampered with by malicious attackers, thereby protecting the machine learning model from poisoning attacks and ensuring the security of the machine learning model.
[0062] 3. Stronger privacy protection capabilities. The present invention performs a split-shuffle process before uploading the gradient information to the federated learning server, thereby improving the privacy protection strength. In most current federated learning, the gradient information is directly sent to the federated learning server, so that the federated learning server can obtain the relationship between the gradient information and the client, which reduces the privacy protection strength. In the present invention, the gradient information is split and shuffled by the authentication server, which destroys the subordinate relationship between the gradient information and the client, so that the federated learning server cannot analyze the relevant client information through the gradient information, thereby reducing the privacy budget required by the scheme. According to the definition of differential privacy, the larger the privacy budget, the lower the privacy protection strength; therefore, by splitting and shuffling the gradient information, the privacy protection strength of the scheme is enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0064] Figure 1 is a flow chart of a federated learning method based on local differential privacy disclosed in an embodiment of the present invention;
[0065] Figure 2 It is a schematic diagram of the application environment of the federated learning method based on local differential privacy disclosed in an embodiment of the present invention;
[0066] Figure 3 is a schematic diagram of the splitting and shuffling steps in the present invention;
[0067] Figure 4 is a structural block diagram of a federated learning device in Embodiment 3 of the present invention;
[0068] Figure 5 It is a structural block diagram of the computer device in Example 4 of the present invention. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not 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.
[0070] Example 1
[0071] In this embodiment, there are 100 federated learning clients; the gradient information uploaded by the clients contains T dimensions; the total number of iterative rounds is 20; the privacy budget is set to ∈ = 1; the MNIST handwritten dataset is used. The specific process of this example is as follows:
[0072] T1. Each federated learning client uses a prime number generator to generate two large prime numbers (p, q), calculate their product N = p × q, the least common multiple L of parameters p - 1 and q - 1, and find parameter E based on parameter L. Among them, parameter E needs to satisfy that the greatest common divisor with parameter L is 1, and 1 < E < L; then find parameter D, where parameter D needs to satisfy E × D mod L = 1, and 1 < D < L; finally, each federated learning client obtains the RSA public key pk = <E, N> and RSA private key sk = <D, N> based on the above parameters, and sends the RSA public key pk to the authentication server for registration;
[0073] T2. The authentication server maintains a list P to store the RSA public keys pk and ids of the federated learning clients. When the authentication server receives the RSA public key pk sent by the federated learning client, it assigns an id to each federated learning client, sends the id to the client, and combines the id and the RSA public key pk into a key - value pair (id, pk) and stores it in the list.
[0074] T3. Assume that the initial model parameters of the federated learning server - side are θ0, and send the model parameters θ0 to each federated learning client; after receiving the model parameters θ0, the federated learning client constructs a model locally and trains the model using local data. Represent the gradient of the trained model as g = (g1, g2, …, g T ), where g i represents the real - valued number of the i - th dimension of the gradient g, 1 ≤ i ≤ T; then, the federated learning client converts each real - valued number in the model gradient g into an integer r within [-c·10 ρ , c·10 ρ . Among them, c represents the range of the above - mentioned integer domain, ρ represents the precision of the real number. When converting, a real number only retains ρ digits after the decimal point. Here, take c = 1, ρ = 8, then the interval is [-1·10 8 , 1·10 8 .
[0075] T4. After a real - valued number is converted into an integer r, calculate the fraction of r with each integer within the interval [-1·10 8 , 1·10 8 , and calculate the interval [-1·10 8 , 1·10 8] is selected as the output probability. According to this probability, from the interval [-1·10 8 ,1·10 8 ] to replace the original value in the gradient g; after replacing all values in the gradient g, the privacy-preserving gradient g′ is obtained.
[0076] T5. The federated learning client uses its own RSA private key sk=<D,N> , calculate the ciphertext c of the privacy-preserving gradient g′ used for authentication server verification = (g′) D mod N; concatenate the ciphertext c, privacy protection gradient g′ and its own id to get the message M=<c,g′,id> , sent to the authentication server.
[0077] T6. The authentication server receives the message sent by the federated learning client and parses it into M=<c,g′,id> , get the RSA public key pk of the corresponding federated learning client from the list according to the id value, and parse the RSA public key into pk=<E,N> , and calculate the plaintext m, compare m with g′, and ensure the correctness of the privacy protection gradient g′. After the privacy protection gradient verification of all federated learning clients is completed, the authentication server needs to randomly select the privacy protection gradients of k clients from them, with a selection probability of k / N. The privacy protection gradients of unselected clients will be discarded.
[0078] T7, the authentication server splits and shuffles the privacy protection gradients of the k clients. Figure 3 As shown in Figure 1, we first split the values in the privacy-preserving gradient and retain only the dimension information of each value. Then we shuffle them and reorder them. For the convenience of description, we represent k different values in the same dimension as Among them, 1≤j≤k, represents the jth value among the k dimensions i. The authentication server combines the split and shuffled privacy-preserving gradients into a set, denoted as G, and sends the set G to the federated learning server.
[0079] T8. The federated learning server receives the privacy-preserving gradient set G sent by the authentication server and starts aggregation. According to the dimension information of each value in the set, the average value of the gradient of each dimension is obtained to obtain the average gradient Use average gradient Update the model parameter θ0 to obtain the new model parameter θ1, and send the parameter θ1 to each federated learning client to start a new round of iteration.
[0080] T9. After all 20 rounds of iteration are completed, the final model on the federated learning server side is verified using the test data set, and the final accuracy is 95.83%, which is only 1.43% lower than the accuracy without using the privacy protection algorithm. Compared with other privacy protection algorithms, the local differential privacy protection method disclosed in the present invention has advantages both in terms of privacy protection intensity and the final accuracy of the model.
[0081] Example 2
[0082] In this Example 2, the preset conditions are as follows: there are 500 federated learning clients; the gradient information uploaded by the clients contains H dimensions; the total number of iteration rounds is 30; the privacy budget is set to ∈ = 10; the CIFAR-10 image classification data set is used. The specific process of this example is as follows:
[0083] T1. Each federated learning client uses a prime number generator to generate two large prime numbers (p, q), and calculate their product N = p × q, the least common multiple L of parameters p - 1 and parameter q - 1, and find parameter E according to parameter L, where parameter E needs to satisfy that the greatest common divisor with parameter L is 1, and 1 < E < L; then find parameter D, where parameter D needs to satisfy E × D mod L = 1, and 1 < D < L; finally, each federated learning client obtains the RSA public key pk = <e, N> and the RSA private key sk = <D, N> according to the above parameters, and sends the RSA public key pk to the authentication server for registration;
[0084] T2. The authentication server maintains a list P to store the RSA public key pk and id of the federated learning client. When the authentication server receives the RSA public key pk sent by the federated learning client, it assigns an id to each federated learning client, sends the id to the client, and combines the id and the RSA public key pk into a key-value pair (id, pk) and stores it in the list.
[0085] T3. Assume that the initial model parameters of the federated learning server side are θ0, and send the model parameters θ0 to each federated learning client; after receiving the model parameters θ0, the federated learning client constructs a model locally and uses the local data to train the model, and represents the gradient of the trained model as g = (g1, g2,..., g T ), where g i represents the real value of the i-th dimension of the gradient g, 1 ≤ i ≤ T; then, the federated learning client converts each real number in the model gradient g into [-c·10 ρ , c·10 ρ], where c represents the range of the integer domain, and ρ represents the precision of the real number. When converting a real number, only ρ digits after the decimal point are retained. Here, c = 1, ρ = 8, and the interval is [-1·10 8 ,1·10 8 ].
[0086] T4. After a real value is converted to an integer r, calculate the difference between r and the interval [-1·10 8 ,1·10 8 ], and calculate the interval [-1·10 8 ,1·10 8 ] is selected as the output probability. According to this probability, from the interval [-1·10 8 ,1·10 8 ] to replace the original value in the gradient g; after replacing all values in the gradient g, the privacy-preserving gradient g′ is obtained.
[0087] T5. The federated learning client uses its own RSA private key sk=<D,N> , calculate the ciphertext c of the privacy-preserving gradient g′ used for authentication server verification = (g′) D mod N; concatenate the ciphertext c, privacy protection gradient g′ and its own id to get the message M=<c,g′,id> , sent to the authentication server.
[0088] T6. The authentication server receives the message sent by the federated learning client and parses it into M=<c,g′,id> , get the RSA public key pk of the corresponding federated learning client from the list according to the id value, and parse the RSA public key into pk=<E,N> , and calculate the plaintext m, compare m with g′, and ensure the correctness of the privacy protection gradient g′. After the privacy protection gradient verification of all federated learning clients is completed, the authentication server needs to randomly select the privacy protection gradients of k clients from them, with a selection probability of k / N. The privacy protection gradients of unselected clients will be discarded.
[0089] T7, the authentication server splits and shuffles the privacy protection gradients of the k clients. Figure 3 As shown in Figure 1, we first split the values in the privacy-preserving gradient and retain only the dimension information of each value. Then we shuffle them and reorder them. For the convenience of description, we represent k different values in the same dimension as Among them, 1≤j≤k, represents the jth value among the k dimensions i. The authentication server combines the split and shuffled privacy-preserving gradients into a set, denoted as G, and sends the set G to the federated learning server.
[0090] T8. The federated learning server receives the privacy-preserving gradient set G sent by the authentication server and starts aggregation. According to the dimension information of each value in the set, the average value of the gradient of each dimension is obtained to obtain the average gradient Use average gradient Update the model parameter θ0 to obtain the new model parameter θ1, and send the parameter θ1 to each federated learning client to start a new round of iteration.
[0091] T9. After completing all 30 rounds of iterations, the final model of the federated learning server was verified using a test data set, and the final accuracy was 59.68%, which was only 1.78% lower than the accuracy without using a privacy protection algorithm. Compared with other privacy protection algorithms, the local differential privacy protection method disclosed in the present invention has advantages in terms of privacy protection strength and the final accuracy of the model.
[0092] Example 3
[0093] like Figure 4 As shown, this embodiment provides a federated learning device based on local differential privacy and split shuffling, which includes an initialization module 401, a model training module 402, a gradient information authentication module 403, and a gradient information aggregation module 404. The specific functions of each module are as follows:
[0094] Initialization module 401, the federated learning server sends the initial model parameter θ0 to the federated learning client, the federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own id, and then receives the model parameter θ0 sent by the federated learning server, and initializes the model locally;
[0095] In the model training module 402, the federated learning client uses local data to train the model. After completing the model training, the privacy protection algorithm Φ is used to process the gradient information g of the model to generate the privacy protection gradient g′. The privacy protection gradient g′ is then encrypted using the RSA private key sk to obtain the ciphertext c. The ciphertext c, the privacy protection gradient g′ and its own id are concatenated into a message M and sent to the authentication server.
[0096] Gradient information authentication module 403: after receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, compares the decryption result with the privacy-preserving gradient g′, and confirms that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradients g′ of all federated learning clients, randomly selects the privacy-preserving gradients g′ of k clients, splits and shuffles the privacy-preserving gradients g′ of k clients, obtains the gradient set G, and sends it to the federated learning server;
[0097] Gradient information aggregation module 404, the federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, a new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iterations, the federated learning method ends.
[0098] Example 4
[0099] This embodiment provides a computer device, which may be a computer, such as Figure 5 As shown, a processor 502, a memory, an input device 503, a display 504 and a network interface 505 connected through a system bus 501, the processor is used to provide computing and control capabilities, the memory includes a non-volatile storage medium 506 and an internal memory 507, the non-volatile storage medium 506 stores an operating system, a computer program and a database, the internal memory 507 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium, when the processor 502 executes the computer program stored in the memory, a federated learning method based on local differential privacy and split shuffling proposed by the present invention is implemented, including the following steps:
[0100] S1, initialization phase: The federated learning server sends the initial model parameter θ0 to the federated learning client. The federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own id, and then receives the model parameter θ0 sent by the federated learning server and initializes the model locally.
[0101] S2. Model training: The federated learning client uses local data to train the model. After completing the model training, it uses the privacy protection algorithm Φ to process the gradient information g of the model to generate the privacy protection gradient g′. It then uses the RSA private key sk to encrypt the privacy protection gradient g′ to obtain the ciphertext c. It then concatenates the ciphertext c, the privacy protection gradient g′ and its own id to form a message M and sends it to the authentication server.
[0102] S3. Gradient information authentication and processing: After receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g′ to confirm that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradients g′ of all federated learning clients, randomly select the privacy-preserving gradients g′ of k clients, split and shuffle the privacy-preserving gradients g′ of k clients, obtain the gradient set G, and send it to the federated learning server;
[0103] S4, gradient information aggregation: The federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, the new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iterations, the federated learning method ends.
[0104] Example 5
[0105] This embodiment provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, a federated learning method based on local differential privacy and split-shuffle proposed by the present invention is implemented, including the following steps:
[0106] S1, initialization phase: The federated learning server sends the initial model parameter θ0 to the federated learning client. The federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own id, and then receives the model parameter θ0 sent by the federated learning server and initializes the model locally.
[0107] S2. Model training: The federated learning client uses local data to train the model. After completing the model training, it uses the privacy protection algorithm Φ to process the gradient information g of the model to generate the privacy protection gradient g′. It then uses the RSA private key sk to encrypt the privacy protection gradient g′ to obtain the ciphertext c. It then concatenates the ciphertext c, the privacy protection gradient g′ and its own id to form a message M and sends it to the authentication server.
[0108] S3. Gradient information authentication and processing: After receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g′ to confirm that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradients g′ of all federated learning clients, randomly select the privacy-preserving gradients g′ of k clients, split and shuffle the privacy-preserving gradients g′ of k clients, obtain the gradient set G, and send it to the federated learning server;
[0109] S4, gradient information aggregation: The federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, the new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iterations, the federated learning method ends.
[0110] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A federated learning method based on local differential privacy and split-shuffle, characterized in that: The described federated learning method includes the following steps: S1. Initialization phase: The federated learning server sends the initial model parameters θ0 to the federated learning clients. The federated learning clients generate an RSA public key pk and an RSA private key sk, send the RSA public key pk to the authentication server for registration to obtain their own ids, then receive the model parameters θ0 sent by the federated learning server, and initialize the model locally. S2. Model training: The federated learning client uses local data to train the model. After completing the model training, it uses the privacy protection algorithm Φ to process the model’s gradient information g and generate the privacy protection gradient g. ′ ; Then use the RSA private key sk to encrypt the privacy-preserving gradient g′ to obtain the ciphertext c, and then encrypt the ciphertext c and the privacy-preserving gradient g ′ It is concatenated with its own ID to form a message M and sent to the authentication server; The process of step S2 is as follows: S2a, the federated learning client uses local data to train the model and expresses the gradient of the trained model as g = (g1, g2, …, g n ), where g i Represents the real value of the i-th dimension of the gradient information g; S2b, convert the real number of each dimension in the model gradient information g into [-c·10 ρ ,c·10 ρ ], where c represents the range of the integer domain, and ρ represents the precision of the real number. When converting a real number, only ρ digits after the decimal point are retained; S2c, calculate r and the interval [-c·10 ρ ,c·10 ρ The score of each integer in ] is calculated as follows: Among them, y represents the interval [-c·10 ρ ,c·10 ρ ], and y≠r; d(r,y) represents the Euclidean distance between r and y; α represents the privacy parameter, which is used to control the privacy protection strength; S2d, calculation interval [-c·10 ρ ,c·10 ρ ] The probability of each integer being selected as the output is calculated as follows: in, represents the interval [-c·10 ρ ,c·10 ρ ]; r′ represents the interval [-c·10 ρ ,c·10 ρ ] is the integer selected as the output, r′≠r; S2e, according to the probability of each integer being selected calculated in step S2d, select the integer from the interval [-c·10 ρ ,c·10 ρ ] select an integer to replace the original value in the gradient information g; after replacing all the values in the gradient information g, the privacy-preserving gradient g is obtained. ′ ; S2f, federated learning client uses RSA private key sk=<D,N> , calculate the ciphertext c of the privacy-preserving gradient g′ used for authentication server verification = (g′) D mod N; S2g, the federated learning client sends the ciphertext c and the privacy-preserving gradient g ′ Cascade with its own id to get message M=<c,g′,id> , send the message M to the authentication server; S3. Gradient information authentication and processing: After receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g′ to confirm that the privacy-preserving gradient g′ has not been replaced or tampered with; after collecting the privacy-preserving gradient g′ of all federated learning clients, the authentication server will ′ Then, randomly select k clients’ privacy protection gradients g ′ , the privacy protection gradient g for k clients ′ Perform split shuffle processing to obtain the gradient set G and send it to the federated learning server; S4. Gradient information aggregation: The federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, then updates the model on the authentication server using the aggregated gradient information. After the model update is completed, new model parameters θ1 are obtained, and the model parameters θ1 are sent to the federated learning clients to start a new round of iteration. After the preset total number of iteration rounds is completed, the federated learning method ends.
2. The federated learning method based on local differential privacy and split-shuffle according to claim 1, characterized in that: The model represents a machine learning algorithm, and the machine learning algorithm is a convolutional neural network algorithm or a fully connected neural network algorithm.
3. The federated learning method based on local differential privacy and split-shuffle according to claim 1, characterized in that: The process of step S1 is as follows: S1a, Federated Learning Client Using Prime Number Generator Generate two large prime numbers (p, q) and calculate their product N = p × q; S1b. The federated learning client calculates the least common multiple L of the parameters p-1 and q-1; calculates the parameter E based on the parameter L, where the parameter E needs to satisfy that the greatest common divisor with the parameter L is 1, and 1 < E < L; then calculates the parameter D, where the parameter D needs to satisfy (E × D) mod L = 1, and 1 < D < L, where mod() represents the modulo operation. S1c. The federated learning client obtains the RSA public key pk = <E, N> and the RSA private key sk = <D, N> based on the above parameters, and sends the RSA public key pk to the authentication server for registration. S1d. The authentication server maintains a list P to store the RSA public key pk and id of the federated learning client. When the authentication server receives the RSA public key pk sent by the federated learning client, it assigns an id to the federated learning client, sends the id to the federated learning client, and stores the id and the RSA public key pk in the list P. S1e. The federated learning server initializes the model with the model parameters θ0, and sends the model parameters θ0 to the federated learning client; after receiving the model parameters θ0, the federated learning client constructs the model locally.
4. The federated learning method based on local differential privacy and split-shuffle according to claim 1, characterized in that: The process of step S3 is as follows: S3a. The authentication server receives the message sent by the federated learning client and parses it as M = <c, g′, id>, and obtains the corresponding RSA public key pk of the federated learning client from the list P according to the id value. S3b. The authentication server parses the RSA public key as pk = <E, N>, and decrypts the ciphertext c using the following formula to obtain the plaintext m: m=(c) E mod N S3c, comparison between m and g ′ , if the two are the same, it means that the privacy-preserving gradient g sent by the federated learning client is ′ has not been replaced or tampered with, ensuring the privacy protection gradient g ′ Correctness; S3d. When the privacy protection gradients of all federated learning clients are verified, the authentication server randomly selects the privacy protection gradients g of k federated learning clients from all federated learning clients. ′ , assuming there are B clients in total, the probability of selection is k / B, and the privacy protection gradient g of the unselected federated learning client is discarded ′ ; S3e. The authentication server performs a split and shuffle process on the privacy-preserving gradients of these k federated learning clients. S3f. The authentication server combines the split and shuffled privacy-preserving gradients into a set, denoted as G, and sends the set G to the federated learning server.
5. The method for federated learning based on local differential privacy and split-shuffle according to claim 4, characterized in that: The process of the split and shuffle process in step S3e is as follows: First, the privacy protection gradient g ′ The values in are split, only the dimension information of each value is retained, and then the relative position of each value is shuffled and reordered, and k different values in the same dimension are represented as Among them, 1≤j≤k, Represents the jth value among k values of dimension i.
6. The method for federated learning based on local differential privacy and split-shuffle according to claim 1, characterized in that: The process of step S4 is as follows: S4a, the federated learning server receives the privacy-preserving gradient set G sent by the authentication server and starts aggregation. According to the dimension information of each value in the set, the average value of the gradient of each dimension is obtained to obtain the average gradient The aggregation formula is as follows: in, Represents the average gradient The value of the i-th dimension in ; S4b, using average gradient Update the model parameter θ0 to get the new model parameter θ1. The formula is as follows: Among them, γ represents the model learning rate set on the federated learning server, which is used to control the optimization rate of model parameters; S4c, the federated learning server sends the model parameter θ1 to each federated learning client and starts a new round of iteration. When the total number of iterations reaches the preset total number of iterations, the federated learning method ends.
7. A federated learning device based on the federated learning method based on local differential privacy and split shuffle according to any one of claims 1 to 6, characterized in that: The federated learning device comprises: Initialization module: The federated learning server sends the initial model parameter θ0 to the federated learning client. The federated learning client generates an RSA public key pk and an RSA private key sk, sends the RSA public key pk to the authentication server for registration, obtains its own ID, and then receives the model parameter θ0 sent by the federated learning server and initializes the model locally. In the model training module, the federated learning client uses local data to train the model. After the model training is completed, the privacy protection algorithm Φ is used to process the gradient information g of the model to generate the privacy protection gradient g. ′ ; Then use the RSA private key sk to encrypt the privacy-preserving gradient g′ to obtain the ciphertext c, and then encrypt the ciphertext c and the privacy-preserving gradient g ′ It is concatenated with its own ID to form a message M and sent to the authentication server; Gradient information authentication module, after receiving the message sent by the federated learning client, the authentication server parses the message, obtains the corresponding RSA public key pk according to the id, uses the public key pk to decrypt the ciphertext c, and compares the decryption result with the privacy-preserving gradient g ′ Compare and confirm the privacy protection gradient g ′ It has not been replaced or tampered with; after collecting the privacy protection gradient g of all federated learning clients ′ Then, randomly select k clients’ privacy protection gradients g ′ , the privacy protection gradient g for k clients ′ Perform split shuffle processing to obtain the gradient set G and send it to the federated learning server; Gradient information aggregation module, the federated learning server receives the gradient set G sent from the authentication server, aggregates the gradient information in the gradient set G, and then uses the aggregated gradient information to update the model on the authentication server. After the model update is completed, the new model parameter θ1 is obtained, and the model parameter θ1 is sent to the federated learning client to start a new round of iteration. After completing the preset total number of iterations, the federated learning method ends.
8. A computer device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, it implements the federated learning method based on local differential privacy and split shuffling as described in any one of claims 1-6.
9. A storage medium storing a program, characterized in that: When the program is executed by a processor, the federated learning method based on local differential privacy and split shuffling described in any one of claims 1 to 6 is implemented.
