Secure and adaptive federated learning method, electronic device and storage medium

By conducting deviation evaluation and dynamic screening of node update data in federated learning, the problems of Byzantine node attacks and model training speed are solved, and the security and efficiency of the model are improved.

CN118427825BActive Publication Date: 2024-10-18BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410890398.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-18
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

In the model training scenario of federated learning, forged update data and backdoor implantation of Byzantine nodes threaten model security. Existing detection methods have large errors when the differences are small and cannot guarantee the correct number of nodes, and the central node lacks a trusted data set. This leads to incorrect model training results.

Method used

By evaluating the deviation degree of the updated data of participating training nodes, exponential moving average standard deviation and cosine distance are used to dynamically screen nodes participating in gradient aggregation, and the number of nodes is adjusted to ensure model safety and speed.

Benefits of technology

Effectively defend against Byzantine attacks, improve model training speed, and ensure the security and efficiency of the model parameter aggregation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118427825B_ABST
    Figure CN118427825B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a secure and adaptive federated learning method, electronic device and storage medium, and relates to the field of federated learning technology. The method includes: determining a client node set; obtaining an update gradient obtained by local training of each client node in the client node set based on the model parameters issued; calculating the number of client nodes in the client node set and the lower limit of the number of trusted nodes based on the weighted coefficient by weighted summation to obtain the number to be selected; calculating the angle corresponding to the cosine distance between each update gradient and the global model median aggregate gradient, selecting the number of client nodes to be selected with the smallest angle and putting them into the first set; using the average value of the update gradients of the client nodes in the first set as the global model aggregate gradient, and updating the global model in combination with the model parameters. The implementation method provided by the present invention can not only effectively defend against Byzantine attacks, but also maximize the model training speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a secure and adaptive federated learning method, an electronic device and a corresponding storage medium. Background Art

[0002] At present, with the rapid development of artificial intelligence technology, the application of artificial intelligence technology is becoming more and more extensive. It has been applied to many fields such as image analysis, speech recognition, text processing, intelligent recommendation, security detection, etc. Federated learning and large model technology have become the forefront of artificial intelligence technology. In the model training scenario based on federated learning, the nodes participating in the training can disrupt the model training process by forging updated data, or implant backdoors into the model, which seriously threatens the security of the model.

[0003] Although there are some methods for detecting Byzantine nodes in the prior art, such as using the k-means clustering algorithm to distinguish malicious Byzantine nodes, when the difference between Byzantine nodes and normal nodes is small, the clustering result error is large, and it cannot be guaranteed that the number of nodes in the cluster is exactly within the normal node number range. Or, for example, using a trusted data set to verify the node's update data to identify Byzantine nodes, but in most cases, the central node does not have a trusted data set. Trusted data sets cannot guarantee an unbiased sampling of the sample space, which will mislead the model training results. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a secure and adaptive federated learning method, electronic device and storage medium, which evaluates the deviation of the updated data of the nodes participating in the training and dynamically screens the range of nodes participating in the gradient aggregation according to the statistical distribution of the updated data, so as to at least solve some of the problems in the background technology.

[0005] In order to achieve the above-mentioned purpose, the present invention provides a secure and adaptive federated learning method, which includes: determining a client node set, the client node set including several client nodes; obtaining an update gradient obtained by local training of each client node in the client node set based on the issued model parameters; determining a weighting coefficient according to the standard deviation of all update gradients obtained in this round and the exponential moving average standard deviation of the update gradients in the previous round, and calculating the number of candidates by weighted summation of the number of client nodes in the client node set and the lower limit of the number of trusted nodes based on the weighting coefficient; calculating the angle corresponding to the cosine distance between each update gradient and the median aggregate gradient of the global model, and selecting the candidate number of client nodes with the smallest angle and putting them into the first set; taking the average value of the update gradients of the client nodes in the first set as the global model aggregate gradient, and updating the global model in combination with the model parameters.

[0006] Optionally, the method includes a model initialization step; the model initialization step includes: setting initialization parameters and setting counting variables.

[0007] Optionally, determining the client node set includes: randomly selecting a number of client nodes from the client nodes of the federated learning system to form the client node set.

