Model training method, system, client and server node, electronic device and storage medium

By adjusting the training method according to the computing performance type of the client nodes in federated learning, fast nodes can be trained directly using the sample set, while slow nodes can be trained by dividing the sample set into sub-sample sets. This solves the problem of idle computing resources and improves resource utilization efficiency.

CN116862025BActive Publication Date: 2026-11-27BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310928680.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2026-11-27
Estimated Expiration
2043-07-26

AI Technical Summary

Technical Problem

In federated learning, due to the differences in computing performance among different client nodes, nodes with higher computing performance need to wait for nodes with lower computing performance to complete training, resulting in idle overall computing resources and affecting resource utilization efficiency.

Method used

By obtaining the time constant sent by the server node and the global model aggregation parameters, the client node type is determined to be either a fast or slow node, and the training method is adjusted according to the node type: fast nodes are trained directly using the sample set, while slow nodes divide the sample set into non-empty sub-sample sets for training, and select a portion of the sub-sample set for training to reduce the time required.

Benefits of technology

This improves the efficiency of computing resource utilization, ensuring that all nodes can complete model training faster and reducing the overall idle computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116862025B_ABST
    Figure CN116862025B_ABST
Patent Text Reader

Abstract

The application provides a model training method, system, client and server node, electronic equipment and storage medium. The method is applied to a client node, and the method comprises the following steps: acquiring a time constant and a global model aggregation parameter of a current training period sent by a server node; updating parameters of a local model of the client node by using the global model aggregation parameter; determining a node type of the client node according to a size comparison between the time constant and a training duration of the client node in a last training period, wherein the node type is specifically a fast node or a slow node; training the updated local model by using a sample set of the client node in the case that the client node is the fast node; and in the case that the client node is the slow node, dividing the sample set into n non-empty sub-sample sets, and selecting p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model, so that the idle of the computing resource is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to model training methods, systems, client and server nodes, electronic devices, and storage media. Background Technology

[0002] Currently, with the rapid development of artificial intelligence technology, large-scale AI models are being applied to various fields such as image analysis, speech recognition, text processing, intelligent recommendation, and security detection. Model training methods, represented by federated learning, have become a new cutting-edge technology hotspot.

[0003] In federated learning model training, a server node connects to multiple client nodes, and these client nodes and the server node collaborate to complete the model training. However, due to differences in computational performance among different client nodes, during this collaborative training process, client nodes with relatively higher computational performance can complete their training tasks faster. This often results in these client nodes having to wait for client nodes with relatively lower computational performance to complete their training tasks, leading to idle overall computing resources and affecting the efficiency of computing resource utilization. Summary of the Invention

[0004] The purpose of this application is to provide a model training method, system, client and server nodes, electronic devices and storage media to solve the problems of the prior art.

[0005] A first aspect of this application provides a model training method, the method being applied to a client node, the method comprising:

[0006] Obtain the time constant and global model aggregation parameters for the current training cycle sent by the server node;

[0007] The parameters of the local model of the client node are updated using the global model aggregation parameters;

[0008] The node type of the client node is determined by comparing the time constant with the training duration of the client node in the most recent training cycle. Specifically, the node type is either a fast node or a slow node.

[0009] If the client node is a fast node, the updated local model is trained using the sample set of the client node; or,

[0010] When the client node is a slow node, the sample set is divided into n non-empty sub-sample sets, and p non-empty sub-sample sets are selected from the n non-empty sub-sample sets to train the updated local model, where n is a positive integer greater than 1, p is a positive integer greater than or equal to 1, and n is greater than p.

[0011] In one embodiment, the method further includes: calculating a value of n by using the ratio of the training duration to the time constant, wherein the value of n is greater than or equal to the ratio; and,

[0012] Dividing the sample set into n non-empty sub-sample sets specifically includes: dividing the sample set into n non-empty sub-sample sets on an average basis.

[0013] In one embodiment, the method further includes: calculating the value of p by multiplying the value of n by the ratio of the time constant to the training duration and rounding down.

[0014] In one embodiment, selecting p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model specifically includes:

[0015] For the n non-empty sub-sample sets, determine the total number of training rounds that each non-empty sub-sample set has participated in in previous training cycles;

[0016] Based on the selection order of the total number of training rounds from smallest to largest, select p non-empty sample sets from the n non-empty sample sets;

[0017] The updated local model is trained using the selected p non-empty subsample sets.

[0018] In one embodiment, when the client node is a fast node, the method further includes:

[0019] Obtain the training duration of this training cycle and the update gradient of the parameters of the local model in the client node;

[0020] The training duration and the update gradient are sent to the server node.

[0021] In one embodiment, when the client node is a slow node, the method further includes:

[0022] Determine the actual training time for training the updated local model by selecting the p non-empty subsample sets;

[0023] Based on the actual training time and the proportion of the total number of samples in the p non-empty sub-sample sets to the total number of samples in the sample set, the training time when training the updated local model with the sample set is calculated and used as the training time for this training cycle.

[0024] In one embodiment, when the client node is a slow node, the method further includes calculating the update gradient of the local model parameters of the client node in the current training cycle using the following formula:

[0025]

[0026] Where i is the number of the client node; k is the round number of the current training cycle; p represents the update gradient of the local model parameters of the client node in this training cycle; i The number of non-empty subsample sets selected in the client node; G represents the actual update gradient of the local model parameters for the j-th non-empty subsample set during this training cycle. ij This refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. This is an estimate of the average gradient of each non-empty subsample set in the dataset of the client node.

[0027] A second aspect of this application provides a model training method, the method being applied to a server node, the method comprising:

[0028] Obtain the number of samples in the sample set, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle for each client node.

[0029] Calculate the global model aggregation parameters for the current training cycle using the global model aggregation parameters from the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient from the most recent training cycle.

[0030] Calculate the time constant for the current training cycle by using the number of samples in the sample set of each client node and the training duration of the most recent training cycle.

[0031] Send the time constant and global model aggregation parameters for the current training cycle to each client node respectively.

[0032] A third aspect of this application provides a client node, including:

[0033] The acquisition unit is used to acquire the time constant and global model aggregation parameters of the current training cycle sent by the server node;

[0034] An update unit is used to update the parameters of the local model of the client node using the global model aggregation parameters;

