A federated machine learning method and system that takes into account both robustness and privacy protection

Through encryption key set and secret sharing technology, the malicious poisoning model is identified and removed, the robustness and privacy protection of federated learning are improved, the problems of malicious attacks and privacy leakage in the existing technology are solved, and efficient security is achieved polymerization.

CN117828627BActive Publication Date: 2024-11-15ANHUI NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311575911.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-22
Publication Date
2024-11-15
Estimated Expiration
2043-11-22

AI Technical Summary

Technical Problem

Existing federated learning technologies are inadequate in terms of data sharing and privacy protection, they are vulnerable to malicious poisoning attacks and have a high risk of privacy leakage.

Method used

Using encryption key set and secret sharing technology, the encryption key and aggregation key are generated for the client through the key generation center. The aggregation server generates a wizard gradient and encrypts vectors. The client uses the encryption key and secret sharing algorithm to build similar gradients. Query the key to realize the identification and safe aggregation of malicious poisoning models.

Benefits of technology

It improves the training accuracy and robustness of the federated learning model, ensures the protection of user privacy, reduces the risk of privacy leakage, and realizes efficient secure aggregation of encryption models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117828627B_ABST
    Figure CN117828627B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of federated learning, and in particular to a method and system for federated machine learning that takes both robustness and privacy protection into consideration, comprising the following steps: a key generation center generates a key set for a client and an aggregation server, each client uses a local data set to train a model to generate a local model update, and encrypts the model update into a ciphertext and sends it to an aggregation server to assist in generating a global model update, wherein some clients are malicious clients that will forge local model updates and initiate poisoning attacks, the aggregation server trains a wizard model update, and uses a designed similarity gradient query algorithm based on the wizard model to screen out malicious model updates, and finally, the aggregation server deletes the identified poisonous model updates, and obtains a global model update through a data security aggregation method based on a matrix cipher. The present invention realizes the data security of model parameters of federated learning, the privacy protection of users, and the robustness against model poisoning attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a federated learning method and system that takes both robustness and privacy protection into consideration. Background Art

[0002] At present, machine learning is the most representative artificial intelligence technology. It requires a huge amount of data as support. The more data, the better the algorithm model obtained by training, and the stronger the generalization ability of the model. However, with the increasingly stringent management of data privacy and security, it is becoming more and more difficult to collect and share data between different organizations. Data, as the "fuel" of machine learning, is difficult to be fully shared, which will lead to huge challenges in the development of machine learning. In order to solve this problem, people began to seek a method to train machine learning models without centralizing all data to a central server.

[0003] Federated learning provides a distributed machine learning framework with privacy protection features, and can collaborate with thousands of participants in a distributed manner to iteratively train a specific machine learning model. In federated learning, each participant trains an initial model using their own data set and sends model parameter updates to the aggregation server. The aggregation server aggregates the received model updates to obtain a global model. This mechanism can not only share the training data of all parties, but also protect the privacy of the participants, and to a certain extent solves the data island problem faced by traditional machine learning.

[0004] When conducting federated learning with existing technologies, cloud servers cannot access the local data and training process permissions of each participant, making them vulnerable to poisoning attacks by malicious participants, reducing the robustness of federated learning and thus affecting the accuracy of the global model. In addition, each participant needs to share the parameter updates of the local model with other participants. The parameter updates contain the privacy information of the participants, which may cause the user's personal information to be leaked to untrusted servers or other malicious users. Federated learning faces serious risks of privacy leakage. Summary of the invention

[0005] The purpose of the present invention is to provide a robust privacy-preserving federated learning framework and method to solve the technical problem in the prior art that privacy leakage and poisoning attacks reduce the robustness of federated learning.

[0006] In order to solve the above technical problems, the present invention specifically provides the following technical solutions:

[0007] A federated learning method that takes both robustness and privacy protection into consideration, including:

[0008] Step S1, a key generation center generates an encryption key set for encrypting the model, an aggregation key set for performing aggregation calculation, and a deaggregation key for performing aggregate decryption of the model ciphertext for each client, and sends the encryption key set and the aggregation key set to each client, and sends the deaggregation key to the aggregation server;

[0009] Step S2: the aggregation server trains and generates a wizard model for screening clients, generates a wizard gradient during the training of the wizard model, and performs vector encryption on the wizard gradient to obtain a wizard gradient ciphertext;

[0010] Step S3: the aggregation server broadcasts the guide gradient ciphertext to each client;

[0011] Step S4: Each client uses the local data set to train and update the local model, obtains the local gradient of the current local model, and encrypts the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext;

[0012] Step S5: Each client constructs a vector X according to the guide gradient ciphertext and the encryption key set. i , and the matrix Y i , to generate a similar gradient query key qk containing local privacy information i =(X i ,Y i );

[0013] Step S6: Each client uses a secret sharing algorithm and an ElGamal public key encryption system to encrypt and share the aggregate key to obtain a ciphertext of the secret sharing value of the aggregate key;

[0014] Step S7, each client sends the local gradient ciphertext, the secret shared value ciphertext and the similarity gradient query key of the updated local model to the aggregation server;

[0015] Step S8: The aggregation server uses the similar gradient query key to perform security screening in the local gradient ciphertext of the updated local model to obtain k updated local models, and securely aggregates the k updated local models to obtain an aggregate value of the local gradient ciphertext;