[0008] Optionally, the exponential moving average standard deviation of each round is calculated by the following steps: determining a weighting coefficient using a constant coefficient, calculating a weighted sum of the variance of this round and the exponential moving average variance of the previous round; and taking the arithmetic square root of the weighted sum as the exponential moving average standard deviation of this round.

[0009] Optionally, the lower limit of the number of trusted nodes is an estimated value, and the range of the estimated value is constrained by the number of client nodes in the client node set.

[0010] Optionally, the weighting coefficient is determined based on the standard deviation of all updated gradients obtained in this round and the exponential moving average standard deviation of the updated gradients in the previous round, including: calculating the ratio of the standard deviation of all updated gradients obtained in this round to the exponential moving average standard deviation of the updated gradients in the previous round; when the ratio is greater than 1, assigning the ratio to 1; using the ratio as the weighting coefficient for the lower limit of the number of trusted nodes, and using 1 minus the ratio as the weighting coefficient for the number of client nodes in the client node set.

[0011] Optionally, if the weighted sum of the number of client nodes in the client node set and the lower limit of the number of trusted nodes is not an integer, the number to be selected is obtained by rounding down.

[0012] Optionally, the global model median aggregate gradient is obtained by the following steps: determining the median of each dimension from all acquired update gradients by dimension; and combining the medians of all dimensions into the global model median aggregate gradient.

[0013] Optionally, the angle corresponding to the cosine distance between each updated gradient and the median aggregate gradient of the global model is calculated, including: for each updated gradient, the cosine distance between the updated gradient and the median aggregate gradient of the global model is calculated, and then the inverse cosine function is used to map the cosine distance to the corresponding angle.

[0014] Optionally, the method is configured to be executed in a loop when the following preset conditions are met; the preset conditions include: after updating the global model in combination with the model parameters, determining that the current state of the federated learning system does not meet the training stop condition of the federated learning.

[0015] The present invention also provides a secure and adaptive federated learning device, which includes: a node selection module, which is used to determine a client node set, wherein the client node set includes several client nodes; a gradient acquisition module, which is used to obtain the update gradient of each client node in the client node set after local training based on the issued model parameters; a quantity determination module, which is used to determine the weighting coefficient according to the standard deviation of all update gradients obtained in this round and the exponential moving average standard deviation of the update gradient in the previous round, and calculate the number of client nodes in the client node set and the lower limit of the number of trusted nodes based on the weighting coefficient through weighted summation to obtain the number of candidates; a set determination module, which is used to calculate the angle corresponding to the cosine distance between each update gradient and the median aggregate gradient of the global model, and select the number of candidates with the smallest angle into the first set; and a parameter aggregation module, which is used to use the average value of the update gradients of the client nodes in the first set as the global model aggregate gradient, and update the global model in combination with the model parameters.

[0016] The present invention also provides an electronic device, comprising: at least one processor; a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the aforementioned secure adaptive federated learning method by executing the instructions stored in the memory.

[0017] The present invention also provides a machine-readable storage medium on which instructions are stored. When the instructions are executed by a processor, the processor is configured to execute the aforementioned secure adaptive federated learning method.

[0018] The present invention also provides a computer program product, including a computer program, which implements the aforementioned secure adaptive federated learning method when executed by a processor.

[0019] The above technical solution has the following beneficial effects:

[0020] According to the statistical distribution of the updated gradients of each client node, especially the deviation evaluation, the number of nodes participating in the global model parameter aggregation process is dynamically adjusted, which can not only effectively defend against Byzantine attacks, but also maximize the model training speed.

[0021] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0023] Figure 1 A schematic diagram of the steps of a secure and adaptive federated learning method according to an embodiment of the present invention is shown;

[0024] Figure 2 A schematic diagram of the implementation process of a secure and adaptive federated learning method according to an embodiment of the present invention is shown;

[0025] Figure 3 A schematic diagram of the structure of a secure and adaptive federated learning device according to an embodiment of the present invention is shown;

[0026] Figure 4 The figure schematically shows the internal structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0028] Figure 1 The following schematically shows the steps of a secure adaptive federated learning method according to an embodiment of the present invention. Figure 1 As shown, a secure and adaptive federated learning method includes:

[0029] S01. Determine a client node set, where the client node set includes a number of client nodes;

[0030] S02, obtaining an update gradient of each client node in the client node set after local training based on the sent model parameters;

