A federated learning method and device, terminal and server

By constructing multi-objective optimization parameters and dynamically adjusting the number of terminal training iterations, the problem of imbalance between training efficiency and convergence gain caused by heterogeneous terminal systems and data in federated learning is solved, and more efficient model convergence is achieved.

CN116415694BActive Publication Date: 2026-02-06CHINA MOBILE COMM LTD RES INST +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111662439.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2026-02-06
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In existing federated learning schemes, due to the heterogeneity of terminal systems and data, it is difficult to balance training time efficiency with global convergence gain of the terminal, which affects the convergence speed and efficiency of the model.

Method used

By constructing multi-objective optimization parameters, including training idle time and convergence contribution sum, the number of training iterations of the terminal is dynamically adjusted to minimize idle time and maximize convergence contribution sum, thereby achieving a balance between training time efficiency and global convergence gain of the terminal.

Benefits of technology

This improves the training time efficiency and terminal global convergence gain of federated learning, ensuring that the model reaches the optimal convergence state in the shortest possible time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116415694B_ABST
    Figure CN116415694B_ABST
Patent Text Reader

Abstract

The application discloses a federated learning processing method and device, a terminal and a server, relates to the technical field of computer processing, and aims to solve the problem that the existing scheme is difficult to achieve balance between training efficiency and convergence gain. The method comprises the following steps: obtaining training information of N terminals in the tth round of joint training, wherein the training information comprises training data set information, training time information and convergence contribution value; determining multi-objective optimization parameters according to the training data set information, the training time information and the convergence contribution value, wherein the multi-objective optimization parameters comprise training idle time and convergence contribution sum; determining the target training iteration number of each terminal in the N terminals by taking the minimization of the training idle time as the first optimization target and the maximization of the convergence contribution sum as the second optimization target; and sending the target training iteration number of each terminal to the N terminals respectively. The embodiment of the application can achieve balance between improving the training time efficiency of federated learning and improving the global convergence gain of the terminal.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer processing, and particularly relates to a federated learning processing method and device, a terminal and a server. BACKGROUND

[0002] The working principle of federated learning is as shown in Figure 1 , that is, the cloud center server first distributes a model to each terminal participating in federated learning, each terminal trains the model, and sends the trained model to the cloud center server, and the cloud center server is responsible for aggregating these models.

[0003] In the existing federated learning method, it is usually assumed that each terminal performs the same training round, and the training round does not change during the training process. However, on the one hand, due to the terminal system heterogeneity problem, the computing power and communication ability of each terminal are inconsistent, and when the training rounds of each terminal are the same, it is easy to cause the generation of lagging terminals, thereby affecting the convergence speed of the federated learning model; on the other hand, due to the terminal data heterogeneity problem, the convergence directions of the local models of each terminal are inconsistent, thereby causing the global convergence gain of each terminal to be inconsistent.

[0004] It can be seen that, in the existing federated learning scheme, due to the influence of terminal system heterogeneity and data heterogeneity, there is a contradiction between the training time efficiency of federated learning and the global convergence gain of the terminal, and it is difficult to balance between the two targets. SUMMARY

[0005] Embodiments of the present application provide a federated learning processing method and device, a terminal and a server to solve the problem that the existing federated learning scheme is difficult to balance between the training time efficiency and the global convergence gain of the terminal.

[0006] In a first aspect, embodiments of the present application provide a federated learning processing method, executed by a server, comprising:

[0007] obtaining training information of N terminals in the tthround of joint training, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to the training loss change value, N is an integer greater than 1, and t is a positive integer;

[0008] determining multi-objective optimization parameters according to the training data set information, the training time information and the convergence contribution value, the multi-objective optimization parameters including training idle time and convergence contribution sum;

[0009] determining a target training iteration number of each terminal in the N terminals, taking minimizing the training idle time as a first optimization target, and taking maximizing the convergence contribution sum as a second optimization target;

[0010] The N terminals are respectively sent a respective target training iteration number for use by the N terminals in a (t+1)th round of joint training.

[0011] Optionally, the determining the multi-objective optimization parameter according to the training dataset information, the training time information and the convergence contribution value comprises:

[0012] An initial training iteration number is determined according to the training dataset information;

[0013] A training time consumption of each of the N terminals is calculated according to the training time information and a current training iteration number, wherein the current training iteration number is the initial training iteration number at initial calculation;

[0014] A longest training time consumption and a shortest training time consumption are determined according to the training time consumption of each of the N terminals;

[0015] A difference between the longest training time consumption and the shortest training time consumption is determined as the training idle time.

[0016] Optionally, the training time information comprises an iteration calculation time and a communication time;

[0017] The training time consumption of the first terminal is equal to a sum of a first product and a communication time of the first terminal, the first product is equal to a product of an iteration calculation time of the first terminal and the current training iteration number, and the first terminal is any terminal of the N terminals.

[0018] Optionally, the determining the multi-objective optimization parameter according to the training dataset information, the training time information and the convergence contribution value comprises:

[0019] An initial training iteration number is determined according to the training dataset information;

[0020] A convergence contribution sum of the N terminals is calculated according to the convergence contribution value and a current training iteration number, wherein the current training iteration number is the initial training iteration number at initial calculation.

[0021] Optionally, the convergence contribution sum is equal to a sum of products of the convergence contribution value of each of the N terminals and the current training iteration number.

[0022] Optionally, the initial training iteration number is a maximum allowable initial training iteration number.

[0023] Before the taking the minimization of the training idle time as a first optimization objective and the maximization of the convergence contribution sum as a second optimization objective, the method further comprises:

[0024] determine a maximum convergence contribution sum according to the convergence contribution sum of the N terminals obtained in the initial calculation;

[0025] wherein the second optimization objective is that the convergence contribution sum is equal to the maximum convergence contribution sum.

[0026] Optionally, the first optimization objective is that the training slack time is equal to 0.

[0027] Optionally, the determination of the target training iteration number of each terminal in the N terminals according to the first optimization objective of minimizing the training slack time and the second optimization objective of maximizing the convergence contribution sum comprises:

[0028] constructing a multi-objective optimization function according to the training slack time, the convergence contribution sum, a maximum training slack time and a maximum convergence contribution sum, wherein the maximum convergence contribution sum is determined according to a maximum allowable training iteration number and the convergence contribution value sum, and the maximum training slack time is determined according to the maximum allowable training iteration number and the training time information;

[0029] calculating an optimization objective value of the multi-objective optimization function, and determining the target training iteration number of each terminal in the N terminals according to the optimization objective of minimizing the optimization objective value.

[0030] Optionally, the multi-objective optimization function is a weighted distance function of the training slack time and the convergence contribution sum.

[0031] Optionally, the calculation of the optimization objective value of the multi-objective optimization function and the optimization objective of minimizing the optimization objective value comprises:

[0032] calculating an optimization objective value L2 of the multi-objective optimization function;

[0033] in the case that the optimization objective value L2 does not satisfy the minimization condition, reducing the training iteration number of a target terminal, the target terminal being a terminal with the longest current training time consumption in the N terminals, the current training time consumption being calculated according to a current training iteration number;

[0034] obtaining an updated training slack time and a convergence contribution sum;

[0035] re-calculating the optimization objective value L2 of the multi-objective optimization function according to the updated training slack time and the convergence contribution sum;

[0036] judging whether the re-calculated optimization objective value L2 satisfies the minimization condition;

[0037] In the case that the re-calculated optimization target value L2 does not satisfy the minimization condition, the method comprises repeating the steps of reducing the training iteration number of the target terminal until the optimization target value L2 satisfies the minimization condition.

[0038] In the case that the optimization target value L2 satisfies the minimization condition, the current training iteration number of each terminal in the N terminals is outputted.

[0039] Optionally, the reducing the training iteration number of the target terminal in the case that the optimization target value does not satisfy the minimization condition comprises:

[0040] The optimization target value L2 is assigned to a first optimization target value L2' and a maximum optimization target value L 2max ;

[0041] In the case that the current training idle time T idle does not reach a minimum value, and the current first optimization target value L2' is less than or equal to the current maximum optimization target value L 2max , the current first optimization target value L2' is assigned to the current maximum optimization target value L 2max .

[0042] According to the current training iteration number, the target terminal with the longest current training time consumption among the N terminals is determined.

[0043] The training iteration number of the target terminal is reduced by 1.

[0044] After the re-calculating the optimization target value L2 of the multi-target optimization function, and before the judging whether the re-calculated optimization target value L2 satisfies the minimization condition, the method further comprises:

[0045] The re-calculated optimization target value L2 is assigned to a first optimization target value L2'.

[0046] The outputting the current training iteration number of each terminal in the N terminals in the case that the optimization target value L2 satisfies the minimization condition comprises:

[0047] In the case that the current training idle time T idle reaches a minimum value, or the current first optimization target value L2' is greater than the current maximum optimization target value L 2max , the current training iteration number of each terminal in the N terminals is outputted.

[0048] Optionally, the convergence contribution value is determined based on the following manner:

[0049] obtain a first average loss value of the first terminal in the tth round of joint training, the first terminal being any one of the N terminals;

[0050] obtain a second average loss value of the first terminal in the (t-1)th round of joint training, t being an integer greater than 1;

[0051] calculate a training loss change value of the first terminal according to the first average loss value, the second average loss value and a training iteration number of the first terminal in the (t-1)th round of joint training;

[0052] map the training loss change value of the first terminal to a preset interval to obtain a convergence contribution value of the first terminal.

[0053] In a second aspect, the embodiments of the present application further provide another federated learning method, executed by a terminal, the method comprising:

[0054] send training information in the tth round of joint training to a server, so that the server determines a multi-objective optimization parameter according to the training information, and determines a target training iteration number of the terminal by optimizing the multi-objective optimization parameter, wherein the training information comprises training dataset information, training time information and a convergence contribution value, the convergence contribution value being related to a training loss change value, N being an integer greater than 1, and t being a positive integer;

[0055] receive the target training iteration number sent by the server;

[0056] perform the (t+1)th round of joint training based on the target training iteration number.

[0057] In a third aspect, the embodiments of the present application further provide a federated learning device, arranged in a server, the federated learning device comprising:

[0058] an obtaining module, configured to obtain training information of N terminals in the tth round of joint training, wherein the training information comprises training dataset information, training time information and a convergence contribution value, the convergence contribution value being related to a training loss change value, N being an integer greater than 1, and t being a positive integer;

