An Adaptive Aggregation-based Federated Learning System, Method, Device and Storage Medium

The self-adaptive federated learning system addresses synchronization inefficiencies by computing weights based on client data and model features, optimizing aggregation modes for improved training efficiency and model performance.

CN115713113BActive Publication Date: 2025-07-15SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211506085.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2025-07-15
Estimated Expiration
2042-11-29

AI Technical Summary

Technical Problem

The existing federated learning framework cannot adaptively calculate the aggregation weight based on the data characteristics and model characteristics of the client in the real scenario in the asynchronous aggregation mode, resulting in slowing training speed and degrading model performance, and cannot select a suitable aggregation mode according to user needs, affecting training efficiency.

Method used

It provides a federated learning system for adaptive aggregation. It obtains the client's data features and model features through the feature perception layer, calculates the normalized weights through the weight allocation layer, performs weighted aggregation layer, the information prediction layer predicts the performance of different aggregation modes, and the strategy selection layer selects the most suitable aggregation mode for training.

Benefits of technology

It improves the training efficiency of federated learning, can adaptively allocate weights and select appropriate aggregation mode in different scenarios, meets the specific needs of users, and improves the training speed and performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115713113B_ABST
    Figure CN115713113B_ABST
Patent Text Reader

Abstract

The present invention discloses an adaptive aggregation-based federated learning system, method, device, and storage medium. The central server distributes the global model to all client devices, enabling the client devices to train local models based on local data and then return the updated local models to the central server. The central server adaptively calculates the normalized weights of each client device according to the data characteristics and model characteristics of the client devices, and then adopts different aggregation modes to perform aggregation updates on the global model. The first model accuracy, the first time cost, and the first communication cost under different aggregation modes are predicted, and then these predicted information is pushed to facilitate the selection of a suitable aggregation mode according to user requirements. Then, formal federated learning training is carried out according to this aggregation mode. Embodiments of the present invention can adaptively calculate aggregation weights and select a suitable aggregation mode for federated learning training, improving the training efficiency of federated learning, and can be widely applied to the field of federated learning technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a federated learning system, method, device and storage medium for adaptive aggregation. Background Art

[0002] In recent years, with the rise of big data and deep learning, a large amount of multi-source heterogeneous data has caused problems such as the isolated distribution of data and the lack of data privacy supervision. Personal privacy and data security have received increasing attention. At the same time, fine-grained data islands also restrict the development of data services. In the actual application process, it is not only difficult to avoid the risk of sensitive information leakage, but also reduces the accuracy of services. In recent years, using the federated learning framework for local training of user data and global optimization of model parameters has become one of the effective solutions to meet the needs of user privacy protection and multi-source heterogeneous data fusion.

[0003] The traditional federated learning framework adopts the synchronous aggregation mode (Synchronous), that is, in each training round, the central server synchronously sends the global model to multiple clients. After the multiple clients train the model based on local data, they return the updated local models to the central server. The central server waits for all clients to upload the local models before performing global model aggregation and update. The synchronous aggregation mode can make full use of the data information of all clients during aggregation to ensure that the global model can converge efficiently. However, since synchronous aggregation needs to wait for all clients to upload the local models before performing global model aggregation and update, when there are situations such as network congestion at the central server side or slow training speeds of some clients, it is easy to cause the problem of inefficient global model update.

[0004] Currently, most federated learning frameworks adopt the asynchronous aggregation mode (Asynchronous), that is, the central server asynchronously sends the global model to multiple clients. After multiple clients train the model based on local data, they return the updated local models to the central server. After the central server waits for the clients to upload the local models within the specified waiting time, it determines the weights of the local models uploaded by each client according to the time difference between the client receiving the global model and returning the updated local model, and performs weighted aggregation update of the global model. The asynchronous aggregation mode does not need to wait for all clients to upload local models, and can determine the weights of different clients according to the staleness of the local models, ensuring that the global model can converge more efficiently. However, in different scenarios, different waiting times have a direct impact on the performance of the aggregated global model. At the same time, since the local data of clients is usually coarse-grained data, that is, the quantity is small, the data category coverage is insufficient, and the distribution between categories is unbalanced, and the current asynchronous aggregation mode implies the assumption of averaging local data characteristics, only focusing on the time heterogeneity of clients and not being able to pay more attention to clients with high-quality data, so it cannot distinguish clients according to the data characteristics in the actual situation, resulting in a slowdown in training speed, a decline in model performance, and an increase in communication costs.

[0005] Therefore, how to adaptively calculate the aggregation weights according to the characteristics of clients and local models in real application scenarios and select an appropriate aggregation mode for federated learning training to improve the training efficiency of federated learning has become an urgent problem to be solved. Summary of the Invention

[0006] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art to a certain extent.

[0007] To this end, an object of an embodiment of the present invention is to provide a federated learning system with adaptive aggregation, which can adaptively calculate the aggregation weights and select an appropriate aggregation mode for federated learning training, improving the training efficiency of federated learning.

[0008] Another object of an embodiment of the present invention is to provide a federated learning method with adaptive aggregation.

