Federal learning method and system based on client clustering selection under Non-IID data

By employing a client-side clustering selection strategy, the central server selects clients to participate in training based on loss values ​​and accuracy. This addresses the issues of slow convergence speed and low accuracy in federated learning for Non-IID data, enabling efficient global model training.

CN118965046AActive Publication Date: 2024-11-15ZHEJIANG SCI-TECH UNIV

Patent Information

Application Number
CN202410982114.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-15
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

In the case of Non-IID data, federated learning suffers from problems such as slow global model convergence speed, low training accuracy, and limited network bandwidth.

Method used

By using a client-side clustering selection method, the central server clusters clients based on their loss values ​​and selects the clients with the highest accuracy to participate in global model training, thereby reducing communication overhead.

Benefits of technology

It achieves convergence of the global model under Non-IID data, improves training accuracy and reduces communication overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118965046A_ABST
    Figure CN118965046A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning method and method based on client clustering selection under Non-IID data. The method comprises the following steps: S1, constructing a federated learning system model under the Non-IID data; s2, the client downloads the global model, calculates a loss value and an accuracy rate, and sends the calculated loss value and the accuracy rate to a central server; s3, the central server clusters the clients according to the loss values, and selects the clients participating in federated learning training in each cluster according to the accuracy; and S4, the selected client updates local model parameters and sends the local model parameters to the central server, the central server performs global model aggregation and iteration, and judges whether a target accuracy rate or a maximum federated learning training round number is reached, if not, the step S2 is executed, and if yes, the federated learning training round is stopped. According to the method, the requirement on the network communication bandwidth can be relaxed, and the convergence of the global model under Non-IID data is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of federated learning and client selection, and in particular, relates to a federated learning method and system based on client cluster selection under Non-IID (non-independent and identically distributed) data. Background Art

[0002] In recent years, with the development of big data, the processing power, video memory, and memory bandwidth of a single machine are often unable to meet the needs of large models, which has led to the rise of distributed machine learning. However, the problem of data privacy leakage has gradually become prominent. To solve this problem, federated learning came into being. In traditional federated learning, the client performs model training locally and sends local model parameter updates to the central server. The central server aggregates the model based on the received parameter updates and updates the global model. This provides opportunities for fields such as healthcare, finance, and the Internet of Things. However, the non-independent and identically distributed (Non-IID) characteristics of data in practical applications bring many challenges to federated learning.

[0003] Under Non-IID data, each client has a different data distribution, and there may be significant differences between locally trained models. When the central server aggregates the scattered models, the convergence speed of the global model is slow and the training accuracy of the model is also low. At the same time, the network bandwidth is limited, and it is impractical for the central server to perform model updates and aggregation on all clients in parallel. Based on this, the present invention proposes a federated learning method and system based on client clustering selection under Non-IID data. By selecting clients suitable for participating in global model training, the convergence of the global model under Non-IID data is achieved under low bandwidth requirements. Summary of the invention

[0004] The purpose of the present invention is to address the above-mentioned problems existing in federated learning under Non-IID data, and to provide a federated learning method and system based on client cluster selection under Non-IID data, which improves training accuracy and reduces communication overhead through the technology of client cluster selection.

[0005] In order to achieve the purpose of the present invention, the present invention adopts the following technical scheme:

[0006] A federated learning method based on client cluster selection under Non-IID data includes the following steps:

[0007] S1. Construct a federated learning system model under Non-IID data;

[0008] S2. The client downloads the global model, calculates the loss value and accuracy, and sends the calculated loss value and accuracy to the central server;

[0009] S3. The central server clusters the clients according to the loss value and selects the clients that participate in the federated learning training in each cluster according to the accuracy rate;

[0010] S4. The selected client updates the local model parameters and sends them to the central server. The central server completes the global model aggregation and determines whether the target accuracy or the maximum number of federated learning training rounds is reached. If not, it returns to step S2; if reached, it stops the federated learning training.