[0031] S03, determining a weighting coefficient according to the standard deviation of all updated gradients obtained in this round and the exponential moving average standard deviation of the updated gradients in the previous round, and calculating the number of client nodes in the client node set and the lower limit of the number of trusted nodes based on the weighting coefficient by weighted summation to obtain the number to be selected;

[0032] S04, calculating the angle corresponding to the cosine distance between each updated gradient and the median aggregate gradient of the global model, and selecting the number of client nodes to be selected with the smallest angle and putting them into the first set;

[0033] S05. Taking the average value of the updated gradients of the client nodes in the first set as the global model aggregation gradient, and updating the global model in combination with the model parameters.

[0034] Through the above implementation method, by evaluating the deviation of the node update data participating in the training and dynamically screening the range of nodes participating in gradient aggregation according to the statistical distribution of the update data, it is possible to effectively defend against Byzantine node attacks and ensure that the model converges at a faster speed.

[0035] In some embodiments of the present application, the method includes a model initialization step; the model initialization step includes: setting initialization parameters and setting count variables. If the federated learning system is in a state before the first round of training, it may be necessary to initialize the model of the federated learning system. In the federated learning system, assuming that the federated learning server node is S, the server node can also become a parameter server in the federated learning system. All federated learning client nodes constitute a set , the total number of all federated learning client nodes is The specific steps of model initialization are: the parameter server S initializes the parameters of the adopted deep neural network model, and the initialization parameters are ,in , is the total number of parameter dimensions of the global model. Set the count variable ,initialization However, it should be noted that the model initialization is not necessary. For example, after the federated learning system starts the second round of training and later rounds, the aforementioned secure adaptive federated learning method can be applied, but it is no longer necessary to perform the initialization before the secure adaptive federated learning method.

[0036] In some embodiments of the present application, determining the client node set includes: randomly selecting a number of client nodes from the client nodes of the federated learning system to form the client node set. When the round model parameters are issued, the server node S Randomly select from client nodes Client nodes, 0< ≤ , the selected federated learning client node is , where i is the client node number, 0< ≤ . The parameters of the global model of the convolutional neural network model Sent to the selected federated learning client node, starting the Round of local model training and model parameter update. , and are all positive integers. For example, in When the round model parameters are issued, the server node S Randomly select from client nodes The selected federated learning client nodes are . The parameters of the global model of the convolutional neural network model Sent to the selected federated learning client node, starting the Round of local model training and model parameter update.

[0037] In some embodiments of the present application, in step S02, obtaining the update gradient of each client node in the client node set after local training based on the sent model parameters includes: During the local model training, each Use all sample data stored locally as training data sets, use the stochastic gradient descent algorithm to train the local model, and calculate the update gradient of the local model In the During the local model training, each Update the gradient of the local model Sent to server node S. Server node S thus obtains the aforementioned update gradient , its subscript i and Client Node The subscript of corresponds to r is the number of training rounds.

[0038] In some embodiments of the present application, the standard deviation of all updated gradients obtained in this round in step S03 may be calculated by the following steps:

[0039] First calculate the average value of all updated gradients obtained in this round:

[0040]

[0041] in, For all The standard deviation is further calculated based on the mean, including:

[0042]

[0043] in, is the standard deviation.

[0044] In some embodiments of the present application, the exponential moving average standard deviation of each round is calculated by the following steps: determining a weighting coefficient with a constant coefficient, calculating a weighted sum of the variance of the current round and the exponential moving average variance of the previous round; and taking the arithmetic square root of the weighted sum as the exponential moving average standard deviation of the current round. Specifically,

[0045]

[0046] in, is the exponential moving average standard deviation, subscript r and r -1 is the number of training rounds; , is a constant coefficient. In the first round of parameter training, there is no exponential moving average variance in the previous round. At this time, the exponential moving average standard deviation of this round is replaced by the standard deviation of this round, that is: .