[0009] In order to achieve the above technical objectives, the technical solutions adopted in the embodiments of the present invention include:

[0010] In the first aspect, an embodiment of the present invention provides a federated learning system with adaptive aggregation, including:

[0011] A local training layer, which is used for the client to train the model based on local data after receiving the global model sent by the central server and return the updated local model to the central server;

[0012] A feature perception layer for obtaining the data features of each of the client devices and the model features of the local model;

[0013] A weight allocation layer for calculating the normalized weights of each of the client devices during the weighted aggregation of the global model based on the data features and the model features;

[0014] An aggregation update layer for performing weighted aggregation on the local models uploaded by each of the client devices according to the normalized weights and a plurality of preset aggregation modes, calculating the model accuracy of the global model in the current aggregation round, and sending the updated global model to each of the client devices participating in the aggregation;

[0015] An information prediction layer for predicting based on the model accuracy in the current aggregation round and the model accuracy in the previous aggregation round to obtain prediction information corresponding to each of the aggregation modes, where the prediction information includes the first model accuracy that can be achieved within a preset time under each of the aggregation modes, and the first time cost and the first communication cost required to reach a preset second model accuracy;

[0016] A strategy selection layer for selecting a first aggregation mode from the aggregation modes according to the prediction information pushed by the central server and the user requirements obtained in advance, and performing formal federated learning training according to the first aggregation mode.

[0017] Further, in an embodiment of the present invention, the data features include the proportion of the local data samples of the client device in the total of the local data samples of all client devices in the current aggregation round, and the data richness of the local data samples of the client device, and the model features include the model obsolescence of the local model.

[0018] Further, in an embodiment of the present invention, the calculation formula for the normalized weight is:

[0019]

[0020] where represents the normalized weight of the k-th client device when participating in the weighted aggregation of the global model, represents the time normalized weight of the k-th client device, DW k represents the data volume normalized weight of the k-th client device, represents the data richness normalized weight of the k-th client device;

[0021] The calculation formula for the time normalized weight is:

[0022] TW k =(r - r k +1) -α

[0023]

[0024]

[0025] Among them, TW k represents the time weight of the k-th client, K represents the total number of clients participating in the training, r represents the current aggregation round, r k represents the round in which the global model aggregated by the k-th client is received, and α represents a preset hyperparameter, α ∈ (0, 1);

[0026] The calculation formula for the data volume normalization weight is:

[0027]

[0028]

[0029] Among them, n represents the total data volume of all clients in the current aggregation round, n k represents the data volume of the local data samples of the k-th client;

[0030] The calculation formula for the data richness normalization weight is:

[0031]

[0032]

[0033]

[0034] Among them, IW k is the data richness of the local data samples of the k-th client, p i, represents the proportion of the i-th type of samples in the local data samples of the k-th client, l k represents the total number of sample categories of the local data samples of the k-th client.

[0035] Furthermore, in an embodiment of the present invention, the aggregation mode includes a synchronous aggregation mode and multiple asynchronous aggregation modes with different maximum waiting times. Among them, the synchronous aggregation mode is that the central server performs global model weighted aggregation after each client uploads the corresponding local model, and the asynchronous aggregation mode is that the central server performs global model weighted aggregation according to the received local models after a preset maximum waiting time.

[0036] Furthermore, in an embodiment of the present invention, the prediction information is obtained through the following steps:

[0037] Determine the accuracy improvement gradient based on the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round;

[0038] Determine the second time cost and the second communication cost of the current aggregation round;

[0039] Predict the first model accuracy based on the accuracy improvement gradient, the second time cost, and the preset time;

[0040] Predict the first time cost based on the accuracy improvement gradient, the second time cost, and the second model accuracy;

[0041] Predict the first communication cost based on the accuracy improvement gradient, the second communication cost, and the second model accuracy.

[0042] Further, in an embodiment of the present invention, the information prediction layer is further configured to:

[0043] Determine a plurality of second aggregation modes according to the prediction information, and push the second aggregation modes to the policy selection layer through a central server, where the second aggregation modes include at least one of the aggregation mode with the highest first model accuracy, the aggregation mode with the lowest first time cost, and the aggregation mode with the lowest first communication cost.

[0044] Further, in an embodiment of the present invention, the aggregation update layer is further configured to:

[0045] After the policy selection layer selects the first aggregation mode, perform weighted aggregation on the local models uploaded by each client according to the normalized weight and the first aggregation mode.

[0046] In a second aspect, an embodiment of the present invention provides a federated learning method for adaptive aggregation, including the following steps:

[0047] Send the initial global model to each client, so that after each client receives the global model, perform model training based on local data and return the updated local model to the central server;

[0048] Obtain the data features and the model features of the local models of each client, and calculate the normalized weights of each client during the weighted aggregation of the global model according to the data features and the model features;

[0049] Weighted aggregation is performed on the local models uploaded by each of the client devices according to the normalized weights and a plurality of preset aggregation modes, the model accuracy of the global model in the current aggregation round is calculated, and the updated global model is sent to each of the client devices participating in the aggregation;

