Federated learning adaptive optimization method based on client quantity and communication period

By calculating the optimal number of clients and communication cycle, the federated learning process is adaptively adjusted, solving the problems of training speed and accuracy, and achieving faster model training and higher accuracy.

CN116341687BActive Publication Date: 2025-12-05NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211088880.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-07
Publication Date
2025-12-05
Estimated Expiration
2042-09-07

AI Technical Summary

Technical Problem

In existing federated learning systems, the number of clients participating in each round of updates is fixed, which affects training speed and accuracy, and the communication time overhead is large, resulting in low model training efficiency.

Method used

By calculating the optimal number of clients and communication cycle in the federated learning framework, the number of clients and communication cycle are adaptively adjusted, and the model training process is optimized by combining stochastic gradient descent, thus optimizing the training time in stages.

Benefits of technology

It accelerated the convergence speed of model training, improved training accuracy, and reduced training time overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116341687B_ABST
    Figure CN116341687B_ABST
Patent Text Reader

Abstract

The application discloses a federated learning adaptive optimization method based on the number of clients and communication periods, which comprises the following steps: a client trains a local model; a Lipschitz constant and an upper limit of a standard deviation of a local model target function are estimated, and an optimal number of clients m and a communication period tau in a federated learning framework are calculated; a central server sends initial values of global model parameters to m clients; the selected clients train the local models, and update the local model parameters and the target function values of each client; the central server aggregates the local model parameters and the target function values corresponding to each client to obtain new global model parameters w and a target function value F; and the global model parameters w are output. The federated learning process is divided into multiple stages according to a set unit time interval, the number of participating client and the size of the communication period are adaptively modified, the model training process of the federated learning is effectively accelerated, and the convergence speed of the global model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to federated learning technology, and in particular to an adaptive optimization method for federated learning based on the number of clients and the communication cycle. Background Technology

[0002] With the rapid development of mobile and IoT devices, the primary source of data is now edge devices rather than cloud devices. These edge devices are equipped with increasingly advanced sensors and stronger computing and communication capabilities. Therefore, more and more scholars, experts, and companies are considering storing data locally and pushing network computing to edge devices, leading to the emergence of frameworks like Mobile Edge Computing (MEC) as a solution. MEC frameworks typically collect large amounts of user data and send it to a central server; however, this operation raises privacy concerns, as the data could be eavesdropped on by malicious users on the network, thus compromising customer privacy.

[0003] Federated learning is a distributed machine learning framework that enables joint learning without collecting all user data. This effectively addresses the privacy concerns of MEC (Multi-access Edge Computing) frameworks by keeping training data on personal devices. Communication is a critical technical bottleneck in federated learning networks, which can consist of numerous devices, such as millions of smartphones. Model training and data transmission on these edge devices consume significant communication time. The number of participating clients and the communication cycle are important factors affecting the training time of federated learning models. In existing federated learning systems, the number of clients participating in each update round is usually fixed, impacting the training speed and accuracy of the federated learning framework. Summary of the Invention

[0004] Purpose of the invention: To address the above problems, the purpose of this invention is to provide an adaptive optimization method for federated learning based on the number of clients and the communication cycle. This optimization method comprehensively considers the impact of the number of clients and the communication cycle on the training speed and training error of the federated learning framework. While ensuring high accuracy of the trained model, it reduces the training time overhead of the federated learning framework and improves the convergence speed of the model.

[0005] Technical Solution: This invention provides an adaptive optimization method for federated learning based on the number of clients and communication cycle, applied to a federated learning framework. The federated learning framework includes a central server and multiple clients. The multiple clients collaboratively train a neural network model in a distributed manner under the coordination of the central server. The optimization method includes the following steps:

[0006] Step 1: The central server randomly selects a client k. This client uses stochastic gradient descent to train the local model for r rounds, obtaining the local model parameters.

[0007] Step 2: Estimate the Lipschitz constant and upper bound of the standard deviation of the local model objective function using the local model parameters, and calculate the optimal number of clients m and communication period τ in the federated learning framework based on the Lipschitz constant and upper bound of the standard deviation of the local model objective function.

