A model hierarchy-based multi-task federated learning client contribution degree measurement method

By calculating client contributions and screening low contributors through a model hierarchical method, the problem of quantifying client contributions in multi-task federated learning is solved, and the accuracy of model aggregation and training efficiency are improved.

CN119129704BActive Publication Date: 2025-10-21UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411100711.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2025-10-21
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

In multi-task federated learning, existing technologies cannot accurately quantify the contribution of each client, resulting in impaired model performance.

Method used

A model-layered approach is adopted to calculate the gradient similarity and contribution vector of each layer of the client model to accurately measure the client contribution and screen out low contributors to optimize the training process.

Benefits of technology

It achieves more accurate model aggregation and faster training process while maintaining privacy protection, optimizing the time and model accuracy of federated learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129704B_ABST
    Figure CN119129704B_ABST
Patent Text Reader

Abstract

The application provides a model layer-based multi-task federated learning client contribution degree measurement method, relates to federated learning and machine learning model layering technology. The method contains a distributed architecture of a central server and multiple client nodes, first configures a federated learning environment and data preparation, then the central server measures the contribution degree of each client under the existing federated task, and secondly, the central server layers the received model parameters and calculates the gradient of each layer of the model; the model layer similarity relative to the initiator client is calculated to obtain a normalized contribution vector, a new model is calculated according to the contribution vector and the data amount on the client, the next round of training client is selected, and the task queue is updated. The application can accurately identify the contribution of each client in federated learning, realize more accurate model aggregation under layer contribution measurement, maintain the same privacy protection effect as general federated learning, optimize the federated learning time and improve the model precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning and machine learning model stratification, and in particular to a multi-task federated learning client contribution measurement method based on model stratification. Background Art

[0002] With the continuous development of the internet and the rapid increase in hardware and storage capabilities, artificial intelligence and machine learning, built on massive amounts of data from multiple sources, are seeing increasingly widespread application and research. As data producers increasingly prioritize the security of private information and data, and as relevant government departments and legislative bodies increasingly prioritize data security and user privacy, data security has become a global concern. Traditional centralized machine learning methods require centralized data collection and processing, then train a global model based on this data. However, this approach carries significant risks of privacy breaches.

[0003] Federated learning, a distributed computing framework that addresses data silos, allows multiple clients to collaboratively train shared models without centralizing data, protecting privacy while leveraging decentralized data resources. It can capture shared knowledge from multiple clients to generate a more performant global model. For example, using deep learning classification algorithms, federated learning can leverage small amounts of data from each client without leaking data to train a classification model with improved generalization and accuracy, alleviating the problem of insufficient client data.

[0004] Multi-task federated learning requires the cooperation of all clients when jointly training a model. Traditional federated learning treats each client's contribution as equal, evenly aggregating the model parameters of each local client. However, data distribution may differ between the task initiator's client and other clients. This difference can impair model performance even when contributions are the same, thus affecting the performance of the model achieved by the task initiator's client. Therefore, finding an effective method to measure client contributions is a key challenge in solving the application of multi-task federated learning. Summary of the Invention

[0005] The purpose of the present invention is to provide a client contribution measurement method for multi-task federated learning based on model layering, which solves the problem of client contribution quantification in multi-task federated learning in the prior art.

[0006] In order to solve the above problems, the present invention adopts the following technical problems:

[0007] A client contribution measurement method for multi-task federated learning based on model layering is applied to a distributed architecture including a central server and multiple client nodes, including the following steps:

[0008] S1. Configure the federated learning environment and prepare data, including:

[0009] The configuration of the federated learning environment includes configuring a central server and connecting N clients participating in the training to a private network;

[0010] Data preparation includes data sample acquisition and data preprocessing; specifically, each participant obtains their own sample data With data labels in represents the image sample data of the i-th participant, represents the data label of the i-th participant;