[0011] Furthermore, in step S1, a federated learning system model under Non-IID data is constructed, wherein the federated learning system model under Non-IID data includes a central server and multiple clients, M = {1, 2, ..., n} represents the set of all clients, S represents the set of selected clients, the constant m represents the number of clients selected by the central server in each round, ω t represents the global model parameters in the tth round of federated learning training. For client i, the local dataset distributed by the central server is defined as D i , the number of times selected to participate in global model training is defined as C i , and define the loss value of client i in the tth round of federated learning training as The model parameters are updated to

[0012] Furthermore, step S2 specifically includes:

[0013] S21. The client downloads the global model from the central server and uses cross entropy to calculate the loss value of the global model and the local data set in the tth round After expansion, it is sent to the central server. The expansion method is specifically expressed as follows:

[0014]

[0015] Where i represents the client, and i∈M, represents the cross entropy loss value of client i in the tth round of federated learning training. λ is a constant, which represents the expansion factor. After expansion, Sent to the central server to participate in the clustering task;

[0016] S22. The client calculates the accuracy acc of the global small test set on the local model i And sent to the central server, the specific calculation method is as follows:

[0017]

[0018] Among them, n correct The number of samples correctly classified using the local model for the test set, n totalIndicates the total number of samples in the test set.

[0019] Furthermore, in step S3, the central server calculates the loss value of each client i after the expansion in the tth round. The K-Center-Greedy strategy is used for clustering. After clustering is completed, the clients with the highest accuracy are selected from the m clusters to form a set S. The clients in the set S participate in the update of the global model.

[0020] Further, step S4 is specifically as follows:

[0021] S41. Client i∈S calculates the local model parameter update and sends it to the central server. Set S represents all selected clients. The calculation of the local model parameter update is as follows:

[0022]

[0023] in, is the local model parameter of client i in round t, ω t-1 is the global model parameter at round t-1;

[0024] S42. The central server selects the client i based on the number of times C i and local dataset size |D i |Calculate the score as follows:

[0025]

[0026] Among them, |D i | represents the size of the local data set of client i, C i It represents the number of times client i is selected, and β is a floating point number in the range of [0,1].

[0027] S43. The central server calculates the weight of client i participating in the global model training based on the score and completes the global model aggregation, as follows:

[0028]

[0029] Among them, Score i is the score calculated by client i in step S42;

[0030] S44. The central server determines the test set in the global model ω t Whether the prediction accuracy under t reaches the target accuracy or whether t reaches the maximum number of federated learning training rounds, if not, return to execute step S2, if so, stop the federated learning training.

[0031] The present invention also provides a federated learning system based on client clustering selection under Non-IID data, based on the above method, including the following modules:

[0032] Model building module, used to build a federated learning system model under Non-IID data;

[0033] The calculation module is used for the client to download the global model, calculate the loss value and accuracy, and send the calculated loss value and accuracy to the central server;

[0034] The selection module is used by the central server to cluster the clients according to the loss value and select the clients participating in the federated learning training in each cluster according to the accuracy rate;

[0035] The aggregation and iteration module is used to update the local model parameters of the selected clients and send them to the central server. The central server completes the global model aggregation and continuously iterates until the target accuracy or the maximum number of iterations is reached.

[0036] Compared with the existing client selection technology, the present invention uses the client's loss value clustering method, that is, in each round of federated learning, the client sends the loss value and accuracy to the central server. The central server clusters the loss value and selects the client with the highest accuracy in each cluster, thereby achieving the convergence of the global model under Non-IID data, and also reducing the communication overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flowchart of a federated learning method based on client clustering selection under Non-IID data in a preferred embodiment of the present invention.

[0038] Figure 2 This is a comparison chart of the accuracy of each client selection strategy when the Non-IID degree is 0.5.

[0039] Figure 3 This is a comparison chart of the accuracy of each client selection strategy when the Non-IID degree is 0.8.

[0040] Figure 4 It is a block diagram of a federated learning system based on client clustering selection under Non-IID data in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0041] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0042] This embodiment provides a federated learning method based on client cluster selection under Non-IID data, such as Figure 1 As shown, the specific steps include:

[0043] S1. Construct a federated learning system model under Non-IID data;

[0044] S2. The client downloads the global model and sends the calculated loss value and accuracy to the central server;

[0045] S3. The central server clusters the clients according to the loss value and selects the clients that participate in the federated learning training in each cluster according to the accuracy rate;

[0046] S4. The selected client updates the local model parameters and sends them to the central server. The central server completes the global model aggregation and determines whether the target accuracy or the maximum number of federated learning rounds is reached. If not, it returns to step S2. If so, it stops the federated learning training.

[0047] This embodiment provides a method for federated learning based on client cluster selection, which aims to solve the challenges of federated learning under Non-IID data by selecting clients. This strategy is verified by comparing a solution based on client loss value clustering and accuracy selection with other client selection strategies in terms of time, performance and communication overhead.

[0048] Specifically, in step S1, a federated learning system model under Non-IID data is constructed. It includes a central server and multiple clients, M = {1, 2, ..., n} represents the set of all clients, S represents the set of selected clients, the constant m represents the number of clients selected by the central server in each round, ω t represents the global model parameters in the tth round of federated learning training, and defines the Non-IID degree σ. The closer σ is to 1, the greater the Non-IID degree is; the closer σ is to 0, the smaller the Non-IID degree is. For client i, the local data set distributed by the central server is defined as D i , the number of times selected to participate in global model training is defined as C i , and define the loss value of client i in the tth round of federated learning training as The model parameters are updated to In this embodiment, a central server and 20 clients are included, and a comparative experiment is conducted for σ=0.5 and σ=0.8.

[0049] Step S2 of this embodiment specifically includes:

[0050] S21. The client downloads the global model from the central server and uses cross entropy to calculate the loss value of the global model and the local data set in the tth round After expansion, it is sent to the central server. The expansion method is specifically expressed as follows:

[0051]

[0052] Where i represents the client, and i∈M, represents the cross entropy loss value of client i in the tth round of federated learning training. λ is a constant, which represents the expansion factor. After expansion, It is sent to the central server to participate in the clustering task. In this embodiment, λ=64 is set.

[0053] S22. The client calculates the accuracy acc of the global small test set on the local model i And sent to the central server, the specific calculation method is as follows:

[0054]

[0055] Among them, n correct The number of samples correctly classified using the local model for the test set, n total Indicates the total number of samples in the test set.

[0056] In step S3, the central server calculates the loss value of each client i after the expansion of the tth round of federated learning training. The K-Center-Greedy strategy is used for clustering. After clustering is completed, the clients with the highest accuracy are selected from the m clusters to form a set S. The clients in the set S participate in the update of the global model. In this embodiment, m=4, that is, each round of federated learning process will divide 20 clients into 4 clusters according to the loss value, and select one client from each cluster to participate in the global model training.

[0057] In step S4, the selected client updates the local model parameters and sends them to the central server. The central server completes the global model aggregation and iterates until the target accuracy or the maximum number of iterations is reached. In this embodiment, the maximum number of iterations is set to 40, the target accuracy is set to 60% when σ=0.5, and the target accuracy is set to 55% when σ=0.8. This step is as follows:

[0058] S41. Client i∈S calculates the local model parameter update and sends it to the central server. Set S represents all selected clients. The calculation of the local model parameter update is as follows:

[0059]

[0060] in, is the local model parameter of client i in round t, ω t-1 is the global model parameter at round t-1;

[0061] S42. The central server selects the client i based on the number of times C i and local dataset size |Di |Calculate the score as follows:

[0062]

[0063] Among them, |D i | represents the size of the local data set of client i, C i represents the number of times client i is selected, and β is a floating point number in the range of [0,1]. In this embodiment, β is set to 0.2.

[0064] S43. The central server calculates the weight of client i participating in the global model training based on the score and completes the global model aggregation, as follows:

[0065]

[0066] Among them, Score i is the score calculated by client i in step S42;

[0067] S44. The central server determines the test set in the global model ω t Whether the prediction accuracy under t reaches the target accuracy or whether t reaches the maximum number of federated learning training rounds, if not, return to execute step S2, if so, stop the federated learning training.