[0008] Step 3: The central server sends the initial value w0 of the global model parameters to m clients; the selected clients set their local model parameters to w0, use stochastic gradient descent to train their local models for τ rounds, update the local model parameters and objective function values ​​of each client after training, and send the updated values ​​back to the central server.

[0009] Step 4: The central server aggregates the local model parameters and objective function values ​​corresponding to each client to obtain new global model parameters w and objective function values ​​F;

[0010] Step 5: Determine whether the global objective function value F has reached the training accuracy ε. If F > ε, the central server records the current training time t and determines the size of the training time t. If t is less than the unit time interval T0 of the multi-stage training, jump to step 3. If t is greater than T0, update the training time t = t - T0 and jump to step 2. If F < ε, the training ends and the global model parameters w are output.

[0011] Furthermore, step 2 specifically includes:

[0012] Calculate the gradient sequence g based on the local model parameters. i The expression is:

[0013]

[0014] In the formula, The model is randomly initialized with parameters η, where η is the learning rate and i represents the number of training epochs.

[0015] Calculate sequence L based on local model parameters and gradient sequence. i The expression is:

[0016]

[0017] In the formula, ‖·‖ represents the calculation of the second normal form;

[0018] The Lipschitz constant L of the objective function is calculated based on the sequence, and the expression is:

[0019] L = max i∈[1,r-1] {Li};

[0020] The upper bound σ of the standard deviation of the objective function is calculated based on the gradient sequence, and the expression is:

[0021]

[0022] In the formula, This represents the average value of the gradient sequence.

[0023] Furthermore, the expressions for the optimal number of clients m and the communication period τ mentioned in step 2 are as follows:

[0024]

[0025]

[0026] In the formula, Y is the average time difference for a client to perform one round of local model training, and D is the communication latency for a single client to transmit model parameters to the central server.

[0027] Furthermore, the expressions for the global model parameter w and the objective function value F mentioned in step 4 are as follows:

[0028]

[0029]

[0030] In the formula, w k and F k These are the updated local model parameters and corresponding local objective function values ​​for the k-th client, respectively, n. k Let k be the amount of sample data owned by the k-th client.

[0031] Beneficial effects: Compared with the prior art, the significant advantages of this invention are: This invention focuses on the relationship between training speed and training error in the federated learning framework, and proposes a method for calculating the optimal number of clients and communication cycle; This invention divides the entire federated learning process into multiple stages according to a set unit time interval, calculates the optimal number of clients and communication cycle for each stage, and adaptively modifies the number of participating clients and the size of the communication cycle during model training, effectively accelerating the model training process of federated learning, improving the convergence speed of the global model, and ensuring that the model has high accuracy. Attached Figure Description

[0032] Figure 1 This is a flowchart of the adaptive optimization method of the present invention. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments.

[0034] like Figure 1 This embodiment describes an adaptive optimization method for federated learning based on the number of clients and communication cycle. This method is applied to a federated learning framework, which includes a central server and multiple clients. The multiple clients collaboratively train a neural network model in a distributed manner under the coordination of the central server. The optimization method includes the following steps:

[0035] Step 1: The central server randomly selects a client k. This client uses stochastic gradient descent to train the local model for r rounds, obtaining the local model parameters.

[0036] The federated learning framework described above consists of a central server and multiple clients. The central server maintains a global model with parameters w, and each client maintains its own local model, with the local model parameters of the k-th client denoted as w. k It possesses n sample data. k .

[0037] Step 2: Estimate the Lipschitz constant and upper bound of the standard deviation of the local model objective function using the local model parameters, and calculate the optimal number of clients m and communication period τ in the federated learning framework based on the Lipschitz constant and upper bound of the standard deviation of the local model objective function.

[0038] The above-mentioned estimation of the Lipschitz constant and upper bound of the standard deviation of the local model objective function using local model parameters specifically includes:

[0039] Calculate the gradient sequence g based on the local model parameters. i The expression is:

[0040]

[0041] In the formula, The model is randomly initialized with parameters η, where η is the learning rate and i represents the number of training epochs.