[0016] Step S9: Reconstruct the aggregate key based on the secret shared value ciphertext by using the secret sharing homomorphic property, and decrypt the aggregate value and the aggregate key of the local gradient ciphertext by using the deaggregation key to obtain the local gradient aggregate value plaintext for updating the global model, so as to realize the update of the global model;

[0017] Step S10: The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model.

[0018] As a preferred solution of the present invention, the generation of the encryption key set, the aggregation key set and the de-aggregation key includes:

[0019] Given system security parameter 1 k , the key generation center selects a large prime number p, two positive real numbers α, β∈R + , a real number μ∈R and two (d+1)-dimensional vectors r=(r1,r2,…,r d+1 )∈R d+1 ,s=(s1,s2,…,s d+1 )∈R d+1 , and generate n different (2d+2)×(2d+2)-dimensional reversible matrices M i ∈R (2d+2)×(2d+2) , generate the encryption key set ek for each client i ={α,β,μ,r,s,M i}, where r1, r2, r d+1 , s1, s2, s d+1 are all random parameters, ek i is the encryption key set of the i-th client, i is the counting variable of the client, i∈[1,n], n is the total number of clients;

[0020] The key generation center randomly generates a matrix The rank of the matrix D is d, and the elements in D belong to the finite field Z p , m is a random number greater than d;

[0021] Using the matrix D, the key generation center uses the function B = MMI (D, p) to generate the modular inverse matrix MMI is the function body for calculating modular inverse matrix;

[0022] Use the function F = ModNull(D T , p) Generate the modular null space D T is the transposed matrix of D, ModNull is the function body for computing the modulo null space;

[0023] Among them, matrices B and F T Satisfy the equation B*D=I and F respectively T *D=0, I is the identity matrix, F T is the transposed matrix of F;

[0024] The key generation center generates n different arbitrary matrices

[0025] Calculate n generalized modular inverse matrices The key generation center will FT Split into n shared values ​​F i T , so that it satisfies And generate a random vector Calculate the key kF i T , generate the aggregate key set for each client ak i is the aggregate key set of the i-th client, i∈[1,n];

[0026] The key generation center uses the ElGamal public key encryption system to generate a public-private key pair (pk i ,sk i ), pk i is the public key of the ith client, sk i is the private key of the i-th client;

[0027] The key generation center sends the key set {ek i ,ak i ,sk i} and the public key list {pk i |i∈[1,n]} is sent to all clients, and at the same time, the matrix D is sent to the aggregation server as the deaggregation key.

[0028] As a preferred solution of the present invention, the step of performing vector encryption on the guide gradient to obtain the guide gradient ciphertext includes:

[0029] Use the aggregation server to train a server model w using a training dataset D0 owned by the server i , obtain the wizard model;

[0030] In the training process of the guide model, the guide gradient is generated by the stochastic gradient descent algorithm. Satisfy the equation In the formula, L(w i ,D0) is the loss function, is a derivative operation, D0 is the training data set owned by the server, i is the i-th client, and w is the initialization state. i They are all the same;

[0031] Use the aggregation server to generate a d-dimensional random perturbation vector t = (t1, t2, ..., t d )∈R d The wizard gradient Encryption is performed to obtain the encrypted ciphertext form of the guide gradient And the encrypted form of the wizard gradient and the current global model Wnow Broadcast to all clients;

[0032] in,

[0033] As a preferred solution of the present invention, the step of encrypting the local gradient using an encryption key in an encryption key set to obtain a local gradient ciphertext includes:

[0034] Each client receives the global model w sent by the aggregation server now Replace it with the current local model, and then use the client to use the local dataset D i ,i∈[1,n] trains the local model w now , D i is the local data set of the i-th client;

[0035] Use the client to obtain the local model w now The local gradient g i =(g i1 , g i2 , …, g id )∈R d ;

[0036] Utilize the client to use the encryption key set ek i The encryption key in the (2d+2)-dimensional vector is calculated And according to the vector g i 'Calculate the first vector c of the encrypted local gradient i1 =g i ′M i -1 ;

[0037] Use the aggregate key set ak i The aggregation key in the encrypted local gradient is calculated as the second vector c i2 =g i E i +kF i T ;

[0038] Finally, the local gradient is encrypted according to the first vector and the second vector to obtain the local gradient ciphertext c i =(c i1 ,c i2 ), where c i is the local gradient ciphertext of the i-th client.

[0039] As a preferred solution of the present invention, the similarity gradient query key qk i =(X i , Y i ), including:

[0040] Each client passes the formula and Y i(jl) =β(M i(j,2l) -M i(j,2l-1) ),j∈[1,2d+2],l∈[1,d] calculates a (2d+2)-dimensional vector X i and a (2d+2)×(d) dimensional matrix Y i , where X i(j) Yes X i The jth element of Y i(jl) Yes i The element in the jth row and lth column of M i(j,l) It is M i The element at the jth row and lth column of ;

[0041] According to the vector X i and the matrix Y i , generate similarity gradient query key qk i =(X i ,Y i ).

[0042] As a preferred solution of the present invention, the generation of the secret shared value ciphertext of the aggregate key includes:

[0043] Each client uses a secret sharing algorithm Aggregate key set ak i The vector kF i T Generate n secret shared values

[0044] The client uses the ElGamal public key encryption system to encrypt the secret shared value Encrypt and obtain the secret shared value ciphertext F i ={F i,j |j∈C}, where In the formula, PK j represents the public key of the jth client, Encrypted by ElGamal public key encryption Generate ciphertext F ij , To generate a secret shared value through a secret sharing algorithm j is the counting variable of the client, and C is the client set.