[0011] The central server establishes a connection with each federated client participating in the training. The client sends a task request to the central server, and the server generates a task queue Q. The client sends the data volume of the local sample to the server. in Represents the amount of data on client i; after the server obtains the data of all clients, it calculates the total amount of data

[0012] S2. The central server measures the contribution of each client to the existing federated task:

[0013] S2.1. Client x initiates a federated task. The central server selects K training clients from N clients, where client x is always included. Next, the central server updates the aggregate round number R, the local training round number T on the local client, the training batch size B, and the client's local loss function f(·) to initialize model training.

[0014] S2.2, the central server initializes the model and distributes it to the participating K clients;

[0015] S2.3, the K clients participating in the training use batch B in their private local data Last training round T;

[0016] S2.4. Based on the distributed gradient descent method, each edge node prepares to calculate the gradient value of the current round using its local data and the received model parameters;

[0017] S2.5. Based on the received loss function and model parameters, each client participating in the training randomly selects a certain amount of local data and uses the backpropagation algorithm to calculate the latest gradient value of the model parameters received in the current round using the selected local data. Where i represents the number of the edge node, θ i Indicates the model parameter value received in the current round, f iRepresents the received model loss function, Represents the back propagation algorithm, which calculates the model x based on its local data i And the loss function f i The current round gradient value of the training client sends the locally trained parameters θ to the central server i ;

[0018] S3. Contribution measurement process includes the following steps:

[0019] S3.1. After receiving the parameters, the central server divides the model into layers and calculates the gradients of each layer.

[0020] S3.2. For the clients participating in this round of training, the server calculates the model layer similarity relative to client x, and after normalization, obtains the contribution vector α of the K participating training clients relative to client x. x ;

[0021] S4, the central server sends the new model to the target task client;

[0022] S4.1. Calculate the new model parameters of the target task client based on the contribution vector and the amount of data on the client participating in the training as a joint vector

[0023] S4.2, the server according to the joint contribution vector Select K clients to participate in the next round of target task training;

[0024] S4.3. Repeat steps S2 and S4 until the target task reaches the predetermined training rounds or the preset accuracy;

[0025] S5. Update the task queue;

[0026] S5.1. Delete the completed task from the current task queue Q and select the next task to continue training.

[0027] S5.2. Move the queue head pointer to the next task. If the pointer points to NULL, all training tasks are completed.

[0028] S5.3. If a new task is added during the training process, the position where it is inserted into the queue is selected based on whether the task is a real-time task.

[0029] Furthermore, the specific operation method for calculating the gradient of each layer of the model is:

[0030] S3.1.1. The central server receives the latest gradient values ​​uploaded by each client after training. After that, the latest gradient value Update the model parameters of each client on the server, as follows:

[0031]

[0032] Where η represents the learning rate;

[0033] S3.1.2. After the update, the server divides each client model into layers according to the structure of each layer of the model and calculates the gradient of each layer with respect to the task initiator x. The gradient of the kth layer The calculation formula is:

[0034]

[0035] in, represents the model parameters of the k-th layer of client i, Represents the k-th layer parameters of the model parameters initialized in the first round;

[0036] Furthermore, the contribution vector α x The specific calculation method is as follows:

[0037] S3.2.1. Calculate the cosine similarity of client i relative to the model of each layer of client x. The calculation formula is as follows:

[0038]

[0039] in, Represents the cosine similarity of client i relative to the model of each layer of client x, and denote the gradients of the kth layer of client x and client i respectively;

[0040] S3.2.2, the calculated cosine similarity Added to the contribution vector of the specified layer, the final contribution matrix relative to client x is obtained, which is expressed as follows:

[0041]

[0042] in, represents the aggregate weight vector of layer m in client x, represents the aggregate weight vector of client i relative to client K at the mth layer; It is obtained by calculating the cosine similarity of the client x gradient relative to the gradients of other clients and then performing weighted normalization;

