A federated learning model training method, device, equipment and storage medium
By exchanging parameter differences and gradient differences in federated learning, the client and server collaboratively adjust model parameters, solving the problems of slow convergence speed and low accuracy caused by non-independent and identically distributed data, and achieving more efficient model training.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNIONPAY
- Filing Date
- 2022-11-11
- Publication Date
- 2026-06-05
AI Technical Summary
Federated learning suffers from slow model convergence and reduced accuracy due to non-independent and identically distributed data.
In each iteration of training of the federated learning model, the client and server adjust the model parameters by exchanging parameter differences and gradient differences. The server comprehensively determines the global parameter control variables for the next round, and the client adjusts the local parameter gradients based on the global parameter control variables, thereby achieving parameter constraints and direction guidance.
It effectively solves the client drift problem, significantly improves the convergence speed and accuracy of federated learning models, and reduces the number of communication times and training iterations.
Smart Images

Figure CN115660115B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model training technology, and in particular to a federated learning model training method, apparatus, device and storage medium. Background Technology
[0002] Federated learning is a distributed framework that decouples data and models, addressing the challenges of data silos and privacy protection. When training models using federated learning, joint modeling can be achieved among participants without data leaving their local environments. The trained federated learning model (also known as a global model) can be shared and deployed among the participants. Federated learning has broad application prospects in fields such as smart healthcare, financial insurance, and the Internet of Things (IoT).
[0003] However, federated learning faces a serious challenge from the problem of non-independent and identically distributed data. This problem means that the data distribution of each participant is not consistent with the global distribution. This inconsistency may lead to slow model convergence and may also impair the accuracy of the model.
[0004] Therefore, improving the convergence speed and accuracy of federated learning models based on non-independent and identically distributed data is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] This application provides a federated learning model training method, apparatus, device, and storage medium to improve the convergence speed and accuracy of federated learning models.
[0006] Firstly, this application provides a federated learning model training method applied to a client, the method comprising:
[0007] During each iteration of training the federated learning model, at least the following steps must be performed:
[0008] Receive the current round global model parameters and current round global parameter control variables of the federated learning model to be trained sent by the server;
[0009] The local model parameters of the currently saved federated learning sub-model are updated using the global model parameters of this round;
[0010] Based on the updated local model parameters and the global parameter control variables for this round, the local parameter gradient is determined; based on the local parameter gradient, the local model parameters for this round are determined; and based on the updated local model parameters, the global sub-parameter gradient is determined.
[0011] Determine the first difference between the local model parameters output in this round and the global model parameters in this round; and determine the second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables from the previous round; send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variables for the next round based on the first difference and the second difference sent by each client.
[0012] In one possible implementation, determining the local parameter gradient based on the updated local model parameters and the current-round global parameter control variables includes:
[0013] The loss value is determined based on the updated local model parameters and sample data;
[0014] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the loss value is corrected.
[0015] The gradient of the local parameters is determined based on the corrected loss value.
[0016] In one possible implementation, correcting the loss value based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round includes:
[0017] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0018] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0019] In one possible implementation, determining the local model parameters for the current round output based on the local parameter gradient includes:
[0020] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0021] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0022] In one possible implementation, correcting the local parameter gradient based on the currently saved local parameter control variables from the previous round and the global parameter control variables for the current round includes:
[0023] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0024] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0025] In one possible implementation, the local model parameters output in this round are determined based on the corrected local parameter gradient and the updated local model parameters, including:
[0026] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0027] In one possible implementation, the method further includes:
[0028] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0029] Secondly, this application provides a federated learning model training method applied to a server, the method comprising:
[0030] During each iteration of training the federated learning model, at least the following steps should be performed:
[0031] If the first difference between the local model parameters of the previous round output and the global model parameters of the previous round sent by each client, and the second difference between the gradient of the global sub-parameters of each client in the previous round and the local parameter control variables of the clients in the previous two rounds are received, the global model parameters and global parameter control variables of the federated learning model to be trained in this round are determined based on the first difference and the second difference.
[0032] The current round's global model parameters and control variables are sent to each client.
[0033] In one possible implementation, determining the current-round global model parameters and control variables for the current-round global parameters of the federated learning model to be trained based on each first difference and second difference includes:
[0034] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0035] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0036] Thirdly, this application provides a federated learning model training system, the system comprising:
[0037] The server is configured to perform at least the following steps during each iteration of training the federated learning model: if it receives a first difference between the local model parameters output in the previous round and the global model parameters in the previous round from each client, and a second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the clients in the previous two rounds, it determines the global model parameters and global parameter control variables of the federated learning model to be trained in the current round based on the first and second differences; and sends the global model parameters and global parameter control variables to each client.
[0038] Each client is configured to perform at least the following steps during each iteration of training the federated learning model: receiving the current-round global model parameters and the current-round global parameter control variables sent by the server; updating the local model parameters of the currently saved federated learning sub-model using the current-round global model parameters; determining the local parameter gradient based on the updated local model parameters and the current-round global parameter control variables; determining the local model parameters output in the current round based on the local parameter gradient; determining the global sub-parameter gradient based on the updated local model parameters; determining a first difference between the local model parameters output in the current round and the current-round global model parameters; and determining a second difference between the global sub-parameter gradient and the currently saved local parameter control variables from the previous round; and sending the first difference and the second difference to the server.
[0039] Fourthly, this application provides a federated learning model training apparatus, the apparatus comprising:
[0040] The receiving module is used to receive the global model parameters and global parameter control variables of the federated learning model to be trained in each round of training from the server during each round of training.
[0041] The update module is used to update the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round;
[0042] The first determining module is used to determine the local parameter gradient based on the updated local model parameters and the global parameter control variables of this round, determine the local model parameters output in this round based on the local parameter gradient, and determine the global sub-parameter gradient based on the updated local model parameters.
[0043] The first sending module is used to determine a first difference between the local model parameters output in the current round and the global model parameters in the current round; and to determine a second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables of the previous round; and to send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variables of the next round based on the first difference and the second difference sent by each client.
[0044] In one possible implementation, the first determining module is specifically used for:
[0045] The loss value is determined based on the updated local model parameters and sample data;
[0046] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the loss value is corrected.
[0047] The gradient of the local parameters is determined based on the corrected loss value.
[0048] In one possible implementation, the first determining module is specifically used for:
[0049] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0050] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0051] In one possible implementation, the first determining module is specifically used for:
[0052] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0053] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0054] In one possible implementation, the first determining module is specifically used for:
[0055] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0056] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0057] In one possible implementation, the first determining module is specifically used for:
[0058] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0059] In one possible implementation, the first determining module is further configured to:
[0060] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0061] Fifthly, this application provides a federated learning model training apparatus, the apparatus comprising:
[0062] The second determining module is used to determine the current global model parameters and current global parameter control variables of the federated learning model during each iteration of training of the federated learning model, based on the first difference between the local model parameters output in the previous round and the global model parameters in the previous round sent by each client, and the second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the client in the previous two rounds.
[0063] The second sending module is used to send the current round global model parameters and the current round global parameter control variables to each client.
[0064] In one possible implementation, the second determining module is specifically used for:
[0065] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0066] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0067] In a sixth aspect, this application provides an electronic device comprising at least a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the steps of any of the methods described above.
[0068] In a seventh aspect, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the methods described above.
[0069] Eighthly, this application provides a computer program product comprising: computer program code that, when run on a computer, causes the computer to perform the steps of any of the methods described above.
[0070] Because the server in this application can comprehensively determine the global parameter control variable for the next round based on the difference between the current round's global sub-parameter gradient sent by each client and the previous round's local parameter control variable, where the local parameter control variable can also be called the client model parameter update direction or the federated learning sub-model parameter update direction, and the global parameter control variable can also be called the federated learning model parameter update direction or the server model parameter update direction, in other words, the server in this application can comprehensively determine the next round's model parameter update direction of the federated learning model based on the current round's global sub-parameter gradient sent by each client and the previous round's client model parameter update direction; in this application, each client can determine the next round's model parameter update direction based on the difference between the current round's global parameter control variable sent by the server. This approach determines the local parameter gradient of the client. In other words, each client can determine its local parameter gradient based on the global model parameter update direction sent by the server for this round, and thus determine the local model parameters output by the client in this round. Based on this, compared with related technologies where each client trains its local federated learning sub-model independently, which is prone to client-drift problems, in this application, each client can constrain each other. Each client can refer to the parameter update direction of other clients during iterative training to adjust the parameters of its local federated learning sub-model, thereby effectively solving the client-drift problem and improving the accuracy of the trained federated learning model.
[0071] In addition, when performing federated learning training based on global parameter control variables, the federated learning sub-model in the client can be pulled back to the vicinity of the ideal update path during each iteration of training. This can significantly reduce the number of communications between the client and the server, as well as the number of iterations of the federated learning model, and significantly improve the convergence speed of the federated learning model. Attached Figure Description
[0072] To more clearly illustrate the implementation methods in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0073] Figure 1 The diagram illustrates the training process of a first federated learning model provided in some embodiments;
[0074] Figure 2 The diagram illustrates the training process of a second federated learning model provided in some embodiments;
[0075] Figure 3The diagram illustrates the training process of a third federated learning model provided in some embodiments;
[0076] Figure 4 The diagram illustrates the training process of the fourth federated learning model provided in some embodiments;
[0077] Figure 5 The diagram illustrates a federated learning model training system provided in some embodiments;
[0078] Figure 6 The diagram shows a schematic of a federated learning model training apparatus provided in some embodiments;
[0079] Figure 7 A schematic diagram of another federated learning model training apparatus provided in some embodiments is shown;
[0080] Figure 8 A schematic diagram of an electronic device structure provided by some embodiments is shown. Detailed Implementation
[0081] To improve the convergence speed and accuracy of federated learning models, this application provides a method, apparatus, device, and medium for training federated learning models.
[0082] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.
[0083] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0084] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0085] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0086] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0088] Figure 1 The diagram illustrates a first-type federated learning model training process provided by some embodiments. This method is applied to a client, which can be, for example, an electronic device such as a PC or mobile terminal. Figure 1 As shown, during each iteration of training the federated learning model, the client must perform at least the following steps:
[0089] S101: Receive the current round global model parameters and current round global parameter control variables of the federated learning model to be trained, sent by the server.
[0090] In one possible implementation, to improve the convergence speed and accuracy of the federated learning model, during any round (e.g., the r-th round) of iterative training of the federated learning model, the server can determine the model parameters of the federated learning model in this round (for ease of description, referred to as the global model parameters of this round, denoted by...). (represented), and the parameter control variables in this round (for ease of description, referred to as the global parameter control variables in this round, denoted by...). (represented), and the determined global model parameters for this round. and the global parameter control variables in this round This is sent to each client (also known as a participant) involved in this round of training. Specifically, it addresses how the server determines the global model parameters for this round. and the global parameter control variables in this round This will be introduced later, and will not be repeated here. The federated learning model can also be called a server model, and the global parameter control variable can be called the parameter update direction of the federated learning model, or the parameter update direction of the server model. Correspondingly, the global parameter control variable in this round... This can also be referred to as the direction of parameter updates for the federated learning model in this round, or the direction of parameter updates for the server model in this round.
[0091] Each client participating in this training round can receive the global model parameters sent by the server. and the global parameter control variables in this round
[0092] S102: Update the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round.
[0093] For ease of description, the model stored in each client is referred to as a federated learning sub-model. For any given client, the global model parameters for this round are received from the server. and the global parameter control variables in this round Then, the global model parameters for this round can be used. The parameters of the currently saved federated learning sub-model (for ease of description, referred to as local model parameters, using...) This means that each client participating in this round of training can update the parameters (also known as weights) of the federated learning sub-model stored locally on its own machine to the global model parameters for this round.
[0094] S103: Based on the updated local model parameters and the global parameter control variables of this round, determine the local parameter gradient, and based on the local parameter gradient, determine the local model parameters output in this round; and based on the updated local model parameters, determine the global sub-parameter gradient.
[0095] In one possible implementation, the current round's global model parameters are used for any client. Local model parameters for the currently saved federated learning sub-model After the update, the updated local model parameters can be used as a basis. That is, the global model parameters in this round and the global parameter control variables in this round Determine the local parameter gradient (for ease of understanding, use...) express).
[0096] In one possible implementation, based on the updated local model parameters and the global parameter control variables in this round Determine the gradient of local parameters The process may include:
[0097] The loss value is determined based on the updated local model parameters and sample data;
[0098] The loss value is corrected based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round.
[0099] The gradient of the local parameters is determined based on the corrected loss value.
[0100] Specifically, for any given client, the sample dataset used to train the federated learning sub-model during this round of iterative training is D. i This means that the sample dataset contains several sample data points i. The loss value (also called the loss function, but for ease of understanding, we'll use...) can be determined based on the updated local model parameters and the sample data i. (Represented by...). For example, when determining the loss value, one could input sample data i into the federated learning sub-model, obtain the recognition result of the federated learning sub-model, and determine the loss value based on the difference between the sample label corresponding to sample data i and the recognition result, etc., which will not be elaborated further here. In one possible implementation, during each round of iterative training of the federated learning model, each client can perform several (for convenience, referred to as K times) sub-trainings on its local federated learning sub-model based on sample data. The loss value for this round of training can be determined based on the sum of the loss values corresponding to each sample data in the K sub-training processes. For convenience, the obtained loss value for this round of training is represented by... express.
[0101] In one possible implementation, to effectively address the client drift problem and improve the convergence speed and accuracy of the federated learning model, for any client, the control variables (for ease of understanding, referred to as...) can be based on the local parameters saved by that client from the previous round. (representation) and global parameter control variables for this round The loss value is corrected. In one possible implementation, the client controls the variables based on the currently saved local parameters from the previous round. and the global parameter control variables in this round When correcting for loss values, one can first determine the local parameter control variables from the previous round. With the global parameter control variables in this round The third difference, namely
[0102] In this context, the federated learning sub-model in the client can also be called the client model, and the local parameter control variables can also be called the client model parameter update direction, or the federated learning sub-model parameter update direction. Correspondingly, the local parameter control variables from the previous round... This can also be referred to as the direction of the previous round's client model parameter updates, or the direction of the previous round's federated learning sub-model parameter updates. In one possible implementation, to effectively address the client drift problem, the previous round's local parameter control variables can be... With the global parameter control variables in this round The difference, i.e. the third difference, is used as the client drift value. The loss value is corrected based on the client drift value, thereby correcting the local parameter gradient of the client based on the client drift value. This allows each client to refer to the parameter update direction of other clients during iterative training to adjust the parameters of the local federated learning sub-model. This can effectively solve the client drift problem, improve the accuracy of the trained federated learning model, and significantly improve the convergence speed of the federated learning model.
[0103] In one possible implementation, the control variables are based on the currently saved local parameters from the previous round. and the global parameter control variables in this round When correcting for the loss value, it can be based on the third difference. And a set loss value adjustment rate (referred to as β for ease of understanding) is used to correct the loss value.
[0104] For example, when correcting the loss value based on the third difference and the set loss value adjustment rate β, one can first determine the global model parameters received in the previous iteration of training (for ease of understanding, these are referred to as...). The difference between the above-mentioned third difference (referred to as the fourth difference for ease of description), i.e. Additionally, the updated local model parameters can be determined. The difference between the fifth and fourth differences (for ease of description, it is called the fifth difference), namely:
[0105]
[0106] Determine the product of the square of the fifth difference and the loss adjustment rate β, i.e.:
[0107]
[0108] In one possible implementation, the loss value can be accurately corrected based on the product of the square of the fifth difference and the loss value adjustment rate β. For example, the sum of the uncorrected loss value and this product can be determined as the corrected loss value. This corrected loss value (for ease of understanding, it will be referred to as the local update function) is used... (indicated), where:
[0109]
[0110] In one possible implementation, the local parameter gradient can be determined based on the corrected loss value. In one possible implementation, a local update function can be used. For local model parameters Find the derivative to obtain the gradient of the local parameters. Right now:
[0111] For any given client, the client obtains the local parameter gradient. Then, gradients based on local parameters can be used. Determine the local model parameters output by the client in this round. In one possible implementation, this is based on the local parameter gradient. When determining the local model parameters for the current output, it is possible to first base them on the currently saved local parameter control variables from the previous round. and the global parameter control variables in this round Correct the gradient of the local parameters. For example, when correcting the gradient of the local parameters, one could first determine the third difference between the local parameter control variable from the previous round and the global parameter control variable from the current round, i.e. Then, based on this third difference and the set drift adjustment rate α, the local parameter gradient is corrected. For example, the product of the third difference and the drift adjustment rate α can be determined, and the difference between the local parameter gradient and this product can be used as the corrected local parameter gradient. That is, the corrected local parameter gradient is:
[0112] In one possible implementation, the local model parameters for the current round of output can be determined based on the corrected local parameter gradient and the updated local model parameters. For example, determining the local model parameters for the current round of output can be achieved by determining the corrected local parameter gradient and a set local learning rate (denoted as η for ease of understanding). local The product of (representation) is then used to determine the local model parameters for the current round's output, based on this product and the updated local model parameters. For example, the updated local model parameters can be determined. The difference between the product and the output is determined as the local model parameter output in this round. It can be:
[0113] In one possible implementation, the client can also determine the global sub-parameter gradient for the current round based on the updated local model parameters (for ease of understanding, use...). (This is an example). For instance, the client can base its response on the updated local model parameters, which is also based on the current round of global model parameters sent by the server. The loss value is determined, and the process for determining the loss value is the same as that described in the previous embodiment, so it will not be repeated here. The loss value obtained for this round of training can also be... This can be referred to as a server-side update subfunction. Sub-functions can be updated via the server side. For local model parameters Find the derivative to obtain the global subparameter gradient. Right now:
[0114] In one possible implementation, the global sub-parameter gradient obtained in this round can be... Determined as the local parameter control variable for this round This is for the client to use in the next round of iterative training, and will not be elaborated on here.
[0115] S104: Determine the first difference between the local model parameters output in this round and the global model parameters in this round; and determine the second difference between the global sub-parameter gradient and the currently saved local parameter control variable from the previous round; send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variable for the next round based on the first difference and the second difference sent by each client.
[0116] In one possible implementation, to improve the convergence speed and accuracy of the federated learning model, the client can determine the local model parameters for the current round's output. With the global model parameters in this round The first difference between them, i.e. In addition, the client can also determine the global subparameter gradient. Compared with the currently saved local parameter control variables from the previous round The second difference between them, i.e.
[0117] In one possible implementation, for each client participating in the current round of iterative training, the client can send its first difference and second difference to the server. After receiving the first and second differences sent by each client, if the federated learning model has not yet met the set convergence condition, the server can determine the global model parameters for the next round of iterative training based on the first and second differences sent by each client (for ease of understanding, these are referred to as the next round global model parameters). (represented) and global parameter control variables (for ease of understanding, referred to as the next round of global parameter control variables, denoted by) express).
[0118] In one possible implementation, when the server determines the global model parameters and control variables for the next round based on the first and second differences sent by each client, it can be based on the first difference from each client and the set global learning rate (denoted as η for ease of understanding). global (Indicates) the global model parameters in this round. The parameters of the global model for the next round are then corrected.
[0119] For example, suppose the set of clients participating in this round of training is N. trains The number of clients participating in this training round is represented by |N|. clients | indicates that the average of the first difference sent by each client can be determined first: Then determine the global learning rate η. global Product of the average of the first differences: Optionally, the global model parameters for this round can be... The sum of this product is used to determine the global model parameters for the next round, i.e.:
[0120] In one possible implementation, the server can base its actions on the second difference sent by each client. The global parameter control variables for this round are adjusted to obtain the global parameter control variables for the next round. For example, the server can first determine the average of the second difference sent by each client: Then, the global parameter control variables for this round... The sum of this average value is determined as the global parameter control variable for the next round. Right now:
[0121]
[0122] Because the server in this application can comprehensively determine the global parameter control variable for the next round based on the difference between the current round's global sub-parameter gradient sent by each client and the previous round's local parameter control variable, where the local parameter control variable can also be called the client model parameter update direction or the federated learning sub-model parameter update direction, and the global parameter control variable can also be called the federated learning model parameter update direction or the server model parameter update direction, in other words, the server in this application can comprehensively determine the next round's model parameter update direction of the federated learning model based on the current round's global sub-parameter gradient sent by each client and the previous round's client model parameter update direction; in this application, each client can determine the next round's model parameter update direction based on the difference between the current round's global parameter control variable sent by the server. This approach determines the local parameter gradient of the client. In other words, each client can determine its local parameter gradient based on the global model parameter update direction sent by the server for this round, and thus determine the local model parameters output by the client in this round. Based on this, compared with related technologies where each client trains its local federated learning sub-model independently, which is prone to client-drift problems, in this application, each client can constrain each other. Each client can refer to the parameter update direction of other clients during iterative training to adjust the parameters of its local federated learning sub-model, thereby effectively solving the client-drift problem and improving the accuracy of the trained federated learning model.
[0123] In addition, when performing federated learning training based on global parameter control variables, the federated learning sub-model in the client can be pulled back to the vicinity of the ideal update path during each iteration of training. This can significantly reduce the number of communications between the client and the server, as well as the number of iterations of the federated learning model, and significantly improve the convergence speed of the federated learning model.
[0124] In addition, the previous round of local parameter control variables in this application With the global parameter control variables in this round The difference can be used as the client drift value. When correcting the local parameter gradient of the client based on the client drift value, each client can refer to the parameter update direction information of other clients in the iterative training process to adjust the parameters of the local federated learning sub-model. This can effectively solve the client drift problem, improve the accuracy of the trained federated learning model, and significantly improve the convergence speed of the federated learning model.
[0125] In addition, this application can also correct the local parameter gradient of the client based on the set drift adjustment rate, which can effectively prevent improper adjustment caused by over-adjustment or under-adjustment, effectively solve the client drift problem, improve the accuracy of the trained federated learning model, and significantly improve the convergence speed of the federated learning model.
[0126] In addition, this application can also correct the client's loss value based on the set loss value adjustment rate, which can effectively prevent improper adjustment caused by over-adjustment or under-adjustment, effectively solve the client drift problem, improve the accuracy of the trained federated learning model, and significantly improve the convergence speed of the federated learning model.
[0127] For ease of understanding, the training process of the federated learning model provided in this application will be explained below through a specific embodiment.
[0128] At the start of training, the server obtains the global model parameters. Setting initial values (Initial values can be 0, etc.) The initial values of the global model parameters are used as the global model parameters for the first round. In addition, the server can also obtain the global parameter control variable z. server Setting initial values (Initial values can be 0, etc.) The initial value of the global parameter control variable is used as the global parameter control variable for the first round. Similarly, the client can obtain the local parameter control variable z. i Setting initial values (The initial value can be 0, etc.), the local parameter control variable z i The initial value is set as the local parameter control variable for the previous round.
[0129] During the first round of iterative training, the server will use the global model parameters from the first round. The first round of global parameter control variables Send it to each client. For each client, the client will send the local model parameters of the currently saved federated learning sub-model. Updated to the global model parameters of the first round. Based on the updated local model parameters and sample data, the corrected loss value is determined. It can be done For local model parameters Find the derivative to obtain the gradient of the local parameters. Right now:
[0130] For each client, the local model parameters output in the first round It can be:
[0131] Additionally, for each client, the global sub-parameter gradient for that client in the first round can also be obtained:
[0132] For the client, the first difference of the client. and the second difference All are sent to the server.
[0133] In addition, the client can The local parameter control variable is determined as the first round.
[0134] After receiving the first and second differences from each client, the server can integrate the parameters of each client's sub-model and, based on the first and second differences, determine the global model parameters to be used for the second round of training of the federated learning model. and the second round of global parameter control variables
[0135] in,
[0136]
[0137] During the second round of iterative training, the server will use the global model parameters from the second round. The first round of global parameter control variables Send it to each client. For each client, the client will send the local model parameters of the currently saved federated learning sub-model. Updated to the second round of global model parameters Based on the updated local model parameters and sample data, the corrected loss value is determined: It can be done For local model parameters Find the derivative to obtain the gradient of the local parameters. Right now:
[0138] For each client, the local model parameters output in the second round. It can be:
[0139] Additionally, for each client, the global sub-parameter gradient for that client in the second round can also be obtained:
[0140] For the client, the first difference of the client. and the second difference All are sent to the server.
[0141] In addition, the client can Determined as the local parameter control variable for the second round
[0142] After receiving the first and second differences from each client, the server can integrate the parameters of each client's sub-model. Based on the first and second differences, it determines the global model parameters to be used during the third round of training of the federated learning model. and the third round of global parameter control variables Among them, the server determines the global model parameters in the third round. and the third round of global parameter control variables The process, and the client receiving the third round of global model parameters. and the third round of global parameter control variables The subsequent training process is similar to the first and second rounds of training described above, and will not be repeated here.
[0143] Assuming that the federated learning model in the server meets the convergence condition after N rounds of iterative training, the server can send the trained federated learning model to each client, and each client can receive and use the federated learning model.
[0144] To facilitate understanding, the federated learning process provided in this application will be explained and illustrated below through a specific embodiment. See also... Figure 2 , Figure 2 The diagram illustrates a second federated learning model training process provided in some embodiments, which includes the following steps:
[0145] S201: The server sends the current round of global model parameters and the current round of global parameter control variables to each client.
[0146] S202: Each client updates the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round.
[0147] S203: Each client determines its local parameter gradient based on the updated local model parameters and the global parameter control variables for this round, and determines the local model parameters for the current round based on the local parameter gradient. Additionally, each client can also determine the global sub-parameter gradient based on the updated local model parameters.
[0148] S204: Each client determines the first difference between the local model parameters output in this round and the global model parameters in this round; and determines the second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables from the previous round; and sends the first and second differences to the server, so that the server determines the next round global model parameters and the next round global parameter control variables of the federated learning model to be trained based on the first and second differences sent by each client, and returns to the loop to execute S201.
[0149] To facilitate understanding, the federated learning process provided in this application will be explained and illustrated below through a specific embodiment. See also... Figure 3 , Figure 3 The diagram illustrates a training process for a third federated learning model provided in some embodiments, which includes the following steps:
[0150] S301: The server sends the current round of global model parameters and the current round of global parameter control variables to each client.
[0151] S302: Each client updates the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round.
[0152] S303: Each client determines the loss value based on the updated local model parameters and sample data; determines the third difference between the currently saved local parameter control variable from the previous round and the global parameter control variable for this round; corrects the loss value based on the third difference and the set loss value adjustment rate; and determines the local parameter gradient based on the corrected loss value.
[0153] S304: Each client determines the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round; based on the third difference and the set drift adjustment rate, the local parameter gradient is corrected; and the product of the corrected local parameter gradient and the set local learning rate is determined; based on this product and the updated local model parameters, the local model parameters output in the current round are determined.
[0154] S305: Each client determines the global sub-parameter gradient based on the updated local model parameters; determines the first difference between the local model parameters output in this round and the global model parameters in this round; and determines the second difference between the global sub-parameter gradient and the currently saved local parameter control variables from the previous round; sends the first and second differences to the server, so that the server determines the next round global model parameters and the next round global parameter control variables of the federated learning model to be trained based on the first and second differences sent by each client, and returns to the loop to execute S301.
[0155] Based on the same technical concept, this application also provides a federated learning model training method, which is applied to a server. Figure 4 The diagram illustrates the training process of the fourth federated learning model provided in some embodiments, such as... Figure 4 As shown, in each iteration of training the federated learning model, the process includes at least the following steps:
[0156] S401: If the first difference between the local model parameters output in the previous round and the global model parameters in the previous round sent by each client, and the second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the clients in the previous two rounds are received, the global model parameters and global parameter control variables of the federated learning model to be trained in this round are determined based on the first difference and the second difference.
[0157] In one possible implementation, taking the third round of training as an example, the server receives the local model parameters from the second round output sent by each client. With the second round of global model parameters The first difference between and the second round of global sub-parameter gradient Compared with the first round of client-side local parameter control variables The second difference between Then, based on the first and second differences sent by each client, the server can determine the global model parameters to be used for the third round of training of the federated learning model. and the third round of global parameter control variables
[0158] In one possible implementation, determining the current-round global model parameters and control variables for the current-round global parameters of the federated learning model to be trained based on each first difference and second difference includes:
[0159] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0160] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0161] The process of determining the global model parameters and control variables for this round is the same as in the above embodiments. For example:
[0162] The parameters of the third-round global model can be calculated using the following formula:
[0163]
[0164] The third round of global parameter control variables can be calculated using the following formula:
[0165] I will not go into details here.
[0166] S402: Send the current round's global model parameters and current round's global parameter control variables to each client.
[0167] Based on the same technical concept, this application also provides a federated learning model training system. Figure 5 The diagram illustrates a federated learning model training system provided by some embodiments, such as... Figure 5 As shown, the system includes:
[0168] Server 51 is configured to perform at least the following steps during each iteration of training the federated learning model: if it receives a first difference between the local model parameters output in the previous round and the global model parameters in the previous round, and a second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the client in the previous two rounds, sent by each client 52, based on the first difference and the second difference, determine the global model parameters and global parameter control variables of the federated learning model to be trained in the current round; and send the global model parameters and global parameter control variables in the current round to each client 52.
[0169] The client 52 is configured to perform at least the following steps during each iteration of training the federated learning model: receiving the current-round global model parameters and the current-round global parameter control variables sent by the server; updating the local model parameters of the currently saved federated learning sub-model using the current-round global model parameters; determining the local parameter gradient based on the updated local model parameters and the current-round global parameter control variables; determining the local model parameters output in the current round based on the local parameter gradient; determining the global sub-parameter gradient based on the updated local model parameters; determining a first difference between the current-round output local model parameters and the current-round global model parameters; and determining a second difference between the global sub-parameter gradient and the currently saved previous-round local parameter control variables; and sending the first difference and the second difference to the server 51.
[0170] In one possible implementation, the server 51 is specifically used for:
[0171] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0172] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0173] In one possible implementation, the client 52 is specifically used for:
[0174] The loss value is determined based on the updated local model parameters and sample data;
[0175] The loss value is corrected based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round.
[0176] The gradient of the local parameters is determined based on the corrected loss value.
[0177] In one possible implementation, the client 52 is specifically used for:
[0178] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0179] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0180] In one possible implementation, the client 52 is specifically used for:
[0181] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0182] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0183] In one possible implementation, the client 52 is specifically used for:
[0184] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0185] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0186] In one possible implementation, the client 52 is specifically used for:
[0187] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0188] In one possible implementation, the client 52 is further configured to:
[0189] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0190] Based on the same technical concept, this application provides a federated learning model training device. Figure 6 The diagram illustrates a federated learning model training apparatus provided in some embodiments, such as... Figure 6 As shown, the device includes:
[0191] The receiving module 61 is used to receive the global model parameters and global parameter control variables of the federated learning model to be trained in each round of training from the server during each round of training of the federated learning model.
[0192] Update module 62 is used to update the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round;
[0193] The first determining module 63 is used to determine the local parameter gradient based on the updated local model parameters and the global parameter control variables of this round, determine the local model parameters output in this round based on the local parameter gradient, and determine the global sub-parameter gradient based on the updated local model parameters.
[0194] The first sending module 64 is used to determine a first difference between the local model parameters output in the current round and the global model parameters in the current round; and to determine a second difference between the global sub-parameter gradient and the currently saved local parameter control variable from the previous round; and to send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variable for the next round based on the first difference and the second difference sent by each client.
[0195] In one possible implementation, the first determining module 63 is specifically used for:
[0196] The loss value is determined based on the updated local model parameters and sample data;
[0197] The loss value is corrected based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round.
[0198] The gradient of the local parameters is determined based on the corrected loss value.
[0199] In one possible implementation, the first determining module 63 is specifically used for:
[0200] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0201] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0202] In one possible implementation, the first determining module 63 is specifically used for:
[0203] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0204] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0205] In one possible implementation, the first determining module 63 is specifically used for:
[0206] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0207] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0208] In one possible implementation, the first determining module 63 is specifically used for:
[0209] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0210] In one possible implementation, the first determining module 63 is further configured to:
[0211] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0212] Based on the same technical concept, this application also provides a federated learning model training device. Figure 7 The diagram illustrates another federated learning model training apparatus provided in some embodiments, such as... Figure 7 As shown, the device includes:
[0213] The second determining module 71 is used to determine the current global model parameters and current global parameter control variables of the federated learning model during each round of iterative training if it receives the first difference between the local model parameters output in the previous round and the global model parameters in the previous round sent by each client, and the second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the client in the previous two rounds, based on the first difference and the second difference.
[0214] The second sending module 72 is used to send the current round global model parameters and the current round global parameter control variables to each client.
[0215] In one possible implementation, the second determining module 71 is specifically used for:
[0216] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0217] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0218] Based on the same technical concept, this application also provides an electronic device. Figure 8 The diagram illustrates a schematic representation of an electronic device structure provided in some embodiments, such as... Figure 8 As shown, the electronic device includes: a processor 81, a communication interface 82, a memory 83, and a communication bus 84, wherein the processor 81, the communication interface 82, and the memory 83 communicate with each other through the communication bus 84.
[0219] The memory 83 stores a computer program, which, when executed by the processor 81, causes the processor 81 to perform the following steps:
[0220] During each iteration of training the federated learning model, at least the following steps must be performed:
[0221] Receive the current round global model parameters and current round global parameter control variables of the federated learning model to be trained sent by the server;
[0222] The local model parameters of the currently saved federated learning sub-model are updated using the global model parameters of this round;
[0223] Based on the updated local model parameters and the global parameter control variables for this round, the local parameter gradient is determined; based on the local parameter gradient, the local model parameters for this round are determined; and based on the updated local model parameters, the global sub-parameter gradient is determined.
[0224] Determine the first difference between the local model parameters output in this round and the global model parameters in this round; and determine the second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables from the previous round; send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variables for the next round based on the first difference and the second difference sent by each client.
[0225] In one possible implementation, the processor 81 is specifically used for:
[0226] The loss value is determined based on the updated local model parameters and sample data;
[0227] The loss value is corrected based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round.
[0228] The gradient of the local parameters is determined based on the corrected loss value.
[0229] In one possible implementation, the processor 81 is specifically used for:
[0230] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0231] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0232] In one possible implementation, the processor 81 is specifically used for:
[0233] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0234] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0235] In one possible implementation, the processor 81 is specifically used for:
[0236] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0237] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0238] In one possible implementation, the processor 81 is specifically used for:
[0239] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0240] In one possible implementation, the processor 81 is further configured to:
[0241] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0242] Based on the same technical concept, this application also provides an electronic device, see still for reference. Figure 8As shown, the electronic device includes: a processor 81, a communication interface 82, a memory 83, and a communication bus 84, wherein the processor 81, the communication interface 82, and the memory 83 communicate with each other through the communication bus 84.
[0243] The memory 83 stores a computer program, which, when executed by the processor 81, causes the processor 81 to perform the following steps:
[0244] During each iteration of training the federated learning model, at least the following steps should be performed:
[0245] If the first difference between the local model parameters of the previous round output and the global model parameters of the previous round sent by each client, and the second difference between the gradient of the global sub-parameters of each client in the previous round and the local parameter control variables of the clients in the previous two rounds are received, the global model parameters and global parameter control variables of the federated learning model to be trained in this round are determined based on the first difference and the second difference.
[0246] The current round's global model parameters and control variables are sent to each client.
[0247] In one possible implementation, the processor 81 is specifically used for:
[0248] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0249] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0250] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0251] Communication interface 82 is used for communication between the above-mentioned electronic device and other devices.
[0252] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0253] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0254] Based on the same technical concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by an electronic device. When the program is run on the electronic device, the electronic device performs the following steps:
[0255] During each iteration of training the federated learning model, at least the following steps must be performed:
[0256] Receive the current round global model parameters and current round global parameter control variables of the federated learning model to be trained sent by the server;
[0257] The local model parameters of the currently saved federated learning sub-model are updated using the global model parameters of this round;
[0258] Based on the updated local model parameters and the global parameter control variables for this round, the local parameter gradient is determined; based on the local parameter gradient, the local model parameters for this round are determined; and based on the updated local model parameters, the global sub-parameter gradient is determined.
[0259] Determine the first difference between the local model parameters output in this round and the global model parameters in this round; and determine the second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables from the previous round; send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variables for the next round based on the first difference and the second difference sent by each client.
[0260] In one possible implementation, determining the local parameter gradient based on the updated local model parameters and the current-round global parameter control variables includes:
[0261] The loss value is determined based on the updated local model parameters and sample data;
[0262] The loss value is corrected based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round.
[0263] The gradient of the local parameters is determined based on the corrected loss value.
[0264] In one possible implementation, correcting the loss value based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round includes:
[0265] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0266] The loss value is corrected based on the third difference and the set loss value adjustment rate.
[0267] In one possible implementation, determining the local model parameters for the current round output based on the local parameter gradient includes:
[0268] Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the gradient of the local parameters is corrected;
[0269] Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
[0270] In one possible implementation, correcting the local parameter gradient based on the currently saved local parameter control variables from the previous round and the global parameter control variables for the current round includes:
[0271] Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round;
[0272] The local parameter gradient is corrected based on the third difference and the set drift adjustment rate.
[0273] In one possible implementation, the local model parameters output in this round are determined based on the corrected local parameter gradient and the updated local model parameters, including:
[0274] Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
[0275] In one possible implementation, the method further includes:
[0276] The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
[0277] Based on the same technical concept, this application also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the following steps:
[0278] During each iteration of training the federated learning model, at least the following steps should be performed:
[0279] If the first difference between the local model parameters of the previous round output and the global model parameters of the previous round sent by each client, and the second difference between the gradient of the global sub-parameters of each client in the previous round and the local parameter control variables of the clients in the previous two rounds are received, the global model parameters and global parameter control variables of the federated learning model to be trained in this round are determined based on the first difference and the second difference.
[0280] The current round's global model parameters and control variables are sent to each client.
[0281] In one possible implementation, determining the current-round global model parameters and control variables for the current-round global parameters of the federated learning model to be trained based on each first difference and second difference includes:
[0282] Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round.
[0283] Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
[0284] The aforementioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in an electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), optical storage such as CDs, DVDs, BDs, HVDs, etc., and semiconductor storage such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs), etc.
[0285] Based on the same technical concept, this application provides a computer program product, which includes: computer program code, which, when run on a computer, causes the computer to implement the method described in any of the above-described method embodiments applied to electronic devices.
[0286] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof, or in whole or in part, as a computer program product. The computer program product includes one or more computer instructions, which, when loaded and executed on a computer, generate, in whole or in part, the processes or functions described in the embodiments of this application.
[0287] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0288] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0289] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0290] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0291] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A federated learning model training method, characterized in that, Applied to a client, the method includes: During each iteration of training the federated learning model, at least the following steps must be performed: Receive the current round global model parameters and current round global parameter control variables of the federated learning model to be trained sent by the server; The local model parameters of the currently saved federated learning sub-model are updated using the global model parameters of this round; Based on the updated local model parameters and the global parameter control variables for this round, the local parameter gradient is determined; based on the local parameter gradient, the local model parameters for this round are determined; and based on the updated local model parameters, the global sub-parameter gradient is determined. Determine the first difference between the local model parameters output in this round and the global model parameters in this round; and determine the second difference between the gradient of the global sub-parameters and the currently saved local parameter control variables from the previous round; send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variables for the next round based on the first difference and the second difference sent by each client; Specifically, the local model parameters for this round of output are determined based on the local parameter gradient, including: Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round; based on the third difference and the set drift adjustment rate, correct the local parameter gradient; Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined.
2. The method according to claim 1, characterized in that, The step of determining the local parameter gradient based on the updated local model parameters and the current round of global parameter control variables includes: The loss value is determined based on the updated local model parameters and sample data; Based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round, the loss value is corrected. The gradient of the local parameters is determined based on the corrected loss value.
3. The method according to claim 2, characterized in that, The step of correcting the loss value based on the currently saved local parameter control variables from the previous round and the global parameter control variables from the current round includes: Determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round; The loss value is corrected based on the third difference and the set loss value adjustment rate.
4. The method according to claim 1, characterized in that, Based on the corrected local parameter gradient and the updated local model parameters, the local model parameters output in this round are determined, including: Determine the product of the corrected local parameter gradient and the set local learning rate; based on this product and the updated local model parameters, determine the local model parameters for this round of output.
5. The method according to claim 1, characterized in that, The method further includes: The gradient of the global sub-parameter is determined as the local parameter control variable for this round.
6. A method for training a federated learning model, characterized in that, Applied to a server, the method includes: During each iteration of training the federated learning model, at least the following steps should be performed: If the first difference between the local model parameters of the previous round output and the global model parameters of the previous round sent by each client, and the second difference between the gradient of the global sub-parameters of each client in the previous round and the local parameter control variables of the clients in the previous two rounds are received, the global model parameters and global parameter control variables of the federated learning model to be trained in this round are determined based on the first difference and the second difference. Send the current round's global model parameters and current round's global parameter control variables to each client; The local model parameters output in the previous round are the global model parameters and global parameter control variables of the federated learning model to be trained sent by the server to each client. This allows each client to update the local model parameters of the currently saved federated learning sub-model using the global model parameters from the previous round. It also allows each client to determine the third difference between the local parameter control variables from the previous two rounds and the global parameter control variables from the previous round. Based on the third difference and a set drift adjustment rate, each client corrects the local parameter gradient. Finally, based on the corrected local parameter gradient and the updated local model parameters, each client determines the local model parameters output in the previous round.
7. The method according to claim 6, characterized in that, The process of determining the current-round global model parameters and control variables for the current-round global parameters of the federated learning model to be trained based on each first difference and second difference includes: Based on each first difference and the set global learning rate, the global model parameters of the previous round are corrected to obtain the global model parameters of the current round. Based on each second difference, the global parameter control variables of the previous round are corrected to obtain the global parameter control variables of the current round.
8. A federated learning model training system, characterized in that, The system includes: The server is configured to perform at least the following steps during each iteration of training the federated learning model: if it receives a first difference between the local model parameters output in the previous round and the global model parameters in the previous round from each client, and a second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the clients in the previous two rounds, it determines the global model parameters and global parameter control variables of the federated learning model to be trained in the current round based on the first and second differences; and sends the global model parameters and global parameter control variables to each client. Each client, during each iteration of training of the federated learning model, performs at least the following steps: receiving the current-round global model parameters and control variables from the server; updating the local model parameters of the currently saved federated learning sub-model using the current-round global model parameters; determining the local parameter gradient based on the updated local model parameters and the current-round global parameter control variables; determining the local model parameters output in this round based on the local parameter gradient; and determining the global sub-parameter gradient based on the updated local model parameters; and determining the local model parameters output in this round and the control variables. The process involves: determining the first difference between the global model parameters in this round; determining the second difference between the global sub-parameter gradient and the currently saved local parameter control variable from the previous round; sending the first and second differences to the server; and determining the local model parameters output in this round based on the local parameter gradient, which includes: determining the third difference between the local parameter control variable from the previous round and the global parameter control variable in this round; correcting the local parameter gradient based on the third difference and a set drift adjustment rate; and determining the local model parameters output in this round based on the corrected local parameter gradient and the updated local model parameters.
9. A federated learning model training device, characterized in that, The device includes: The receiving module is used to receive the global model parameters and global parameter control variables of the federated learning model to be trained in each round of training from the server during each round of training. The update module is used to update the local model parameters of the currently saved federated learning sub-model using the global model parameters of this round; The first determining module is used to determine the local parameter gradient based on the updated local model parameters and the global parameter control variables of this round, determine the local model parameters output in this round based on the local parameter gradient, and determine the global sub-parameter gradient based on the updated local model parameters. The first sending module is used to determine a first difference between the local model parameters output in the current round and the global model parameters in the current round; and to determine a second difference between the global sub-parameter gradient and the currently saved local parameter control variable from the previous round; and to send the first difference and the second difference to the server, so that the server determines the global model parameters and the global parameter control variable for the next round based on the first difference and the second difference sent by each client. The first determining module is specifically used to determine the third difference between the local parameter control variable of the previous round and the global parameter control variable of the current round; to correct the local parameter gradient based on the third difference and the set drift adjustment rate; and to determine the local model parameters output in the current round based on the corrected local parameter gradient and the updated local model parameters.
10. A federated learning model training device, characterized in that, The device includes: The second determining module is used, during each iteration of training of the federated learning model, if it receives a first difference between the local model parameters output in the previous round and the global model parameters in the previous round sent by each client, and a second difference between the gradient of the global sub-parameters in the previous round and the local parameter control variables of the client in the previous two rounds, it determines the global model parameters and global parameter control variables of the federated learning model to be trained in the current round based on the first and second differences; wherein, the local model parameters output in the previous round are the global model parameters and global parameter control variables of the federated learning model to be trained in the previous round sent by each client to the server, so that each client updates the local model parameters of the currently saved federated learning sub-model using the global model parameters in the previous round, so that each client determines a third difference between the local parameter control variables in the previous two rounds and the global parameter control variables in the previous round, so that each client corrects the local parameter gradient based on the third difference and a set drift adjustment rate, and so that each client determines the local model parameters output in the previous round based on the corrected local parameter gradient and the updated local model parameters; The second sending module is used to send the current round global model parameters and the current round global parameter control variables to each client.
11. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, the processor being configured to implement the steps of the method as described in any one of claims 1-7 when executing a computer program stored in the memory.
12. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1-7.