[0035] The comparison unit is used to determine the node type of the client node by comparing the time constant with the training duration of the client node in the most recent training cycle. The node type is specifically a fast node or a slow node.

[0036] The first training unit is used to train the updated local model using the sample set of the client node when the client node is a fast node; or,

[0037] The second training unit is used to divide the sample set into n non-empty sub-sample sets when the client node is a slow node, and select p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model, where n is a positive integer greater than 1, p is a positive integer greater than or equal to 1, and n is greater than p.

[0038] A fourth aspect of this application provides a server node, including:

[0039] The second acquisition unit is used to acquire the number of samples in the sample set of each client node, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle.

[0040] The global model aggregation parameter calculation unit is used to calculate the global model aggregation parameters for the current training cycle using the global model aggregation parameters from the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient from the most recent training cycle.

[0041] The time constant calculation unit is used to calculate the time constant of the current training cycle by using the number of samples in the sample set of each client node and the training duration of the most recent training cycle.

[0042] The sending unit is used to send the time constants and global model aggregation parameters for the current training cycle to each client node.

[0043] A fifth aspect of this application provides a model training system, including a server node and multiple client nodes connected to the server node, wherein:

[0044] The server node includes: a second acquisition unit, used to acquire the number of samples in the sample set of each client node, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle; a global model aggregation parameter calculation unit, used to calculate the global model aggregation parameters of the current training cycle using the global model aggregation parameters of the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient of the most recent training cycle; a time constant calculation unit, used to calculate the time constant of the current training cycle using the number of samples in the sample set of each client node and the training duration of the most recent training cycle; and a sending unit, used to send the time constant of the current training cycle and the global model aggregation parameters to each client node respectively.

[0045] The client node includes: an acquisition unit for acquiring the time constant and global model aggregation parameters of the current training cycle sent by the server node; an update unit for updating the parameters of the local model of the client node using the global model aggregation parameters; a comparison unit for determining the node type of the client node by comparing the time constant with the training duration of the client node in the most recent training cycle, wherein the node type is specifically a fast node or a slow node; a first training unit for training the updated local model using the sample set of the client node when the client node is a fast node; or, a second training unit for dividing the sample set into n non-empty sub-sample sets when the client node is a slow node, and selecting p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model, wherein n is a positive integer greater than 1, p is a positive integer greater than or equal to 1, and n is greater than p.

[0046] A sixth aspect of this application provides an electronic device, including:

[0047] processor;

[0048] A memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in any one of the embodiments of this application.

[0049] A seventh aspect of this application provides a storage medium storing a computer program that can be executed by a processor to perform the method described in any one of the embodiments of this application.

[0050] The model training method provided in this application includes first obtaining the time constant and global model aggregation parameters of the current training cycle sent by the server node, then updating the parameters of the local model of the client node using the global model aggregation parameters, and then determining the node type of the client node by comparing the time constant with the training duration of the client node in the most recent training cycle. Specifically, if the client node is a fast node, the updated local model is trained using the sample set of the client node; or if the client node is a slow node, the sample set is divided into n non-empty sub-sample sets, and p non-empty sub-sample sets are selected from the n non-empty sub-sample sets to train the updated local model. Therefore, this method reduces the number of samples used by slow nodes to train the model, allowing slow nodes to complete model training relatively faster, thus reducing the overall idle computing resources and improving the utilization efficiency of computing resources. Attached Figure Description

[0051] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 A schematic diagram of the specific structure of a heterogeneous federated learning system provided in an embodiment of this application;

[0053] Figure 2 A schematic diagram illustrating the specific process of a federated learning model training method provided in an embodiment of this application;

[0054] Figure 3 A schematic diagram of the specific process of a model training method provided in one embodiment of this application;

[0055] Figure 4 A schematic diagram of the specific process of a model training method provided in one embodiment of this application;

[0056] Figure 5 A schematic diagram of the specific structure of a client node provided in one embodiment of this application;

[0057] Figure 6 A schematic diagram of the specific structure of a server node provided in one embodiment of this application;

[0058] Figure 7 A schematic diagram of the specific structure of a model training system provided in one embodiment of this application;

[0059] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0060] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. In the description of this application, terms such as "first," "second," and "third" are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance or order.

[0061] As mentioned earlier, in federated learning model training methods, due to the differences in computational performance among different client nodes, during collaborative training, client nodes with relatively high computational performance can complete their own training tasks faster. This often leads to these client nodes having to wait for client nodes with relatively low computational performance to complete their training tasks, resulting in the overall idleness of computing resources and affecting the utilization efficiency of computing resources.

[0062] In view of this, embodiments of this application provide a model training method, apparatus, electronic device, and storage medium that can reduce the idleness of overall computing resources and thereby improve the utilization efficiency of computing resources.

[0063] like Figure 1 The diagram shown is a schematic representation of a heterogeneous federated learning system provided in an embodiment of this application. This system includes a server node 1 and multiple client nodes 2. The server node 1 connects to each client node 2, enabling the server node 1 to communicate with each client node 2. Each client node 2 stores its own sample set, and the sample sets (including the number of samples in each sample set) are typically different between different client nodes 2. Furthermore, each client node 2 stores its own local model, while the server node 1 stores the global model.

[0064] Here, we can first briefly explain the model training method of federated learning, combined with... Figure 2 As shown, in the federated learning model training method, training can be carried out through multiple training cycles. For example, in the first training cycle, server node 1 sends the first parameter of the first training cycle to each client node 2. After obtaining the first parameter, each client node 2 trains its own local model based on the first parameter and its own sample set. After completing the training, it feeds back the second parameter to the server. Server node 1 updates its own global model based on the second parameter fed back by each client node 2 and generates the first parameter of the second training cycle. This completes the model training of the first training cycle.

[0065] Then, in the second training cycle, server node 1 sends the first parameter of the second training cycle to each client node 2. After receiving the first parameter, each client node 2 trains its local model again using its own sample set based on the first parameter, and feeds back the second parameter to the server after completing the training. Server node 1 updates its global model again based on the second parameter fed back by each client node 2, and generates the first parameter of the third training cycle. This completes the model training for the second training cycle. And so on, model training is carried out for the third to Nth training cycles until the training termination condition is met.

[0066] Here, the first parameter refers to the data sent from server node 1 to client node 2, and the second parameter refers to the data sent from client node 2 to server node 1. The specific data included in the first and second parameters will be explained in detail in subsequent embodiments. Furthermore, for the Nth training cycle, the number of rounds in this training cycle is N.

