Method for reducing communication overhead in homomorphic encryption federated learning and related device
By generating public and private keys for homomorphic encryption in federated learning and using a scaling factor to dequantize gradient vectors, the client retains high-precision gradient components and quantizes other components, thus solving the problem of excessive communication overhead caused by homomorphic encryption and improving training efficiency.
Patent Information
- Application Number
- CN202410964854.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-07-18
AI Technical Summary
In federated learning, homomorphic encryption results in excessive communication overhead and high computational complexity for encryption and decryption, making it difficult to deploy effectively in large-scale device training scenarios.
By generating public and private keys, homomorphic encrypted gradient transmission is performed between the client and the central server. The gradient vector is dequantized using a scaling factor, and then decrypted and aggregated on the central server. The client retains the high-precision gradient components and quantizes other components, reducing the amount of communication data.
It reduces communication overhead and improves the gradient aggregation calculation efficiency of the central server, making it suitable for large-scale device training scenarios.
Smart Images

Figure CN118984211B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of federated learning, and in particular to a method for reducing communication overhead in homomorphic encrypted federated learning and related equipment. Background Art
[0002] During the federated learning training process, communication between nodes has an important impact on training efficiency. A large amount of parameter transmission may cause the communication time between nodes to be too long, reducing the efficiency of federated learning.
[0003] Furthermore, federated learning using homomorphic encryption results in high computational complexity for encryption and decryption, often generating significant communication overhead, which makes it very difficult to deploy federated learning using homomorphic encryption in large-scale device training scenarios. Summary of the Invention
[0004] In view of this, the purpose of this application is to propose a method and related equipment for reducing communication overhead in homomorphic encrypted federated learning.
[0005] Based on the above objectives, this application provides a method for reducing communication overhead in homomorphic encrypted federated learning, which is applied to a central server and includes:
[0006] Generate public and private keys, and distribute the public key to each client;
[0007] In each round of training, the global model of this round is distributed to each client;
[0008] Receive the current round's scaling factor and encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round's scaling factor, aggregate the dequantized target gradient vectors to obtain an aggregated encrypted gradient;
[0009] Decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and use the target aggregated gradient of this round to train the global model of this round to obtain the global model of the next round;
[0010] In response to determining that the target aggregate gradient of this round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, the training is completed; in response to determining that the target aggregate gradient of this round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations, the next round of training is performed.
[0011] Furthermore, the encrypted target gradient vector is dequantized using the scaling factor of this round, including:
[0012] Each target gradient component in the encrypted target gradient vector is dequantized according to the following formula:
[0013]
[0014] Among them, p i represents the i-th target gradient component, Indicates p i The target gradient component after dequantization, s represents the scaling factor of this round;
[0015] The dequantized target gradient components are combined into a dequantized encrypted target gradient vector.
[0016] Based on the same inventive concept, this application provides another method for reducing communication overhead in homomorphic encrypted federated learning, which is applied to the client and includes:
[0017] Receive the public key sent by the central server;
[0018] In each round of training, receiving the global model of the current round sent by the central server;
[0019] Train the global model of this round to obtain the gradient vector of this round, and add the quantization error obtained from the previous round of training to the gradient vector of this round to obtain the effective gradient vector of this round, which contains multiple effective gradient components;
[0020] Selecting a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retaining a first portion of the effective gradient components in the first number, quantizing a second portion of the effective gradient components to obtain quantized gradients, and combining the retained effective gradient components and the quantized gradients to form a target gradient vector for this round;
[0021] The effective gradient vector is used to determine the scaling factor of this round, the scaling factor of this round and the target gradient vector are used to determine the quantization error of the next round of training, and the scaling factor of this round and the target gradient vector encrypted by the public key are sent to the central server.
[0022] Further, the sum of the first part and the second part is equal to the first amount;
[0023] Furthermore, the second part of the effective gradient component is quantized to obtain a quantized gradient, including:
[0024] Each effective gradient component of the second part is quantized using the function shown below:
[0025]
[0026] in, Represents the jth effective gradient component in the second part of the gradient component, q i express The quantized gradient component after quantization, where j∈the second part;
[0027] The quantized gradient components are combined into the quantized gradient.
[0028] Furthermore, determining the scaling factor of this round using the effective gradient vector includes:
[0029] The following calculation is performed using each effective gradient component in the effective gradient vector:
[0030]
[0031] Where s represents the scaling factor, n represents the total number of effective gradient components, represents the i-th effective gradient component.
[0032] Furthermore, the quantization error of the next round of training is determined using the scaling factor of the current round and the target gradient vector, including:
[0033]
[0034] Where e represents the quantization error, represents the effective gradient vector, s represents the scaling factor, and Q represents the target gradient vector.
[0035] Based on the same inventive concept, the present application also provides a device for reducing communication overhead in homomorphic encrypted federated learning, comprising: a key distribution module, a model distribution module, an aggregation module, a decryption module, and a determination module;
[0036] The key distribution module is configured to generate a public key and a private key, and distribute the public key to each client;
[0037] The model distribution module is configured to distribute the global model of this round to each client in each round of training;
[0038] The aggregation module is configured to receive the current round scaling factor and the encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round scaling factor, and aggregate the dequantized target gradient vector to obtain an aggregated encrypted gradient;
[0039] The decryption module is configured to decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and train the global model of this round using the target aggregated gradient of this round to obtain the global model of the next round;
[0040] The determination module is configured to, in response to determining that the target aggregate gradient of the current round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, complete the training; and in response to determining that the target aggregate gradient of the current round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations, proceed to the next round of training.
[0041] Based on the same inventive concept, the present application also provides another device for reducing communication overhead in homomorphic encrypted federated learning, comprising: a key receiving module, a model receiving module, a training module, a gradient processing module, and an error calculation module;
[0042] The key receiving module is configured to receive the public key sent by the central server;
[0043] The model receiving module is configured to receive the global model of the current round sent by the central server in each round of training;
[0044] The training module is configured to train the global model of this round to obtain a gradient vector of this round, and add the quantization error obtained from the previous round of training to the gradient vector of this round to obtain an effective gradient vector of this round, wherein the effective gradient vector includes multiple effective gradient components;
[0045] The gradient processing module is configured to select a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retain a first portion of the effective gradient components in the first number, quantize a second portion of the effective gradient components to obtain quantized gradients, and combine the retained effective gradient components and the quantized gradients to form a target gradient vector for this round;
[0046] The error calculation module is configured to use the effective gradient vector to determine the scaling factor of the current round, use the scaling factor of the current round and the target gradient vector to determine the quantization error of the next round of training, and send the scaling factor of the current round and the target gradient vector encrypted by the public key to the central server.
[0047] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, it implements the method for reducing communication overhead in homomorphic encrypted federated learning as described in any one of the above items.
[0048] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method of reducing communication overhead in the above-mentioned homomorphic encrypted federated learning.
[0049] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the method for reducing communication overhead in homomorphic encrypted federated learning as described in any of the above items.
[0050] As can be seen from the above, the method and related equipment for reducing communication overhead in homomorphic encrypted federated learning provided by the present application, in each round of training, the client obtains the gradient vector of this round after training based on the global model obtained from the central server, comprehensively considers the quantization error in each round of training, and adds the quantization error calculated in the previous round to the gradient vector to obtain the effective gradient vector, and obtains the target gradient vector by selecting the first multiple effective gradient vectors with the largest absolute values, retaining a part of them with high precision, and quantizing the other part by 1 bit, so that the amount of data contained in the target gradient vector is reduced, and the communication overhead required when transmitting the target gradient vector to the central server is smaller, and the central server has higher computational efficiency when performing gradient aggregation calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in this application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0052] Figure 1 This is a first flow chart of a method for reducing communication overhead in homomorphically encrypted federated learning according to an embodiment of the present application;
[0053] Figure 2 This is a second flow chart of the method for reducing communication overhead in homomorphic encrypted federated learning according to an embodiment of the present application;
[0054] Figure 3 This is a first structural diagram of a device for reducing communication overhead in homomorphic encrypted federated learning according to an embodiment of the present application;
[0055] Figure 4 This is a second structural diagram of the apparatus for reducing communication overhead in homomorphic encrypted federated learning according to an embodiment of the present application;
[0056] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the objectives, technical solutions and advantages of this application more clear, this application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0058] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0059] As described in the background technology section, the related methods for reducing communication overhead in homomorphic encryption federated learning are still difficult to meet the communication needs of federated learning in actual work.
[0060] In the process of implementing this application, the applicant discovered that the main problem with the related homomorphic encryption federated learning method is that during the federated learning training process, communication between nodes has an important impact on training efficiency. A large amount of parameter transmission may cause the communication time between nodes to be too long, thereby reducing the efficiency of federated learning.
[0061] Furthermore, federated learning using homomorphic encryption results in high computational complexity for encryption and decryption, often generating significant communication overhead, which makes it very difficult to deploy federated learning using homomorphic encryption in large-scale device training scenarios.
[0062] Based on this, one or more embodiments in this application provide a method for reducing communication overhead in homomorphic encrypted federated learning.
[0063] In an embodiment of the present application, a federated learning scenario for model training includes a central server and multiple clients.
[0064] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0065] refer to Figure 1 A method for reducing communication overhead in homomorphic encrypted federated learning according to an embodiment of the present application is applied to a central server and specifically includes the following steps:
[0066] Step S101: Generate a public key and a private key, and distribute the public key to each client.
[0067] In an embodiment of the present application, before model training, the central server will generate a public key and a private key for homomorphic encryption, send the generated public key to each client, and retain the generated private key on the central server.
[0068] Step S102: In each round of training, the global model of this round is distributed to each client.
[0069] In this embodiment, after the distribution of the private key is completed, the first round of training of the model can be started.
[0070] In the first round of training, the initialized global model can be distributed to each client.
[0071] Furthermore, in each subsequent round of training, the updated global model obtained after the training is distributed to each client.
[0072] In another embodiment of the present application, during the first round of training, the central server will also initialize an error cache, so that each client can store the quantization error obtained in each subsequent round of training in the error cache.
[0073] Step S103: Receive the current round scaling factor and the encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round scaling factor, aggregate the dequantized target gradient vectors to obtain an aggregated encrypted gradient.
[0074] In this embodiment, in each round of training, after each client trains its own global model, it sends the scaling factor and the encrypted target gradient vector to the central server.
[0075] Based on homomorphic encryption, the central server can use the received scaling factor to dequantize the encrypted target gradient vector sent by the same client.
[0076] Specifically, for the scaling factor and encrypted target gradient vector sent by any client, each target gradient component in the encrypted target gradient vector can be dequantized according to the following formula:
[0077]
[0078] Among them, p i represents the i-th target gradient component in the encrypted target gradient vector, Indicates p i The target gradient component after dequantization, s represents the scaling factor of the same client in this round;
[0079] Based on this, the dequantized target gradient components are combined into a dequantized target gradient vector, wherein the target gradient vector is still in an encrypted state.
[0080] Furthermore, based on homomorphic encryption, the central server can directly perform aggregation operations using the dequantized and encrypted target gradient vector to obtain the aggregated encrypted gradient.
[0081] Step S104: Decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and train the global model of this round using the target aggregated gradient of this round to obtain the global model of the next round.
[0082] In an embodiment of the present application, based on the aggregated encrypted gradient obtained in the aforementioned steps, since the aggregated encrypted gradient is still in an encrypted state, it needs to be decrypted before being used for training the global model.
[0083] Specifically, the aggregated encrypted gradient is decrypted using the private key retained in the previous step, thereby obtaining the decrypted target aggregated gradient for this round of training.
[0084] Based on this, the central server uses the target aggregated gradient to train the global model of this round, and after this round of training, updates the global model to obtain the global model for the next round of training.
[0085] Step S105: In response to determining that the target aggregate gradient of this round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, the training is completed; in response to determining that the target aggregate gradient of this round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations, the next round of training is performed.
[0086] In an embodiment of the present application, in each round of training, the central server determines whether the number of training rounds reaches a preset number of iterations, and whether the currently determined target aggregation gradient reaches a preset gradient threshold.
[0087] Specifically, the number of iterations can be considered as the maximum training rounds when training the global model. Based on this, it can be determined whether the current training rounds have reached the maximum training rounds. When the maximum training rounds are reached, the global model training is considered completed.
[0088] Furthermore, after determining whether the target aggregate gradient reaches the gradient threshold, when the target aggregate gradient reaches the gradient threshold, the global model training is considered completed.
[0089] It can be seen that when either the training round or the target aggregate gradient reaches the preset standard, the training can be considered complete.
[0090] Furthermore, when the number of training rounds does not reach the maximum number of training rounds and the target aggregate gradient does not reach the gradient threshold, the global model is considered not to be trained yet.
[0091] Based on this, we can enter the next round of training and send the updated global model obtained from this round of training to each client.
[0092] refer to Figure 2 The present application provides a method for reducing communication overhead in homomorphic encrypted federated learning according to an embodiment, which is applied to a client and specifically includes the following steps:
[0093] Step S201: Receive the public key sent by the central server.
[0094] In an embodiment of the present application, before model training, each client receives a public key from a central server for homomorphic encryption.
[0095] Step S202: In each round of training, receive the global model of the current round sent by the central server.
[0096] In an embodiment of the present application, at the beginning of each round of training, each client receives a global model for that round of training from a central server.
[0097] Specifically, in the first round of training, each client receives its initialized global model from the central server. In each subsequent round of training, each client receives the updated global model from the central server based on the previous round of training.
[0098] Step S203: Train the global model of this round to obtain the gradient vector of this round, and add the quantization error obtained in the previous round of training to the gradient vector of this round to obtain the effective gradient vector of this round, wherein the effective gradient vector includes multiple effective gradient components.
[0099] In an embodiment of the present application, in each round of training, each client trains the received global model using its locally stored training data, thereby obtaining the gradient vector G of this round.
[0100] The gradient vector G contains multiple gradient components and is expressed as G = [g1, g2, g3, ..., g n ].
[0101] Based on this, the quantization error e obtained in the previous round of training is added to the gradient vector G obtained through training.
[0102] In this embodiment, in the first round of training of the client, the quantization error e=[0, 0, 0, . . . , 0] may be initialized.
[0103] In this embodiment, the quantization error e can be added to the gradient vector G according to the following formula to obtain an effective gradient vector:
[0104]
[0105] in, Represents the effective gradient vector, the effective gradient vector contains multiple effective gradient components, that is, Represents the nth effective gradient component.
[0106] Step S204: Select a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retain a first portion of the first number of effective gradient components, quantize a second portion of the effective gradient components to obtain quantized gradients, and combine the retained effective gradient components and the quantized gradients to form a target gradient vector for this round.
[0107] In an embodiment of the present application, each client determines a plurality of effective gradient components with larger absolute values from the plurality of effective gradient components based on the respective effective gradient vectors determined above.
[0108] Specifically, all effective gradient components are arranged in descending order of absolute value, and starting from the effective gradient component with the largest absolute value, K effective gradient components are determined. Based on this, the top K effective gradient components with the largest absolute value can be obtained.
[0109] Furthermore, the determined first number of effective gradient components is divided into a first part and a second part, wherein the effective gradient components of the first part retain gradient accuracy, and the effective gradient components of the second part are quantized to obtain quantized gradients.
[0110] Specifically, according to specific circumstances, the most important multiple effective gradient components among the first number of effective gradient components may be taken as the first part, and the other effective gradient components may be taken as the second part.
[0111] In some embodiments, the first 30% of the effective gradient components in the first quantity can be taken in descending order of absolute value as the first part, and the remaining 70% of the effective gradient components can be taken as the second part.
[0112] In other embodiments, the norm and gradient variation may be calculated for each effective gradient component in the first quantity, and the two may be weighted, and the weighted result may be used as the division index of the effective gradient component.
[0113] Based on this, in the order of the division index from large to small, the first 30% of the effective gradient components are taken as the first part, and the remaining 70% of the effective gradient components are taken as the second part.
[0114] Furthermore, each effective gradient component in the second part is quantized.
[0115] Specifically, the sign function can be used to perform 1-bit quantization according to the following formula:
[0116]
[0117] in, Represents the jth effective gradient component in the second part of the gradient component, q i express The quantized gradient component after quantization, where j∈the second part;
[0118] Based on this, the various quantized gradient components are combined into a quantized gradient.
[0119] Furthermore, the retained effective gradient component of the first part and the quantized gradient including multiple quantized gradient components are combined to form a target gradient vector Q.
[0120] According to this, the target gradient vector Q = [q1, q2, q3, ..., q 0.3n ,q 0.3n+1 ,…,q n ], where q1 to q n are the n target gradient components in the target gradient vector, [q1, q2, q3, ..., q 0.3n ] is the first 30% effective gradient component to retain the gradient accuracy, that is, the effective gradient component of the first part; [q 0.3n+1 ,…,q n ] are the quantized gradient components after 1-bit quantization, that is, the results after the effective gradient components of the second part are quantized.
[0121] Step S205: Determine the scaling factor of this round using the effective gradient vector, determine the quantization error of the next round of training using the scaling factor of this round and the target gradient vector, and send the scaling factor of this round and the target gradient vector encrypted with the public key to the central server.
[0122] In an embodiment of the present application, in each round of training, each client can further determine the scaling factor of this round of training based on the effective gradient vector determined in the above steps, and calculate the quantization error for the next round of training based on the scaling factor.
[0123] Specifically, in order to calculate the quantization error more accurately, it is necessary to use all effective gradient components in the effective gradient vector for calculation.
[0124] In this embodiment, the vector error can be calculated according to the following formula:
[0125]
[0126] Where e represents the quantization error, represents the effective gradient vector, s represents the scaling factor, and Q represents the target gradient vector.
[0127] Furthermore, the calculated vector error is stored in a pre-established error buffer to be retrieved and used in the next round of training.
[0128] In this embodiment, the scaling factor can be determined using each effective gradient component in the effective gradient vector according to the following formula:
[0129]
[0130] Where s represents the scaling factor, n represents the total number of effective gradient components, represents the i-th effective gradient component, where
[0131] It can be seen that by utilizing all effective gradient components to calculate a more accurate scaling factor, the accurate quantization error can be calculated.
[0132] Based on this, each client can encrypt the target gradient vector obtained in each round of training and send it to the central server.
[0133] Specifically, each client uses the private key obtained before the start of training to encrypt the target gradient vector obtained in the current round of training, and sends the encrypted target gradient vector and the above-determined scaling factor to the central server.
[0134] It can be seen that the method for reducing communication overhead in homomorphic encrypted federated learning in an embodiment of the present application is that in each round of training, the client obtains the gradient vector of this round after training based on the global model obtained from the central server, and comprehensively considers the quantization error in each round of training, so as to add the quantization error calculated in the previous round to the gradient vector to obtain the effective gradient vector, and obtains the target gradient vector by selecting the first multiple effective gradient vectors with the largest absolute values, retaining a part of them with high precision, and quantizing the other part by 1 bit, so that the amount of data contained in the target gradient vector is reduced, and the communication overhead required when transmitting the target gradient vector to the central server is smaller, and the central server has higher computational efficiency when performing gradient aggregation calculations.
[0135] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario and completed by multiple devices working together. In the case of such a distributed scenario, one of the multiple devices may only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method described.
[0136] It should be noted that the above description is limited to some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0137] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, an embodiment of the present application also provides a device for reducing communication overhead in homomorphic encrypted federated learning.
[0138] refer to Figure 3 The device for reducing communication overhead in the homomorphic encryption federated learning includes: a key distribution module 301, a model distribution module 302, an aggregation module 303, a decryption module 304 and a determination module 305;
[0139] The key distribution module 301 is configured to generate a public key and a private key, and distribute the public key to each client;
[0140] The model distribution module 302 is configured to distribute the global model of this round to each client in each round of training;
[0141] The aggregation module 303 is configured to receive the current round scaling factor and the encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round scaling factor, and aggregate the dequantized target gradient vector to obtain an aggregated encrypted gradient;
[0142] The decryption module 304 is configured to decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and use the target aggregated gradient of this round to train the global model of this round to obtain the global model of the next round;
[0143] The determination module 305 is configured to complete training in response to determining that the target aggregate gradient of the current round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, and to proceed to the next round of training in response to determining that the target aggregate gradient of the current round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations.
[0144] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the embodiments of the present application also provide another device for reducing communication overhead in homomorphic encrypted federated learning.
[0145] refer to Figure 4 The device for reducing communication overhead in homomorphic encrypted federated learning includes: a key receiving module 401, a model receiving module 402, a training module 403, a gradient processing module 404 and an error calculation module 405;
[0146] The key receiving module 401 is configured to receive the public key sent by the central server;
[0147] The model receiving module 402 is configured to receive the global model of the current round sent by the central server in each round of training;
[0148] The training module 403 is configured to train the global model of this round to obtain a gradient vector of this round, and add the quantization error obtained from the previous round of training to the gradient vector of this round to obtain an effective gradient vector of this round, wherein the effective gradient vector includes multiple effective gradient components;
[0149] The gradient processing module 404 is configured to select a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retain a first portion of the effective gradient components in the first number, quantize a second portion of the effective gradient components to obtain quantized gradients, and combine the retained effective gradient components and the quantized gradients to form a target gradient vector for this round;
[0150] The error calculation module 405 is configured to use the effective gradient vector to determine the scaling factor of the current round, use the scaling factor of the current round and the target gradient vector to determine the quantization error of the next round of training, and send the scaling factor of the current round and the target gradient vector encrypted with the public key to the central server.
[0151] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0152] The device of the above embodiment is used to implement the method of reducing communication overhead in the corresponding homomorphic encrypted federated learning in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0153] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, it implements the method for reducing communication overhead in homomorphic encrypted federated learning as described in any of the above embodiments.
[0154] Figure 5 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.
[0155] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0156] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of the present application are implemented through software or firmware, the relevant program codes are stored in the memory 1020 and called and executed by the processor 1010.
[0157] The input / output interface 1030 is used to connect an input / output module to implement information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.
[0158] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).
[0159] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0160] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of the present application, and does not necessarily include all the components shown in the figure.
[0161] The device of the above embodiment is used to implement the method of reducing communication overhead in the corresponding homomorphic encrypted federated learning in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0162] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method for reducing communication overhead in homomorphic encrypted federated learning as described in any of the above embodiments.
[0163] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0164] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method of reducing communication overhead in homomorphic encrypted federated learning as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0165] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the method for reducing communication overhead in homomorphic encrypted federated learning as described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0166] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0167] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the drawings provided. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the following fact, that is, the details of the implementation of these block diagram devices are highly dependent on the platform of the embodiment to be implemented in the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). When specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0168] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the embodiments discussed.
[0169] The embodiments of the present application are intended to encompass all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A method for reducing communication overhead in homomorphic encrypted federated learning, characterized in that: Applied to central server; The method includes: Generate public and private keys, and distribute the public key to each client; In each round of training, the global model of this round is distributed to each client; Receive the current round's scaling factor and encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round's scaling factor, aggregate the dequantized target gradient vectors to obtain an aggregated encrypted gradient; Decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and use the target aggregated gradient of this round to train the global model of this round to obtain the global model of the next round; In response to determining that the target aggregate gradient of this round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, the training is completed; in response to determining that the target aggregate gradient of this round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations, the next round of training is performed.
2. The method according to claim 1, characterized in that Dequantizing the encrypted target gradient vector using the scaling factor of this round includes: Each target gradient component in the encrypted target gradient vector is dequantized according to the following formula: Among them, p i represents the i-th target gradient component, Indicates p i The target gradient component after dequantization, s represents the scaling factor of this round; The dequantized target gradient components are combined into a dequantized encrypted target gradient vector.
3. A method for reducing communication overhead in homomorphic encrypted federated learning, characterized in that: Applied to the client; The method includes: Receive the public key sent by the central server; In each round of training, receiving the global model of the current round sent by the central server; Train the global model of this round to obtain the gradient vector of this round, and add the quantization error obtained from the previous round of training to the gradient vector of this round to obtain the effective gradient vector of this round, which contains multiple effective gradient components; Selecting a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retaining a first portion of the effective gradient components in the first number, quantizing a second portion of the effective gradient components to obtain quantized gradients, and combining the retained effective gradient components and the quantized gradients to form a target gradient vector for this round; The effective gradient vector is used to determine the scaling factor of this round, the scaling factor of this round and the target gradient vector are used to determine the quantization error of the next round of training, and the scaling factor of this round and the target gradient vector encrypted by the public key are sent to the central server.
4. The method according to claim 3, characterized in that The sum of the first portion and the second portion is equal to the first amount; The step of quantizing the second effective gradient component to obtain a quantized gradient includes: Each effective gradient component of the second part is quantized using the function shown below: in, Represents the jth effective gradient component in the second part of the gradient component, q i express The quantized gradient component after quantization, where j∈the second part; The quantized gradient components are combined into the quantized gradient.
5. The method according to claim 3, characterized in that The determining of the scaling factor of this round by using the effective gradient vector includes: The following calculation is performed using each effective gradient component in the effective gradient vector: Where s represents the scaling factor, n represents the total number of effective gradient components, represents the i-th effective gradient component.
6. The method according to claim 3, characterized in that Determining the quantization error of the next round of training by using the scaling factor of the current round and the target gradient vector includes: Where e represents the quantization error, represents the effective gradient vector, s represents the scaling factor, and Q represents the target gradient vector.
7. A device for reducing communication overhead in homomorphic encrypted federated learning, characterized in that: include: Key distribution module, model distribution module, aggregation module, decryption module and judgment module; The key distribution module is configured to generate a public key and a private key, and distribute the public key to each client; The model distribution module is configured to distribute the global model of this round to each client in each round of training; The aggregation module is configured to receive the current round scaling factor and the encrypted target gradient vector from each client, dequantize the encrypted target gradient vector using the current round scaling factor, and aggregate the dequantized target gradient vector to obtain an aggregated encrypted gradient; The decryption module is configured to decrypt the aggregated encrypted gradient using the private key to obtain the target aggregated gradient of this round, and train the global model of this round using the target aggregated gradient of this round to obtain the global model of the next round; The determination module is configured to, in response to determining that the target aggregate gradient of the current round reaches a preset gradient threshold and / or the number of training rounds reaches a preset number of iterations, complete the training; and in response to determining that the target aggregate gradient of the current round does not reach the preset gradient threshold and the number of training rounds does not reach the preset number of iterations, proceed to the next round of training.
8. A device for reducing communication overhead in homomorphic encrypted federated learning, characterized in that: include: Key receiving module, model receiving module, training module, gradient processing module and error calculation module; The key receiving module is configured to receive the public key sent by the central server; The model receiving module is configured to receive the global model of the current round sent by the central server in each round of training; The training module is configured to train the global model of this round to obtain a gradient vector of this round, and add the quantization error obtained from the previous round of training to the gradient vector of this round to obtain an effective gradient vector of this round, wherein the effective gradient vector includes multiple effective gradient components; The gradient processing module is configured to select a first number of effective gradient components from the effective gradient vector in descending order of absolute value, retain a first portion of the effective gradient components in the first number, quantize a second portion of the effective gradient components to obtain quantized gradients, and combine the retained effective gradient components and the quantized gradients to form a target gradient vector for this round; The error calculation module is configured to use the effective gradient vector to determine the scaling factor of the current round, use the scaling factor of the current round and the target gradient vector to determine the quantization error of the next round of training, and send the scaling factor of the current round and the target gradient vector encrypted by the public key to the central server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Federal learning-based data aggregation method and system, equipment and medium
CN117744134A
Federated machine learning-based model training method and apparatus
WO2024093426A1