[0045] As a preferred solution of the present invention, the security screening of k updated local models includes:

[0046] The aggregation server first uses the client's similarity gradient query key qki =(X i ,Y i ) performs a query calculation on the guide gradient ciphertext to obtain an encrypted vector that can be used for distance comparison with the encrypted ciphertext form of the local gradient in

[0047] According to the previous formula and Y i(jl) =β(M i(j,2l) -M i(j,2l-1) ),j∈[1,2d+2],l∈[1,d], Expressed as In the formula Represents a (2d+2)-dimensional vector Is the guide gradient The perturbation vector t=(t1,t2,…,t d )∈R d ;

[0048] Aggregate servers by formula Calculate the distance between the guide gradient ciphertext and the local gradient ciphertext based on the formula The calculation of the aggregation server is done by the formula Compare two different local gradient ciphertexts g i ,g k and the guide gradient ciphertext The distance between Yes i and The distance between Yes k and The distance between

[0049] Among them, if It means Otherwise, it means In the formula, refers to the local gradient g k The distance from the guide gradient to the local gradient g i Closer, refers to the local gradient g i The distance from the guide gradient to the local gradient g k Closer;

[0050] The aggregation server calculates the distance between all local gradient ciphertexts and the guide gradient ciphertext, and selects k local gradients with the closest distance to the guide gradient from all local gradients to form a valid gradient index set I g, and the remaining local gradients in all local gradients form the malicious gradient index set I b .

[0051] As a preferred solution of the present invention, the global model updating includes:

[0052] The aggregation server indexes the set I according to the effective gradient g Aggregate the local gradient ciphertext through the formula Calculate the aggregation value to obtain the aggregation value of the local gradient ciphertext;

[0053] The aggregation server indexes the malicious gradient set I b and the corresponding secret shared value ciphertext list F b ={F i,j |i∈I b ,j∈I g}Sent to all selected clients, upon receiving I b and F b Afterwards, each selected client decrypts the secret shared value Calculate the sum of the secret shares of all unselected clients And sent to the aggregation server, where the selected client is the valid gradient index set I g The clients corresponding to the local gradient in the , unselected clients are the malicious gradient index set I b The client corresponding to the local gradient in is, where, Decryption for the ElGamal public key encryption system yields is the process of solving the sum of the secret shared values;

[0054] The aggregation server uses the secret sharing homomorphic algorithm to reconstruct the sum of the aggregate keys of the unselected clients.

[0055] The aggregation server uses the deaggregation key D to perform aggregation decryption on the sum of the aggregation value of the local gradient ciphertext and the aggregation key of the unselected client to obtain the plaintext of the local gradient aggregation value of the selected client;

[0056]

[0057] The aggregation server updates the global model w based on the plain text of the local gradient aggregation value of the selected client. now ←(w old -λg update ), where λ is the global learning rate, W now is the updated global model, W old is the global model before updating, w now ←(w old-λg update ) is w old Replace with w now .

[0058] As a preferred solution of the present invention, the present invention provides a federated learning system that takes both robustness and privacy protection into consideration, including:

[0059] The key generation center is used to generate encryption key sets for encrypting the model, aggregation key sets for performing aggregate calculations, and deaggregation keys for aggregate decryption of model ciphertexts for each client;

[0060] The client is used to train and update the local model using the local data set, obtain the local gradient of the current local model, and encrypt the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext;

[0061] Used to construct a vector X according to the guide gradient ciphertext and the encryption key set i , and the matrix Y i , to generate a similar gradient query key qk containing local privacy information i =(X i ,Y i );

[0062] Used to encrypt and share the aggregate key using a secret sharing algorithm and an ElGamal public key encryption system to obtain a ciphertext of a secret sharing value of the aggregate key; and

[0063] Used to replace the current local model with the updated global model;

[0064] The aggregation server is used to train and generate a wizard model for screening clients, generate a wizard gradient during the training of the wizard model, and perform vector encryption on the wizard gradient to obtain a wizard gradient ciphertext;

[0065] for securely screening the local gradient ciphertext of the updated local model by using a similar gradient query key to obtain k updated local models, and securely aggregating the k updated local models to obtain an aggregate value of the local gradient ciphertext; and

[0066] It is used to reconstruct the aggregation key based on the secret sharing value ciphertext by utilizing the secret sharing homomorphic property, and use the deaggregation key to decrypt the aggregation value and aggregation key of the local gradient ciphertext to obtain the local gradient aggregation value plaintext for updating the global model, so as to realize the global model.

[0067] As a preferred solution of the present invention, the aggregation server broadcasts the guide gradient ciphertext to each client;

[0068] The client sends the local gradient ciphertext, the secret shared value ciphertext and the similarity gradient query key of the updated local model to the aggregation server;

[0069] The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model.

[0070] Compared with the prior art, the present invention has the following beneficial effects:

[0071] The present invention designs a secure similarity gradient query algorithm to identify and remove malicious poisoned models. In view of the limitation that federated learning completely relies on the local model update of the client, a server-side trust guidance mechanism is designed to guide the training direction of the global model through the server-generated guide gradient, thereby improving the training accuracy of the federated model. In view of the computational complexity of secure aggregation of encrypted models, a data aggregation method based on the combination of matrix cryptography and secret sharing technology is proposed to achieve efficient and secure aggregation of encrypted models. The present invention not only achieves the model robustness of federated learning against poisoning attacks, but also achieves user privacy protection and secure aggregation of models, which should play an important role in improving the implementation of federated learning technology in the industry. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0073] Figure 1 A flow chart of a federated learning method provided by an embodiment of the present invention;