[0050] Predictions are made based on the model accuracy in the current aggregation round and the model accuracy in the previous aggregation round to obtain prediction information corresponding to each of the aggregation modes;

[0051] A first aggregation mode is selected from the aggregation modes according to the prediction information and the user requirements obtained in advance, and the first aggregation mode is returned to the central server, so that the central server performs formal federated learning training according to the first aggregation mode.

[0052] In a third aspect, an embodiment of the present invention provides a federated learning device for adaptive aggregation, including:

[0053] At least one processor;

[0054] At least one memory for storing at least one program;

[0055] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned federated learning method for adaptive aggregation.

[0056] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored, and the program executable by the processor is used to execute the above-mentioned federated learning method for adaptive aggregation when executed by the processor.

[0057] The advantages and beneficial effects of the present invention will be partially given in the following description, partially will become obvious from the following description, or will be understood through the practice of the present invention:

[0058] In the federated learning system according to the embodiments of the present invention, the central server distributes the global model to all client devices, enabling the client devices to train local models based on local data and then return the updated local models to the central server. The central server adaptively calculates the normalized weights of each client device according to the data characteristics and model characteristics of the client devices, and then adopts different aggregation modes to perform aggregation updates on the global model, and predicts the first model accuracy that can be achieved within a preset time and the first time cost and first communication cost required to reach the preset second model accuracy under different aggregation modes. Then, these prediction information is pushed to facilitate users to select a suitable aggregation mode according to their specific needs, and then formal federated learning training is carried out according to this aggregation mode. The embodiments of the present invention can adaptively calculate the aggregation weights and select a suitable aggregation mode for federated learning training, improving the training efficiency of federated learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following introduces the drawings required to be used in the embodiments of the present invention. It should be understood that the drawings introduced below only facilitate the clear expression of some embodiments of the technical solutions in the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative efforts.

[0060] Figure 1 It is a structural block diagram of a federated learning system with adaptive aggregation provided by an embodiment of the present invention;

[0061] Figure 2 It is a schematic diagram of the pre-training process of a federated learning system with adaptive aggregation provided by an embodiment of the present invention;

[0062] Figure 3 It is a schematic diagram of the formal training process of a federated learning system with adaptive aggregation provided by an embodiment of the present invention;

[0063] Figure 4 It is a schematic diagram of the synchronous aggregation mode of a federated learning system with adaptive aggregation provided by an embodiment of the present invention;

[0064] Figure 5 It is a schematic diagram of the asynchronous aggregation mode of a federated learning system with adaptive aggregation provided by an embodiment of the present invention;

[0065] Figure 6 It is a schematic flow chart of a method for federated learning with adaptive aggregation provided by an embodiment of the present invention;

[0066] Figure 7 It is a structural block diagram of a device for federated learning with adaptive aggregation provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0067] Embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where like or similar reference numerals denote like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation to the present invention. For the step numbers in the following embodiments, they are only set for the convenience of explanation and illustration, and no limitation is imposed on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0068] In the description of the present invention, the meaning of "a plurality" is two or more. If the first and second are described, it is only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence of the indicated technical features. In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this technology belongs.

[0069] Referring to Figure 1 , an embodiment of the present invention provides an adaptive aggregation federated learning system, including:

[0070] A local training layer, configured to, after the client receives the global model sent by the central server, perform model training based on local data and return the updated local model to the central server;

[0071] A feature perception layer, configured to obtain the data features of each client and the model features of the local model;

[0072] A weight allocation layer, configured to calculate the normalized weights of each client during the weighted aggregation of the global model according to the data features and the model features;

[0073] An aggregation update layer, configured to perform weighted aggregation on the local models uploaded by each client according to the normalized weights and a plurality of preset aggregation modes, calculate the model accuracy of the global model in the current aggregation round, and send the updated global model to each client participating in the aggregation;

[0074] An information prediction layer, configured to perform prediction according to the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round to obtain prediction information corresponding to each aggregation mode. The prediction information includes the first model accuracy that can be achieved within a preset time under each aggregation mode, as well as the first time cost and the first communication cost required to reach the preset second model accuracy;

[0075] The strategy selection layer is used to select the first aggregation mode from the aggregation modes according to the prediction information pushed by the central server and the user needs obtained in advance, and perform formal federated learning training according to the first aggregation mode.

[0076] When the federated learning system of the embodiment of the present invention is used for federated learning training, several rounds of local model training and global model weighted aggregation are first performed as pre-training, and the results of the pre-training will serve as the basis for the subsequent selection of the aggregation mode. Figure 2 FIG. 1 is a schematic diagram of a pre-training process of an adaptive aggregated federated learning system provided by an embodiment of the present invention, wherein:

[0077] The local training layer is used by the client to train the local model using local data based on a certain loss function and optimizer after receiving the global model sent by the central server, and then return the trained local model to the central server.

[0078] The feature perception layer is used to obtain data features of different clients and the features of the local models they upload, such as the proportion of the client's local data samples in the current aggregation round of all client data, the richness of the client's local data samples, and the staleness of the local model. The specific acquisition method is that the client uploads various information of the local data used in the local training layer and the aggregation round received from the global model at the same time when uploading the local model.