[0067] like Figure 3 The diagram illustrates a model training method provided in this embodiment. This method is applied to client node 2 in the aforementioned heterogeneous federated learning system. It can train a local model within client node 2 and, during the training process, reduce the idle resources of the overall computing resources of the heterogeneous federated learning system, thereby improving the utilization efficiency of computing resources. The client node 2 applying this method can be any one or more client nodes in the heterogeneous federated learning system. For example, each client node 2 in the heterogeneous federated learning system trains its own local model using this method. The method specifically includes the following steps:

[0068] Step S31: Obtain the time constant and global model aggregation parameters for this training cycle sent by the server node.

[0069] Here, "current training cycle" can refer to any training cycle from the second training cycle to the Nth training cycle. For example, if the current training cycle is the 10th training cycle, then the most recent training cycle is the 9th training cycle (that is, the most recent training cycle among the previous training cycles).

[0070] During this training cycle, the server node sends the first parameter, namely the time constant and the global model aggregation parameters for this training cycle, to each client node. Correspondingly, the client nodes can obtain the time constant and global model aggregation parameters for this training cycle sent by the server node.

[0071] Step S32: Update the parameters of the local model of the client node using the global model aggregation parameters.

[0072] In step S31 above, the client node obtains the time constant and global model aggregation parameters for the current training cycle. Therefore, in step S32, the global model aggregation parameters are further used to update the parameters of the client node's own local model. For example, the parameters of the client node's own local model are updated to the global model aggregation parameters.

[0073] Step S33: Based on the comparison between the time constant and the training duration of the client node in the most recent training cycle, determine the node type of the client node. If it is a fast node, proceed to step S34; if it is a slow node, proceed to step S35.

[0074] Specifically, the node type is either a fast node or a slow node. For example, if the time constant is less than the training time of the client node in the most recent training cycle, it indicates that the client node took a relatively long time in the most recent training cycle and its training speed was relatively slow. In this case, the node type of the client node is a slow node. Alternatively, if the time constant is greater than or equal to the training time of the client node in the most recent training cycle, it indicates that the client node took a relatively short time in the most recent training cycle and its training speed was relatively fast. In this case, the node type of the client node is a fast node.

[0075] Therefore, in step S33, the time constant can be compared with the training duration of the client node in the most recent training cycle. If the time constant is less than the training duration, the node type of the client node can be determined to be a slow node; otherwise, if the time constant is greater than or equal to the training duration, the node type of the client node can be determined to be a fast node.

[0076] Step S34: If the client node is a fast node, train the updated local model using the sample set of the client node.

[0077] As mentioned above, if the time constant is greater than or equal to the training time of the client node in the most recent training cycle, then the client node is a fast node. This also indicates that the client node took a relatively short time in the most recent training cycle and trained relatively quickly. Therefore, in this training cycle, the sample set of the client node is used to train the updated local model.

[0078] The updated local model is trained using the sample set of the client node. Specifically, this can be done by using samples from the client node's sample set (usually all samples in the set) to train the updated local model. During this training process, for example, all samples in the sample set can be input into the local model, and an algorithm such as gradient descent can be used to perform m iterations of training on the local model. Thus, the local model is trained in this training cycle. The value of m can typically be set according to actual needs; for example, m can be 3, 4, 5, 6, or other values.

[0079] Of course, after training the local model in this training cycle, the client node also needs to feed back a second parameter to the server node. In this embodiment, the second parameter includes the training duration of this training cycle and the update gradient of the parameters of the local model in the client node. Therefore, the method may further include obtaining the training duration of this training cycle and the update gradient of the parameters of the local model in the client node, and then sending the obtained training duration and update gradient to the server node.

[0080] For example, when using the gradient descent algorithm to train the local model for m iterations, the total time taken for the m iterations can be obtained as the training duration of the current training cycle; and for the local model in the client node, the update gradient of the parameters of the local model in the client node can be calculated using the formula related to the update gradient of the model parameters.

[0081] Step S35: When the client node is a slow node, divide the sample set into n non-empty sub-sample sets, and select p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model.

[0082] As mentioned above, if the time constant is less than the training time of the client node in the most recent training cycle, then the client node is a slow node. This also indicates that the client node took a relatively long time in the most recent training cycle and its training speed was relatively slow. Therefore, in this training cycle, only a portion of the samples in the sample set of the client node is used to train the updated local model, thereby reducing the training time of the model.

[0083] In step S35, n is a positive integer greater than 1, p is a positive integer greater than or equal to 1, and n is greater than p. For example, n can be 2 and p can be 1; or n can be 3 and p can be 1 or 2, etc. Specifically, a non-empty subset refers to a subset containing at least one sample.

[0084] In practical applications, the specific value of n can be set to a fixed positive integer greater than 1, and the specific value of p can also be set to a positive integer greater than or equal to 1 and less than n. This approach has a lower implementation cost, but it can easily lead to a decrease in the utilization rate of the sample set.

[0085] To improve the utilization rate of samples in the sample set of this client node, the values ​​of n and p can be set in the following way. For example, the value of n can be calculated by the ratio of the training duration of the client node in the most recent training cycle to the time constant, where the value of n is greater than or equal to the ratio, that is, the value of n can be calculated by formula one.

[0086]

[0087] In Formula 1, i is the ID of the client node in the heterogeneous federated learning system; n i For the calculated value of n for the client node numbered i; T i For the client node with ID i, the training duration in the most recent training cycle; T th This is the time constant for this training cycle.

[0088] At this point, due to the time constant T th Less than the training duration T i ,therefore Greater than 1; therefore, in practical applications, for this n i The specific size can be determined by... Round down to the nearest integer, then add 1, 2, or another positive integer to the rounded value to obtain n. i The specific value to be taken.

[0089] Accordingly, the value of p can be calculated in the following way. For example, by multiplying the value of n by the ratio of the time constant to the training duration and rounding down, the value of p can be calculated. That is, the value of p can be calculated using Formula 2.

[0090]

[0091] Similarly, in Formula 2, i is the ID of the client node in the heterogeneous federated learning system; p i For the calculated value of p for the client node numbered i; T i For the client node with ID i, the training duration in the most recent training cycle; T th n is the time constant for this training cycle; i For the client node numbered i, n can take any value. iIt can be calculated using the formula above; This is the floor operator.

