A cloud-based federated learning model aggregation method and system for homomorphic encryption

By converting model gradient information into non-negative floating point numbers and performing binary encoding encryption, the high cost and accuracy loss problems caused by homomorphic encryption in inter-federal learning are solved, and efficient model aggregation and update are achieved.

CN116055027BActive Publication Date: 2025-03-28XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310033753.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-03-28
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

In the prior art, homomorphic encryption leads to high communication and computing costs in inter-cloud federated learning, as well as the loss of model parameter accuracy and slower model convergence speed caused by batch quantization encryption.

Method used

By converting model gradient information into non-negative floating point numbers and converting them into binary numbers for batch splicing, encoding and encryption, avoiding the use of quantization techniques, thereby reducing communication and computing costs.

Benefits of technology

It realizes the communication and computing costs caused by homomorphic encryption without revealing user privacy, avoiding the problem of loss of model parameter accuracy and slowing down model convergence speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116055027B_ABST
    Figure CN116055027B_ABST
Patent Text Reader

Abstract

The present invention discloses a cloud-based federated learning model aggregation method and system for homomorphic encryption. By converting the gradient information of the client local model into non-negative floating-point numbers, overflow errors caused by adding negative numbers are avoided. The process of converting the parameters of the client local model into non-negative floating-point numbers does not leak user privacy. Because all clients will only send the largest absolute value of their model parameters to the server; the server then determines the maximum value of these absolute values ​​and sends it to the client; the client model parameters are then converted to non-negative floating-point numbers by adding the maximum value; then converting each non-negative floating-point number into a binary number can avoid the use of quantization technology and thus avoid the accuracy loss caused by the quantization of model parameters; encoding a binary number spliced ​​from a batch of binary numbers into a decimal number can greatly increase the batch number, thereby reducing the communication and computing costs caused by homomorphic encryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a federated learning technology in a cloud computing environment, and in particular to a cloud federated learning model aggregation method and system for homomorphic encryption. Background Art

[0002] In recent years, cloud computing has become a new generation of cloud computing model, supporting open collaboration between cloud service providers and deep integration of multi-party cloud resources, providing key support for building a national integrated big data center and leading the high-quality development of the digital economy; but how to achieve global resource demand prediction in the cloud environment while protecting data privacy and meeting relevant laws and regulations is a major pain point of cloud computing.

[0003] Federated learning can achieve collaborative machine learning model training without exposing any user privacy data, which has attracted increasing attention in academia and industry. However, recent studies have shown that attackers can use model parameters (such as gradients) transmitted during federated learning training to infer sensitive information of the participating clients. Among the currently proposed model parameter protection methods, homomorphic encryption has attracted much attention due to its ability to provide strong privacy protection without losing model accuracy. Nevertheless, directly encrypting each model parameter information under federated learning will result in high communication and computational costs. To this end, some researchers have pointed out that batch quantization of model parameters into an integer that can be directly encrypted (i.e., batch quantization encryption) can reduce the communication and computational costs caused by homomorphic encryption in federated learning. However, related work has shown that quantization technology will lead to loss of model parameter accuracy and slow down the convergence of the model. Summary of the invention

[0004] The purpose of the present invention is to provide a cloud-based federated learning model aggregation method and system for homomorphic encryption, so as to overcome the problems of high homomorphic encryption communication and computing costs in the prior art, as well as loss of model parameter accuracy and slow model convergence speed in batch quantization encryption.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] A cloud-based federated learning model aggregation method for homomorphic encryption includes the following steps:

[0007] Convert model gradient information into non-negative floating point numbers;

[0008] Convert each non-negative floating point number into a (M+N)-bit binary number; M bits represent the integer part of the non-negative floating point number, and N bits represent the decimal part of the non-negative floating point number;

[0009] Batch concatenation, encoding and encryption of the converted binary numbers;

[0010] Aggregate, decrypt, decode and split the encrypted results in the previous step to obtain the aggregated gradient value;