[0043] Specifically, each row vector of the contribution matrix is ​​multiplied by the corresponding client data volume Relative to the total amount of data The weighted contribution vector is obtained by the ratio of ; each row of the weighted contribution vector is normalized using softmax so that the sum of the contribution of each layer is 1.

[0044] Furthermore, the new model parameters of the target task client The calculation process is as follows:

[0045] S4.1.1. Aggregate the same layer model parameters of the clients participating in the training into a K-dimensional vector Represents the model parameters of the mth layer of client i;

[0046] S4.1.2. For L layers, aggregate them into The model hierarchical matrix of

[0047] S4.1.3. Calculate the aggregation model of client x. The aggregation calculation process is: After aggregation, the server will Sent to the task client.

[0048] Furthermore, step S4.2 is specifically as follows:

[0049] S4.2.1. Select the contribution vector of the top model in the contribution matrix, discard the k models with low contribution, and randomly select k clients from the remaining models as new clients.

[0050] S4.2.2. The newly joined client establishes a connection with the central server;

[0051] S4.2.3. The central server sends the newly constructed client group Start the next round of training.

[0052] Furthermore, the specific operation method of step S5.3 is as follows:

[0053] S5.3.1. If the newly added task is not a real-time task, the newly added task is added to the end of the task queue and the tail pointer moves back one position;

[0054] S5.3.2. If the newly added task is a real-time high-priority task, after the current round of client learning is completed, the central server saves the connection status information, the target task client saves the aggregated model, and the next round of training for the new task starts directly.

[0055] After adopting the above technical solution, the present invention has the following beneficial effects:

[0056] (1) During the training process, the present invention can accurately identify the contribution of each client in federated learning, and achieve model aggregation under more accurate hierarchical contribution measurement through model stratification. At the same time, the privacy protection effect is the same as that of general federated learning, and it can be naturally combined with other protection schemes.

[0057] (2) The solution of the present invention achieves a faster multi-task federated learning process by screening out the measured low contributors in each round, thereby achieving the purpose of optimizing the federated learning time and model accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is a flow chart of the overall training process of an example of the present invention.

[0059] Figure 2 Schematic diagram of the measurement vector in the process of the present invention.

[0060] Figure 3 This is a schematic diagram of client selection in the process of the present invention. DETAILED DESCRIPTION

[0061] The purpose of the present invention is to provide a client contribution measurement method for multi-task federated learning based on model layering, which solves the problem of client contribution quantification in multi-task federated learning in the prior art.

[0062] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the implementation methods and drawings.

[0063] See also Figure 1 For a given image recognition neural network model to be trained, the following steps are used to optimize the model parameters while compressing the communication volume: In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the implementation methods and drawings.

[0064] S1. Configure the federated learning environment and prepare data, including:

[0065] The configuration of the federated learning environment includes configuring a central server and connecting N clients participating in the training to a private network;

[0066] Data preparation includes data sample acquisition and data preprocessing. The data sample acquisition and data preprocessing process are as follows:

[0067] Each participant obtains their own sample data With data labels in represents the image sample data of the i-th participant, Represents the data label of the i-th participant, sample data Contains sample images and sample categories. This embodiment obtains sample data by collecting user-generated local images and the categories of acquired images. With data labels

[0068] The central server establishes a connection with each federated client participating in the training. The client sends a task request to the central server, and the server generates a task queue Q. The amount of data the client sends to the server for local samples in Represents the amount of data on client i. After the server obtains the data of all clients, it calculates the total amount of data

[0069] S2. The central server measures the contribution of each client to the existing federated task:

[0070] S2.1. Client x initiates a federated task. The central server selects K training clients from N clients, with client x always included in the K training clients. Next, the collective round number R, the local training round number T on the local client, the training batch size B, and the client's local loss function f(·) are updated to initialize model training.

[0071] S2.2, the central server initializes the model and distributes it to the participating K clients;