[0068] In order to evaluate the technical effect of the technical solution of the proposed preferred embodiment, the accuracy and time consumption of the present invention are verified by comparative experiments, and the communication overhead of the present invention is analyzed.

[0069] The experimental results are evaluated as follows:

[0070] 1. Accuracy

[0071] Figure 2 , 3 The figure shows the accuracy comparison experimental results of the client cluster selection scheme proposed by the present invention and other existing client selection schemes. This embodiment selects two different Non-IID degrees of 0.5 and 0.8 for comparison experiments. It can be observed from the figure that the client cluster selection scheme Loss-KCenter proposed by the present invention performs similarly to K-Center in terms of accuracy, but when the Non-IID degree is large, that is, when σ=0.8, it can be clearly seen that the client cluster selection scheme proposed by the present invention is more stable.

[0072] 2. Time-consuming

[0073] Table 1 is a time-consuming comparison table of the client loss value clustering selection scheme provided by the present invention and other client selection schemes. Compared with other client selection schemes, the client loss value clustering selection scheme provided by the present invention is at a medium level in terms of time consumption, which is better than Pow-D directly based on loss value selection and Favor based on reinforcement learning.

[0074] Table 1 Comparison of the time consumption of each client selection scheme

[0075]

[0076] 3. Communication overhead

[0077] The Random and Favor strategies do not need to transmit any information except the updated model parameters to the central server, so the communication overhead is minimal. In contrast, the K-Center and K-medoids strategies require all clients to transmit the local model parameters obtained in the last update to the central server, which makes the communication overhead the largest. In contrast, the Pow-D and Loss-KCenter strategies proposed by the present invention require that all clients transmit to the central server only a one-dimensional array that is much smaller than the model parameters. Only the selected clients need to transmit the updated model parameters, and the amount of information is relatively small, so the communication overhead is low.

[0078] like Figure 4 As shown, this embodiment discloses a federated learning system based on client cluster selection under Non-IID data, based on the above-mentioned federated learning method embodiment based on client cluster selection under Non-IID data, including the following modules:

[0079] Model building module, used to build a federated learning system model under Non-IID data;

[0080] The calculation module is used for the client to download the global model, calculate the loss value and accuracy, and send the calculated loss value and accuracy to the central server;

[0081] The selection module is used by the central server to cluster the clients according to the loss value and select the clients participating in the federated learning training in each cluster according to the accuracy rate;

[0082] The aggregation and iteration module is used to update the local model parameters of the selected client and send them to the central server. The central server completes the global model aggregation and continues to iterate until the target accuracy or the maximum number of iterations is reached.

[0083] For other contents of this embodiment, please refer to the above method embodiment.

[0084] In summary, the present invention discloses a method and system for federated learning based on client clustering selection under Non-IID data, and proposes a client selection strategy based on loss value clustering and accuracy selection, called Loss-KCenter, that is, the central server completes clustering through the loss values ​​sent by each client, and selects the client participating in the federated learning training in each cluster according to the accuracy. The selected client calculates the local model parameters according to the local data set, and after completion, the model parameter update is sent to the central server. The central server updates the global model according to an aggregation algorithm based on the data volume and the number of times the client is selected, until the target accuracy or the maximum number of iterations is reached. The present invention can relax the requirements for network communication bandwidth and achieve the convergence of the global model under Non-IID data.

[0085] The above description is only for the preferred embodiments and principles of the present invention. For ordinary technicians in this field, according to the ideas provided by the present invention, there will be changes in the specific implementation methods, and these changes should also be regarded as the protection scope of the present invention.

Claims

1. A federated learning method based on client cluster selection under Non-IID data, characterized by: The steps include: S1. Construct a federated learning system model under Non-IID data; S2. The client downloads the global model, calculates the loss value and accuracy, and sends the calculated loss value and accuracy to the central server; S3. The central server clusters the clients according to the loss value and selects the clients that participate in the federated learning training in each cluster according to the accuracy rate; S4. The selected client updates the local model parameters and sends them to the central server. The central server performs global model aggregation to determine whether the target accuracy or the maximum number of federated learning training rounds is reached. If not, it returns to step S2. If so, it stops the federated learning training.

