Federated learning method, device, equipment and medium based on evolutionary computing
Through the method based on evolutionary calculation, iteratively optimizes the hyperparameters in federated learning, solving the problem of low efficiency in the existing technology, and significantly improving the performance of the federated learning model.
Patent Information
- Application Number
- CN202010567731.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-19
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-06-19
AI Technical Summary
The efficiency of determining hyperparameters in existing federated learning is low, which affects performance indicators, making it difficult to guarantee the performance of the model, and it requires manual adjustment of hyperparameters to be time-consuming and labor-intensive.
Using an evolutionary calculation-based method, the hyperparameters are optimized through iterative evolution calculations, and the sub-target model performance indicators and hyperparameter sets of multiple devices are sorted and updated, and the hyperparameters are automatically adjusted until the iteration stop condition is reached.
It significantly improves the efficiency of hyperparameter optimization in federated learning, avoids manual manual adjustments, and significantly improves the performance of federated learning models.
Smart Images

Figure CN111709534B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a federated learning method, apparatus, device and readable storage medium based on evolutionary computing. Background Art
[0002] In federated learning, complex models such as neural networks are often used. Such models have a large number of hyperparameters, such as learning rate, number of network layers, and dimension of each convolution kernel. Existing federated learning algorithms can only train neural networks based on set hyperparameters. Since fixed hyperparameters set by humans are often not optimal hyperparameters, federated learning models trained under artificially given hyperparameters often cannot achieve the best results. In order to obtain a good federated learning model, it is necessary to constantly adjust hyperparameters based on experience and re-perform federated learning. The whole process is time-consuming, labor-intensive, and costly, and the final performance indicators are difficult to guarantee.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a federated learning method, apparatus, device and readable storage medium based on evolutionary computing, aiming to solve the technical problem that the efficiency of determining hyperparameters in existing federated learning is low, which affects the performance indicators of federated learning.
[0005] To achieve the above object, the present invention provides a federated learning method based on evolutionary computing, and the federated learning method based on evolutionary computing comprises the following steps:
[0006] Determine a hyperparameter of a first group corresponding to the first device in a hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group;
[0007] Receiving performance indicators of second sub-goal models sent by multiple second devices, performing iterative evolutionary calculations based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in the second group corresponding to the second device;
[0008] The first device and the plurality of second devices determine their respective initial model parameters based on the target hyperparameters, and the first device and the plurality of second devices perform federated learning based on their respective initial model parameters to obtain a target model.
[0009] Further, the step of receiving the performance indicators of the second sub-goal models sent by the multiple second devices, and performing iterative evolutionary calculation based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models and the hyperparameter set to obtain the target hyperparameter includes:
[0010] Performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models, and the hyperparameter set to obtain an updated hyperparameter set for the first device to adjust the first group and the plurality of second devices to adjust the second group;
[0011] Iterative evolutionary calculation is performed based on the adjusted first grouping, the plurality of second groups, and the updated hyperparameter set until an iteration stop condition is detected to obtain the target hyperparameter.
[0012] Furthermore, the step of performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models and the hyper-parameter set to obtain an updated hyper-parameter set includes:
[0013] Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be retained are obtained from the sorted hyperparameters;
[0014] The hyperparameter set is updated based on the hyperparameter to be retained.
[0015] Further, the step of updating the hyperparameter set based on the hyperparameter to be retained includes:
[0016] Selecting a first hyperparameter to be converted from the hyperparameters to be retained, so as to update the value of the preset position of the hyperparameter to be converted to obtain the expanded hyperparameter; and / or,
[0017] Selecting a second hyperparameter to be converted and a third hyperparameter to be converted from the hyperparameters to be retained, and exchanging the values of the second hyperparameter to be converted and the third hyperparameter to be converted to obtain the expanded hyperparameter;
[0018] The hyperparameter set is updated based on the hyperparameter to be retained and the expanded hyperparameter.
[0019] Furthermore, the step of updating the hyperparameter set based on the hyperparameter to be retained and the expanded hyperparameter includes:
[0020] Obtaining random hyperparameters, and using the hyperparameters to be retained, the expanded hyperparameters, and the random hyperparameters as the updated hyperparameter set;
[0021] The step of determining the hyperparameters corresponding to the first group in the hyperparameter set includes:
[0022] The hyperparameters corresponding to the first group are determined in the updated hyperparameter set.
[0023] Further, the step of obtaining an updated set of hyperparameters for the first device to adjust the first group and the multiple second devices to adjust the second group includes:
[0024] Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be eliminated are obtained from the sorted hyperparameters;
[0025] The multiple devices corresponding to the to-be-eliminated hyperparameters are regrouped to update the first group and the multiple second groups.
[0026] Furthermore, the step of obtaining the target hyperparameter until the iteration stop condition is detected includes:
[0027] When it is detected that the current number of groups is equal to the preset number, the iterative evolution calculation is stopped;
[0028] Based on the performance indicator of the first sub-goal model and the performance indicators of the plurality of second sub-goal models, the target hyperparameter is determined in the current hyperparameter set.
[0029] Furthermore, before the step of determining the hyperparameters of the first group corresponding to the first device in the hyperparameter set so that the devices in the first group perform federated learning based on the hyperparameters of the first group to obtain the first sub-goal model corresponding to the first group, the step includes:
[0030] Acquire communication performance data between the first device and the plurality of second devices participating in federated learning, and determine a first group corresponding to the first device and a second group corresponding to each of the plurality of second devices based on the communication performance data.
[0031] Furthermore, the federated learning device based on evolutionary computing includes:
[0032] a federated learning module, configured to determine a hyperparameter of a first group corresponding to the first device in a hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group;
[0033] an iterative evolutionary calculation module, configured to receive performance indicators of a second sub-goal model sent by multiple second devices, and perform iterative evolutionary calculation based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in a second group corresponding to the second device;
[0034] A training module is used for the first device and multiple second devices to determine their respective initial model parameters based on the target hyperparameters, and the first device and multiple second devices perform federated learning based on their respective initial model parameters to obtain a target model.
[0035] In addition, to achieve the above-mentioned purpose, the present invention also provides a device, which includes: a memory, a processor, and a federated learning program based on evolutionary computing stored in the memory and executable on the processor, wherein the federated learning program based on evolutionary computing, when executed by the processor, implements the steps of the federated learning method based on evolutionary computing described in any one of the above items.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a readable storage medium, on which a federated learning program based on evolutionary computing is stored. When the federated learning program based on evolutionary computing is executed by a processor, the steps of the federated learning method based on evolutionary computing described in any one of the above items are implemented.
[0037] The present invention determines the hyperparameters of the first group corresponding to the first device in the hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameters of the first group, obtain the first sub-target model corresponding to the first group, and then receive the performance indicators of the second sub-target model sent by multiple second devices, perform iterative evolutionary calculation based on the performance indicators of the first sub-target model, the performance indicators of the multiple second sub-target models and the hyperparameter set, and obtain the target hyperparameters, wherein the second sub-target model is obtained by the devices in the second group corresponding to the second device through federated learning, and then the first device and the multiple second devices determine their respective initial model parameters based on the target hyperparameters, and the first device and the multiple second devices perform federated learning based on their respective initial model parameters to obtain the target model. Through evolutionary calculation, on the basis of optimizing the model parameters of federated learning, the model hyperparameters of federated learning are simultaneously optimized, thereby avoiding manual adjustment of hyperparameters, and significantly improving the performance of the federated learning model while improving the efficiency of hyperparameter optimization in federated learning. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of the structure of a device in a hardware operating environment involved in an embodiment of the present invention;
[0039] Figure 2 It is a flowchart of the first embodiment of the federated learning method based on evolutionary computing of the present invention;
[0040] Figure 3 It is a schematic diagram of the functional modules of an embodiment of a federated learning device based on evolutionary computing of the present invention.
[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0043] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a device in a hardware operating environment involved in an embodiment of the present invention.
[0044] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0045] Those skilled in the art will understand that Figure 1 The target detection system structure shown in the figure does not constitute a limitation on the device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0046] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a federated learning program based on evolutionary computing.
[0047] exist Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the user end and communicate data with the user end; and the processor 1001 can be used to call the federated learning program based on evolutionary computing stored in the memory 1005.
[0048] In this embodiment, the device includes: a memory 1005, a processor 1001, and a federated learning program based on evolutionary computing stored in the memory 1005 and executable on the processor 1001, wherein when the processor 1001 calls the federated learning program based on evolutionary computing stored in the memory 1005, the steps of the federated learning method based on evolutionary computing provided in each embodiment of the present application are executed.
[0049] The present invention also provides a federated learning method based on evolutionary computing, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the federated learning method based on evolutionary computing of the present invention.
[0050] The embodiment of the present invention provides an embodiment of a federated learning method based on evolutionary computing. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown here.
[0051] In this embodiment, the federated learning method based on evolutionary computing includes:
[0052] Step S100, determining a hyperparameter of a first group corresponding to the first device in a hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group;
[0053] In this embodiment, there are multiple federated learning participants. Assume that there are n participants. The device is represented by S. Each participant has its own local private training data, and all private training data are independent and identically distributed. All participants randomly select a small part of themselves, such as 10% of privacy-insensitive data, as a public verification data set to verify the performance of the trained federated learning model. All participants send and exchange their own public verification data sets to each other, so that each participant holds the verification data sets of all participants.
[0054] Specifically, before step S100, it includes: obtaining communication performance data between the first device and the multiple second devices participating in federated learning, and determining a first group corresponding to the first device and a second group corresponding to each of the multiple second devices based on the communication performance data.
[0055] Group all participants in federated learning, that is, determine which participants are included in each group. When grouping for the first time, group all n participants equally, assuming they are divided into k groups, with t = n / k participants in each group. The first device is any participant among all participants in federated learning, and the second device is any participant other than the first device. The basis for grouping can be that all participants communicate with each other participant multiple times, such as 3 times, and record the average communication time (network transmission time) α and network bandwidth β with each participant to obtain the network delay σ
[0056]
[0057] All participants are sorted according to the value σ from small to large, where a and b are manually set coefficients. Starting from the first participant P1, P1 selects the first t-1 participants with the smallest σ values to form a group. The next ungrouped participant selects the first t-1 ungrouped participants with the smallest σ values to form the second group. And so on, until all participants are grouped. Federated learning participants are divided into k groups with a capacity of t, where k = n / t. It should be noted that when n participants cannot be evenly distributed, the remaining participants are randomly assigned to multiple groups.
[0058] It should be noted that these hyperparameters obtained for the first time are pre-set based on historical experience. Hyperparameters are converted to vectors. Hyperparameters of neural networks include learning rate, number of network layers, and dimension of each convolution kernel. Before vector conversion, simple processing can be performed, such as taking the logarithm of the learning rate l and using the logarithm of l to indirectly store the learning rate, which facilitates vector conversion. Vector conversion uses existing technologies, such as Gray encoding, to obtain multiple hyperparameter ω vectors. The hyperparameter vector of the jth group of participants is recorded as ω j .
[0059] Specifically, the hyperparameters corresponding to the first group are determined in the hyperparameter set, the local machine learning model parameters are initialized using the hyperparameters, and federated learning is performed between the participants until the model converges. The federated learning is stopped, and the federated learning model of the first group is output, which is recorded as the first sub-target model.
[0060] It should be noted that the t participants in the first group transmit their computing performance and the amount of local training data to each other, where the computing performance can be obtained by CPU frequency and core number, computing performance = CPU frequency * core number, and the parameter μ is obtained according to the computing performance ξ and the amount of training data λ.
[0061]
[0062] The participant with the largest μ value in the first group is selected as the leading party for the federated training of the first group. In this way, the selected leading party has better computing performance and a smaller amount of training data.
[0063] Step S200, receiving performance indicators of second sub-goal models sent by multiple second devices, performing iterative evolutionary calculations based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in the second group corresponding to the second device;
[0064] Specifically, step S200 includes:
[0065] Step S210, performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models and the hyperparameter set to obtain an updated hyperparameter set for the first device to adjust the first group and the plurality of second devices to adjust the second group;
[0066] In this embodiment, multiple second groups respectively determine the dominant party of each group, using the same method as the first group to determine the dominant party, which will not be repeated here. Determine the hyperparameters corresponding to the second group in the hyperparameter set, use the hyperparameters to initialize the local machine learning model parameters of each device (participant) in the second group, and conduct federated learning between the participants until the model converges, stop federated learning, and output the federated learning model of the second group, which is recorded as the second sub-target model.
[0067] The principle of evolutionary computing is used to determine the hyperparameters to be retained in the hyperparameter set according to the performance indicators of the first sub-goal model and multiple second sub-goal models, and the hyperparameter set is optimized according to the hyperparameters to be retained to obtain an updated hyperparameter set. At the same time, the hyperparameters are screened according to the performance indicators of each sub-goal model to adjust the first grouping and multiple second groups.
[0068] Specifically, step S210 includes:
[0069] Step S211, sorting the hyperparameters in the hyperparameter set based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, and obtaining the hyperparameters to be retained from the sorted hyperparameters;
[0070] In this embodiment, the hyperparameters corresponding to each sub-goal model are sorted from best to worst according to the performance indicators of the sub-goal models, and the hyperparameters to be retained are determined according to the sorted hyperparameters. The hyperparameters to be retained include two parts. The first part: a certain number of hyperparameters with the best performance are selected from the sorted hyperparameters; the second part: a certain number of hyperparameters with better performance are randomly selected from the sorted hyperparameters. Among them, the specific number of reservations is determined according to the actual situation. For example, among the sorted hyperparameters, the 20% hyperparameters with the best performance are selected and retained, and then half of the hyperparameters with a performance ranking of 20%-60% are randomly selected and retained. In this example, the first preset number is equal to 40% of the total number of hyperparameters, and the total number of hyperparameters is equal to the number of groups, that is, 40% of the total number of hyperparameters is also 40% of the number of groups. .
[0071] Step S212: updating the hyperparameter set based on the hyperparameter to be retained.
[0072] Specifically, step S212 includes:
[0073] Step a, selecting a first hyperparameter to be converted from the hyperparameters to be retained, so as to update the value of the preset position of the hyperparameter to be converted to obtain the expanded hyperparameter; and / or,
[0074] Step b, selecting a second hyperparameter to be converted and a third hyperparameter to be converted from the hyperparameters to be retained, and exchanging the values of the second hyperparameter to be converted and the third hyperparameter to be converted to obtain the expanded hyperparameter;
[0075] Step c, updating the hyperparameter set based on the hyperparameter to be retained and the expanded hyperparameter;
[0076] In this embodiment, the crossover and mutation methods are used to generate extended hyperparameters based on the hyperparameters to be retained. Among them, the crossover of evolutionary computing is a method of generating new individuals through crossover based on two individuals. Two hyperparameters are selected from the hyperparameters to be retained, the values of the corresponding positions of the hyperparameters are randomly exchanged, and a hyperparameter obtained after the exchange of the values is output as an extended hyperparameter. The mutation of evolutionary computing is to randomly select several positions of a hyperparameter vector, randomly change the values, and generate a new hyperparameter after mutation. The second preset number is the number of extended hyperparameters, which is specified according to actual conditions, such as 40% of the total number of hyperparameters. The total number of hyperparameters is equal to the number of groups, that is, 40% of the total number of hyperparameters is also 40% of the number of groups.
[0077] Further, step c includes: obtaining random hyperparameters, and taking the hyperparameters to be retained, the expanded hyperparameters and the random hyperparameters as the updated hyperparameter set;
[0078] In this embodiment, the number of groups is calculated, and the difference between the number of groups and the first preset number corresponding to the hyperparameter to be retained and the second preset number corresponding to the expanded hyperparameter is calculated, and the difference is used as the third preset number, that is, the sum of the first preset value, the second preset value and the third preset value is equal to the number of groups. For example, the first preset value is equal to 40% of the number of groups, the second preset value is equal to 40% of the number of groups, and the third preset value is equal to 20% of the number of groups. Next, a random hyperparameter equal to the third preset number is obtained.
[0079] Furthermore, the hyperparameters to be retained are the hyperparameters with relatively good performance retained in this round of evolutionary calculations, the expanded hyperparameters are obtained by crossover and / or mutation operations based on the hyperparameters to be retained, and the random hyperparameters are pre-set based on historical experience values. The hyperparameters to be retained, the expanded hyperparameters, and the random hyperparameters are used as the hyperparameters required for each group in the new round of evolutionary calculations, that is, the hyperparameter set is updated. The updated hyperparameter set is used again for a new round of federated learning and evolutionary calculations.
[0080] Furthermore, step S210 further includes:
[0081] Step S213, sorting the hyperparameters in the hyperparameter set based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, and obtaining hyperparameters to be eliminated from the sorted hyperparameters;
[0082] Step S214: regroup the multiple devices corresponding to the hyperparameters to be eliminated to update the first group and the multiple second groups.
[0083] In this embodiment, the first device receives the performance indicators of the second sub-goal model sent by multiple second devices, and determines the hyperparameters to be eliminated in the hyperparameter set according to the performance indicators of the first sub-goal model and the performance indicators of multiple second sub-goal models. Among them, the performance indicators of the first sub-goal model are obtained by testing the first sub-goal model on the validation data set, such as accuracy, F1 score, etc. According to the performance indicators of the first sub-goal model and the multiple second sub-goal models, the hyperparameters corresponding to each sub-goal model are sorted from best to worst, wherein one performance indicator can be selected each time, or multiple performance indicators can be selected for reference. The hyperparameter corresponding to the sub-goal model with the worst performance indicator of the model is determined as the hyperparameter to be eliminated. The devices in the group corresponding to the hyperparameter to be eliminated will be randomly redistributed to other groups, so that multiple second devices adjust their corresponding second groups, and the first device adjusts the first group, and the total number of groups at this time is reduced by 1. It should be noted that the group corresponding to the hyperparameter to be eliminated may be the first group or any second group.
[0084] Step S220, performing iterative evolution calculation based on the adjusted first grouping, the plurality of second groups, and the updated hyperparameter set until an iteration stop condition is detected to obtain a target hyperparameter.
[0085] Specifically, step S220 includes:
[0086] Step S221, when it is detected that the current number of groups is equal to the preset number, the iterative evolution calculation is stopped;
[0087] Step S222: determining the target hyperparameter in the current hyperparameter set based on the performance indicator of the first sub-goal model and the performance indicators of the plurality of second sub-goal models.
[0088] In this embodiment, the hyperparameters to be retained, the expanded hyperparameters, and the random hyperparameters are used as the hyperparameters required for each group in the new round of evolutionary calculation, and step S100 is continued to be performed to perform iterative evolutionary calculation. In the process of iterative evolutionary calculation, the number of groups is reduced by 1 after each round of iteration. When it is detected that there are only 2 groups left in the current group, the iterative evolutionary calculation is stopped, that is, the preset number is equal to 2.
[0089] The performance indicators of the two sub-goal models obtained by the last two groups of federated learning are compared, and the hyperparameters corresponding to the sub-goal model with good model performance are used as the target hyperparameters.
[0090] This embodiment divides the many participants of federated learning into multiple groups, and each group performs federated learning on a model defined by a hyperparameter. The hyperparameters of different groups are different. Through the validation set test, the advantages and disadvantages of different hyperparameters are compared, and high-quality hyperparameters can be screened and retained, while new hyperparameters are randomly generated. In the process of continuous evolutionary computing iteration, different groups are gradually merged, and finally all grouped participants are merged into a large group, and the hyperparameters are eliminated by the survival of the fittest, and finally the appropriate hyperparameters are obtained.
[0091] Step S300: The first device and the plurality of second devices determine respective initial model parameters based on the target hyperparameters, and the first device and the plurality of second devices perform federated learning based on their respective initial model parameters to obtain a target model.
[0092] In this embodiment, on the basis of optimizing the model parameters of federated learning, the model hyperparameters of federated learning are simultaneously optimized through evolutionary computing, thereby determining the target hyperparameters. The first device and multiple second devices initialize the local machine learning model parameters based on the target hyperparameters. All participants jointly perform federated learning until the model converges, stop federated learning, and output the target model of federated learning.
[0093] The present invention determines the hyperparameters of the first group corresponding to the first device in the hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameters of the first group, obtain the first sub-target model corresponding to the first group, and then receive the performance indicators of the second sub-target model sent by multiple second devices, perform iterative evolutionary calculation based on the performance indicators of the first sub-target model, the performance indicators of the multiple second sub-target models and the hyperparameter set, and obtain the target hyperparameters, wherein the second sub-target model is obtained by the devices in the second group corresponding to the second device through federated learning, and then the first device and the multiple second devices determine their respective initial model parameters based on the target hyperparameters, and the first device and the multiple second devices perform federated learning based on their respective initial model parameters to obtain the target model. Through evolutionary calculation, on the basis of optimizing the model parameters of federated learning, the model hyperparameters of federated learning are simultaneously optimized, thereby avoiding manual adjustment of hyperparameters, and significantly improving the performance of the federated learning model while improving the efficiency of hyperparameter optimization in federated learning.
[0094] The present invention further provides a federated learning device based on evolutionary computing, referring to Figure 3 , Figure 3 It is a schematic diagram of the functional modules of an embodiment of a federated learning device based on evolutionary computing of the present invention.
[0095] a federated learning module 10, configured to determine a hyperparameter of a first group corresponding to the first device in a hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group;
[0096] an iterative evolutionary calculation module 20, configured to receive performance indicators of a second sub-goal model sent by a plurality of second devices, and perform iterative evolutionary calculation based on the performance indicators of the first sub-goal model, the performance indicators of the plurality of second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in a second group corresponding to the second device;
[0097] The training module 30 is used for the first device and the plurality of second devices to determine respective initial model parameters based on the target hyperparameters, and the first device and the plurality of second devices to perform federated learning based on their respective initial model parameters to obtain a target model.
[0098] Furthermore, the iterative evolution calculation module 20 is also used for:
[0099] Performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models, and the hyperparameter set to obtain an updated hyperparameter set for the first device to adjust the first group and the plurality of second devices to adjust the second group;
[0100] Iterative evolutionary calculation is performed based on the adjusted first grouping, the plurality of second groups, and the updated hyperparameter set until an iteration stop condition is detected to obtain the target hyperparameter.
[0101] Furthermore, the iterative evolution calculation module 20 is also used for:
[0102] Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be retained are obtained from the sorted hyperparameters;
[0103] The hyperparameter set is updated based on the hyperparameter to be retained.
[0104] Furthermore, the iterative evolution calculation module 20 is also used for:
[0105] Selecting a first hyperparameter to be converted from the hyperparameters to be retained, so as to update the value of the preset position of the hyperparameter to be converted to obtain the expanded hyperparameter; and / or,
[0106] Selecting a second hyperparameter to be converted and a third hyperparameter to be converted from the hyperparameters to be retained, and exchanging the values of the second hyperparameter to be converted and the third hyperparameter to be converted to obtain the expanded hyperparameter;
[0107] The hyperparameter set is updated based on the hyperparameter to be retained and the expanded hyperparameter.
[0108] Furthermore, the iterative evolution calculation module 20 is also used for:
[0109] Obtaining random hyperparameters, and using the hyperparameters to be retained, the expanded hyperparameters, and the random hyperparameters as the updated hyperparameter set;
[0110] The step of determining the hyperparameters corresponding to the first group in the hyperparameter set includes:
[0111] The hyperparameters corresponding to the first group are determined in the updated hyperparameter set.
[0112] Furthermore, the iterative evolution calculation module 20 is also used for:
[0113] Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be eliminated are obtained from the sorted hyperparameters;
[0114] The multiple devices corresponding to the to-be-eliminated hyperparameters are regrouped to update the first group and the multiple second groups.
[0115] Furthermore, the iterative evolution calculation module 20 is also used for:
[0116] When it is detected that the current number of groups is equal to the preset number, the iterative evolution calculation is stopped;
[0117] Based on the performance indicator of the first sub-goal model and the performance indicators of the plurality of second sub-goal models, the target hyperparameter is determined in the current hyperparameter set.
[0118] Furthermore, the federated learning device based on evolutionary computing also includes:
[0119] A grouping module is used to obtain communication performance data between the first device and the multiple second devices participating in federated learning, and determine a first group corresponding to the first device and a second group corresponding to each of the multiple second devices based on the communication performance data.
[0120] In addition, an embodiment of the present invention further proposes a readable storage medium, on which a federated learning program based on evolutionary computing is stored. When the federated learning program based on evolutionary computing is executed by a processor, the steps of the federated learning method based on evolutionary computing in the above-mentioned embodiments are implemented.
[0121] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0122] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a system device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0124] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A federated learning method based on evolutionary computing, characterized in that: Applied to a first device, the federated learning method includes: Determine a hyperparameter of a first group corresponding to the first device in a hyperparameter set, so that the devices in the first group perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group; Receiving performance indicators of second sub-goal models sent by multiple second devices, performing iterative evolutionary calculations based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in the second group corresponding to the second device; The first device and the plurality of second devices determine respective initial model parameters based on the target hyperparameters, and the first device and the plurality of second devices perform federated learning based on the respective initial model parameters to obtain a target model; Before the step of determining the hyperparameters of the first group corresponding to the first device in the hyperparameter set so that the devices in the first group perform federated learning based on the hyperparameters of the first group to obtain the first sub-target model corresponding to the first group, the method includes: Acquire communication performance data between the first device and the plurality of second devices participating in federated learning, and determine a first group corresponding to the first device and a second group corresponding to each of the plurality of second devices based on the communication performance data.
2. The method for federated learning based on evolutionary computing according to claim 1, characterized in that: The step of receiving the performance indicators of the second sub-goal models sent by the multiple second devices, and performing iterative evolutionary calculation based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models and the hyperparameter set to obtain the target hyperparameters includes: Performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models, and the hyperparameter set to obtain an updated hyperparameter set for the first device to adjust the first group and the plurality of second devices to adjust the second group; Iterative evolutionary calculation is performed based on the adjusted first grouping, the plurality of second groups, and the updated hyperparameter set until an iteration stop condition is detected to obtain the target hyperparameter.
3. The method for federated learning based on evolutionary computing according to claim 2, characterized in that: The step of performing evolutionary calculation based on the performance index of the first sub-goal model, the performance indexes of the plurality of second sub-goal models, and the hyper-parameter set to obtain an updated hyper-parameter set comprises: Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be retained are obtained from the sorted hyperparameters; The hyperparameter set is updated based on the hyperparameter to be retained.
4. The method for federated learning based on evolutionary computing according to claim 3, characterized in that: The step of updating the hyperparameter set based on the hyperparameter to be retained comprises: Selecting a first hyperparameter to be converted from the hyperparameters to be retained, so as to update the value of the preset position of the first hyperparameter to be converted to obtain an expanded hyperparameter; and / or, Selecting a second hyperparameter to be converted and a third hyperparameter to be converted from the hyperparameters to be retained, and exchanging the values of the second hyperparameter to be converted and the third hyperparameter to be converted to obtain the expanded hyperparameter; The hyperparameter set is updated based on the hyperparameter to be retained and the expanded hyperparameter.
5. The method for federated learning based on evolutionary computing according to claim 4, characterized in that: The step of updating the hyperparameter set based on the hyperparameter to be retained and the expanded hyperparameter includes: Obtaining random hyperparameters, and using the hyperparameters to be retained, the expanded hyperparameters, and the random hyperparameters as the updated hyperparameter set; The step of determining the hyperparameters corresponding to the first group in the hyperparameter set includes: The hyperparameters corresponding to the first group are determined in the updated hyperparameter set.
6. The method for federated learning based on evolutionary computing according to claim 2, characterized in that: The step of obtaining an updated set of hyperparameters for the first device to adjust the first group and the plurality of second devices to adjust the second group includes: Based on the performance index of the first sub-goal model and the performance indexes of the plurality of second sub-goal models, the hyperparameters in the hyperparameter set are sorted, and the hyperparameters to be eliminated are obtained from the sorted hyperparameters; The multiple devices corresponding to the to-be-eliminated hyperparameters are regrouped to update the first group and the multiple second groups.
7. The method for federated learning based on evolutionary computing according to claim 2, characterized in that: The step of obtaining the target hyperparameter until the iteration stop condition is detected comprises: When it is detected that the current number of groups is equal to the preset number, the iterative evolution calculation is stopped; Based on the performance indicator of the first sub-goal model and the performance indicators of the plurality of second sub-goal models, the target hyperparameter is determined in the current hyperparameter set.
8. A federated learning device based on evolutionary computing, characterized in that: The federated learning device based on evolutionary computing includes: a federated learning module, configured to determine a hyperparameter of a first group corresponding to a first device in a hyperparameter set, so that devices in the first group can perform federated learning based on the hyperparameter of the first group to obtain a first sub-target model corresponding to the first group; an iterative evolutionary calculation module, configured to receive performance indicators of a second sub-goal model sent by multiple second devices, and perform iterative evolutionary calculation based on the performance indicators of the first sub-goal model, the performance indicators of the multiple second sub-goal models, and the hyperparameter set to obtain target hyperparameters, wherein the second sub-goal model is obtained by performing federated learning on devices in a second group corresponding to the second device; a grouping module, configured to obtain communication performance data between the first device and the plurality of second devices participating in federated learning, and determine a first group corresponding to the first device and a second group corresponding to each of the plurality of second devices based on the communication performance data; A training module is used for the first device and multiple second devices to determine their respective initial model parameters based on the target hyperparameters, and the first device and multiple second devices perform federated learning based on their respective initial model parameters to obtain a target model.
9. A device, characterized in that: The device includes: a memory, a processor, and a federated learning program based on evolutionary computing stored in the memory and executable on the processor. When the federated learning program based on evolutionary computing is executed by the processor, the steps of the federated learning method based on evolutionary computing as described in any one of claims 1 to 7 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores the federated learning program based on evolutionary computing, and when the federated learning program based on evolutionary computing is executed by a processor, the steps of the federated learning method based on evolutionary computing as described in any one of claims 1 to 7 are implemented.