[0011] The obtained gradient values ​​are weighted to obtain the gradient values ​​used to update the model parameters.

[0012] Furthermore, batch concatenation, encoding and encryption of gradient information specifically include:

[0013] The obtained n binary numbers are given a batch size n′ and the n binary numbers are divided into batches;

[0014] Concatenate every n′ binary numbers into a long binary number

[0015] Will Encoded in its decimal form

[0016] The client will be encrypted by the public key What you get Send to the server.

[0017] Furthermore, the server obtains the m clients' After that, we can calculate the aggregation result: At the same time, it is sent to each client, and the client uses the private key to decrypt get After that, the aggregated model gradient value is obtained by decoding, splitting, and decimal conversion.

[0018] Furthermore, the aggregation, decryption, decoding and splitting of gradient information are as follows:

[0019] The obtained m clients Calculate its aggregation result:

[0020] right Decrypted

[0021] The client converts the decimal format Decode into its binary form

[0022] Will Split into n′ binary numbers with (M+N) bits

[0023] Will Transform to get the gradient value aggregation result y j .

[0024] Furthermore, the gradient values ​​of the model parameters are updated according to the FedAvg algorithm.

[0025] Furthermore, in the model, gradient information is a positive or negative floating point number.

[0026] Furthermore, each client The gradient information is converted into a non-negative floating point number using a threshold.

[0027] Furthermore, the threshold α is In the formula, Indicates calculating the absolute value of the jth gradient of the ith vector with n gradient values; max(·) n Indicates calculating the maximum absolute value of all model parameters in the i-th vector; max(·) m It means calculating the maximum absolute value among the m model parameter vectors.

[0028] Furthermore, and max(·) n Runs on the client, and max(·) m Runs on the server side.

[0029] A cloud-based federated learning model aggregation system for homomorphic encryption, including a data processing module, a data conversion module, and a data update module;

[0030] The data processing module is used to transform, batch splice, encode and encrypt model gradient information.

[0031] The data analysis module is used to aggregate, decrypt, decode and split the data obtained by the data processing module;

[0032] The data update module is used to perform weighted update on the aggregated gradient values.

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

[0034] The present invention discloses a cloud-based federated learning model aggregation method for homomorphic encryption. By converting the gradient information of the client local model into non-negative floating-point numbers, overflow errors caused by adding negative numbers are avoided. The process of converting the parameters of the client local model into non-negative floating-point numbers does not leak user privacy. Because all clients will only send the largest absolute value of their model parameters to the server; the server then determines the maximum value of these absolute values ​​and sends it to the client; the client model parameters are then converted to non-negative floating-point numbers by adding the maximum value; then converting each non-negative floating-point number into a binary number can avoid the use of quantization technology and thus avoid the loss of accuracy caused by the quantization of model parameters; encoding a binary number spliced ​​from a batch of binary numbers into a decimal number can greatly increase the batch number, thereby reducing the communication and computing costs caused by homomorphic encryption.

[0035] Furthermore, the obtained n binary numbers are given a batch size n′ to divide the n binary numbers into batches; concatenate every n′ binary numbers into a long binary number Will Encoded in its decimal form The client will be encrypted by the public key What you get Sending it to the server can achieve cloud-to-cloud federated learning model aggregation and increase the batch size as much as possible, greatly reducing communication and computing costs.

[0036] The present invention discloses an inter-cloud federated learning model aggregation system for homomorphic encryption. The system converts model gradient information and batch-concatenates it into a long binary number, encodes it into a decimal number for encryption, and then aggregates, decrypts, decodes, splits, and updates the model. This enables inter-cloud federated learning model aggregation and increases the batch number as much as possible, thereby significantly reducing communication and computing costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 Schematic diagram of the working process in the embodiment of the present invention.

[0038] In the figure, X1, X2 and X3 represent the gradient values ​​of a certain layer of the three clients respectively. DETAILED DESCRIPTION