[0072] S2.3, K clients participating in the training use Batch as their local data Last training round T.

[0073] S2.4. Based on the distributed gradient descent algorithm, each edge node prepares to calculate the gradient value of the current round using its local data and the received model parameters;

[0074] S2.5. Based on the received loss function and model parameters, each client participating in the training randomly selects a certain amount of local data and uses the backpropagation algorithm to calculate the latest gradient value of the model parameters received in the current round using the selected local data. Where i represents the number of the edge node, θ i Indicates the model parameter value received in the current round, f i Represents the received model loss function, Represents the back propagation algorithm, which calculates the model x based on its local data i And the loss function f i The current round gradient value of the training client sends the locally trained parameters θ to the central server i ;

[0075] S3. The measurement process includes the following steps:

[0076] S3.1. After receiving the parameters, the central server divides the model into layers and calculates the gradients of each layer. The specific operation method is as follows:

[0077] S3.1.1. The central server receives the latest gradient values ​​uploaded by each client after training. After that, the latest gradient value Update the client models on the server. The specific formula can be expressed by formula (1);

[0078] η represents the learning rate (1);

[0079] S3.1.2. After the update, the server divides each client model into layers according to the structure of each layer of the model and calculates the gradient of each layer with respect to the task initiator x. The layered diagram is as follows Figure 2 As shown, the k-th layer gradient The calculation formula is represents the model parameters of the k-th layer of client i, Represents the k-th layer parameters of the model parameters initialized in the first round;

[0080] S3.2. For the clients participating in this round of training, the server calculates the model layer similarity relative to client x, and after normalization, obtains the contribution vector α of the K participating training clients relative to client x. x , the specific method is as follows:

[0081] S3.2.1. Calculate the cosine similarity of client i relative to the model of each layer of client x. The calculation formula is as follows: Represents the cosine similarity of client i relative to the model of each layer of client x, and denote the gradients of the kth layer of client x and client i respectively;

[0082]

[0083] S3.2.2, the calculated cosine similarity Added to the contribution vector of the specified layer, the final contribution matrix relative to client x is obtained, which is expressed as formula (3);

[0084]

[0085] In S3.2.3 and S3.2.2, represents the aggregate weight vector of the mth layer in client x, and It represents the aggregate weight vector of client i relative to client K at the mth layer. It is obtained by calculating the cosine similarity of the client x gradient relative to the gradients of other clients through formula (2), and then performing weighted normalization. For a deep neural network with m layers, formula (4) holds true.

[0086]

[0087] Specifically, each row vector of the contribution matrix is ​​multiplied by the corresponding client data volume Relative to the total amount of data The weighted contribution vector is obtained by using the ratio of ; each row of the weighted contribution vector is normalized using softmax so that the sum of the contribution of each layer (i.e., the aggregate weight vector) is 1; the softmax normalization is expressed as formula (5);

[0088]

[0089] Furthermore, the temperature parameter temp in formula (5) controls the output of the softmax function. By scaling the softmax function input, the degree of normalization can be controlled to be smooth or sharp. The larger the temp value, the smoother the output, and the smaller the normalized vector variance will be until it becomes uniformly distributed. The smaller the temp value, the sharper the output, and the larger the normalized vector variance will be until it becomes uniformly distributed. The value is 1.

[0090] S4, the central server sends the new model to the target task client;

[0091] S4.1. Calculate the new model parameters of the target task client based on the contribution vector and the amount of data on the client participating in the training as a joint vector The specific operation method is:

[0092] S4.1.1. Aggregate the same layer models of the clients participating in the training into a K-dimensional vector Represents the model parameters of the mth layer of client i;

[0093] S4.1.2. For L layers, aggregate them into The model hierarchical matrix of

[0094] S4.1.3. Calculate the aggregation model of client x. The aggregation calculation process is: After aggregation, the server will Sent to the task client.

[0095] S4.2, the server according to the joint contribution vector Select K clients to participate in the next round of target task training; the specific operation method is:

[0096] S4.2.1. Select the contribution vector of the top model in formula (3), select k models with low contribution and discard them, and randomly select k clients from the remaining Nk models as new clients. The selection process is as follows: Figure 3 As shown;

[0097] S4.2.2. The newly joined client establishes a connection with the central server;

[0098] S4.2.3. The central server sends the newly constructed client group Start the next round of training.

[0099] S4.3. Repeat steps S2 and S4 until the target task reaches the predetermined training rounds or the preset accuracy.

[0100] S5. Update task queue

[0101] S5.1. Delete the completed task from the current task queue Q and select the next task to continue training.

[0102] S5.2. Move the queue head pointer to the next task. If the pointer points to NULL, all training tasks are completed.

[0103] S5.3. If a new task is added during training, select the position to insert it into the queue based on whether the task is a real-time task. The specific operation method is as follows:

[0104] S5.3.1. If the newly added task is not a real-time task, the newly added task is added to the end of the task queue and the tail pointer moves back one position;

[0105] S5.3.2. If the newly added task is a real-time high-priority task, after the current round of client learning is completed, the central server saves the connection status information, the target task client saves the aggregated model, and the next round of training for the new task starts directly.

[0106] In summary, the model-layered, multi-task federated learning client contribution measurement method provided in this embodiment addresses the existing problem of being unable to accurately quantify the contribution of each client in multi-task learning. Furthermore, by introducing a step to screen low-contributors and preemptive priority scheduling, the training process is significantly shorter than that of traditional federated learning algorithms while maintaining comparable security.

[0107] It will be understood that the present invention is described by way of some embodiments, and it will be appreciated by those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are intended to be protected by the present invention.

Claims

1. A client contribution measurement method for multi-task federated learning based on model layering, applied to a distributed architecture including a central server and multiple client nodes, characterized by: The method specifically comprises the following steps: S1. Configure the federated learning environment and prepare data, including: The configuration of the federated learning environment includes configuring a central server and connecting N clients participating in the training to a private network; Data preparation includes data sample acquisition and data preprocessing; specifically, each participant obtains their own sample data With data labels in represents the sample data of the i-th participant, represents the data label of the i-th participant; The central server establishes a connection with each federated client participating in the training. The client sends a task request to the central server, and the server generates a task queue Q. The client sends the data volume of the local sample to the server. in Indicates the amount of data on client i; after the server obtains the data of all clients, it calculates the total amount of data S2. The central server measures the contribution of each client to the existing federated task: S2.

1. Client x initiates a federated task. The central server selects K clients from N clients to participate in training. The K clients participating in training always include client x. Next, the centralized server updates the collective round number R, the local training round number T on the local client, the training batch size B, and the client's local loss function f(·) to initialize model training. S2.2, the central server initializes the model and distributes it to the participating K clients; S2.3, the K clients participating in the training use batch B in their private local data Last training round T; S2.

4. Based on the distributed gradient descent method, each edge node prepares to calculate the gradient value of the current round using its local data and the received model parameters; S2.

5. Based on the received loss function and model parameters, each client participating in the training randomly selects a certain amount of local data and uses the backpropagation algorithm to calculate the latest gradient value of the model parameters received in the current round using the selected local data. Where i represents the number of the edge node, θ i Indicates the model parameter value received in the current round, f i Represents the received model loss function, Represents the back propagation algorithm, which calculates the model x based on its local data i And the loss function f i The current round gradient value of the training client sends the locally trained parameters θ to the central server i ; S3. Contribution measurement process includes the following steps: S3.

1. After receiving the parameters, the central server divides the model into layers and calculates the gradients of each layer. S3.

2. For the clients participating in this round of training, the central server calculates the model layer similarity relative to client x, and after normalization, obtains the contribution vector α of the K participating training clients relative to client x. x ; S4, the central server sends the new model to the target task client; S4.