[0042] Calculate sequence L based on local model parameters and gradient sequence. i The expression is:

[0043]

[0044] In the formula, ‖·‖ represents the calculation of the second normal form;

[0045] The Lipschitz constant L of the objective function is calculated based on the sequence, and the expression is:

[0046] L = max i∈[1,r-1] {L i};

[0047] The upper bound σ of the standard deviation of the objective function is calculated based on the gradient sequence, and the expression is:

[0048]

[0049] In the formula, This represents the average value of the gradient sequence.

[0050] The expressions for calculating the optimal number of clients m and communication period τ in the federated learning framework based on the Lipschitz constant and upper bound of the standard deviation of the local model's objective function are as follows:

[0051]

[0052]

[0053] In the formula, Y is the average time difference for a client to perform one round of local model training, and D is the communication latency for a single client to transmit model parameters to the central server.

[0054] Step 3: The central server sends the initial global model parameter value w0 to m clients; the selected clients set their local model parameters to w0 and train their local models using stochastic gradient descent for τ rounds. After training, the local model parameters w0 for each client are updated. k and objective function value F k The updated value is then sent back to the central server.

[0055] Initialize the global model and related variables. In this embodiment, the initial value of the global objective function F is 1, the initial value of the global model parameter w is a random value, and the initial training time t = 0 is initialized.

[0056] Step 4: The central server aggregates the local model parameters and objective function values ​​corresponding to each client to obtain new global model parameters w and objective function values ​​F;

[0057] The expressions for the global model parameters w and the objective function value F are as follows:

[0058]

[0059]

[0060] In the formula, w k and F k These are the updated local model parameters and corresponding local objective function values ​​for the k-th client, respectively, n. k Let k be the amount of sample data owned by the k-th client.

[0061] Step 5: Determine if the global objective function value F has reached the training accuracy ε. If F > ε, the central server records the current training time t and determines the magnitude of training time t. If t is less than the unit time interval T0 of multi-stage training, proceed to step 3. If t is greater than T0, update the training time t = t - T0 and proceed to step 2. If F < ε, training ends, and the global model parameters w are output. The training accuracy is a preset value.

[0062] To verify that the federated learning adaptive optimization method of this invention can effectively accelerate the training speed of the federated learning model, the following examples are provided for comparison and illustration. In this verification example, the amount of sample data n possessed by each client is set. k With the same value of 480, the average time difference Y for a client to perform one round of local model training is 0.5s, the communication latency D for a single client to transmit model parameters to the central server is 0.2s, the learning rate η is 0.1, the unit time interval T0 for multi-stage training is 60s, and the training accuracy ε is 0.05.

[0063] Randomly select a client k=3, and use stochastic gradient descent to perform r=10 mini-batch training iterations on the local model to obtain the local model parameter sequence. The values ​​are: {0.33246, 0.67662, 0.97788, 1.21133, 1.53068, 1.78022, 2.07607, 2.30032, 2.52935, 2.89057, 3.26035};

[0064] The gradient sequence {g} is calculated. i |i∈[1,10]} is: {3.4416, 3.0125, 2.3345, 3.1935, 2.4953, 2.9585, 2.2425, 2.2902, 3.6121, 3.6978};

[0065] Calculate the sequence {L i |i∈[1,9]} is: {1.4240, 2.9046, 2.6898, 2.7975, 1.5653, 3.1928, 0.2087, 3.6595, 0.2314};

[0066] The Lipschitz constant L of the objective function is calculated to be 3.7824;

[0067] Calculate the mean of the gradient sequence If the standard deviation is 2.9278, then the upper bound σ of the objective function is:

[0068]

[0069] Set the initial value of the global objective function F to 1, the initial value of the global model parameter w to a random value of 1.12, and initialize the training time t = 0;

[0070] Calculate the optimal number of clients m and communication period τ as follows:

[0071]

[0072]

