Robust federated learning method and device based on federated probability Shapley value
By constructing a robust federated learning method based on federated probability Sharple value, using the predicted probability and calibration function of the global model to calculate client weights, the problem of lack of robustness of federated learning is solved, and more stable and accurate model training is achieved.
Patent Information
- Application Number
- CN202510265652.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-07-22
AI Technical Summary
The existing federated learning methods lack robustness and are unable to effectively deal with client data heterogeneity and malicious client attacks, resulting in instability in model training.
By constructing a robust federated learning method based on federated probability Sharpley values, the predicted probability and calibration functions of the global model are used to construct utility functions, calculate the local and global federated probability Sharpley values of the client, dynamically adjust the client weights, and optimize model updates.
It improves the robustness of federated learning, can more granularly evaluate the contribution of each client to model training, and enhances the stability and accuracy of model training.
Smart Images

Figure CN120354966A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine learning, and particularly to a robust federated learning method and device based on the federated probability Shapley value. Background Art
[0002] In the framework of federated learning, multiple clients do not need to share local data and jointly train a machine learning model under the coordination of a central server, effectively reducing the data storage and privacy risks in traditional centralized machine learning methods, enabling data to be fully utilized under the premise of protecting privacy, and being widely applied in multiple fields such as healthcare, finance, and data markets. For example, in the healthcare field, multiple hospitals can jointly train the same disease classifier under the federated learning paradigm without sharing the original data of patients, achieving patient privacy protection.
[0003] In existing federated learning methods, when aggregating local model updates, the clients are usually weighted uniformly or weighted based on the size of the local dataset. However, the data of different clients tends to be heterogeneous, and in actual scenarios, malicious clients may use corrupted data or send noisy parameters to manipulate the model. The above-mentioned federated learning lacks robustness and cannot effectively handle complex actual scenarios.
[0004] Regarding the problem of the lack of robustness in federated learning in related technologies, no effective solution has been proposed yet. Summary of the Invention
[0005] In this embodiment, a robust federated learning method and device based on the federated probability Shapley value are provided to solve the problem of the lack of robustness in federated learning in related technologies.
[0006] In a first aspect, in this embodiment, a robust federated learning method based on the federated probability Shapley value is provided, which is applicable to a robust federated learning system based on the federated probability Shapley value; wherein, the system includes a server and multiple clients, and each client is connected to the server; the method includes:
[0007] Construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model;
[0008] In each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probability Shapley value of the current round of the client through the utility function; based on the local federated probability Shapley value of the current round, determine the weight corresponding to the client;
[0009] Update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used to perform classification training based on local data.
[0010] In some embodiments, based on the target data uploaded by each client, determining the local federated probability Shapley value of the current round of the client through the utility function includes:
[0011] Based on the target data uploaded by each client, determining the expected value of the marginal contribution of the client in each client subset through the utility function;
[0012] Use the expected value of the marginal contribution of the client in each client subset as the local federated probability Shapley value of the current round of the client.
[0013] In some embodiments, when the federated learning is horizontal federated learning, the target data is the gradient data of the local training model.
[0014] In some embodiments, when the federated learning is vertical federated learning, the target data is the data embedding of the local data of the client.
[0015] In some embodiments, based on the local federated probability Shapley value of the current round, determining the weight corresponding to the client includes:
[0016] Obtain the local federated probability Shapley value of the client in each previous round;
[0017] Based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round, determine the global federated probability Shapley value of the client;
[0018] Based on the global federated probability Shapley value of the client, determine the weight corresponding to the client.
[0019] In some embodiments, the determining the weight corresponding to the client based on the local federated probability Shapley value of the current round further includes:
[0020] Perform min-max normalization on the local federated probability Shapley value of the current round of the client to obtain the normalized local federated probability Shapley value of the current round of the client;
[0021] Obtain the normalized local federated probability Shapley value of the client in each previous round;
[0022] Based on the normalized local federated probability Shapley value of the current round and the normalized local federated probability Shapley values of each of the previous rounds, determine the global federated probability Shapley value of the client;
[0023] Based on the global federated probability Shapley value of the client, determine the weight corresponding to the client.
[0024] In some embodiments, after determining the local federated probability Shapley value of the first client and the local federated probability Shapley value of the second client among the clients, determining the normalized local federated probability Shapley value of the second client includes:
[0025] Determine the difference in the local federated probability Shapley value between the first client and the second client;
[0026] Based on the local federated probability Shapley value of the first client and the difference in the local federated probability Shapley value, determine the normalized local federated probability Shapley value of the second client.
[0027] In a second aspect, in the present embodiment, a robust federated learning device based on the federated probability Shapley value is provided, which is applicable to a robust federated learning system based on the federated probability Shapley value; wherein, the system includes a server and multiple clients, and each client is connected to the server; the device includes:
[0028] A construction module, configured to construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model;
[0029] An operation module, configured to, in each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probability Shapley value of the current round of the client through the utility function; based on the local federated probability Shapley value of the current round, determine the weight corresponding to the client;
[0030] An update module, configured to update the global model based on the weights corresponding to the clients, and update the local training models of the clients based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used to perform classification training based on local data.
[0031] In a third aspect, a computer device is provided in this embodiment, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the robust federated learning method based on the federated probability Shapley value described in the first aspect above is implemented.
[0032] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored. When the program is executed by a processor, the robust federated learning method based on the federated probability Shapley value described in the first aspect above is implemented.
[0033] Compared with the related art, in the robust federated learning method and device based on the federated probability Shapley value provided in this embodiment, a utility function is constructed based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model; in each round of federated learning, the server receives the target data uploaded by each client; based on the target data uploaded by each client, the local federated probability Shapley value of the current round of the client is determined through the utility function; based on the local federated probability Shapley value of the current round, the weight corresponding to the client is determined; the global model is updated based on the weights corresponding to each client, and the local training models of each client are updated based on the updated global model parameters to perform the next round of federated learning until the iteration condition is reached; the local training model is used for classification training based on local data, solving the problem of lack of robustness in federated learning, and realizing the effective evaluation of the contribution of each client in model training to improve the robustness of federated learning.
[0034] The details of one or more embodiments of the present application are set forth in the following drawings and description to make the other features, objects, and advantages of the present application more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0036] Figure 1 is a hardware structure block diagram of a terminal device of a robust federated learning method based on the federated probability Shapley value provided in an embodiment of the present application;
[0037] Figure 2 is a flowchart of a robust federated learning method based on the federated probability Shapley value provided in an embodiment of the present application;
[0038] Figure 3It is a flowchart of a robust federated learning method based on federated probability Shapley value provided by another embodiment of the present application;
[0039] Figure 4 It is a flowchart of a robust federated learning method based on federated probability Shapley value provided by a preferred embodiment of the present application;
[0040] Figure 5 It is a structural block diagram of a robust federated learning device based on federated probability Shapley value provided by an embodiment of the present application.
[0041] In the figure: 102, a processor; 104, a memory; 106, a transmission device; 108, an input / output device; 10, a construction module; 20, an operation module; 30, an update module. Detailed implementation manners
[0042] To more clearly understand the purpose, technical solution, and advantages of the present application, the present application will be described and explained below with reference to the accompanying drawings and embodiments.
[0043] Unless otherwise defined, the technical terms or scientific terms involved in the present application should have the general meaning understood by those with ordinary skills in the technical field to which the present application belongs. In the present application, words such as "a", "one", "a kind of", "the", "these", etc. do not indicate a limitation in quantity, and they can be singular or plural. The terms "including", "comprising", "having" and any variations thereof involved in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device including a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products, or devices. The terms "connected", "coupled", etc. involved in the present application do not limit to physical or mechanical connections, but may include electrical connections, whether directly or indirectly connected. The "multiple" involved in the present application means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects associated before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in the present application are only used to distinguish similar objects and do not represent a specific sorting for the objects.
[0044] The method embodiments provided in this embodiment can be executed on a terminal, a computer, or a similar computing device. For example, running on a terminal, Figure 1It is a hardware block diagram of a terminal of the robust federated learning method based on the federated probability Shapley value in this embodiment. As Figure 1 shown, the terminal may include one or more ( Figure 1 only one is shown in Figure 1 ) processors 102 and a memory 104 for storing data. Among them, the processor 102 may include, but is not limited to, processing devices such as a microprocessor MCU or a field programmable gate array FPGA. The above terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above terminal. For example, the terminal may further include more or fewer components than Figure 1 shown in Figure 1 , or have a different configuration from that shown in
[0045] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the robust federated learning method based on the federated probability Shapley value in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely set relative to the processor 102, and these remote memories may be connected to the terminal through a network. Examples of the above network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0046] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one instance, the transmission device 106 includes a network adapter (abbreviated as NIC), which can be connected to other network devices through a base station and thus can communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0047] In this embodiment, a robust federated learning method based on the federated probability Shapley value is provided. Figure 2 It is a flowchart of the robust federated learning method based on the federated probability Shapley value in this embodiment. As Figure 2 shown, the process includes the following steps:
[0048] Step S210: Construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model.
[0049] Step S220: In each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probability Shapley value of the current round of the client through the utility function; based on the local federated probability Shapley value of the current round, determine the weight corresponding to the client.
[0050] Step S230: Update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used for classification training based on local data.
[0051] Specifically, the existing Shapley value usually uses classification accuracy as the utility function. However, using the original probability as the utility function can more finely capture the impact of individual data points. Based on this, given a set of predictions with relevant confidence scores, the average prediction confidence is the average of each confidence score. If the set C = {c1, c2,..., c n} represents the confidence scores of n predictions, the specific expression of the average prediction confidence T is as follows:
[0052]
[0053] In formula (1), c i represents each element in the set C, and satisfies 0 ≤ c i ≤ 1. Based on the average prediction confidence after introducing probability above, the concept of the utility function in the original Shapley value can be replaced, so as to construct a preliminary utility function based on the prediction probability of the global model in the server for the validation set, that is, the utility function based on probability. Among them, for a given classification problem, it is necessary to quantify the contribution of the data z i ∈ D (1 ≤ i ≤ |D|) to the probability classifier of the binary classification task. Let be the validation set. For a given data coalition S The utility function U p (S) based on probability is defined as follows:
[0054]
[0055] In formula (2), represents the predicted label of the k-th data in the validation set and the actual label y kThe same prediction probability. Compared with using classification accuracy as the utility function, U p (·) shows the original probability of the classifier trained on the data coalition S. The cumulative data point z i The marginal contribution in all possible coalitions on D, as the probability Shapley value PSV of client i i , is specifically defined as follows:
[0056]
[0057] In Equation (3), n represents the number of elements in set D. It should be noted that various classifiers can be converted into probability classifiers through certain processing, enabling the probability Shapley value to be widely applied in federated learning. For example, logistic regression, as a probability classifier, can directly output class probabilities using the built-in sigmoid function; for classifiers such as Support Vector Machine (SVM) and decision tree that do not provide probability output by themselves, probability output can also be achieved. For example, SVM can use the Platt scaling method to generate class probabilities by fitting the sigmoid function, and decision tree can estimate probabilities by statistically calculating the proportions of various classes in the leaf nodes.
[0058] The above probability Shapley value can be made to more realistically approximate the original contribution of data points by introducing a calibration function. The inherent non-linear characteristics reflected by the improvement of the prediction probability for the original probability cannot be ignored. For example, the improvement in prediction confidence from 90% to 100% is usually more challenging than that from 60% to 70%. Based on this, in order to capture the non-linear characteristics, the importance of the marginal improvement brought by data points when the prediction probability is relatively high can be emphasized, and a utility function constructed based on the calibration function is further proposed The calibration function can adopt functions such as softplus function, square function, mish function, and swish function. Taking the softplus function as an example, the utility function is specifically defined as follows:
[0059]
[0060] CF(x) = log(1 + e x ) (5)
[0061] In Equations (4) and (5), represents the predicted label of the k-th data in the validation set and the actual label y kThe same prediction probability; CF(x) is the calibration function. Since the softplus function is monotonically increasing on (0,1) and is a convex function on (0,1), it can meet the requirements of non-linear prediction confidence, and thus can generate well-calibrated data valuation results. Based on the utility function of the calibrated probability, the expected value of the marginal contribution of the data point z i in all possible coalitions can be used to measure z i 's calibrated probability Shapley value The specific definition is as follows:
[0062]
[0063] In formula (6), n represents the number of elements in set D. Further, the above utility function and the corresponding calibrated probability Shapley value can be applied to horizontal federated learning and vertical federated learning for client weight calculation. Specifically, in horizontal federated learning, the global model parameters x 1 and the global step size η g , local step size η l are pre-initialized, and the initial probability distribution P = [γ,..., γ] is set. In the t-th (t = 1, 2,..., T) round of communication in federated learning, sample C t from each client according to the probability distribution P t , so as to introduce different clients to participate in training in different rounds. The global model parameters x t are sent to all clients in C
[0064] through the server, ensuring that the clients start local training based on the latest global model. t Among them, for each client i ∈ C , the local training model is initialized to the global model sent by the server, that is In each local step r = 1, 2,..., R, calculate the mini-batch gradient and update the local training model That is, update the local training model according to the local gradient and local step size; then, calculate the target data of client i, that is, the gradient data
[0065] The server receives the gradient data uploaded by each client, and based on the gradient data uploaded by each client, through the pre-constructed utility function Determine the expected value of the marginal contribution of the client in each subset of clients, and use the expected value of the marginal contribution of the client in each subset of clients as the local federated probability Shapley value of the current round of the client. Then, obtain the local federated probability Shapley value of the client in each previous round, and calculate the global federated probability Shapley value of the client based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round. Furthermore, use the global federated probability Shapley value of the client as the weight corresponding to the client After that, update the global model based on the weights corresponding to each client, that is And update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is met, such as reaching the preset number of training rounds, the change amount of the model parameters between adjacent iteration rounds is less than the threshold, etc., which is not limited here. After the training is completed, return the global model parameter x T+1 。
[0066] In addition, in vertical federated learning, initialize the global model parameters in the server in advance and the global learning rate η g 、local learning rate η l 。In the t (t = 1, 2, …, T) -th round of communication of federated learning, for each client m (m = 1, 2, …, M), select private data (or mini - batch data) x n,m from the local data of the client, and calculate the local data embedding h n,m = h m (θ m ; x n,m ), where h m represents the local embedding function of client m with parameter θ m , thus embedding the information of the local data x n,m into the output h n,m , and then upload the data embedding to the server.
[0067] Receive the data embeddings uploaded by each client through the server. According to the data embeddings h n,m uploaded by each client, calculate the federated probability Shapley value of the client through the pre - constructed utility function Then, calculate the local gradient of each client Furthermore, calculate the global gradient e represents the loss function.
[0068] After that, update the global model parameters of the server using the global gradient and the global learning rate, that is And update the local training models of each client using the local gradient and the local learning rate, that is Perform the next round of federated learning until the iteration conditions are met, such as reaching a preset number of training rounds, the change in model parameters between adjacent iteration rounds is less than a threshold, etc., which are not limited here. After the training is completed, return the global model parameters
[0069] It should be noted that the above robust federated learning method based on the federated probability Shapley value can be applied to multiple fields such as healthcare, finance, and transportation. Taking the horizontal federated learning of a medical data classification model as an example, different medical institutions are used as each client, and each client holds medical data for model training, such as blood test data, electrocardiogram data, etc. Initialize the medical data classification model parameters, global step size, and local step size in the server, and set the initial probability distribution. In each round of communication of federated learning, sample from each medical institution according to the probability distribution, and send the medical data classification model parameters to each medical institution participating in the training through the server
[0070] Each medical institution initializes its local model parameters to the received medical data classification model parameters, trains the local model based on the local medical data of each medical institution, and uploads the trained gradient data to the server. The server receives the gradient data uploaded by each medical institution, calculates the local federated probability Shapley value of the current round of the medical institution through a pre-constructed utility function based on the gradient data uploaded by each medical institution, and calculates the global federated probability Shapley value of the medical institution based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round. Furthermore, use the global federated probability Shapley value of the medical institution as the weight corresponding to the medical institution
[0071] After that, update the medical data classification model in the server based on the weights corresponding to each medical institution, and update the local models of each medical institution based on the updated medical data classification model parameters, and perform the next round of federated learning until the preset number of training rounds is reached
[0072] In the existing federated learning methods, when aggregating local model updates, the methods of uniformly weighting clients or weighting clients based on the size of the local dataset are usually adopted. However, the data of different clients tends to be heterogeneous, and in actual scenarios, malicious clients may use corrupted data or send noisy parameters to manipulate the model. The above federated learning lacks robustness and cannot effectively cope with complex actual scenarios
[0073] Compared with the prior art, in the present application, a utility function is constructed based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model; in each round of federated learning, the server receives the target data uploaded by each client; based on the target data uploaded by each client, the local federated probability Shapley value of the current round of the client is determined through the utility function; based on the local federated probability Shapley value of the current round, the weight corresponding to the client is determined; the global model is updated based on the weights corresponding to each client, and the local training models of each client are updated based on the updated global model parameters, and the next round of federated learning is performed until the iteration condition is reached; the local training model is used for classification training based on local data. Based on this, a utility function based on the original probability is constructed, and a convex function applicable to the federated learning scenario is used for calibration, and the federated probability Shapley value is proposed, which uses the prediction probability more precisely and enhances the utility differentiation. Therefore, based on the utility function of the calibrated probability, the federated probability Shapley value of the client can be measured by measuring the expected value of the marginal contribution of the client in all possible coalitions, solving the problem of the lack of robustness in federated learning, and realizing the effective evaluation of the contribution of each client in model training to improve the robustness of federated learning.
[0074] In some of the embodiments, such as Figure 3 shown, based on the target data uploaded by each client in step S220, determining the local federated probability Shapley value of the current round of the client through the utility function includes the following steps:
[0075] Step S221, based on the target data uploaded by each client, determining the expected value of the marginal contribution of the client in each client subset through the utility function;
[0076] Step S222, using the expected value of the marginal contribution of the client in each client subset as the local federated probability Shapley value of the current round of the client.
[0077] Specifically, each round of training process t (t≥1) is defined as a cooperative game where x t is the global model parameter at the beginning of the t-th round, C t is the subset of clients participating in the t-th round, and let |C t | = N t , N t represents the number of clients participating in the t-th round. And represents returning the model parameter updated by the client subset S, V i t is the model parameter update vector of client i in the t-th round, η g,t and ηl,t They are the global learning rate and the local learning rate in the t-th round respectively. Based on this, a certain coalition 's utility is defined as the performance of the global model updated in the t-th round by this coalition, that is, the utility function U F (S)=Φ(D v ,Ψ(x t ,S)), in the cooperative game In the t-th round, the local federal probability Shapley value of client i is specifically defined as follows:
[0078]
[0079] In Equation (7), U F (S∪{i})-U F (S) represents the increase in the utility of the coalition after client i joins subset S. It should be noted that the local federal probability Shapley value is used to measure the total marginal contribution of a certain client relative to all subsets of selected clients, and there is no need to retrain the model from scratch. It can be directly calculated based on the model update in the current round.
[0080] Through this embodiment, based on the target data uploaded by each client, the expected value of the marginal contribution of the client in each client subset is determined through the utility function, and the local federal probability Shapley value of the current round of the client is the expected value of the marginal contribution of the client in each client subset, so as to accurately evaluate the contribution of each client in the current round.
[0081] In some of these embodiments, when the federated learning is horizontal federated learning, the target data is the gradient data of the local training model.
[0082] Specifically, in horizontal federated learning, for each client i∈C t , the local training model is initialized as the global model sent by the server. At each local step r = 1, 2,..., R, calculate the mini-batch gradient and update the local training model That is, update the local training model according to the local gradient and the local step size, and calculate the target data of client i, that is, the gradient data of the local training model Send the gradient data of each participating training client to the server.
[0083] Furthermore, the server receives the gradient data uploaded by each client. Based on the gradient data uploaded by each client, through a pre-constructed utility function Determine the expected value of the marginal contribution of the client in each client subset, and use the expected value of the marginal contribution of the client in each client subset as the local federated probability Shapley value of the current round of the client. Then, obtain the local federated probability Shapley value of the client in each previous round, and calculate the global federated probability Shapley value of the client based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round. Furthermore, use the global federated probability Shapley value of the client as the weight corresponding to the client.
[0084] Through this embodiment, in horizontal federated learning, using the gradient data of the local training model in each client as the measurement benchmark of the Shapley value, the accurate calculation of the local federated probability Shapley value is realized.
[0085] In some of these embodiments, in the case where the federated learning is vertical federated learning, the target data is the data embedding of the local data of the client.
[0086] Specifically, for vertical federated learning, in the t (t = 1, 2,..., T) -th round of communication of the federated learning, for each client m (m = 1, 2,..., M), select private data (or mini - batch data) x from the local data of the client n,m , calculate the local data embedding h n,m = h m (θ m ; x n,m ), where h m represents the local embedding function of client m, and the parameter is θ m . In this way, the information of the local data x n,m is embedded into the output h n,m . After that, upload the data embedding to the server. To achieve efficient calculation of the client, in the actual algorithm, the embedding function h m can be set to be linear, that is
[0087] During the global training process, the server waits to receive messages from the active client m. This message includes two types. The first message is a query about the gradient of the loss function with respect to the embedding vector h n,m , and the second message is the new embedding vector h m calculated using the updated local model parameter θ n,m . For the first message, the server calculates the gradient of client m based on the currently stored h n,m and returns the calculation result to the corresponding client. When receiving the second message, the server calculates the new gradient with respect to θ0 based on the embedding vectors of other clients it currently has and updates the model parameter θ0. Among them, in each interaction process with the server, each active client m randomly selects a data point xn,m , query the gradient of h n,m , securely upload the updated embedding vector h n,m , and update the local model parameter θ m .
[0088] It should be noted that in the vertical federated learning scenario, the client only shares the local data embedding instead of the original data, effectively protecting data privacy. Among them, the data of each client m is not shared with other clients or the server. Each client m learns the local data embedding h m , which is represented by the parameter θ m , mapping the high-dimensional vector to a low-dimensional space, that is (P` m << P m ). For the scenario of introducing the global federated probability Shapley value, the optimization problem solved by the client and the server in the t-th round changes as follows:
[0089]
[0090] In Equation (8), θ0 represents the global model parameter learned and maintained by the server; l represents the loss function, capturing the accuracy of the global model parameters θ0, θ1, …, θ M ; r represents the regularization term of each client, used to restrict or encode the prior knowledge of the local model parameter; represents the global federated probability Shapley value of client i in the t-th round.
[0091] Among them, in this embodiment, by multiplying the weight of each data embedding of the client by the coefficient of the number of clients in the optimization problem, a weight with an expected value of 1 can be obtained to ensure that the client data embedding can be effectively updated to the global model in each round of communication.
[0092] Through this embodiment, in vertical federated learning, taking the data embedding of the local data in each client as the measurement benchmark of the Shapley value, the accurate calculation of the local federated probability Shapley value is realized, and through the cooperative game modeling method of data embedding, while protecting data privacy, the global model performance is optimized, achieving a good balance between privacy protection and performance optimization. In addition, this embodiment extends the robust federated learning method from horizontal data partitioning to vertical data feature partitioning, further enhancing the adaptability and generality of the algorithm.
[0093] In some of these embodiments, determining the weight corresponding to the client based on the local federated probability Shapley value of the current round in step S220 includes the following steps:
[0094] Obtain the local federated probability Shapley value of the client in each previous round;
[0095] Determine the global federated probability Shapley value of the client based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round.
[0096] Determine the weight corresponding to the client based on the global federated probability Shapley value of the client.
[0097] It should be noted that each round of collaborative training can be regarded as a collaborative process composed of a subset of clients. The marginal contribution of each client in each round can be deduced based on the collaborative process, so that the marginal contributions of each client in multiple consecutive rounds can be combined to obtain the global federated probability Shapley value of the client, in order to adjust the weight. Compared with directly calculating the probability Shapley value, there is no need to retrain the model from scratch to deduce the marginal contribution of each client subset.
[0098] Specifically, obtain the local federated probability Shapley value of the client in each previous round, accumulate the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round to obtain the global federated probability Shapley value of the client, and further use the global federated probability Shapley value of the client as the weight corresponding to the client.
[0099] Through this embodiment, obtain the local federated probability Shapley value of the client in each previous round, determine the global federated probability Shapley value of the client based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round, and determine the weight corresponding to the client based on the global federated probability Shapley value of the client, regarding the federated learning training as a cooperative game, dynamically aggregating according to the global federated probability Shapley value of the client, and dynamically adjusting the weight based on the global federated probability Shapley value of the client to ensure the accuracy and stability of weight calculation.
[0100] In some of these embodiments, determining the weight corresponding to the client based on the local federated probability Shapley value of the current round in step S220 further includes the following steps:
[0101] Perform min-max normalization on the local federated probability Shapley value of the current round of the client to obtain the normalized local federated probability Shapley value of the current round of the client;
[0102] Obtain the normalized local federated probability Shapley value of the client in each previous round;
[0103] Determine the global federated probability Shapley value of the client based on the normalized local federated probability Shapley value of the current round and the normalized local federated probability Shapley values of each previous round;
[0104] Determine the weight corresponding to the client based on the global federated probability Shapley value of the client.
[0105] Specifically, since the change in the performance of the global model during the training process gradually decreases, and the ranges of the local federated probability Shapley values in different rounds are inconsistent. To eliminate the influence of the inconsistent ranges, the local federated probability Shapley value of the current round of the client is subjected to min-max normalization to obtain the normalized local federated probability Shapley value of the current round of the client. The specific calculation formula is as follows:
[0106]
[0107] In Equation (9), max() and min() are used to return the maximum and minimum values in the set of local federated probability Shapley values respectively.
[0108] After that, obtain the normalized local federated probability Shapley values of the client in each previous round, accumulate the normalized local federated probability Shapley value of the current round and the normalized local federated probability Shapley values of each previous round to obtain the global federated probability Shapley value of each client, and then use the global federated probability Shapley value of the client as the weight corresponding to the client.
[0109] Among them, for T consecutive collaborative games The global federated probability Shapley value of client i The specific calculation formula is as follows:
[0110]
[0111] In Equation (10), β represents a hyperparameter that controls the update rate of the global federated probability Shapley value. In this embodiment, the global federated probability Shapley value is updated through the normalized local federated probability Shapley value in each round, which can capture the contribution of the client during the current training process and is suitable for dynamically adjusting the client weight. The hyperparameter β can adjust the timeliness of the contribution. For example, β = 0 means that the global federated probability Shapley value completely depends on the normalized local federated probability Shapley value of the current round.
[0112] It should be noted that the contribution of each client to the global loss is determined by weighting the global federated probability Shapley value of the client. The specific expression of the adaptive training target of the server in the t-th round is as follows:
[0113]
[0114] In Equation (11), the adaptive training target of the server in the t-th round is to minimize the objective function F in the parameter space t (x); F i\(L_i(x)\) represents the local loss function of client \(i\); represents the weight of the client for the global loss in the \(t\)-th round.
[0115] It can be understood that according to the balance property, the sum of the local federated probability Shapley values of the selected clients in each round is equal to the improvement of the global model performance in that round. Since the model performance increment in a single round is small, the absolute value of the local federated probability Shapley value is not important, and the min-max normalization operation maintains the relative sizes of the selected clients in each round, which is a better choice when evaluating the relative contributions of clients.
[0116] In this embodiment, the local federated probability Shapley value of the current round of the client is min-max normalized to obtain the normalized local federated probability Shapley value of the current round of the client, the normalized local federated probability Shapley values of the client in each previous round are obtained, the global federated probability Shapley value of the client is determined based on the normalized local federated probability Shapley value of the current round and the normalized local federated probability Shapley values of each previous round, and the weight corresponding to the client is determined based on the global federated probability Shapley value of the client, so as to eliminate the influence caused by the inconsistent ranges of the local federated probability Shapley values in different rounds, which helps to improve the accuracy of evaluating the contributions of clients.
[0117] In some of these embodiments, after determining the local federated probability Shapley value of the first client and the local federated probability Shapley value of the second client among the clients, determining the normalized local federated probability Shapley value of the second client includes the following steps:
[0118] Determine the difference in local federated probability Shapley values between the first client and the second client;
[0119] Based on the local federated probability Shapley value of the first client and the difference in local federated probability Shapley values, determine the normalized local federated probability Shapley value of the second client.
[0120] Specifically, in the \(t\)-th round of communication, for any two clients \(k, i\in N\) in the client set \(N = \{1, 2, \ldots, n\}\), the local federated probability Shapley value of the first client \(k\) and the local federated probability Shapley value of the second client \(i\) are calculated, and the difference in local federated probability Shapley values between the first client \(k\) and the second client \(i\) is calculated, that is Then the set of differences in local federated probability Shapley values between the first client \(k\) and any other client in the client set is where The specific calculation formula of
[0121]
[0122] Furthermore, based on the above formula (12), the subset S in the formula can be derived in three parts, namely the subset containing client i, the subset containing client k, and the subset not containing client i and client k. After rearranging the terms, the specific representation of the normalized local federated probability Shapley value of client i is as follows:
[0123]
[0124] In formula (13), according to the calculation definition of the normalized local federated probability Shapley value, we get Introduce any selected client k and use Transform the equation to get where represents the difference in the local federated probability Shapley value between client k and client i; furthermore, since when then reaches the maximum value, then When then reaches the minimum value, then In the formula Formula (13) shows that based on the difference in the local federated probability Shapley between each client and any client k, the normalized federated probability Shapley value of each client can be calculated.
[0125] It should be noted that the difference in the local federated probability Shapley in each round of communication usually has a relatively small variance statistically. Based on this characteristic, in this embodiment, the change range of the local federated probability Shapley is used as the optimization point. By estimating the difference in the normalized local federated probability Shapley value, and using the characteristic of a relatively small range, the above method for calculating the normalized federated probability Shapley value of the client is designed, that is, the difference in the local federated probability Shapley value between each client and a certain client is used for min-max normalization. Compared with directly normalizing the local federated probability Shapley value of each client, the computational complexity is significantly reduced.
[0126] Through this embodiment, the difference in the local federated probability Shapley value between the first client and the second client is determined. Based on the local federated probability Shapley value of the first client and the difference in the local federated probability Shapley value, the normalized local federated probability Shapley value of the second client is determined, so as to significantly reduce the computational complexity, thereby reducing the computational cost of adaptive federated learning.
[0127] The following describes and illustrates this embodiment through preferred embodiments.
[0128] Figure 4 is a flowchart of the robust federated learning method based on the federated probability Shapley value in this preferred embodiment. As Figure 4 shown, the robust federated learning method based on the federated probability Shapley value includes the following steps:
[0129] Step S410: Construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model.
[0130] Step S420: In each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the expected value of the marginal contribution of the client in each client subset through the utility function; take the expected value of the marginal contribution of the client in each client subset as the local federated probability Shapley value of the client in the current round.
[0131] Step S430: Obtain the local federated probability Shapley value of the client in each previous round; based on the local federated probability Shapley value in the current round and the local federated probability Shapley values in each previous round, determine the global federated probability Shapley value of the client; based on the global federated probability Shapley value of the client, determine the weight corresponding to the client.
[0132] Step S440: Update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used for classification training based on local data.
[0133] Through this embodiment, a utility function is constructed based on the prediction probability of the global model in the server for the validation set and a preset calibration function, and the prediction probability is the probability that the predicted label of the data in the validation set is the same as the actual label. In each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the expected value of the marginal contribution of the client in each client subset through the utility function, take the expected value of the marginal contribution of the client in each client subset as the local federated probability Shapley value of the client in the current round, and obtain the local federated probability Shapley value of the client in each previous round. Based on the local federated probability Shapley value in the current round and the local federated probability Shapley values in each previous round, determine the global federated probability Shapley value of the client, and then based on the global federated probability Shapley value of the client, determine the weight corresponding to the client.
[0134] Further, the global model is updated based on the weights corresponding to each client, and the local training models of each client are updated based on the updated global model parameters to perform the next round of federated learning until the iteration condition is reached, solving the problem of lack of robustness in federated learning and achieving effective evaluation of the contribution of each client in model training to improve the robustness of federated learning.
[0135] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0136] In this embodiment, a robust federated learning device based on the federated probabilistic Shapley value is also provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated here. The following terms "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0137] Figure 5 is the structural block diagram of the robust federated learning device based on the federated probabilistic Shapley value in this embodiment, as Figure 5 shown, the device includes:
[0138] A construction module 10, configured to construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model;
[0139] An operation module 20, configured to receive, in each round of federated learning, the target data uploaded by each client through the server; determine the local federated probabilistic Shapley value of the current round of the client through the utility function based on the target data uploaded by each client; and determine the weight corresponding to the client based on the local federated probabilistic Shapley value of the current round;
[0140] An update module 30, configured to update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters to perform the next round of federated learning until the iteration condition is reached; the local training model is used to perform classification training based on local data.
[0141] Through the device provided in this embodiment, a utility function is constructed based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model; in each round of federated learning, the server receives the target data uploaded by each client; based on the target data uploaded by each client, the local federated probability Shapley value of the client for the current round is determined through the utility function; based on the local federated probability Shapley value of the current round, the weight corresponding to the client is determined; the global model is updated based on the weights corresponding to each client, and the local training models of each client are updated based on the updated global model parameters, and the next round of federated learning is performed until the iteration condition is reached; the local training model is used for classification training based on local data, which solves the problem of lack of robustness in federated learning and realizes the effective evaluation of the contribution of each client in model training to improve the robustness of federated learning.
[0142] In some embodiments, the operation module 20 is further configured to determine, based on the target data uploaded by each client, the expected value of the marginal contribution of the client in each subset of clients through the utility function; and use the expected value of the marginal contribution of the client in each subset of clients as the local federated probability Shapley value of the client for the current round.
[0143] In some embodiments, the operation module 20 is further configured to obtain the local federated probability Shapley value of the client in each previous round; determine the global federated probability Shapley value of the client based on the local federated probability Shapley value of the current round and the local federated probability Shapley values of each previous round; and determine the weight corresponding to the client based on the global federated probability Shapley value of the client.
[0144] In some embodiments, the operation module 20 is further configured to perform min-max normalization on the local federated probability Shapley value of the client for the current round to obtain the normalized local federated probability Shapley value of the client for the current round; obtain the normalized local federated probability Shapley values of the client in each previous round; determine the global federated probability Shapley value of the client based on the normalized local federated probability Shapley value of the current round and the normalized local federated probability Shapley values of each previous round; and determine the weight corresponding to the client based on the global federated probability Shapley value of the client.
[0145] In some embodiments, the operation module 20 is further configured to determine the difference in the local federated probability Shapley value between the first client and the second client; and determine the normalized local federated probability Shapley value of the second client based on the local federated probability Shapley value of the first client and the difference in the local federated probability Shapley value.
[0146] It should be noted that each of the above modules can be a functional module or a program module, and can be implemented either by software or by hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combined form.
[0147] In this embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0148] Optionally, the above computer device may further include a transmission device and an input / output device. Among them, the transmission device is connected to the above processor, and the input / output device is connected to the above processor.
[0149] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:
[0150] S1, construct a utility function based on the prediction probability of the global model for the validation set in the server and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model;
[0151] S2, in each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probability Shapley value of the current round of the client through the utility function; based on the local federated probability Shapley value of the current round, determine the weight corresponding to the client;
[0152] S3, update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used for classification training based on local data.
[0153] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated in this embodiment.
[0154] In addition, in combination with the robust federated learning method based on the federated probability Shapley value provided in the above embodiments, a storage medium can also be provided to implement it in this embodiment. A computer program is stored on the storage medium; when the computer program is executed by a processor, it implements any one of the above embodiments of the robust federated learning method based on the federated probability Shapley value.
[0155] It should be understood that the specific embodiments described herein are for the purpose of explaining this application and not for limiting it. All other embodiments obtained by those of ordinary skill in the art based on the embodiments provided in this application without creative efforts shall fall within the protection scope of this application.
[0156] Obviously, the accompanying drawings are only some examples or embodiments of this application. For those of ordinary skill in the art, this application can also be applied to other similar situations based on these drawings without creative efforts. Additionally, it can be understood that although the work done during the development here may be complex and time-consuming, for those of ordinary skill in the art, certain design, manufacturing, or production changes based on the technical content disclosed in this application are only routine technical means and should not be regarded as insufficient disclosure of this application.
[0157] The term "embodiment" in this application means that the specific features, structures, or characteristics described in connection with the embodiment may be included in at least one embodiment of this application. The phrase appears at various positions in the specification and does not necessarily mean the same embodiment, nor does it mean being independent or alternative to other embodiments and mutually exclusive. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in this application can be combined with other embodiments without conflict.
[0158] The above-described embodiments merely represent several implementation manners of this application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of patent protection. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.
Claims
1. A robust federated learning method based on the federated probabilistic Shapley value, characterized in that, Applicable to a robust federated learning system based on the federated probabilistic Shapley value; wherein, the system includes a server and multiple clients, and each client is connected to the server; the method includes: Construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model; In each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probabilistic Shapley value of the client for the current round through the utility function; based on the local federated probabilistic Shapley value of the current round, determine the weight corresponding to the client; Update the global model based on the weights corresponding to each client, and update the local training models of each client based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used for classification training based on local data.
2. The robust federated learning method based on the federated probability Shapley value according to claim 1, wherein Based on the target data uploaded by each client, determining the local federated probabilistic Shapley value of the client for the current round through the utility function includes: Based on the target data uploaded by each client, determine the expected value of the marginal contribution of the client in each client subset through the utility function; Use the expected value of the marginal contribution of the client in each client subset as the local federated probabilistic Shapley value of the client for the current round.
3. The robust federated learning method based on the federal probability Shapley value according to claim 1 or claim 2, characterized in that, In the case where the federated learning is horizontal federated learning, the target data is the gradient data of the local training model.
4. The robust federated learning method based on the federal probability Shapley value according to claim 1 or claim 2, characterized in that, In the case where the federated learning is vertical federated learning, the target data is the data embedding of the local data of the client.
5. The robust federated learning method based on the federated probability Shapley value according to claim 1, wherein, Based on the local federated probabilistic Shapley value of the current round, determining the weight corresponding to the client includes: Obtain the local federated probabilistic Shapley value of the client in each previous round; Based on the local federated probabilistic Shapley value of the current round and the local federated probabilistic Shapley values of each previous round, determine the global federated probabilistic Shapley value of the client; Based on the global federated probabilistic Shapley value of the client, determine the weight corresponding to the client.
6. The robust federated learning method based on the federated probability Shapley value according to claim 1, wherein, The determining the weight corresponding to the client based on the local federated probabilistic Shapley value of the current round further includes: Perform min-max normalization on the local federated probabilistic Shapley value of the client for the current round to obtain the normalized local federated probabilistic Shapley value of the client for the current round; Obtain the normalized local federated probabilistic Shapley value of the client in each previous round; Based on the normalized local federated probabilistic Shapley value of the current round and the normalized local federated probabilistic Shapley values of each previous round, determine the global federated probabilistic Shapley value of the client; Based on the global federated probabilistic Shapley value of the client, determine the weight corresponding to the client.
7. The robust federated learning method based on the federated probability Shapley value according to claim 6, wherein After determining the local federated probability Shapley value of the first client and the local federated probability Shapley value of the second client among the clients, determining the normalized local federated probability Shapley value of the second client includes: Determining the difference in the local federated probability Shapley value between the first client and the second client; Based on the local federated probability Shapley value of the first client and the difference in the local federated probability Shapley value, determining the normalized local federated probability Shapley value of the second client.
8. A robust federated learning device based on the federated probabilistic Shapley value, characterized in that, Applicable to a robust federated learning system based on the federated probability Shapley value; wherein, the system includes a server and a plurality of clients, and each client is connected to the server; the device includes: A construction module, configured to construct a utility function based on the prediction probability of the global model in the server for the validation set and a preset calibration function; the prediction probability is the prediction probability that the predicted label of the data in the validation set is the same as the actual label; the global model is a data classification model; An operation module, configured to, in each round of federated learning, receive the target data uploaded by each client through the server; based on the target data uploaded by each client, determine the local federated probability Shapley value of the current round of the client through the utility function; based on the local federated probability Shapley value of the current round, determine the weight corresponding to the client; An update module, configured to update the global model based on the weights corresponding to the clients, and update the local training models of the clients based on the updated global model parameters, and perform the next round of federated learning until the iteration condition is reached; the local training model is used to perform classification training based on local data.
9. A computer device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps of the robust federated learning method based on the federated probability Shapley value according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the robust federated learning method based on the federated probability Shapley value according to any one of claims 1 to 7.
Citation Information
Cited By
Federal learning contribution evaluation method and device
CN121303267A