[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 should fall within the scope of protection of the present invention.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] The present invention is further described in detail below in conjunction with specific embodiments and drawings. The above contents are for explanation of the present invention rather than limitation. To facilitate the description of the workflow of the present invention, only the gradient values ​​of three client models at the same layer and their related operation steps are listed as examples.

[0042] The present invention provides a cloud-based federated learning model aggregation method for homomorphic encryption, which specifically includes the following steps:

[0043] (1) Convert model gradient information into non-negative floating point numbers;

[0044] Specifically, in the model, the gradient information is a positive or negative floating point number. In this step, assume that there are m n-dimensional vectors, X1, X2, ..., X m ∈R n , respectively represent the parameters used for aggregation from a certain layer of the machine learning model of the m clients. Then the threshold α is:

[0045]

[0046] In the formula, Indicates calculating the absolute value of the jth gradient of the ith vector with n gradient values; max(·) n Indicates calculating the maximum absolute value of all model parameters in the i-th vector; max(·) m It means calculating the maximum absolute value among the m model parameter vectors.

[0047] and max(·) n Runs on the client, and max(·) m Run on the server side, because this will not expose the client's private information. Then, each client uses the threshold to convert its gradient information into a non-negative floating point number using the following formula:

[0048]

[0049] in, is the gradient value The converted non-negative floating point number. Figure 1 Assume that there are three vectors X1 = [-0.42, 0.10], X2 = [-0.28, -0.13] and X3 = [-0.51, 0.11]. By applying formula (1) to these three vectors, we know that the threshold α = 0.51. Then, by using formula (2), we can convert it into: [0.09, 0.61], [0.23, 0.38] and [0.00, 0.62].

[0050] (2) Binary conversion of non-negative floating point gradient information;

[0051] Specifically, each non-negative floating point number is converted into a (M+N)-bit binary number; where M bits represent the integer part of the non-negative floating point number and N bits represent the decimal part of the non-negative floating point number. Specifically, a non-negative floating point number p is split into the integer part p I and the floating point part p F For example, p=1.75, then p I =1 and p F =0.75. For the integer part p I , which can be directly converted into an M-bit binary number; and for the floating point part p F , it needs to be converted into an integer using formula (3):

[0052]

[0053] In the formula, K means that only K numbers after the decimal point are considered; Indicates rounding down. At this time, it can be converted into an N p Binary number of bits To avoid overflow errors during gradient aggregation, you need to Front filling (NN p ) zeros. Finally, the non-negative floating point number p can be converted into a (M+N)-bit binary number:

[0054]

[0055] The values ​​of M, K, and N need to be large enough to avoid overflow errors when the model aggregates.

[0056] The following will explain in detail how the values ​​of these three parameters are determined.

[0057] The value of M. From formula (1), we know that the threshold α is the maximum absolute value of all gradients; after formula (2), the maximum possible value of the gradient after non-negative transformation in the worst case is α′=2α. Then the upper bound of the sum of the integer parts of the gradient after non-negative transformation is α′ I ·m. In the formula, α′ I is the integer part of α′; m is the number of clients. Therefore, the number of bits required to represent the integer part can be calculated as:

[0058] M=total number of bits in decimal2binary(α′ I ·m) (5)

[0059] For example, in Figure 1 In step 2, we know that α = 0.51, m = 3. Then α′ = 1.02, α′ I = 1. So we can get M = total number of bits in decimal2binary(1×3) = 2.

[0060] The value of K. As can be seen from formula (5), K determines the number of decimal places used to represent the floating point part of the gradient value. Note that the larger the K used for the floating point part, the higher the computation and communication cost, but higher model accuracy can be obtained in gradient aggregation. In general, when K ≥ 4, the negative impact of this binary conversion method on the quality of the training model can be ignored. For the convenience of illustrating this method, Figure 1 In this case, K is set to 2.