[0092] Therefore, the values ​​of n and p can be calculated using Formula 1 and Formula 2 above. After calculating the value of n using Formula 1, the specific implementation of dividing the sample set into n non-empty sub-sample sets can typically be to divide the sample set into n non-empty sub-sample sets on an equal basis, so that the number of samples in each non-empty sub-sample set is equal or approximately equal.

[0093] Thus, one specific way to select p non-empty sub-sample sets from n non-empty sub-sample sets is to randomly select p non-empty sub-sample sets from the n non-empty sub-sample sets. This random selection method has a low implementation cost, but it is easy to cause some samples to have fewer training times, while other samples have more training times, resulting in an imbalance in the number of training times among the samples.

[0094] A second specific method for selecting p non-empty sub-sample sets from n non-empty sub-sample sets is to first determine the total number of training rounds each non-empty sub-sample set has participated in in previous training cycles, and then select p non-empty sub-sample sets from the n non-empty sub-sample sets in ascending order of the total number of training rounds. This allows the selection of p non-empty sub-sample sets with the smallest total number of training rounds from the n non-empty sub-sample sets. Then, the selected p non-empty sub-sample sets are used to train the updated local model, thereby balancing the number of training rounds among the samples.

[0095] The specific method for selecting p non-empty sub-sample sets from the n non-empty sub-sample sets according to the order of the total number of training rounds from smallest to largest can be as follows: First, sort the n non-empty sub-sample sets according to the order of the total number of training rounds from smallest to largest (e.g., using a bubble sorting method), and then select the p non-empty sub-sample sets that are at the top of the sort; or first, sort the n non-empty sub-sample sets according to the order of the total number of training rounds from largest to smallest, and then select the p non-empty sub-sample sets that are at the bottom of the sort.

[0096] Regarding the specific methods for selecting p non-empty subsets from n non-empty subsets, the first method mentioned above has a lower implementation cost but is prone to causing an imbalance in the number of training iterations among the samples, while the second method can balance the number of training iterations among the samples. However, considering practical applications, when the number of training rounds is small, using the first method for random selection is prone to causing an imbalance in the number of training iterations, while when the number of training rounds is large, random selection is less likely to cause an imbalance in the number of training iterations.

[0097] Therefore, these two methods can be combined to obtain a third implementation. In this third implementation, it can be first determined whether the number of training rounds in the current training cycle is greater than a preset value. If it is greater than the preset value, it means that there are too many training rounds, and the first implementation method described above can be used; conversely, if it is less than or equal to the preset value, it means that there are too few training rounds, and the second implementation method described above can be used. Therefore, this third implementation method comprehensively considers the issues of sample balance and implementation cost, thereby comprehensively reducing implementation cost and sample imbalance. Specifically, for the number of training rounds in the current training cycle, for example, if the current training cycle is the 5th training cycle, then the number of training rounds is 5; if the current training cycle is the Nth training cycle, then the number of training rounds is N.

[0098] Specifically, for each of the n non-empty sub-sample sets, the total number of training rounds that each non-empty sub-sample set has participated in during previous training cycles is determined. This total number of training rounds reflects how many training rounds the samples in the corresponding non-empty sub-sample set have participated in during previous training cycles. For example, if the total number of training rounds is larger, it means that the samples in the corresponding non-empty sub-sample set have participated in more training rounds during previous training cycles; conversely, if the total number of training rounds is smaller, it means that the samples in the corresponding non-empty sub-sample set have participated in fewer training rounds during previous training cycles.

[0099] Therefore, in practical applications, for each of the n non-empty sub-sample sets, the total number of training rounds that each non-empty sub-sample set has participated in during previous training cycles can be determined. Specifically, this can be achieved as follows: for each of the n non-empty sub-sample sets, first obtain the total number of training rounds that each sample in the non-empty sub-sample set has participated in during previous training cycles, and then sum the total number of training rounds that each sample in the non-empty sub-sample set has participated in during previous training cycles to obtain the total number of training rounds that the non-empty sub-sample set has participated in during previous training cycles.

[0100] Of course, after determining the total number of training rounds that each non-empty sub-sample set has participated in during previous training cycles using this method, the index of the non-empty sub-sample set can be stored in an index set, and the corresponding round record parameters can be constructed. This is used to record the total number of training rounds that the non-empty subsample set has participated in during previous training rounds. The elements in this sequence set are the indices of each non-empty subsample set obtained in previous training rounds; these indices uniquely represent the corresponding non-empty subsample set.

[0101] Furthermore, for each of the n non-empty sub-sample sets, the total number of training rounds in which each non-empty sub-sample set has participated in previous training cycles is determined. This can be achieved by first obtaining a set of indices, and then, for each of the n non-empty sub-sample sets, determining whether the indices of that non-empty sub-sample set are included in the indices set. If so, it means that the non-empty sub-sample set has been generated in previous training cycles, and thus the round record parameters corresponding to that non-empty sub-sample set can be obtained. This allows us to obtain the total number of training rounds that the non-empty subsample set has participated in during previous training cycles; or, if not, it indicates that the non-empty subsample set is a new non-empty subsample set, which can be obtained by first obtaining the total number of training rounds that each sample in the non-empty subsample set has participated in during previous training cycles, and then summing the total number of training rounds that each sample in the non-empty subsample set has participated in during previous training cycles, thus obtaining the total number of training rounds that the non-empty subsample set has participated in during previous training cycles.

[0102] It should be noted that after selecting p non-empty subsample sets, these p non-empty subsample sets can be used to train the updated local model. During this training process, samples from the p non-empty subsample sets can be input into the local model, and an algorithm such as gradient descent can be used to perform m iterations of training on the local model, thereby achieving the training of the local model in this training cycle. The value of m can be the same as the value of m in step S34 above, which will not be elaborated further here.

[0103] The model training method provided in this application includes first obtaining the time constant and global model aggregation parameters of the current training cycle sent by the server node, then updating the parameters of the local model of the client node using the global model aggregation parameters, and then determining the node type of the client node by comparing the time constant with the training duration of the client node in the most recent training cycle. Specifically, if the client node is a fast node, the updated local model is trained using the sample set of the client node; or if the client node is a slow node, the sample set is divided into n non-empty sub-sample sets, and p non-empty sub-sample sets are selected from the n non-empty sub-sample sets to train the updated local model. Therefore, this method reduces the number of samples used by slow nodes to train the model, allowing slow nodes to complete model training relatively faster, thus reducing the overall idle computing resources and improving the utilization efficiency of computing resources.