[0059] a first determining module, configured to determine a multi-objective optimization parameter according to the training dataset information, the training time information and the convergence contribution value, the multi-objective optimization parameter comprising a training idle time and a convergence contribution sum;

[0060] a second determining module, configured to determine a target training iteration number of each terminal in the N terminals, taking minimizing the training idle time as a first optimization objective and taking maximizing the convergence contribution sum as a second optimization objective;

[0061] The first sending module is configured to send respective target training iteration numbers to the N terminals respectively, which are used by the N terminals in the t+1th round of joint training.

[0062] Optionally, the first determining module comprises:

[0063] The first determining unit is configured to determine an initial training iteration number according to the training dataset information.

[0064] The first calculating unit is configured to calculate a training time consumption of each terminal in the N terminals according to the training time information and a current training iteration number, wherein the current training iteration number is the initial training iteration number in initial calculation.

[0065] The second determining unit is configured to determine a longest training time consumption and a shortest training time consumption according to the training time consumption of each terminal in the N terminals.

[0066] The third determining unit is configured to determine that a difference between the longest training time consumption and the shortest training time consumption is the training idle time.

[0067] Optionally, the training time information comprises an iteration calculation time and a communication time.

[0068] The training time consumption of the first terminal is equal to a sum of a first product and a communication time of the first terminal, the first product is equal to a product of an iteration calculation time of the first terminal and the current training iteration number, and the first terminal is any terminal in the N terminals.

[0069] Optionally, the first determining module comprises:

[0070] The fourth determining unit is configured to determine an initial training iteration number according to the training dataset information.

[0071] The second calculating unit is configured to calculate a convergence contribution sum of the N terminals according to the convergence contribution value and a current training iteration number, wherein the current training iteration number is the initial training iteration number in initial calculation.

[0072] Optionally, the convergence contribution sum is equal to a sum of products of the convergence contribution value of each terminal in the N terminals and the current training iteration number.

[0073] Optionally, the initial training iteration number is a maximum allowable initial training iteration number.

[0074] The federated learning device further comprises:

[0075] The third determining module is configured to determine a maximum convergence contribution sum according to the convergence contribution sum of the N terminals obtained in initial calculation.

[0076] wherein the second optimization objective is the convergence contribution sum equal to the maximum convergence contribution sum.

[0077] Optionally, the first optimization objective is the training slack time equal to 0.

[0078] Optionally, the second determining module comprises:

[0079] a constructing unit, configured to construct a multi-objective optimization function according to the training slack time, the convergence contribution sum, a maximum training slack time and a maximum convergence contribution sum, wherein the maximum convergence contribution sum is determined according to a maximum allowable training iteration number and the convergence contribution value sum, and the maximum training slack time is determined according to the maximum allowable training iteration number and the training time information;

[0080] a fifth determining unit, configured to calculate an optimization objective value of the multi-objective optimization function, and determine a target training iteration number of each terminal in the N terminals with the optimization objective of minimizing the optimization objective value.

[0081] Optionally, the multi-objective optimization function is a weighted distance function of the training slack time and the convergence contribution sum.

[0082] Optionally, the second determining module comprises:

[0083] a third calculating unit, configured to calculate an optimization objective value L2 of the multi-objective optimization function;

[0084] a processing unit, configured to, in a case where the optimization objective value L2 does not satisfy a minimization condition, reduce a training iteration number of a target terminal, the target terminal being a terminal with a longest current training time consumption in the N terminals, the current training time consumption being calculated according to a current training iteration number;

[0085] an obtaining unit, configured to obtain an updated training slack time and convergence contribution sum;

[0086] a fourth calculating unit, configured to recalculate the optimization objective value L2 of the multi-objective optimization function according to the updated training slack time and convergence contribution sum;

[0087] a judging unit, configured to judge whether the recalculated optimization objective value L2 satisfies the minimization condition;

[0088] an executing unit, configured to, in a case where the recalculated optimization objective value L2 does not satisfy the minimization condition, repeatedly execute the step of reducing the training iteration number of the target terminal until the optimization objective value L2 satisfies the minimization condition;

[0089] an output unit, configured to output a current training iteration number of each of the N terminals in a case where the optimization target value L2 satisfies a minimum condition.

[0090] Optionally, the processing unit is configured to:

[0091] assign the optimization target value L2 to a first optimization target value L2' and a maximum optimization target value L 2max ;

[0092] in a case where a current training idle time T idle does not reach a minimum value, and a current first optimization target value L2' is less than or equal to a current maximum optimization target value L 2max , assign the current first optimization target value L2' to the current maximum optimization target value L 2max ;

[0093] determine a target terminal, in which a current training time consumption is the longest, according to a current training iteration number of the N terminals;

[0094] decrement, by 1, a training iteration number of the target terminal;

[0095] The second determination module further includes:

[0096] an assignment unit, configured to assign the recalculated optimization target value L2 to a first optimization target value L2';

[0097] The output unit is configured to output a current training iteration number of each of the N terminals in a case where a current training idle time T idle reaches a minimum value, or a current first optimization target value L2' is greater than a current maximum optimization target value L 2max .

[0098] Optionally, the convergence contribution value is determined based on the following manner:

[0099] obtain a first average loss value of a first terminal in a tth round of joint training, the first terminal being any terminal of the N terminals;

[0100] obtain a second average loss value of the first terminal in a (t-1)th round of joint training, t being an integer greater than 1;

[0101] calculate a training loss change value of the first terminal according to the first average loss value, the second average loss value, and a training iteration number of the first terminal in the (t-1)th round of joint training;

[0102] map the training loss change value of the first terminal to a preset interval to obtain a convergence contribution value of the first terminal.

[0103] In a fourth aspect, the embodiments of the present application further provide another federated learning device, which is arranged in a terminal and comprises:

[0104] a second sending module, configured to send training information in the tthround of joint training to a server, so that the server determines multi-objective optimization parameters according to the training information, and determines the target training iteration number of the terminal by optimizing the multi-objective optimization parameters, wherein the training information comprises training data set information, training time information and a convergence contribution value, the convergence contribution value is related to a training loss change value, N is an integer greater than 1, and t is a positive integer;

[0105] a receiving module, configured to receive the target training iteration number sent by the server;

[0106] a training module, configured to perform the t+1thround of joint training based on the target training iteration number.

[0107] In a fifth aspect, the embodiments of the present application further provide an electronic device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the federated learning method according to the first aspect when executing the computer program, or implements the steps in the federated learning method according to the second aspect.

[0108] In a sixth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in the federated learning method according to the first aspect, or implement the steps in the federated learning method according to the second aspect.

[0109] In the embodiments of the present application, training information of N terminals in the tth round of joint training is obtained, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to the training loss change value, N is an integer greater than 1, and t is a positive integer; according to the training data set information, the training time information and the convergence contribution value, multi-objective optimization parameters are determined, the multi-objective optimization parameters include training idle time and convergence contribution sum; the target training iteration number of each terminal in the N terminals is determined by taking minimizing the training idle time as the first optimization target and maximizing the convergence contribution sum as the second optimization target; and the target training iteration number of each terminal is sent to the N terminals respectively for use in the t+1th round of joint training of the N terminals. In this way, by constructing multi-objective optimization parameters including training idle time and convergence contribution sum, and taking optimization of the two target optimization parameters as the optimization target, appropriate training iteration numbers of the terminals are determined respectively, so as to balance between improving the federated learning training time efficiency and improving the terminal global convergence gain, so as to maximize the convergence speed of the federated learning model. BRIEF DESCRIPTION OF DRAWINGS

[0110] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0111] Figure 1 is a framework implementation diagram of the federated learning algorithm provided by the embodiments of the present application;

[0112] Figure 2 is a schematic diagram of the influence of terminal system heterogeneity and data heterogeneity on training efficiency in the existing federated learning provided by the embodiments of the present application;

[0113] Figure 3 is one of the flowcharts of the federated learning method provided by the embodiments of the present application;

[0114] Figure 4 is a general framework diagram of the federated learning system provided by the embodiments of the present application;

[0115] Figure 5 is a workflow diagram of the federated learning iteration number adaptive allocation mechanism provided by the embodiments of the present application;

[0116] Figure 6 is a federated learning training execution flowchart provided by the embodiments of the present application;

[0117] Figure 7is a flowchart of a federated learning method provided by an embodiment of the present application;

[0118] Figure 8 is a structural diagram of a federated learning device provided by an embodiment of the present application;

[0119] Figure 9 is a structural diagram of a federated learning device provided by an embodiment of the present application;

[0120] Figure 10 is a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0121] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0122] To make the embodiments of the present application clearer, the related concepts of federated learning will be briefly introduced as follows:

[0123] The working principle of federated learning is shown in Figure 1 The cloud center server first distributes the model to each terminal participating in federated learning, the terminal uses the stochastic gradient descent optimization method to train the intelligent algorithm, and then the terminal sends the trained model to the cloud center server before the training task deadline, and the cloud center server is responsible for aggregating these models. The end-cloud collaborative training time is composed of two parts: terminal algorithm training time and model transmission time. Federated learning repeats this process until the model converges. However, the parameter quantity of the intelligent algorithm is huge, and if the terminal uploads the model to the cloud center server after each training iteration, it will increase the model transmission time, thereby reducing the training convergence speed of federated learning. In order to reduce the model transmission time between the terminal and the cloud center server, the most popular federated learning training algorithm at present is the federated averaging algorithm. The federated averaging algorithm assumes that each terminal performs the same number of training iterations, and synchronizes with the cloud center after performing multiple training iterations at each terminal, thereby reducing the communication frequency between the terminal and the cloud, and reducing the model transmission time.

[0124] Current federated learning work generally assumes that all terminals perform the same number of training epochs, and that these epochs remain unchanged during training. However, due to the heterogeneity of systems and data among terminals, an unreasonable number of training iterations performed by each terminal can negatively impact the training time efficiency and global convergence gain of the federated learning model, thus slowing down its convergence speed. Existing improvement schemes include: 1) discarding lagging terminals, but this limits the participation of terminals with high-quality data in training; 2) selecting terminals that contribute to global convergence, but this does not make good use of the idle time of all terminals.