[0061] The value of N. Similar to M, the value of N must be large enough to accommodate the arithmetic carry caused by summing the floating-point parts of the non-negative transformed gradients. However, the integer upper limit of the sum of the floating-point parts of the non-negative transformed gradients cannot be simply calculated as α′ F,I ·m; where α′ F,I is the integer form of the floating-point part of α′. This is because it is not guaranteed that α′ F,I is the maximum integer value of the floating point part of all non-negative conversion gradients. Since K determines the number of decimal places used to represent the floating point part of all non-negative conversion gradients, the sum of the integer forms of the floating point parts of the non-negative conversion gradients must be less than I K ·m; where I K is the largest integer with K decimal digits. For example, when K = 2, I K = 99. Therefore, the number of binary digits required for the floating-point part that will not cause the aggregate result to overflow can be calculated as:

[0062] N=total number of bits in decimal2binary(I K·m) (6)

[0063] like Figure 1 In step 2, it is known that m=3, K=2; then N=total number of bits indecimal2binary(99×3)=9.

[0064] (3) Batch concatenation, encoding and encryption of gradient information;

[0065] Specifically, after converting all n gradient values ​​into (M+N)-bit binary numbers, given a batch size n′, these n binary numbers can be divided into batches; where In other words, each batch is composed of n′ (M+N)-bit binary numbers, and if they are insufficient, they are padded with zeros. Thus, every n′ binary numbers will be concatenated into a long binary number. Where k represents the batch index:

[0066]

[0067] It should be noted that in homomorphic encryption, as the key increases, the integer that can be encrypted will also increase. Therefore, in order to increase the batch size n′, we further Encoded in its decimal form The addition of encoded decimal numbers is equivalent to the bit-by-bit addition of their corresponding binary numbers. This is reasonable because in the underlying logic of modern computers, decimal number operations are performed in binary form. For example, in Figure 1 In step 3, the batch long binary number of X1 is [0000000100100000111101]; then its decimal form is 18493. Finally, the client will be encrypted by the public key What you get Send to the server.

[0068] (4) Aggregation, decryption, decoding and splitting of gradient information;

[0069] Specifically, the server obtains the m clients’ After that, we can calculate the aggregation result: At the same time, it is sent to each client. The client uses the private key to decrypt get After that, the aggregated model parameters are obtained through the following procedure.

[0070] The first step is decoding. The client converts the decimal format Decode into its binary form For example, in Figure 1 In step 4, it is known that but Then in order to have The same number of digits must be in Fill in front with

[00000] .

[0071] The second step is splitting. Split into n′ binary numbers with (M+N) bits

[0072]

[0073] For example, in Figure 1 In the splitting process of step 4, two binary numbers can be obtained: [00000100000] and [00010100001].

[0074] Finally, the decimal conversion. Transformed into the true gradient value aggregation result y j For each split binary number Extract the first M bits as the integer part and the last N bits as the floating point part. Then convert them into decimal numbers respectively. and Please note In formula (3), it has been multiplied by 10. K , so we must multiply by 10 -K To convert it into a floating point number. The corresponding floating point numbers are:

[0075]

[0076] From formula (4), we can see that each gradient value in the m vectors is added to the threshold α, then In fact, it is the sum of the true aggregation gradient value and m·α. Therefore, the true aggregation gradient value should be:

[0077]

[0078] For example, in Figure 1 In the decimal conversion step of step 4, the first M=2 bits of the binary number [00010100001] are extracted to obtain the integer part

[00] (decimal number is 0), and the last N=9 bits are extracted to obtain the floating point part [010100001] (decimal number is 161). According to formula (9), the corresponding floating point number is: 0+161×10 -2=1.61; According to formula (10), the real aggregation gradient value can be obtained as: 1.61-3×0.51=0.08. After the same steps, another real aggregation gradient value can be obtained as: -1.21.

[0079] (5) Weighted update of model parameters.