[0104] As mentioned above, in the federated learning model training method, after the client node completes the training of its own local model in each training cycle, it needs to feed back a second parameter to the server node. In this embodiment, the second parameter includes the training duration of the current training cycle and the update gradient. Therefore, when the client node is a slow node, after executing step S35 above, the method may further include obtaining the training duration of the current training cycle and the update gradient of the parameters of the local model in the client node through the following method:

[0105] First, the actual training time and actual update gradient of the selected p non-empty sub-sample sets for training the updated local model can be determined. For example, the actual training time can be obtained as the total time taken for m iterations of training when the samples in the p non-empty sub-sample sets are input into the local model and the gradient descent algorithm is used to train the local model. Then, for the local model in the client node, the actual update gradient of the parameters of the local model in the client node can be calculated using the relevant calculation formula of the update gradient of the model parameters.

[0106] After determining the actual training duration and the actual update gradient, the training duration for training the updated local model with the sample set can be calculated based on the actual training duration and the proportion of the total number of samples in the p non-empty subsample sets to the total number of samples in the sample set. This training duration can be used as the training duration for the current training cycle. For example, the training duration can be calculated using Formula 3.

[0107] T i =TP i ×1 / Q i Formula 3

[0108] In Formula 3, i is the ID of the client node in the heterogeneous federated learning system; TP i For client node number i, the calculated actual training duration; Q i Let i be the percentage of the total number of samples in the p non-empty subsample sets in the total number of samples in the sample set.

[0109] Among them, Q represents the proportion of the total number of samples in the p non-empty subsample sets to the total number of samples in the sample set. i The calculation method, as mentioned above, involves dividing the sample set into n non-empty subsets on average, ensuring that the number of samples in each non-empty subset is equal or substantially equal. This Q... i =p i / n i , where p iLet p be the number of non-empty subsamples selected from the client node with ID i.

[0110] After determining the actual training duration and the actual update gradient, the update gradient of the local model parameters of the client node in this training cycle can be calculated using Formula 4:

[0111]

[0112] In Formula 4, i is the number of the client node in the heterogeneous federated learning system; k is the round number of the current training cycle, for example, the round number of the second training cycle is 2, and the round number of the fifth training cycle is 5. For client node i, the update gradient of the local model parameters in training epoch k (i.e., the current training epoch) is the update gradient of the local model parameters of the client node in the current training epoch; p i p represents the number of non-empty subsample sets selected from the client node with ID i, i.e., the number of non-empty subsample sets selected from the client node. For training epochs of epoch k, the actual update gradient of the parameters of the local model with respect to the j-th non-empty subsample set, where j is the selected p i The index of a non-empty subset; G ij This refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. For the dataset of this client node, the estimated average gradient of each non-empty subset is given, where... It can be calculated using Formula 5.

[0113]

[0114] Therefore, through Formula 4, the update gradient of the local model parameters of the client node in this training cycle can be calculated, and through Formula 3, the training duration of this training cycle can be calculated. Furthermore, the client node can use the update gradient and the training duration as the second parameter and feed them back to the server node, so that the server node can use the second parameter to further update its own global model.

[0115] It should be noted that when calculating the gradient of the local model parameters of the client node in this training cycle using Formula 4 above, the introduction of formula 4... Therefore, the calculated update gradient can be made more accurate.

[0116] like Figure 4The diagram illustrates another embodiment of the model training method provided in this application. This method is applied to a server node connected to a client node in the aforementioned heterogeneous federated learning system. Specifically, the method includes the following steps:

[0117] Step S41: Obtain the number of samples in the sample set, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle for each client node.

[0118] As mentioned above, in the federated learning model training method of this application, in each training cycle, after the client node completes the training of its own local model, it can obtain the update gradient of the parameters of the local model in this training cycle and the training duration of this training cycle, and then feed back the update gradient and training duration to the server node.

[0119] Therefore, in step S41, the specific method for obtaining the training duration and update gradient of the most recent training cycle for each client node can be that after each client node completes the training of its own local model in the most recent training cycle, it sends the update gradient of the parameters of the local model in that most recent training cycle and the training duration of the most recent training cycle to the server node, so that the server node can obtain the training duration and update gradient of the most recent training cycle for each client node.

[0120] Regarding the method for obtaining the sample count of each client node's sample set, in practical applications, since the sample count of each client node's sample set usually doesn't change much in a short period, the server node can obtain the sample count of each client node's sample set in the first training cycle. For example, after a client node completes training its own local model in the first training cycle, it can also feed back the sample count of its own sample set to the server node, allowing the server node to obtain the sample count of that client node's sample set. Furthermore, after obtaining the sample count of each client node's sample set in the first training cycle, the server node can store the sample count of each client node's sample set in a database, and retrieve the sample count of each client node's sample set from the database in subsequent training cycles.

[0121] It should be noted that during the first training cycle, the model usually needs to be initialized, assuming the total number of client nodes is N. c Initialization can be performed as follows: The server node can use methods such as Gaussian randomization to initialize the parameters of its own global model, where the initialization parameter can be w0. ′ Then the initialization parameter Nc Each client node; thus, each client node receives the initialization parameter w0. ′ Then, the initialization parameter w0 can be used. ′ Initialize its own local model.

[0122] Of course, in this first training cycle, since there is no most recent training cycle, the training duration of the most recent training cycle is not stored in each client node. At this time, each client node can use its own sample set (such as all the samples in the sample set) to train the initialized local model, thereby obtaining the training duration of the first training cycle and the update gradient of the parameters of the local model in the first training cycle, and feeding back the training duration and the update gradient to the server node. Of course, it can also feed back the number of samples in its own sample set.

[0123] Step S42: Calculate the global model aggregation parameters for the current training cycle using the global model aggregation parameters from the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient from the most recent training cycle.

[0124] After the server node obtains the number of samples in the sample set of each client node, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle through step S41, in step S42, it calculates the global model aggregation parameters of the current training cycle using the global model aggregation parameters of the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient of the most recent training cycle. For example, formulas six to eight can be used to calculate the global model aggregation parameters of the current training cycle.

