Asynchronous federated learning method based on information gain and related equipment
Through the asynchronous federated learning method based on information gain in federated learning, grouping and aggregating model gradients, the problems of inconsistency in training time caused by differences in client equipment performance and frequent model updates do not bring about improvement in convergence speed, achieving more efficient Global model training.
Patent Information
- Application Number
- CN202411081224.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-04-07
- Filing Date
- 2024-08-08
- Publication Date
- 2025-01-03
AI Technical Summary
In federated learning, differences in client device performance lead to inconsistent training time, high-performance clients need to wait for training results from other clients, resulting in the inability to play to their advantages, and frequent updates to model gradients in asynchronous federated learning do not bring about faster convergence of the global model in fastest convergence of the global model in asynchronous federated learning speed.
Using an asynchronous federated learning method based on information gain, grouping by calculating the characteristic similarity between the model gradient and the grouping center, adjusting the grouping center, comprehensively considering the total information, freshness and effectiveness of the model gradient, and removing gradients with information gain less than the threshold. , select groups with high information gain rate for aggregation, and use the staleness of the model gradient to update the learning rate for global training.
The convergence speed of the global model is improved, the waiting time of high-performance clients is optimized, and the model gradient with large information gain is ensured to participate in the aggregation, reducing the phenomenon of frequent updates without bringing about the improvement of convergence speed.
Smart Images