[0080] Specifically, according to the FedAvg algorithm, after each client obtains the true aggregate gradient value, it can weight it to obtain the gradient value used to update the model parameters. The server first calculates the weight of the i-th client for model parameter update: Where, NS i is the data volume of the i-th client. Then it is sent to the corresponding client. Finally, the client passes To calculate the gradient value that can be used to update the model parameters. For example, in Figure 1 In step 5, assume that each client's β i =1 / 3, then the gradient value of model parameter update is: [-1.21, 0.08] / 3 = [-0.403, 0.027].

[0081] The present invention discloses a cloud-based federated learning model method for homomorphic encryption, which converts model gradient information into non-negative floating-point numbers without leaking customer privacy, and then converts the non-negative floating-point numbers into binary numbers. The client batch splices, encodes and encrypts the converted binary number gradient information and sends it to a server.

[0082] Accordingly, the present invention provides a cloud-based federated learning model aggregation system for homomorphic encryption, which includes: a data processing module, a data parsing module, and a data updating module.

[0083] Specifically, the data processing module is used to transform, batch splice, encode and encrypt model gradient information.

[0084] The data analysis module is used to aggregate, decrypt, decode and split the data obtained by the data processing module;

[0085] The data update module is used to perform weighted update on the aggregated gradient values.

Claims

1. A cloud-based federated learning model aggregation method for homomorphic encryption, comprising the following steps: Convert model gradient information into non-negative floating point numbers; Convert each non-negative floating point number into a (M+N)-bit binary number; M bits represent the integer part of the non-negative floating point number, and N bits represent the decimal part of the non-negative floating point number; Batch concatenation, encoding and encryption of the converted binary numbers; Aggregate, decrypt, decode and split the encrypted results in the previous step to obtain the aggregated gradient value; The obtained gradient values ​​are weighted to obtain the gradient values ​​used to update the model parameters; The batch concatenation, encoding and encryption of gradient information specifically include: The obtained n binary numbers are given a batch size n ′ Divide n binary numbers into batches; Each n ′ Binary numbers are concatenated into a long binary number Will Encoded in its decimal form The client will be encrypted by the public key What you get Send to the server; The server gets m clients After that, we can calculate the aggregation result: At the same time, it is sent to each client, and the client uses the private key to decrypt get After that, the aggregated model gradient value is obtained by decoding, splitting, and decimal conversion; The aggregation, decryption, decoding and splitting of gradient information are as follows: The obtained m clients Calculate the aggregate result: right Decrypted The client converts the decimal format Decode into its binary form Will Split into n ′ A binary number with (M+N) digits Will Transform to get the gradient value aggregation result y j .

2. According to claim 1, a cloud federated learning model aggregation method for homomorphic encryption is characterized in that ,The gradient values ​​of model parameters are updated according to the FedAvg algorithm.

3. According to claim 1, a cloud federated learning model aggregation method for homomorphic encryption is characterized in that ,In the model, gradient information is a positive or negative floating point number.

4. A cloud-based federated learning model aggregation method for homomorphic encryption according to claim 1, characterized in that , each client passes The gradient information is converted into a non-negative floating point number using a threshold; the threshold α is In the formula, Indicates calculating the absolute value of the jth gradient of the ith vector with n gradient values; max(·) n Indicates calculating the maximum absolute value of all model parameters in the i-th vector; max(·) m It means calculating the maximum absolute value among the m model parameter vectors.

5. The cloud-based federated learning model aggregation method for homomorphic encryption according to claim 4, characterized in that: and max(·) n Runs on the client, and max(·) m Runs on the server side.

6. A model aggregation system for implementing the cloud-based federated learning model aggregation method for homomorphic encryption as claimed in claim 1, characterized in that: It includes a data processing module, a data conversion module and a data updating module; The data processing module is used to transform, batch splice, encode and encrypt model gradient information; The data analysis module is used to aggregate, decrypt, decode and split the data obtained by the data processing module; The data update module is used to perform weighted update on the aggregated gradient values.