[0125]

[0126] In Formula 6, the total number of client nodes is N. c ; i is the ID of the client node; |D i | represents the number of samples in the sample set of the client node with ID i.

[0127]

[0128] In Formula 7, |D T | Calculated using Formula 6 above; This is the gradient update for the client node with ID i in the most recent training cycle; the total number of client nodes is N. c ; i is the client node number; |D i | represents the number of samples in the sample set of the client node with ID i.

[0129]

[0130] In formula eight, w k-1 These are the aggregated parameters of the global model for the most recent training cycle. It can be calculated using Formula 7; η is the learning rate, where 0 < η < 1, and the value of η usually decreases gradually as the number of training rounds increases; w k These are the calculated global model aggregation parameters for this training cycle.

[0131] Of course, after calculating the global model aggregation parameters for this training cycle using formulas six to eight above, the server node can also use these global model aggregation parameters to update its own global model.

[0132] Furthermore, after calculating the global model aggregation parameters for this training cycle, the server node can also determine whether the training termination condition is met. For example, the training termination condition could be that the global model aggregation parameters converge and / or the number of iterations is greater than a preset maximum number of iterations (the preset maximum number of iterations could be 100). For instance, if the global model aggregation parameters converge, it means that the model training has been completed, and the training termination condition can be determined to be met, and the next training cycle can be terminated; or, if the number of iterations is greater than the preset maximum number of iterations, it also means that the model training has been completed, and the training termination condition can be determined to be met, and the next training cycle can be terminated.

[0133] Additionally, it should be noted that after the server node initializes the parameters of its global model, the global model aggregate parameters of its global model are initialized to w′0. Correspondingly, in this first training cycle, each client node trains its initialized local model to obtain the training duration of the first training cycle and the update gradient of the local model parameters during the first training cycle. This training duration and update gradient are then fed back to the server node, along with the sample size of its own sample set. At this point, when the server node calculates the global model aggregate parameters for the second training cycle using formulas six to eight, in formula eight, w′... k-1 Specifically, it is w′0.

[0134] Step S43: Calculate the time constant for the current training cycle using the number of samples in the sample set of each client node and the training duration of the most recent training cycle.

[0135] Since the number of samples in the sample sets of each client node is usually different, directly calculating the time constant of the current training cycle based on the training duration of the most recent training cycle usually does not accurately reflect the training efficiency of each client node. Therefore, in step S43, the time constant of the current training cycle is calculated using the number of samples in the sample sets of each client node and the training duration of the most recent training cycle. For example, for each client node, the training duration of its most recent training cycle can be divided by the number of samples in its own sample set to calculate the average training duration per sample in the most recent training cycle for that client node. Then, for each client node, they are sorted in ascending order according to the average training duration per sample in the most recent training cycle, and the median, 70th percentile, 80th percentile, or 90th percentile client nodes are selected. The training duration of the most recent training cycle for these client nodes can then be used as the time constant of the current training cycle. Of course, other methods can also be used to calculate the time constant of the current training cycle.

[0136] It should be noted that the execution order of steps S42 and S43 is not limited here. For example, step S42 can be executed first and then step S43, or step S43 can be executed first and then step S42, or steps S42 and S43 can be executed in parallel, or other execution orders are also possible.

[0137] Step S44: Send the time constant and global model aggregation parameters for the current training cycle to each client node respectively.

[0138] After the server node calculates the time constant for the current training cycle through step S43 and the global model aggregation parameters for the current training cycle through step S42, it sends the time constant and global model aggregation parameters for the current training cycle to each client node.

[0139] Since the model training methods in steps S41 to S44 adopt the same inventive concept as the model training methods in steps S31 to S25, they can also solve the problems in the prior art, and will not be elaborated here.

[0140] Based on the same inventive concept as the model training method provided in the embodiments of this application, the embodiments of this application also provide a client node. For any unclear aspects of this client node embodiment, please refer to the corresponding content of the method embodiments. Figure 5The diagram shows the specific structure of the client node 50, which includes: an acquisition unit 501, an update unit 502, a comparison unit 503, a first training unit 504, and a second training unit 505, wherein:

[0141] The acquisition unit 501 is used to acquire the time constant and global model aggregation parameters of the current training cycle sent by the server node;

[0142] The update unit 502 is used to update the parameters of the local model of the client node using the global model aggregation parameters;

[0143] The comparison unit 503 is used to determine the node type of the client node by comparing the time constant with the training duration of the client node in the most recent training cycle. The node type is specifically a fast node or a slow node.

[0144] The first training unit 504 is used to train the updated local model using the sample set of the client node when the client node is a fast node; or,

[0145] The second training unit 505 is used to divide the sample set into n non-empty sub-sample sets when the client node is a slow node, and select p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model, where n is a positive integer greater than 1, p is a positive integer greater than or equal to 1, and n is greater than p.

[0146] The client node 50 provided in this application embodiment adopts the same inventive concept as the model training method provided in this application embodiment. Under the premise that the method can solve the technical problem, the client node 50 can also solve the technical problem, which will not be elaborated here.

[0147] In addition, in practical applications, the technical effects achieved by combining the client node 50 with specific hardware devices, cloud technologies, etc., are also within the scope of protection of this application. For example, using a distributed cluster approach to deploy different units in the client node 50 to different nodes in the distributed cluster, thereby improving efficiency; or deploying some units in the client node 50 to the cloud, thereby reducing costs.

[0148] The client node 50 may further include an n-value calculation unit, used to calculate the value of n by the ratio of the training duration to the time constant, wherein the value of n is greater than or equal to the ratio; and to divide the sample set into n non-empty sub-sample sets, specifically including: dividing the sample set into n non-empty sub-sample sets on an average basis.

[0149] The client node 50 may also include a p-value calculation unit, which calculates the value of p by multiplying the value of n by the ratio of the time constant to the training duration and rounding down.

[0150] Specifically, selecting p non-empty sub-sample sets from the n non-empty sub-sample sets to train the updated local model can include:

[0151] For the n non-empty sub-sample sets, determine the total number of training rounds that each non-empty sub-sample set has participated in in previous training cycles;

[0152] Based on the selection order of the total number of training rounds from smallest to largest, select p non-empty sample sets from the n non-empty sample sets;

[0153] The updated local model is trained using the selected p non-empty subsample sets.