[0079] The weight distribution layer is used to adopt a specific weight distribution scheme, that is, according to the different features obtained by the feature perception layer, the normalized weight of each client when the global model is aggregated is calculated.

[0080] The aggregation update layer is used by the central server to weighted aggregate the local models uploaded by each client, calculate the accuracy of the global model in the current aggregation round, and delegate the updated global model to each client participating in the aggregation. In the pre-training phase, the central server will use multiple aggregation modes to perform weighted aggregation on the uploaded local models, where different aggregation modes refer to synchronous aggregation modes and asynchronous aggregation modes with different maximum waiting times. Different aggregation modes all use the above weight distribution scheme.

[0081] The information prediction layer is used by the central server to predict the model accuracy that can be achieved in a certain period of time and the time cost and communication cost required to achieve a certain accuracy rate in different aggregation modes based on the accuracy rate of the global model in the current aggregation round and the previous aggregation round. Specifically, the model accuracy that can be achieved in a certain period of time in the future is predicted based on the accuracy improvement gradient of the previous and next aggregation rounds, and the time cost and communication cost required to achieve a certain accuracy rate is predicted based on the time cost and communication cost consumed by the previous and next aggregation rounds and the improvement in accuracy.

[0082] like Figure 3The figure shows a schematic diagram of the formal training process of an adaptive aggregation-based federated learning system provided by an embodiment of the present invention, where:

[0083] The policy selection layer is used for the service user to select a suitable aggregation mode for formal federated learning training according to the prediction information of different aggregation modes pushed by the central server and the recommended aggregation mode, and referring to its own specific requirements such as the need for a lower time cost. After selecting a suitable aggregation mode, the central server will obtain the aggregation mode information selected by the service user and use this aggregation model for weighted aggregation update of the global model in the subsequent federated learning training.

[0084] The functions of the local training layer, the feature perception layer, and the weight allocation layer in the formal training process are the same as their functions in the pre-training process, and the relevant steps are also the same.

[0085] The function of the aggregation update layer in the formal training process is basically the same as its function in the pre-training process. The difference is that the central server only uses one aggregation mode for weighted aggregation update of the global model in the formal federated learning training, that is, the aggregation mode selected by the service user in the previous step.

[0086] It can be understood that the weight allocation scheme of the embodiment of the present invention can be calculated according to various characteristics of the client data and the model, such as the sample distribution of different categories of the client local data, the obsolescence of the local model, etc.; the embodiment of the present invention can provide different aggregation methods. After the federated learning starts, the central server can perform pre-training for a certain period of time, predict the characteristics of different aggregation methods after pre-training, such as the communication cost required to reach a certain accuracy rate, and push this prediction information to the user and can also recommend the most efficient aggregation mode, so that the user can flexibly select a suitable aggregation mode according to its own specific requirements for subsequent federated learning. The embodiment of the present invention has the following advantages:

[0087] 1) The weight allocation scheme pays attention to more features and has strong adaptability: The weight allocation scheme used in the embodiment of the present invention can calculate the aggregation weight of each client according to the proportion of the local data sample of each client in all client data in the current aggregation round, the richness of the local data sample of each client, the distribution ratio of different categories of data in the local data sample of each client, and the obsolescence of the local model. In this way, it can simultaneously pay attention to the data characteristics of the client and the obsolescence of the local model, making the weight allocation more reasonable, with strong adaptability, and can achieve good results in different scenarios.

[0088] 2) It has multiple aggregation modes: Different from most existing technical solutions that have only one aggregation mode, the embodiment of the present invention has the currently commonly used synchronous aggregation mode and asynchronous aggregation mode, which can be flexibly used in different scenarios.

[0089] 3) Capable of pre-training to provide users with the most suitable aggregation solution: After starting federated learning, the embodiment of the present invention will use different aggregation modes for pre-training, and at the same time predict the characteristic information of different aggregation methods, such as the time cost required to achieve a certain accuracy rate, and then push this information to the user and recommend a relatively efficient aggregation mode. The user can flexibly choose the aggregation mode according to their own needs, thereby improving the training efficiency of federated learning.

[0090] As a further optional implementation, the data features include the ratio of the client's local data samples to the total local data samples of all clients in the current aggregation round, and the data richness of the client's local data samples, and the model features include the model staleness of the local model.

[0091] Specifically, the larger the amount of local data on the client, the richer the categories of local data samples, and the more uniform the category distribution ratio of local data samples, the better the performance of the local model trained thereby, and the more conducive it is to the convergence of the global model; the staleness of the local model refers to the time consumed by the client from the receipt of the global model to the completion of the training and update of the local model. In the asynchronous aggregation mode, since the central server does not have to wait for all clients to upload local models when aggregating and updating the global model, some clients with too slow training speed may have been training on an unupdated global model, that is, the staleness is large. In this case, the trained local model is not conducive to the convergence of the global model. Therefore, the aggregation weight of the local model with a large staleness should be lower.

