Federal learning method and system, storage medium and program product
Through the two-stage federated learning method, the client selection probability is dynamically adjusted, and the client with less data is preferred for preliminary training of the model. The client with larger data is optimized by using the client to optimize the model, which solves the performance and efficiency of the existing federated learning under non-ideal data distribution conditions, and realizes the stability and efficiency of the model under complex data distribution.
Patent Information
- Application Number
- CN202510212627.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-02-25
AI Technical Summary
Existing federated learning methods have deteriorated performance and efficiency under non-ideal data distribution conditions, especially when client data is not independently distributed.
A two-stage federated learning method is adopted. In the first stage, the first stage is to allocate the first selection probability that is negatively correlated to the local data volume, and preferentially select clients with smaller data volume for model training; in the second stage, the second stage is to allocate the second selection probability that is positively correlated with the data volume, and make full use of the data provided by clients with larger data volume for model optimization.
It effectively solves the problem of model training instability caused by the imbalance of client data volume, improves the stability and efficiency of the model under complex data distribution, and improves the robustness and generalization capabilities of the model.
Smart Images

Figure CN120163264A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular, to a federated learning method, system, storage medium, and program product. Background Art
[0002] Federated Learning (FL) is a privacy-preserving distributed machine learning method that can achieve joint modeling without moving user data out of the local area, optimize model performance, and achieve "data does not move while the model moves", effectively protecting data privacy and breaking data islands. As a popular research direction in machine learning, federated learning fully exploits the data value without directly sharing data and shows broad application prospects in fields such as healthcare, financial services, and intelligent Internet of Things. Therefore, designing an efficient and secure federated learning method is crucial for promoting its practical application and giving full play to its potential.
[0003] Currently, existing federated learning methods include: the server randomly selects a subset from all clients and sends the current global model parameters to these clients; subsequently, the clients use the local private data set to train the model, calculate the gradients, and send them back to the server for aggregation processing; repeating the above process, after the global model on the server side converges, the parameters are redistributed to all clients participating in federated learning.
[0004] However, existing federated learning methods have limitations in dealing with the problem of non-independent and identically distributed (non-IID) client data. Specifically, current algorithms mostly focus on the differences in data features while ignoring the impact of data volume differences, and usually select clients to participate in each round of training with a fixed probability, failing to effectively utilize the differences in data volume among clients. In actual scenarios, the data volumes of different clients often show significant imbalances, and such differences may exacerbate the instability of model training, leading to problems such as performance degradation and efficiency reduction of federated learning under non-ideal data distribution conditions. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a federated learning method, system, storage medium, and program product to eliminate or improve one or more defects existing in the prior art and solve the problems of performance degradation and efficiency reduction of existing federated learning under non-ideal data distribution conditions.
[0006] One aspect of the present invention provides a federated learning method, which includes the following steps:
[0007] Determine a set of clients participating in the first-phase federated learning from the client set according to the first selection probability pre-allocated by the client; the first selection probability corresponding to each client is negatively correlated with the local data volume of the client and is determined based on the inverse ratio relationship of the local data volume of the client; the first-phase federated learning includes at least one round of learning rounds, and before the start of each learning round, determine a set of clients participating in the current learning round from the client set again based on the first selection probability;
[0008] In each learning round of the first-phase federated learning, send the global model parameters of the target model to the currently selected client, so that the selected client can perform model training based on the global model parameters and local training data, iterate the model parameters deployed locally and return; aggregate the local model parameters to iterate the global model parameters;
[0009] After each learning round is completed, determine whether the current learning round is the target round. If the current learning round is the target round, re-allocate the second selection probability for each client; the second selection probability corresponding to each client is positively correlated with the local data volume of the client and is determined based on the direct ratio relationship of the local data volume of the client;
[0010] Determine a set of clients participating in the second-phase federated learning from the client set according to the second selection probability; the second-phase federated learning includes at least one round of learning rounds, and before the start of each learning round, determine a set of clients participating in the current learning round from the client set again based on the second selection probability;
[0011] In each learning round of the second-phase federated learning, send the current global model parameters to the currently selected client, so that the currently selected client can perform model training based on the current global model parameters and local training data, iterate the current global model parameters until the target model converges.
[0012] In some embodiments of the present invention, determining whether the current learning round is the target round includes:
[0013] Receive the local loss function value sent by the selected client; the local loss function value is calculated by the selected client based on a preset local loss function;
[0014] Calculate the global loss function value based on the loss function;
[0015] Compare the global loss function value with a preset transformation threshold to obtain a comparison result;
[0016] If the comparison results of consecutive preset numbers of learning rounds indicate that the global loss function value is less than the preset transformation threshold, determine the current round as the target round.
[0017] In some embodiments of the present invention, determining whether the current learning round is the target round includes:
[0018] Determining the convergence situation of the target model, and in the case where the target model converges, determining the model convergence round as the target round.
[0019] In some embodiments of the present invention, after sending the current global model parameters to the currently selected client so that the currently selected client performs model training based on the current global model parameters and local training data and iteratively updating the current global model parameters until the target model converges, it further includes:
[0020] Reassigning a first selection probability for each client based on the inverse relationship of the local data volume of each client;
[0021] Adjusting the target round based on the model convergence round and a preset number to set the target round to a preset number of rounds before the model convergence round;
[0022] Performing the step of determining a group of clients participating in the first-stage federated learning from the client set according to the first selection probability pre-allocated to the clients.
[0023] In some embodiments of the present invention, before determining whether the current learning round reaches the target round, it further includes:
[0024] In the case where the model is a high-performance model, increasing the learning round based on the initial target round to obtain the target round; in the case where the model is a low-performance model, decreasing the learning round based on the initial target round to obtain the target round; wherein the initial target round is preset based on the computing resources corresponding to each client; the computing resources are positively correlated with the initial target round. In some embodiments of the present invention, after sending the current global model parameters to the currently selected client so that the currently selected client performs model training based on the current global model parameters and local training data and iteratively updating the current global model parameters until the target model converges, it further includes:
[0025] Regrouping the client set based on the local data volume of the clients to obtain at least one group of client groupings;
[0026] Sending the current global model parameters of the target model to each group of client groupings respectively, and performing third-stage federated learning within each group of client groupings to obtain an intra-group target model corresponding to each group of client groupings; wherein the intra-group data volume corresponding to each group of client groupings is negatively correlated with the intra-group federated learning round.
[0027] In some embodiments of the present invention, after respectively sending the current global model parameters of the target model to each group of client groups and performing the third-stage federated learning within each group of client groups to obtain the in-group target models corresponding to each group of clients, it further includes:
[0028] Send the model parameters of the in-group target model to each client in the corresponding client group, so that each client trains the in-group target model based on local data to obtain the client model corresponding to each client.
[0029] On the other hand, the present invention also provides a federated learning system, and the system includes:
[0030] A federated learning server for the federated learning method of any one of the above;
[0031] At least two clients, which are used to receive the global model parameters of the target model sent by the federated learning server through the clients selected by the federated learning server and participate in federated learning based on the received global model parameters and local training data; in each learning round of the first-stage federated learning, participate in federated learning through the clients selected based on the first selection probability, perform model training based on local training data and update the model parameters, and return the updated model parameters to the federated learning server for aggregation; in each learning round of the second-stage federated learning: participate in federated learning through the clients selected based on the second selection probability, perform model training based on the globally aggregated and updated model parameters of the federated learning server and local training data until the target model converges.
[0032] On the other hand, the present invention also provides a computer-readable storage medium, on which a computer program / instructions are stored, and when the program / instructions are executed by a processor, the steps of the method of any one of the above are implemented.
[0033] On the other hand, the present invention also provides a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the method described in any one of the above are implemented.
[0034] The beneficial effects of the present invention are at least:
[0035] The federated learning method and system of the present invention can solve the problems of performance degradation and efficiency reduction of existing federated learning under non-ideal data distribution conditions; the federated learning is divided into two stages, the first stage focuses on quickly establishing the basic structure of the model, and the second stage focuses on refined optimization; in the first stage, by assigning a first selection probability negatively correlated with the local data volume to the client, giving priority to the clients with less data volume, ensuring that their unique features can be quickly learned by the model, and avoiding the model being prematurely biased towards the clients with larger data volume. In the second stage, switch to a second selection probability positively correlated with the data volume, make full use of the rich data provided by the clients with larger data volume, and further optimize the model performance, which can effectively cope with the non-independent and identically distributed problems of client data, enabling the model to maintain stability and efficiency under complex data distributions; at the same time, this dynamic adjustment strategy balances the contradiction between data volume and feature diversity, and can improve the robustness and generalization ability of the model.
[0036] In addition, by grouping each client and putting the clients with similar data volumes in a group, the local data volume distribution among the clients within each group is relatively balanced, so as to improve the stability of subsequent training; at the same time, different degrees of federated learning fine-tuning are independently carried out within each client group, full fine-tuning is carried out on the group composed of clients with less data volume, and a small number of rounds of fine-tuning are carried out on the client group composed of clients with larger data volume, so as to balance the neglect of clients with less data volume in the later stage of the global model training stage, and make full use of all client data, overcoming the problem that local fine-tuning performs poorly on clients with less data volume.
[0037] The additional advantages, objects, and features of the present invention will be partially described below, and will become partially obvious to those of ordinary skill in the art after studying the following text, or can be learned from the practice of the present invention. The objects and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the specification and the drawings.
[0038] Those skilled in the art will understand that the objects and advantages that can be achieved by the present invention are not limited to the above specifically described, and the above and other objects that the present invention can achieve will be more clearly understood according to the following detailed description. Brief Description of the Drawings
[0039] The drawings described herein are used to provide a further understanding of the present invention, form a part of this application, and do not limit the present invention. In the drawings:
[0040] Figure 1 It is a schematic flowchart of the federated learning method provided by an embodiment of the present invention.
[0041] Figure 2Schematic diagram of the structure of the federated learning system provided by an embodiment of the present invention. Detailed implementation manners
[0042] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with the implementation manners and the accompanying drawings. Herein, the illustrative implementation manners of the present invention and their descriptions are used to explain the present invention, but do not limit the present invention.
[0043] Herein, it should also be noted that in order to avoid obscuring the present invention due to unnecessary details, only the structures and / or processing steps closely related to the solution of the present invention are shown in the drawings, while other details less related to the present invention are omitted.
[0044] It should be emphasized that the term "including / comprising" when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0045] Herein, it should also be noted that if not otherwise specified, the term "connection" in this article can not only refer to direct connection, but also represent indirect connection with an intermediate.
[0046] In the following, embodiments of the present invention will be described with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0047] Figure 1 Schematic flowchart of the federated learning method according to an embodiment of the present invention, and the method is executed on a federated learning server; wherein, the federated learning server includes a cloud server, a local server, an edge server or a server running in a virtual machine or a container, and the implementation manner of the federated learning server is not limited in this embodiment.
[0048] Specifically, the present application provides a federated learning method, and the method includes the following steps S101 to S105:
[0049] Step S101, determine a group of clients participating in the first-stage federated learning from the client set according to the first selection probability pre-allocated by the clients.
[0050] Wherein, the first-stage federated learning includes at least one round of learning rounds, and before the start of each learning round, a group of clients participating in the current learning round are re-determined from the client set based on the first selection probability.
[0051] A client refers to a terminal that establishes a communication connection with a federated learning server and performs federated learning using local data and other clients connected to the federated learning server, including mobile phones, tablets, or servers, etc. The implementation manner of the client is not limited in this embodiment.
[0052] In federated learning, the local data of clients is usually non-i.i.d., which means that there may be significant differences in the data characteristics and distributions of different clients. If all clients are directly used for global model training of the target model, it may lead to problems such as slow convergence, performance degradation, or instability of the target model.
[0053] Based on this, in the initial stage of federated learning, when the target model has not fully learned the overall characteristics of the data, preferentially selecting clients with less data volume at this time can enable the model to capture the unique characteristics of these clients faster, helping to avoid the target model relying too much on clients with large data volumes and ensuring that the model can fairly learn the important information of each client.
[0054] Taking the federated language recognition system as an example, the federated language recognition system is used for speech-to-text tasks in a multilingual environment. The clients participating in federated learning include user devices from different regions, and their speech data has the following characteristics: data volume differences, in some regions (such as big cities), the number of users is large and the data volume is large, while in remote regions, the number of users is small and the data volume is small; feature distribution differences, users in different regions may have different accents, dialects, or language habits, resulting in significant differences in acoustic features. Based on this, in the initial stage of training, the model needs to quickly learn the dialect features of users in remote regions, avoiding the problem that the model only adapts to the mainstream language or accent.
[0055] In some embodiments of the present invention, a first selection probability is pre-allocated to each client in the client set, and a group of clients is dynamically selected from the client set according to the first selection probability.
[0056] Among them, the first selection probability corresponding to each client is negatively correlated with the local data volume of the client, and is determined based on the inverse ratio relationship of the local data volume of each client after the federated learning client collects the local data volume information of all clients. Specifically, the first selection probability corresponding to each client can be expressed by the following formula:
[0057]
[0058] In the formula, p1 represents the first selection probability; D k represents the local data volume corresponding to the kth client; N represents the number of the first group of clients.
[0059] After determining the first selection probability corresponding to each client, before the start of each learning round in the first-phase federated learning, a group of clients is selected from the client set according to the first selection probability using a random sampling method, such as the Roulette Wheel Selection Algorithm (RWS) or Probability-Based Random Sampling (PBRS).
[0060] Step S102, in each learning round of the first-phase federated learning, send the global model parameters of the target model to the currently selected client, so that the selected client performs model training based on the current global model parameters and local training data, iteratively deploys the local model parameters and returns them; aggregate the local model parameters to iteratively update the global model parameters.
[0061] In each learning round of the first-phase federated learning, the federated learning server sends the global model parameters of the target model to the client selected in the current learning round. The selected client performs model training for the current learning round based on the received global model parameters and local training data, and iteratively updates the global model parameters.
[0062] Taking the total number of rounds of the first-phase federated learning as R rounds as an example, in the r-th round, each currently selected client updates the model based on the received global model parameters and local training data set. At the same time, each client will pre-define a local loss function to measure the performance of the model parameters on the local training data set.
[0063] Among them, R is an integer greater than 1; r is an integer greater than 1 and less than or equal to R; the local loss function includes the Cross-Entropy Loss or the Mean Squared Error (MSE), etc. This embodiment does not limit the type of the local loss function.
[0064] Each currently selected client minimizes the local loss function through an optimization algorithm (such as the gradient descent method), generates new local model parameters, calculates the local loss function value, and returns it to the federated learning server.
[0065] After the federated learning server receives the local model parameters returned by all currently selected clients, it uses an aggregation algorithm (such as the FedAvg algorithm) to perform weighted averaging to generate new global model parameters, and calculates the global loss function value based on the local loss function values returned by each selected client. Among them, the global loss function value is used to indicate the overall performance of the model on the local client data of the selected clients.
[0066] Step S103, after each learning round is completed, determine whether the current learning round is the target round. If the current learning round is the target round, reassign the second selection probability for each client.
[0067] In order to adjust the global model using richer data in the later stage of federated learning and enhance the robustness of the model. Therefore, in the first-stage federated learning, after reaching the target round, it is necessary to adjust the strategy of federated learning and assign the second selection probability to each client to give a higher probability to the client with relatively more local data.
[0068] Among them, the second selection probability corresponding to each client is positively correlated with the local data volume of the client and is determined based on the proportional relationship of the local data volume of each client, and can be expressed by the following formula:
[0069]
[0070] In the formula, p2 represents the second selection probability; D k represents the local data volume corresponding to the k-th client; N represents the number of the first group of clients.
[0071] In some embodiments of the present invention, in the first-stage federated learning, after reaching the target round, adjust the probability of federated learning to perform the second-stage federated learning. Represent the target round by round R, and determine whether the current learning round is the target round, which specifically includes any one of the following situations:
[0072] First, in the case where there are serious differences in the distribution of local data of each client, determine round R according to whether the global loss function value calculated by the federated learning server remains non-decreasing within a certain number of training rounds.
[0073] Specifically, determining whether the current learning round is the target round includes: receiving the local loss function value sent by the selected client; the local loss function value is calculated by the selected client based on a preset local loss function; calculating the global loss function value based on the loss function; comparing the global loss function value with a preset transformation threshold to obtain a comparison result; in the case where the comparison results of consecutive preset numbers of learning rounds indicate that the global loss function value is less than the preset transformation threshold, determine the current round as the target round.
[0074] Second, set round R at the learning round corresponding to the convergence of the target model.
[0075] Specifically, determining whether the current learning round is the target round includes: determining the convergence situation of the target model. If the target model converges, determine the model convergence round as the target round.
[0076] In actual implementation, when the computing resources of the client are limited, in order to save computing resources and training costs, the round R can also be set before the learning rounds corresponding to the convergence of the target model. Among them, the computing resources include but are not limited to processor performance, memory capacity, network bandwidth, and storage capacity.
[0077] Thirdly, determine the round R based on the performance requirements of the target model and the preset initial target round.
[0078] Among them, the initial target round is determined based on the computing resources corresponding to the client, and the computing resources are positively correlated with the initial target round.
[0079] In the case where the computing resources of the client are relatively abundant (such as high-performance processors, large-capacity memories, and high-bandwidth networks), a larger initial target round can be set; in the case where the computing resources of the client are relatively limited (such as low-performance devices or unstable network connections), the initial target round needs to be reduced to avoid training delays or failures due to insufficient client processing capabilities and ensure the efficient operation of the entire federated learning process.
[0080] In some embodiments of the present invention, by performing weighted summation averaging on the computing resources of each client, the average computing resource score of the client is obtained; based on the mapping relationship pre-established between the average computing resource score and the initial target round, the initial target round is determined, or, based on the average computing resource score and a preset monotonically increasing function, the initial target round is calculated.
[0081] In the case where the performance requirements of the target model indicate that the target model is a high-performance model, the number of learning rounds is increased based on the initial target round; in the case where the performance requirements of the target model indicate that the target model is a low-performance model, the number of learning rounds is reduced based on the initial target round.
[0082] Specifically, before determining whether the current learning round reaches the target round, it further includes: in the case where the model is a high-performance model, increasing the number of learning rounds based on the initial target round to obtain the target round; in the case where the model is a low-performance model, reducing the number of learning rounds based on the initial target round to obtain the target round; among them, the initial target round is preset based on the computing resources corresponding to each client; the computing resources are positively correlated with the initial target round. Step S104, determine a group of clients participating in the second-stage federated learning from the client set according to the second selection probability.
[0083] Among them, the second-stage federated learning includes at least one learning round. Before the start of each learning round, a group of clients participating in the current learning round is re-determined from the client set based on the second selection probability.
[0084] Specifically, after determining the second selection probability corresponding to each client, before the start of each learning round in the second-stage federated learning, a random sampling method, such as the Roulette Wheel Selection Algorithm (RWS) or Probability-Based Random Sampling (PBRS), is used to select clients from the client set according to the second selection probability.
[0085] Step S105: In each learning round of the second-stage federated learning, send the current global model parameters to the currently selected client, so that the currently selected client performs model training based on the current global model parameters and local training data, and iteratively update the current global model parameters until the target model converges.
[0086] In each learning round of the second-stage federated learning, the federated learning server sends the current global model parameters of the target model to the client selected in the current learning round. The client selected in the current learning round performs model training based on the received model parameters and local training data.
[0087] After receiving the results returned by all selected clients, the federated learning server uses an aggregation algorithm (such as the FedAvg algorithm) to perform weighted averaging on the local model parameters of the selected clients to generate new global model parameters, and calculates the global loss function value based on the local loss function values returned by each selected client. When the global loss function value indicates that the target model converges, the second-stage federated learning is completed.
[0088] In actual implementation, in the second-stage federated learning, the probability of a client with less local data being selected to participate in the federated learning is lower. Although these clients have been fully trained in the first-stage federated learning, due to the forgetting property of the deep learning model, as the training continues, the adaptability of the global model to the data of these clients will gradually decrease, thus affecting the performance of the personalized models of these clients.
[0089] Based on this, in some embodiments of the present invention, after completing the second-stage federated learning, the target model is adjusted through intra-group federated fine-tuning to different degrees.
[0090] By grouping each client and putting clients with similar data volumes in one group, the local data volume distribution among clients within each group is made relatively balanced, thus improving the stability of subsequent training. Independent and varying degrees of federated learning fine-tuning are carried out within each client group. The group composed of clients with less data is fully fine-tuned, while the client group composed of clients with more data is fine-tuned for a small number of rounds, so as to balance the neglect of clients with less data in the later stage of the global model training phase, enabling all client data to be fully utilized and also overcoming the problem that local fine-tuning performs poorly on clients with less data.
[0091] Specifically, after sending the current global model parameters of the target model to each client group respectively and performing the third-stage federated learning within each client group to obtain the in-group target model corresponding to each client group, it further includes: regrouping the client set based on the local data volume of the clients to obtain at least one client group; sending the current global model parameters of the target model to each client group respectively and performing the third-stage federated learning within each client group to obtain the in-group target model corresponding to each client group; where the in-group data volume corresponding to each client group is negatively correlated with the number of in-group federated learning rounds.
[0092] After completing the model fine-tuning within each client group, based on the model obtained by performing federated learning fine-tuning within each client group, fine-tuning is carried out using the local data of the clients to obtain the final personalized client model.
[0093] Specifically, after sending the current global model parameters of the target model to each client group respectively and performing the third-stage federated learning within each client group to obtain the in-group target model corresponding to each client group, it further includes: sending the model parameters of the in-group target model to each client in the corresponding client group, so that each client trains the in-group target model based on the local data to obtain the client model corresponding to each client.
[0094] In addition, in the case of changes in client data, such as new data addition or data distribution changes, a new round of federated learning needs to be restarted to adapt to the new data state. At this time, the new federated learning can refer to the target round corresponding to the previous round of federated learning and adjust the target round of this round in combination with the current actual situation to ensure that the target round is controlled before the convergence of the first-stage federated learning model. In this way, not only can historical information be fully utilized to optimize the training process, but also the problem of low training efficiency or model performance degradation caused by improper setting of the target round can be effectively avoided.
[0095] Specifically, after sending the current global model parameters of the target model to each group of client groups respectively and performing the third-stage federated learning within each group of client groups to obtain the in-group target models corresponding to each group of clients, it further includes: reallocating the first selection probability for each client based on the inverse relationship of the local data volume of each client; adjusting the target round based on the model convergence round and a preset number, so as to set the target round to a preset number of rounds before the model convergence round; performing the step of determining a group of clients participating in the first-stage federated learning from the client set according to the first selection probability pre-allocated to the clients.
[0096] On the other hand, as Figure 2 shown, the present invention also provides a federated learning system, which includes a federated learning server and at least two clients:
[0097] The federated learning server is used to implement the above-mentioned federated learning method.
[0098] First, the federated learning server determines a group of clients participating in the first-stage federated learning from the client set according to the first selection probability pre-allocated to each client. Among them, the first selection probability corresponding to each client is negatively correlated with the local data volume of the client and is determined based on the inverse relationship of the local data volume of each client. The first-stage federated learning includes at least one round of learning rounds. Before the start of each learning round, a group of clients participating in the current learning round is re-determined from the client set based on the first selection probability.
[0099] In each learning round of the first-stage federated learning, the federated learning server sends the current global model parameters of the target model to the clients selected in the current round, so that the first group of clients performs the first-stage federated learning based on the current global model parameters and local training data.
[0100] At least two clients are used to receive the current global model parameters of the target model sent by the federated learning server through the clients selected by the federated learning server in the current round, and participate in the federated learning based on the received current global model parameters and local training data; in each learning round of the first-stage federated learning, the clients selected based on the first selection probability participate in the federated learning, perform model training based on the local training data, iterate and deploy the local model parameters, and return them to the federated learning server.
[0101] Meanwhile, after each learning round of the first-stage federated learning, the federated learning server is further configured to determine whether the current learning round is the target round. In the case that the current learning round is the target round, it reassigns a second selection probability for each client. The second selection probability corresponding to each client is positively correlated with the local data volume of the client and is determined based on the proportional relationship of the local data volume of each client.
[0102] Next, two groups of clients participating in the second-stage federated learning are determined from the client set according to the second selection probability. The second-stage federated learning includes at least one learning round. Before the start of each learning round, a group of clients participating in the current learning round is re-determined from the client set based on the second selection probability.
[0103] In each learning round of the second-stage federated learning, the current global model parameters are sent to the currently selected client, so that the currently selected client performs model training based on the current global model parameters and local training data, and iteratively updates the current global model parameters until the target model converges.
[0104] In each learning round of the second-stage federated learning, at least two clients participate in the federated learning through the clients selected based on the second selection probability, and continue to perform model training based on the updated current global model parameters of the federated learning server and local training data until the target model converges.
[0105] For relevant details, refer to the above embodiments.
[0106] It should be noted that when the federated learning system provided in the above embodiments performs federated learning, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs to complete all or part of the functions described above. In addition, the federated learning system provided in the above embodiments and the embodiments of the federated learning method belong to the same concept, and the specific implementation process is detailed in the method embodiments and will not be repeated here.
[0107] In summary, the present invention provides a federated learning method and system. The method is executed on a federated learning server. A set of clients participating in the first-phase federated learning is determined from a client set according to a first selected probability pre-allocated to each client. The first selected probability corresponding to each client is negatively correlated with the local data volume of the client and is determined based on the inverse ratio relationship of the local data volume of each client. The current global model parameters of the target model are sent to the selected clients, so that the selected clients can perform model training based on the current global model parameters and local training data. After each learning round of the first-phase federated learning, it is determined whether the current learning round is the target round. If the current learning round is the target round, a second selected probability is re-allocated to each client. The second selected probability corresponding to each client is positively correlated with the local data volume of the client and is determined based on the direct ratio relationship of the local data volume of each client. A set of clients participating in the second-phase federated learning is determined from the client set according to the second selected probability. The current global model parameters are sent to the currently selected clients, so that the currently selected clients can perform a model based on the current global model parameters and local training data until the target model converges. It can solve the problems of performance degradation and efficiency reduction of existing federated learning under non-ideal data distribution conditions. The federated learning is divided into two phases. The first phase focuses on quickly establishing the basic structure of the model, and the second phase focuses on fine-tuning. In the first phase, by allocating a first selected probability negatively correlated with the local data volume to the clients, clients with less data volume are given priority, ensuring that their unique features can be quickly learned by the model and preventing the model from prematurely biasing towards clients with larger data volumes. In the second phase, the second selected probability positively correlated with the data volume is switched to make full use of the rich data provided by clients with larger data volumes to further optimize the model performance. It can effectively cope with the non-independent and identically distributed problem of client data, enabling the model to maintain stability and efficiency under complex data distributions. At the same time, this dynamic adjustment strategy balances the contradiction between data volume and feature diversity, and can improve the robustness and generalization ability of the model.
[0108] In addition, by grouping each client and placing clients with similar data volumes in a group, the local data volume distribution among clients within each group is relatively balanced to improve the stability of subsequent training. At the same time, different degrees of federated learning fine-tuning are independently performed within each client group. The group composed of clients with less data volume is fully fine-tuned, and the client group composed of clients with larger data volumes is fine-tuned for a small number of rounds, thereby balancing the neglect of clients with less data volume in the later stage of the global model training phase and enabling all client data to be fully utilized, overcoming the problem that local fine-tuning performs poorly on clients with less data volume.
[0109] On the other hand, the present invention also provides a computer-readable storage medium, on which a computer program / instructions is stored, and when the program / instructions are executed by a processor, the steps of any one of the above-mentioned federated learning methods are implemented.
[0110] On the other hand, the present invention also provides a computer program product, including a computer program / instructions, characterized in that when the computer program / instructions are executed by a processor, the steps of any one of the above-mentioned federated learning methods are implemented.
[0111] Those of ordinary skill in the art should understand that the various exemplary components, systems, and methods described in connection with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Specifically, whether to implement in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave on a transmission medium or a communication link.
[0112] It should be clear that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, the detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order between steps after understanding the spirit of the present invention.
[0113] In the present invention, the features described and / or illustrated for one embodiment can be used in the same way or in a similar way in one or more other embodiments, and / or combined with the features of other embodiments or replace the features of other embodiments.
[0114] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, various changes and modifications can be made to the embodiments of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A federated learning method, characterized in that: The method comprises the following steps: According to the first selection probability pre-assigned by the client, a group of clients participating in the first phase of federated learning is determined from the client set; the first selection probability corresponding to each client is negatively correlated with the amount of local data of the client, and is determined based on the inverse relationship between the amount of local data of the client; the first phase of federated learning includes at least one round of learning, and before the start of each learning round, a group of clients participating in the current learning round is re-determined from the client set based on the first selection probability; In each learning round of the first stage of federated learning, the global model parameters of the target model are sent to the currently selected client, so that the selected client performs model training based on the global model parameters and local training data, iterates the model parameters deployed locally and returns; aggregates the local model parameters to iterate the global model parameters; After each learning round is completed, determine whether the current learning round is the target round, and if the current learning round is the target round, reallocate the second selection probability for each client; the second selection probability corresponding to each client is positively correlated with the amount of local data of the client, and is determined based on the proportional relationship of the amount of local data of the client; Determine a group of clients participating in the second phase of federated learning from the client set according to the second selection probability; the second phase of federated learning includes at least one round of learning, and before each learning round starts, re-determine a group of clients participating in the current learning round from the client set based on the second selection probability; In each learning round of the second stage of federated learning, the current global model parameters are sent to the currently selected client, so that the currently selected client performs model training based on the current global model parameters and local training data, and iterates the current global model parameters until the target model converges.
2. The method according to claim 1, characterized in that The determining whether the current learning round is the target round includes: Receiving a local loss function value sent by the selected client; the local loss function value is calculated by the selected client based on a preset local loss function; Calculate a global loss function value based on the loss function; Comparing the global loss function value with a preset transformation threshold to obtain a comparison result; When the comparison results of a preset number of consecutive learning rounds indicate that the global loss function value is less than the preset transformation threshold, the current round is determined as the target round.
3. The method according to claim 1, characterized in that The determining whether the current learning round is the target round includes: The convergence of the target model is determined, and when the target model converges, the model convergence round is determined as the target round.
4. The method according to claim 3, characterized in that The sending of the current global model parameters to the currently selected client so that the currently selected client performs model training based on the current global model parameters and local training data, and iterating the current global model parameters until the target model converges, further includes: Based on the inverse relationship between the amount of local data of each client, reallocate the first selection probability to each client; Adjusting the target round based on the model convergence round and a preset number to set the target round to a preset number of rounds before the model convergence round; The step of determining a group of clients participating in the first phase of federated learning from the client set according to the first selection probability pre-assigned by the client is performed.
5. The method according to claim 1, characterized in that Before determining whether the current learning round reaches the target round, the method further includes: When the model is a high-performance model, the learning rounds are increased on the basis of the initial target rounds to obtain the target rounds; when the model is a low-performance model, the learning rounds are reduced on the basis of the initial target rounds to obtain the target rounds; wherein the initial target rounds are pre-set based on the computing resources corresponding to each client; and the computing resources are positively correlated with the initial target rounds.
6. The method according to claim 1, characterized in that The sending of the current global model parameters to the currently selected client so that the currently selected client performs model training based on the current global model parameters and local training data, and iterating the current global model parameters until the target model converges, further includes: Regrouping the client set based on the amount of local data of the client to obtain at least one group of client groups; The current global model parameters of the target model are sent to each group of client groups respectively, and the third stage of federated learning is performed in each group of client groups to obtain the in-group target model corresponding to each group of clients; wherein the in-group data amount corresponding to each group of client groups is negatively correlated with the in-group federated learning round.
7. The method according to claim 6, characterized in that After sending the current global model parameters of the target model to each group of client groups, respectively, performing the third stage of federated learning in each group of client groups, and obtaining the target model in the group corresponding to each group of clients, the method further includes: The model parameters of the target model within the group are sent to each client in the corresponding client group, so that each client trains the target model within the group based on local data to obtain a client model corresponding to each client.
8. A federated learning system, characterized in that: The system comprises: A federated learning server, configured to execute the federated learning method according to any one of claims 1 to 7; At least two clients are used to receive the global model parameters of the target model sent by the federated learning server through the client selected by the federated learning server, and participate in federated learning based on the received global model parameters and local training data; in each learning round of the first stage of federated learning, the client selected based on the first selection probability participates in the federated learning, and model training is performed based on the local training data and the model parameters are updated, and the updated model parameters are returned to the federated learning server for aggregation; in each learning round of the second stage of federated learning: the client selected based on the second selection probability participates in the federated learning, and model training is performed based on the global model parameters and local training data aggregated and updated by the federated learning server until the target model converges.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method as claimed in any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Federal learning method and system
CN114781545A
Voice recognition method based on personalized federal learning
CN116665654A
Adaptive asynchronous federated learning method and system based on deep reinforcement learning
CN118586474A
Federal learning-based client selection method and system
CN119204262A
Federated learning optimizations
US20230177349A1