1. According to the contribution vector α x The data volume on the client participating in the training is used as a joint vector to calculate the new model parameters of the target task client S4.2, the server according to the joint contribution vector Select K clients to participate in the next round of target task training; S4.

3. Repeat steps S2 and S4 until the target task reaches the predetermined training rounds or the preset accuracy; S5. Update the task queue; S5.

1. Delete the completed task from the current task queue Q and select the next task to continue training. S5.

2. Move the queue head pointer to the next task. If the pointer points to NULL, all training tasks are completed. S5.

3. If a new task is added during the training process, the position where it is inserted into the queue is selected based on whether the task is a real-time task.

2. The client contribution measurement method for multi-task federated learning based on model layering according to claim 1 is characterized in that: The specific operation method of the gradient of each layer of the calculation model is: S3.1.

1. The central server receives the latest gradient values ​​uploaded by each client after training. After that, the latest gradient value Update the model parameters of each client on the server, as follows: Where η represents the learning rate; S3.1.

2. After the update, the server divides each client model into layers according to the structure of each layer of the model and calculates the gradient of each layer with respect to the task initiator x. The gradient of the kth layer The calculation formula is: in, represents the model parameters of the k-th layer of client i, Represents the k-th layer parameters of the model parameters initialized in the first round.

3. The client contribution measurement method for multi-task federated learning based on model layering according to claim 1 is characterized in that: The contribution vector α x The specific calculation method is as follows: S3.2.

1. Calculate the cosine similarity of client i relative to the model of each layer of client x. The calculation formula is as follows: in, Represents the cosine similarity of client i relative to the model of each layer of client x, and denote the gradients of the kth layer of client x and client i respectively; S3.2.2, the calculated cosine similarity Added to the contribution vector of the specified layer, the final contribution matrix relative to client x is obtained, which is expressed as follows: in, represents the aggregate weight vector of the mth layer in client x, represents the aggregate weight vector of client i relative to client K at the mth layer; It is obtained by calculating the cosine similarity of the client x gradient relative to the gradients of other clients, and then performing weighted normalization; Specifically, each row vector of the contribution matrix is ​​multiplied by the corresponding client data volume Relative to the total amount of data The weighted contribution vector is obtained by the ratio of ; each row of the weighted contribution vector is normalized using softmax so that the sum of the contribution of each layer is 1.

4. The client contribution measurement method for multi-task federated learning based on model layering according to claim 1 is characterized in that: The new model parameters of the target task client The calculation process is as follows: S4.1.

1. Aggregate the same layer model parameters of the clients participating in the training into a K-dimensional vector Represents the model parameters of the mth layer of client i; S4.1.

2. For L layers, aggregate them into The model hierarchical matrix of S4.1.

3. Calculate the aggregation model of client x. The aggregation calculation process is: After aggregation, the server will Sent to the task client.

5. The client contribution measurement method for multi-task federated learning based on model layering according to claim 4 is characterized in that: The step S4.2 is specifically as follows: S4.2.

1. Select the contribution vector of the top model in the contribution matrix, discard the k models with low contribution, and randomly select k clients from the remaining models as new clients. S4.2.

2. The newly joined client establishes a connection with the central server; S4.2.

3. The central server sends the newly constructed client group Start the next round of training.

6. The client contribution measurement method for multi-task federated learning based on model layering according to claim 5 is characterized in that: The specific operation method of step S5.3 is as follows: S5.3.

1. If the newly added task is not a real-time task, the newly added task is added to the end of the task queue and the tail pointer moves back one position; S5.3.

2. If the newly added task is a real-time high-priority task, after the current round of client learning is completed, the central server saves the connection status information, the target task client saves the aggregated model, and the next round of training for the new task starts directly.

Citation Information

Patent Citations

  • Fair privacy calculation method based on federated node contribution

    CN116306910A

  • Fair federal learning method based on node contribution clustering

    CN117196058A