[0125] Due to system and data heterogeneity issues at the terminals, if all terminals perform the same number of training rounds, an unreasonable number of training iterations will reduce the training efficiency of federated learning. Figure 2 As shown, due to the heterogeneity of terminal systems, the computing and communication capabilities of terminals are inconsistent. Therefore, when terminals complete the same training round, some terminals will lag behind, thus slowing down the convergence speed of the federated learning model. Furthermore, due to data heterogeneity, the convergence direction of the local models on each terminal is inconsistent, resulting in inconsistent convergence gains of the global models across the terminals. Figure 2 In the process, terminals 2 and 3 become lagging devices due to differences in data volume and computing power, respectively (e.g., ...). Figure 2 (As shown in part (a)). To improve the training time efficiency of federated learning, the number of training iterations for terminal 2 and terminal 3 can be reduced so that the three terminals complete training at the same time as much as possible. However, because terminal 2 and terminal 3 have high-quality data, the global convergence gain of the terminals is relatively large (e.g., Figure 2 (As shown in part (b)). Because training efficiency consists of training time efficiency and terminal iteration global convergence gain, reducing the number of training iterations for terminal 2 and terminal 3 may lead to a decrease in the overall federated learning training efficiency. Therefore, due to the influence of data heterogeneity and system heterogeneity, there is a contradiction between federated learning training time efficiency and terminal global convergence gain, making it difficult to measure the relationship between the number of terminal training iterations and training time efficiency, as well as the terminal global convergence gain. These problems seriously hinder the design of an adaptive allocation mechanism for the number of terminal iterations in federated learning.

[0126] This application mainly addresses the system heterogeneity and data heterogeneity problems existing in the federated learning training process, and proposes an adaptive allocation mechanism for the number of training iterations of the federated learning terminal.

[0127] In the federated learning terminal iteration number adaptive allocation mechanism proposed in the present application, the two goals of improving training time efficiency and terminal global convergence gain are modeled as a multi-objective optimization problem. Then based on the terminal contribution and the maximum local optimal solution, the idea of greediness is used to adjust the terminal training iteration number to gradually reduce the idle time, so that the solution of the multi-objective optimization gradually approaches the local optimal solution with the minimum idle time, and finally a balance is reached between the two goals, achieving simultaneous improvement of federated learning training time efficiency and terminal global convergence gain.

[0128] The present application mainly carries out in the federated learning environment of terminal heterogeneity.

[0129] Figure 4 is the overall framework of the federated learning system. The system mainly consists of a physical resource layer, a basic service layer, a platform execution layer and an application layer. The physical resource layer consists of intelligent terminal devices and cloud center servers. Neural network model training is carried out on the terminal, and the cloud center server acts as a parameter server. The basic service layer consists of a virtualization platform Docker, an artificial intelligence training framework PyTorch and a communication control tool gRPC. The two execution modules in the platform execution layer are designed based on these tools, including a terminal execution module based on an iteration number adaptive allocation mechanism and a server execution module. The terminal execution module is responsible for controlling the neural network training process on the terminal, and the server execution module manages the entire federated learning training process, including training execution process, terminal management and other work.

[0130] Referring to Figure 3 , Figure 3 is the flowchart of the federated learning method provided by the embodiment of the present application, as shown in Figure 3 , comprising the following steps:

[0131] Step 301, obtaining training information of N terminals in the tthround of joint training, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to the training loss change value, N is an integer greater than 1, and t is a positive integer.

[0132] The above N terminals can refer to multiple terminals participating in joint training, and in the embodiment of the present application, all terminals can participate in joint training, without selecting only part of the terminals to participate in training at the beginning of each communication round.

[0133] The N terminals can be referred to as one communication round for each complete joint training process (including model distribution, iteration calculation and model transmission), and any terminal can perform multiple iteration calculations in one round of joint training.

[0134] The server can be a cloud server for joint training with the N terminals, for storing and distributing training models and related parameters, which can act as a parameter server to implement model parameter aggregation, calculation, communication, etc.

[0135] The tthround of joint training can refer to any round of joint training. In actual application, the N terminals can send their relevant training information in the round of training, such as training data set information, training time information, convergence contribution value of the terminal, etc., to the server after each round of joint training, so that the server can analyze the model training of each terminal according to the collected relevant training information of the N terminals in the round of joint training, determine the processing capacity of each terminal, and then adaptively allocate appropriate iteration numbers to each terminal to ensure that each terminal has similar training time efficiency and convergence gain.

[0136] The training data set information can refer to the number, size, etc. of the local data set used by the terminal in the tthround of joint training, to reflect the training data heterogeneity of the terminal.

[0137] The training time information can refer to the training time spent by the terminal in the tthround of joint training, such as communication time and iteration calculation time.

[0138] The convergence contribution value can be used to evaluate the contribution of the terminal to the global convergence in the tthround of joint training, and the convergence contribution value can be mapped based on the training loss change value, that is, the convergence contribution value can be related to the training loss change value, or can be calculated based on the training loss change value. The training loss change value can refer to the change value of the training loss value of the terminal in the two rounds of joint training.

[0139] Optionally, the convergence contribution value is determined based on the following manner:

[0140] Obtain a first average loss value of a first terminal in the tthround of joint training, the first terminal being any terminal of the N terminals;

[0141] Obtain a second average loss value of the first terminal in the t-1thround of joint training, t being an integer greater than 1;

[0142] Calculate a training loss change value of the first terminal according to the first average loss value, the second average loss value and the number of training iterations of the first terminal in the t-1thround of joint training;

[0143] Map the training loss change value of the first terminal to a preset interval to obtain the convergence contribution value of the first terminal.

[0144] In an embodiment, the convergence contribution value of each terminal can be evaluated by calculating the training loss change value of each terminal in the t-1th joint training and the tth joint training.

[0145] For example, the convergence contribution value of a terminal, such as a first terminal, in the N terminals can be calculated by obtaining an average loss value of the first terminal in the tth joint training, denoted as a first average loss value, and obtaining an average loss value of the first terminal in the t-1th joint training, denoted as a second average loss value.

[0146] Then, the training loss change value of the first terminal can be calculated according to the first average loss value, the second average loss value, and the number of training iterations of the first terminal in the t-1th joint training. For example, the training loss change value of the first terminal can be obtained by dividing the difference between the second average loss value and the first average loss value by the number of training iterations of the first terminal in the t-1th joint training.

[0147] Finally, the convergence contribution value of the first terminal can be represented by mapping the training loss change value of the first terminal to a preset interval, such as an interval of [0, 1].

[0148] Specifically, the server can send the global model to all terminals at the beginning of each communication round to obtain the loss function value of the global model on the terminals based on the local training data set D i . It is assumed that the average loss function value of terminal i based on the data set D i in the tth communication round is f i t (ω t ) = E[F i (ω t , D i )], and the average loss function value of terminal i in the t-1th communication round is f i t-1 (ω t-1 ). Then, the loss function change value of each training iteration of terminal i between the t-1th and tth communications can be represented as wherein represents the number of training iterations of terminal i in the t-1th communication round, ω represents the model parameter, and F i (ω t , D i ) represents the training model of terminal i.

[0149] Since it is difficult to determine the final convergence state of the neural network model, the optimal convergence state of the neural network cannot be used to evaluate the terminal convergence contribution in practice. Because an excellent global model needs to fit all terminal user data, the loss function change value of the terminal training set on the global model can be used to estimate the terminal contribution to the global convergence. The average change value of the loss function has no numerical significance, only relative significance. The convergence contribution of one terminal is less than that of another terminal, indicating that the terminal has less effect on the current global convergence. Therefore, in order to better evaluate the terminal contribution, in an embodiment, a sigmoid function, i.e., a sigmod function, can be used to map the loss function change range to the interval [0, 1] to represent the convergence contribution of the terminal, and the mapping formula is as follows:

[0150]

[0151] wherein C i is the convergence contribution of the terminal i.

[0152] In this way, through this embodiment, a more accurate and reliable terminal convergence contribution evaluation method can be provided, which is beneficial to subsequent multi-objective optimization.

[0153] Step 302, determining a multi-objective optimization parameter according to the training dataset information, the training time information and the convergence contribution value, the multi-objective optimization parameter including a training idle time and a convergence contribution sum.

[0154] In the embodiments of the present application, in order to balance the training time efficiency and the terminal global convergence gain in federated learning, and at the same time improve the training time efficiency and the terminal global convergence gain, the two objectives can be modeled as a multi-objective optimization problem.

[0155] Therefore, in this step, the multi-objective optimization parameter, specifically the training idle time and the convergence contribution sum, can be determined according to the training dataset information, the training time information and the convergence contribution value.

[0156] The training idle time can be the difference between the longest time and the shortest time consumed by the N terminals to complete a round of training task.

[0157] The convergence contribution sum can be the sum of the convergence contribution values made by the N terminals in completing a round of training task.

[0158] And in the embodiments of the present application, the training idle time and the convergence contribution sum can be related to the training iteration number of the terminal, i.e., the two target parameters to be optimized. The purpose of the embodiments of the present application is to determine a suitable or optimal training iteration number for each terminal, so as to ensure that the training idle time and the convergence contribution sum of the N terminals in the next round of joint training reach the optimal value.

[0159] In a specific implementation, the initial training iteration number can be determined according to the training dataset information, and then the longest time consumption and the shortest time consumption of the N terminals to complete the iteration number can be determined in combination with the training time information of the N terminals in the tthround of joint training, and finally the relationship between the training idle time and the training iteration number can be obtained based on the difference between the longest time consumption and the shortest time consumption.

[0160] In addition, the convergence contribution value of the N terminals to complete the iteration number can be determined in combination with the convergence contribution value of the N terminals in the tthround of joint training, and finally the relationship between the convergence contribution and the training iteration number can be obtained based on the sum of the convergence contribution values of the terminals.

[0161] Optionally, the step 302 comprises:

[0162] determining an initial training iteration number according to the training dataset information;

[0163] calculating the training time consumption of each terminal of the N terminals according to the training time information and the current training iteration number, wherein the current training iteration number is the initial training iteration number in the initial calculation;

[0164] determining the longest training time consumption and the shortest training time consumption according to the training time consumption of each terminal of the N terminals;

[0165] determining the training idle time as the difference between the longest training time consumption and the shortest training time consumption.

[0166] The determination of the initial training iteration number according to the training dataset information can be based on the information such as the number or size of the training dataset of each terminal, and a preliminary iteration number can be determined for each terminal, for example, if the number of the training dataset of a certain terminal is large, more initial training iteration numbers are allocated to it. Specifically, the initial training iteration number of each terminal can be accurately calculated in combination with the system hyperparameters in joint training, such as the local training round E and the local training batch size B. That is, the initial training iteration number τi of terminal i can be calculated as follows: i The system hyperparameters E and B are input into the terminal iteration number allocation algorithm to calculate the initial training iteration number τi of terminal i. i The specific calculation formula can be as follows: i τi=E×D i / B.

[0167] Then, the training time consumption of each terminal can be calculated according to the training time information of each terminal and the current training iteration number, for example, the training time information of a terminal can be multiplied by its current training iteration number to evaluate the training time consumption of the terminal.

[0168] It should be noted that in the embodiments of the present application, the training idle time is a target optimization parameter related to the training iteration number of each terminal, and the target training iteration number of each terminal that can make the training idle time optimal is found by continuously updating the training iteration number of each terminal. Therefore, the training time consumption of each terminal needs to be calculated according to the current latest training iteration number of each terminal in the algorithm, and then the training idle time related to the current training iteration number is calculated.

[0169] In the initial calculation of the training idle time, the current training iteration number of each terminal is the initial training iteration number. In the non-initial calculation of the training idle time, the training idle time can be calculated according to the training iteration number of each terminal that has been updated in the current stage.

[0170] After the training time consumption of each terminal is calculated, the longest training time consumption and the shortest training time consumption among all the training time consumptions of the N terminals can be determined, and the difference between the longest training time consumption and the shortest training time consumption can be taken as the training idle time under the current training iteration number.

[0171] For example, it is assumed that the training time consumptions of the N terminals are T1, T2,..., TN respectively. N The longest training time consumption T max max(T1, T2,..., TN) and the shortest training time consumption T N min(T1, T2,..., TN) can be determined, so that the training idle time T min Tmax-Tmin. N idle max min

[0172] Further, the training time information includes an iteration calculation time and a communication time.

[0173] The training time consumption of the first terminal is equal to the sum of the first product and the communication time of the first terminal, the first product is equal to the product of the iteration calculation time of the first terminal and the current training iteration number, and the first terminal is any terminal in the N terminals.

[0174] That is, in a more specific embodiment, the training time information of any terminal i can include an iteration calculation time T i cp and a communication time Therefore, when calculating the training time consumption T i of terminal i, the formula can be used for calculation, τ i is the training iteration number of terminal i.

[0175] ​​​​Thus, by the above embodiments, the training iteration number based on the terminal can be ensured, the training time consumption of each terminal can be accurately estimated, and the target parameter to be optimized related to the training iteration number, i.e., the training idle time, can be determined.

[0176] Optionally, the step 302 comprises:

[0177] According to the training data set information, an initial training iteration number is determined.

[0178] According to the convergence contribution value and the current training iteration number, a convergence contribution sum of the N terminals is calculated, wherein, in the initial calculation, the current training iteration number is the initial training iteration number.

[0179] In order to improve the convergence speed of the federated learning training, the global convergence gain of the terminal also needs to be improved, and therefore, the present application assumes that another optimization target is the sum of the training contributions of all terminals, i.e., the convergence contribution sum of the N terminals.

[0180] The above-mentioned manner of determining the initial training iteration number can refer to the related description in the foregoing embodiments, which will not be described here again.

[0181] Then, according to the convergence contribution value of each terminal and the current training iteration number, the convergence contribution sum of the N terminals can be calculated, for example, the convergence contribution value of each terminal can be multiplied by its current training iteration number to evaluate the total convergence contribution of the terminal under its current training iteration number, and then the sum of the total convergence contributions of the terminals is taken as the convergence contribution sum of the N terminals.

[0182] It should be noted that, in the embodiments of the present application, the convergence contribution sum is also a target optimization parameter related to the training iteration number of each terminal, and the target training iteration number of each terminal that can make the convergence contribution sum optimal also needs to be found by continuously updating the training iteration number of each terminal, and therefore, the total convergence contribution of each terminal needs to be calculated according to the latest training iteration number of each terminal in the algorithm, and then the convergence contribution sum of the N terminals related to the current training iteration number of each terminal is calculated.

[0183] In the initial calculation of the convergence contribution sum, the current training iteration number of each terminal is the initial training iteration number. In the non-initial calculation of the convergence contribution sum, the convergence contribution sum can be calculated according to the training iteration number of each terminal that has been updated in the current stage.

[0184] Further, the convergence contribution sum is equal to the sum of the product of the convergence contribution value of each terminal in the N terminals and the current training iteration number.

[0185] That is, in a more specific embodiment, the total convergence contribution value of any terminal i is equal to τ i × Ci , and the convergence contribution sum of the N terminals sum The convergence contribution sum of the N terminals can be calculated based on the formula , and the training iteration number of terminal i is denoted as i

[0186] Thus, through the above embodiments, the training iteration number of the terminal can be ensured to accurately evaluate the target parameter to be optimized related to the training iteration number, i.e., the convergence contribution sum of the N terminals.

[0187] Step 303: determining the target training iteration number of each terminal in the N terminals, taking the minimum training idle time as the first optimization target and the maximum convergence contribution sum as the second optimization target.

[0188] In the embodiments of the present application, it is considered that the closer the training time of the N terminals in a round of joint training, i.e., the more consistent, the better, which can reduce or avoid the occurrence of lagging terminals and improve the training time efficiency of federated learning. Therefore, the minimum training idle time can be taken as the first optimization target, such as making the training idle time reach 0 as the optimal value, i.e., the training time of each terminal is the same, so that there is no need to wait for any terminal to complete the training in the model joint training, thereby improving the overall efficiency of federated learning; and the convergence contribution sum can be taken as the second optimization target, such as making the convergence contribution sum of the N terminals reach the maximum upper limit value to ensure the maximum global convergence gain.

[0189] In this step, the minimum training idle time can be taken as the first optimization target, the convergence contribution sum can be taken as the second optimization target, a multi-objective optimization problem can be constructed, and the training iteration number of each terminal corresponding to the optimal value of the multi-objective optimization problem can be obtained by modeling and solving the multi-objective optimization problem, i.e., the target training iteration number of each terminal in the N terminals is determined.

[0190] Optionally, the initial training iteration number is a maximum allowable initial training iteration number.

[0191] Before the step 303, the method further includes:

[0192] determining the maximum convergence contribution sum according to the convergence contribution sum of the N terminals obtained by the initial calculation.

[0193] The second optimization target is that the convergence contribution sum is equal to the maximum convergence contribution sum.

[0194] ​In an embodiment, when calculating the initial training iteration number of each terminal, the maximum allowable training iteration number of each terminal can be determined as the initial training iteration number according to the training data set information of each terminal. For example, the maximum allowable training iteration number of each terminal can be accurately calculated as the initial training iteration number in combination with system hyperparameters in joint training, such as the local training round E, the local training batch size B, and the like. The specific calculation formula can be: τ i = E x D i / B, the upper bound of the training iteration number of terminal i is E x D i / B.

[0195] Considering that C sum can effectively measure the global convergence gain of the terminal, if the value of C sum is increased, the global convergence gain of the federated learning terminal can be increased. If the training iteration number of each terminal reaches the upper bound τ i = E x D i / B, i ∈ S, S is a terminal set, then the optimization target C sum has a maximum value, and the maximum value is At this time, the global model convergence of the federated learning will obtain the highest convergence gain.

[0196] Therefore, in the embodiment, the maximum convergence contribution sum C max of the N terminals can be calculated according to the initial training iteration number and the convergence contribution value of each terminal, and the convergence contribution sum C max can be used as the training optimization target of the convergence contribution sum of the N terminals, so as to ensure that the global model convergence of the federated learning obtains the highest possible convergence gain.

[0197] Optionally, the first optimization target is that the training idle time is equal to 0.

[0198] For all terminals participating in the federated learning training, the application assumes that the time required for terminal i to complete one round of training iteration is T i cp Therefore, the time consumed by the terminal to complete τ i training iterations is τ i x T i cp It is assumed that the time required for the terminal to upload and download the model, that is, the communication time consumption, is Therefore, the total time consumed by terminal i in one round of communication iteration is: Therefore, the longest time consumed by all terminals in the training task is T max = max(T1, T2,... T N ), and the shortest time consumed is T min = min(T1, T2,... T N). Based on the above assumptions, the present application defines the longest time consumption T max The difference between the shortest time consumption T min and the longest time consumption T idle is the slack time:

[0199] T max -T min

[0200] In this period of time, the terminal that completes the task in advance will wait for other terminals, resulting in the terminal that does not complete the task becoming a lag terminal, thereby slowing down the federated learning training efficiency. The slack time can measure the current training time efficiency, and if the slack time is reduced, the lag terminal can be reduced, thereby improving the federated learning training time efficiency. The present application takes T idle as one of the optimization goals, and if a suitable terminal training iteration number is found to make T idle = 0, the lag terminal in the federated learning training process completely disappears, and the federated learning training time efficiency is maximized.

[0201] Therefore, in an embodiment, the slack time T idle = 0 can be trained as the first optimization goal to improve the federated learning training time efficiency.

[0202] In summary, the above two optimization goals can be modeled as a multi-objective optimization model, and a reasonable terminal training iteration number distribution scheme can be found by solving the problem to solve the contradiction between the two goals of federated learning, to achieve a balance between improving the federated learning training time efficiency and improving the terminal global convergence gain, so that the federated learning model convergence speed is maximized. Because the slack time can represent the federated learning training time efficiency, and the sum of the terminal convergence contributions can represent the terminal global convergence gain, the slack time and the sum of the terminal convergence contributions can be taken as optimization goals, and the optimal values of the two goals are T idle = 0 and C sum = C max , respectively.

[0203] Optionally, the step 303 comprises:

[0204] According to the training slack time, the convergence contribution sum, the maximum training slack time, and the maximum convergence contribution sum, a multi-objective optimization function is constructed, wherein the maximum convergence contribution sum is determined according to the maximum allowable training iteration number and the convergence contribution sum, and the maximum training slack time is determined according to the maximum allowable training iteration number and the training time information;

[0205] The optimization goal value of the multi-objective optimization function is calculated, and the optimization goal is to minimize the optimization goal value, to determine the target training iteration number of each terminal in the N terminals.

[0206] After the multi-objective optimization parameters, i.e., the training slack time and the convergence contribution sum, and the optimization objectives, i.e., the maximum training slack time and the maximum convergence contribution sum, are determined according to the current training iteration numbers of the terminals, a suitable multi-objective optimization function can be constructed based on the parameters and values, so as to obtain the target training iteration number of each terminal in the N terminals by calculating the optimization objective value of the multi-objective optimization function and taking minimizing the optimization objective value as the optimization objective.

[0207] wherein the maximum convergence contribution sum is an upper limit of the terminal convergence contribution sum C sum , and the maximum training slack time is an upper limit of the training slack time T idle .

[0208] When constructing the multi-objective optimization function, the maximum convergence contribution sum C max may be used to normalize the terminal convergence contribution sum C sum , and the maximum training slack time may be used to normalize the training slack time T idle . For example, the multi-objective optimization function can be constructed with (C max -C sum ) / C sum and as variables, so as to unify the units of the multi-objective optimization parameters, and the target training iteration number of each terminal in the N terminals when the minimum value is taken can be determined by finding the minimum value of the multi-objective optimization function.

[0209] In this way, by constructing the multi-objective optimization problem into a multi-objective optimization function to find the optimal value, the target training iteration number allocated to each terminal can be accurately and quickly calculated, and the training time efficiency and the terminal global convergence gain of the federated learning are simultaneously improved.

[0210] Further, the multi-objective optimization function is a weighted distance function of the training slack time and the convergence contribution sum.

[0211] That is, in an embodiment, the weighted distance function of the training slack time and the convergence contribution sum is constructed as the multi-objective optimization function by using the weighted distance of the solution of the multi-objective optimization problem and the optimal value as the optimization objective.

[0212] The weighted distance function of the training slack time and the convergence contribution sum can be constructed as the multi-objective optimization function by taking the two target optimization parameters as variables.

[0213] For example, after the training slack time and the convergence contribution and are normalized, a multi-objective optimization function can be constructed according to the Euclidean distance of the two, which can be mathematically expressed as follows:

[0214]

[0215] Wherein, α is used to adjust the attention bias of the adaptive adjustment mechanism for the terminal training iteration number to the system heterogeneity and data heterogeneity, α = 0 indicates that the adaptive adjustment mechanism only solves the data heterogeneity problem, and α = 1 indicates that the adaptive adjustment mechanism only solves the system heterogeneity problem. is the upper limit of the slack time T idle , C max is the upper limit of the terminal contribution sum, and C max are used to normalize the two objective optimization parameters.

[0216] From the above multi-objective optimization function, it can be seen that when T idle tends to 0, C sum tends to C max , L2 will tend to the minimum value, that is, the smaller T idle , the smaller C max , the smaller C sum , the smaller L2, so that the minimum value of L2 can be calculated to realize multi-objective optimization, and the minimum value of L2 can be determined by each terminal taking different training iteration numbers τ i .

[0217] In this way, by solving the multi-objective optimization function, the training time efficiency and the terminal convergence gain can be balanced, thereby effectively improving the federated learning training efficiency.

[0218] Further, the method further comprises:

[0219] calculating the optimization objective value L2 of the multi-objective optimization function;

[0220] in the case that the optimization objective value L2 does not satisfy the minimum condition, reducing the training iteration number of the target terminal, the target terminal being the terminal with the longest current training time in the N terminals, the current training time being calculated according to the current training iteration number;

[0221] obtaining the updated training slack time and convergence contribution sum;

[0222] recomputing the optimization objective value L2 of the multi-objective optimization function according to the updated training slack time and convergence contribution sum.

[0223] determining whether the re-calculated optimization target value L2 satisfies a minimization condition;

[0224] In the case where the re-calculated optimization target value L2 does not satisfy the minimization condition, repeating the steps of reducing the training iteration number of the target terminal to the step of determining whether the re-calculated optimization target value L2 satisfies the minimization condition until the optimization target value L2 satisfies the minimization condition;

[0225] In the case where the optimization target value L2 satisfies the minimization condition, outputting the current training iteration number of each terminal in the N terminals.

[0226] That is, the process of solving the multi-objective optimization function can be that, according to the current training iteration number of each terminal, the optimization target value L2 of the multi-objective optimization function is calculated, and the initial calculation of the optimization target value L2 is calculated according to the initial training iteration number of each terminal.

[0227] Each time the optimization target value L2 is calculated, a determination of whether the minimization condition is satisfied can be made, and the minimization condition can be that the training idle time tends to 0, or the terminal convergence contribution sum tends to the maximum upper limit value, or the current optimization target value L2 does not continue to decrease. In the case where the current optimization target value L2 does not satisfy the minimization condition, the training iteration number of the target terminal can be determined according to the training time of the N terminals at the current training iteration number, and the training iteration number of the target terminal can be reduced, such as by 1 or 2 each time.

[0228] Then, according to the updated training iteration number of the target terminal, the training time of the target terminal is re-calculated, and the maximum time and the minimum time are updated together with the training time of other terminals, so that the updated training idle time and convergence contribution sum can be obtained. And according to the updated training idle time and convergence contribution sum, the optimization target value L2 of the multi-objective optimization function is re-calculated.

[0229] For the re-calculated optimization target value L2, a similar determination of whether the minimization condition is satisfied can be made, that is, determining whether the re-calculated optimization target value L2 satisfies the minimization condition. In the case where the re-calculated optimization target value L2 still does not satisfy the minimization condition, the above process can be repeated, that is, the target terminal with the longest current time is determined again, the training iteration number of the target terminal is reduced, the optimization target value L2 is re-calculated and the step of determining whether the optimization target value L2 satisfies the minimization condition is repeated until the re-calculated optimization target value L2 satisfies the minimization condition.

[0230] In a case where it is determined that the optimization target value L2 obtained by the calculation satisfies the minimization condition, such as a case where the current training idle time has reached an optimal value, or a case where the terminal convergence contribution has reached a maximum upper limit value, or a case where the current optimization target value L2 does not continue to decrease, it is indicated that the algorithm has converged and there is no further optimization space, and therefore, the current latest training iteration number of each terminal in the N terminals can be output.

[0231] In this way, by this embodiment, a logical and easy-to-calculate training iteration number solution scheme can be provided, and the training time efficiency of federated learning and the terminal global convergence gain are improved at the same time.

[0232] Further, in a case where the optimization target value does not satisfy the minimization condition, the training iteration number of the target terminal is reduced, including:

[0233] The optimization target value L2 is assigned to a first optimization target value L2' and a maximum optimization target value L 2max ;

[0234] In a case where the current training idle time T idle has not reached a minimum value, and the current first optimization target value L2' is less than or equal to the current maximum optimization target value L 2max , the current first optimization target value L2' is assigned to the current maximum optimization target value L 2max ;

[0235] According to the current training iteration number, the target terminal with the longest current training time consumption among the N terminals is determined;

[0236] The training iteration number of the target terminal is reduced by 1;

[0237] After the optimization target value L2 of the multi-objective optimization function is recalculated, before it is determined whether the recalculated optimization target value L2 satisfies the minimization condition, the method further includes:

[0238] The recalculated optimization target value L2 is assigned to a first optimization target value L2';

[0239] In a case where the optimization target value L2 satisfies the minimization condition, the current training iteration number of each terminal in the N terminals is output, including:

[0240] In a case where the current training idle time T idle has reached a minimum value, or the current first optimization target value L2' is greater than the current maximum optimization target value L 2max , the current training iteration number of each terminal in the N terminals is output.

[0241] In a more specific implementation, the initially calculated optimization target value L2 can be assigned to the first optimization target value L2′ and the maximum optimization target value L. 2max Then determine the current training idle time T. idle Whether the minimum value has been reached can be determined by judging the maximum training time T among the N terminals. max Is it less than or equal to T? min And determine whether the current first optimization objective value L2′ is greater than the current maximum optimization objective value L. 2max If none of these conditions are met, that is, the maximum training time T... max Greater than T min The first optimization objective value L2′ is less than or equal to the current maximum optimization objective value L. 2max Then, the current first optimization objective value L2′ is assigned to the current maximum optimization objective value L. 2max It can also determine the target terminal with the longest current training time among the N terminals, decrement the number of training iterations of the target terminal by 1, that is, decrement the number of training iterations of the terminal with the longest training time by 1 each time it is adjusted, and recalculate the optimization objective value L2 of the multi-objective optimization function based on the adjusted number of training iterations.

[0242] Each recalculated optimization objective value L2 can be assigned to the first optimization objective value L2′, and used to compare it with the previous maximum optimization objective value L. 2max The comparison is performed to determine whether the minimization condition is met, i.e., the current training idle time T is reassessed. idle Has the minimum value been reached? Or, is the current first optimization objective value L2′ greater than the current maximum optimization objective value L? 2max .

[0243] During the current training downtime T idle The minimum value is reached, or the current first optimization objective value L2′ is greater than the current maximum optimization objective value L. 2max That is, if one of the conditions is met, the current training iteration number of each of the N terminals can be directly output.

[0244] Thus, this implementation provides a logically sound and easily computable solution for calculating the number of training iterations, and simultaneously improves the training time efficiency of federated learning and the global convergence gain of the terminal.

[0245] It should be noted that, in order to quickly determine the target terminal with the longest training time, the training time T of each terminal in the t-th round of communication can be used. i Put into max heap H max In the middle, the H max The structure is a stack, with the maximum value stored at the top, so that if the minimization condition is not met, the maximum value can be retrieved from H. maxT with the largest pop-up value j After taking out, τ j is reduced by 1, and the updated T j ' is put back into H max to continue the subsequent process.

[0246] A complete workflow of the adaptive allocation mechanism of the number of federated learning iterations can be as shown in Figure 5 .

[0247] The loop process in the embodiments of the present application uses the greedy idea to adjust the number of terminal training iterations, gradually reduces the idle time based on the terminal contribution and the maximum local optimal solution, so that the solution of the multi-objective optimization gradually approaches the local optimal solution with the minimum idle time, and finally balances between the two targets, achieving the simultaneous improvement of the training time efficiency of federated learning and the global convergence gain of the terminal.

[0248] Step 304, respectively sending the target training iteration number of each terminal to the N terminals, for the N terminals to use in the t+1 round of joint training.

[0249] The target training iteration number of each terminal in the N terminals obtained in the previous step can be used by the N terminals in the next round, i.e., the t+1 round of joint training, to ensure that the N terminals can obtain shorter training idle time and higher convergence contribution in the t+1 round of joint training, and to achieve the simultaneous improvement of the training time efficiency of federated learning and the global convergence gain of the terminal.

[0250] For example, the target training iteration number of each terminal can be sent to the N terminals respectively when the N terminals start the t+1 round of joint training, so that each terminal performs iteration calculation of the corresponding iteration number in this round of training based on the target training iteration number of each terminal; or the target training iteration number of each terminal can also be sent to the N terminals in advance, and the N terminals perform iteration calculation of the corresponding iteration number in the t+1 round of training based on the target training iteration number obtained when starting the t+1 round of joint training.

[0251] The federal learning method of the embodiment of the application obtains training information of N terminals in the tth round of joint training, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to training loss change value, N is an integer greater than 1, and t is a positive integer; the multi-objective optimization parameter is determined according to the training data set information, the training time information and the convergence contribution value, the multi-objective optimization parameter includes training idle time and convergence contribution sum; the target training iteration number of each terminal in the N terminals is determined by taking minimizing the training idle time as the first optimization target and maximizing the convergence contribution sum as the second optimization target; and the target training iteration number of each terminal is respectively sent to the N terminals for use in the t+1th round of joint training of the N terminals. In this way, by constructing the multi-objective optimization parameter including the training idle time and the convergence contribution sum, and taking the optimization of the two target optimization parameters as the optimization target, the appropriate training iteration number of each terminal is determined, so as to balance between improving the training time efficiency of the federal learning and improving the global convergence gain of the terminal, and maximize the convergence speed of the federal learning model.

[0252] Please refer to Figure 6 , Figure 6 The federal learning training execution flowchart is used to represent the federal learning training execution logic. The specific process is as follows:

[0253] 1) First, at the beginning of training, the user decides whether to use the iteration number adaptive allocation mechanism. If not, the terminal can use the default terminal training iteration number in the whole training process, for example, the federal average training mechanism is used, and each terminal uses the same system set iteration number.