[0092] As an optional implementation, the calculation formula of the normalized weight is:

[0093]

[0094] in, represents the normalized weight of the kth client when participating in the weighted aggregation of the global model, represents the time-normalized weight of the k-th client, DW k represents the normalized weight of the data volume of the kth client, represents the normalized weight of the data richness of the kth client;

[0095] The calculation formula of time normalization weight is:

[0096] TW k =(rr k +1) -α

[0097]

[0098]

[0099] Among them, TW k represents the time weight of the k-th client, K represents the total number of clients participating in the training, r represents the current aggregation round, and r k represents the round in which the global model received by the k-th client is aggregated, and α represents a preset hyperparameter, where α ∈ (0, 1);

[0100] The calculation formula for the data volume normalization weight is as follows:

[0101]

[0102]

[0103] Among them, n represents the total data volume of all clients in the current aggregation round, and n k represents the data volume of the local data samples of the k-th client;

[0104] The calculation formula for the data richness normalization weight is as follows:

[0105]

[0106]

[0107]

[0108] Among them, IW k is the data richness of the local data samples of the k-th client, and p i, represents the proportion of the i-th type of sample in the local data samples of the k-th client, and l k represents the total number of sample categories of the local data samples of the k-th client.

[0109] It can be understood that the time normalization weight is related to the obsolescence of the local model and is calculated through the current aggregation round and the round in which the global model received by the client is aggregated; the data volume normalization weight is related to the proportion of the local data samples; the data richness normalization weight is related to the distribution of different types of samples in the local data samples.

[0110] Furthermore, as an optional implementation manner, the aggregation mode includes a synchronous aggregation mode and multiple asynchronous aggregation modes with different maximum waiting times. Among them, the synchronous aggregation mode is that the central server performs weighted aggregation of the global model after each client uploads the corresponding local model, and the asynchronous aggregation mode is that the central server performs weighted aggregation of the global model according to the received local models after the preset maximum waiting time.

[0111] Such as Figure 4The figure shows a schematic diagram of the synchronous aggregation mode of an adaptive aggregation-based federated learning system provided by an embodiment of the present invention. It can be understood that after each client receives the global model sent by the central server, it starts training the model based on local data and returns the updated local model to the central server after the model training is completed; the central server needs to wait for all K clients to upload their local models before it can perform global model aggregation and update.

[0112] As Figure 5 The figure shows a schematic diagram of the asynchronous aggregation mode of an adaptive aggregation-based federated learning system provided by an embodiment of the present invention. It can be understood that after each client receives the global model sent by the central server, it starts training the model based on local data and returns the updated local model to the central server after the model training is completed; the central server waits for clients to upload their local models within the specified maximum waiting time, and performs weighted aggregation and update on the received local models after reaching the maximum waiting time T. The local models that have not been uploaded in the current aggregation round (such as the local model of client 2) will participate in the weighted aggregation in subsequent rounds. It should be recognized that in different scenarios, the maximum waiting time T of the asynchronous aggregation mode has a crucial impact on the improvement of the global model accuracy. Therefore, the embodiments of the present invention regard asynchronous aggregation modes with different maximum waiting times T as different aggregation modes.

[0113] Further as an optional implementation manner, the prediction information is obtained through the following steps:

[0114] Determine the accuracy improvement gradient according to the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round;

[0115] Determine the second time cost and the second communication cost of the current aggregation round;

[0116] Predict the first model accuracy according to the accuracy improvement gradient, the second time cost, and the preset time;

[0117] Predict the first time cost according to the accuracy improvement gradient, the second time cost, and the second model accuracy;

[0118] Predict the first communication cost according to the accuracy improvement gradient, the second communication cost, and the second model accuracy.

[0119] Specifically, the specific calculation formula for the model accuracy is:

[0120]

[0121] Among them, acc represents the model accuracy, FP represents the number of samples that are actually negative samples but are judged as positive samples, FN represents the number of samples that are actually positive samples but are judged as negative samples, TN represents the number of samples that are actually negative samples and are judged as negative samples at the same time, and TP represents the number of samples that are actually positive samples and are judged as positive samples at the same time.

[0122] The accuracy improvement gradient can be obtained according to the difference in the model accuracy between the previous and the next rounds.

[0123] The specific calculation formula for the second time cost is:

[0124] Tcost = T r -T r-1

[0125] Among them, Tcost represents the second time cost, and T r represents the moment when the r-th aggregation round is completed, and T r-1 represents the moment when the (r - 1)-th aggregation round is completed.

[0126] The specific calculation formula for the second communication cost is:

[0127]

[0128] Among them, Ncost represents the communication cost, N j represents the number of bytes occupied by the j-th model transmitted, and M represents the total number of models transmitted.

[0129] In some optional embodiments, the accuracy improvement value per unit time is determined according to the accuracy improvement gradient and the second time cost, and then multiplied by the preset time to obtain the first model accuracy, and the second model accuracy is divided by this accuracy improvement value to obtain the first time cost; similarly, the accuracy improvement value of the unit communication cost can be calculated to determine the first communication cost.