[0073] The central server selects 4 clients and sends the global model parameter w = 1.12 to these 4 clients. The selected clients set their local model parameter w k to 1.12 for all k ∈ [1, m], and use the stochastic gradient descent method to train the local model for 3 rounds, obtaining the local model parameters {w k |k ∈ [1, 4]} as: {1.4313, 1.6301, 1.4568, 1.5597}, and the objective function values {F k |k ∈ [1, 4]} as: {0.634, 0.617, 0.608, 0.622}, and send them back to the central server;

[0074] The central server calculates the new global model parameter w and objective function value F:

[0075]

[0076]

[0077] At this time, the global objective function value 0.620 > ε(0.05), and the central server records the current training time t = 14s < T0(60s), and continues to train using the current parameters m = 4, τ = 3; when the value of the global objective function F is 0.221 > ε(0.05), and at this time the training time of the model t = 61s > T0(60s), then set the training time t = 61s - 60s = 1s, jump to the step of calculating the optimal number of clients and communication period, calculate the new parameters m = 4, τ = 2, and continue training;

[0078] Repeat this process until the global objective function value F is 0.049 < 0.05, and at this time the global model parameter w = 43.7615 is the desired model training result, and the training ends.

[0079] In summary, this invention proposes an adaptive optimization method for federated learning based on the number of clients and the communication cycle. This method can adaptively modify the number of participating clients and the length of the communication cycle during the training of the federated learning model, effectively accelerating the convergence speed of the federated learning model training and ensuring high model accuracy.

Claims

1. A federated learning adaptive optimization method based on the number of clients and the communication period, applied to a federated learning framework, the federated learning framework comprising a central server and a plurality of clients, characterized in that, A plurality of clients cooperatively train a neural network model in a distributed manner under the coordination of a central server, and the optimization method comprises the following steps: Step 1, the central server randomly selects a client k, which trains the local model for r rounds using the stochastic gradient descent method to obtain the local model parameters In step 2, the Lipschitz constant and the upper bound of the standard deviation of the local model objective function are estimated by using the local model parameters, and the optimal number of clients m and the communication period τ in the federated learning framework are calculated according to the Lipschitz constant and the upper bound of the standard deviation of the local model objective function; The expressions of the optimal number of clients m and the communication period τ are respectively: In the formula, Y is the average time difference of one round of local model training of the client, D is the communication delay of the single client transmitting the model parameters to the central server; L is the Lipschitz constant of the objective function, σ is the upper bound of the standard deviation of the objective function; η is the learning rate, and F is the global objective function value; In step 3, the central server sends the initial value w0 of the global model parameters to the m clients; the selected clients set the local model parameters to w0, and use the stochastic gradient descent method to train the local model for τ rounds, update the local model parameters and the objective function value corresponding to each client after the training is completed, and send the updated value back to the central server; In step 4, the central server aggregates the local model parameters and the objective function value corresponding to each client to obtain the new global model parameters w and the objective function value F; In step 5, it is judged whether the global objective function value F reaches the training precision ε, if F>ε, the central server records the current training time t, judges the training time t, if t is less than the unit time interval T0 of the multi-stage training, it is jumped to step 3, if t is greater than T0, the training time t is updated as t=t-T0, and it is jumped to step 2; if F<ε, the training is completed, and the global model parameters w are output.

2. The federated learning adaptive optimization method of claim 1, wherein, The step 2 specifically comprises: According to the local model parameters, a gradient sequence g is calculated i The expression is: wherein are the random initialization parameters of the model, η is the learning rate, and i denotes the number of training rounds. According to the local model parameters and the sequence of gradients, a sequence L is calculated i , the expression is: In the formula, ‖·‖ represents calculating the two norms; According to the sequence, the Lipschitz constant L of the objective function is calculated, and the expression is: According to the gradient sequence, the upper bound σ of the standard deviation of the objective function is calculated, and the expression is: In the formula, is the average value of the gradient sequence.

3. The federated learning adaptive optimization method of claim 1, wherein, In step 4, the expressions of the global model parameters w and the objective function value F are respectively: where w k and F k are the updated local model parameters and the corresponding local objective function value of the kth client, respectively, n k is the amount of sample data owned by the kth client,