[0254] 2) If it is used, the server first transmits the model parameters to the terminal and obtains the average loss value of the terminal based on the local data set.

[0255] 3) Then, the iteration number adaptive allocation mechanism is used to adjust the terminal training iteration number in the whole training process to improve the federal learning training efficiency.

[0256] 4) The communication between the terminal and the server is independent of each other. In order to improve the communication efficiency, the communication thread pool design scheme is used to make the communication between the terminal and the server parallel.

[0257] 5) After the terminal training iteration number allocation is completed, the specific terminal training message is transmitted to the communication thread pool. The thread pool allocates a thread for each terminal object, and each thread is responsible for communication with a terminal and waits for the terminal to transmit the model training result to the server.

[0258] 6) The server receives the training results, aggregates the model parameters of each terminal, and obtains the training results of the current communication round. Finally, the main process selects the next communication round or ends the federated learning training.

[0259] The difference between the embodiments of the present application and the prior art is that: 1) the federated learning iteration number adaptive allocation mechanism makes all terminals participate in training, rather than selecting only part of the terminals at the beginning of each communication round; 2) in each communication round, the iteration number adaptive allocation mechanism needs to obtain the data state and system state of the terminal, and determine the training iteration number that the terminal needs to perform at the server, so as to improve the training time efficiency of federated learning and the global convergence gain of the terminal.