[0130] Further as an optional implementation manner, the information prediction layer is further configured to:

[0131] Determine a number of second aggregation modes according to the prediction information, and push the second aggregation modes to the policy selection layer through the central server. The second aggregation modes include at least one of the aggregation mode with the highest first model accuracy, the aggregation mode with the lowest first time cost, and the aggregation mode with the lowest first communication cost.

[0132] Specifically, after completing the federated learning pre-training, the central server pushes the prediction information of different aggregation modes recorded by the information prediction layer to the service user and recommends several aggregation modes, such as the aggregation mode with the highest accuracy of the first model, the aggregation mode with the lowest first-time cost, and the aggregation mode with the lowest first communication cost. The recommended aggregation mode can also be determined by comprehensively considering the accuracy, time cost, and communication cost.

[0133] Further as an optional implementation, the aggregation update layer is further configured to:

[0134] After the first aggregation mode is selected by the policy selection layer, the local models uploaded by each client are weighted and aggregated according to the normalized weights and the first aggregation mode.

[0135] The system structure and training process of the embodiments of the present invention have been described above. Next, the advantages of the embodiments of the present invention over the prior art will be described.

[0136] In the prior art, although the aggregation modes of some federated learning frameworks can determine the aggregation weights of different clients according to certain specific rules or objectives, most of the technical solutions are relatively limited. They only design their weight allocation schemes according to a certain rule, such as minimizing the objective function or the local sample ratio of the client, resulting in poor generalization and weak adaptability of the technical solutions. It is impossible to comprehensively focus on the characteristics of the local model and difficult to achieve good results in other application scenarios outside the specific scenario. At the same time, these solutions also only adopt a single aggregation mode, such as synchronous aggregation. In summary, the problems of the prior art solutions are summarized as follows:

[0137] 1) The adaptability of the weight allocation scheme is weak; the prior art solutions only design their weight allocation schemes according to a certain rule, such as minimizing the objective function or the local sample ratio of the client. Therefore, it is impossible to simultaneously focus on multiple characteristics of the client and the local model, such as the obsolescence of the local model, the data sample volume of the client, and the data sample distribution ratio of the client, etc., making it difficult to allocate higher weights to clients with high-quality local models.

[0138] 2) A single aggregation mode may lead to inefficient aggregation; most of the prior art solutions adopt the synchronous aggregation mode, that is, the central server needs to wait for all clients to upload their local models before performing the aggregation update of the global model. When there are situations such as network congestion on the central server side or slow training speeds of some clients, it is easy to cause the problem of inefficient global model update.

[0139] 3) It is impossible to provide a suitable aggregation scheme according to the user's needs; the existing technical solutions can only provide a synchronous aggregation mode or an asynchronous aggregation mode with a fixed maximum waiting time, and cannot tailor a suitable aggregation scheme for the user according to the real scenario where the user is located. When the training speeds of all client machines in the scenario where the user is located are not very different, the synchronous aggregation mode can make full use of the data information of all client machines to ensure that the global model converges more efficiently. At this time, choosing the synchronous aggregation mode can ensure that a global model with better performance can be obtained in a short time; when the training speeds of the client machines are quite different, the asynchronous aggregation mode can avoid the straggler problem, enabling the global model to achieve better performance.

[0140] The embodiment of the present invention provides a federated learning system with adaptive aggregation and selectable aggregation modes, which can adaptively allocate the weights of client aggregation according to the characteristics of different scenarios, and recommend different aggregation modes for users through pre-training, meeting the needs of users using the federated learning framework in different scenarios and improving the training efficiency of federated learning. Specifically:

[0141] 1) The embodiment of the present invention has an adaptive weight allocation scheme. In the embodiment of the present invention, when updating the global model by weighted aggregation, a weight allocation scheme is designed, which can adaptively allocate the weights of each client participating in the aggregation according to the data characteristics of the client and the obsolescence characteristics of the uploaded local model. This weight allocation scheme can simultaneously focus on multiple characteristics, thus ensuring that weights can be reasonably allocated in different scenarios.

[0142] 2) The embodiment of the present invention can use different aggregation modes for pre-training and obtain information on different aggregation modes. In the embodiment of the present invention, pre-training is carried out in the first few rounds of starting federated learning. The central server can obtain the characteristic information of different aggregation modes through information such as the accuracy change of the global model, the time cost consumed, and the communication cost in the pre-training.

[0143] 3) The embodiment of the present invention can push information on different aggregation modes to users and recommend aggregation modes. In the embodiment of the present invention, after the pre-training is completed, the central server can push information reflecting the advantages and disadvantages of different aggregation modes to the users, such as the accuracy that can be achieved within a certain time using this mode, the time cost required to reach a certain accuracy, etc., and the central server will also recommend a relatively efficient aggregation mode for the users.

[0144] 4) Users can select a suitable aggregation mode according to their own needs. Users can select a suitable aggregation mode for subsequent formal federated learning training according to the pushed information and in combination with their actual needs, such as being unable to tolerate a large time cost.