[0074] Figure 2 A schematic diagram of a federated learning system provided in an embodiment of the present invention;

[0075] Figure 3 A schematic diagram of a federated learning method provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0076] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0077] like Figure 1 and Figure 3 As shown in FIG. 1 , a federated learning method that takes into account both robustness and privacy protection includes:

[0078] Step S1: A key generation center generates an encryption key set for encrypting the model, an aggregation key set for performing aggregation calculation, and a deaggregation key for performing aggregate decryption of the model ciphertext for each client, and sends the encryption key set and the aggregation key set to each client, and sends the deaggregation key to the aggregation server;

[0079] Step S2: the aggregation server trains and generates a wizard model for screening clients, generates a wizard gradient during the training of the wizard model, and performs vector encryption on the wizard gradient to obtain a wizard gradient ciphertext;

[0080] Step S3: The aggregation server broadcasts the guide gradient ciphertext to each client;

[0081] Step S4: Each client uses the local data set to train and update the local model, obtains the local gradient of the current local model, and encrypts the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext;

[0082] Step S5: Each client constructs a vector X based on the guide gradient ciphertext and the encryption key set. i , and the matrix Y i , to generate a similar gradient query key qk containing local privacy information i =(X i ,Y i );

[0083] Step S6: Each client uses a secret sharing algorithm and an ElGamal public key encryption system to encrypt and share the aggregate key to obtain a ciphertext of the secret sharing value of the aggregate key;

[0084] Step S7: Each client sends the local gradient ciphertext, secret shared value ciphertext and similar gradient query key of the updated local model to the aggregation server;

[0085] Step S8: The aggregation server uses the similar gradient query key to perform security screening in the local gradient ciphertext of the updated local model to obtain k updated local models, and securely aggregates the k updated local models to obtain an aggregate value of the local gradient ciphertext;

[0086] Step S9: Reconstruct the aggregate key based on the secret shared value ciphertext by using the secret sharing homomorphic property, and decrypt the aggregate value and the aggregate key of the local gradient ciphertext by using the deaggregation key to obtain the local gradient aggregate value plaintext for updating the global model, so as to realize the update of the global model;

[0087] Step S10: The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model.

[0088] In view of the limitation that federated learning completely relies on the local model update of the client, the present invention designs a server-side trust guidance mechanism, which guides the training direction of the global model through the server-generated guide gradient, thereby improving the training accuracy of the federated model.

[0089] The present invention designs a secure similarity gradient query algorithm, which can perform calculations on local gradient ciphertexts, identify and remove malicious poisoning models without infringing client privacy, and maintain the accuracy of the global model at the same level as that in the absence of poisoning attacks when 10%-50% of malicious clients launch poisoning attacks.

[0090] In view of the computational complexity of secure aggregation of encryption models, the present invention proposes a data aggregation method based on the combination of matrix cryptography and secret sharing technology. Compared with traditional homomorphic encryption and secure multi-party computing cryptographic algorithms, this scheme has a lightweight computational overhead and realizes efficient and secure aggregation of encryption models.

[0091] The present invention combines secret sharing technology with homomorphic encryption technology and applies it to federated learning. It divides the parameters of a local model into multiple parts and shares them with other different clients to ensure the security of parameter data. Only when the parameter data parts in multiple clients are merged at the same time can the original parameter data be restored. Therefore, in federated learning, no single client can see the complete local model privacy data or the parameter update of the local model, which improves data security, reduces privacy leakage, and achieves privacy protection.

[0092] Moreover, homomorphic encryption technology allows data operations to be performed in an encrypted state. The ciphertext obtained by performing operations on two ciphertexts is the same as the corresponding plaintext operation result. This means that under the homomorphic encryption algorithm, mathematical operations can be performed on the ciphertext without decryption, thereby protecting the privacy of the data and further ensuring the privacy of local model parameters in federated learning. By performing continuous homomorphic operations on the ciphertext, the combined effect of multiple operations can be achieved without decrypting the ciphertext. This allows the homomorphic encryption algorithm to be applied to multi-party secure computing and privacy protection in federated learning, and to achieve secure computing and data sharing in federated learning.

[0093] Specifically, the generation of the encryption key set, the aggregation key set, and the de-aggregation key includes:

[0094] Given system security parameter 1 k , the key generation center selects a large prime number p, two positive real numbers α, β∈R +, a real number μ∈R and two (d+1)-dimensional vectors r=(r1,r2,…,r d+1 )∈R d+1 ,s=(s1,s2,…,s d+1 )∈R d+1 , and generate n different (2d+2)×(2d+2)-dimensional reversible matrices M i ∈R (2d+2)×(2d+2) , generate the encryption key set ek for each client i ={α,β,μ,r,s,M i}, where r1, r2, r d+1 , s1, s2, s d+1 are all random parameters, ek i is the encryption key set of the i-th client, i is the counting variable of the client, i∈[1,n], n is the total number of clients;

[0095] The key generation center randomly generates a matrix The rank of the matrix D is d, and the elements in D belong to the finite field Z p , m is a random number greater than d;

[0096] Using the matrix D, the key generation center uses the function B = MMI (D, p) to generate the modular inverse matrix MMI is the function body for calculating modular inverse matrix;

