Quantitative federal learning method capable of protecting privacy
Through quantitative and Boolean sharing technology, combined with the Diffie-Hellman key exchange protocol, the problem of resource restrictions and privacy leakage in federated learning in smart IoT devices is solved, and efficient privacy protection and communication optimization is achieved.
Patent Information
- Application Number
- CN202410933275.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-12
AI Technical Summary
In smart IoT devices, the resource limitations and privacy leakage problems of federated learning are difficult to solve at the same time, and the prior art is difficult to realize the privacy protection of model update vectors while reducing communication overhead.
Using quantitative technology to compress the model to update the vector, and protect its privacy through Boolean Sharing and Diffie-Hellman key exchange protocols. The server realizes the aggregation of secret shared values through Boolean to arithmetic sharing conversion protocol, reducing the communication overhead of participants and ensuring privacy security .
It effectively reduces the size of the update of the federated learning participant model, reduces the communication overhead, and ensures the privacy protection of the participant model update vector without increasing the communication overhead, and improves the efficiency of federated learning in the smart Internet of Things.
Smart Images

Figure CN118940310A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of federated learning, quantization and privacy protection in intelligent Internet of Things, and in particular to a privacy-protecting quantized federated learning method. Background Art
[0002] The smart Internet of Things (IoT) refers to physical devices connected via the Internet that can collect and exchange data. Smart IoT devices typically have sensing, computing, and communication capabilities, and are used in a variety of application scenarios, such as smart homes, smart cities, health monitoring, and industrial automation. Federated Learning (FL) is a distributed machine learning method that allows collaborative model training among multiple participants without centralizing the original data. Its main features include: local training, where each device trains the model locally and generates model parameters or gradients; server aggregation, where the central server is responsible for collecting local model parameters, aggregating them, and updating the global model; privacy protection, which helps protect user privacy because the participants' original data does not leave the device.
[0003] Smart IoT can be a participant in federated learning, but smart IoT devices are often subject to the following resource constraints: computing power, limited processor performance, usually low-power embedded processors; storage capacity, limited memory and storage space, difficult to store large data sets and complex models; battery life, battery-powered devices need to save energy to extend working time; bandwidth limitations, limited network bandwidth, slow data transmission speed and high cost. At the same time, today's deep learning neural networks are getting larger and larger, making it a challenge to conduct federated learning on resource-constrained smart IoT devices. In addition, during the federated learning process, although the data does not leave the device, the transmission of model parameters or gradients may still leak sensitive information, so it is also necessary to strengthen the privacy protection of the model parameters or gradients of the participants.
[0004] In order to solve the problem of resource constraints on IoT devices, researchers and engineers have proposed a variety of solutions. Model compression technology is to reduce model size and computational complexity through techniques such as pruning, quantization, and knowledge distillation. For example, model parameters represented by floating point numbers are quantized to low-bit representations, or redundant neurons and connections are removed through pruning. Lightweight model design is to design machine learning models specifically for resource-constrained devices. These lightweight models have fewer parameters and computational requirements and are suitable for running on low-power devices.
[0005] In order to solve the problem of privacy leakage in federated learning, existing research mainly uses differential privacy to add noise when uploading model parameters or gradients to ensure the data privacy of a single device. Differential privacy can be achieved by adding Laplace noise or Gaussian noise. Through homomorphic encryption, calculations are performed in an encrypted state to ensure that data is not leaked during transmission and processing. Homomorphic encryption allows arithmetic operations to be performed without decrypting the data. There is also the use of secure multi-party computing, which divides the data into multiple encrypted parts and performs calculations between different participants to ensure that no single participant can obtain the complete original data.
[0006] Implementing privacy protection for federated learning will increase the communication overhead of IoT devices. Existing research has found few federated learning solutions that can both reduce communication overhead and protect privacy. In order to not only reduce the communication overhead of participants in federated learning, but also protect the privacy of participants' model update vectors, we combine federated learning, quantization, and privacy protection in the smart IoT and propose a privacy-preserving quantized federated learning method. Summary of the invention
[0007] The purpose of the present invention is to provide a privacy-preserving quantitative federated learning method, which utilizes quantization to reduce the size of the model update vector submitted by the participants, utilizes Boolean sharing and the Diffie-Hellman key exchange protocol to protect the privacy of the quantized model update vector of the participants, and the server can complete the aggregation of the secret sharing values of the participants through a conversion protocol from Boolean to arithmetic sharing.
[0008] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is specifically: a privacy-protecting quantitative federated learning method, comprising the following steps:
[0009] S10, during the system initialization phase, the system administrator SM builds the platform, sets the system's quantitative level, generates the system's public parameters, and publishes a list of federated learning tasks; the two servers S1 and S2 use the system's public parameters to generate a corresponding pair of public and private keys for themselves; each participant generates a corresponding pair of public and private keys and can apply to participate in a specific federated learning task. SM assigns a corresponding quantitative level to each participant based on the participant's transmission capacity.
[0010] S20, in the quantization encoding stage of local model parameters, each participant calculates the update vector of the local model based on the model parameters of the current round in the model training task of his / her choice and uses the local data set, calculates its second-order norm and symbol value based on this update vector, and obtains a second-order norm and a symbol vector, and quantizes this model update vector according to his / her own quantization level, which can effectively compress this model update vector and obtain the corresponding quantized update vector; each participant combines the second-order norm, symbol vector and quantized update vector corresponding to his / her local model update vector into a triple.
[0011] S30, in the privacy protection stage of the quantized update vector, each participant uses the public keys of servers S1 and S2 and his own private key to calculate two corresponding session keys, inputs the two session keys into a pseudo-random number generator to obtain two random binary numbers, uses the two random binary numbers to perform an XOR operation on the quantized update vector to obtain a blinded update vector, then combines the second-order norm, the sign vector and the blinded update vector into a triplet, and sends the triplet to server S1.
[0012] S40, in the Boolean sharing generation phase of servers S1 and S2, server S1 verifies the triplet of each participant. If it passes the verification, the second-order norm and symbol vector of this participant are sent to server S2, otherwise the triplet of this participant is discarded; server S1 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into a pseudo-random generator, outputs a random binary number, and XORs the random binary number with the blinded update vector to obtain a Boolean sharing vector with this participant; server S2 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into a pseudo-random generator, outputs a random binary number, and obtains a Boolean sharing number with this participant.
[0013] S50, conversion from Boolean sharing to arithmetic sharing. Servers S1 and S2 respectively calculate a specified number of double verification bits based on the Boolean sharing number of each participant using the oblivious transfer protocol. S1 and S2 use the double verification bits to convert their respective Boolean sharing binary numbers into corresponding arithmetic sharing values, and form a matrix with the arithmetic sharing values of each participant to obtain an arithmetic sharing matrix for all participants in this training model.
[0014] S60, aggregation of arithmetic sharing matrix, servers S1 and S2 combine the symbol vectors of each participant into a symbol matrix, and use the arithmetic sharing matrix, the symbol matrix, the second-order norm of each participant and the quantization level to calculate their respective aggregation vectors; server S2 sends its own aggregation vector to server S1. Server S1 then calculates the total aggregation vector from the vector sent by S2 and updates the global model.
[0015] S70, local model update phase, participants repeat steps S20-S60 until the number of training rounds reaches the specified number, and the system administrator and all participants obtain the final model parameters.
[0016] Furthermore, the step S10 includes:
[0017] S101, the system administrator SM first builds the platform and sets a low quantization level s L and high quantization levels H , that is, s L H , and s L and H is a positive integer, select a large prime number p and a random number g∈Z p * , Z p * ={1,2,…,p-1}, set the initial model parameter w0 and a positive integer scaling factor λ, select a pseudo-random number generator PRG(·), and publish the task list of federated learning. All participants and servers can register on the platform;
[0018] S102, let U i Represents the i-th participant, participant U i Apply to participate in a federated learning task and select a random number r i ∈Z p * , as your own private key sk i =r i And keep it secret, calculate the public key A pair of public and private keys (sk i ,pk i ); Server S1 selects a random number r1'∈Z p * , as its private key ssk1=r1', calculate the public key A pair of public and private keys (ssk1, spk1) is formed; server S2 selects a random number r2'∈Z p * , as its private key ssk2 = r1', calculate the public key Form a pair of public and private keys (ssk2, spk2); the server and participants use their public and private key pairs to build a secure channel for data transmission between them;
[0019] S103, SM sets the corresponding quantization level for each participant according to the transmission capacity of the participant. i The transmission capacity is lower than the average transmission capacity, and its quantization level is set to s i =s L , when U i The transmission capacity is higher than the average transmission capacity, and its quantization level is set to s i =s H , and publish the quantitative levels of all participants.
[0020] Furthermore, the step S20 includes:
[0021] S201, assuming that participant U i Perform the t-th round of model training, 1≤t≤T, T is the maximum round of model training, and each vector in the global model parameter is d-dimensional; when t=1, participant U i Get the global model parameter w from the system manager SM t-1 =w0, when t>1, participant U i Get the global model parameter w of round t-1 from server S1 t-1 , train on the local data set to obtain the local model parameters w t,i , calculate the local model update vector v i =w t,i -w t-1 ;
[0022] S202, let v i,j is the vector v i The jth component (1≤j≤d) of is a floating point number with a storage space of 32 bits in the computer memory. i ||2 represents vector v i The second-order norm of Let the sign function sgn(x)∈{0,1}, when x≥0, sgn(x)=0, when x<0, sgn(x)=1, that is, when x is a negative number, the function outputs a binary bit with a value of 1, and when x is a non-negative number, the function outputs a binary bit with a value of 0;
[0023] S203, Participant U i According to the number of quantization levels s specified by SM i ∈{s L ,s H}, divide the interval [-1,1] into 2s iThere exists an integer l such that v i,j / ||v i ||2∈[l / s i ,(l+1) / s i ], define the probability function ξ(v i,j ,v i ,s i ,l)→{l / s i ,(l+1) / s i}, the function is 1-(s i ·v i,j / ||v i ||2-l) is equal to l / s i , with s i ·v i,j / ||v i The probability value of ||2-l is equal to (l+1) / s i ; for j = 1, 2, ···, d, U i Calculate v i,j '=ξ(v i,j ,v i ,s i ,l), get v i '=(v i,1 ',v i,2 ',···,v i,d ');
[0024]
[0025] S204, Participant U i Using the sign function sgn(x), we can get the vector v i 'Calculate the corresponding symbol value σ for each component in i,j =sgn(v i,j '), get v i 'The symbol vector σ i =(σ i,1 ,σ i,2 ,···,σ i,d ),calculate Get vector
[0026] S205, due to Quantization level i The effective length of a binary number Represents the real number log2(s i +1) rounded up to no less than log2(s i +1); due to the high level of quantization s H ≤255, so Li ≤8, the above quantization method can convert a 32-bit floating point number into a binary number not greater than 8 bits. i Vector Each component of length 32 bits is compressed into L i bit binary number, get the quantized update vector Form a triple
[0027] Furthermore, the step S30 includes:
[0028] S301. In order to protect the privacy of model parameters, participant U i According to the Diffie-Hellman key exchange protocol, using its private key sk i , server S1's public key spk1 and S2's public key spk2, calculate the random seed r i,1 and r i,2 Input to the pseudo-random number generator PRG(·) to get a length of L i Two random binary numbers s i,1 =PRG(r i,1 ) and s i,2 =PRG(r i,2 );
[0029] S302, update vector for blind quantization Each component ParticipantU i calculate For two binary bits, the XOR operation results in 1 when the two bits are different and 0 when the two bits are the same, forming a blinded quantization update vector Get a triple And send it to server S1.
[0030] Furthermore, the step S40 includes:
[0031] S401, server S1 receives triplet According to the participants i The number of quantization levels s i ,calculate Validation Vector Is the binary length of d·L i ,||v i ||2 is greater than zero; if The binary length of i , and ||v i ||2>0, server S1 puts (||v i ||2,σ i ) is sent to server S2, otherwise the triplet is discarded;
[0032] S402, server S1 uses its private key ssk1 and participant U according to the Diffie-Hellman key exchange protocol i The public key pk i , calculate the random seed r i,1 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,1 =PRG(r i,1 ), for the blinded vector Each component calculate Get and quantize the update vector A corresponding Boolean shared vector
[0033] S403, server S2 receives a tuple (||v i ||2,σ i ), according to the Diffie-Hellman key exchange protocol, using its private key ssk2 and participant U i The public key pk i , calculate the random seed r i,2 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,2 =PRG(r i,2 ).
[0034] Furthermore, the step S50 includes:
[0035] S501, server S1 selects a random bit b1∈{0,1} and two random numbers z, C∈Z p * And send this random number C to S2;
[0036] S502, S2 selects a random public-private key pair (sk, pk) and calculates pk'=C-pk. S2 selects a random bit b2 and converts a public key pair (pk0 * ,pk1 *) is sent to S1. It should be noted here that when b2 = 0, S2 sends this public key pair (pk, pk') to S1. At this time, pk0 * =pk,pk1 * =pk'; when b2 = 1, S2 sends the public key pair (pk', pk) to S1. At this time, pk0 * =pk',pk1 * =pk;
[0037] S503, S1 receives the public key pair (pk0 * ,pk1 * ), using the public key encryption algorithm RSA, calculate the ciphertext e0 = Enc(z,pk0 * ), e1=Enc(z+b1,pk1 * ), and sends the ciphertext (e0, e1) to S2;
[0038] S504, S2 receives the ciphertext (e0, e1), and decrypts the ciphertext using the public key encryption algorithm RSA. If b2 = 0, use sk to decrypt e0:
[0039] Dec(e0,sk)=Dec(Enc(z,pk0 * ),sk)=Dec(Enc(z,pk),sk)=z,
[0040] Otherwise, decrypt e1 with sk:
[0041] Dec(e1,sk)=Dec(Enc(z+b1,pk1 * ),sk)=Dec(Enc(z+b1,pk),sk)=z+b1;
[0042] S2 can only obtain one value between z and z+b1, which can be expressed as z+b1b2(mod p), let a=z+b1b2(modp);
[0043] S505, server S1 calculates b1'=b1+2z(mod p), which can convert the Boolean share b1 into the corresponding arithmetic share b1', generating a double verification bit (b1, b1'); server S2 calculates b2'=b2-2a(mod p)=b2-2z-2b1b2(modp), which can convert the Boolean share b2 into the corresponding arithmetic share b2', generating a double verification bit (b2, b2'); due to Servers S1 and S2 can use steps S501-S505 to implement the conversion of Boolean shares b1 and b2 into arithmetic shares b1' and b2';
[0044] S506, due to is a vector The jth component of i Boolean shared value of bit Converted into the corresponding arithmetic sharing value, server S1 needs L i double verification bit, let (b 1,k ,b 1,k ') is the server S1 Boolean shared value The kth double verification bit (1≤k≤L i ), S1 uses steps S501-S505 to convert the Boolean share b 1,k Transformed into the corresponding arithmetic share b 1,k '. In order to make the length L i Boolean shared value s of bit i,2 Converted into the corresponding arithmetic sharing value, server S2 needs L i double verification bit, let (b 2,k ,b 2,k ') is the Boolean shared value s of server S2 i,2 The kth double verification bit (1≤k≤L i ), S2 can execute steps S501-S505 in parallel to share each Boolean 2,k Transformed into the corresponding arithmetic share b 2,k ';
[0045] S507, Order It is the quantity The kth binary bit of s i,2,k is a binary number s i,2 The kth binary bit (1≤k≤L i ), at this time, server S1 has a double verification bit (b 1,k ,b 1,k ') and a Boolean shared bit calculate And send v1 to S2; server S2 has a double verification bit (b 2,k ,b 2,k ') and a Boolean shared bit s i,2,k ∈{0,1}, calculate And v2 is sent to S1; S1 and S2 respectively calculate S1 calculates the arithmetic shared value of the kth bit S2 calculates the arithmetic shared value of the kth bit because
[0046] Right now Servers S1 and S2 are able to convert single-bit Boolean shares into corresponding arithmetic shares;
[0047] S508, server S1 uses the value of each arithmetic share calculate Get Participant U i Arithmetic shared vector of (1≤i≤m) The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix V with m rows and d columns. m×d ; Server S2 uses the value of each arithmetic share calculate Get Participant U i Arithmetic shared vector of (1≤i≤m) The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix W with m rows and d columns. m×d .
[0048] Furthermore, the step S60 includes:
[0049] S601, server S1 uses participant U i (1≤i≤m)||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', and the value of λ makes x i '∈Z p * ; Rounding is based on x i ×10 λ The value of the decimal part determines whether to round up or down. If the decimal part is less than 0.5, it is rounded down, that is, the decimal part is discarded and the integer part remains unchanged. If the decimal part is greater than or equal to 0.5, it is rounded up, that is, 1 is added to the integer part.
[0050] S602, for 1≤i≤m, server S1 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i =(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix Fm×d The jth column of V j Represents the arithmetic shared matrix V m×d The jth column of
[0051] S603, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S1 uses vector x i Each component of ' and V j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q1 + =(q 1,1 + ,q 1,2 + ,···,q 1,d + ) and q1 - =(q 1,1 - ,q 1,2 - ,···,q 1,d - ), where vector q1 + is x i ' and V j The sum of all positive products of the corresponding components in the column, vector q1 - is x i ' and V j The sum of all negative products of the corresponding components in the column;
[0052] S604, server S2 uses participant U i (1≤i≤m)||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', and the value of λ makes x i '∈Z p * ;
[0053] S605. For 1≤i≤m, server S2 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i=(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix F m×d The jth column of j Represents the matrix W m×d The jth column of
[0054] S606, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S2 uses vector x i Each component of ' and W j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q2 + =(q 2,1 + ,q 2,2 + ,···,q 2,d + ) and q2 - =(q 2,1 - ,q 2,2 - ,···,q 2,d - ), and q2 + and q2 - Sent to S1, where vector q2 + is x i ' and W j The sum of all positive products of the corresponding components in the column, vector q2 - is x i ' and W j The sum of all negative products of the corresponding components in the column;
[0055] S607, server S1 uses vector q1 + ,q2 + ,q1 - and q2 - For each component of , calculate:
[0056] q j + =(q 1,j + +q 2,j + mod p) / 10 λ,
[0057] q j - =(q 1,j - +q 2,j - mod p) / 10 λ ,
[0058] Get two vectors q + =(q1 + ,q2 + ,···,q d + ) and vector q - =(q1 - ,q1 - ,…,q d - );
[0059] S608. Server S1 calculates and updates global model parameters:
[0060] w t =w t-1 +(q + -q - ) / m.
[0061] Furthermore, the step S70 includes:
[0062] S701, when the number of model training rounds t≤T, participant U i Repeat the above steps S20-S60, otherwise, the participant ends the federated learning task. At this point, the system administrator and all participants obtain the final model parameter w T .
[0063] Table 1 shows the symbols in the present invention
[0064]
[0065]
[0066]
[0067] Compared with the prior art, the present invention has the following beneficial effects:
[0068] (1) The present invention provides a privacy-preserving quantitative federated learning method, which uses quantization technology to reduce the size of model updates of federated learning participants, reduces the communication overhead of participants, and improves the efficiency of federated learning in the smart Internet of Things.
[0069] (2) The present invention provides a privacy-preserving quantitative federated learning method, which utilizes Boolean sharing and the Diffie-Hellman key exchange protocol to further protect the privacy of the participants' quantized model update vectors. The participants only need to perform lightweight Boolean operations, which does not increase the communication overhead of the participants compared to a method without privacy protection.
[0070] (3) The present invention provides a privacy-preserving quantitative federated learning method and proposes a protocol for converting quantized Booleans into arithmetic sharing, so that the aggregation server can update the global model of federated learning through Boolean sharing. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0072] Figure 1 A flowchart of a privacy-preserving quantitative federated learning method provided by the present invention.
[0073] Figure 2 A system model diagram of a privacy-preserving quantitative federated learning method provided by the present invention.
[0074] Figure 3 The present invention is a curve diagram showing the impact of different quantization levels on the model accuracy of a privacy-preserving quantitative federated learning method on independent and identically distributed data sets.
[0075] Figure 4 The present invention is a curve diagram showing the impact of different quantization levels on the accuracy of a privacy-preserving quantitative federated learning method model on a non-independent and identically distributed data set.
[0076] Figure 5 The present invention provides a privacy-preserving quantitative federated learning method on independent and identically distributed datasets using a model accuracy curve of 4-bit & 5-bit heterogeneous quantization.
[0077] Figure 6 The present invention provides a privacy-preserving quantitative federated learning method on a non-independent and identically distributed dataset using a model accuracy curve of 4-bit & 5-bit heterogeneous quantization. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. Of course, the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.
[0079] Example 1
[0080] See also Figure 1 to Figure 2 The present invention provides a technical solution, a privacy-preserving quantitative federated learning method, such as Figure 1 As shown in , it includes: system initialization, quantization encoding of local model parameters, privacy protection of quantization update vectors, generation of server Boolean sharing, conversion of Boolean sharing to arithmetic sharing, aggregation of arithmetic sharing matrix, and local model update. Figure 2 As shown in the figure, a privacy-preserving quantitative federated learning method includes a system administrator SM, a participant U i The system administrator SM is a trusted entity responsible for building the platform and publishing initial parameters. i Perform model training locally, quantize and encode the trained model update vector, and protect privacy, and send the privacy-protected triples to server S1. Server S1 verifies participant U i , generates its own Boolean share, and sends the verified two-tuple to server S2. S2 generates its own Boolean share based on the two-tuple. Then S1 and S2 perform the conversion from Boolean to arithmetic share, calculate their own aggregation vector from the arithmetic share matrix, and S2 sends their own aggregation vector to S1. Server S1 finally calculates the total aggregation vector and calculates and updates the global model parameters. Participant U i The global model can be downloaded to conduct a new round of model training. When the training rounds reach the specified number, the participants end the federated learning task. At this point, the system administrator and all participants obtain the final model parameters.
[0081] This embodiment provides a privacy-preserving quantitative federated learning method, which specifically includes the following steps:
[0082] S10, during the system initialization phase, the system administrator SM builds the platform, sets the system's quantitative level, generates the system's public parameters, and publishes a list of federated learning tasks; the two servers S1 and S2 use the system's public parameters to generate a corresponding pair of public and private keys for themselves; each participant generates a corresponding pair of public and private keys and can apply to participate in a specific federated learning task. SM assigns a corresponding quantitative level to each participant based on the participant's transmission capacity.
[0083] S20, in the quantization encoding stage of local model parameters, each participant calculates the update vector of the local model based on the model parameters of the current round in the model training task of his / her choice and uses the local data set, calculates its second-order norm and symbol value based on this update vector, and obtains a second-order norm and a symbol vector, and quantizes this model update vector according to his / her own quantization level, which can effectively compress this model update vector and obtain the corresponding quantized update vector; each participant combines the second-order norm, symbol vector and quantized update vector corresponding to his / her local model update vector into a triple.
[0084] S30, in the privacy protection stage of the quantized update vector, each participant uses the public keys of servers S1 and S2 and his own private key to calculate two corresponding session keys, inputs the two session keys into a pseudo-random number generator to obtain two random binary numbers, uses the two random binary numbers to perform an XOR operation on the quantized update vector to obtain a blinded update vector, then combines the second-order norm, the sign vector and the blinded update vector into a triplet, and sends the triplet to server S1.
[0085] S40, in the Boolean sharing generation phase of servers S1 and S2, server S1 verifies the triplet of each participant. If it passes the verification, the second-order norm and symbol vector of this participant are sent to server S2, otherwise the triplet of this participant is discarded; server S1 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into a pseudo-random generator, outputs a random binary number, and XORs the random binary number with the blinded update vector to obtain a Boolean sharing vector with this participant; server S2 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into a pseudo-random generator, outputs a random binary number, and obtains a Boolean sharing number with this participant.
[0086] S50, conversion from Boolean sharing to arithmetic sharing. Servers S1 and S2 respectively calculate a specified number of double verification bits based on the Boolean sharing number of each participant using the oblivious transfer protocol. S1 and S2 use the double verification bits to convert their respective Boolean sharing binary numbers into corresponding arithmetic sharing values, and form a matrix with the arithmetic sharing values of each participant to obtain an arithmetic sharing matrix for all participants in this training model.
[0087] S60, aggregation of arithmetic sharing matrix, servers S1 and S2 form each participant's symbol vector into a symbol matrix, and use the arithmetic sharing matrix, symbol matrix, second-order norm and quantization level of each participant to calculate their own aggregation vector; server S2 sends its own aggregation vector to server S1. Server S1 then calculates the total aggregation vector from the vector sent by S2 and updates the global model.
[0088] S70, local model update phase, participants repeat steps S20-S60 until the number of training rounds reaches the specified number, and the system administrator and all participants obtain the final model parameters.
[0089] The step S10 specifically includes the following steps:
[0090] S101, the system administrator SM first builds the platform and sets a low quantization level s L and high quantization levels H , that is, s L H , and s L and H is a positive integer, select a large prime number p and a random number g∈Z p * , Z p * ={1,2,…,p-1}, set the initial model parameter w0 and a positive integer scaling factor λ, select a pseudo-random number generator PRG(·), and publish the task list of federated learning. All participants and servers can register on the platform;
[0091] S102, let U i Represents the i-th participant, participant U i Apply to participate in a federated learning task and select a random number r i ∈Z p * , as your own private key sk i =r i And keep it secret, calculate the public key A pair of public and private keys (sk i ,pk i ); Server S1 selects a random number r1'∈Z p * , as its private key ssk1=r1', calculate the public key A pair of public and private keys (ssk1, spk1) is formed; server S2 selects a random number r2'∈Z p * , as its private key ssk2 = r1', calculate the public key Form a pair of public and private keys (ssk2, spk2); the server and participants use their public and private key pairs to build a secure channel for data transmission between them;
[0092] S103, SM sets the corresponding quantization level for each participant according to the transmission capacity of the participant. i The transmission capacity is lower than the average transmission capacity, and its quantization level is set to s i =s L , when U i The transmission capacity is higher than the average transmission capacity, and its quantization level is set to s i =s H , and publish the quantitative levels of all participants.
[0093] The step S20 specifically includes the following steps:
[0094] S201. Assume that participant U i Perform the t-th round of model training, 1≤t≤T, T is the maximum round of model training, and each vector in the global model parameters is d-dimensional; when t=1, participant U i Get the global model parameter w from the system manager SM t-1 =w0, when t>1, participant U i Get the global model parameter w of round t-1 from server S1 t-1 , train on the local data set to obtain the local model parameters w t,i , calculate the local model update vector v i =w t,i -w t-1 ;
[0095] S202, let v i,j is the vector v i The jth component (1≤j≤d) of is a floating point number with a storage space of 32 bits in the computer memory. i ||2 represents vector v i The second-order norm of Let the sign function sgn(x)∈{0,1}, when x≥0, sgn(x)=0, when x<0, sgn(x)=1, that is, when x is a negative number, the function outputs a binary bit with a value of 1, and when x is a non-negative number, the function outputs a binary bit with a value of 0;
[0096] S203, Participant U i According to the number of quantization levels s specified by SM i ∈{s L ,s H}, divide the interval [-1,1] into 2s iThere exists an integer l such that v i,j / ||v i ||2∈[l / s i ,(l+1) / s i ], define the probability function ξ(v i,j ,v i ,s i ,l)→{l / s i ,(l+1) / s i}, the function is 1-(s i ·v i,j / ||v i ||2-l) is equal to l / s i , with s i ·v i,j / ||v i The probability value of ||2-l is equal to (l+1) / s i ; for j = 1, 2, ···, d, U i Calculate v i,j '=ξ(v i,j ,v i ,s i ,l), get v i '=(v i,1 ',v i,2 ',···,v i,d ');
[0097]
[0098] S204, Participant U i Using the sign function sgn(x), we can get the vector v i 'Calculate the corresponding symbol value σ for each component in i,j =sgn(v i,j '), get v i 'The symbol vector σ i =(σ i,1 ,σ i,2 ,···,σ i,d ),calculate Get vector
[0099] S205, due to Quantization level i The effective length of a binary number Represents the real number log2(s i +1) rounded up to no less than log2(s i +1); due to the high level of quantization s H ≤255, so Li ≤8, the above quantization method can convert a 32-bit floating point number into a binary number not greater than 8 bits. i Vector Each component of length 32 bits is compressed into L i bit binary number, get the quantized update vector Form a triple
[0100] The step S30 specifically includes the following steps:
[0101] S301. In order to protect the privacy of model parameters, participant U i According to the Diffie-Hellman key exchange protocol, using its private key sk i , server S1's public key spk1 and S2's public key spk2, calculate the random seed r i,1 and r i,2 Input to the pseudo-random number generator PRG(·) to get a length of L i Two random binary numbers s i,1 =PRG(r i,1 ) and s i,2 =PRG(r i,2 );
[0102] S302, update vector for blind quantization Each component ParticipantU i calculate For two binary bits, the XOR operation results in 1 when the two bits are different and 0 when the two bits are the same, forming a blinded quantization update vector Get a triple And send it to server S1.
[0103] The step S40 specifically includes the following steps:
[0104] S401, server S1 receives triplet According to the participants i The number of quantization levels s i ,calculate Validation Vector Is the binary length of d·L i ,||v i ||2 is greater than zero; if The binary length is equal to d·L i , and ||v i ||2>0, server S1 puts (||v i ||2,σ i ) is sent to server S2, otherwise the triplet is discarded;
[0105] S402, server S1 uses its private key ssk1 and participant U according to the Diffie-Hellman key exchange protocol i The public key pk i , calculate the random seed r i,1 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,1 =PRG(r i,1 ), for the blinded vector Each component calculate Get and quantize the update vector A corresponding Boolean shared vector
[0106] S403, server S2 receives a tuple (||v i ||2,σ i ), according to the Diffie-Hellman key exchange protocol, using its private key ssk2 and participant U i The public key pk i , calculate the random seed r i,2 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,2 =PRG(r i,2 ).
[0107] The step S50 specifically includes the following steps:
[0108] S501, server S1 selects a random bit b1∈{0,1} and two random numbers z, C∈Z p * And send this random number C to S2;
[0109] S502, S2 selects a random public-private key pair (sk, pk) and calculates pk'=C-pk. S2 selects a random bit b2 and converts a public key pair (pk0 * ,pk1 *) is sent to S1. It should be noted here that when b2 = 0, S2 sends this public key pair (pk, pk') to S1. At this time, pk0 * =pk,pk1 * =pk'; when b2 = 1, S2 sends the public key pair (pk', pk) to S1. At this time, pk0 * =pk',pk1 * =pk;
[0110] S503, S1 receives the public key pair (pk0 * ,pk1 * ), using the public key encryption algorithm RSA, calculate the ciphertext e0 = Enc(z,pk0 * ), e1=Enc(z+b1,pk1 * ), and sends the ciphertext (e0, e1) to S2;
[0111] S504, S2 receives the ciphertext (e0, e1), and decrypts the ciphertext using the public key encryption algorithm RSA. If b2 = 0, use sk to decrypt e0:
[0112] Dec(e0,sk)=Dec(Enc(z,pk0 * ),sk)=Dec(Enc(z,pk),sk)=z,
[0113] Otherwise, decrypt e1 with sk:
[0114] Dec(e1,sk)=Dec(Enc(z+b1,pk1 * ),sk)=Dec(Enc(z+b1,pk),sk)=z+b1;
[0115] S2 can only obtain one value between z and z+b1, which can be expressed as z+b1b2(mod p), let a=z+b1b2(modp);
[0116] S505, server S1 calculates b1'=b1+2z(mod p), which can convert the Boolean share b1 into the corresponding arithmetic share b1', generating a double verification bit (b1, b1'); server S2 calculates b2'=b2-2a(mod p)=b2-2z-2b1b2(modp), which can convert the Boolean share b2 into the corresponding arithmetic share b2', generating a double verification bit (b2, b2'); due to Servers S1 and S2 can use steps S501-S505 to implement the conversion of Boolean shares b1 and b2 into arithmetic shares b1' and b2';
[0117] S506, due to is a vector The jth component of i Boolean shared value of bit Converted into the corresponding arithmetic sharing value, server S1 needs L i double verification bit, let (b 1,k ,b 1,k ') is the server S1 Boolean shared value The kth double verification bit (1≤k≤L i ), S1 uses steps S501-S505 to convert the Boolean share b 1,k Transformed into the corresponding arithmetic share b 1,k '. In order to make the length L i Boolean shared value s of bit i,2 Converted into the corresponding arithmetic sharing value, server S2 needs L i double verification bit, let (b 2,k ,b 2,k ') is the Boolean shared value s of server S2 i,2 The kth double verification bit (1≤k≤L i ), S2 can execute steps S501-S505 in parallel to share each Boolean 2,k Transformed into the corresponding arithmetic share b 2,k ';
[0118] S507, Order It is the quantity The kth binary bit of s i,2,k is a binary number s i,2 The kth binary bit (1≤k≤L i ), at this time, server S1 has a double verification bit (b 1,k ,b 1,k ') and a Boolean shared bit calculate And send v1 to S2; server S2 has a double verification bit (b 2,k ,b 2,k ') and a Boolean shared bit s i,2,k ∈{0,1}, calculate And v2 is sent to S1; S1 and S2 respectively calculate S1 calculates the arithmetic shared value of the kth bit S2 calculates the arithmetic shared value of the kth bit because
[0119] Right now Servers S1 and S2 are able to convert single-bit Boolean shares into corresponding arithmetic shares;
[0120] S508, server S1 uses the value of each arithmetic share calculate Get Participant U i Arithmetic shared vector of (1≤i≤m) The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix V with m rows and d columns. m×d ; Server S2 uses the value of each arithmetic share calculate Get Participant U i Arithmetic shared vector of (1≤i≤m) The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix W with m rows and d columns. m×d .
[0121] The step S60 specifically includes the following steps:
[0122] S601, server S1 uses participant U i (1≤i≤m)||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', and the value of λ makes x i '∈Z p * ; Rounding is based on x i ×10 λ The value of the decimal part determines whether to round up or down. If the decimal part is less than 0.5, it is rounded down, that is, the decimal part is discarded and the integer part remains unchanged. If the decimal part is greater than or equal to 0.5, it is rounded up, that is, 1 is added to the integer part.
[0123] S602, for 1≤i≤m, server S1 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i =(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix Fm×d The jth column of V j Represents the arithmetic shared matrix V m×d The jth column of
[0124] S603, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S1 uses vector x i Each component of ' and V j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q1 + =(q 1,1 + ,q 1,2 + ,···,q 1,d + ) and q1 - =(q 1,1 - ,q 1,2 - ,···,q 1,d - ), where vector q1 + is x i ' and V j The sum of all positive products of the corresponding components in the column, vector q1 - is x i ' and V j The sum of all negative products of the corresponding components in the column;
[0125] S604, server S2 uses participant U i (1≤i≤m)||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', and the value of λ satisfies x i '∈Z p * ;
[0126] S605. For 1≤i≤m, server S2 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i=(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix F m×d The jth column of j Represents the matrix W m×d The jth column of
[0127] S606, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S2 uses vector x i Each component of ' and W j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q2 + =(q 2,1 + ,q 2,2 + ,···,q 2,d + ) and q2 - =(q 2,1 - ,q 2,2 - ,···,q 2,d - ), and q2 + and q2 - Sent to S1, where vector q2 + is x i ' and W j The sum of all positive products of the corresponding components in the column, vector q2 - is x i ' and W j The sum of all negative products of the corresponding components in the column;
[0128] S607, server S1 uses vector q1 + ,q2 + ,q1 - and q2 - For each component of , calculate:
[0129] q j + =(q 1,j + +q 2,j + mod p) / 10 λ,
[0130] q j - =(q 1,j - +q 2,j - mod p) / 10 λ ,
[0131] Get two vectors q + =(q1 + ,q2 + ,···,q d + ) and vector q - =(q1 - ,q1 - ,…,q d - );
[0132] S608. Server S1 calculates and updates global model parameters:
[0133] w t =w t-1 +(q + -q - ) / m.
[0134] The step S70 specifically includes the following steps:
[0135] S701, when the number of model training rounds t≤T, participant U i Repeat the above steps S20-S60, otherwise, the participant ends the federated learning task. At this point, the system administrator and all participants obtain the final model parameter w T .
[0136] Some of the terms mentioned in this embodiment are explained below:
[0137] Public key encryption algorithm RSA: The security of the RSA algorithm mainly depends on the difficulty of factoring the product of two large prime numbers. The following are the basic steps of the RSA algorithm. (1) S2 selects two large prime numbers p1 and p2, calculates the modulus n = p1 × p2, and calculates the Euler function Choose one with The mutually prime integers e are used as the public key exponent. The private key exponent r is calculated so that S2 generates a public key pk = (e, n) and a private key sk = (r, n). (2) S1 encrypts the plaintext with the public key (e, n) Calculate the ciphertext (3) S2 uses the private key (r,n) to decrypt the ciphertext c and calculate
[0138] Secure channel: Through digital signature technology, a secure channel for transmission can be constructed. The role of digital signature in cryptography is to ensure the integrity, authentication and non-repudiation of digital information. The following are the main steps of digital signature: (1) Generate a key pair: First, the sender needs to generate a pair of public and private keys. The private key is confidential and only held by the signer, while the public key can be shared publicly with anyone. (2) Create a hash of the message: For the original message to be signed, a hash value is created using a hash function. This hash value is a short, fixed-size representation of the message. Any small change to the original message will cause the hash value to change significantly. (3) Sign the hash with the private key: Use the holder's private key to encrypt the hash value generated in the previous step. This creates a digital signature. (4) The sender sends <message, signature> as a data packet to the receiver. (5) Verify the digital signature: The receiver decrypts the received digital signature with the sender's public key to obtain the hash value of the message. At the same time, the receiver also uses the same hash function to create a new hash value for the received original message and compares the two hash values. If they match, the signature is verified to be valid and the message has not been tampered with during transmission. (6) Verification results. If the verification process is successful, the receiver can be sure that: the message was sent by the signer, satisfying authentication; the message has not been changed since it was sent, satisfying integrity; the sender cannot deny sending the message, satisfying non-repudiation.
[0139] Arithmetic sharing: Arithmetic sharing involves breaking down a value into multiple shares, which are distributed to the participants of the calculation. Each share is meaningless alone, and only by combining all the shares can the original value be obtained. The specific operation is, the secret value y∈Z p * ,y i It's a Z p * A random value on constraints.
[0140] Boolean sharing: Boolean sharing is to decompose a secret value of a binary string into multiple shares, so that a single share cannot provide any information about the original secret, but the combination of all shares can restore the original secret. The specific operation is, the secret value y∈Z2 α , Z2 α is a binary string of length α bits, y i Is a Z2 α A random value on Constraints on y.
[0141] Diffie-Hellman key exchange protocol: The Diffie-Hellman key exchange protocol is a security protocol used by two parties to secretly share a key over a completely insecure communication channel.
[0142] The core of Diffie-Hellman key exchange is based on the difficulty of the discrete logarithm problem, which is a problem considered difficult in mathematics and there is currently no known efficient algorithm to solve it. Its basic steps are as follows:
[0143] (1) Selecting common basic parameters: First, the two parties negotiate a large prime number p and a random number g∈Z p * , these two values are public.
[0144] (2) Generate private key and calculate public key: One party randomly selects a random number r1∈Z p * , as its private key sk1, and then calculate the public key Send it to the other party. The other party randomly selects a random number r2∈Z p * , then calculate the public key Send it to the other party.
[0145] (3) Calculate the shared key: After receiving the other party’s public key, the two parties use their own private keys to calculate the shared key. The other party calculates the shared key because Therefore, the shared key r calculated by the two parties 1,2 =r 2,1 .
[0146] In this example, the communication overhead and privacy protection of the participants will be explained, pointing out that this method reduces the communication overhead of the participants and protects the privacy of the participants.
[0147] The reduction in communication overhead is explained below:
[0148] An image classification task is performed on the MNIST dataset using a convolutional neural network (CNN) to verify the performance of the proposed privacy-preserving quantitative federated learning method. This experiment is implemented based on Python 3.8 and torch1.8.0 and deployed on a computer with AMD Ryzen 7 6800H, 16GB RAM, and NVIDIA GeForce RTX 3060.
[0149] The experiment constructed a federated learning system and set the learning rate to 0.001. The number of participants in each round of federated learning was m=20, the number of local iterations of the participants was 5, the size of the local training dataset was 128, the local batch size of each round of training was 16, the scaling factor λ was 5, the size of the test dataset was 256, and the number of global training rounds T was set to 50.
[0150] like Figure 3 and Figure 4 As shown, for s i From low to high selection, it is found that on independent and non-IID data sets, when the quantization level s of 20 participants i When s ≤7, the accuracy of the trained model cannot meet the requirements; when s i = 15, the model accuracy is not much different from that of the standard federated learning model; when s i =31, compared with s i When the value is 15, the model accuracy is not improved much. L You can take 15, then That is 4-bit quantization. High quantization level s H You can take 31, then That is 5-bit quantization. Assume that in each round, server S1 receives a quantization level of s L and H Each participant accounts for 50%, that is, the server receives 10 participants with quantization levels 15 and 31 in each round.
[0151] like Figure 5 As shown in Figure 1, on the independent and identically distributed MNIST dataset, the model accuracy of standard federated learning is about 97.9%, and the model accuracy of this 4-bit & 5-bit heterogeneous quantization method is about 94.8%, which is about 3.1% lower than that of standard federated learning. Figure 6 As shown in the figure, on the non-independent and identically distributed MNIST dataset, the model accuracy of standard federated learning is about 95.8%, and the model accuracy of this 4-bit & 5-bit heterogeneous quantization method is about 96.1%, which is about 0.3% higher than that of standard federated learning.
[0152] ParticipantU i The model update vector v is obtained through training i , each participant v i The size of v is 926016 bits, the original data of 20 participants i The size is 2260.78KB.
[0153] ParticipantU i Vector v i After performing the quantization operation, the triplet is obtained The second norm ||v i ||2 is a 32-bit number, the symbol vector σ i is a 28938-dimensional vector, where each component is a 1-bit symbol value, with a total size of 28938 bits. The quantized update vector of the 4-bit quantized participant It is a 28938-dimensional vector, each component is a 4-bit value, and the size is 115752 bits. The quantized update vector of the 5-bit quantized participant Each component of is a 5-bit value, and the size is 114690 bits. Therefore, after the participants are quantized, the size of the triplet of 20 participants is 388.65KB.
[0154] ParticipantU i Update vector for quantization Perform blinding to generate a blinded quantization update vector The triplet after privacy protection 4-bit quantized participant blind update vector is a 28938-dimensional vector, each component is a 4-bit value, and the size is 115752 bits. The blind update vector of the 5-bit quantized participant Each component of is a 5-bit value, with a size of 114690 bits. After the participants perform privacy protection on the quantized update vector, the size of the triplet of 20 participants is 388.65KB, which does not increase the additional communication overhead compared to the case without privacy protection. Therefore, this 4-bit & 5-bit heterogeneous quantization method is better than directly submitting the original data v i The communication overhead is reduced by about 82.8%.
[0155] The following is an explanation of security:
[0156] Theorem 1: In this scheme, if the two aggregation servers S1 and S2 are semi-honest and do not collude, then each participant cannot obtain the quantized update vector of other participants.
[0157] Proof: Since server S1 has participant U i Tuple sent Also has through and participants U i Shared random seed r i,1 Generate a random binary number s i,1 Server S2 has access to and participants U i Shared random seed r i,2 Generate a random binary number s i,2 , the quantized update vector that needs privacy protection Each component
[0158] As long as the Diffie-Hellman key exchange protocol ensures that the random seed r i,1 and r i,2 are secretly owned by both parties, then except for participant U i No one except you can get the original vector This protects the participants i The quantized update vector of .
[0159] In the generation of the double verification bit, the kth double verification bit (b 1,k ,b 1,k ') and (b 2,k ,b 2,k '), due to b 1,k and b 2,k is a Boolean share between S1 and S2, so in the subsequent Boolean to arithmetic conversion stage, S1 and S2 are swapped and After that, S1 cannot get b 2,k , S2 cannot get b 1,k , so S1 and S2 cannot pass To further calculate the secret value Each bit of .
[0160] In the aggregation phase of the arithmetic shared matrix, server S1 obtains the aggregated vector q1 + ,q2 + ,q1 - and q2 - , but cannot obtain the quantized update vector of a single participant. Therefore, the protection of participant U is achieved throughout the entire process of the scheme. i The quantized update vector
[0161] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A privacy-preserving quantitative federated learning method, including three types of entities: system administrator, participant and server, characterized in that: The following steps are involved: S10, system initialization phase: the system administrator SM builds the platform, sets the system's quantitative level, generates the system's public parameters, and publishes the task list of federated learning; The two servers S1 and S2 use the system public parameters to generate a corresponding pair of public and private keys for themselves; each participant generates a corresponding pair of public and private keys and applies to participate in a specific federated learning task. SM assigns a corresponding quantitative level to each participant based on the participant's transmission capacity; S20, in the quantization encoding stage of local model parameters, each participant calculates the update vector of the local model based on the model parameters of the current round in the model training task selected by the participant, using the local data set, calculates its second-order norm and symbol value based on the update vector, obtains a second-order norm and a symbol vector, quantizes the model update vector according to its own quantization level, and obtains the corresponding quantized update vector; each participant forms a triple of the second-order norm, symbol vector and quantized update vector corresponding to its local model update vector; S30, privacy protection phase of quantization update vector: each participant uses the public keys of servers S1 and S2 and its own private key to calculate two corresponding session keys, inputs the two session keys into a pseudo-random number generator to obtain two random binary numbers, uses the two random binary numbers to perform XOR operation on the quantization update vector to obtain a blinded update vector, and then forms a triplet of the second-order norm, the sign vector and the blinded update vector, and sends the triplet to server S1; S40, Boolean sharing generation phase of servers S1 and S2, server S1 verifies the triplet of each participant, and if it passes the verification, sends the second-order norm and symbol vector of this participant to server S2, otherwise discards the triplet of this participant; server S1 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into the pseudo-random generator, outputs a random binary number, and XORs the random binary number with the blinded update vector to obtain a Boolean sharing vector with this participant; server S2 uses its own private key and the public key of each verified participant to calculate the session key, inputs the session private key into the pseudo-random generator, outputs a random binary number, and obtains a Boolean sharing number with this participant; S50, conversion from Boolean sharing to arithmetic sharing, servers S1 and S2 respectively calculate a specified number of double verification bits according to the Boolean sharing number of each participant using the oblivious transfer protocol; S1 and S2 use the double verification bits to convert their respective Boolean sharing binary numbers into corresponding arithmetic sharing values, and form a matrix with the arithmetic sharing values of each participant to obtain an arithmetic sharing matrix for all participants in this training model; S60, aggregation of arithmetic sharing matrix, servers S1 and S2 combine the symbol vectors of each participant into a symbol matrix, and use the arithmetic sharing matrix, the symbol matrix, the second-order norm and quantization level of each participant to calculate their respective aggregation vectors; server S2 sends its own aggregation vector to server S1; server S1 uses S2's aggregation vector to calculate the total aggregation vector and update the global model; S70, local model update phase, participants repeatedly execute steps S20 to S60 until the number of training rounds reaches the specified number, and the system administrator and all participants obtain the final model parameters.
2. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S10 comprises the following steps: S101, the system administrator SM first builds the platform and sets a low quantization level s L and high quantization levels H ,s L and H is a positive integer, and s L H , choose a large prime number p and a random number g∈Z p * , Z p * ={1,2,…,p-1}, set the initial model parameter w0 and a positive integer scaling factor λ, select a pseudo-random number generator PRG(·), and publish the task list of federated learning. All participants and servers register on the platform; S102, let U i Represents the i-th participant, participant U i Apply to participate in a federated learning task and select a random number r i ∈Z p * , as your own private key sk i =r i And keep it secret, calculate the public key A pair of public and private keys (sk i ,pk i ); Server S1 selects a random number r1'∈Z p * , as its private key ssk1=r1', calculate the public key A pair of public and private keys (ssk1, spk1) is formed; server S2 selects a random number r2'∈Z p * , as its private key ssk2 = r1', calculate the public key Form a pair of public and private keys (ssk2, spk2); the server and participants use their public and private key pairs to build a secure channel for data transmission between them; S103, SM sets the corresponding quantization level for each participant according to the transmission capacity of the participant. i The transmission capacity is lower than the average transmission capacity, and its quantization level is set to s i =s L , when U i The transmission capacity is higher than the average transmission capacity, and its quantization level is set to s i =s H , and publish the quantitative levels of all participants.
3. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S20 comprises the following steps: S201, assuming that participant U i Perform the t-th round of model training, 1≤t≤T, T is the maximum round of model training, and each vector in the global model parameter is d-dimensional; when t=1, participant U i Get the global model parameter w from the system manager SM t-1 =w0, when t>1, participant U i Get the global model parameter w of round t-1 from server S1 t-1 , train on the local data set to obtain the local model parameters w t,i , calculate the local model update vector v i =w t,i -w t-1 ; S202, let v i,j is the vector v i The jth component of , 1≤j≤d, is a floating point number with a storage space of 32 bits in the computer memory, ||v i ||2 represents vector v i The second-order norm of , let the sign function sgn(x)∈{0,1}, when x≥0, sgn(x)=0, when x<0, sgn(x)=1, that is, when x is a negative number, the function outputs a binary bit with a value of 1, when x is a non-negative number, the function outputs a binary bit with a value of 0; S203, Participant U i According to the number of quantization levels s specified by SM i ∈{s L ,s H }, divide the interval [-1,1] into 2s i There are quantization intervals of equal length, there exists an integer l such that v i,j / ||v i ||2∈[l / s i ,(l+1) / s i ], define the probability function ξ(v i,j ,v i ,s i ,l)→{l / s i ,(l+1) / s i }, the function is 1-(s i ·v i,j / ||v i ||2-l) is equal to l / s i , with s i ·v i,j / ||v i The probability value of ||2-l is equal to (l+1) / s i ; for j = 1, 2, ···, d, U i Calculate v i,j '=ξ(v i,j ,v i ,s i ,l), get v i '=(v i,1 ',v i,2 ',···,v i,d '); S204, Participant U i Using the sign function sgn(x), we can get the vector v i 'Calculate the corresponding symbol value σ for each component in i,j =sgn(v i,j '), get v i 'The symbol vector σ i =(σ i,1 ,σ i,2 ,···,σ i,d ),calculate Get vector S205, due to Quantization level i The effective length of a binary number Due to the high level of quantization H ≤255, so L i ≤8, the above quantization method converts a 32-bit floating point number into a binary number not greater than 8 bits, U i Vector Each component of length 32 bits is compressed into L i bit binary number, get the quantized update vector Form a triple 4. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S30 comprises the following steps: S301, Participant U i Using its private key sk i , server S1's public key spk1 and S2's public key spk2, calculate the random seed r i,1 and r i,2 Input to the pseudo-random number generator PRG(·) to get a length of L i Two random binary numbers s i,1 =PRG(r i,1 ) and s i,2 =PRG(r i,2 ); S302, in order to blind the vector Each component ParticipantU i calculate Among them, ⊕ is the XOR operator symbol, which constitutes a blinded quantization update vector Get a triple And send it to server S1.
5. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S40 comprises the following steps: S401, server S1 receives triplet According to the participants i The number of quantization levels s i ,calculate Validation Vector Is the binary length of d·L i ,||v i ||2 is greater than zero; if The binary length of i , and ||v i ||2>0, server S1 puts (||v i ||2,σ i ) is sent to server S2, otherwise the triplet is discarded; S402, server S1 uses its private key ssk1 and participant U i The public key pk i , calculate the random seed r i,1 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,1 =PRG(r i,1 ), for the blinded vector Each component calculate Get and quantize the update vector A corresponding Boolean shared vector S403, server S2 receives a tuple (||v i ||2,σ i ), using its private key ssk2 and participant U i The public key pk i , calculate the random seed r i,2 Input the pseudo-random number generator PRG(·) to get a length of L i A random binary number s i,2 =PRG(r i,2 ).
6. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S50 comprises the following steps: S501, server S1 selects a random bit b1∈{0,1} and two random numbers z, C∈Z p * And send this random number C to S2; S502, S2 selects a random public-private key pair (sk, pk), calculates pk'=C-pk, S2 selects a random bit b2, and converts a public key pair (pk0 * ,pk1 * ) is sent to S1. It should be noted here that: when b2 = 0, pk0 * =pk,pk1 * =pk'; when b2 = 1, pk0 * =pk',pk1 * =pk; S503, S1 receives the public key pair (pk0 * ,pk1 * ), using the public key encryption algorithm RSA, calculate the ciphertext e0 = Enc(z,pk0 * ), e1=Enc(z+b1,pk1 * ), and sends the ciphertext (e0, e1) to S2; S504, S2 receives the ciphertext (e0, e1), and decrypts the ciphertext using the public key encryption algorithm RSA. If b2 = 0, use sk to decrypt e0: Dec(e0,sk)=Dec(Enc(z,pk0 * ),sk)=Dec(Enc(z,pk),sk)=z, Otherwise, decrypt e1 with sk: Dec(e1,sk)=Dec(Enc(z+b1,pk1 * ),sk)=Dec(Enc(z+b1,pk),sk)=z+b1, S2 can only obtain one value between z and z+b1, which is expressed as z+b1b2(mod p), let a=z+b1b2(mod p); S505, server S1 calculates b1'=b1+2z(mod p), converts Boolean share b1 into corresponding arithmetic share b1', and generates a double verification bit (b1, b1'); server S2 calculates b2'=b2-2a(mod p)=b2-2z-2b1b2(mod p), converts Boolean share b2 into corresponding arithmetic share b2', and generates a double verification bit (b2, b2'); since b1'+b2'(mod p)=b1+b2-2b1b2=b1⊕b2, servers S1 and S2 use steps S501 to S505 to convert Boolean shares b1 and b2 into corresponding arithmetic shares b1' and b2'; S506, due to is a vector The jth component of i Boolean shared value of bit Converted into the corresponding arithmetic sharing value, server S1 needs L i double verification bit, let (b 1,k ,b 1,k ') is the Boolean shared value of server S1 The kth double verification bit of i , S1 executes steps S501 to S505 in parallel, and each Boolean share b 1,k Transformed into the corresponding arithmetic share b 1,k '; In order to make the length L i Boolean shared value s of bit i,2 Converted into the corresponding arithmetic sharing value, server S2 needs L i double verification bit, let (b 2,k ,b 2,k ') is the Boolean shared value s of server S2 i,2 The kth double verification bit of i , S2 executes steps S501 to S505 in parallel, and each Boolean share b 2,k Transformed into the corresponding arithmetic share b 2,k '; S507, Order It is the quantity The kth binary bit of s i,2,k is a binary number s i,2 The k-th binary bit of i , at this time, server S1 has a double verification bit (b 1,k ,b 1,k ') and a Boolean shared bit calculate And send v1 to S2; server S2 has a double verification bit (b 2,k ,b 2,k ') and a Boolean shared bit s i,2,k ∈{0,1}, calculate v2=s i,2,k ⊕b 2,k , and v2 is sent to S1; S1 and S2 respectively calculate v=v1⊕v2, and S1 calculates the arithmetic shared value of the kth bit S2 calculates the arithmetic shared value of the kth bit Due to b 1,k '+b 2,k '(mod p) = b 1,k ⊕b 2,k , calculate Servers S1 and S2 convert the single-bit Boolean shares into corresponding arithmetic shares; S508, server S1 uses the value of each arithmetic share calculate Get Participant U i , arithmetic shared vector with 1≤i≤m The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix V with m rows and d columns. m×d ; Server S2 uses the value of each arithmetic share calculate Get Participant U i , arithmetic shared vector with 1≤i≤m The arithmetic sharing vectors of m participants are combined into an arithmetic sharing matrix W with m rows and d columns. m×d .
7. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S60 comprises the following steps: S601, server S1 uses participant U i , 1≤i≤m||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', λ is a function used to control x i The value of λ is such that x i '∈Z p * ; S602, for 1≤i≤m, server S1 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i =(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix F m×d The jth column of V j Represents the arithmetic shared matrix V m×d The jth column of S603, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S1 uses vector x i Each component of ' and V j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q1 + =(q 1,1 + ,q 1,2 + ,···,q 1,d + ) and q1 - =(q 1,1 - ,q 1,2 - ,···,q 1,d - ), where vector q1 + is x i ' and V j The sum of all positive products of the corresponding components in the column, vector q1 - is x i ' and V j The sum of all negative products of the corresponding components in the column; S604, server S2 uses participant U i , 1≤i≤m||v i ||2 and s i , calculate x i =||v i ||2 / s i , then x i ×10 λ Round to integer x i ', and satisfies the integer x i '∈Z p * ; S605. For 1≤i≤m, server S2 forms a vector x i '=(x1',x2',···,x m '), the symbol vector σ of m participants i =(σ i,1 ,σ i,2 ,···,σ i,d ), forming a symbol matrix F with m rows and d columns m×d , let F j Denotes the matrix F m×d The jth column of j Denotes the arithmetic sharing matrix W m×d The jth column of S606, for 1≤j≤d, when F j The sign bit σ i,j = 0, 1≤i≤m, server S2 uses vector x i Each component of ' and W j Calculate the corresponding components in the column When F j The sign bit σ i,j =1, calculate Get two vectors q2 + =(q 2,1 + ,q 2,2 + ,···,q 2,d + ) and q2 - =(q 2,1 - ,q 2,2 - ,···,q 2,d - ), and q2 + and q2 - Sent to S1, where vector q2 + is x i ' and W j The sum of all positive products of the corresponding components in the column, vector q2 - is x i ' and W j The sum of all negative products of the corresponding components in the column; S607, server S1 uses vector q1 + ,q2 + ,q1 - and q2 - For each component of , calculate: q j + =(q 1,j + +q 2,j + mod p) / 10 λ , q j - =(q 1,j - +q 2,j - mod p) / 10 λ , Get two vectors q + =(q1 + ,q2 + ,···,q d + ) and vector q - =(q1 - ,q1 - ,…,q d - ); S608. Server S1 calculates and updates global model parameters: w t =w t-1 +(q + -q - ) / m。 8. The privacy-preserving quantitative federated learning method according to claim 1, characterized in that: The step S70 includes the following steps: S701, when the number of model training rounds t≤T, participant U i Repeat the above steps S20 to S60. Otherwise, the participant ends the federated learning task. At this time, the system administrator and all participants obtain the final model parameter w T .
Citation Information
Cited By
Federal learning method and apparatus by combining differential privacy noise shares, and medium
CN119783849A