[0260] Referring to Figure 7 , Figure 7 is a flowchart of the federated learning method provided by the embodiments of the present application, which is executed by a terminal, as shown in Figure 7 , comprising the following steps:

[0261] Step 701, sending training information in the tth joint training to a server, so that the server determines multi-objective optimization parameters according to the training information, and determines the target training iteration number of the terminal by optimizing the multi-objective optimization parameters, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to the training loss change value, N is an integer greater than 1, and t is a positive integer.

[0262] Step 702, receiving the target training iteration number sent by the server.

[0263] Step 703, based on the target training iteration number, performing the t+1th joint training.

[0264] The embodiments of the present application are the corresponding terminal side implementation of the method embodiments shown in Figure 3 , and the specific implementation can refer to the related description in the embodiments shown in Figure 3 , and the same or similar technical effects can be achieved. To avoid repetition, it will not be described here.

[0265] The embodiments of the present application also provide a federated learning device arranged at a server. Referring to Figure 8 , Figure 8 is a structural diagram of the federated learning device provided by the embodiments of the present application. Since the principle of solving the problem of the federated learning device is similar to the federated learning method in the embodiments of the present application, the implementation of the federated learning device can refer to the implementation of the method, and the repeated parts will not be described here.

[0266] As shown in Figure 8 , the federated learning device 800 comprises:

[0267] The acquisition module 801 is configured to acquire training information of N terminals in the tth round of joint training, wherein the training information comprises training dataset information, training time information, and a convergence contribution value, the convergence contribution value is related to a training loss change value, N is an integer greater than 1, and t is a positive integer.

[0268] The first determination module 802 is configured to determine multi-objective optimization parameters according to the training dataset information, the training time information, and the convergence contribution value, wherein the multi-objective optimization parameters comprise a training idle time and a convergence contribution sum.

[0269] The second determination module 803 is configured to determine a target training iteration number of each terminal in the N terminals by taking minimizing the training idle time as a first optimization objective and taking maximizing the convergence contribution sum as a second optimization objective.

[0270] The first sending module 804 is configured to send the target training iteration number of each terminal to the N terminals respectively, for use in the t+1th round of joint training.

[0271] Optionally, the first determination module 802 comprises:

[0272] A first determination unit is configured to determine an initial training iteration number according to the training dataset information.

[0273] A first calculation unit is configured to calculate a training time consumption of each terminal in the N terminals according to the training time information and a current training iteration number, wherein, in initial calculation, the current training iteration number is the initial training iteration number.

[0274] A second determination unit is configured to determine a longest training time consumption and a shortest training time consumption according to the training time consumption of each terminal in the N terminals.

[0275] A third determination unit is configured to determine that a difference between the longest training time consumption and the shortest training time consumption is the training idle time.

[0276] Optionally, the training time information comprises an iteration calculation time and a communication time.

[0277] The training time consumption of the first terminal is equal to a sum of a first product and a communication time of the first terminal, the first product is equal to a product of an iteration calculation time of the first terminal and the current training iteration number, and the first terminal is any terminal in the N terminals.

[0278] Optionally, the first determination module 802 comprises:

[0279] A fourth determination unit is configured to determine an initial training iteration number according to the training dataset information.

[0280] a second calculation unit, configured to calculate a convergence contribution sum of the N terminals according to the convergence contribution values and a current training iteration number, wherein the current training iteration number is the initial training iteration number in initial calculation.

[0281] Optionally, the convergence contribution sum is equal to a sum of the convergence contribution value of each terminal in the N terminals and the current training iteration number.

[0282] Optionally, the initial training iteration number is a maximum allowable initial training iteration number.

[0283] The federated learning device 800 further includes:

[0284] a third determination module, configured to determine a maximum convergence contribution sum according to the convergence contribution sum of the N terminals obtained in initial calculation.

[0285] The second optimization target is that the convergence contribution sum is equal to the maximum convergence contribution sum.

[0286] Optionally, the first optimization target is that the training slack time is equal to 0.

[0287] Optionally, the second determination module 803 includes:

[0288] a construction unit, configured to construct a multi-objective optimization function according to the training slack time, the convergence contribution sum, a maximum training slack time and a maximum convergence contribution sum, wherein the maximum convergence contribution sum is determined according to a maximum allowable training iteration number and the convergence contribution value sum, and the maximum training slack time is determined according to the maximum allowable training iteration number and the training time information.

[0289] a fifth determination unit, configured to calculate an optimization target value of the multi-objective optimization function, and determine a target training iteration number of each terminal in the N terminals with the optimization target of minimizing the optimization target value.

[0290] Optionally, the multi-objective optimization function is a weighted distance function of the training slack time and the convergence contribution sum.

[0291] Optionally, the second determination module 803 includes:

[0292] a third calculation unit, configured to calculate an optimization target value L2 of the multi-objective optimization function.

[0293] a processing unit, configured to reduce the training iteration number of a target terminal in the case that the optimization target value L2 does not satisfy a minimization condition, the target terminal being a terminal with a longest current training time in the N terminals, and the current training time being calculated according to a current training iteration number.

[0294] an obtaining unit, configured to obtain an updated training slack time and a convergence contribution sum;

[0295] a fourth calculating unit, configured to recalculate an optimization target value L2 of the multi-objective optimization function according to the updated training slack time and the convergence contribution sum;

[0296] a judging unit, configured to judge whether the recalculated optimization target value L2 meets a minimization condition;

[0297] a performing unit, configured to, in a case where the recalculated optimization target value L2 does not meet the minimization condition, repeatedly perform the step of judging whether the optimization target value L2 meets the minimization condition by reducing the training iteration number of the target terminal until the optimization target value L2 meets the minimization condition;

[0298] an output unit, configured to output the current training iteration number of each terminal in the N terminals in a case where the optimization target value L2 meets the minimization condition.

[0299] Optionally, the processing unit is configured to:

[0300] assign the optimization target value L2 to a first optimization target value L2' and a maximum optimization target value L 2max ;

[0301] in a case where the current training slack time T idle has not reached a minimum value, and the current first optimization target value L2' is less than or equal to the current maximum optimization target value L 2max , assign the current first optimization target value L2' to the current maximum optimization target value L 2max ;

[0302] determine, according to the current training iteration number, the target terminal with the longest current training time consumption among the N terminals;

[0303] reduce the training iteration number of the target terminal by 1;

[0304] The second determining module 803 further includes:

[0305] an assignment unit, configured to assign the recalculated optimization target value L2 to a first optimization target value L2';

[0306] The output unit is configured to, in a case where the current training slack time T idle has reached the minimum value, or the current first optimization target value L2' is greater than the current maximum optimization target value L 2max , output the current training iteration number of each terminal in the N terminals.

[0307] Optionally, the convergence contribution value is determined based on the following manner:

[0308] obtain a first average loss value of the first terminal in the tth round of joint training, the first terminal being any one of the N terminals;

[0309] obtain a second average loss value of the first terminal in the (t-1)th round of joint training, t being an integer greater than 1;

[0310] calculate a training loss change value of the first terminal according to the first average loss value, the second average loss value and a training iteration number of the first terminal in the (t-1)th round of joint training;

[0311] map the training loss change value of the first terminal to a preset interval to obtain the convergence contribution value of the first terminal.