[0047] In some embodiments of the present application, the weighting coefficient is determined according to the standard deviation of all updated gradients obtained in this round and the exponential moving average standard deviation of the updated gradients in the previous round, including: calculating the ratio of the standard deviation of all updated gradients obtained in this round to the exponential moving average standard deviation of the updated gradients in the previous round; when the ratio is greater than 1, assigning the ratio to 1; using the ratio as the weighting coefficient of the lower limit of the number of trusted nodes, and using 1 minus the ratio as the weighting coefficient of the number of client nodes in the client node set. In some embodiments, if the standard deviation of this round is not greater than the exponential moving average standard deviation of the previous round, the ratio of the standard deviation of this round to the exponential moving average standard deviation of the previous round is used as the weighting coefficient, and the number to be selected is the weighted sum of the number of client nodes in the client node set and the lower limit of the number of trusted nodes based on their respective weighting coefficients. If the standard deviation of this round is greater than the exponential moving average standard deviation of the previous round, the ratio will be greater than 1, and the ratio needs to be assigned to 1 at this time, thereby calculating: the weighting coefficient of the lower limit of the number of trusted nodes is 1, that is, itself, and the weighting coefficient of the number of client nodes in the client node set is 0.

[0048] The number of candidates obtained based on the above weighted coefficient determination method It can be expressed by the following formula:

[0049]

[0050] in, is the number of candidates to be selected, is the lower limit of the number of trusted nodes, is the number of client nodes in the client node set. Its selection criteria are and If the weighted sum of the number of client nodes in the client node set and the lower limit of the number of trusted nodes is not an integer, the number to be selected is obtained by rounding down, where is the floor operator.

[0051] In some embodiments of the present application, the lower limit of the number of trusted nodes is an estimated value, preferably estimated by experts or estimated by some indicators in the federated learning system. The range of the estimated value is constrained by the number of client nodes in the client node set, for example .

[0052] In some embodiments of the present application, the global model median aggregate gradient is obtained by the following steps: determining the median of each dimension from all updated gradients obtained by dimension; specifically:

[0053]

[0054] in, for The j-th dimension component of , For The function of the median.

[0055] The median values ​​of all dimensions are combined into the global model median aggregate gradient, that is, according to all Get J-dimensional , which is the aggregate gradient in the global model.

[0056] In some embodiments of the present application, calculating the angle corresponding to the cosine distance between each updated gradient and the median aggregate gradient of the global model includes:

[0057] For each updated gradient, the cosine distance between the updated gradient and the global model median aggregate gradient is calculated, and then the inverse cosine function is used to map the cosine distance to the corresponding angle. Specifically:

[0058] Cosine distance = ;

[0059] in, For client nodes In the r The updated gradient of the round, is the aggregated gradient of the global model median; further mapping the cosine distance to an angle, we have:

[0060]

[0061] That is, the cosine distance is mapped to the corresponding angle through the inverse cosine function, so that the parameter server S obtains the median aggregate gradient of the global model and each client node Deviation Angle , and then based on each The client nodes are selected to a first set, that is, a set of client nodes that participate in the global model aggregate gradient calculation.

[0062] In some implementations of the present application, in step S05, the average value of the update gradients of the client nodes in the first set is used as the global model aggregate gradient, including:

[0063]

[0064] in, For the first set mentioned above, For the first set The number of client nodes in Aggregate gradients for the global model.

[0065] In some embodiments of the present application, the method is configured to execute in a loop when the following preset conditions are met; the preset conditions include: after updating the global model in combination with the model parameters, it is determined that the current state of the federated learning system does not meet the training stop condition of the federated learning. The termination condition judgment in this step is used to judge the following logic: execute in a loop when the following preset conditions are met; the preset conditions include: after updating the global model with the updated parameters, it is determined that the current state of the federated learning system does not meet the training stop condition of the federated learning. The training stop condition includes: the parameters of the global model Convergence or If the parameters of the global model Convergence or , then terminate the training process, otherwise The value of is increased by 1, and steps S01 to S02 are repeated to start the next round of model parameter delivery, local model training and model parameter update. is the preset training cycle threshold constant, is a positive integer greater than 1.

[0066] Through the above implementation method, the number of nodes participating in the global model parameter aggregation process is dynamically adjusted by evaluating the deviation of the updated data of the nodes participating in the training, which can not only effectively defend against Byzantine attacks, but also maximize the model training speed.