[0097] Use the function F = ModNull(D T ,p) Generate modular null space D T is the transposed matrix of D, ModNull is the function body for computing the modulo null space;

[0098] Among them, matrices B and F T Satisfy the equation B*D=I and F respectively T *D=0, I is the identity matrix, F T is the transposed matrix of F;

[0099] The key generation center generates n different arbitrary matrices

[0100] Calculate n generalized modular inverse matrices The key generation center will F T Split into n shared values ​​F i T , so that it satisfies And generate a random vector Calculate the key kF i T , generate the aggregate key set for each client aki is the aggregate key set of the i-th client, i∈[1,n];

[0101] The key generation center uses the ElGamal public key encryption system to generate a public-private key pair (pk i ,sk i ), pk i is the public key of the ith client, sk i is the private key of the i-th client;

[0102] The key generation center sends the key set {ek i ,ak i ,sk i} and the public key list {pk i |i∈[1,n]} is sent to all clients, and at the same time, the matrix D is sent to the aggregation server as the deaggregation key.

[0103] Among them, the encryption key set and the aggregation key set are both owned by the client, and the two are in a parallel relationship; the encryption key set is mainly used for model encryption and query key generation, and the aggregation key set is mainly used for model aggregation calculation. The aggregation calculation is performed on the server side, but the server only needs to do a simple addition operation. The data is processed on the client side using the aggregation key. The aggregation key set is sent to the client.

[0104] In view of the limitation that federated learning completely relies on the client's local model update, the present invention designs a server-side trust guidance mechanism, which guides the training direction of the global model through the server-generated guide gradient, thereby improving the training accuracy of the federated model. Specifically,

[0105] Perform vector encryption on the guide gradient to obtain the guide gradient ciphertext, including:

[0106] Use the aggregation server to train a server model w using a training dataset D0 owned by the server i , get the wizard model;

[0107] Among them, during the training process of the guide model, the guide gradient is generated by the stochastic gradient descent algorithm Satisfy the equation In the formula, L(w i ,D0) is the loss function, is a derivative operation, D0 is the training data set owned by the server, i is the i-th client, and w is the initialization state. i They are all the same;

[0108] Use the aggregation server to generate a d-dimensional random perturbation vector t=(t1, t2, …, t d)∈R d Guide gradient Encrypt to get the encrypted ciphertext form of the guide gradient And the encrypted form of the wizard gradient and the current global model w now Broadcast to all clients;

[0109] in,

[0110] The local gradient is encrypted using the encryption key in the encryption key set to obtain the local gradient ciphertext, including:

[0111] Each client receives the global model w sent by the aggregation server now Replace it with the current local model, and then use the client to use the local dataset D i ,i∈[1,n] trains the local model w now , D i is the local data set of the i-th client;

[0112] Use the client to obtain the local model w now The local gradient g i =(g i1 ,g i2 ,…,g id )∈R d ;

[0113] Utilize the client to use the encryption key set ek i The encryption key in the (2d+2)-dimensional vector is calculated And according to the vector g i 'Calculate the first vector c of the encrypted local gradient i1 =g i ′M i -1 ;

[0114] Use the aggregate key set ak i The aggregation key in the encrypted local gradient is calculated as the second vector c i2 =g i E i +kF i T ;

[0115] Finally, the local gradient is encrypted according to the first vector and the second vector to obtain the local gradient ciphertext c i =(c i1 ,c i2 ), where c i is the local gradient ciphertext of the i-th client.

[0116] Similarity gradient query key qk i =(X i ,Y i ), including:

[0117] Each client passes the formula and Y i(jl) =β(M i(j,2l) -M i(j,2l-1) ),j∈[1,2d+2],l∈[1,d] calculates a (2d+2)-dimensional vector X i and a (2d+2)×(d) dimensional matrix Y i , where X i(j) Yes X i The jth element of Y i(jl) Yes i The element in the jth row and lth column of M i(j,l) It is M i The element at the jth row and lth column of ;

[0118] According to vector X i and the matrix Y i , generate similarity gradient query key qk i =(X i ,Y i ).

[0119] The generation of the ciphertext of the secret shared value of the aggregate key includes:

[0120] Each client uses a secret sharing algorithm Aggregate key set ak i The vector kF i T Generate n secret shared values

[0121] The client uses the ElGamal public key encryption system to encrypt the secret shared value Encrypt and obtain the secret shared value ciphertext F i ={F i,j |j∈C}, where In the formula, PK j represents the public key of the jth client, Encrypted by ElGamal public key encryption Generate ciphertext F ij , To generate a secret shared value through a secret sharing algorithm j is the counting variable of the client, and C is the client set.

[0122] A secure K-similar gradient query algorithm is designed to identify encrypted local models, and the Euclidean distance calculation and comparison can effectively resist poisoning attacks on encrypted models. The data aggregation method based on matrix cryptography and secret sharing technology are combined to efficiently achieve secure aggregation of gradients to obtain global model gradients without decrypting each encrypted local model.

[0123] Security screening of k updated local models, including:

[0124] The aggregation server first uses the client's similarity gradient query key qk i =(X i ,Y i ) performs a query calculation on the guide gradient ciphertext to obtain an encrypted vector that can be used for distance comparison with the encrypted ciphertext form of the local gradient in