[0312] The federal learning device 800 provided by the embodiment of the present application can execute the method embodiments described above, and the implementation principles and technical effects are similar, and the embodiment will not be described here.

[0313] The terminal device 800 of the embodiment of the present application obtains training information of N terminals in the tth round of joint training, wherein the training information includes training data set information, training time information and convergence contribution value, the convergence contribution value is related to the training loss change value, N is an integer greater than 1, and t is a positive integer; determine multi-objective optimization parameters according to the training data set information, the training time information and the convergence contribution value, the multi-objective optimization parameters include training idle time and convergence contribution sum; taking minimizing the training idle time as the first optimization target and maximizing the convergence contribution sum as the second optimization target, determine the target training iteration number of each terminal in the N terminals; respectively send the target training iteration number of each terminal to the N terminals for use in the (t+1)th round of joint training. In this way, by constructing the multi-objective optimization parameters including the training idle time and the convergence contribution sum, and taking the optimization of the two target optimization parameters as the optimization target, the appropriate training iteration number of each terminal is determined, so as to balance between improving the training time efficiency and improving the terminal global convergence gain, so as to maximize the convergence speed of the federal learning model.

[0314] The embodiment of the present application also provides a federal learning device arranged in a terminal. Referring to Figure 9 , Figure 9 is a structure diagram of the federal learning device provided by the embodiment of the present application. Since the principle of solving the problem of the federal learning device is similar to that of the federal learning method in the embodiment of the present application, the implementation of the federal learning device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0315] As Figure 9 shown, the federal learning device 900 comprises:

[0316] The second sending module 901 is configured to send training information in the tth round of joint training to a server, so that the server determines multi-objective optimization parameters according to the training information, and determines the target training iteration number of the terminal by optimizing the multi-objective optimization parameters, wherein the training information comprises training dataset information, training time information and convergence contribution value, the convergence contribution value is related to training loss change value, N is an integer greater than 1, and t is a positive integer.

[0317] The receiving module 902 is configured to receive the target training iteration number sent by the server.

[0318] The training module 903 performs the t+1th round of joint training based on the target training iteration number.

[0319] The federal learning device 900 provided by the embodiment of the present application can execute the above-mentioned method embodiment, and has similar implementation principles and technical effects, and the embodiment will not be repeated here.

[0320] The embodiment of the present application also provides an electronic device. Since the principle of solving the problem of the electronic device is similar to the federal learning method in the embodiment of the present application, the implementation of the electronic device can be referred to the implementation of the method, and the repeated part will not be repeated. As Figure 10 shown, the electronic device of the embodiment of the present application comprises:

[0321] The processor 1000, in one implementation, the electronic device is a server, and the processor 1000 is configured to read the program in the memory 1020, and execute the following process:

[0322] Obtain the training information of N terminals in the tth round of joint training, wherein the training information comprises training dataset information, training time information and convergence contribution value, the convergence contribution value is related to training loss change value, N is an integer greater than 1, and t is a positive integer.

[0323] Determine multi-objective optimization parameters according to the training dataset information, the training time information and the convergence contribution value, wherein the multi-objective optimization parameters comprise training idle time and convergence contribution sum.

[0324] Determine the target training iteration number of each terminal in the N terminals, taking minimizing the training idle time as the first optimization target and maximizing the convergence contribution sum as the second optimization target.

[0325] The transceiver 1010 respectively sends the target training iteration number of each terminal to the N terminals, which is used in the t+1th round of joint training of the N terminals.

[0326] The transceiver 1010 is configured to receive and transmit data under the control of the processor 1000.

[0327] wherein, in Figure 10 The bus architecture can include any number of interconnected buses and bridges, specifically, various circuitry linking the one or more processors represented by the processor 1000 and the memory represented by the memory 1020. The bus architecture can also link various other circuitry such as peripheral devices, voltage regulators, and power management circuitry, which are well known in the art and thus, are not further described herein. The bus interface provides an interface. The transceiver 1010 can be a plurality of elements, i.e., including a transmitter and a receiver, providing a means for communicating with various other apparatuses over a transmission medium. The processor 1000 is responsible for managing the bus architecture and general processing, and the memory 1020 can store data used by the processor 1000 in performing operations.

[0328] Optionally, the processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0329] According to the training data set information, determine an initial training iteration number;

[0330] According to the training time information and the current training iteration number, calculate a training time consumption of each terminal in the N terminals, wherein, in the initial calculation, the current training iteration number is the initial training iteration number;

[0331] According to the training time consumption of each terminal in the N terminals, determine a longest training time consumption and a shortest training time consumption;

[0332] Determine the difference between the longest training time consumption and the shortest training time consumption as the training idle time.

[0333] Optionally, the training time information includes iteration calculation time and communication time;

[0334] The training time consumption of the first terminal is equal to the sum of the first product and the communication time of the first terminal, the first product is equal to the product of the iteration calculation time of the first terminal and the current training iteration number, and the first terminal is any terminal in the N terminals.

[0335] Optionally, the processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0336] According to the training data set information, determine an initial training iteration number;

[0337] According to the convergence contribution value and the current training iteration number, a convergence contribution sum of the N terminals is calculated, wherein the current training iteration number is the initial training iteration number when the convergence contribution sum is calculated for the first time.

[0338] Optionally, the convergence contribution sum is equal to a sum of the convergence contribution value of each terminal in the N terminals and the current training iteration number.

[0339] Optionally, the initial training iteration number is a maximum allowable initial training iteration number.

[0340] The processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0341] According to the convergence contribution sum of the N terminals calculated for the first time, a maximum convergence contribution sum is determined.

[0342] The second optimization objective is that the convergence contribution sum is equal to the maximum convergence contribution sum.

[0343] Optionally, the first optimization objective is that the training slack time is equal to 0.

[0344] The processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0345] According to the training slack time, the convergence contribution sum, a maximum training slack time and a maximum convergence contribution sum, a multi-objective optimization function is constructed, wherein the maximum convergence contribution sum is determined according to a maximum allowable training iteration number and the convergence contribution value sum, and the maximum training slack time is determined according to the maximum allowable training iteration number and the training time information.

[0346] An optimization objective value of the multi-objective optimization function is calculated, and a target training iteration number of each terminal in the N terminals is determined by taking minimizing the optimization objective value as an optimization objective.

[0347] Optionally, the multi-objective optimization function is a weighted distance function of the training slack time and the convergence contribution sum.

[0348] The processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0349] An optimization objective value L2 of the multi-objective optimization function is calculated.

[0350] In a case where the optimization objective value L2 does not satisfy a minimum condition, a training iteration number of a target terminal is reduced, the target terminal is a terminal with a longest current training time in the N terminals, and the current training time is calculated according to a current training iteration number.

[0351] obtaining an updated training slack time and a convergence contribution sum;

[0352] recomputing an optimization objective value L2 of the multi-objective optimization function according to the updated training slack time and the convergence contribution sum;

[0353] judging whether the recomputed optimization objective value L2 meets a minimization condition;

[0354] in a case where the recomputed optimization objective value L2 does not meet the minimization condition, repeatedly performing the step of reducing the training iteration number of the target terminal to the step of judging whether the recomputed optimization objective value L2 meets the minimization condition until the optimization objective value L2 meets the minimization condition;

[0355] in a case where the optimization objective value L2 meets the minimization condition, outputting the current training iteration number of each terminal in the N terminals.

[0356] Optionally, the processor 1000 is further configured to read a program in the memory 1020 and perform the following steps:

[0357] assigning the optimization objective value L2 to a first optimization objective value L2' and a maximum optimization objective value L 2max ;

[0358] in a case where the current training slack time T idle has not reached a minimum value and the current first optimization objective value L2' is less than or equal to the current maximum optimization objective value L 2max , assigning the current first optimization objective value L2' to the current maximum optimization objective value L 2max ;

[0359] determining a target terminal with a longest current training time consumption among the N terminals according to the current training iteration number;

[0360] reducing the training iteration number of the target terminal by 1;

[0361] assigning the recomputed optimization objective value L2 to the first optimization objective value L2';

[0362] in a case where the current training slack time T idle has reached the minimum value or the current first optimization objective value L2' is greater than the current maximum optimization objective value L 2max , outputting the current training iteration number of each terminal in the N terminals.

[0363] Optionally, the convergence contribution value is determined based on the following manner:

[0364] obtain a first average loss value of the first terminal in the tth round of joint training, the first terminal being any one of the N terminals;

[0365] obtain a second average loss value of the first terminal in the (t-1)th round of joint training, t being an integer greater than 1;

[0366] calculate a training loss change value of the first terminal according to the first average loss value, the second average loss value and a training iteration number of the first terminal in the (t-1)th round of joint training;

[0367] map the training loss change value of the first terminal to a preset interval to obtain a convergence contribution value of the first terminal.

[0368] In another implementation, the electronic device is a terminal, and the processor 1000 is configured to read a program in the memory 1020 and perform the following steps:

[0369] send training information in the tth round of joint training to a server through the transceiver 1010, so that the server determines a multi-objective optimization parameter according to the training information, and determines a target training iteration number of the terminal by optimizing the multi-objective optimization parameter, wherein the training information includes training data set information, training time information and a convergence contribution value, the convergence contribution value is related to a training loss change value, N is an integer greater than 1, and t is a positive integer;

[0370] receive the target training iteration number sent by the server;

[0371] perform the (t+1)th round of joint training based on the target training iteration number.

[0372] The electronic device provided by the embodiments of the present application can execute the above-mentioned method embodiments, and the implementation principles and technical effects are similar, and the present embodiment will not be repeated here.

[0373] In addition, the computer readable storage medium of the embodiments of the present application is used to store a computer program, and the computer program can be executed by the processor to perform each step in the federated learning method shown in the above Figure 3 or Figure 7 .

[0374] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other manners. For example, the described device embodiments are merely illustrative. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

[0375] In addition, each function unit in the embodiments of the present application can be integrated into a processing unit, or each unit can be physically separated, or two or more than two units are integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software function units.

[0376] The integrated unit implemented in the form of software function units can be stored in a computer readable storage medium. The above software function unit stored in a storage medium includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute part of the steps of the transceiving method described in the embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0377] The above is the preferred embodiment of the present application. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.

Claims