[0067] Figure 2 The following is a schematic diagram showing the implementation process of a secure and adaptive federated learning method according to an embodiment of the present invention. Figure 2 As shown, it includes the following implementation steps: the parameter server initializes the model parameters. The parameter server randomly selects the client node and sends the model parameters. The client node trains the local model based on the local sample and uploads the update gradient of the local model. The parameter server performs statistical evaluation and deviation evaluation on all local model update gradients, selects some update gradients to aggregate and generate global model parameters. The parameter server determines the training termination condition and ends when the training termination condition is met. If the training termination condition is not met, it jumps to the step where the parameter server randomly selects the client node and sends the model parameters to perform the next round of model training and parameter aggregation.

[0068] It can be seen from this embodiment that this embodiment mainly selects trusted nodes to participate in the aggregation process of global model parameters based on the angle of deviation from the median calculated through statistical evaluation and deviation evaluation, thereby achieving safe adaptation.

[0069] Based on the same inventive concept, the present invention also provides a secure and adaptive federated learning device. Figure 3 The schematic diagram of the structure of a secure and adaptive federated learning device according to an embodiment of the present invention is shown. Figure 3 As shown, the device includes: a node selection module, which is used to determine a client node set, and the client node set includes several client nodes; a gradient acquisition module, which is used to obtain the update gradient of each client node in the client node set after local training based on the sent model parameters; a quantity determination module, which is used to determine the weighting coefficient according to the standard deviation of all update gradients obtained in this round and the exponential moving average standard deviation of the update gradient in the previous round, and the number of client nodes in the client node set and the lower limit of the number of trusted nodes are calculated by weighted sum based on the weighting coefficient to obtain the number to be selected; a set determination module, which is used to calculate the angle corresponding to the cosine distance between each update gradient and the median aggregate gradient of the global model, and select the number of client nodes to be selected with the smallest angle and put them into the first set; and a parameter aggregation module, which is used to use the average value of the update gradients of the client nodes in the first set as the global model aggregate gradient, and update the global model in combination with the model parameters.

[0070] In some optional implementations of the present application, the method includes a model initialization step; the model initialization step includes: setting initialization parameters and setting counting variables.

[0071] In some optional implementations of the present application, determining the client node set includes: randomly selecting a number of client nodes from the client nodes of the federated learning system to form the client node set.

[0072] In some optional embodiments of the present application, the exponential moving average standard deviation of each round is calculated by the following steps: determining a weighting coefficient using a constant coefficient, calculating a weighted sum of the variance of this round and the exponential moving average variance of the previous round; and taking the arithmetic square root of the weighted sum as the exponential moving average standard deviation of this round.

[0073] In some optional implementations of the present application, the lower limit of the number of trusted nodes is an estimated value, and the range of the estimated value is constrained by the number of client nodes in the client node set.

[0074] In some optional embodiments of the present application, the weighting coefficient is determined based on the standard deviation of all updated gradients obtained in this round and the exponential moving average standard deviation of the updated gradients in the previous round, including: calculating the ratio of the standard deviation of all updated gradients obtained in this round to the exponential moving average standard deviation of the updated gradients in the previous round; when the ratio is greater than 1, assigning the ratio to 1; using the ratio as the weighting coefficient for the lower limit of the number of trusted nodes, and using 1 minus the ratio as the weighting coefficient for the number of client nodes in the client node set.

[0075] In some optional implementations of the present application, if the weighted sum of the number of client nodes in the client node set and the lower limit of the number of trusted nodes is not an integer, the number to be selected is obtained by rounding down.

[0076] In some optional embodiments of the present application, the global model median aggregate gradient is obtained by the following steps: determining the median of each dimension from all updated gradients obtained by dimension; and combining the medians of all dimensions into the global model median aggregate gradient.

[0077] In some optional embodiments of the present application, the angle corresponding to the cosine distance between each updated gradient and the median aggregate gradient of the global model is calculated, including: for each updated gradient, calculating the cosine distance between the updated gradient and the median aggregate gradient of the global model, and then using the inverse cosine function to map the cosine distance to the corresponding angle.

[0078] In some optional embodiments of the present application, the method is configured to be executed in a loop when the following preset conditions are met; the preset conditions include: after updating the global model in combination with the model parameters, determining that the current state of the federated learning system does not meet the training stop condition of the federated learning.

[0079] The specific definition of each functional module in the above-mentioned secure adaptive federated learning device can be found in the definition of the secure adaptive federated learning method above, which will not be repeated here. Each module in the above-mentioned system can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory in the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. It also realizes the dynamic adjustment of the number of nodes participating in the global model parameter aggregation process, which can effectively defend against Byzantine attacks and maximize the advantages of model training speed.