[0154] When the client node is a fast node, the client node 50 may further include a parameter feedback unit, used to obtain the training duration of the current training cycle and the update gradient of the parameters of the local model in the client node; and send the training duration and the update gradient to the server node.

[0155] In the case that the client node is a slow node, the client node 50 may further include a training duration calculation unit, which is used to determine the actual training duration for training the updated local model with the selected p non-empty sub-sample sets; and calculate the training duration for training the updated local model with the sample sets based on the actual training duration and the proportion of the total number of samples in the p non-empty sub-sample sets to the total number of samples in the sample set, and use this as the training duration of the current training cycle.

[0156] When the client node is a slow node, the client node 50 can calculate the update gradient of the local model parameters in the current training cycle using the following formula:

[0157]

[0158] Where i is the number of the client node; k is the round number of the current training cycle; p represents the update gradient of the local model parameters of the client node in this training cycle; i The number of non-empty subsample sets selected in the client node; G represents the actual update gradient of the local model parameters for the j-th non-empty subsample set during this training cycle. ijThis refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. This is an estimate of the average gradient of each non-empty subsample set in the dataset of the client node.

[0159] Based on the same inventive concept as the model training method provided in the embodiments of this application, the embodiments of this application also provide a server node. For any unclear aspects of this server node embodiment, please refer to the corresponding content of the method embodiments. Figure 6 The diagram shows the specific structure of the server node 60, which includes: a second acquisition unit 601, a global model aggregation parameter calculation unit 602, a time constant calculation unit 603, and a sending unit 604, wherein:

[0160] The second acquisition unit 601 is used to acquire the number of samples in the sample set of each client node, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle.

[0161] The global model aggregation parameter calculation unit 602 is used to calculate the global model aggregation parameters for the current training cycle using the global model aggregation parameters of the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient of the most recent training cycle.

[0162] The time constant calculation unit 603 is used to calculate the time constant of the current training cycle by using the number of samples in the sample set of each client node and the training duration of the most recent training cycle.

[0163] The sending unit 604 is used to send the time constant and global model aggregation parameters of the current training cycle to each client node respectively.

[0164] The server node 60 provided in this application embodiment adopts the same inventive concept as the model training method provided in this application embodiment. Under the premise that the method can solve the technical problem, the server node 60 can also solve the technical problem, which will not be elaborated here.

[0165] Based on the same inventive concept as the model training method provided in the embodiments of this application, the embodiments of this application also provide a model training system. This model training system is based on the idea of ​​federated learning, therefore, in terms of system structure, as... Figure 7As shown, the model training system 70 includes a server node 60 provided in this application embodiment, and multiple client nodes 50 provided in this application embodiment connected to the server node 60, thereby achieving model training through the collaborative training of the server node 60 and the multiple client nodes 50 in the model training system 70.

[0166] like Figure 8 As shown, this embodiment also provides an electronic device 8, including: at least one processor 81 and a memory 82. Figure 8 Taking a processor as an example, the processor 81 and the memory 82 can be connected via a bus 80. The memory 82 stores instructions that can be executed by the processor 81. The instructions are executed by the processor 81 to enable the electronic device 8 to implement all or part of the process of the method in the embodiments of this application.

[0167] In practical applications, the electronic device 8 can be a mobile phone, laptop computer, desktop computer, or a large server or server cluster composed of them. For example, in the scenario provided in the embodiments of this application, the electronic device 8 can act as a server node or a client node.

[0168] This invention also provides a storage medium storing a computer program that can be executed by a processor to complete all or part of the methods described in this application. The storage medium can be a disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc. The storage medium may also include combinations of the above types of memory.

[0169] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A model training method, characterized in that, Applied to client nodes, the method includes: Obtain the time constant and global model aggregation parameters of the current training cycle sent by the server node; wherein, the time constant is calculated by the server node using the number of samples in the sample set of each client node and the training duration of the most recent training cycle; The parameters of the local model of the client node are updated using the global model aggregation parameters; The node type of the client node is determined by comparing the time constant with the total training time of the client node in the most recent training cycle of m iterations. The node type is either a fast node or a slow node. If the time constant is greater than or equal to the total training time, the node type of the client node is determined to be a fast node. If the time constant is less than the total training time, the node type of the client node is determined to be a slow node. When the client node is a fast node, the updated local model is trained through m iterations using the sample set of the client node. When the client node is a slow node, the sample set of the client node is divided into n non-empty sub-sample sets, and p non-empty sub-sample sets are selected from the n non-empty sub-sample sets to perform m iterations of training on the updated local model. Here, n is a positive integer greater than 1, and the value of n is greater than or equal to the ratio of the total training time to the time constant. p is a positive integer greater than or equal to 1, and the value of p is obtained by multiplying the value of n by the ratio of the time constant to the total training time and rounding down. In addition, n is greater than p. Specifically, selecting p non-empty sub-sample sets from the n non-empty sub-sample sets as training samples to perform m iterations of training on the updated local model includes: For the n non-empty sub-sample sets, determine the total number of training rounds that each non-empty sub-sample set has participated in in previous training cycles; Based on the selection order of the total number of training rounds from smallest to largest, select p non-empty sample sets from the n non-empty sample sets; Using the selected p non-empty subsample sets, the updated local model is trained through m iterations. When the client node is a slow node, the method further includes: The update gradient of the local model parameters of the client node in this training cycle is calculated using the following formula: Where i is the number of the client node; k is the round number of the current training cycle; The update gradient of the local model parameters of the client node in this training cycle is used to calculate the global model aggregation parameters for the next training cycle. The number of non-empty subsample sets selected in the client node; This represents the actual update gradient of the local model parameters for the j-th non-empty subsample set during this training cycle. This refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. This is an estimate of the average gradient of each non-empty sub-sample set in the dataset of the client node; in, , Let n be the value of n corresponding to the number i of the client node.

2. The method according to claim 1, characterized in that, The method further includes: calculating the value of n by using the ratio of the total training time to the time constant, wherein the value of n is greater than or equal to the ratio; and, Dividing the sample set of the client node into n non-empty sub-sample sets specifically includes: dividing the sample set into n non-empty sub-sample sets on an average basis.

3. The method according to claim 2, characterized in that, The method further includes: calculating the value of p by multiplying the value of n by the ratio of the time constant to the total training duration and rounding down.