1. A federated learning method, characterized in that, Executed by the server, the method includes: Obtain training information for N terminals in the t-th round of joint training, wherein the joint training is based on training tasks for training neural network models, including face recognition, object detection, and image classification, and the training information includes training dataset information, training time information, and convergence contribution value. The convergence contribution value is related to the change value of training loss and is used to evaluate the contribution of the terminals to global convergence in the t-th round of joint training. The convergence contribution value is calculated based on the change value of training loss, where N is an integer greater than 1 and t is a positive integer. Based on the training dataset information, training time information, and convergence contribution value, multi-objective optimization parameters are determined. The multi-objective optimization parameters include training idle time and convergence contribution sum. The training idle time is the difference between the longest and shortest time taken to complete one round of training among the N terminals. The convergence contribution sum is the sum of the convergence contribution values ​​made by the N terminals in completing one round of training. The target number of training iterations for each of the N terminals is determined with minimizing the training idle time as the first optimization objective and maximizing the convergence contribution as the second optimization objective. Each of the N terminals sends its own target training iteration count, which is used by the N terminals in the (t+1)th round of joint training. The server is a cloud server that works with the N terminals to perform joint training, and is used to store and distribute training models and related parameters.

2. The method according to claim 1, characterized in that, The step of determining the multi-objective optimization parameters based on the training dataset information, training time information, and convergence contribution value includes: Based on the training dataset information, determine the initial number of training iterations; Based on the training time information and the current training iteration number, the training time of each of the N terminals is calculated, wherein, in the initial calculation, the current training iteration number is the initial training iteration number; Based on the training time of each of the N terminals, determine the longest training time and the shortest training time; The difference between the longest and shortest training time is determined as the training idle time.

3. The method according to claim 2, characterized in that, The training time information includes iteration calculation time and communication time; The training time of the first terminal is equal to the sum of the first product and the communication time of the first terminal. The first product is equal to the product of the iteration calculation time of the first terminal and the current number of training iterations. The first terminal is any one of the N terminals.

4. The method according to claim 1, characterized in that, The step of determining the multi-objective optimization parameters based on the training dataset information, training time information, and convergence contribution value includes: Based on the training dataset information, determine the initial number of training iterations; Based on the convergence contribution value and the current training iteration number, the sum of convergence contributions of the N terminals is calculated, wherein, in the initial calculation, the current training iteration number is the initial training iteration number.

5. The method according to claim 4, characterized in that, The sum of convergence contributions is equal to the sum of the products of the convergence contribution values ​​of each of the N terminals and the current number of training iterations.

6. The method according to claim 4, characterized in that, The initial number of training iterations is the maximum allowed number of initial training iterations; Before setting the first optimization objective as minimizing the training idle time and the second optimization objective as maximizing the convergence contribution, the method further includes: Based on the sum of convergence contributions of the N terminals obtained in the initial calculation, determine the maximum sum of convergence contributions; Wherein, the second optimization objective is that the sum of convergence contributions equals the sum of maximum convergence contributions.

7. The method according to claim 1, characterized in that, The first optimization objective is that the training idle time is equal to 0.

8. The method according to claim 1, characterized in that, The step of determining the target training iteration number for each of the N terminals, with minimizing the training idle time as the first optimization objective and maximizing the convergence contribution as the second optimization objective, includes: A multi-objective optimization function is constructed based on the training idle time, the sum of convergence contributions, the maximum training idle time, and the sum of maximum convergence contributions. The sum of maximum convergence contributions is determined based on the maximum allowable number of training iterations and the sum of convergence contribution values. The maximum training idle time is determined based on the maximum allowable number of training iterations and the training time information. Calculate the objective value of the multi-objective optimization function, and determine the target training iteration number for each of the N terminals by minimizing the objective value.

9. The method according to claim 8, characterized in that, The multi-objective optimization function is a weighted distance function of the training idle time and the sum of the convergence contributions.

10. The method according to claim 8, characterized in that, The step of calculating the objective value of the multi-objective optimization function and determining the target training iteration number for each of the N terminals with minimizing the objective value as the optimization objective is included: Calculate the objective value L2 of the multi-objective optimization function; If the optimization objective value L2 does not meet the minimization condition, the number of training iterations for the target terminal is reduced. The target terminal is the terminal with the longest current training time among the N terminals, and the current training time is calculated based on the current number of training iterations. Obtain the updated training idle time and convergence contribution; Based on the updated training idle time and convergence contribution, the optimization objective value L2 of the multi-objective optimization function is recalculated; Determine whether the recalculated optimization objective value L2 satisfies the minimization condition; If the recalculated optimization target value L2 does not meet the minimization condition, repeat the step of reducing the number of training iterations of the target terminal until it is determined whether the recalculated optimization target value L2 meets the minimization condition, until the optimization target value L2 meets the minimization condition. If the optimization objective value L2 satisfies the minimization condition, output the current training iteration number of each of the N terminals.

11. The method according to claim 10, characterized in that, The step of reducing the number of training iterations for the target terminal when the optimization objective value does not meet the minimization condition includes: The optimization objective value L2 is assigned to the first optimization objective value L2′ and the maximum optimization objective value L. 2max ; During the current training downtime T idle The minimum value has not been reached, and the current first optimization objective value L2′ is less than or equal to the current maximum optimization objective value L. 2max In this case, the current first optimization objective value L2′ is assigned to the current maximum optimization objective value L. 2max ; Based on the current number of training iterations, determine the target terminal with the longest current training time among the N terminals; Decrement the number of training iterations for the target terminal by 1; After recalculating the optimization objective value L2 of the multi-objective optimization function, and before determining whether the recalculated optimization objective value L2 satisfies the minimization condition, the method further includes: The recalculated optimization objective value L2 is assigned to the first optimization objective value L2′; When the optimization objective value L2 satisfies the minimization condition, the current training iteration number of each of the N terminals is output, including: During the current training downtime T idle The minimum value is reached, or the current first optimization objective value L2′ is greater than the current maximum optimization objective value L. 2max In the case of N terminals, output the current training iteration number of each terminal.

12. The method according to claim 1, characterized in that, The convergence contribution value is determined based on the following method: Obtain the first average loss value of the first terminal in the tth round of joint training, where the first terminal is any one of the N terminals; Obtain the second average loss value of the first terminal in the (t-1)th round of joint training, where t is an integer greater than 1; The training loss change value of the first terminal is calculated based on the first average loss value, the second average loss value, and the number of training iterations of the first terminal in the (t-1)th round of joint training. The training loss change value of the first terminal is mapped to a preset interval to obtain the convergence contribution value of the first terminal.

13. A federated learning method, characterized in that, The method, executed by a terminal, includes: The training information in the t-th round of joint training is sent to the server so that the server can determine the multi-objective optimization parameters based on the training information, and determine the target training iteration number of the terminal by optimizing the multi-objective optimization parameters. The training information includes training dataset information, training time information, and convergence contribution value. The convergence contribution value is related to the change value of training loss. The convergence contribution value is used to evaluate the terminal's contribution to global convergence in the t-th round of joint training. The convergence contribution value is calculated based on the change value of training loss. The multi-objective optimization parameters include training idle time and convergence contribution sum. The training idle time is the difference between the longest and shortest time for N terminals to complete a round of training task. The convergence contribution sum is the sum of the convergence contribution values ​​made by the N terminals in completing a round of training task. N is an integer greater than 1, and t is a positive integer. Receive the target training iteration number sent by the server; Based on the target training iteration number, perform the (t+1)th round of joint training; The joint training is based on training tasks for neural network models, including face recognition, object detection, and image classification. The server is a cloud server that works with the N terminals to perform joint training and is used to store and distribute training models and related parameters.

14. A federated learning device, characterized in that, The federated learning device, located on the server side, includes: The acquisition module is used to acquire training information of N terminals in the t-th round of joint training. The joint training is based on the training task of neural network model training, which includes face recognition, object detection and image classification. The training information includes training dataset information, training time information and convergence contribution value. The convergence contribution value is related to the change value of training loss. The convergence contribution value is used to evaluate the contribution of the terminal to global convergence in the t-th round of joint training. The convergence contribution value is calculated based on the change value of training loss. N is an integer greater than 1 and t is a positive integer. The first determining module is used to determine multi-objective optimization parameters based on the training dataset information, training time information, and convergence contribution value. The multi-objective optimization parameters include training idle time and convergence contribution sum. The training idle time is the difference between the longest and shortest time spent completing one round of training tasks among the N terminals. The convergence contribution sum is the sum of the convergence contribution values ​​made by the N terminals in completing one round of training tasks. The second determining module is used to determine the target number of training iterations for each of the N terminals, with minimizing the training idle time as the first optimization objective and maximizing the convergence contribution as the second optimization objective. The first sending module is used to send the target training iteration number to each of the N terminals respectively, for use by the N terminals in the (t+1)th round of joint training; The server is a cloud server that works with the N terminals to perform joint training, and is used to store and distribute training models and related parameters.

15. A federated learning device, characterized in that, The federated learning device, located on a terminal, includes: The second sending module is used to send training information in the t-th round of joint training to the server, so that the server can determine multi-objective optimization parameters based on the training information, and determine the target training iteration number of the terminal by optimizing the multi-objective optimization parameters. The training information includes training dataset information, training time information, and convergence contribution value. The convergence contribution value is related to the training loss change value. The convergence contribution value is used to evaluate the terminal's contribution to global convergence in the t-th round of joint training. The convergence contribution value is calculated based on the training loss change value. The multi-objective optimization parameters include training idle time and convergence contribution sum. The training idle time is the difference between the longest and shortest time for N terminals to complete a round of training task. The convergence contribution sum is the sum of the convergence contribution values ​​made by the N terminals in completing a round of training task. N is an integer greater than 1, and t is a positive integer. The receiving module is used to receive the target training iteration number sent by the server; The training module performs joint training in the (t+1)th round based on the target training iteration number; The joint training is based on training tasks for neural network models, including face recognition, object detection, and image classification. The server is a cloud server that works with the N terminals to perform joint training and is used to store and distribute training models and related parameters.

16. An electronic device comprising: A transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor; characterized in that the processor is configured to read the program in the memory to implement the steps in the federated learning method as described in any one of claims 1 to 12; or to implement the steps in the federated learning method as described in claim 13.

17. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the federated learning method as described in any one of claims 1 to 12; or implements the steps of the federated learning method as described in claim 13.

Citation Information

Patent Citations

  • Model joint training method and device for protecting privacyPrivacy protection model joint training method and device

    CN111340242A

  • Federal model training method and device, electronic equipment and storage medium

    CN113011602A