Federal learning-based client selection method and system
The method addresses data imbalance in federated learning by logically grouping clients using angular distance mixed similarity and generative adversarial networks, enhancing model accuracy and reducing overhead.
Patent Information
- Application Number
- CN202411318661.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional client selection methods in federated learning ignore data imbalance, leading to model performance deviation and increased computational and communication overhead, while existing solutions like clustering and Power-of-Choice algorithms either increase complexity or introduce bias.
A method involving logical grouping of clients based on angular distance mixed similarity, using principal component analysis and trigonometric similarity to determine client weights, combined with data enhancement through generative adversarial networks to improve data representativeness.
Enhances model convergence by reducing local model deviation and ensuring fair participation, improving the accuracy and efficiency of federated learning by selecting representative clients and enhancing data sets.
Smart Images

Figure CN119204262A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of deep learning, and in particular, relates to a client selection method and system based on federated learning. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Federated learning is a distributed machine learning method that allows multiple participants to collaboratively train models without sharing data. This method effectively protects data privacy. However, in the federated learning scenario, data heterogeneity is a major problem faced by federated learning. In actual application scenarios, the data generated by the marine edge environment is characterized by large differences in data distribution, such as differences in data distribution jitter caused by the autocorrelation and specific trends of marine time series data, or missing data samples and labels caused by marine communication interference. These problems increase with the imbalance of data distribution, and the degree of data heterogeneity also increases. If the degree of data heterogeneity can be quantified by analyzing the data distribution, representative data clients can be selected to participate in training. This selection strategy can effectively reduce the divergence between the global model and the local model, thereby reducing the difference between the global optimal solution and each local optimal solution.
[0004] Based on the above problems, the traditional method usually adopts a random selection strategy for client selection. However, this method may cause the selected clients to have similar data distribution when selecting clients, ignoring data imbalance, especially when the data heterogeneity is high, which may lead to model performance deviation and reduced accuracy. To solve this problem, some technicians proposed a new clustering federated learning (CFL) framework, which groups clients according to their data distribution and selects representative clients from each group to participate in training, thereby ensuring that clients with different distributions are fully represented. However, the clustering process of this method increases the computational complexity, and when the data heterogeneity is large, the accuracy of clustering may be insufficient; some people proposed the Power-of-Choice algorithm, which randomly samples the candidate client set, estimates its local loss, and selects the client with the highest loss to participate in training, so as to reduce the error of the global model on a specific data distribution. However, this method requires additional communication to estimate local losses, which may introduce bias. In addition, the Iterative Federated Clustering Algorithm (IFCA) method reduces the global model error by training multiple models in parallel on different clients and clustering clients to match different data distributions. However, this method requires parallel training of multiple models, which increases the computational and communication overhead. Summary of the invention
[0005] The present invention provides a client selection method and system based on federated learning to solve the problem that the traditional client selection method ignores the deviation of local client performance caused by data imbalance, thereby affecting the accuracy of the global model; and the problem that the traditional client selection method needs to increase additional computational complexity and communication overhead.
[0006] According to a first aspect of an embodiment of the present invention, a method for selecting a client based on federated learning is provided, comprising: Logically group the clients participating in federated learning; Based on the received locally optimized model parameters of the client, the angular distance mixed similarity between the client and each client in the group is calculated; wherein the angular distance mixed similarity is calculated specifically by: performing principal component analysis on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, calculating the similarity of the two clients by combining angle and distance; Determine the weight of the current client being selected based on the obtained angular distance mixed similarity between the client and other clients in the group; Based on the weights of each client in the group, determine the clients that participate in the global model aggregation in the current iteration round.
[0007] Furthermore, the calculation of the angular distance mixed similarity is specifically expressed as follows:
[0008]
[0009] in, Represents the client training model parameters selected by principal component analysis k principal components, v represents a specific principal component extracted by principal component analysis. and They represent the clients calculated based on the trigonometric similarity. i and j The component scores on principal component v, are model parameters or gradient matrices.
[0010] Furthermore, the trigonometric function similarity adopts cosine similarity.
[0011] Furthermore, the weight of the current client being selected is determined based on the average value of the angular distance mixed similarity between each client and other clients in the group.
[0012] Furthermore, in each iteration of federated learning, the local data of each client is enhanced through a pre-trained generative adversarial network.
[0013] Furthermore, the clients participating in the global model aggregation in the current iteration round are determined based on the weights of the clients in the group. Specifically, several clients in each group whose weights are greater than a preset threshold or are ranked high in terms of weight are selected to participate in the global model aggregation of the iteration round.
[0014] Furthermore, the clients participating in the federated learning are logically grouped, specifically according to the client computing efficiency predicted based on the amount of local data of each client and the training time.
[0015] According to a second aspect of an embodiment of the present invention, a client selection system based on federated learning is provided, including: A grouping unit, which is used to logically group the clients participating in federated learning; A similarity calculation unit, which is used to calculate the angular distance mixed similarity between the client and each client in the group based on the received locally optimized model parameters of the client; wherein the calculation of the angular distance mixed similarity is specifically: performing principal component analysis on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, calculating the similarity of the two clients by combining angle and distance; The client selection unit is used to determine the weight of the current client selected based on the angular distance mixed similarity between the client and other clients in the group; based on the weight size of each client in the group, determine the client participating in the global model aggregation in the current iteration round.
[0016] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising a memory, a processor, and a computer program stored and running on the memory, wherein when the processor executes the program, the method for selecting a client based on federated learning is implemented.
[0017] According to a fourth aspect of an embodiment of the present invention, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the client selection method based on federated learning is implemented.
[0018] Compared with the prior art, the present invention has the following beneficial effects: (1) The scheme described in the present invention provides a client selection method and system based on federated learning. The scheme effectively solves the problem of system heterogeneity by logically grouping clients during the model training process. At the same time, it reveals the consistency relationship between the similarity of local optimization between devices and the similarity of data distribution, and provides an angular distance hybrid similarity calculation strategy for measuring the difference in data distribution, effectively reducing the impact of local model deviation on the global model, and ensuring stronger convergence.
[0019] (2) The present invention measures the local optimization similarity. For the grouped clients, based on the consistency relationship between the local optimization similarity of the clients and the data distribution similarity, the data distribution differences are analyzed to quantify the degree of data heterogeneity, and the degree of heterogeneity is intuitively visualized.
[0020] (3) The present invention adopts client selection based on data representation to reduce the local performance deviation of the client and the error between the local model and the global model. It selects the most data representative clients to participate in aggregation and ensures the fairness of federated learning training.
[0021] (4) Through data enhancement based on generative adversarial networks (GANs), the present invention makes the data sets of clients with low data representativeness become richer and more representative, thereby improving their participation opportunities in the group and global aggregation process, and ultimately enhancing the fairness and effectiveness of the entire federated learning system.
[0022] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0024] Figure 1 is a flow chart of angular distance mixed similarity calculation described in an embodiment of the present invention; Figure 2 A client selection flow chart described in an embodiment of the present invention; Figure 3 Schematic diagram of the generative adversarial network structure described in an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0026] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0027] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0028] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0029] In order to solve the problems existing in the prior art, such as Figure 1 As shown, this embodiment provides a client selection method based on federated learning, including: Step 1: Logically group the clients participating in federated learning; The clients participating in the federated learning are logically grouped, specifically according to the client computing efficiency predicted based on the amount of local data of each client and the training time.
[0030] Specifically, each client uses the client's computing resources to train a local model based on the initial global model broadcast by the central server and local data to generate a local model, and then updates the local model. During the model training process, the computing efficiency is evaluated based on the amount of local data and the training time. During the waiting time interval, the statistics of clients ready for global aggregation are completed, and the logical grouping of clients is completed based on this standard.
[0031] Step 2: Based on the received locally optimized model parameters of the client, the angular distance mixed similarity between the client and each client in the group is calculated; wherein the calculation of the angular distance mixed similarity is specifically as follows: principal component analysis is performed on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, the similarity between the two clients is calculated by combining angle and distance; The calculation of the angular distance mixing similarity is specifically expressed as follows:
[0032]
[0033] in, Represents the client training model parameters selected by principal component analysisk principal components, v represents a specific principal component extracted by principal component analysis. and They represent the clients calculated based on the trigonometric similarity. i and j The component scores on principal component v, are model parameters or gradient matrices.
[0034] Specifically, the Federated Learning Average Algorithm (FedAvg) is currently the most widely used federated optimization algorithm. When the client performs model training and grouping, the current local optimization goal can be defined as:
[0035] in, is the training data size of the nth client, is the i-th sample of the n-th client, and follows the data distribution of the n-th client . is based on the model parameters w training samples The prediction loss function on . We get the local optimization target and update it:
[0036] The local model optimization gradient is obtained by back propagation calculation. The similarity of local optimization is directly related to the data distribution. By combining cosine similarity with Euclidean distance, a new angular distance hybrid similarity measurement method for measuring the similarity distance of any device is obtained by comprehensively considering the direction and size of the local model update vector. The angular distance hybrid similarity can be defined as:
[0037]
[0038] in, represents the k principal components selected by applying principal component analysis (PCA) to the client's updated model parameters or gradient matrix. v represents a specific principal component extracted by principal component analysis. and They represent the component scores of client i and j on principal component v calculated based on trigonometric similarity. The PCA we use is a simple dimensionality reduction technique that centers each dimension in the data set, calculates the covariance matrix and performs eigenvalue decomposition on it to obtain eigenvalues and eigenvectors. The model is decomposed into m directions, and then only the first k eigenvectors are selected instead of all eigenvectors according to the size of the eigenvalues. Finally, the dimensionality reduction matrix P is formed, and the original data is projected onto the selected principal component to obtain This method significantly reduces the number of features while retaining most of the data variance, making the data matrix smaller after dimensionality reduction, thereby reducing the amount of calculation. It can also be represented by the cosine kernel function, and the angular distance mixed similarity can be changed to:
[0039] in, and are the local model update vectors of device i and device j at time step t. The entire similarity calculation flow chart is shown in 1.
[0040] Step 3: Based on the obtained angular distance mixed similarity between the client and other clients in the group, determine the weight of the current client being selected; The weight of the current client selected is determined based on the average value of the angular distance mixed similarity between each client and other clients in the group.
[0041] Specifically, the solution described in this embodiment uses the direct relationship between the similarity of local optimization and the similarity of data distribution to measure the balance of local data distribution between devices. Based on the angular distance hybrid similarity evaluation group, the data distribution similarity of each client is evaluated, and the average similarity between each device and other devices is calculated as the selection weight. The formula for calculating the selection weight is defined as:
[0042] in, Indicates the number of devices in the group other than device i. Clients are selected from high to low according to the selection weights, and the most data-characterized clients selected from each group are summarized as the final client selection result. The client selection process is as follows: Figure 2 shown.
[0043] Step 4: Based on the weights of each client in the group, determine the clients that participate in the global model aggregation in the current iteration round.
[0044] In a specific implementation, the clients participating in the global model aggregation in the current iteration round are determined based on the weights of the clients in the group. Specifically, several clients in each group whose weights are greater than a preset threshold or are ranked high in terms of weight size are selected to participate in the global model aggregation of the iteration round.
[0045] In one or more embodiments, in each iteration round of federated learning, data enhancement is performed on the local data of each client using a pre-trained generative adversarial network.
[0046] Specifically, in order to ensure more fair client participation, the potential value of clients with low data representativeness is fully utilized. We achieve data enhancement through generative adversarial networks (GANs) to improve the representativeness of data within the group. The working principle of the generative adversarial network is composed of a generator and a discriminator. The generator generates realistic data samples, while the discriminator tries to distinguish between these generated data and real data. The two networks compete with each other and are continuously optimized until the generator can generate samples that the discriminator cannot distinguish. In order to better generate data that can make up for the lack of data representativeness, a representative loss term is introduced to encourage the generated data to cover the unrepresented data distribution in the feature space:
[0047] in, Is generated data and low representative data The similarity measure between . It is a weight parameter that controls the generator to focus on low data representation. The goal of GAN is to make the sample distribution generated by the generator close to the real data distribution. . Therefore, the objective function of GAN is:
[0048] where z is the input noise of the generator, usually sampled from a uniform or Gaussian distribution. is the output of the generator, i.e., the generated fake sample. It is the output of the discriminator, indicating the probability that the input sample is the real data. Indicates the degree of difference between the real sample and the generated sample.
[0049] It should be noted here that the loss function (objective function) of the discriminator is independent of the loss function of the generator. The purpose of the loss term is only to guide the generator to focus on generating samples that are more similar to low-representative data, and to promote the generator to generate data with wider coverage and better representativeness. The discriminator learns how to distinguish between real samples and generated samples, and does not need to consider the representativeness or diversity of the generated data. It indirectly improves the learning ability of the discriminator through indirect influence.
[0050] The schematic diagram of the generated adversarial network structure is as follows Figure 3 As shown, the specific process is: 1) First, data preprocessing is performed. Features are extracted from existing low-representation data, normalized, and prepared for input to GAN.
[0051] 2) Train the Generative Adversarial Network. The generator accepts random noise z as input and generates fake data samples The discriminator receives both real data samples x and generated fake samples , and output the true and false probabilities. Alternately optimize the generator and the discriminator, and update the weights of the discriminator and the generator through back propagation, so that the discriminator tries to judge the real samples as 1 and the fake samples as 0; the generator tries to make the fake samples recognized as 1 by the discriminator.
[0052] 3) Generate enhanced data. After training is completed, use the generator to generate more new samples. These generated samples fill the blank areas of the original data in the data feature space, thereby improving the representativeness of the data set.
[0053] 4) Expand the dataset. Combine the generated samples with the original data to form a more balanced and diverse dataset.
[0054] Therefore, by using the generative adversarial network to achieve data enhancement with low data representation within the group, we can effectively fill the blank areas of the original data and improve the diversity and representativeness of the data set. This method not only fully utilizes the potential value of low-representative data, but also generates realistic new samples, allowing the model to be exposed to a wider data distribution during training, thereby improving the fairness and generalization ability of the model.
[0055] In one or more embodiments, a client selection system based on federated learning is provided corresponding to the above method, including: A grouping unit, which is used to logically group the clients participating in federated learning; A similarity calculation unit, which is used to calculate the angular distance mixed similarity between the client and each client in the group based on the received locally optimized model parameters of the client; wherein the calculation of the angular distance mixed similarity is specifically: performing principal component analysis on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, calculating the similarity of the two clients by combining angle and distance; The client selection unit is used to determine the weight of the current client selected based on the angular distance mixed similarity between the client and other clients in the group; based on the weight size of each client in the group, determine the client participating in the global model aggregation in the current iteration round.
[0056] It can be understood that the system described in this embodiment corresponds to the method in the above embodiment, and its technical details are described in detail in Embodiment 1, so they are not repeated here.
[0057] In further embodiments, there is also provided: An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in Embodiment 1 is performed. For the sake of brevity, no further description is given here.
[0058] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0059] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0060] A computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the method described in embodiment 1 is completed.
[0061] The method in the first embodiment can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0062] Those skilled in the art will appreciate that the units, i.e., algorithm steps, of the various examples described in the present embodiment can be implemented in electronic hardware or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0063] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. 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 client selection method based on federated learning, characterized in that: include: Logically group the clients participating in federated learning; Based on the received locally optimized model parameters of the client, the angular distance mixed similarity between the client and each client in the group is calculated; wherein the angular distance mixed similarity is calculated specifically by: performing principal component analysis on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, calculating the similarity of the two clients by combining angle and distance; Determine the weight of the current client being selected based on the obtained angular distance mixed similarity between the client and other clients in the group; Based on the weights of each client in the group, determine the clients that participate in the global model aggregation in the current iteration round.
2. A method for selecting a client based on federated learning as claimed in claim 1, characterized in that: The calculation of the angular distance mixing similarity is specifically expressed as follows: in, Represents the client training model parameters selected by principal component analysis k principal components, v represents a specific principal component extracted by principal component analysis. and They represent the clients calculated based on the trigonometric similarity. i and j The component scores on principal component v, is the transpose of the model parameters or gradient matrix.
3. A method for selecting a client based on federated learning as claimed in claim 2, characterized in that: The trigonometric function similarity adopts cosine similarity.
4. A method for selecting a client based on federated learning as claimed in claim 1, characterized in that: The weight of the current client selected is determined based on the average value of the angular distance mixed similarity between each client and other clients in the group.
5. A method for selecting a client based on federated learning as claimed in claim 1, characterized in that: In each iteration of federated learning, the local data of each client is augmented by a pre-trained generative adversarial network.
6. A method for selecting a client based on federated learning as claimed in claim 1, characterized in that: The method of determining the clients participating in the global model aggregation in the current iteration round based on the weight of each client in the group is specifically: selecting several clients in each group whose weight is greater than a preset threshold or which are ranked high in weight size to participate in the global model aggregation of the iteration round.
7. A method for selecting a client based on federated learning as claimed in claim 1, characterized in that: The clients participating in the federated learning are logically grouped, specifically according to the client computing efficiency predicted based on the amount of local data of each client and the training time.
8. A client selection system based on federated learning, characterized in that: include: A grouping unit, which is used to logically group the clients participating in federated learning; A similarity calculation unit, which is used to calculate the angular distance mixed similarity between the client and each client in the group based on the received locally optimized model parameters of the client; wherein the calculation of the angular distance mixed similarity is specifically: performing principal component analysis on the locally optimized model parameters of the client, and based on the component scores corresponding to the obtained principal components, calculating the similarity of the two clients by combining angle and distance; The client selection unit is used to determine the weight of the current client selected based on the angular distance mixed similarity between the client and other clients in the group; based on the weight size of each client in the group, determine the client participating in the global model aggregation in the current iteration round.
9. An electronic device comprising a memory, a processor and a computer program stored and running on the memory, characterized in that: When the processor executes the program, a client selection method based on federated learning is implemented as described in any one of claims 1-7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a client selection method based on federated learning as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Federal learning method and system, storage medium and program product
CN120163264A