Figure CN119250224A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of federated learning, and in particular, to an asynchronous federated learning method based on information gain and related equipment. Background Art
[0002] In federated learning, the performance of client devices may vary significantly, so the training time required by each client varies greatly. The central server must receive the local training models of all clients before it can aggregate them, which forces high-performance clients to wait for the training results of other clients, making it impossible to take advantage of them. Asynchronous federated learning is an optimization method to solve the above problem.
[0003] Furthermore, in asynchronous federated learning, a waiting time is usually preset for the receiving client model, and the client models received within this time period are aggregated without quantifying the entire aggregated model. In other words, it leads to frequent updates of model gradients without bringing about faster convergence of the global model. Summary of the invention
[0004] In view of this, the purpose of this application is to propose an asynchronous federated learning method based on information gain and related equipment.
[0005] Based on the above purpose, this application provides an asynchronous federated learning method based on information gain, which is applied to the client;
[0006] The method includes:
[0007] In each round of local training, each client receives the global model from the central server, and uses the preset semantic data to perform local training on the global model received in the current round, thereby obtaining the local model and corresponding model gradient of the client in this round of training;
[0008] Each client uploads the model gradient obtained from this round of local training to the central server and enters a blocked state to wait.
[0009] Based on the same inventive concept, the present application also provides another asynchronous federated learning method based on information gain, which is applied to a central server, wherein the central server caches multiple groups, each group includes at least one model gradient, and a group center is correspondingly set;
[0010] The method includes:
[0011] In response to receiving a model gradient sent by any client, determining the feature similarity between the model gradient of the client and each group center, dividing the model gradient into groups corresponding to the highest feature similarity, re-determining the group center of the group, and adjusting the group according to the re-determined group centers;
[0012] For each adjusted group, the total amount of information, freshness and validity of each model gradient in the group are calculated, the information gain of the model gradient is determined using the total amount of information, the freshness and the validity, the model gradient whose information gain is less than a preset gain threshold is removed, in response to determining that the information gain rate of any group is greater than the preset gain rate threshold, the learning rate is updated according to the mean of the staleness of the model gradients in the group, the model gradients are aggregated according to the staleness of the model gradients to obtain an aggregated gradient, the aggregated gradient, the updated learning rate and the constructed group weight are used to perform the preset gradient descent algorithm on the global model to perform this round of global training, the global model of this round of global training is obtained, and the global model is sent to the client waiting in a blocked state.
[0013] Further, determining the feature similarity between the client's model gradient and each group center includes:
[0014] Extracting a vector matrix of the model gradient, wherein the vector matrix is related to the magnitude and direction of the model gradient;
[0015] According to the similarity measurement formula shown below, the similarity vector between the model gradient and each group center is determined:
[0016]
[0017] Among them, s a The similarity between the ath element in the vector matrix representing the model gradient and the ath element corresponding to the group center is used as an element in the similarity vector, sgn(g a ) represents the direction and magnitude of the ath element in the vector matrix of the model gradient, Indicates the direction and size of the ath element corresponding to the group center, sgn indicates the direction of the element, g a and Indicates the size value of the element;
[0018] According to the following formula, the similarity vector is scalarized to obtain a similarity scalar, which is used as the feature similarity:
[0019]
[0020] Where d represents the similarity scalar.
[0021] Furthermore, the total amount of information, freshness, and validity of each model gradient in the group are calculated, including:
[0022] For each model gradient, the modulus of the model gradient is taken as the total amount of information;
[0023] The freshness is determined using a preset decay coefficient according to an exponential function as shown below:
[0024]
[0025] Where, λ represents the attenuation coefficient, t represents the current round of global training, and τ i Represents the timestamp of the i-th model gradient;
[0026] The cosine similarity between the model gradient and the aggregated gradient obtained from the previous round of global training is calculated, and the cosine similarity is used as the effectiveness.
[0027] Further, the information gain of the model gradient is determined using the total amount of information, the freshness and the effectiveness, including:
[0028] The information gain of the model gradient is obtained by integrating the total amount of information, freshness and validity of the model gradient according to the formula shown below:
[0029]
[0030] Among them, I i represents the information gain of the i-th model gradient, μ i represents the validity of the i-th model gradient, Represents the total amount of information of the i-th model gradient.
[0031] Further, the information gain rate of the group is determined according to the information gain of each model gradient, including:
[0032] For each group, the information gain of the group in the current round of global training is determined using the following formula using each model gradient in the group:
[0033]
[0034] in, represents the information gain of the group in the tth round of global training, N′ j Represents the total number of model gradients in this group, I j Represents the information gain of the j-th model gradient in this group;
[0035] According to the formula shown below, the share of the information gain of the current round of global training of the group in the total information gain of multiple rounds of global training is determined and used as the information gain rate:
[0036]
[0037] Among them, m represents m rounds of global training, r trepresents the information gain rate.
[0038] Based on the same inventive concept, the present application also provides an asynchronous federated learning device based on information gain, including: a local training module and an upload module;
[0039] The local training module is configured such that each client receives the global model from the central server in each round of local training, performs local training on the global model received in the current round using preset semantic data, and obtains the local model of the client in the current round of training and the corresponding model gradient;
[0040] The upload module is configured such that each client uploads the model gradient obtained by the local training to the central server and enters a blocking state to wait.
[0041] Based on the same inventive concept, the present application also provides another asynchronous federated learning device based on information gain, including: a grouping module, a screening module and a global aggregation module;
[0042] The grouping module is configured to, in response to receiving a model gradient sent by any client, determine the feature similarity between the model gradient of the client and each group center, divide the model gradient into groups corresponding to the highest feature similarity, redetermine the group center of the group, and adjust the grouping according to the redetermined group centers;
[0043] The screening module is configured to calculate, for each adjusted group, the total amount of information, freshness and validity of each model gradient in the group, determine the information gain of the model gradient using the total amount of information, the freshness and the validity, remove the model gradient whose information gain is less than a preset gain threshold, and determine the information gain rate of the group according to the information gain of each model gradient;
[0044] The global aggregation module is configured to, in response to determining that the information gain rate of any group is greater than a preset gain rate threshold, update the learning rate according to the mean of the staleness of the gradients of each model in the group, aggregate the gradients of each model according to the staleness of the gradients of each model to obtain an aggregated gradient, use the aggregated gradient, the updated learning rate and the constructed group weights to perform a preset gradient descent algorithm on the global model to perform this round of global training, obtain the global model of this round of global training, and send it to the client waiting in a blocked state.
[0045] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the asynchronous federated learning method based on information gain as described in any one of the above items is implemented.
[0046] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the asynchronous federated learning method based on information gain as described above.
[0047] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions, which, when executed on a computer, enables the computer to execute the information gain-based asynchronous federated learning method as described in any of the above items.
[0048] From the above, it can be seen that the information gain-based asynchronous federated learning method and related equipment provided by the present application, when the central server performs each round of global training on the global model, based on the grouping of each model gradient in the previous round of global training, when the model gradient of any client is received, the model gradient is grouped by calculating the feature similarity between the model gradient and the center of each group, and after the grouping is readjusted by the clustering algorithm, the total amount of information, freshness and effectiveness of each model gradient in each adjusted group are comprehensively considered to determine the information gain of the model gradient, so that the model gradient with a smaller information gain can be removed from the group, and accordingly, the information gain of each group is determined by using the information gain of the remaining model gradients, and then the information gain rate of the group is obtained. Based on this, the group with a large information gain rate can be selected to aggregate the model gradient, and when the model gradient is aggregated, the staleness of each model gradient is used to complete the aggregation of the model gradient. Accordingly, the aggregated gradient can be used to perform global training on the global model, and the obtained global model of this round is sent to the corresponding client for local training. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 This is a first flow chart of an asynchronous federated learning method based on information gain according to an embodiment of the present application;
[0051] Figure 2 A second flow chart of the asynchronous federated learning method based on information gain according to an embodiment of the present application;
[0052] Figure 3This is a first structural diagram of an asynchronous federated learning device based on information gain according to an embodiment of the present application;
[0053] Figure 4 This is a second structural diagram of an asynchronous federated learning device based on information gain according to an embodiment of the present application;
[0054] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0056] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connecting" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0057] As described in the background technology section, the related information gain-based asynchronous federated learning method is still difficult to meet practical needs.
[0058] In the process of implementing this application, the applicant found that the main problem with the related asynchronous federated learning method based on information gain is that in federated learning, the device performance of the client may vary significantly, so the training time required by each client varies greatly. The central server must receive the local training models of all clients before aggregation, which forces high-performance clients to wait for the training results of other clients, resulting in their inability to play their advantages. Asynchronous federated learning is an optimization method to solve the above problems.
[0059] Furthermore, in asynchronous federated learning, a waiting time is usually preset for the receiving client model, and the client models received within this time period are aggregated without quantifying the entire aggregated model. In other words, it leads to frequent updates of model gradients without bringing about faster convergence of the global model.
[0060] Based on this, one or more embodiments in the present application provide an asynchronous federated learning method based on information gain.
[0061] In an embodiment of the present application, taking the intelligent operation scenario of an electronic device as a specific example, each electronic device serves as a client, and the client can collect relevant data of the user's operation of the electronic device, such as text and / or voice input by the user into the electronic device, and use it as semantic data.
[0062] Furthermore, the client is also provided with a local model, which can predict the next operation based on the relevant input data, for example, predicting the text that the user is about to input based on the input semantic data; or it can also predict the corresponding operation based on the relevant input data, for example, predicting the document that the user needs to open based on the input semantic data.
[0063] Furthermore, before applying the local model for prediction, asynchronous federated learning is used to train the local model, and after each round of training on the client, the model gradient is uploaded to the central server and aggregated using the central server, thereby completing asynchronous federated learning.
[0064] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0065] refer to Figure 1 An asynchronous federated learning method based on information gain according to an embodiment of the present application is applied to a client; and specifically includes the following steps:
[0066] Step S101: In each round of local training, each client receives a global model from a central server, and performs local training on the global model received in the current round using preset semantic data to obtain the local model of the client for this round of training and the corresponding model gradient.
[0067] In an embodiment of the present application, the client electronic device may be, for example, a mobile phone, a tablet, a computer, or a vehicle networking system.
[0068] Among them, the performance of each electronic device may vary significantly, so the time required for local training of local models when acting as a client varies greatly.
[0069] The number of clients is set to N, and the i-th client is denoted as k i , where k i ∈K={k1,k2,...,k N}.
[0070] Furthermore, the semantic data collected by the client may specifically include, for example, image data, text data and / or voice data, and each collected semantic data is represented as ξ i , and combine the semantic data into a dataset D i ,in, M represents the amount of collected data.
[0071] In this embodiment, for any client k i In each round of local training, it receives the global model from the central server and uses the dataset D i Train the global model received in the current round of local training.
[0072] Among them, the client can use an optimizer to perform local training, such as the ADAM optimizer (Adaptive Moment Estimation Optimizer) or the SGD optimizer (Stochastic Gradient Descent Optimizer).
[0073] Furthermore, after the client completes the local training of the current round, the local model of the current round is obtained, and the model gradient of the local model
[0074] in, It represents the model gradient of the local model of the i-th client obtained in the t-th round of local training, that is, the i-th model gradient.
[0075] In this embodiment, when there are multiple clients, the performance of each client is different, and the time to train the model gradient is different. Therefore, the model gradient is determined. When the model gradient is obtained through training, the timestamp τ is also determined. i .
[0076] Step S102: Each client uploads the model gradient obtained from this round of local training to the central server and enters a blocking state to wait.
[0077] In an embodiment of the present application, after completing local training, each client can upload the model gradient and corresponding timestamp obtained by local training to the central server.
[0078] Furthermore, after the client completes the current round of uploading, it can be made to enter a blocking state and wait for the central server to perform the following aggregation operation.
[0079] Furthermore, when the client is waiting in the blocked state, when it receives the global model sent by the central server again, it uses the global model sent again to perform the next round of local training.
[0080] refer to Figure 2, an asynchronous federated learning method based on information gain in another embodiment of the present application is applied to a central server, wherein the central server caches multiple groups, each group includes at least one model gradient, and a group center is correspondingly set; and specifically includes the following steps:
[0081] Step S201, in response to receiving a model gradient sent by any client, determining the feature similarity between the model gradient of the client and each group center, dividing the model gradient into groups corresponding to the highest feature similarity, redetermining the group center of the group, and adjusting the group according to the redetermined group centers.
[0082] In an embodiment of the present application, based on the model gradients and their corresponding timestamps sent by each client to the central server in the aforementioned embodiment, the central server can group the model gradients of the client when receiving the model gradients and timestamps uploaded by any one or more clients.
[0083] Specifically, the central server pre-sets a plurality of groups of model gradients, each of which includes one or more model gradients.
[0084] Furthermore, each group is also provided with a group center C, which reflects the average level of each model gradient in the current group, wherein each group center C can be represented in the form of a vector matrix.
[0085] Furthermore, each group is also set with a current group weight. Among them, by calculating the cosine similarity using the group center and the aggregated gradient obtained from the previous global training, the group weight of the current round of global training can be obtained.
[0086] Based on this, the model gradients are grouped by comparing the feature similarity between the client's model gradient and each group center.
[0087] Specifically, a vector matrix of the model gradient is extracted, and the vector matrix specifically represents the size and direction characteristics of the model gradient.
[0088] Furthermore, the vector matrix of the model gradient is used to calculate the similarity vector with each group center.
[0089] Specifically, the similarity measurement formula shown below is used to calculate the similarity vector:
[0090]
[0091] Among them, s aThe similarity between the ath element in the vector matrix representing the model gradient and the corresponding ath element in the group center is used as an element in the similarity vector, sgn(g a ) represents the direction and magnitude of the ath element in the vector matrix of the model gradient, Indicates the direction and size of the ath element corresponding to the group center, sgn indicates the direction of the element, g a and Indicates the size of the element.
[0092] It can be seen that in the above formula, the size and direction of each element in the vector matrix are compared with the corresponding element in the group center. When the size and direction are consistent, the formula is used. Calculation is performed to obtain the similarity between the ath element of the vector matrix and the corresponding ath element in the group center; when their sizes and / or directions are inconsistent, the similarity between the ath element of the vector matrix and the corresponding ath element in the group center is determined to be 0.
[0093] Based on this, the similarity between each element in the model gradient and the corresponding element in the group center is composed into a similarity vector S.
[0094] Furthermore, the similarity vector is scalarized according to the following formula:
[0095]
[0096] Among them, d represents the similarity scalar that describes the similarity between the vector matrix and the group center. When the similarity scalar is larger, the similarity between the two is higher, and when the similarity scalar is smaller, the similarity between the two is smaller.
[0097] Based on this, the model gradients can be divided into groups with the highest similarity.
[0098] Furthermore, when a new model gradient is added to any group, the central server may recalculate the group center of the group to replace the group center before the new model gradient is added.
[0099] Furthermore, when the group center of any group is re-determined, a clustering algorithm can be used to re-group.
[0100] Furthermore, after each regrouping, a corresponding grouping identifier C is set for each group. * .
[0101] In this embodiment, when the central server performs the first round of global training, before multiple groups are set, a clustering algorithm can be used to group multiple model gradients.
[0102] Step S202: For each adjusted group, calculate the total amount of information, freshness and validity of each model gradient in the group, determine the information gain of the model gradient using the total amount of information, the freshness and the validity, remove the model gradient whose information gain is less than a preset gain threshold, and determine the information gain rate of the group based on the information gain of each model gradient.
[0103] In the embodiment of the present application, based on the groups adjusted in the above steps, the information gain rate of each group is determined according to the group identifier, so as to determine the group to be subjected to gradient aggregation.
[0104] Specifically, the central server identifies each group C * Determine the corresponding groups respectively, and determine all model gradients in the groups.
[0105] Furthermore, each model gradient in the group is characterized in multiple dimensions, for example, the model gradient is characterized from aspects such as the total amount of information, freshness and effectiveness.
[0106] Specifically, for each model gradient, the modulus of the model gradient is calculated, and the calculation result is used as the total amount of information of the model gradient.
[0107] Furthermore, an exponential function is used to calculate the freshness of the model gradient received in the current round relative to the global training of the current round.
[0108] Specifically, using the preset attenuation coefficient, the exponential function shown below is calculated:
[0109]
[0110] Among them, λ represents the attenuation coefficient between 0 and 1, t represents the current round of global training, and τ i Represents the timestamp of the i-th model gradient.
[0111] It can be seen that the exponential part t-τ in the above exponential function i It represents the time difference between the global model received by client i before local training and the global model held by the central server when the training is completed; the larger the time difference between the two, the lower the freshness of the model gradient.
[0112] Furthermore, the model gradient and the aggregated gradient obtained by the central server after the previous round of global training are used to calculate the cosine similarity, and the calculation result is used as the validity.
[0113] Based on this, by integrating the total amount of information, freshness and effectiveness of the model gradient, the information gain I of the local model obtained by the client in this round of local training relative to the current global model of the central server can be determined.i .
[0114] Specifically, according to the formula shown below, the fusion model gradient g i The total amount of information, freshness and effectiveness of the model are obtained i Information gain:
[0115]
[0116] Among them, I i represents the information gain of the i-th model gradient, μ i represents the validity of the i-th model gradient, Represents the i-th model gradient g i The total amount of information.
[0117] Furthermore, for each group, based on a preset gain threshold, the model gradients whose information gain is less than the gain threshold are removed from the group, so as to avoid the model gradients with too small information gain from participating in the gradient aggregation process, thereby ensuring that the model gradients participating in the gradient aggregation make a greater performance contribution to the training of the global model, avoiding frequent updates without bringing about a faster convergence speed of the global model.
[0118] Based on this, for each group, the information gain of the group is determined according to the information gain of each model gradient therein, thereby determining the information gain rate of the group, and the information gain rate is used to reflect the current information gain level of the group.
[0119] Specifically, according to the formula shown below, the gradients of each model in the group are summed, and the sum result is used as the information gain of the group in the current round of global training:
[0120]
[0121] in, represents the information gain of the group in the tth round of global training, N′ j Represents the total number of model gradients in this group, I j Represents the information gain of the j-th model gradient in this group.
[0122] Furthermore, as the number of global training rounds increases, the model gradient uploaded by the client will tend to 0, and the information gain of the model gradient will gradually decrease.
[0123] Based on this, the information gain of the group in multiple rounds of global training is selected, and the sum of multiple rounds is determined. The share of the information gain of the current round of global training in the above-mentioned multiple rounds is calculated to reflect the information gain level of the current round.
[0124] Specifically, the information gain rate of the group is calculated according to the following formula:
[0125]
[0126] Among them, m represents the mth round of global training, r t represents the information gain rate.
[0127] Based on this, the information gain rate of each group is compared with a preset gain rate threshold to determine the group to be subjected to gradient aggregation.
[0128] Step S203, in response to determining that the information gain rate of any group is greater than a preset gain rate threshold, updating the learning rate according to the mean of the staleness of the gradients of each model in the group, aggregating the gradients of each model according to the staleness of the gradients of each model to obtain an aggregated gradient, using the aggregated gradient, the updated learning rate and the constructed group weights, adopting a preset gradient descent algorithm to perform this round of global training on the global model, obtaining the global model of this round of global training, and sending it to the client waiting in a blocked state.
[0129] In an embodiment of the present application, based on the comparison between the information gain rate and the gain rate threshold in the aforementioned steps, when the information gain rate of any group is less than or equal to the gain rate threshold, the group is not gradient aggregated, and the model gradients of each client continue to be received.
[0130] Furthermore, when the information gain rate of any group is greater than the gain rate threshold, the model gradients in the group are aggregated to obtain the aggregated gradient, and the global model is trained based on this.
[0131] Specifically, the exponential part t-τ of the exponential function in the previous step is i As the staleness O of the corresponding model gradient, and determine the average staleness O of each model gradient avg .
[0132] Furthermore, the learning rate of the global model is adaptively adjusted according to the average value of the staleness determined above.
[0133] Specifically, the learning rate is adjusted according to the following formula:
[0134]
[0135] Among them, η t-1 represents the learning rate during the t-1th round of global training, η t represents the learning rate during the tth round of global training, and γ is a hyperparameter.
[0136] Furthermore, based on the gradients of each model, the gradients are aggregated according to the following formula:
[0137]
[0138] in, Indicates that in the tth round of global training, based on the group C i Aggregate gradient.
[0139] It can be seen that when calculating the aggregate gradient above, the part t-τ that is the staleness of the model gradient i The role of is to regard the staleness as the weight of the model gradient. The earlier the generation time, the larger the staleness of the model gradient, and the smaller the corresponding weight. The smaller the staleness, the larger the corresponding weight of the model gradient.
[0140] Based on this, based on the aforementioned updated learning rate and aggregate gradient, and combined with the group weights of each group, the global model uses a preset gradient descent algorithm to perform this round of global training, and according to the formula shown below, after completing the global training, a new global model is obtained:
[0141]
[0142] in, represents the global model obtained from the previous round of global training, Represents the global model obtained by the current round of global training.
[0143] Furthermore, the global model obtained in the current round is sent to the client.
[0144] Specifically, when sending the global model to the client, the global model may be sent to the client waiting in a blocked state.
[0145] It can be seen that the asynchronous federated learning method based on information gain of the embodiment of the present application, when the central server performs each round of global training on the global model, based on the grouping of each model gradient in the previous round of global training, when the model gradient of any client is received, the model gradient is grouped by calculating the feature similarity between the model gradient and the center of each group. After the grouping is readjusted by the clustering algorithm, the total amount of information, freshness and effectiveness of each model gradient in each adjusted group are comprehensively considered to determine the information gain of the model gradient, so that the model gradient with a smaller information gain can be removed from the group. Based on this, the information gain of each group is determined by using the information gain of the remaining model gradients, and then the information gain rate of the group is obtained. Based on this, the group with a large information gain rate can be selected to aggregate the model gradients, and when the model gradients are aggregated, the staleness of each model gradient is used to complete the aggregation of the model gradients. Based on this, the aggregated gradient can be used to perform global training on the global model, and the obtained global model of this round can be sent to the corresponding client for local training.
[0146] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0147] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0148] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application also provides an asynchronous federated learning device based on information gain.
[0149] refer to Figure 3 , the asynchronous federated learning device based on information gain includes: a local training module 301 and an upload module 302;
[0150] The local training module 301 is configured such that each client receives a global model from the central server in each round of local training, performs local training on the global model received in the current round using preset semantic data, and obtains the local model of the client in the current round of training and the corresponding model gradient;
[0151] The upload module 302 is configured such that each client uploads the model gradient obtained from the local training to the central server and enters a blocking state to wait.
[0152] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the embodiments of the present application also provide another asynchronous federated learning device based on information gain.
[0153] refer to Figure 4 , the asynchronous federated learning device based on information gain includes: a grouping module 401, a screening module 402 and a global aggregation module 403;
[0154] The grouping module 401 is configured to, in response to receiving a model gradient sent by any client, determine the feature similarity between the model gradient of the client and each group center, divide the model gradient into groups corresponding to the highest feature similarity, redetermine the group center of the group, and adjust the grouping according to the redetermined group centers;
[0155] The screening module 402 is configured to calculate, for each adjusted group, the total amount of information, freshness and validity of each model gradient in the group, determine the information gain of the model gradient using the total amount of information, the freshness and the validity, remove the model gradient whose information gain is less than a preset gain threshold, and determine the information gain rate of the group according to the information gain of each model gradient;
[0156] The global aggregation module 403 is configured to, in response to determining that the information gain rate of any group is greater than a preset gain rate threshold, update the learning rate according to the mean of the staleness of the gradients of each model in the group, aggregate the gradients of each model according to the staleness of the gradients of each model to obtain an aggregated gradient, use the aggregated gradient, the updated learning rate and the constructed group weights to apply a preset gradient descent algorithm to the global model to perform this round of global training, obtain the global model of this round of global training, and send it to the client waiting in a blocked state.
[0157] For the convenience of description, the above devices are described in terms of functions and are divided into various modules. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0158] The device of the above embodiment is used to implement the corresponding asynchronous federated learning method based on information gain in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0159] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the asynchronous federated learning method based on information gain as described in any of the above embodiments is implemented.
[0160] Figure 5 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0161] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0162] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solution provided in the embodiment of the present application is implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0163] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0164] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0165] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0166] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiment of the present application, and does not necessarily include all the components shown in the figure.
[0167] The device of the above embodiment is used to implement the corresponding asynchronous federated learning method based on information gain in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0168] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the information gain-based asynchronous federated learning method as described in any of the above embodiments.
[0169] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0170] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the asynchronous federated learning method based on information gain as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0171] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are executed on a computer, the computer executes the asynchronous federated learning method based on information gain as described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0172] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0173] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0174] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0175] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the present application.
Claims
1. An asynchronous federated learning method based on information gain, characterized in that: Applied to the client; The method includes: In each round of local training, each client receives the global model from the central server, and uses the preset semantic data to perform local training on the global model received in the current round, thereby obtaining the local model and corresponding model gradient of the client in this round of training; Each client uploads the model gradient obtained from this round of local training to the central server and enters a blocked state to wait.
2. An asynchronous federated learning method based on information gain, characterized in that: Applied to a central server, the central server caches multiple groups, each group includes at least one model gradient, and a group center is set accordingly; The method includes: In response to receiving a model gradient sent by any client, determining the feature similarity between the model gradient of the client and each group center, dividing the model gradient into groups corresponding to the highest feature similarity, re-determining the group center of the group, and adjusting the group according to the re-determined group centers; For each adjusted group, calculate the total amount of information, freshness and validity of each model gradient in the group, determine the information gain of the model gradient using the total amount of information, the freshness and the validity, remove the model gradient whose information gain is less than a preset gain threshold, and determine the information gain rate of the group according to the information gain of each model gradient; In response to determining that the information gain rate of any group is greater than a preset gain rate threshold, the learning rate is updated according to the mean of the staleness of the gradients of each model in the group, and the gradients of each model are aggregated according to the staleness of the gradients of each model to obtain an aggregated gradient. The aggregated gradient, the updated learning rate and the constructed group weights are used to perform a preset gradient descent algorithm on the global model to perform this round of global training, and the global model of this round of global training is obtained, and the global model is sent to the client waiting in a blocked state.
3. The method according to claim 2, characterized in that Determining the feature similarity between the model gradient of the client and each group center includes: Extracting a vector matrix of the model gradient, wherein the vector matrix is related to the magnitude and direction of the model gradient; According to the similarity measurement formula shown below, the similarity vector between the model gradient and each group center is determined: Among them, s a The similarity between the ath element in the vector matrix representing the model gradient and the ath element corresponding to the group center is used as an element in the similarity vector, sgn(g a ) represents the direction and magnitude of the ath element in the vector matrix of the model gradient, Indicates the direction and size of the ath element corresponding to the group center, sgn indicates the direction of the element, g a and Indicates the size value of the element; According to the following formula, the similarity vector is scalarized to obtain a similarity scalar, which is used as the feature similarity: Where d represents the similarity scalar.
4. The method according to claim 2, characterized in that: The calculation of the total amount of information, freshness and validity of each model gradient in the group includes: For each model gradient, the modulus of the model gradient is taken as the total amount of information; The freshness is determined using a preset decay coefficient according to an exponential function as shown below: Where, λ represents the attenuation coefficient, t represents the current round of global training, and τ i Represents the timestamp of the i-th model gradient; The cosine similarity between the model gradient and the aggregated gradient obtained from the previous round of global training is calculated, and the cosine similarity is used as the effectiveness.
5. The method according to claim 4, characterized in that The determining the information gain of the model gradient by using the total amount of information, the freshness and the effectiveness includes: The information gain of the model gradient is obtained by integrating the total amount of information, freshness and validity of the model gradient according to the formula shown below: Among them, I i represents the information gain of the i-th model gradient, μ i represents the validity of the i-th model gradient, Represents the total amount of information of the i-th model gradient.
6. The method according to claim 2, characterized in that Determining the information gain rate of the group according to the information gain of each model gradient includes: For each group, the information gain of the group in the current round of global training is determined using the following formula using each model gradient in the group: in, represents the information gain of the group in the tth round of global training, N′ j Represents the total number of model gradients in this group, I j Represents the information gain of the j-th model gradient in this group; According to the formula shown below, the share of the information gain of the current round of global training of the group in the total information gain of multiple rounds of global training is determined and used as the information gain rate: Among them, m represents m rounds of global training, r t represents the information gain rate.
7. An asynchronous federated learning device based on information gain, characterized in that: include: Local training module and upload module; The local training module is configured such that each client receives the global model from the central server in each round of local training, performs local training on the global model received in the current round using preset semantic data, and obtains the local model of the client in the current round of training and the corresponding model gradient; The upload module is configured such that each client uploads the model gradient obtained by the local training to the central server and enters a blocking state to wait.
8. An asynchronous federated learning device based on information gain, characterized in that: include: Grouping module, filtering module and global aggregation module; The grouping module is configured to, in response to receiving a model gradient sent by any client, determine the feature similarity between the model gradient of the client and each group center, divide the model gradient into groups corresponding to the highest feature similarity, redetermine the group center of the group, and adjust the grouping according to the redetermined group centers; The screening module is configured to calculate, for each adjusted group, the total amount of information, freshness and validity of each model gradient in the group, determine the information gain of the model gradient using the total amount of information, the freshness and the validity, remove the model gradient whose information gain is less than a preset gain threshold, and determine the information gain rate of the group according to the information gain of each model gradient; The global aggregation module is configured to, in response to determining that the information gain rate of any group is greater than a preset gain rate threshold, update the learning rate according to the mean of the staleness of the gradients of each model in the group, aggregate the gradients of each model according to the staleness of the gradients of each model to obtain an aggregated gradient, use the aggregated gradient, the updated learning rate and the constructed group weights to perform a preset gradient descent algorithm on the global model to perform this round of global training, obtain the global model of this round of global training, and send it to the client waiting in a blocked state.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 6.
