Federal learning GPU acceleration ciphertext aggregation method based on homomorphic encryption
By adopting modular component homomorphic encryption and GPU parallel computing methods in federated learning, the problems of large computing overhead and accuracy loss of homomorphic encryption in federated learning are solved, and an efficient, accurate and secure federated learning process is achieved.
Patent Information
- Application Number
- CN202411888995.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-12-20
AI Technical Summary
The existing application of homomorphic encryption in federated learning has problems such as large computing overhead, loss of accuracy, and involuntary and controllable technology, resulting in low efficiency, poor accuracy and insufficient security.
The modular component homomorphic encryption library is used to combine federated learning to calculate different modular components in parallel through GPU to realize MNIST handwriting recognition in encryption, improving the speed and security of recognition.
It effectively improves the efficiency and accuracy of federated learning, while ensuring the security of learning, solving the concerns of data privacy leakage, and reducing the risk of data leakage.
Smart Images

Figure CN119483906A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and more specifically to a federated learning GPU accelerated ciphertext aggregation method based on homomorphic encryption. Background Art
[0002] In the era of massive data, many devices and organizations are continuously generating large amounts of information. Making good use of this useful data can greatly improve the efficiency of problem solving. Deep learning helps us solve practical problems by building models and learning the characteristics of a large amount of sample data, and it demonstrates powerful performance.
[0003] However, in traditional centralized deep learning, users upload their personal data to the server for training. During this data transmission process, there is a risk of privacy data leakage, so users may refuse to share data. This will result in insufficient data diversity or insufficient data volume, and the accuracy and robustness of the training model will also decrease. Unlike centralized deep learning, federated learning is a distributed deep learning that allows users to collaborate with other users to train models without uploading data. Specifically, users only need to upload the model parameters of local training to the server. After obtaining the model parameters of each user, the server aggregates them and sends the aggregated model back to the user, and then starts the next round of training until consensus is reached. Federated learning reduces the risk of data leakage through this joint collaboration method and alleviates users' concerns about privacy leakage. However, the server is still vulnerable to attacks. Attackers can obtain the model parameters uploaded by users and then destroy the global model. How to prevent model parameters from being directly exposed to attackers has become a problem that needs to be solved.
[0004] Homomorphic encryption allows calculations to be performed directly on ciphertext without having to decrypt it into plaintext for calculations. The result obtained by decrypting the ciphertext obtained after homomorphic encryption operation is consistent with the result obtained by plaintext operation. Based on this feature, homomorphic encryption can be applied to federated learning. The client encrypts the model information and transmits it to the server. The server only performs aggregation operations and then returns the new encrypted model information to the client. The client performs decryption operations locally and uses the new global model for training. This process is repeated until the end condition is met. In this way, some sensitive information is protected and users' concerns about information leakage are alleviated. However, the existing homomorphic encryption applied to federated learning has the following disadvantages: 1. The high computational overhead of homomorphic encryption leads to a long time: Homomorphic encryption is usually more complex than traditional encryption algorithms. Especially when calculating large-scale data, the computational complexity increases significantly, requiring a lot of computing power and time for encryption and decryption operations, resulting in low overall efficiency. 2. Precision loss and many homomorphic encryption libraries do not support floating-point operations: Some homomorphic encryptions introduce noise during the encryption and decryption process, and may approximate the data, resulting in deviations between the encrypted and decrypted values and the true values; in the process of federated learning, many parameters such as weights are floating-point numbers, but many homomorphic encryption libraries only support integer operations, which hinders the development of homomorphic encryption for federated learning. 3. Technically uncontrollable: Currently commonly used homomorphic encryption libraries such as HElib and SEAL are developed by foreign countries, which greatly increases the cost of commercial use and reduces the security of our product applications.
[0005] Therefore, how to improve the efficiency, accuracy, and security of federated learning using homomorphic encryption is an urgent problem that needs to be solved by those skilled in the art. Summary of the invention
[0006] In view of this, the present invention provides a federated learning GPU-accelerated ciphertext aggregation method based on homomorphic encryption. This method is combined with a modular component homomorphic encryption library and federated learning, and different modular components are calculated in parallel by GPU to realize MNIST handwriting recognition under encrypted conditions, which greatly improves the speed and security of recognition, can effectively improve the efficiency and accuracy of federated learning, and at the same time ensure the security of learning.
[0007] In order to achieve the above object, the present invention adopts the following technical solution:
[0008] A federated learning GPU accelerated ciphertext aggregation method based on homomorphic encryption includes the following steps:
[0009] Step 1: The server initializes the global model and sends the model parameters of the global model to the client;
[0010] Step 2: The client generates a private key and a computation key for homomorphic encryption;
[0011] Step 3: The client trains the local model according to the model parameters of the global model and updates the local model;
[0012] Step 4: The client uses the modular component homomorphic encryption algorithm to encrypt the model parameters of the local model according to the private key, obtains the ciphertext, and sends the ciphertext to the server;
[0013] Step 5: After receiving the ciphertext, the server loads all the client ciphertexts into the GPU and performs parallel sum calculation according to the calculation key to obtain the sum value. The sum value is then sent back to the CPU for weighted average aggregation according to the calculation key to obtain the aggregated ciphertext and send it to the client.
[0014] Step 6: The client uses the private key to decrypt the aggregated ciphertext, uses the decrypted model parameters to update the local model, and returns to step 3 until the number of iterations is reached or the objective function of the global model converges.
[0015] Preferably, in step 1, the model parameters are initialized to obtain a global model, and the global model is a neural network with a depth of 6 layers, including 2 convolutional layers, 1 maximum pooling layer and 3 fully connected layers.
[0016] Preferably, the process of generating a public-private key pair by the client in step 2 is:
[0017] Step 21: Select n model bases to form a model projection base B;
[0018] Step 21: Set the user master key U, encrypt the user master key U, and generate the location template S;
[0019] Step 23: Generate a private key and a calculation key according to the model projection basis B and the position template S, the private key SK includes the model projection basis B, the position template S, the magnification a and the proportional factor Δ; the calculation key EK includes the model projection basis B, the magnification a and the proportional factor Δ.
[0020] Preferably, the specific process of the client training the local model in step 3 is:
[0021] Step 31: Download model parameters of the current global model from the server;
[0022] Step 32: Update the local model using the downloaded model parameters and load the dataset;
[0023] Step 33: Extract several groups of data batches of size B from the data set;
[0024] Step 34: Input a set of data batches into the local model for forward propagation to obtain prediction results;
[0025] Step 35: Calculate the loss function based on the predicted results and the true results marked in the data set, and calculate the gradient of the loss function relative to each model parameter in the local model through the back propagation algorithm;
[0026] Step 36: Update the model parameters of the local model using stochastic gradient descent according to the gradient, select the next set of data batches, and return to step 34 until the set training rounds are reached or the loss converges.
[0027] Preferably, in step 4, the specific process of the client using the modular component homomorphic encryption algorithm to encrypt the model parameters of the local model according to the private key is:
[0028] Step 41: Select 3 random numbers;
[0029] Step 42: multiply the model parameter by the scale factor Δ in the private key SK and take the nearest integer, multiply the obtained integer by the magnification a in the private key SK and add the random number noise η to obtain the distinguished plaintext;
[0030] Step 43: multiply the three random numbers by the magnification a respectively and then add the random number noise η to obtain three amplified scrambled random numbers;
[0031] Step 44: Let the model parameters perform a modulo operation on the modulo projection basis B to obtain a real modulo projection set;
[0032] Step 45: Perform a modulo operation on the modulo projection basis B using the three amplified scrambled random numbers to obtain a redundant modulo projection set;
[0033] Step 46: Insert the real module projection set into the redundant module projection set according to the position of the real module component in the position template S of the private key SK to obtain the ciphertext e; the ciphertext e is actually the confused redundant module projection set, the real module projection set is the real module projection, and the position template S determines the position of each real module projection in the M-1 confused redundant module projections in the confused redundant module projection set.
[0034] Preferably, the ciphertext e is transmitted to the CPU in the server for storage. In step 5, the server is equipped with a GPU, and the process of weighted averaging and aggregating the ciphertext by the server is as follows:
[0035] Step 51: The GPU copies the ciphertext e on the CPU in the server;
[0036] Step 52: The GPU starts a sum kernel and an extraction kernel, calls multiple thread blocks, each thread block has multiple threads, each thread performs sum calculations on different data groups of the ciphertext e according to the calculation key EK, extracts and stores the sum value into the result array, and the sum value in the result array is returned to the CPU to release GPU memory; each thread performs sum and extraction operations on the corresponding data group according to the global index, obtains the sum value and returns it to the CPU;
[0037] Step 53: The CPU performs a weighted average operation on the sum value according to the calculated key EK to obtain the aggregated ciphertext and sends it to the client.
[0038] Preferably, the client receives the aggregated ciphertext, decrypts it using the private key SK to obtain updated model parameters, and updates the local model using the updated model parameters.
[0039] It can be known from the above technical scheme that compared with the prior art, the present invention discloses a federated learning GPU accelerated ciphertext aggregation method based on homomorphic encryption, which ensures data security through a federated learning scheme based on homomorphic encryption of modular components, thereby alleviating users' concerns about data privacy leakage. The present invention uses a homomorphic encryption method based on obfuscated modular components. The calculations of different modular components are independent. The independence of the components enables multiple data components to be calculated at the same time, so that multi-core processors or distributed computing resources can be fully utilized to accelerate the calculation process; GPU is used to realize parallel calculation of ciphertext. GPU has a large number of cores and can process a large amount of data at the same time, which is suitable for large-scale computing tasks. GPU is fast in performing matrix operations and vector operations, especially suitable for the process of matrix addition. GPU can process more data per unit time, which helps to accelerate complex computing processes. When processing specific types of computing tasks, GPU's energy efficiency is usually better than CPU, and computing resources can be used more effectively, so the characteristics of GPU parallel computing are very suitable for accelerating the computing process. The specific beneficial effects of the present invention include:
[0040] (1) A federated learning solution is adopted, where the server and clients can work together to train the model, combining diverse data from different clients to improve the generalization ability of the model and make it perform better on unknown data;
[0041] (2) The server can perform aggregation operations such as weighted averaging on the encrypted parameters from each participant to obtain an update of the global model, thereby achieving the integration and improvement of model parameters in federated learning;
[0042] (3) The modular component homomorphic encryption algorithm is implemented using the domestically developed modular component homomorphic encryption library. It is highly efficient and requires less average running time, which can be applied to scenarios with large amounts of data. The client does not need to upload data to the server when training data locally, and the modular component homomorphic encryption algorithm is used, so that the server can directly aggregate the ciphertext without decrypting it, thus protecting the user's privacy-sensitive data and reducing the risk of data leakage.
[0043] (4) GPU is used to accelerate the ciphertext aggregation operation, which effectively improves the efficiency and increases the aggregation operation speed by five times compared with ordinary CPU;
[0044] (5) By supporting floating-point operations and floating-point encoding, ciphertext calculations with 19 digits after the decimal point can be realized, providing support for the implementation of the federated learning security aggregation method based on the modular component homomorphic encryption algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0046] Figure 1 A flow chart of the module-component homomorphic federated learning secure aggregation method provided by the present invention;
[0047] Figure 2 Schematic diagram of the federated learning architecture based on the modular component homomorphic encryption algorithm provided by the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] The embodiment of the present invention discloses a federated learning GPU accelerated ciphertext aggregation method based on homomorphic encryption, such as Figure 1 As shown, the following steps are included:
[0050] Step 1: The server initializes the global model and sends the model parameters of the global model to the client;
[0051] Step 2: The client generates a private key and a computation key for homomorphic encryption;
[0052] Step 3: The client trains the local model according to the model parameters of the global model and updates the local model;
[0053] Step 4: The client uses the modular component homomorphic encryption algorithm to encrypt the model parameters of the local model according to the private key, obtains the ciphertext, and sends the ciphertext to the server;
[0054] Step 5: After receiving the ciphertext, the server loads all the client ciphertexts into the GPU and performs parallel sum calculation according to the calculation key to obtain the sum value. The sum value is then sent back to the CPU for weighted average aggregation according to the calculation key to obtain the aggregated ciphertext and send it to the client.
[0055] Step 6: The client uses the private key to decrypt the aggregated ciphertext, uses the decrypted model parameters to update the local model, and returns to step 3 until the number of iterations is reached or the objective function of the global model converges.
[0056] On the other hand, in a specific embodiment, based on the federated learning GPU accelerated ciphertext aggregation method of homomorphic encryption, the structural diagram of data transmission between the server and the client is as follows: Figure 2 As shown, the specific steps include:
[0057] S1. Model parameter initialization;
[0058] The server initializes the model parameters of the global model, including weight parameters, and selects clients participating in the training in a certain proportion; the server sends the initialized global model to the clients participating in the training, and then starts federated learning;
[0059] S2. Key generation: The client generates key information for encryption, decryption, and homomorphic computing, including private keys and computing keys;
[0060] S3. Local model training on the client;
[0061] The client receives the global model sent by the server and trains local data based on the model. When the client's model reaches the end condition, the model parameters are encrypted using the modular component homomorphic encryption algorithm according to the private key, and the encrypted model parameters are transmitted back to the server.
[0062] S4. Server aggregation;
[0063] After receiving the encrypted model parameters from each client, the server performs a weighted average calculation based on the calculation key. In this process, there are a large number of blind calculation operations such as ciphertext and ciphertext addition, and a large number of independent modulus components need to perform the same calculation, so this blind calculation process is placed on the GPU for parallel calculation to speed up the process. After the calculation is completed, the new encrypted model parameters are sent back to each client;
[0064] S5. Iterative training;
[0065] After receiving the new encrypted model parameters, the client uses the private key to decrypt them, then uses the decrypted model parameters to update the local model and restart local data training, repeating S3-S5 until the end condition is met, which includes reaching the training round or model convergence.
[0066] On the other hand, in a specific embodiment, a federated learning GPU accelerated ciphertext aggregation method based on homomorphic encryption specifically includes the following steps:
[0067] S1. The server initializes the model parameters of the global model, specifically including the following steps:
[0068] S11, the server initializes the global model and sets the global model to a 6-layer neural network, which includes 2 convolutional layers, 1 maximum pooling layer, and 3 fully connected layers;
[0069] S12, the server sends the model parameters of the global model to the clients participating in the training;
[0070] S2. The client generates the private key and computation key required for homomorphic encryption, which specifically includes the following steps:
[0071] S21, selecting n standard module bases to form a module projection base B; performing module operation on the module bases to obtain module projections of data and construct a module projection base;
[0072] S22. The client sets its own user master key U and encrypts the user master key U to generate a location template S;
[0073] S23, generate a private key SK, including the module projection basis B, the position template S, the magnification a and the scale factor Δ; generate a calculation key EK, including the module projection basis B, the magnification a and the scale factor Δ; wherein the magnification a is used to eliminate the noise added in the homomorphic encryption process to ensure the accuracy of the result; the scale factor Δ is determined based on the sufficient precision required to represent the floating point number, ensuring that the range and precision of the encryption calculation are consistent with the expected precision of the result; the position template S determines the M-1 positions used to confuse each real module projection in the redundant module projection, which is also the most critical parameter in our private key. In order to ensure security, N log M>128 is required to ensure that the position template S will not be obtained by brute force by attackers;
[0074] S3. The client participating in the training receives the model parameters of the global model from the server. The client sets the hyperparameters used in the training, such as the learning rate, batch size, and number of training rounds, so as to perform forward propagation and backward propagation on its own local data. The training process based on the set hyperparameters and the received global model specifically includes the following steps:
[0075] S31, the client downloads the model parameters of the current global model from the server, which are usually aggregated in the previous training rounds;
[0076] S32, the client uses the model parameters to update its local model;
[0077] S33, the client prepares data locally, loads the data set and performs some preprocessing operations on the local data;
[0078] S34, the client extracts a data batch of size B from the loaded data set, where B defines the parameters of how many samples are included in each data batch;
[0079] Use the current local model to perform forward propagation calculations on the extracted data batches, input the data batches into the neural network of the local model for forward propagation, and obtain the prediction results of the local model through calculations at each layer of the network;
[0080] S36, calculating the loss function through the prediction results and the true values marked in the local data set;
[0081] S37, calculate the gradient of the loss function relative to each model parameter of the local model through the back-propagation algorithm; this process involves the chain rule, calculating the gradient of each model parameter backward layer by layer;
[0082] S38. Use the stochastic gradient descent (SGD) algorithm to update the model parameters according to the calculated gradients; the update process involves dynamically adjusting parameters such as the learning rate to make the parameter update stable and reduce the risk of problems such as overfitting;
[0083] S39, repeat the forward propagation and back propagation process, i.e., S34-S38, until the set training round is reached or the loss converges;
[0084] S4. After the client participating in the training completes the training of the local model, the model parameters are encrypted using the private key using the modular component homomorphic encryption algorithm. The client performing the training transmits the encrypted model parameters to the server. Assuming that the modular projection basis B includes 64 modular bases and the number of obfuscated redundant data is 3, the specific steps are as follows:
[0085] S41, generating three random data (i.e., confusing redundant data) for confusing the real model projection component;
[0086] S42, multiply the model parameter by the scale factor Δ in the private key SK, and round it to the nearest integer, the integer value is first multiplied by the magnification a in the private key SK, and then added to the first random number η, to obtain a distinguished plaintext; the first random number η is mainly used to prevent the same plaintext under the same module basis from obtaining the same ciphertext, where η<<a, so as to eliminate the noise generated by the superposition of the first random number η and obtain the correct result;
[0087] S43, multiplying the three random numbers by the magnification factor a in the private key SK to amplify them by a times, and adding the random number noise η to obtain three amplified and scrambled data, namely, the amplified scrambled random numbers;
[0088] S44, let the model parameters perform a modulo operation on the modulo projection basis B (of which there are 64 modulo bases) to obtain the modulo projection, and construct a real modulo projection set;
[0089] S45, performing a modulo operation on a modulo projection basis B (of which there are 64 modulo bases) using three amplified scrambled random numbers to obtain a modulo projection, and constructing a redundant modulo projection set;
[0090] S46, inserting the real modulus projection set into the redundant modulus projection set according to the position of the real modulus component in the position template S of the private key SK for obfuscation, each real modulus projection has four optional positions, and obtaining a ciphertext e of size 64×4;
[0091] S47, the participant sends the encrypted client model parameters, i.e., ciphertext e, to the server;
[0092] S5. The server receives the ciphertext e sent by each client, but does not decrypt it. Instead, it directly uses the properties of homomorphic encryption to perform weighted average on each ciphertext to obtain the aggregated ciphertext. The ciphertext e is transmitted to the CPU of the server.
[0093] The server loads the weighted average calculation process of the ciphertext to the GPU for parallel sum calculation. The calculated sum result is returned to the CPU, and the sum result is weighted averaged and aggregated, and then sent to the client participating in the training. The specific steps include:
[0094] S51, GPU is ready to receive and process data, and copies the ciphertext e on the CPU to the GPU so that the GPU can access the data;
[0095] S52, GPU starts a sum kernel, calls multiple thread blocks, each thread block has multiple threads, responsible for summing different data groups; starts an extraction kernel, responsible for extracting the first array from each group and storing it in the result array;
[0096] S53, each thread processes the corresponding group according to its global index, performs addition or extraction operations according to the calculation key EK, and obtains the calculation result; for example, when the ciphertext e is a 64×4 ciphertext matrix, the operation performed by the GPU is to add the corresponding positions of a large number of 64×4 ciphertext two-dimensional arrays, and then extract the ciphertext addition results and put them into the result array as the calculation result. Since this process is carried out in parallel, the speed of this process is greatly accelerated; each thread performs a blind addition operation on the ciphertexts of the model parameters corresponding to the two clients. In this process, the two groups of ciphertexts are first aligned according to the magnification a and the scale factor Δ in the calculation key EK, and then the two groups of aligned ciphertexts are added using the modular projection basis B to obtain a new ciphertext, and finally the magnification and scale factor orders of the new ciphertext are updated according to the magnification and scale factor orders of the two groups of ciphertexts;
[0097] S54, transferring the calculation result from the result data of the GPU back to the CPU, and releasing the GPU memory;
[0098] S55. After receiving the calculation result, the CPU performs a weighted average operation according to the calculation key EK to obtain the aggregated ciphertext; since there is no division operation in homomorphic encryption, the operation of multiplying by the inverse is used instead;
[0099] After the server aggregation operation of S56 and S55 is completed, the updated model parameters (i.e., aggregated ciphertext) in the ciphertext state are sent to the clients participating in the training;
[0100] S6. Each client participating in the training receives the aggregated ciphertext sent by the server and decrypts it using its own private key SK, and updates the local model;
[0101] S7. Repeat S3-S6 to continuously optimize the global model until the specified number of iterations is reached or the loss function converges.
[0102] In the present invention, the client is mainly responsible for receiving and decrypting the global model sent by the server, and performing gradient descent (SGD) training on local data based on the global model. The server is mainly responsible for distributing the global model to the client and performing aggregation operations on the encrypted client model parameters. In this process, the greatest effect of using the homomorphic encryption algorithm is that the server can directly perform aggregation operations without having access to the plaintext data. When performing aggregation operations, the server uses GPU to implement parallel computing. The core architecture of GPU is based on SIMD, i.e. "single instruction, multiple data", which means that each core will execute the same instruction at the same time, but operate on different data. This architecture is particularly suitable for processing data-intensive tasks that can be parallelized, such as image and matrix calculations; and in GPU, computing tasks are usually decomposed into a large number of threads, each thread processes part of the task, and GPU can run thousands to millions of threads at the same time, greatly improving computing efficiency, so the greatest effect of using GPU is to accelerate the blind computing process of aggregation operations, add the corresponding position ciphertexts in parallel, and then transmit the results back to CPU.
[0103] The present invention completes the training of the overall data through collaborative training between the client and the server, and achieves no leakage of intermediate data, enhancing the privacy and security of the client's local data. Most importantly, the GPU is used to accelerate the blind computing process in parallel, making up for the inefficiency of homomorphic encryption. Federated learning allows multiple participants to train models locally without sharing original data; through homomorphic encryption, the data remains encrypted even during the model training process, which can effectively protect personal privacy, especially in sensitive fields such as medicine and finance, alleviating users' concerns about privacy leakage to a certain extent, and can attract more users to participate.
[0104] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0105] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A GPU-accelerated ciphertext aggregation method for federated learning based on homomorphic encryption, characterized in that: The following steps are involved: Step 1: The server initializes the global model and sends the model parameters of the global model to the client; Step 2: The client generates a private key and a computation key for homomorphic encryption; Step 3: The client trains the local model according to the model parameters of the global model and updates the local model; Step 4: The client uses the modular component homomorphic encryption algorithm to encrypt the model parameters of the local model according to the private key, obtains the ciphertext, and sends the ciphertext to the server; Step 5: After receiving the ciphertext, the server loads all the client ciphertexts into the GPU and performs parallel sum calculation according to the calculation key to obtain the sum value. The sum value is then sent back to the CPU for weighted average aggregation according to the calculation key to obtain the aggregated ciphertext and send it to the client. Step 6: The client uses the private key to decrypt the aggregated ciphertext, uses the decrypted model parameters to update the local model, and returns to step 3 until the number of iterations is reached or the objective function of the global model converges.
2. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 1, it is characterized in that: In step 1, the model parameters are initialized to obtain the global model, which is a neural network with a depth of 6 layers, including 2 convolutional layers, 1 maximum pooling layer and 3 fully connected layers.
3. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 1, it is characterized in that: The process of the client generating a public and private key pair in step 2 is as follows: Step 21: Select n model bases to form a model projection base B; Step 21: Set the user master key U, encrypt the user master key U, and generate the location template S; Step 23: Generate a private key and a calculation key according to the model projection basis B and the position template S, the private key SK includes the model projection basis B, the position template S, the magnification a and the proportional factor Δ; the calculation key EK includes the model projection basis B, the magnification a and the proportional factor Δ.
4. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 1, it is characterized in that: The specific process of the client training the local model in step 3 is as follows: Step 31: Download model parameters of the current global model from the server; Step 32: Update the local model using the downloaded model parameters and load the dataset; Step 33: Extract several groups of data batches of size B from the data set; Step 34: Input a set of data batches into the local model for forward propagation to obtain prediction results; Step 35: Calculate the loss function based on the predicted results and the true results marked in the data set, and calculate the gradient of the loss function relative to each model parameter in the local model through the back propagation algorithm; Step 36: Update the model parameters of the local model using stochastic gradient descent according to the gradient, select the next set of data batches, and return to step 34 until the set training rounds are reached or the loss converges.
5. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 3, it is characterized in that: In step 4, the specific process of the client using the modular component homomorphic encryption algorithm to encrypt the model parameters of the local model according to the private key is: Step 41: Select 3 random numbers; Step 42: multiply the model parameter by the scale factor Δ in the private key SK and take the nearest integer, multiply the obtained integer by the magnification a in the private key SK and add the random number noise η to obtain the distinguished plaintext; Step 43: multiply the three random numbers by the magnification a respectively and then add the random number noise η to obtain three amplified scrambled random numbers; Step 44: Let the model parameters perform a modulo operation on the modulo projection basis B to obtain a real modulo projection set; Step 45: Perform a modulo operation on the modulo projection basis B using the three amplified scrambled random numbers to obtain a redundant modulo projection set; Step 46: Insert the real modulus projection set into the redundant modulus projection set according to the position of the real modulus component in the position template S of the private key SK to obtain the ciphertext e.
6. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 1, it is characterized in that: The ciphertext is transmitted to the CPU in the server for storage. In step 5, the server is equipped with a GPU. The process of weighted averaging and aggregation of the ciphertext by the server is as follows: Step 51: The GPU copies the ciphertext on the CPU in the server; Step 52: The GPU starts a sum kernel and an extraction kernel, calls multiple thread blocks, each thread block has multiple threads, each thread performs sum calculations on different data groups of the ciphertext according to the calculation key EK, extracts the sum value and stores it in the result array, and the sum value in the result array is returned to the CPU to release GPU memory; each thread performs sum and extraction operations on the corresponding data group according to the global index; Step 53: The CPU performs a weighted average operation on the sum value according to the calculated key EK to obtain the aggregated ciphertext and sends it to the client.
7. According to the method of GPU accelerated ciphertext aggregation based on homomorphic encryption for federated learning according to claim 1, it is characterized in that: The client receives the aggregated ciphertext and decrypts it using the private key SK to obtain the updated model parameters, and then uses the updated model parameters to update the local model.
Citation Information
Patent Citations
Federal learning system and method applied to heterogeneous computing equipment
CN113112029A
Heterogeneous acceleration method, device and system for longitudinal federated logistic regression learning
CN113407979A
Federal learning privacy protection method based on homomorphic encryption
CN113434873A
Privacy computing heterogeneous acceleration method and device based on fully homomorphic encryption
CN115622684A
Joint learning accelerator and related methods
CN115860132A
Cited By
Model development data anti-leakage method and device oriented to Plevatory intelligent computing center cloud platform
CN120387181A
Method and device for preventing leakage of model development data for cloud platform of inclusive computing power intelligent computing center
CN120387181B
Federal learning method and system based on modular component homomorphic encryption and response verification
CN121125053A
A federated learning method and system based on mode component homomorphic encryption and response verification
CN121125053B