[0125] According to the previous formula and Y i(jl) =β(M i(j,2l) -M i(j,2l-1) ),j∈[1,2d+2],l∈[1,d], Expressed as In the formula Represents a (2d+2)-dimensional vector Is the guide gradient The perturbation vector t=(t1,t2,…,t d )∈R d ;

[0126] Aggregate servers by formula Calculate the distance between the guide gradient ciphertext and the local gradient ciphertext based on the formula The calculation of the aggregation server is done by the formula Compare two different local gradient ciphertexts g i ,g k and the guide gradient ciphertext The distance between Yes i and The distance between Yes k and The distance between

[0127] Among them, if It means Otherwise, it means In the formula, refers to the local gradient g kThe distance from the guide gradient to the local gradient g i Closer, refers to the local gradient g i The distance from the guide gradient to the local gradient g k Closer;

[0128] The aggregation server calculates the distance between all local gradient ciphertexts and the guide gradient ciphertext, and selects k local gradients with the closest distance to the guide gradient from all local gradients to form a valid gradient index set I g , and the remaining local gradients in all local gradients form the malicious gradient index set I b .

[0129] Global model updates, including:

[0130] The aggregation server indexes the set I according to the effective gradient g Aggregate the local gradient ciphertext through the formula Calculate the aggregation value to obtain the aggregation value of the local gradient ciphertext;

[0131] The aggregation server indexes the malicious gradient set I b and the corresponding secret shared value ciphertext list F b ={F i,j |i∈I b ,j∈I g}Sent to all selected clients, upon receiving I b and F b Afterwards, each selected client decrypts the secret shared value Calculate the sum of the secret shares of all unselected clients And sent to the aggregation server, where the selected client is the valid gradient index set I g The clients corresponding to the local gradient in the , unselected clients are the malicious gradient index set I b The client corresponding to the local gradient in is, where, Decryption for the ElGamal public key encryption system yields is the process of solving the sum of the secret shared values;

[0132] The aggregation server uses the secret sharing homomorphic algorithm to reconstruct the sum of the aggregate keys of the unselected clients.

[0133] The aggregation server uses the deaggregation key D to perform aggregation decryption on the sum of the aggregation value of the local gradient ciphertext and the aggregation key of the unselected client to obtain the plaintext of the local gradient aggregation value of the selected client;

[0134]

[0135] The aggregation server updates the global model w based on the plain text of the local gradient aggregation value of the selected client. now ←(w old -λg update ), where λ is the global learning rate, W now is the updated global model, W old is the global model before updating, w now ←(w old -λg update ) is w old Replace with w now .

[0136] Sum contains the perturbation values ​​of nk unselected clients, which cannot be decrypted. Only the sum of their aggregate keys can be obtained through secret sharing technology. Recover it and add it to Sum, and then use the deaggregation key D to decrypt it to eliminate the disturbance value and get the aggregate value of the local gradient ciphertext.

[0137] like Figure 2 As shown, the present invention provides a federated learning system that takes into account both robustness and privacy protection, including:

[0138] The key generation center is used to generate encryption key sets for encrypting the model, aggregation key sets for performing aggregate calculations, and deaggregation keys for aggregate decryption of model ciphertexts for each client;

[0139] The client is used to train and update the local model using the local data set, obtain the local gradient of the current local model, and encrypt the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext;

[0140] Used to construct vector X based on the wizard gradient ciphertext and encryption key set i , and the matrix Y i , to generate a similar gradient query key qk containing local privacy information i =(X i ,Y i );

[0141] Used to encrypt and share the aggregate key using a secret sharing algorithm and an ElGamal public key encryption system to obtain a ciphertext of a secret sharing value of the aggregate key; and

[0142] Used to replace the current local model with the updated global model;

[0143] The aggregation server is used to train and generate a wizard model for screening clients, generate a wizard gradient during the training of the wizard model, and perform vector encryption on the wizard gradient to obtain a wizard gradient ciphertext;

[0144] for securely screening the local gradient ciphertext of the updated local model by using a similar gradient query key to obtain k updated local models, and securely aggregating the k updated local models to obtain an aggregate value of the local gradient ciphertext; and

[0145] It is used to reconstruct the aggregation key based on the secret sharing value ciphertext by utilizing the homomorphic property of secret sharing, and use the deaggregation key to decrypt the aggregation value and aggregation key of the local gradient ciphertext to obtain the local gradient aggregation value plaintext for updating the global model, so as to realize the update of the global model.

[0146] The aggregation server broadcasts the guide gradient ciphertext to each client;

[0147] The client sends the local gradient ciphertext, secret shared value ciphertext and similar gradient query key of the updated local model to the aggregation server;

[0148] The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model.

[0149] The present invention designs a secure similarity gradient query algorithm to identify and remove malicious poisoned models. In view of the limitation that federated learning completely relies on the local model update of the client, a server-side trust guidance mechanism is designed to guide the training direction of the global model through the server-generated guide gradient, thereby improving the training accuracy of the federated model. In view of the computational complexity of secure aggregation of encrypted models, a data aggregation method based on the combination of matrix cryptography and secret sharing technology is proposed to achieve efficient and secure aggregation of encrypted models. The present invention not only achieves the model robustness of federated learning against poisoning attacks, but also achieves user privacy protection and secure aggregation of models, which should play an important role in improving the implementation of federated learning technology in the industry.