[0145] Refer to Figure 6, an embodiment of the present invention provides an adaptive aggregation federated learning method, including the following steps:

[0146] S101. Send the initial global model to each client, so that after each client receives the global model, it performs model training based on local data and returns the updated local model to the central server;

[0147] S102. Obtain the data features of each client and the model features of the local model, and calculate the normalized weights of each client during the weighted aggregation of the global model according to the data features and model features;

[0148] S103. Perform weighted aggregation on the local models uploaded by each client according to the normalized weights and a plurality of preset aggregation modes, calculate the model accuracy of the global model in the current aggregation round, and send the updated global model to each client participating in the aggregation;

[0149] S104. Make a prediction based on the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round to obtain prediction information corresponding to each aggregation mode;

[0150] S105. Select a first aggregation mode from the aggregation modes according to the prediction information and the pre-obtained user requirements, and return the first aggregation mode to the central server, so that the central server performs formal federated learning training according to the first aggregation mode.

[0151] The content in the above system embodiment is applicable to the method embodiment of the present invention. The functions specifically implemented by the method embodiment of the present invention are the same as those of the above system embodiment, and the beneficial effects achieved are also the same as those of the above system embodiment.

[0152] Referring to Figure 7 , an embodiment of the present invention provides an adaptive aggregation federated learning device, including:

[0153] At least one processor;

[0154] At least one memory for storing at least one program;

[0155] When the above at least one program is executed by the above at least one processor, the above at least one processor implements the above-mentioned adaptive aggregation federated learning method.

[0156] The content in the above method embodiment is applicable to the device embodiment of the present invention. The functions specifically implemented by the device embodiment of the present invention are the same as those of the above method embodiment, and the beneficial effects achieved are also the same as those of the above method embodiment.

[0157] An embodiment of the present invention also provides a computer-readable storage medium, which stores a program executable by a processor. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned federated learning method with adaptive aggregation.

[0158] A computer-readable storage medium according to an embodiment of the present invention can execute a federated learning method with adaptive aggregation provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.

[0159] An embodiment of the present invention also discloses a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 4 the method shown.

[0160] In some alternative embodiments, the functions / operations mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the functions / operations involved, two consecutive blocks shown may actually be executed substantially simultaneously or the above-mentioned blocks can sometimes be executed in the reverse order. In addition, the embodiments presented and described in the flowcharts of the present invention are provided by way of example for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operations and logical flows presented herein. Alternative embodiments are foreseeable, in which the order of various operations is changed and the sub-operations described as part of a larger operation are executed independently.

[0161] In addition, although the present invention is described in the context of functional modules, it should be understood that unless otherwise stated to the contrary, one or more of the above functions and / or features may be integrated in a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It can also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More precisely, considering the attributes, functions, and internal relationships of various functional modules in the devices disclosed herein, the actual implementation of the modules will be understood within the ordinary skills of an engineer. Therefore, those skilled in the art can implement the present invention as set forth in the claims without undue experimentation. It can also be understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, and the scope of the present invention is determined by the full scope of the appended claims and their equivalents.

[0162] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above methods in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0163] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus, or device and execute the instructions), or in conjunction with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0164] More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection part with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the above program can be printed, because the above program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or processing it in other suitable ways as necessary, and then storing it in a computer memory.

[0165] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), and the like.

[0166] In the foregoing description of this specification, descriptions with reference to the terms "one embodiment / example", "another embodiment / example", or "certain embodiments / examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0167] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the claims and their equivalents.

[0168] The above is a specific description of the preferred embodiments of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art can also make various equivalent deformations or substitutions without departing from the spirit of the present invention, and these equivalent deformations or substitutions are all included within the scope defined by the claims of this application.

Claims

1. An adaptive aggregation-based federated learning system, characterized in that Including: A local training layer, which is used for the client to train the model based on local data after receiving the global model sent by the central server and return the updated local model to the central server; A feature perception layer, which is used to obtain the data features of each client and the model features of the local model; A weight allocation layer, which is used to calculate the normalized weights of each client during the weighted aggregation of the global model according to the data features and the model features; An aggregation update layer, which is used to perform weighted aggregation on the local models uploaded by each client according to the normalized weights and a plurality of preset aggregation modes, calculate the model accuracy of the global model in the current aggregation round, and send the updated global model to each client participating in the aggregation; An information prediction layer, which is used to make predictions according to the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round to obtain prediction information corresponding to each aggregation mode, where the prediction information includes the first model accuracy that can be achieved within a preset time under each aggregation mode, as well as the first time cost and the first communication cost required to reach the preset second model accuracy; A strategy selection layer, which is used to select a first aggregation mode from the aggregation modes according to the prediction information pushed by the central server and the user requirements obtained in advance, and perform formal federated learning training according to the first aggregation mode; The calculation formula of the normalized weight is: Among them, represents the normalized weight when the k-th client participates in the global model weighted aggregation, represents the time-normalized weight of the k-th client, DW k represents the data volume-normalized weight of the k-th client, represents the data richness-normalized weight of the k-th client; The calculation formula of the time-normalized weight is: TW k =(r - r k + 1) -α Among them, TW k represents the time weight of the k-th client, K represents the total number of clients participating in the training, r represents the current aggregation round, r k represents the round in which the global model received by the k-th client is aggregated, and α represents a preset hyperparameter, where α ∈ (0, 1); The calculation formula of the data volume-normalized weight is: Among them, n represents the total amount of data of all clients in the current aggregation round, and n k represents the amount of data of the local data sample of the k-th client; The calculation formula of the data richness-normalized weight is: Among them, IW k The data richness of the local data sample of the k-th client, p i,k Indicates the proportion of the i-th type of sample in the local data sample of the k-th client, l k Indicates the total number of sample categories of the local data sample of the k-th client.