4. The method according to claim 1, characterized in that, When the client node is a fast node, the method further includes: Obtain the training duration of this training cycle and the update gradient of the parameters of the local model in the client node; The training duration and the update gradient are sent to the server node.

5. The method according to claim 1, characterized in that, When the client node is a slow node, the method further includes: Determine the actual training time for training the updated local model by selecting the p non-empty subsample sets; Based on the actual training time and the proportion of the total number of samples in the p non-empty sub-sample sets to the total number of samples in the sample set, the training time when training the updated local model with the sample set is calculated and used as the training time for this training cycle.

6. A client node, characterized in that, include: The acquisition unit is used to acquire the time constant and global model aggregation parameters of the current training cycle sent by the server node; wherein the time constant is calculated by the server node using the number of samples in the sample set of each client node and the training duration of the most recent training cycle; the update unit is used to update the parameters of the local model of the client node using the global model aggregation parameters. The comparison unit is used to determine the node type of the client node by comparing the time constant with the total training time of the client node in the most recent training cycle of m iterations. The node type is either a fast node or a slow node. If the time constant is greater than or equal to the total training time, the node type of the client node is determined to be a fast node. If the time constant is less than the total training time, the node type of the client node is determined to be a slow node. The first training unit is used to train the updated local model m times using the sample set of the client node when the client node is a fast node. The second training unit is used to divide the sample set of the client node into n non-empty sub-sample sets when the client node is a slow node, and select p non-empty sub-sample sets from the n non-empty sub-sample sets to perform m iterations of training on the updated local model, where n is a positive integer greater than 1 and the value of n is greater than or equal to the ratio of the total training time to the time constant, p is a positive integer greater than or equal to 1 and the value of p is obtained by multiplying the value of n by the ratio of the time constant to the total training time and rounding down, and n is greater than p; Specifically, selecting p non-empty sub-sample sets from the n non-empty sub-sample sets as training samples to perform m iterations of training on the updated local model includes: For the n non-empty sub-sample sets, determine the total number of training rounds that each non-empty sub-sample set has participated in in previous training cycles; Based on the selection order of the total number of training rounds from smallest to largest, select p non-empty sample sets from the n non-empty sample sets; Using the selected p non-empty subsample sets, the updated local model is trained through m iterations. When the client node is a slow node, the update gradient of the local model parameters of the client node in this training cycle is calculated using the following formula: Where i is the number of the client node; k is the round number of the current training cycle; The update gradient of the local model parameters of the client node in this training cycle is used to calculate the global model aggregation parameters for the next training cycle. The number of non-empty subsample sets selected in the client node; This represents the actual update gradient of the local model parameters for the j-th non-empty subsample set during this training cycle. This refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. This is an estimate of the average gradient of each non-empty sub-sample set in the dataset of the client node; in, , The value of n corresponding to the number i of the client node.

7. A model training system, characterized in that, It includes a server node and multiple client nodes connected to the server node, wherein: The server node includes: a second acquisition unit, used to acquire the number of samples in the sample set of each client node, the training duration of the most recent training cycle, and the update gradient of the most recent training cycle; a global model aggregation parameter calculation unit, used to calculate the global model aggregation parameters of the current training cycle using the global model aggregation parameters of the most recent training cycle, the number of samples in the sample set of each client node, and the update gradient of the most recent training cycle; a time constant calculation unit, used to calculate the time constant of the current training cycle using the number of samples in the sample set of each client node and the training duration of the most recent training cycle; and a sending unit, used to send the time constant of the current training cycle and the global model aggregation parameters to each client node respectively. The client node includes: an acquisition unit, used to acquire the time constant and global model aggregation parameters of the current training cycle sent by the server node; an update unit, used to update the parameters of the local model of the client node using the global model aggregation parameters; and a comparison unit, used to determine the node type of the client node by comparing the time constant with the total training time of m iterations in the most recent training cycle. The node type is either a fast node or a slow node. Specifically, if the time constant is greater than or equal to the total training time, the node type is determined to be a fast node; if the time constant is less than the total training time, the node type is determined to be a slow node. Slow node; First training unit, used to perform m iterations of training on the updated local model using the sample set of the client node when the client node is a fast node; Second training unit, used to divide the sample set into n non-empty sub-sample sets when the client node is a slow node, and select p non-empty sub-sample sets from the n non-empty sub-sample sets to perform m iterations of training on the updated local model, where n is a positive integer greater than 1, and the value of n is greater than or equal to the ratio of the total training time to the time constant, p is a positive integer greater than or equal to 1, and the value of p is obtained by multiplying the value of n by the ratio of the time constant to the total training time and rounding down, and n is greater than p; Specifically, selecting p non-empty sub-sample sets from the n non-empty sub-sample sets as training samples to perform m iterations of training on the updated local model includes: For the n non-empty sub-sample sets, determine the total number of training rounds that each non-empty sub-sample set has participated in in previous training cycles; Based on the selection order of the total number of training rounds from smallest to largest, select p non-empty sample sets from the n non-empty sample sets; Using the selected p non-empty subsample sets, the updated local model is trained through m iterations. When the client node is a slow node, the update gradient of the local model parameters of the client node in this training cycle is calculated using the following formula: Where i is the number of the client node; k is the round number of the current training cycle; The update gradient of the local model parameters of the client node in this training cycle is used to calculate the global model aggregation parameters for the next training cycle. The number of non-empty subsample sets selected in the client node; This represents the actual update gradient of the local model parameters for the j-th non-empty subsample set during this training cycle. This refers to the actual updated gradient of the local model of the client node in the most recent training on the j-th non-empty subsample set before the current training cycle. This is an estimate of the average gradient of each non-empty sub-sample set in the dataset of the client node; in, , The value of n corresponding to the number i of the client node.

8. An electronic device, characterized in that, include: processor; Memory for storing processor-executable instructions; wherein the processor is configured to perform the method as described in any one of claims 1-5.

9. A storage medium, characterized in that, The storage medium stores a computer program that can be executed by a processor to perform the method described in any one of claims 1-5.

Citation Information

Patent Citations

  • An updating method of a distributed parameter server based on a deep reinforcement learning algorithm

    CN109710289A

  • Slow node detection method and device, electronic equipment and storage medium

    CN114328098A

  • Federal learning model training method and device, computer equipment and storage medium

    CN115829055A

  • Federal learning model training method and system

    CN116484944A