Federal data valuation method based on influence pruning sampling
By adopting the influential pruning sampling method in the federal learning scenario, pruning low-influence combination and sampling high-influence combination, the problem of difficult to balance the efficiency and accuracy of federal data valuation in the existing technology is solved, and efficient and accurate data valuation effect is achieved.
Patent Information
- Application Number
- CN202411950043.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The prior art is difficult to achieve high efficiency and accuracy simultaneously in the federated learning scenario, especially in the valuation of data, which fails to fully consider the differential impact of different data set combinations on the approximate results.
Using the federal data valuation method based on influence pruning sampling, a Shapril value calculation scheme based on marginal contribution is designed, and a low-influence client combination is sampled, and a high-influence combination is achieved to estimate the Shapril value using "less but fine" samples.
With smaller approximate errors, the time overhead is greatly reduced, and the fair and efficient data valuation of all participants in federal learning is achieved, improving the overall performance of sampling.
Smart Images

Figure CN119886388A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of federated data valuation, and relates to a problem of evaluating the data value of multiple data owners in a federated learning scenario, and specifically to a federated data valuation method based on influence pruning sampling. Background Art
[0002] Federated learning, as a new paradigm for distributed machine learning, can leverage datasets across multiple data owners without direct access to the original data. However, data owners may be reluctant to share high-quality datasets unless the value of their datasets is fairly measured to ensure that they receive appropriate compensation. Therefore, how to fairly and efficiently perform data valuation has become an urgent problem to be solved in federated learning.
[0003] The Shapley value is a classic concept for measuring the contribution of each party in a collaboration. It has been considered as a standard data evaluation metric for federated learning in previous work because it uniquely satisfies several basic fairness properties. However, data valuation based on the Shapley value is widely considered to be computationally expensive because federated models must be trained and evaluated on an exponential number of dataset combinations. Therefore, researchers have taken efficiency as a core issue and designed a series of approximation algorithms. Existing solutions can be mainly divided into two categories: the first category is gradient-based approximation, which uses gradients to construct federated models during training, thereby avoiding additional training processes. Although these solutions significantly improve computational efficiency, they lack accuracy guarantees, reducing their practicality. The second category is sampling-based approximation, which selects a small number of combinations from all possible dataset combinations to train and evaluate federated models. Recently, more studies have advocated sampling-based methods because they can flexibly trade off between accuracy and efficiency.
[0004] However, existing sampling-based approximations still cannot achieve both high efficiency and accuracy. The main limitation is that they fail to fully consider the differential impact of different dataset combinations on the approximation results. This neglect not only leads to low sampling efficiency, but also makes it difficult to achieve accurate and reliable evaluation with a small number of high-impact samples. This problem highlights the need to more finely utilize the influence of different dataset combinations on the Shapley value when designing sampling strategies to improve the overall performance of sampling.
[0005] In summary, the Shapley value has ideal fairness and has been advocated as a standard metric for federated data valuation. However, due to the high computational overhead of the Shapley value and the failure of existing approximation schemes to achieve high accuracy and efficiency at the same time, its practical application is difficult to achieve. Summary of the invention
[0006] In response to the problems existing in the prior art, the present invention focuses on the data valuation problem in the federated scenario, and proposes a federated data valuation method based on influence pruning sampling. It adopts a Shapley value calculation scheme based on marginal contribution, and designs a Shapley value approximation algorithm based on influence pruning sampling, so that client combinations with low influence are pruned and combinations with high influence are sampled, thereby achieving the effect of estimating the Shapley value with "few but good" samples. It has the advantage of greatly reducing time overhead with a smaller approximation error, and realizes fair and efficient data valuation for all participants in federated learning.
[0007] The present invention provides a federated data valuation method based on influence pruning sampling, and the specific steps are as follows:
[0008] Step 1: The server prepares the test set T, and each client provides a data set {D 1 ,D 2 ,…,D n The server sets the utility function U(·) as the model accuracy and determines the total number of sampling rounds γ and the total number of sampling layers k * +1, will be higher than k * +1 layer of low-impact combination pruning; and in the γ round of sampling, the empty client combination of layer 0 must be sampled
[0009] Above is a natural number set; n is the total number of clients; j is the number of clients in a certain layer combination.
[0010] Step 2: For Tier 0, the server initializes the federation model And directly evaluate it on the test set T, and get the accuracy As an empty client combination The effect
[0011] Step 3: For k=1,2,…,k * Layer, the server selects all client combinations S k , where S k The sample size is |S k |; front k * The total number of samples in the layer is
[0012] Step 4: For the kth * +1 layer, the server randomly selects some client combinations Will Denoted as p, the number of samples of p is |p|, and |P| should not exceed
[0013] Step 5: For the 1st to kth* +1 layer, that is, k=1,2,…,k * +1, repeat steps 6 to 7 to train and evaluate the federated global model on the sampled samples and calculate the marginal contribution.
[0014] Step 6: For each combination S∈S sampled at the kth layer k , the server and the clients in S jointly train the federated global model; then, the server trains the model M on the test set T S Evaluate and get the accuracy acc(M S ,T), and take it as the utility U(M S )=acc(M S ,T).
[0015] Step 7: For each combination S∈S sampled from the kth layer k , the server calculates the marginal contribution U(M) of each client i∈S to the combination S S )-U(M S\{i} ); S\{i} is the subset obtained by subtracting client i from combination S; U(M S\{i} ) is the utility of combination S after subtracting client i.
[0016] Step 8: The server calculates the marginal contribution of each client under different combinations; then the marginal contribution of each layer is averaged to get the approximate Shapley value of client i
[0017] The advantages of the present invention are:
[0018] 1. The federated data valuation method based on influence pruning sampling of the present invention ensures that the client combination is reasonably sampled according to its influence through the ingenious design of the stratified sampling method for approximate calculation of the Shapley value, so that the number of samples is small while the influence is high. It can not only reduce the approximation error, but also efficiently complete the calculation, so as to be applied to large-scale federated scenarios.
[0019] 2. The present invention designs an influence pruning sampling method for federated data valuation based on influence pruning sampling, so that the approximate calculation of the Shapley value is accurate and efficient.
[0020] 3. Compared with the method of accurately calculating the Shapley value, the federated data valuation method based on influence pruning sampling in the present invention greatly reduces the time cost, making it more practical when processing large-scale data or complex federated learning models; at the same time, compared with other existing approximate calculation methods, this method effectively reduces the calculation error on the basis of reducing the calculation complexity, thereby ensuring the reliability and stability of the federated data valuation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a system framework diagram of the federated data valuation method based on influence pruning sampling of the present invention;
[0022] Figure 2 This is an example diagram of the calculation of approximate Shapley value in the federated data valuation method based on influence pruning sampling of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0024] The present invention is based on the federated data valuation method of influence pruning sampling. The whole system framework is as follows: Figure 1 As shown in the figure, the server is responsible for coordinating the clients, including pruning sampling, organizing federated learning, and evaluating data value, while the clients mainly cooperate with the server and contribute data for local model training.
[0025] The present invention is based on the federated data valuation method of influence pruning sampling, which is specifically divided into the following steps:
[0026] Step 1: The model user provides the server with a test set T (different from the training data set source), and each client provides a training data set {D 1 ,D 2 ,…,D n The server sets the utility function U(·) to the accuracy of the federated global model (the global model on the server in federated learning) and determines the total number of sampling rounds γ. The total number of sampling rounds γ can be used to balance accuracy and efficiency. Generally speaking, the larger the γ, the smaller the approximation error and the greater the time cost.
[0027] Since calculating the Shapley value requires evaluating all possible client combinations, we can stratify them according to the size of the combinations, such as Figure 2 As shown in the figure, the scale of each layer is a diamond shape from small to large. Taking 3 clients as an example, the combination of layer 0 is only empty; the combination of layer 1 includes {1}, {2}, {3}; the combination of layer 2 is {1,2}, {1,3}, {2,3}; the combination of layer 3 is {1,2,3}. Among them, the number of clients in each client combination of layer k (i.e., the combination size) is k, and the layer k contains a total of There are multiple client combinations, that is, the number of solutions for selecting k from n clients. However, the higher the individual client combinations, the smaller the impact on the Shapley value, so only the k at the bottom are affected. * +1 layer for sampling, which will be higher than k * +1 layer of low-impact combined pruning. * The calculation formula is:
[0028]
[0029] In the above formula, is a natural number set; n is the total number of clients; j is the number of clients in a certain layer combination. It should be noted that in the γ round sampling, the empty client combination of layer 0 must be sampled Otherwise the contribution margin cannot be calculated.
[0030] Step 2: For Tier 0, the server initializes the federation model And directly evaluate it on the test set T to get the accuracy As an empty client combination The effect
[0031] In step 3, since the first k * The client combinations of the layers have the most significant impact on the Shapley value, so all of them need to be sampled.
[0032] Step 3: For k=1,2,…,k * The client combination has the highest influence, so the server selects all possible client combinations S k (i.e. all samples), where S k The sample size is |S k |. For the kth layer, the number of samples is Then the first k * The total number of samples in the layer is
[0033] Step 4: For the kth * +1 layer, the influence of the client combination is weakened, so the server randomly selects some client combinations (i.e. partial sampling), for ease of representation, Denoted as P. The number of samples of P is |P|, and |P| should not exceed
[0034] To ensure fairness, in the kth * In the client combination P selected in the +1 layer, all clients must appear and the total number of appearances must be the same, that is, j∈N,∑ S∈P I[i∈S]=∑ S∈P I[j∈S], where I is an indicator function that returns 1 when the condition is met, otherwise it returns 0; ∑ S∈P I[i∈S] represents the number of times client i appears in the sample set P.
[0035] exist Figure 2 In the embodiment shown, the number of clients n=4, the total number of sampling rounds γ=9, so there are k * =1, the number of samples in layer 0 and layer 1 is The number of samples in the second layer is The combination of the third and fourth layers is pruned. The specific sampling results from step 3 to step 4 are: the sample set S of the first layer 1 ={{1},{2},{3},{4}}, the sample set S of the second layer 2 ={{1,2},{1,4},{2,3},{3,4}}.
[0036] Step 5: For the 1st to kth * +1 layer, that is, k=1,2,…,k * +1, repeat steps 6 to 7 to train and evaluate the federated global model on the sampled samples and calculate the marginal contribution.
[0037] Step 6: For each combination S∈S sampled at the kth layer k , the server and the clients in S perform federated global model training together.
[0038] First, the server sends the federated global model to all clients in the kth layer, and each client uses the local dataset D i Conduct federated global model training and upload the updated federated global model back to the server.
[0039] Subsequently, the server uses the classic FedAvg algorithm to perform federated learning on the federated global models uploaded by all clients, that is, weighted averaging the model parameters of each party according to the amount of data to obtain a new federated global model M. S , and then sent to all clients in the kth layer, repeating the above process until the federated global model converges or reaches a given number of training rounds, and finally obtaining the federated global model M S .
[0040] Then, the server tests the model M on the test set T. S Evaluate and get the accuracy acc(M S ,T), and take it as the utility U(M S )=acc(M S ,T).
[0041] Step 7: For each combination S∈S sampled from the kth layer k , the server calculates the marginal contribution U(M) of each client i∈S to the combination S S )-U(M S\{i} ). S\{i} is the subset obtained by subtracting client i from combination S; U(M S\{i} ) is the utility of combination S after subtracting client i.
[0042] Step 8: The server calculates the marginal contribution of each client under different combinations according to the following formula for client i: * +1] Average marginal contribution of the layer
[0043]
[0044] Among them, i∈N,k∈[1,k * +1]; U(M S∪{i} )-U(M S ) is the marginal contribution of client i to the combination S, is the number of samples in the |S|th layer that does not contain client i, used to calculate the average value.
[0045] Then take the average of the marginal contribution of each layer to get the approximate Shapley value of client i
[0046]
[0047] exist Figure 2 In the embodiment shown, the utility of all samples after federated model evaluation is given. The approximate Shapley value is calculated by taking client 1 as an example: For layer 1, the average marginal contribution of client 1 is For Tier 2, the average marginal contribution of Client 1 is So the approximate Shapley value for client 1 is Similarly, the data values of other clients are
[0048] In summary, the federated data valuation method based on influence pruning sampling in the present invention uses the precise calculation formula of the Shapley value based on marginal contribution
[0049]
[0050] It can be seen that different sizes of client combinations S have an effect on the Shapley value φ i The impact of |D is different, which is mainly reflected in two aspects: First, the marginal contribution of the federated model decreases with the increase of data volume, that is, when |D S When | is large enough, the marginal contribution U(M S∪{i} )-U(M S ) is usually small. This is because once there is enough data for training, adding new data can only improve the utility to a limited extent. Second, when the size of the client portfolio |S| approaches (n-1) / 2, the corresponding coefficient At this point, it will reach a minimum, thus weakening the influence of combination S. The above analysis shows that when the size of the client combination approaches or exceeds (n-1) / 2, the impact on the final result will decrease. Therefore, the value of client data in federated learning is mainly affected by a few combinations, especially those containing fewer clients.
[0051] Based on the above analysis, the present invention designs an influence pruning sampling method, which makes the approximate calculation of Shapley value accurate and efficient. Given the number of clients n and the total number of sampling rounds γ, this method prunes the combinations involving a large number of federated clients and only focuses on those combinations that have a high impact on the final result, that is, combinations with a size of no more than k. * +1 combination. Assuming that the average time for a federated learning is τ, the time complexity of accurately calculating the Shapley value is O(2 n τ), and the time complexity of this method is O(γτ), which can effectively reduce the time cost. Assuming that the average amount of data of the client in federated learning is t, the approximate error limit of this method is In general federation scenarios, the amount of data t on the client is usually large, so even in k * When the value is small, the method of the present invention can also achieve a smaller approximation error.
Claims
1. A method for estimating federated data based on influence pruning sampling, characterized by: The specific steps are: Step 1: The server prepares the test set T, and each client provides a data set {D1,D2,…,D n The server sets the utility function U(·) as the model accuracy and determines the total number of sampling rounds γ and the total number of sampling layers k * +1, will be higher than k * +1 layer of low-impact combination pruning; and in the γ round of sampling, the empty client combination of layer 0 must be sampled Above is a natural number set; n is the total number of clients; j is the number of clients in a certain layer combination; Step 2: For Tier 0, the server initializes the federation model And directly evaluate it on the test set T, and get the accuracy As an empty client combination The effect Step 3: For k=1,2,…,k * Layer, the server selects all client combinations S k , where S k The sample size is |S k |; front k * The total number of samples in the layer is Step 4: For the kth * +1 layer, the server randomly selects some client combinations Will Denoted as P, the number of samples of P is |P|, and |P| should not exceed Step 5: For the 1st to kth * +1 layer, that is, k=1,2,…,k * +1, repeat steps 6 to 7, train and evaluate the federated global model for the sampled samples, and calculate the marginal contribution; Step 6: For each combination S∈S sampled at the kth layer k , the server and the clients in S jointly train the federated global model; then, the server trains the model M on the test set T S Evaluate and get the accuracy acc(M S ,T), and take it as the utility U(M S )=acc(M S ,T); Step 7: For each combination S∈S sampled from the kth layer k , the server calculates the marginal contribution U(M) of each client i∈S to the combination S S )-U(M S\{i} ); S\{i} is the subset obtained by subtracting client i from combination S; U(M S\{i} ) is the utility of combination S after subtracting client i; Step 8: The server calculates the marginal contribution of each client under different combinations; then the marginal contribution of each layer is averaged to get the approximate Shapley value of client i 2. The method for estimating federated data based on influence pruning sampling as claimed in claim 1, characterized in that: The client combination is layered according to the size of the combination. The combination of layer 0 is an empty combination. The number of clients in each client combination of layer k is k, and the layer k contains The number of client combinations is the number of combinations of k clients selected from n clients.
3. The method for estimating federated data based on influence pruning sampling as claimed in claim 1, characterized in that: In step 4, the kth * In the client combination P selected in the +1 layer, all clients must appear and the total number of appearances must be the same, that is, Where I is an indicator function, which returns 1 when the condition is met, otherwise it returns 0; ∑ S∈P I[i∈S] represents the number of times client i appears in the sample set P.
4. The method for estimating federated data based on influence pruning sampling as claimed in claim 1, characterized in that: In step 6, the federated global model training method is: First, the server sends the federated global model to all clients in the kth layer, and each client uses the local dataset D i Conduct federated global model training and upload the updated federated global model back to the server; Subsequently, the server uses the classic FedAvg algorithm to perform federated learning on the federated global models uploaded by all clients to obtain a new federated global model M S , and then sent to all clients in the kth layer, repeating the above process to obtain the federated global model M S .
5. The method for estimating federated data based on influence pruning sampling as claimed in claim 1, characterized in that: In step 8, for client i, the k∈[1,k * +1] Average marginal contribution of the layer for: Among them, i∈N,k∈[1,k * +1]; U(M S∪{i} )-U(M S ) is the marginal contribution of client i to combination S, is the number of samples in the |S|th layer that does not contain client i, used to calculate the average value; Approximate Shapley value for client i for:
Citation Information
Patent Citations
Federal learning participant contribution measurement method, device, storage medium and equipment
CN113947213A
Traffic prediction model training method and device based on federated learning, and traffic prediction method and device based on federated learning
CN115580891A
Electric power consumption prediction model optimization method and system
CN118690916A
Federal learning method based on Shapril value aggregation
CN118966378A
Model training method, apparatus and system for federated learning
WO2024007132A1