2. The adaptive aggregation-based federated learning system according to claim 1, wherein: The data features include the proportion of the local data samples of the client in the total of the local data samples of all clients in the current aggregation round, and the data richness of the local data samples of the client, and the model features include the model obsolescence of the local model.

3. An adaptive aggregation-based federated learning system according to claim 1, wherein The aggregation modes include a synchronous aggregation mode and a plurality of asynchronous aggregation modes with different maximum waiting times. Among them, the synchronous aggregation mode is that the central server performs weighted aggregation of the global model after each client uploads the corresponding local model, and the asynchronous aggregation mode is that the central server performs weighted aggregation of the global model according to the received local model after the preset maximum waiting time.

4. An adaptive aggregation-based federated learning system according to claim 1, wherein The prediction information is obtained through the following steps: Determine the accuracy improvement gradient according to the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round; Determine the second time cost and the second communication cost of the current aggregation round; Predict the first model accuracy according to the accuracy improvement gradient, the second time cost and the preset time; Predict the first time cost according to the accuracy improvement gradient, the second time cost and the second model accuracy; Predict the first communication cost according to the accuracy improvement gradient, the second communication cost and the second model accuracy.

5. An adaptive aggregation-based federated learning system according to claim 1, characterized in that, The information prediction layer is further used for: Determine a number of second aggregation patterns according to the prediction information, and push the second aggregation patterns to the policy selection layer through the central server. The second aggregation patterns include at least one of the aggregation pattern with the highest accuracy of the first model, the aggregation pattern with the lowest first time cost, and the aggregation pattern with the lowest first communication cost.

6. An adaptive aggregation-based federated learning system according to any one of claims 1 to 5, characterized in that The aggregation update layer is further configured to: After the policy selection layer selects a first aggregation pattern, perform weighted aggregation on the local models uploaded by each client according to the normalized weight and the first aggregation pattern.

7. An adaptive aggregation-based federated learning method, characterized in that, It includes the following steps: Send the initial global model to each client, so that after each client receives the global model, it performs model training based on local data and returns the updated local model to the central server; Obtain the data features and model features of each client, and calculate the normalized weight of each client during the weighted aggregation of the global model according to the data features and the model features; Perform weighted aggregation on the local models uploaded by each client according to the normalized weight and a plurality of preset aggregation patterns, calculate the model accuracy of the global model in the current aggregation round, and send the updated global model to each client participating in the aggregation; Make a prediction based on the model accuracy of the current aggregation round and the model accuracy of the previous aggregation round to obtain prediction information corresponding to each aggregation pattern; Select a first aggregation pattern from the aggregation patterns according to the prediction information and the pre-obtained user requirements, and return the first aggregation pattern to the central server, so that the central server performs formal federated learning training according to the first aggregation pattern; The calculation formula of the normalized weight is: Among them, represents the normalized weight when the k-th client participates in the global model weighted aggregation, represents the time-normalized weight of the k-th client, DW k represents the data volume normalized weight of the k-th client, represents the data richness normalized weight of the k-th client; The calculation formula of the time-normalized weight is: TW k =(r - r k + 1) -α Among them, TW k represents the time weight of the k-th client, K represents the total number of clients participating in the training, r represents the current aggregation round, r k represents the round in which the global model received by the k-th client is aggregated, and α represents a preset hyperparameter, where α ∈ (0, 1); The calculation formula of the data volume-normalized weight is: Among them, n represents the total amount of data of all clients in the current aggregation round, and n k represents the amount of data of the local data sample of the k-th client; The calculation formula of the data richness-normalized weight is: where IW k the data richness of the local data sample of the k-th client, p i,k represents the proportion of the i-th type of samples in the local data sample of the k-th client, l k represents the total number of sample categories of the local data sample of the k-th client.

8. An adaptive aggregation-based federated learning device, characterized in that, It includes: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements an adaptive aggregation federated learning method as claimed in claim 7.

9. A computer-readable storage medium storing a program executable by a processor, characterized in that, The program executable by the processor, when executed by the processor, is used to execute an adaptive aggregation federated learning method as claimed in claim 7.

Citation Information

Patent Citations

  • Federal learning method fusing adaptive weight distribution and personalized differential privacy

    CN114595831A

  • Federal learning network flow classification model training method based on unbalanced data distribution, model and classification method

    CN115002031A