[0150] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A federated learning method that takes into account both robustness and privacy protection, characterized in that: include: Step S1, a key generation center generates an encryption key set for encrypting the model, an aggregation key set for performing aggregation calculation, and a deaggregation key for performing aggregate decryption of the model ciphertext for each client, and sends the encryption key set and the aggregation key set to each client, and sends the deaggregation key to the aggregation server; Step S2: the aggregation server trains and generates a wizard model for screening clients, generates a wizard gradient during the training of the wizard model, and performs vector encryption on the wizard gradient to obtain a wizard gradient ciphertext; Step S3: the aggregation server broadcasts the guide gradient ciphertext to each client; Step S4: Each client uses the local data set to train and update the local model, obtains the local gradient of the current local model, and encrypts the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext; Step S5: Each client constructs a vector according to the guide gradient ciphertext and the encryption key set. , and the matrix , to generate similarity gradient query keys containing local private information ; Step S6: Each client uses a secret sharing algorithm and an ElGamal public key encryption system to encrypt and share the aggregate key to obtain a ciphertext of the secret sharing value of the aggregate key; Step S7, each client sends the local gradient ciphertext, the secret shared value ciphertext and the similarity gradient query key of the updated local model to the aggregation server; Step S8: The aggregation server uses the similar gradient query key to perform security screening in the local gradient ciphertext of the updated local model to obtain k updated local models, and securely aggregates the k updated local models to obtain an aggregate value of the local gradient ciphertext; Step S9: Reconstruct the aggregate key based on the secret shared value ciphertext by using the secret sharing homomorphic property, and decrypt the aggregate value and the aggregate key of the local gradient ciphertext by using the deaggregation key to obtain the local gradient aggregate value plaintext for updating the global model, so as to realize the update of the global model; Step S10: The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model; Similarity Gradient Query Key The generation includes: Each client passes the formula and Calculate a (2 d +2)-dimensional vector and a Dimensional matrix ,in yes The jth element of yes No. Line The elements of the column, yes No. Line The elements of the column, yes No. The element in row 2-1 column, yes No. The element in the row 2d+1 column, yes No. The element in the row and column 2d+2, a positive real number , real number , For n different dimensional reversible matrix, i is the client's counting variable, , n is the total number of clients, is the encrypted form of the guide gradient The l elements; according to the vector and The matrix generates a similarity gradient query key .

2. A federated learning method that takes into account both robustness and privacy protection according to claim 1, characterized in that: The generation of the encryption key set, the aggregation key set and the de-aggregation key includes: Given system security parameters , the key generation center selects a large prime number , two positive real numbers , a real number and two ( d+1 )-dimensional vector , , and generate n different dimensional reversible matrix , generate each client's encryption key set , where r1, r2, r d+1 , s1, s2, s d+1 are all random parameters, ek i For the i The encryption key set of each client, i is the client's counting variable, , n is the total number of clients; the key generation center randomly generates a matrix , where the matrix The rank of , The elements in belong to the finite field , m is a random number greater than d; using the matrix , the key generation center uses the function Generate modular inverse matrix , MMI is the function body for calculating modular inverse matrix; Using functions Generate modular null space , D T is the transposed matrix of D, ModNull is the function body for calculating the modulo null space; where the matrix and Satisfy the equations respectively and , I is the identity matrix, F T is the transposed matrix of F; The key generation center generates n different arbitrary matrices ; Calculate n generalized modular inverse matrices , the key generation center will Split into n shared values , so that it satisfies , and generate a random vector , calculate the key , generate the aggregate key set for each client For the i The aggregate key set of the clients, ; The key generation center uses the ElGamal public key encryption system to generate a public-private key pair for each client. , pk i It is i The client's public key, sk i It is i The key generation center will generate the key set and a list of public keys Send to all clients, and at the same time, the matrix Sent to the aggregation server as the de-aggregation key.

3. A federated learning method that takes into account both robustness and privacy protection according to claim 2, characterized in that: The step of performing vector encryption on the guide gradient to obtain the guide gradient ciphertext includes: Leverage an aggregation server to use a training dataset owned by the server Training a server model , obtaining the guide model; wherein, during the training process of the guide model, the guide gradient is generated by a stochastic gradient descent algorithm , Satisfy the equation , where is the loss function, is a derivative operation, D0 is the training data set owned by the server, i For the i Client, in initialization state They are all the same; Use the aggregation server to generate a d-dimensional random perturbation vector The wizard gradient Encryption is performed to obtain the encrypted ciphertext form of the guide gradient , and the encrypted form of the guide gradient and the current global model W now Broadcast to all clients; among them, .

4. A federated learning method that takes into account both robustness and privacy protection according to claim 3, characterized in that: The step of encrypting the local gradient using an encryption key in an encryption key set to obtain a local gradient ciphertext includes: Each client receives the global model w sent by the aggregation server now Replace it with the current local model, and then use the client to use the local dataset Train the local model w now , For the i The local dataset of each client; use the client to obtain the local model w now The local gradient ; Using the client to use encryption key set The encryption key in the vector is calculated as , and according to the vector Calculate the first vector of encrypted local gradient ; Using Aggregate Key Sets The aggregation key in the second vector of encrypted local gradients is calculated ; Finally, the local gradient is encrypted according to the first vector and the second vector to obtain the local gradient ciphertext , where c i For the i The local gradient ciphertext of each client.