2. The method for federated learning based on client cluster selection under Non-IID data according to claim 1, characterized in that: In step S1, the federated learning system model under Non-IID data includes a central server and multiple clients, M = {1, 2, ..., n} represents the set of all clients, S represents the set of selected clients, the constant m represents the number of clients selected by the central server in each round, ω t represents the global model parameters in the tth round of federated learning training; for client i, the local dataset distributed by the central server is defined as D i , the number of times selected to participate in global model training is defined as C i , and define the loss value of client i in the tth round of federated learning training as The model parameters are updated to 3. The method for federated learning based on client cluster selection under Non-IID data according to claim 2, characterized in that: Step S2 is specifically as follows: S21. The client downloads the global model from the central server and uses cross entropy to calculate the loss value of the global model and the local data set in the tth round After expansion, it is sent to the central server. The expansion method is specifically expressed as follows: Where i represents the client, and i∈M, represents the cross entropy loss value of client i in the tth round of federated learning training. λ is a constant, which represents the expansion factor. After expansion, Sent to the central server to participate in the clustering task; S22. The client calculates the accuracy acc of the global small test set on the local model i And sent to the central server, the specific calculation method is as follows: Among them, n correct The number of samples correctly classified using the local model for the test set, n total Indicates the total number of samples in the test set.

4. The method for federated learning based on client cluster selection under Non-IID data according to claim 3, characterized in that: Step S3 is as follows: the central server calculates the loss value of each client i after the expansion in the tth round. The K-Center-Greedy strategy is used for clustering. After clustering is completed, several clients with the highest accuracy are selected from the m clusters to form a set S. The clients in set S participate in the update of the global model.

5. The method for federated learning based on client cluster selection under Non-IID data according to claim 4, characterized in that: Step S4 is specifically as follows: S41. Client i∈S calculates the local model parameter update and sends it to the central server. Set S represents all selected clients. The calculation of the local model parameter update is as follows: in, is the local model parameter of client i in round t, ω t-1 is the global model parameter at round t-1; S42. The central server selects the client i based on the number of times C i and local dataset size |D i |Calculate the score as follows: Among them, |D i | represents the size of the local data set of client i, C i represents the number of times client i is selected, and β is a floating point number in the range [0,1]; S43. The central server calculates the weight of client i participating in the global model training based on the score and completes the global model aggregation, as follows: Among them, Score i is the score calculated by client i in step S42; S44. The central server determines the test set in the global model ω t Whether the prediction accuracy under t reaches the target accuracy or whether t reaches the maximum number of federated learning training rounds, if not, return to execute step S2, if so, stop the federated learning training.

6. A federated learning system based on client cluster selection under Non-IID data, based on the federated learning method based on client cluster selection under Non-IID data according to any one of claims 1 to 5, characterized in that: Includes the following modules: Model building module, used to build a federated learning system model under Non-IID data; The calculation module is used for the client to download the global model, calculate the loss value and accuracy, and send the calculated loss value and accuracy to the central server; The selection module is used by the central server to cluster the clients according to the loss value and select the clients participating in the federated learning training in each cluster according to the accuracy rate; The aggregation and iteration module is used to update the local model parameters of the selected clients and send them to the central server. The central server completes the global model aggregation and continuously iterates until the target accuracy or the maximum number of iterations is reached.

Citation Information

Patent Citations

  • Object recommendation method and device and cross-domain federated commodity recommendation method and device

    CN116028719A

  • Asynchronous Byzantine fault-tolerant distributed federated learning method and system

    CN117933413A

  • Systems and Methods for Heterogeneous Federated Transfer Learning

    US20220129706A1

Cited By

  • Adaptive clustering federal learning modeling method for precision medical treatment

    CN120781928A

  • Semi-asynchronous federal learning training method based on intelligent client selection and adaptive weighting

    CN120996142A