[0080] In some embodiments of the present invention, an electronic device is provided, comprising: at least one processor; a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor executes the aforementioned secure adaptive federated learning method. Its internal structure diagram can be as follows Figure 4 shown. Figure 4 The internal structure diagram of an electronic device according to an embodiment of the present invention is schematically shown. The electronic device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected via a system bus. Among them, the processor A01 of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The network interface A02 of the electronic device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a secure and adaptive federated learning method is implemented.

[0081] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0082] In one embodiment of the present invention, a machine-readable storage medium is provided, on which instructions are stored. When the instructions are executed by a processor, the processor is configured to execute the aforementioned secure adaptive federated learning method.

[0083] In one embodiment of the present invention, a computer program product is provided, including a computer program, which implements the aforementioned secure adaptive federated learning method when executed by a processor.

[0084] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt 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 codes.

[0085] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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.

[0086] 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 comprising 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.

[0087] 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. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0088] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0089] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0090] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic 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. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0091] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0092] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A secure and adaptive federated learning method, characterized in that: The method includes: Determining a client node set includes: randomly selecting a number of client nodes from the client nodes of the federated learning system to form the client node set; the client node set includes the number of client nodes; Obtaining an update gradient obtained by each client node in the client node set based on the sent model parameters after local training; The weighting coefficient is determined according to the standard deviation of all update gradients obtained in this round and the exponential moving average standard deviation of the update gradients in the previous round, and the exponential moving average standard deviation of each round is calculated by the following steps: the weighting coefficient is determined by a constant coefficient, and the weighted sum of the variance of this round and the exponential moving average variance of the previous round is calculated; the arithmetic square root of the weighted sum is used as the exponential moving average standard deviation of this round; the number of client nodes in the client node set and the lower limit of the number of trusted nodes are calculated based on the weighting coefficient by weighted summation to obtain the number to be selected, including: calculating the ratio of the standard deviation of all update gradients obtained in this round to the exponential moving average standard deviation of the update gradients in the previous round; when the ratio is greater than 1, assigning the ratio to 1; using the ratio as the weighting coefficient of the lower limit of the number of trusted nodes, and using 1 minus the ratio as the weighting coefficient of the number of client nodes in the client node set; Calculate the angle between each updated gradient and the cosine distance between the global model median aggregate gradient, and select the number of candidate client nodes with the smallest angle and put them into the first set; The average value of the updated gradients of the client nodes in the first set is used as the global model aggregate gradient, and the global model is updated in combination with the model parameters.

2. The method according to claim 1, characterized in that The method comprises a model initialization step; the model initialization step comprises: setting initialization parameters and setting counting variables.

3. The method according to claim 1, characterized in that The lower limit of the number of trusted nodes is an estimated value, and the range of the estimated value is constrained by the number of client nodes in the client node set.

4. The method according to claim 1, characterized in that If the weighted sum of the number of client nodes in the client node set and the lower limit of the number of trusted nodes is not an integer, the number to be selected is obtained by rounding down the weighted sum.

5. The method according to claim 1, characterized in that The aggregate gradient in the global model is obtained by the following steps: Determine the median value of each dimension from all updated gradients obtained by dimension; The medians of all dimensions are combined into the global model median aggregate gradient.

6. The method according to claim 1, characterized in that Calculate the angle between each updated gradient and the cosine distance of the aggregated gradient in the global model, including: For each updated gradient, the cosine distance between the updated gradient and the aggregated gradient in the global model is calculated, and then the inverse cosine function is used to map the cosine distance to the corresponding angle.

7. The method according to claim 1, characterized in that The method is configured to be executed cyclically when the following preset conditions are met; The preset condition includes: after updating the global model in combination with the model parameters, determining that the current state of the federated learning system does not meet the training stop condition of the federated learning.

8. An electronic device, characterized in that: include: at least one processor; a memory connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the steps of the secure adaptive federated learning method described in any one of claims 1 to 7 by executing the instructions stored in the memory.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the secure adaptive federated learning method described in any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the secure adaptive federated learning method described in any one of claims 1 to 7 are implemented.