5. A federated learning method that takes into account both robustness and privacy protection according to claim 4, characterized in that: The generation of the secret shared value ciphertext of the aggregate key includes: each client uses a secret sharing algorithm Aggregate Key Set Mean vector Generate n secret shared values ; The client uses the ElGamal public key encryption system to encrypt the secret shared value Encrypt to get the secret shared value ciphertext ,in, , where PK j Representative j The client's public key, Encrypted by ElGamal public key encryption Generate ciphertext F ij , To generate a secret shared value through a secret sharing algorithm , j is the counting variable of the client, and C is the client set.

6. A federated learning method that takes into account both robustness and privacy protection according to claim 5, characterized in that: Security screening of k updated local models, including: The aggregation server first uses the client's similarity gradient to query the key Query and calculate the guide gradient ciphertext to obtain an encrypted vector that can be used for distance comparison with the encrypted ciphertext form of the local gradient ,in ; According to the previous formula and ,Will Expressed as , where Indicates a (2d+2) Dimensional vector , Is the guide gradient The value in, the perturbation vector ; Aggregate servers by formula Calculate the distance between the guide gradient ciphertext and the local gradient ciphertext based on the formula The calculation of the aggregation server is done by the formula Comparing two different local gradient ciphertexts , and the guide gradient ciphertext The distance between yes and The distance between yes and The distance between , then it means , otherwise, it means , where Refers to the local gradient The distance from the guide gradient compared to the local gradient Closer, Refers to the local gradient The distance from the guide gradient compared to the local gradient Closer; the aggregation server calculates the distance between all local gradient ciphertexts and the guide gradient ciphertext, and selects the guide gradient ciphertext from all local gradients. k The local gradients closest to the guide gradient constitute the effective gradient index set I g , and the remaining local gradients in all local gradients form the malicious gradient index set I b .

7. A federated learning method that takes into account both robustness and privacy protection according to claim 6, characterized in that: The global model update includes: Aggregation server based on the effective gradient index set Aggregate the local gradient ciphertext through the formula Calculate the aggregation value to obtain the aggregation value of the local gradient ciphertext; The aggregation server sets the malicious gradient index and the corresponding secret shared value ciphertext list Sent to all selected clients, upon receipt and Afterwards, each selected client decrypts the secret shared value , calculate the sum of the secret sharing values ​​of all unselected clients , and sent to the aggregation server, where the selected client is the valid gradient index set The client corresponding to the local gradient in the table, the unselected client is the malicious gradient index set The client corresponding to the local gradient in is, where, Decryption for the ElGamal public key encryption system yields is the process of solving the sum of the secret shared values; The aggregation server uses the secret sharing homomorphic algorithm to reconstruct the sum of the aggregate keys of the unselected clients. ; Aggregation server uses deaggregation key Perform aggregate decryption on the sum of the aggregate value of the local gradient ciphertext and the aggregate key of the unselected client to obtain the plaintext of the local gradient aggregate value of the selected client; ; The aggregation server updates the global model based on the plain text of the local gradient aggregation value of the selected client. ,in is the global learning rate, W now is the updated global model, W old is the global model before updating, for Replace with .

8. A federated learning system that takes into account both robustness and privacy protection, characterized in that: A federated learning method that takes into account both robustness and privacy protection as described in any one of claims 1 to 7, the system comprising: The key generation center is used to generate encryption key sets for encrypting the model, aggregation key sets for performing aggregate calculations, and deaggregation keys for aggregate decryption of model ciphertexts for each client; The client is used to train and update the local model using the local data set, obtain the local gradient of the current local model, and encrypt the local gradient using the encryption key in the encryption key set to obtain the local gradient ciphertext; Used to construct a vector based on the wizard gradient ciphertext and the encryption key set , and the matrix , to generate similarity gradient query keys containing local private information ; Used to encrypt and share the aggregate key using a secret sharing algorithm and an ElGamal public key encryption system to obtain a ciphertext of a secret sharing value of the aggregate key; and Used to replace the current local model with the updated global model; The aggregation server is used to train and generate a wizard model for screening clients, generate a wizard gradient during the training of the wizard model, and perform vector encryption on the wizard gradient to obtain a wizard gradient ciphertext; for securely screening the local gradient ciphertext of the updated local model by using a similar gradient query key to obtain k updated local models, and securely aggregating the k updated local models to obtain an aggregate value of the local gradient ciphertext; and It is used to reconstruct the aggregate key based on the secret shared value ciphertext by using the secret sharing homomorphic property, and use the deaggregation key to decrypt the aggregate value and aggregate key of the local gradient ciphertext to obtain the local gradient aggregate value plaintext for updating the global model, so as to realize the update of the global model; Similarity Gradient Query Key The generation includes: each client passes the formula and Calculate a (2 d +2)-dimensional vector and a one-dimensional matrix ,in yes The jth element of yes No. Line The elements of the column, yes No. Row 2 The elements of the column, yes No. Line The elements of the column, yes No. Line The elements of the column, yes No. The element in the row and column 2d+2, a positive real number , real number For n different dimensional reversible matrix, i is the client's counting variable, , n is the total number of clients, is the encrypted form of the guide gradient The l elements; according to the vector and the matrix , generate similarity gradient query key .

9. A federated learning system that takes into account both robustness and privacy protection according to claim 8, characterized in that: The aggregation server broadcasts the guide gradient ciphertext to each client; The client sends the local gradient ciphertext, the secret shared value ciphertext and the similarity gradient query key of the updated local model to the aggregation server; The aggregation server broadcasts the updated global model to each client, and each client replaces the current local model with the updated global model.

Citation Information

Cited By

  • Decentralized federated learning-based poisoning attack dynamic defense method

    CN120602123A