Federated learning method and device based on differential privacy law
By adopting semi-synchronous communication and differential privacy methods in federated learning, the problems of long waiting time and waste of computing resources caused by synchronous communication are solved, and faster model convergence and higher training efficiency are achieved.
Patent Information
- Application Number
- CN202111447012.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the existing federated learning process based on differential privacy technology, synchronous communication leads to long waiting time for participating nodes and waste of computing resources, which in turn affects the convergence speed and training efficiency of the target model.
The federated learning method based on semi-synchronous communication is adopted to monitor the signal reception data, obtain the training result data of the completed signal in the stage, and train the target model based on the differential privacy method to control the faster participating nodes in the network environment for semi-synchronous model training.
Effectively avoid interference from the fallen effect, avoid waste of computing resources, improve the convergence speed of the target model, and improve training efficiency and application timeliness.
Smart Images

Figure CN114358307B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and specifically to a federated learning method and device based on differential privacy law. Background Art
[0002] Federated learning is a typical method to solve data privacy leakage in large-scale machine learning in recent years. After the server obtains the target model based on the local model training sent by each participating node, it will send the updated target model and parameters to the participating nodes. In this process, the gradient information of the model may be intercepted by malicious users and the private data of the participating nodes may be deduced. In order to prevent the leakage of gradient information and further improve the security of federated learning, differential privacy technology can be added to the federated learning process. Differential privacy protection is a privacy protection technology based on data distortion. It blurs the data by adding noise to the data, conceals sensitive data information, and makes the data impossible to restore.
[0003] At present, the federated learning process based on differential privacy technology is as follows: all participating nodes based on synchronous communication perform the same number of local training times, and then after the server receives the local models sent by all participating nodes, it introduces Gaussian noise to provide differential privacy protection for the entire federated system, thereby resisting intrusions by external attackers such as background knowledge attacks.
[0004] However, synchronous communication has obvious limitations on the resource utilization and configuration of federated learning based on differential privacy technology. Synchronous communication is used to achieve model aggregation in the federated learning process. Due to factors such as system differences between the participating nodes in synchronous communication, it is easy to be disturbed by the "straggler effect" especially in a heterogeneous network environment, which greatly affects the convergence speed of the aggregation model. Therefore, the existing federated learning process based on differential privacy technology has problems such as long waiting time for participating nodes and waste of computing resources, which in turn leads to problems such as low convergence speed and poor training efficiency of the target model in federated learning. Summary of the invention
[0005] In response to the problems in the prior art, the present application provides a federated learning method and device based on the differential privacy method, which can effectively avoid the interference of the straggler effect, avoid the waste of computing resources and improve the convergence speed of the target model while providing differential privacy protection for the federated learning process of the target model, thereby effectively improving the training efficiency and application timeliness of the target model.
[0006] In order to solve the above technical problems, this application provides the following technical solutions:
[0007] In a first aspect, the present application provides a federated learning method based on differential privacy law, including:
[0008] Based on a stage completion signal corresponding to any one of the multiple training data currently received for federated learning, start monitoring signal reception data within a target period;
[0009] If it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and the training result data of each stage.
[0010] Furthermore, the acquiring of the stage training result data corresponding to each of the stage completion signals received within the target period, and training the target model based on each of the stage training result data, includes:
[0011] Acquire the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value;
[0012] Obtaining a relative stale value of each of the local models according to the training result data of each stage of the target cycle, wherein the relative stale value is a ratio between a total step length of the corresponding local model in the target cycle and a step length difference of the target model, and the step length difference of the target model is a difference between a total step length of the target model in the target cycle and a total step length of a previous cycle;
[0013] The target model is trained based on the differential privacy method, the relative staleness value and the model update value corresponding to each of the local models.
[0014] Furthermore, before starting to monitor the signal reception data within the target period based on the stage completion signal corresponding to any one of the multiple training data currently received for the federated learning, the method further includes:
[0015] The same stage training times threshold is sent to each distributed federated learning participating node respectively, so that after each federated learning participating node has trained its local model based on local training data for a number of times that meets the stage training times threshold, it sends a corresponding stage completion signal and performs local model training again based on the stage training times threshold.
[0016] Further, the step of starting to monitor the signal reception data within the target period based on the stage completion signal corresponding to any one of the multiple training data currently received for the federated learning includes:
[0017] If a stage completion signal is received from any of the federated learning participating nodes in the distributed setting, the stage completion signal is used as the first signal of the current target period and the signal reception data within the target period is monitored;
[0018] Determine in real time whether the signal reception status data within the target cycle meets the preset semi-synchronous training rules, wherein the semi-synchronous training rules include: the total number of stage completion signals received within the target cycle has reached a total signal threshold, and / or the duration of the target cycle has reached a cycle duration threshold.
[0019] Furthermore, the acquiring of the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value, includes:
[0020] End the monitoring of the current target cycle;
[0021] Based on a preset anti-signal loss communication protocol, respectively send stage training result requests to the federated learning participating nodes that send each stage completion signal within the target period, so that each of the federated learning participating nodes that receives the stage training result request respectively sends a local model corresponding to each stage completion signal based on the anti-signal loss communication protocol;
[0022] Receive each of the local models, and obtain a model update value corresponding to each of the local models.
[0023] Furthermore, the training of the target model based on the differential privacy method, the relative stale values and the model update values corresponding to each of the local models, includes:
[0024] Obtaining the second-order norm corresponding to each of the local models;
[0025] Generating the global sensitivity corresponding to each of the local models respectively according to the relative staleness value and the second-order norm corresponding to each of the local models;
[0026] Based on the global sensitivity corresponding to each of the local models, the model update values corresponding to each of the local models are respectively clipped, and the clipped model update values are aggregated to obtain a model update aggregate value;
[0027] Based on the differential privacy method, Gaussian noise is set in the process of updating the aggregate value according to the model and training the target model with each local model, and the training of the target model is stopped when the privacy budget corresponding to the Gaussian noise is 0.
[0028] Furthermore, after training the target model based on the differential privacy method and the training result data of each stage, it also includes:
[0029] Determine whether the target model currently meets the preset convergence requirements. If not, re-receive the stage completion signal corresponding to any one of the multiple training data, and start monitoring the signal reception status data in a new round of target cycle. If it is monitored that the signal reception status data in the new round of target cycle meets the preset semi-synchronous training rules, obtain the stage training result data corresponding to each of the stage completion signals received in the new round of target cycle, and train the target model again based on the differential privacy method and each of the stage training result data.
[0030] In a second aspect, the present application provides a federated learning device based on a differential privacy method, comprising:
[0031] A signal monitoring module, configured to start monitoring signal reception data within a target period based on a stage completion signal corresponding to any one of a plurality of training data currently received for federated learning;
[0032] The semi-synchronous training module is used to obtain the stage training result data corresponding to each stage completion signal received within the target period if it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, and train the target model based on the differential privacy method and each stage training result data.
[0033] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the federated learning method based on the differential privacy method when executing the computer program.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the federated learning method based on the differential privacy method.
[0035] In a fifth aspect, the present application provides a federated learning system, including: a server and respective federated learning nodes respectively connected to the server for communication;
[0036] The server is used to execute the federated learning method based on the differential privacy method;
[0037] The federated learning nodes are used to send a corresponding stage completion signal to the server and perform local model training again based on the stage training number threshold after the number of times the local model is trained based on the local training data meets the corresponding stage training number threshold.
[0038] It can be seen from the above technical scheme that the present application provides a federated learning method based on the differential privacy method. Based on the stage completion signal corresponding to any one of the multiple training data currently received for federated learning, the method starts to monitor the signal reception status data within the target period; if it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and each of the stage training result data. By controlling some faster participating nodes in the normal current network environment to perform semi-synchronous model training, the interference of the straggler effect can be effectively avoided, the waste of computing resources of the participating nodes can be avoided, and the convergence speed of the target model can be improved, thereby effectively improving the training efficiency and application timeliness of the target model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present application 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 It is a structural diagram of the federated learning system in the embodiment of the present application.
[0041] Figure 2 This is a first flow chart of the federated learning method based on the differential privacy method in the embodiment of the present application.
[0042] Figure 3 This is a second flow chart of the federated learning method based on the differential privacy method in the embodiment of the present application.
[0043] Figure 4 This is a third flow chart of the federated learning method based on the differential privacy method in the embodiment of the present application.
[0044] Figure 5 It is a structural diagram of a federated learning device based on the differential privacy method in an embodiment of the present application.
[0045] Figure 6 This is a logical example diagram of a differential privacy federated learning framework based on semi-synchronous communication provided in the application example of this application.
[0046] Figure 7 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] Federated learning is essentially a distributed machine learning framework that meets the requirements of privacy protection, data security and supervision. Through parameter exchange under an encrypted mechanism, it achieves joint modeling and establishes a virtual shared model on the basis of ensuring data privacy, security and legal compliance, thereby improving the effect of the AI model. The working steps of federated learning can be divided into three parts: ① Model selection. The central server will pre-train a model, initialize the parameters of the model, and then distribute the parameters and model to each client participating in federated learning; ② Local model training. After the client receives the model and parameters, it can build a model and then use local data for training; ③ Model aggregation. After each client has trained locally for a certain number of times, it sends the trained model parameters to the server. After receiving the parameters of each client, the server performs certain processing (such as averaging), and then uses the processed parameters to update the server's model, and finally sends the updated global model and parameters to each client.
[0049] In the process of uploading the global model and parameters to the client, the gradient information of the model may be intercepted by malicious users and the user's private data may be inferred. In order to prevent the leakage of gradient information and further improve the security of federated learning, many existing works have added differential privacy technology to the federated learning system. Differential privacy is a new privacy definition proposed in 2006 to address the privacy leakage problem of databases. Differential privacy protection is a privacy protection technology based on data distortion. It blurs the data by adding noise to the data, conceals sensitive data information, and makes the data impossible to restore. The differential privacy protection theory reduces the risk of data leakage, is simple to operate, and is not limited by the amount of data. It mainly uses random noise to ensure that the result of querying publicly visible information does not leak the privacy information of individuals, that is, it provides a method to maximize the accuracy of data queries when querying from statistical databases, while minimizing the chance of identifying their records. In simple terms, it is to remove individual features while retaining statistical features to protect user privacy.
[0050] The basic principle of differential privacy is: when a user (or a potential attacker) submits a query request to a data provider, if the data provider directly publishes accurate query results, it may lead to privacy leakage, because the user may infer private information through the query results. In order to avoid this problem, the differential privacy system requires a middleware to be extracted from the database, and a specially designed random algorithm is used to inject an appropriate amount of noise into the middleware to obtain a noisy middleware; then the noisy middleware is used to derive a noisy query result and return it to the user. In this way, even if the attacker can infer the noisy middleware from the noisy result, he cannot accurately infer the noiseless middleware, let alone reason about the original database, thereby achieving the purpose of protecting privacy.
[0051] The core idea of differential privacy is that for two data sets that differ by one record, the probability of obtaining the same result when querying them is determined by the privacy budget (that is, the degree of privacy protection measured by the user). When the privacy budget is smaller, the probability distribution of the query results returned by the differential privacy algorithm acting on a pair of adjacent data sets is more similar, and the more difficult it is for the attacker to distinguish the pair of adjacent data sets, and the higher the degree of protection. When the privacy budget is 0, the attacker cannot distinguish the pair of adjacent data sets, which means the highest degree of protection.
[0052] Compared with the traditional federated learning system, the differential privacy federated learning system mainly modifies the above ③ model aggregation. The modified steps are: after each client has trained locally for a certain number of times, it sends the trained model parameters and gradient update values to the server. After the server receives the gradient update values from each client, it first performs gradient clipping, using the second-order norm to limit the median value of all user gradient update values; then aggregates the clipped gradient update values (such as averaging or weighted aggregation); then the server adds noise to the aggregated model to provide differential privacy protection. Finally, the updated model and parameters are sent to each client.
[0053] In the above-mentioned model aggregation part ③, a synchronous communication method is adopted: after all clients train locally for the same number of times (the specific number of training times is determined by the server), they uniformly send the trained model parameters to the server.
[0054] The differential privacy federated learning system provides differential privacy protection for the entire federated system by introducing Gaussian noise, thereby resisting intrusions from external attackers such as background knowledge attacks. However, existing experiments have shown that the accuracy and convergence speed of the entire federated model will be significantly reduced after adding Gaussian noise. In addition, traditional federated learning is based on synchronous communication, and all participants perform the same number of local training times. However, due to heterogeneous external network settings such as hardware devices, network connections, and device power, the characteristics of the federated system are significantly different. The differences in the system lead to significant differences in the time it takes to perform model training operations and upload models to the server between different participants. Under realistic conditions, the heterogeneous network environment amplifies the "straggler effect": faster participants have to wait for slower participants (due to network instability and the possibility that participants may exit at any time, the slowest participants may never upload local model parameters). Faster participants (usually participants with abundant computing resources and network resources) do not train models during the waiting period, which results in a huge waste of computing resources. Synchronous communication has significant restrictions on the resource utilization and configuration of federated learning. Due to the existence of privacy budget, it has even stronger restrictions on differential privacy federated learning. Therefore, the current federated learning system uses synchronous communication to achieve model aggregation, which is easily disturbed by the "straggler effect" in a heterogeneous network environment and greatly affects the convergence speed of the aggregated model. Therefore, how to speed up the convergence speed of the federated model while providing differential privacy protection, and how to provide protection methods that meet the needs of the scenario under the premise of the essential contradiction between privacy protection and data availability, minimize the risk of user privacy leakage in machine learning, and improve the training efficiency and reliability of the federated model will be a long-term challenge.
[0055] Based on this, the present application considers adopting a new method for determining semi-synchronous time nodes to realize semi-synchronous communication between each participating node, and then performs at least one stage of semi-synchronous training on the model through this semi-synchronous communication method. By controlling some faster participating nodes in the normal current network environment to perform semi-synchronous model training, it can effectively avoid the interference of the straggler effect, avoid the waste of computing resources and improve the convergence speed of the target model, thereby effectively improving the training efficiency and application timeliness of the target model.
[0056] Based on the above content, the present application also provides a federated learning device based on the differential privacy method for implementing the federated learning method based on the differential privacy method provided in one or more embodiments of the present application. The federated learning device based on the differential privacy method can be a server, see Figure 1, the federated learning device based on the differential privacy method can communicate and connect with each client device in sequence by itself or through a third-party server, etc. These client devices are respectively federated learning participating nodes, and these federated learning participating nodes and the federated learning device based on the differential privacy method constitute a federated learning system. The federated learning device based on the differential privacy method can receive a stage completion signal issued by the client device after the number of times each client device trains a local model based on local training data meets the stage training number threshold, and then start monitoring the signal reception status data within the target period based on the stage completion signal corresponding to any one of the multiple training data currently received for federated learning; if it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, then obtain the stage training result data corresponding to each of the stage completion signals received within the target period, and train the target model based on the differential privacy method and each of the stage training result data. Then, the federated learning device based on the differential privacy method can also determine whether the target model currently meets the preset convergence requirements. If not, the stage completion signal corresponding to any one of the multiple training data is re-received, and the signal reception status data in the new round of target cycle is started to be monitored. If it is monitored that the signal reception status data in the new round of target cycle meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received in the new round of target cycle is obtained, and the target model is trained again based on the differential privacy method and each of the stage training result data until the target model currently meets the preset convergence requirements, the training is terminated, and the final training models are sent to users for practical application.
[0057] It can be understood that the target model can be a machine learning model used for data prediction, recognition or classification, for example, it can be a deep neural network model for face recognition, so that the federated learning method based on the differential privacy law can effectively avoid the interference of the straggler effect and the waste of computing resources while providing differential privacy protection for the federated learning process of the target model, thereby effectively improving the training efficiency of the deep neural network model and the timeliness of the application of face recognition.
[0058] The aforementioned federated learning device based on differential privacy method performs part of federated learning based on differential privacy method can be executed in a server as described above, and in another practical application scenario, all operations can also be completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application is not limited to this. If all operations are completed in the client device, the client device may also include a processor for specific processing of federated learning based on differential privacy method.
[0059] It is understandable that the client device may include any mobile device capable of loading applications, such as a smart phone, a tablet electronic device, a network set-top box, a portable computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.
[0060] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.
[0061] The server and the client device may communicate with each other using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP, UDP / IP, HTTP, HTTPS, etc. Of course, the network protocols may also include, for example, RPC (Remote Procedure Call Protocol) and REST (Representational State Transfer) protocols used on top of the above protocols.
[0062] The details are described in detail through the following embodiments and application examples.
[0063] In order to solve the problems of long waiting time of participating nodes and waste of computing resources in the existing federated learning process based on differential privacy technology, which leads to low convergence speed of the target model in federated learning and poor training efficiency, this application provides an embodiment of a federated learning method based on differential privacy method, see Figure 2The federated learning method based on the differential privacy method executed by the federated learning device based on the differential privacy method specifically includes the following contents:
[0064] Step 100: Based on a stage completion signal corresponding to any one of a plurality of training data currently received for federated learning, start monitoring signal reception data within a target period.
[0065] In step 100, after the number of times each federated learning participating node in the federated learning system has trained its local model based on local training data meets the threshold of the number of stage training times, the node sends a corresponding stage completion signal to the federated learning device based on the differential privacy method. When the federated learning device based on the differential privacy method receives the first stage completion signal, the federated learning device based on the differential privacy method starts to generate a new target period for signal monitoring, and starts to monitor the signal reception data within the newly established target period.
[0066] It can be understood that the signal reception data refers to: the source and total number of completion signals of each stage received by the federated learning device based on the differential privacy method after the monitoring starts. The duration of the target cycle can also be recorded to facilitate the subsequent determination of whether the preset semi-synchronous training rules are met.
[0067] Step 200: If it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and the training result data of each stage.
[0068] It is understandable that the semi-synchronous training rule refers to the semi-synchronous communication rule between the various federated learning participating nodes for federated learning, that is, only the stage training result data of some federated learning participating nodes need to be used to start the stage training of the target model. In this way, some faster participating nodes with normal current network environment can first perform semi-synchronous model training, avoiding the waste of computing resources and improving the convergence speed of the target model.
[0069] It can be understood that the training result data of the said stage refers to the local model and related data obtained by the federated learning participating nodes using the model parameters sent in advance by the federated learning device based on the differential privacy method and their local training data. The local models corresponding to each of these federated learning participating nodes are used for the final clustering by the federated learning device based on the differential privacy method to generate the target model. Therefore, compared with these local models, the target model can be called a global model.
[0070] From the above description, it can be seen that the federated learning method based on the differential privacy method provided in the embodiment of the present application obtains the stage training result data corresponding to each of the stage completion signals received within the target period when it is monitored that the stage completion signal reception data within the target period meets the preset semi-synchronous training rules, and trains the target model based on the preset differential privacy method and each of the stage training result data. Semi-synchronous model training is performed through some faster participating nodes in the current normal network environment. Under the premise of providing differential privacy protection for the federated learning process of the target model, it can effectively avoid the interference of the straggler effect, avoid the waste of computing resources, and improve the convergence speed of the target model, thereby effectively improving the training efficiency and application timeliness of the target model.
[0071] In addition, because each participant trains locally for different times, there is a certain difference between the local model generated by each node and the ideal model. For example, in an extreme case, node A may only train locally once while node B trains locally for E max In this way, the local models trained by nodes A and B will inevitably deviate from the ideal model.
[0072] In other words, in order to resist model inference attacks, model extraction attacks, backdoor attacks, etc., and to improve differential privacy protection for the federated learning system, directly adding a noise perturbation algorithm to the aggregation model will seriously reduce the accuracy of the federated aggregation model, causing the final aggregation model to be in an unusable state, making the federated system unbalanced in data availability and privacy protection, and limiting the large-scale use of differential privacy federated learning systems in enterprises.
[0073] Based on this, after solving the existing problems in the federated learning process based on differential privacy technology, such as long waiting time for participating nodes and waste of computing resources, which in turn lead to low convergence speed and poor training efficiency of the target model in federated learning, in order to solve the existing problems that each participating node has different local training times, resulting in large differences in local model training effects and thus poor accuracy of the target model, this application also proposes a new concept: relative staleness. By using relative staleness to limit global sensitivity, the scope of gradient clipping can be more accurately limited, ensuring that the entire federated learning system generates a high-precision federated aggregation model while providing differential privacy protection.
[0074] In view of the above content, in order to solve the problems in the prior art that the number of local training times of each participating node is different, resulting in large differences in local model training effects and thus poor accuracy of the target model, an embodiment of a federated learning method based on differential privacy method is provided in this application, see Figure 3, step 200 of the federated learning method based on differential privacy law specifically includes the following contents:
[0075] Step 210: Obtain the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value.
[0076] Step 220: Obtain a relative stale value of each local model according to the training result data of each stage of the target cycle, wherein the relative stale value is the ratio of the total step length of the corresponding local model in the target cycle to the step length difference of the target model, and the step length difference of the target model is the difference between the total step length of the target model in the target cycle and the total step length of the previous cycle.
[0077] Specifically, this application proposes a relative stale value RS i To characterize this part of the difference.
[0078] Right now is the total step length of the target model in round t;
[0079] Right now is the total step length of the target model in round t+1;
[0080] Right now is the total step length of client i in round t+1;
[0081] So we have:
[0082]
[0083] Step 230: Train the target model based on the differential privacy method, the relative staleness value and the model update value corresponding to each of the local models.
[0084] From the above description, it can be seen that the federated learning method based on the differential privacy method provided in the embodiment of the present application can solve the problems existing in the prior art that the number of local training of each participating node is different, resulting in large differences in local model training effects and thus poor accuracy of the target model, by using relative staleness to limit global sensitivity. This can more accurately limit the scope of gradient clipping and ensure that the entire federated learning system generates a high-precision federated aggregation model under the premise of providing differential privacy protection. This can further improve the training efficiency and application timeliness of the target model, and further improve the training accuracy, application accuracy and effectiveness of the target model.
[0085] In order to further solve the problem that the number of local training times of each participating node is different, resulting in large differences in local model training effects, an embodiment of the federated learning method based on differential privacy law provided in this application is shown in FIG. Figure 4 , the step 100 of the federated learning method based on differential privacy law also specifically includes the following contents:
[0086] Step 010: Send the same stage training times threshold to each distributed federated learning participating node, so that after each federated learning participating node has trained its local model based on local training data for a number of times that meets the stage training times threshold, it sends a corresponding stage completion signal and performs local model training again based on the stage training times threshold.
[0087] In step 010, the number of stage training times is specified in advance to solve the problem of large differences in local model training effects caused by different local training times for each participating node.
[0088] In the present application, step 010 and steps 210-230 can be either a one-or-the-other solution or can be executed together. The specific selection can be based on the actual communication situation and network environment. For example, if the current network environment cannot guarantee that step 010 can successfully send the same stage training number threshold to each distributed federated learning participating node, then there will still be federated learning participating nodes that have not received the updated same stage training number threshold, but use their own pre-stored or customized stage training number threshold to perform stage training. Therefore, in order to ensure the training accuracy, application accuracy and effectiveness of the target model, steps 210-230 need to be executed.
[0089] In order to improve the reliability and effectiveness of the signal reception data within the monitoring target period, in an embodiment of a federated learning method based on a differential privacy method provided in the present application, step 100 of the federated learning method based on a differential privacy method specifically includes the following contents:
[0090] Step 110: If a stage completion signal is received from any one of the distributed federated learning participating nodes, the stage completion signal is used as the first signal of the current target period and the signal reception data within the target period is monitored.
[0091] Step 120: Determine in real time whether the signal reception status data within the target period meets the preset semi-synchronous training rules, wherein the semi-synchronous training rules include: the total number of the stage completion signals received within the target period has reached the total number of signals threshold, and / or the duration of the target period has reached the period duration threshold.
[0092] Specifically, all participants train locally for a base number of times (for example, the base number is set to five rounds). Participants who have completed training send a completion signal to the central administrator to indicate that they have completed the base number of times, and then continue training locally. After receiving the first completion signal, the central administrator starts the timer (the specific set time is related to the average completion speed of the nodes in the actual federal system). The central administrator continues to receive completion signals from each participant until the number of completion signals reaches the target value or the timer reaches the timing time (that is, the maximum tolerance time). After that, the central administrator stops receiving subsequent completion signals that may exist, and sends participation signals to the participating nodes that have previously sent completion signals (indicating that they are allowed to participate in the federal aggregation process this round), waiting for them to upload their respective local models.
[0093] In order to improve the reliability and effectiveness of obtaining the stage training result data of each of the stage completion signals received within the target period, in an embodiment of the federated learning method based on the differential privacy method provided in the present application, step 210 of the federated learning method based on the differential privacy method specifically includes the following contents:
[0094] Step 211: End monitoring of the current target cycle;
[0095] Step 212: Based on a preset signal loss prevention communication protocol, respectively send a stage training result request to each of the federated learning participating nodes that sends each of the stage completion signals within the target period, so that each of the federated learning participating nodes that receives the stage training result request respectively sends a local model corresponding to each of the stage completion signals based on the signal loss prevention communication protocol;
[0096] It is understandable that the signal loss prevention communication protocol may adopt TCP / IP protocol, etc. In order to provide delivery guarantee (eg, retransmission after transmission signal loss) and sequence guarantee, it is recommended to use TCP / IP protocol to perform the above communication process.
[0097] Step 213: Receive each of the local models, and obtain the model update value corresponding to each of the local models.
[0098] In order to further improve the accuracy of the differential privacy training model, in an embodiment of a federated learning method based on the differential privacy method provided in this application, step 230 of the federated learning method based on the differential privacy method specifically includes the following contents:
[0099] Step 231: Obtain the second-order norm corresponding to each of the local models.
[0100] Step 232: Generate the global sensitivity corresponding to each of the local models according to the relative staleness value and the second-order norm corresponding to each of the local models.
[0101] Step 233: The model update values corresponding to the local models are respectively clipped based on the global sensitivities corresponding to the local models, and the clipped model update values are aggregated to obtain a model update aggregate value.
[0102] Step 234: Based on the differential privacy method, Gaussian noise is set in the process of updating the aggregate value according to the model and training the target model with each of the local models, and the training of the target model is stopped when the privacy budget corresponding to the Gaussian noise is 0.
[0103] For all selected participants, i.e., each client, first calculate their respective model update values and the second-order norm δ i Because the model update matrix is too large, this application uses clipping technology to reduce the update value range of the model with global sensitivity S, so as to ensure the update value of the model The application uses the relative staleness value to determine the global sensitivity of each round, and sets:
[0104]
[0105] This is determined by the relative age of the nodes participating in each round, which can ensure that the global sensitivity S is neither too large nor too small, and achieve more accurate control of the range of gradient clipping. The aggregated model update value Δw t+1 for:
[0106]
[0107] where p i =RS i ·η, represents the contribution of node i, Z t represents the set of nodes selected in round t, δ i Represents the second-order norm of the updated value of the model at node i, represents the model update value of the i-th node, Δw t+1 Represents the updated value of the model after aggregation.
[0108] Finally, Gaussian noise is added to the aggregated federated model to provide differential privacy protection. The privacy upper limit is set to Q. Each time Gaussian noise is added, a certain amount of privacy budget will be consumed. When the privacy budget is consumed, the entire federated system needs to stop the aggregation and noise addition process.
[0109]
[0110] Where m t represents the number of nodes participating in round t, N(0, S 2 σ 2 ) represents Gaussian noise, S is the global sensitivity, σ 2 is the variance of Gaussian noise.
[0111] In addition, due to the privacy budget limitation in the differential privacy method, each round of federated aggregation needs to consume a certain degree of privacy budget. When the privacy budget is consumed to 0, the training process has to stop to maintain differential privacy protection. In other words, due to the limitation of the privacy budget, the training of the federated learning system is usually terminated in advance before the federated model converges, which seriously affects the final accuracy of the model.
[0112] In other words, in order to resist model inference attacks, model extraction attacks, backdoor attacks, etc., and to improve differential privacy protection for the federated learning system, directly adding a noise perturbation algorithm to the aggregation model will seriously reduce the accuracy of the federated aggregation model, causing the final aggregation model to be in an unusable state, making the federated system unbalanced in data availability and privacy protection, and limiting the large-scale use of differential privacy federated learning systems in enterprises.
[0113] Based on this, after solving the problems existing in the prior art of the federated learning process based on differential privacy technology, such as long waiting time for participating nodes and waste of computing resources, which in turn leads to low convergence speed and poor training efficiency of the target model in federated learning, in order to further solve the problems existing in the prior art that the training of the federated learning system has been terminated in advance before the federated model has converged, thereby seriously affecting the final accuracy of the model, in an embodiment of a federated learning method based on differential privacy provided in the present application, the step 200 of the federated learning method based on differential privacy also specifically includes the following content:
[0114] Step 300: Determine whether the target model currently meets the preset convergence requirement;
[0115] If not, return to execute steps 100 and 200, that is; re-receive the stage completion signal corresponding to any one of the multiple training data, and start monitoring the signal reception status data in a new round of target period. If it is monitored that the signal reception status data in the new round of target period meets the preset semi-synchronous training rules, then obtain the stage training result data corresponding to each of the stage completion signals received in the new round of target period, and train the target model again based on the differential privacy method and each of the stage training result data.
[0116] If yes, the training is terminated and the final training model is sent to the user for practical application.
[0117] Based on the above content, the present application also provides a federated learning device based on the differential privacy method for implementing the federated learning method based on the differential privacy method provided in one or more embodiments of the present application. The specific implementation of the federated learning device based on the differential privacy method can be a client. In a specific example, see Figure 5 , the federated learning device based on differential privacy law specifically includes the following contents:
[0118] A signal monitoring module 10, configured to start monitoring signal reception data within a target period based on a stage completion signal corresponding to any one of a plurality of training data currently received for performing federated learning;
[0119] The semi-synchronous training module 20 is used to obtain the stage training result data corresponding to each of the stage completion signals received within the target period if it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, and train the target model based on the differential privacy method and each of the stage training result data.
[0120] The embodiment of the federated learning device based on the differential privacy method provided in the present application can be specifically used to execute the processing flow of the embodiment of the federated learning method based on the differential privacy method in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the above-mentioned embodiment of the federated learning method based on the differential privacy method.
[0121] From the above description, it can be seen that the federated learning device based on the differential privacy method provided in the embodiment of the present application obtains the stage training result data corresponding to each of the stage completion signals received within the target period when it is monitored that the stage completion signal reception data within the target period meets the preset semi-synchronous training rules, and trains the target model based on the preset differential privacy method and each of the stage training result data. By controlling some faster participating nodes in the normal current network environment to perform semi-synchronous model training, it can effectively avoid the interference of the straggler effect, avoid the waste of computing resources, and improve the convergence speed of the target model, thereby effectively improving the training efficiency and application timeliness of the target model.
[0122] In order to further illustrate this solution, this application also provides a differential privacy federated learning framework based on semi-synchronous communication. The purpose of the application example of this application is to propose a differential privacy federated learning framework based on semi-synchronous communication on the basis of the existing federated learning system. By proposing a new method for determining semi-synchronous time nodes to realize a federated learning system based on semi-synchronous communication, by proposing a fair hierarchical weighted random customer selection algorithm to elect suitable customers to participate in federated aggregation, and using relative staleness to limit global sensitivity to more accurately limit the scope of gradient clipping, it is ensured that the entire federated learning system generates a high-precision federated aggregation model while providing differential privacy protection.
[0123] The application example relies on the traditional horizontal federated learning architecture and deep neural network framework (such as pytorch, tensorflow) for model training, aggregates the federated model by weighting the relative staleness value, and then adds appropriate Gaussian noise to the aggregated model to provide differential privacy protection, thus forming a differential privacy federated learning system.
[0124] First is the semi-synchronous communication part. The application example of this application proposes a new method for determining semi-synchronous time nodes and a new concept of "relative staleness value" for subsequent federated weighted aggregation and Gaussian noise addition.
[0125] See also Figure 6 , the application example of this application proposes a new method for determining the semi-synchronous time node to realize a federated learning system based on semi-synchronous communication. It is understood that previous studies on semi-synchronous communication of federated learning have ignored or avoided the determination of the semi-synchronous time point of the federated node. The application example of this application proposes a new method to determine it. All participants train the base value number of times locally (for example, the base value is set to five rounds), and the participants who have completed the training send a completion signal to the central administrator to indicate that the base value number of times has been completed, and then continue to train locally. After receiving the first completion signal, the central administrator starts the timer (the specific set time is related to the average completion speed of the nodes in the actual federated system). The central administrator continues to receive completion signals from each participant until the number of completion signals reaches the target value or the timer reaches the timing time (that is, the maximum tolerance time). After that, the central administrator stops receiving subsequent completion signals that may exist, and sends participation signals to the participating nodes that have previously sent completion signals (representing that they are allowed to participate in the federated aggregation process this round), waiting for them to upload their respective local models. In order to provide delivery guarantees (for example, retransmission can be performed after the transmission signal is lost) and order guarantees, the application example of this application recommends using the TCP / IP protocol to perform the above communication process.
[0126] Because each participant trains locally for different times, there is a certain difference between the local model generated by each node and the ideal model. For example, in extreme cases, node A may only train locally once while node B trains E locally. max In this way, the local models trained by nodes A and B will inevitably deviate from the ideal model.
[0127] This application proposes a relative staleness value RS i To characterize this part of the difference.
[0128] Right now is the total step length of the target model in round t;
[0129] Right now is the total step length of the target model in round t+1;
[0130] Right now is the total step length of client i in round t+1;
[0131] So we have:
[0132]
[0133] Then comes the aggregation process of the central server.
[0134] For all selected participants, i.e., each client, first calculate their respective model update values and the second-order norm δ i Because the model update matrix is too large, this application uses clipping technology to reduce the update value range of the model with global sensitivity S, so as to ensure the update value of the model The application uses the relative staleness value to determine the global sensitivity of each round, and sets:
[0135]
[0136] This is determined by the relative age of the nodes participating in each round, which can ensure that the global sensitivity S is neither too large nor too small, and achieve more accurate control of the range of gradient clipping. The aggregated model update value Δw t+1 for:
[0137]
[0138] where p i =RS i ·η, represents the contribution of node i, Z t represents the set of nodes selected in round t, δ i Represents the second-order norm of the updated value of the model at node i, represents the model update value of the i-th node, Δw t+1 Represents the updated value of the model after aggregation.
[0139] Finally, Gaussian noise is added to the aggregated federated model to provide differential privacy protection. The privacy upper limit is set to Q. Each time Gaussian noise is added, a certain amount of privacy budget will be consumed. When the privacy budget is consumed, the entire federated system needs to stop the aggregation and noise addition process.
[0140]
[0141] Where m t represents the number of nodes participating in round t, N(0, S 2 σ 2 ) represents Gaussian noise, S is the global sensitivity, σ 2 is the variance of Gaussian noise.
[0142] In order to realize the differential privacy federated learning framework based on semi-synchronous communication, accelerate the convergence speed of the federated model while meeting the requirements of data availability and privacy protection, thereby improving the final accuracy of the federated model, the application example of this application proposes the following improvements:
[0143] 1. A new method for determining semi-synchronous time nodes is proposed to realize a federated learning system based on semi-synchronous communication. After determining the semi-synchronous time nodes, the federated system can realize semi-synchronous communication: that is, some nodes with rich computing resources are allowed to perform more training locally, while nodes with poor computing resources only need to complete the basic number of training. At the same time, the relative staleness value is used to characterize the gap between these nodes, so that the relative staleness value can be used for weighted aggregation in the subsequent federated aggregation process to control the proportion of node contribution value.
[0144] 2. A new method for determining global sensitivity is proposed, which uses the relative staleness of the participating nodes in each round to weight the global sensitivity of this round, so as to ensure that the model update value is limited to the range of global sensitivity. It ensures that the global sensitivity S is neither too large nor too small, and achieves more precise control of the range of gradient clipping.
[0145] 3. An efficient federated aggregation and noise perturbation method is proposed. First, the Gaussian mechanism is used to scale the sum of the model update values of all nodes, and then the contribution of each node is used to weight the aggregate model update value. This can approximate the true average value of all user updates while preventing the leakage of relevant personal information. Then Gaussian noise is added to the aggregated model, and the variance of the Gaussian noise is controlled by the global average value, so as to more accurately control the noise size of each round.
[0146] Based on this, the application example of this application proposes a new method for determining semi-synchronous time nodes. Compared with the synchronous communication method, semi-synchronous communication can make full use of the idle computing resources of high-computing power nodes, so that each node is always in an efficient computing state, fundamentally improving resource utilization, empowering the aggregation process of federated learning, accelerating the convergence speed of the aggregation model, and improving the robustness of the federated system. At the same time, the application example of this application proposes a new method for determining global sensitivity, which determines the global sensitivity by the relative staleness of each round, so as to more accurately control the scope of each round of gradient clipping and improve the effect of federated aggregation. Because of the improvement in the convergence speed of the model and the enhancement of the effect of model aggregation, the accuracy that the model can ultimately achieve has been greatly improved in a limited number of communication rounds (limited by the privacy budget), which significantly improves the training ability of the model.
[0147] From a hardware perspective, the present application provides an embodiment of an electronic device for implementing all or part of the content of the federated learning method or model training method based on the differential privacy method, and the electronic device specifically includes the following content:
[0148] Figure 7 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Figure 7 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Figure 7 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0149] In one embodiment, the federated learning function based on differential privacy can be integrated into the central processing unit. The central processing unit can be configured to perform the following control:
[0150] Step 100: Based on a stage completion signal corresponding to any one of a plurality of training data currently received for federated learning, start monitoring signal reception data within a target period.
[0151] Step 200: If it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and the training result data of each stage.
[0152] From the above description, it can be seen that the electronic device provided in the embodiment of the present application can be a central server. When it is monitored that the reception status data of the stage completion signal within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the preset differential privacy method and each of the stage training result data. By controlling some faster participating nodes in the normal current network environment to perform semi-synchronous model training, the interference of the straggler effect can be effectively avoided, the waste of computing resources can be avoided, and the convergence speed of the target model can be improved, thereby effectively improving the training efficiency and application timeliness of the target model.
[0153] In another embodiment, the federated learning or model training device based on the differential privacy method can be configured separately from the central processing unit 9100. For example, the federated learning or model training device based on the differential privacy method can be configured as a chip connected to the central processing unit 9100, and the federated learning or model training function based on the differential privacy method can be realized through the control of the central processing unit.
[0154] like Figure 7 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Figure 7 In addition, the electronic device 9600 may also include Figure 7 For components not shown, reference may be made to the prior art.
[0155] like Figure 7 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0156] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0157] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0158] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0159] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0160] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0161] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0162] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps in the federated learning method or model training method based on the differential privacy method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the federated learning method or model training method based on the differential privacy method in the above embodiments is implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0163] Step 100: Based on a stage completion signal corresponding to any one of a plurality of training data currently received for federated learning, start monitoring signal reception data within a target period.
[0164] Step 200: If it is monitored that the signal reception status data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and the training result data of each stage.
[0165] From the above description, it can be seen that the computer-readable storage medium provided in the embodiment of the present application obtains the stage training result data corresponding to each of the stage completion signals received within the target period when it is monitored that the stage completion signal reception data within the target period meets the preset semi-synchronous training rules, and trains the target model based on the preset differential privacy method and each of the stage training result data. By controlling some faster participating nodes in the normal current network environment to perform semi-synchronous model training, it can effectively avoid the interference of the straggler effect, avoid the waste of computing resources, and improve the convergence speed of the target model, thereby effectively improving the training efficiency and application timeliness of the target model.
[0166] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0167] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0168] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0170] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A federated learning method based on differential privacy, characterized in that: include: Based on a stage completion signal corresponding to any one of the multiple training data currently received for federated learning, start monitoring signal reception data within a target period; If it is monitored that the signal reception data within the target period meets the preset semi-synchronous training rules, the stage training result data corresponding to each of the stage completion signals received within the target period is obtained, and the target model is trained based on the differential privacy method and each of the stage training result data, wherein the semi-synchronous training rules include: the total number of the stage completion signals received within the target period has reached the total number of signals threshold, and / or the duration of the target period has reached the period duration threshold; The step of acquiring the stage training result data corresponding to each of the stage completion signals received within the target period, and training the target model based on each of the stage training result data, includes: Acquire the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value; Obtaining a relative stale value of each of the local models according to the training result data of each stage of the target cycle, wherein the relative stale value is a ratio between a total step length of the corresponding local model in the target cycle and a step length difference of the target model, and the step length difference of the target model is a difference between a total step length of the target model in the target cycle and a total step length of a previous cycle; Training the target model based on a differential privacy method, a relative stale value and a model update value corresponding to each of the local models; The training of the target model based on the differential privacy method, the relative stale values and the model update values corresponding to each of the local models, includes: Obtaining the second-order norm corresponding to each of the local models; Generating the global sensitivity corresponding to each of the local models respectively according to the relative staleness value and the second-order norm corresponding to each of the local models; Based on the global sensitivity corresponding to each of the local models, the model update values corresponding to each of the local models are respectively clipped, and the clipped model update values are aggregated to obtain a model update aggregate value; Based on the differential privacy method, Gaussian noise is set in the process of updating the aggregate value according to the model and training the target model with each local model, and the training of the target model is stopped when the privacy budget corresponding to the Gaussian noise is 0.
2. The federated learning method based on differential privacy method according to claim 1, characterized in that: Before starting to monitor the signal reception data within the target period based on the stage completion signal corresponding to any one of the multiple training data currently received for federated learning, the method further includes: The same stage training times threshold is sent to each distributed federated learning participating node respectively, so that after each federated learning participating node has trained its local model based on local training data for a number of times that meets the stage training times threshold, it sends a corresponding stage completion signal and performs local model training again based on the stage training times threshold.
3. The federated learning method based on differential privacy method according to claim 1, characterized in that: The step of starting to monitor the signal reception data within the target period based on the stage completion signal corresponding to any one of the multiple training data currently received for the federated learning includes: If a stage completion signal is received from any of the federated learning participating nodes in the distributed setting, the stage completion signal is used as the first signal of the current target period and the signal reception data within the target period is monitored; It is determined in real time whether the signal reception data within the target period meets the preset semi-synchronous training rules.
4. The federated learning method based on differential privacy method according to claim 1, characterized in that: The obtaining of the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value, including: End the monitoring of the current target cycle; Based on a preset anti-signal loss communication protocol, respectively send stage training result requests to the federated learning participating nodes that send each stage completion signal within the target period, so that each of the federated learning participating nodes that receives the stage training result request respectively sends a local model corresponding to each stage completion signal based on the anti-signal loss communication protocol; Receive each of the local models, and obtain a model update value corresponding to each of the local models.
5. The federated learning method based on differential privacy method according to any one of claims 1 to 4, characterized in that: After training the target model based on the differential privacy method and the training result data of each stage, it also includes: Determine whether the target model currently meets the preset convergence requirements. If not, re-receive the stage completion signal corresponding to any one of the multiple training data, and start monitoring the signal reception status data in a new round of target cycle. If it is monitored that the signal reception status data in the new round of target cycle meets the preset semi-synchronous training rules, obtain the stage training result data corresponding to each of the stage completion signals received in the new round of target cycle, and train the target model again based on the differential privacy method and each of the stage training result data.
6. A federated learning device based on differential privacy method, characterized in that: include: A signal monitoring module, configured to start monitoring signal reception data within a target period based on a stage completion signal corresponding to any one of a plurality of training data currently received for federated learning; A semi-synchronous training module, for obtaining the stage training result data corresponding to each of the stage completion signals received within the target period if it is monitored that the signal reception data within the target period meets the preset semi-synchronous training rules, and training the target model based on the differential privacy method and each of the stage training result data, wherein the semi-synchronous training rules include: the total number of the stage completion signals received within the target period has reached a total signal threshold, and / or the duration of the target period has reached a period duration threshold; The step of acquiring the stage training result data corresponding to each of the stage completion signals received within the target period, and training the target model based on each of the stage training result data, includes: Acquire the stage training result data of each of the stage completion signals received within the target period, wherein the stage training result data includes a local model and a model update value; Obtaining a relative stale value of each of the local models according to the training result data of each stage of the target cycle, wherein the relative stale value is a ratio between a total step length of the corresponding local model in the target cycle and a step length difference of the target model, and the step length difference of the target model is a difference between a total step length of the target model in the target cycle and a total step length of a previous cycle; Training the target model based on a differential privacy method, a relative stale value and a model update value corresponding to each of the local models; The training of the target model based on the differential privacy method, the relative stale values and the model update values corresponding to each of the local models, includes: Obtaining the second-order norm corresponding to each of the local models; Generating the global sensitivity corresponding to each of the local models respectively according to the relative staleness value and the second-order norm corresponding to each of the local models; Based on the global sensitivity corresponding to each of the local models, the model update values corresponding to each of the local models are respectively clipped, and the clipped model update values are aggregated to obtain a model update aggregate value; Based on the differential privacy method, Gaussian noise is set in the process of updating the aggregate value according to the model and training the target model with each local model, and the training of the target model is stopped when the privacy budget corresponding to the Gaussian noise is 0.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the federated learning method based on the differential privacy method described in any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the federated learning method based on the differential privacy method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and system for jointly updating service model
CN112799708A
Method, device and system for jointly updating model
CN113377797A