Federal learning method and system
Through the smart contract and VCG auction mechanism combined with Starkberg game, a two-layer incentive architecture was designed, and the federated learning method of Byzantine fault-tolerant main chain and stochastic gradient descent was used to solve the problems of insufficient incentive mechanisms and privacy protection in multi-party collaboration, and improve the efficiency and security of model training.
Patent Information
- Application Number
- CN202510542419.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, the lack of effective incentive mechanisms in the federated learning of multi-party collaborative parties has led to insufficient enthusiasm for the contribution of data and computing resources in large and small institutions. At the same time, the pressure of privacy protection during data sharing is high, affecting the efficiency and security of model training.
The training data volume and privacy protection strategy are calculated using smart contracts and VCG auction mechanisms, the compensation scheme is determined in combination with the Starkberg game, and the model is trained through Byzantine fault-tolerant main chain and stochastic gradient descent, and the two-layer consensus algorithm is used to ensure the reliability of data privacy and model interaction.
It realizes fairness and rationality of incentive distribution, improves the efficiency and security of multi-party collaboration, ensures the protection of data privacy, and maximizes the overall welfare of the alliance.
Smart Images

Figure CN120450082A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated learning technology, and in particular to a federated learning method and system. Background Art
[0002] As the number of participants continues to grow, ensuring the timeliness and security of model interactions in complex environments, as well as maintaining participant motivation, have become core issues that urgently need to be addressed in multi-party credit risk assessment. In practical applications, differences in participant size significantly impact the efficiency and final results of model training. Large institutions typically possess abundant historical data and powerful computing resources, but due to cost-benefit considerations, they are often reluctant to contribute data and computing power for free or at low cost. In contrast, smaller institutions, with relatively limited data volumes and computing power, struggle to independently complete large-scale model training tasks. Smaller institutions are more sensitive to data privacy and therefore face greater pressure to protect privacy during data sharing. Therefore, designing appropriate incentive mechanisms for training clusters of varying sizes to encourage them to actively contribute data and computing resources has become a key issue in achieving efficient collaborative model training.
[0003] Existing technologies face problems with timeliness, security, and insufficient incentive mechanism design in multi-party collaboration. It is not easy to design reasonable incentive mechanisms to encourage them to actively contribute data and computing resources, which makes it difficult to train efficient collaborative models. It also cannot solve the problem of greater privacy protection pressure faced by data during sharing.
[0004] Therefore, how to provide a federated learning method and system is an urgent problem to be solved. Summary of the Invention
[0005] The embodiments of the present invention provide a federated learning method and system to address the problem in the existing technology that it is difficult to design a reasonable incentive mechanism to encourage them to actively contribute data and computing resources, thereby making it difficult to train efficient collaborative models, and cannot solve the problem that data faces greater privacy protection pressure during the sharing process.
[0006] To provide a basic understanding of some aspects of the disclosed embodiments, the following is a brief summary. This summary is not intended to be a comprehensive review, identify key or essential elements, or delineate the scope of these embodiments. Its sole purpose is to present some concepts in a simplified form as a prelude to the detailed description that follows.
[0007] According to a first aspect of an embodiment of the present invention, a federated learning method is provided.
[0008] In one embodiment, a federated learning method includes:
[0009] Based on the cluster information reported by each leader, the smart contract is used to calculate the training data volume and privacy protection strategy of each cluster model. The auction mechanism is used to determine the compensation plan. The Stackelberg game is used to determine the training data volume and unit price of the producer, and the initial model parameters are distributed.
[0010] The global model is downloaded from the Byzantine Fault Tolerant main chain and distributed to each participant for local training. The gradient value is calculated through stochastic gradient descent. The differential privacy budget is allocated based on the reputation score and Laplace noise is added. The cluster model is uploaded to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm.
[0011] Based on the cluster model uploaded to the Byzantine Fault Tolerant main chain, a global model is aggregated and iteratively updated until the cluster model reaches the preset termination condition, and finally the reward settlement is completed according to the number of tokens in the participant's account.
[0012] In one embodiment, based on the cluster information reported by each leader, a smart contract is used to calculate the training data volume and privacy protection strategy for each cluster model. An auction mechanism is implemented to determine the compensation plan. The Stackelberg game is used to determine the training data volume and unit price for producers. The initial model parameters are distributed, including:
[0013] Each cluster leader reports its own cluster information to the smart contract, including data volume, expected privacy protection, maximum model valuation coefficient, and minimum cost coefficient;
[0014] Based on the reported cluster information, the smart contract is used to maximize the benefits of the cluster model, calculate the amount of training data and privacy protection level of each cluster model, and form a privacy protection acceptance strategy;
[0015] Based on the amount of training data and the acceptance strategy for privacy protection, the compensation scheme of the auction mechanism is calculated using smart contracts;
[0016] The auction mechanism is divided into differential privacy budget auction and training data auction. The differential privacy budget auction is used to minimize privacy loss, while the training data auction is used to maximize the benefits of federated model training.
[0017] The leader and the producer conduct a Stackelberg game by comparing the unit price of training data volume and computing resources. After reaching a Nash equilibrium, the producer's data volume and unit price are determined, and the initial model parameters and data are transmitted to the producer locally.
[0018] In one embodiment, minimizing privacy loss through a differential privacy budget auction includes:
[0019] Participants report their privacy budget requirements and privacy payment amounts to the smart contract, and calculate the average privacy protection level of the alliance;
[0020] Based on the reported privacy budget, the cost function of adding differential privacy noise to the local model is calculated. Then, based on the privacy budget and the cost function of adding noise, the privacy utility function is calculated.
[0021] In the auction mechanism, the optimal privacy budget receiving strategy is determined based on the privacy budget and privacy payment amount of the participants;
[0022] If the privacy utility function is greater than the preset value, the smart contract successfully executes the noise addition task, collects the privacy computing payment, and enters the next stage of the auction mechanism for the amount of training data; otherwise, the smart contract adjusts the receiving strategy and adjusts the privacy payment or privacy budget according to the needs of the participants, and re-auctions.
[0023] In one embodiment, utilizing a training data auction to maximize federated model training revenue includes:
[0024] Collect the estimated data volume and privacy loss information within the cluster and construct a comprehensive cost function;
[0025] Determine the valuation coefficient, upper limit of data volume, and lower limit of training cost of the alliance model, and construct the profit function;
[0026] The auction mechanism is divided into differential privacy budget auction and training data auction. The differential privacy budget auction problem is defined and the optimal privacy budget acceptance strategy is solved. At the same time, the training data auction problem is defined and the optimal acceptance strategy is solved to maximize the total social surplus.
[0027] Based on the optimal acceptance strategy, the compensation plan is calculated using smart contracts to determine the leader's compensation payment;
[0028] If the fund pool cannot pay compensation, the valuation coefficient will be adjusted and the compensation payment plan will be recalculated. If compensation can be paid, the smart contract will receive tokens;
[0029] The leader confirms the final training data volume and privacy budget and conducts the Stackelberg game within the cluster.
[0030] In one embodiment, the differential privacy budget auction problem is defined and the formula for solving the optimal privacy budget acceptance strategy is as follows:
[0031]
[0032] In the formula, α and β are adjustment factors, represents the best receiving strategy for privacy protection requirements, represents the average privacy protection level of the entire alliance; Indicates the privacy protection level a is a non-negative real number used for adjustment.
[0033] In one embodiment, the formula for defining the training data auction problem and solving the optimal acceptance strategy is:
[0034]
[0035] Where η D * represents the optimal receiving strategy; S * (·) represents the total social surplus; a i represents the valuation coefficient; ψ i represents the cost coefficient; Indicates the lower limit of the cost coefficient; D i Indicates the amount of data; Indicates the upper limit of the data volume; n indicates the number of leaders; Expressed as a profit function; represents the optimal receiving strategy for each cluster’s data volume; σ(·) represents the model performance; is the comprehensive cost function, where ψ i is the comprehensive coefficient of training cost that takes into account the training cost of nodes in the cluster and the differential privacy noise loss.
[0036] In one embodiment, the formula for determining the leader's compensation payment is:
[0037]
[0038] represents the model performance after adding differential privacy noise, Indicates the cost obtained based on the reported cost coefficient, It's about A monotonically increasing function of Denote the privacy budget as The noise injection operation cost required, η D * represents the optimal receiving strategy for the training data auction, and T represents the transpose of the matrix.
[0039] In one embodiment, the leader and the producer conduct a Stackelberg game based on the training data unit price and computing resources to determine the producer's data volume and data unit price, and transmit the initial model parameters and data to the producer locally, including:
[0040] The leader calculates the initial unit price based on the producer’s data volume and total payment amount;
[0041] The producer determines the amount of training data by maximizing the utility function and based on the relationship between the unit price of data and the amount of data;
[0042] When the amount of training data is insufficient, the leader increases the unit price of low-cost producers to encourage data contribution; when data is excessive, the leader reduces the unit price of high-cost producers;
[0043] When the Nash equilibrium of the Stackelberg game is reached, the producer's data volume and data unit price are determined, and the initial model parameters and data are transmitted to the producer's local area.
[0044] In one embodiment, the utility function is formulated as follows:
[0045]
[0046] Where U v,i represents the utility function of the i-th leader; T represents the transpose of the matrix; q j Indicates that the producer P j Unit price paid; d j Represents producer P j The amount of data; g represents; C v,i represents the comprehensive cost function; σ(·) represents the performance of the alliance model; d j Represents producer p j The amount of data, q j Indicates that the producer p j The unit price paid. Leader v i Total payment amount Equivalent to comprehensive cost q j The initial unit price is
[0047] In one embodiment, the global model is downloaded from the Byzantine Fault Tolerant main chain and distributed to each participant for local training. The gradient value is calculated by stochastic gradient descent, the differential privacy budget is allocated in combination with the reputation score, and Laplace noise is added. The cluster model is uploaded to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm, including:
[0048] The cluster leader obtains the latest global model from the Byzantine Fault Tolerant main chain and distributes it to all participants in the cluster, ensuring that each participant synchronously updates the local model and prepares for local training;
[0049] Each participant uses the local dataset for training, calculates the loss function of the local dataset, and uses the stochastic gradient descent method to calculate the gradient value of the local model;
[0050] Based on the participant's reputation score, the differential privacy budget is reasonably allocated, and Laplace noise is added to the gradient of each participant's local training model to ensure data privacy;
[0051] Participants upload their local models to the cluster sub-chain through the consensus algorithm to form a cluster model, and the leader uploads the formed cluster model to the Byzantine fault-tolerant main chain using the Byzantine fault-tolerant mechanism.
[0052] According to a second aspect of an embodiment of the present invention, a federated learning system is provided.
[0053] In one embodiment, the federated learning system includes:
[0054] The multi-party computing and smart contract optimization module is used to calculate the training data volume and privacy protection strategy of each cluster model based on the relevant information reported by each leader's own cluster using smart contracts, implement an auction mechanism to determine the compensation plan, and determine the training data volume and unit price of producers through the Stackelberg game to complete the distribution of initial model parameters;
[0055] The federated learning and privacy protection mechanism module uses the Byzantine Fault Tolerant main chain to download the global model and distribute it to each participant for local training. It calculates the gradient value through stochastic gradient descent, allocates the differential privacy budget based on the reputation score and adds Laplace noise, and uploads the cluster model to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm.
[0056] The global model aggregation and incentive settlement module is used to aggregate and generate a global model based on the cluster model uploaded to the Byzantine Fault Tolerant main chain and iteratively update it until the cluster model reaches the preset termination condition, and finally complete the reward settlement based on the number of tokens in the participant account.
[0057] According to a third aspect of an embodiment of the present invention, a computer device is provided.
[0058] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0059] According to a fourth aspect of embodiments of the present invention, a computer-readable storage medium is provided.
[0060] In one embodiment, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0061] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0062] 1. This invention targets federated learning scenarios involving multi-party cluster collaboration. It constructs a two-layer consensus blockchain structure using "PBFT + FB-Raft," enhancing the credibility of cross-node collaboration and ensuring data integrity and the reliability of model parameter interactions. Furthermore, it designs a two-layer incentive architecture of "VCG auction + Stackelberg game" to ensure the fairness and rationality of incentive distribution, achieve optimal configuration of training strategies, and maximize the overall welfare of the alliance, providing users with an efficient, secure, and reliable federated learning solution.
[0063] 2. The present invention uses the PBFT main chain for the interaction and storage of auction information and global model parameters between leaders. This main chain ensures communication and collaboration between leaders through efficient and secure mechanisms, and provides trust support for global transactions. In addition, the FB-Raft cluster blockchain is used to manage game information, computing resource allocation, and interaction and storage of local model parameters between producers within the cluster, ensuring the effective flow of information within the cluster and providing reliable guarantees for multi-party cooperation. At the same time, the smart contract serves as the trusted third party of the model and acts as the auctioneer to ensure fairness and compliance of all parties in the transaction. In addition, the smart contract is responsible for submitting global model aggregation requests to the cloud server to ensure the transparency and traceability of the training process.
[0064] 3. This invention can effectively enhance the robustness and stability of collaborative training, reasonably balance the distribution of interests between large and small institutions, thereby improving the enthusiasm and collaboration efficiency of multi-party participation and maximizing alliance benefits. It can then be applied to most multi-party collaborative federated learning with wider applicability.
[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0067] Figure 1 is a flowchart of a federated learning method according to an exemplary embodiment;
[0068] Figure 2 is a principle block diagram of a federated learning system according to an exemplary embodiment;
[0069] Figure 3 is a structural diagram of a computer device according to an exemplary embodiment;
[0070] Figure 4A two-tier consensus and incentive model architecture and its workflow are shown according to an exemplary embodiment;
[0071] Figure 5 The figure is a model interaction flow chart of a two-layer consensus architecture according to an exemplary embodiment. DETAILED DESCRIPTION
[0072] The following description and accompanying drawings sufficiently illustrate the specific embodiments herein to enable those skilled in the art to practice them. Portions and features of some embodiments may be included in or substituted for portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims, including all available equivalents thereof. Herein, the terms "first," "second," and the like are used solely to distinguish one element from another and do not require or imply any actual relationship or order between these elements. In practice, the first element can also be referred to as the second element, and vice versa. Furthermore, the terms "comprise," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a structure, device, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such structure, device, or apparatus. Without further limitation, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the structure, device, or apparatus comprising the element. The various embodiments herein are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Similar or identical parts between the various embodiments can be referenced to each other.
[0073] The terms "longitudinal", "transverse", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like used herein to indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are intended only to facilitate the description of this document and simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the present invention. In the description herein, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, they can be mechanical or electrical connections, or they can be internal connections between two elements, they can be directly connected, or they can be indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms can be understood according to the specific circumstances.
[0074] As used herein, unless otherwise specified, the term "plurality" means two or more.
[0075] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.
[0076] In this article, the term "and / or" is used to describe the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0077] It should be understood that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0078] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software so that the processor can call and execute the operations corresponding to the above modules.
[0079] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.
[0080] Figure 1 An embodiment of the federated learning method of the present invention is shown.
[0081] In this optional embodiment, the federated learning method includes:
[0082] In step S101, based on the cluster information reported by each cluster leader, the amount of training data and privacy protection strategy for each cluster model are calculated using smart contracts and the VCG auction mechanism. A compensation plan is determined, and the unit price that the leader needs to pay to the producer and the amount of training data required by the producer are determined through the Stackelberg game, completing the distribution of the initial model parameters.
[0083] Step S102: Use the Byzantine Fault Tolerant main chain to download the global model and distribute it to each participant for local training. Calculate the gradient value through stochastic gradient descent, upload the cluster model to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm, and add Laplace noise of the differential privacy strategy determined by the VCG auction to each cluster model through a smart contract.
[0084] Step S103: Based on the cluster model uploaded to the PBFT main chain, a global model is generated and iteratively updated until the cluster model reaches the preset termination condition, and finally the reward settlement is completed according to the number of tokens in the participant account.
[0085] In this optional embodiment, based on the relevant information of its own cluster reported by each leader, the amount of training data and privacy protection strategy of each cluster model are calculated using a smart contract, an auction mechanism (i.e., VCG auction) is executed to determine the compensation plan, and the amount of training data and unit price of the producer are determined through the Stackelberg game. When the initial model parameters are issued, each cluster leader can report its own cluster information to the smart contract, including the amount of data, expected privacy protection, the maximum value of the model valuation coefficient, and the minimum value of the cost coefficient; based on the reported cluster information, the cluster model benefits are maximized through the smart contract, and the cluster model is calculated. The amount of training data and the level of privacy protection of the model are determined to form a privacy protection acceptance strategy; based on the amount of training data and the privacy protection acceptance strategy, the compensation plan of the auction mechanism is calculated using smart contracts; the auction mechanism is divided into a differential privacy budget auction and a training data volume auction, and the differential privacy budget auction is used to minimize privacy loss, while the training data volume auction is used to maximize the training benefits of the alliance model; the leader and the producer conduct a Stackelberg game based on the unit price of training data volume and computing resources. After reaching a Nash equilibrium, the producer's data volume and unit price of data volume are determined, and the initial model parameters and data are transmitted to the producer locally.
[0086] It should be explained that in the preparation phase, the federated learning training strategy is determined. The leaders of the clusters report the relevant information of their own clusters, including the amount of data, the expected privacy protection, the maximum value of the model valuation coefficient and the minimum value of the cost coefficient. The smart contract maximizes the total benefits of the model based on the information uploaded by each leader, and calculates the acceptance strategy of the amount of data used for training each cluster model and the privacy protection level. in, Represents the acceptance strategy of data volume and privacy protection level respectively, leader v i The maximum amount of training data and privacy protection level of the cluster are (T represents the transpose of the matrix, the accepted strategy is a 2-row n-column matrix, v i The smart contract calculates the compensation scheme for the VCG auction. Conduct VCG auctions. To maximize model training benefits and minimize privacy losses within the alliance, the VCG auction mechanism is divided into: differential privacy budget auctions and training data auctions.
[0087] In this optional embodiment, when minimizing privacy loss through a differential privacy budget auction, participants can report their privacy budget requirements and privacy payment amounts to the smart contract, and calculate the average privacy protection level of the alliance; based on the reported privacy budget, a cost function for adding differential privacy noise to the local model is calculated, and based on the privacy budget and the cost function of adding noise, a privacy utility function is calculated; in the auction mechanism, the optimal privacy budget reception strategy is determined based on the participant's privacy budget and privacy payment amount; if the privacy utility function is greater than the preset value, the smart contract successfully executes the noise addition task, collects the privacy computing payment, and enters the next stage of the auction mechanism for the amount of training data; otherwise, the smart contract adjusts the reception strategy and adjusts the privacy payment or privacy budget according to the participant's needs, and re-auctions.
[0088] It should be explained that participants report privacy budget requirements Payment amount with privacy The benefits of the privacy budget to the alliance are as follows:
[0089]
[0090] Among them, α and β are adjustment factors that control the overall scale of benefits; represents the average privacy protection level of the entire alliance. The cost function of the smart contract adding differential privacy noise to the local model is expressed as:
[0091]
[0092] in, represents the privacy protection level, a is a non-negative real number used for adjustment, and γ is the estimated unit privacy protection level computational cost required for the smart contract to add noise to the model in a federated learning task; the privacy utility function of the smart contract is expressed as:
[0093]
[0094] The goal of the VCG auction in this phase is to determine the optimal privacy budget acceptance strategy to maximize the smart contract's privacy computing payment. The formula for the optimal privacy budget acceptance strategy is:
[0095]
[0096] In the formula, α and β are adjustment factors, represents the best receiving strategy for privacy protection requirements, represents the average privacy protection level of the entire alliance; Indicates the privacy protection level a is a non-negative real number used for adjustment.
[0097] When UE > 0, that is, the smart contract can successfully execute the noise-adding task. The smart contract collects the privacy computing payment from the participants and enters the next stage of the VCG training data volume auction; otherwise, the smart contract adjusts the receiving strategy, and the participants can also adjust the privacy payment or privacy budget and conduct the auction again. The set of privacy budgets of each participant can be expressed as:
[0098]
[0099] In this optional embodiment, when maximizing the training revenue of the coalition model by using the training data volume auction, the estimated data volume and privacy loss information within the cluster can be collected to construct a comprehensive cost function; determine the valuation coefficient, data volume upper limit, and lower limit of the training cost of the coalition model, and construct a revenue function; divide the auction mechanism into differential privacy budget auction and training data volume auction, define the differential privacy budget auction problem and solve the optimal privacy budget acceptance strategy. At the same time, define the training data volume auction problem and solve the optimal acceptance strategy to maximize the total social surplus; based on the optimal acceptance strategy, use the smart contract to calculate the compensation plan and determine the compensation payment of the leader; if the fund pool cannot pay the compensation, adjust the valuation coefficient and recalculate the compensation payment plan. If the compensation can be paid, the smart contract receives the tokens; the leader confirms the final training data volume and privacy budget and conducts a Stackelberg game within the cluster.
[0100] It should be noted that considering the scenario of information symmetry, the leader collects the estimated data volume and privacy loss information within the cluster, and the comprehensive cost function is expressed as where ψ i is the comprehensive training cost coefficient considering the training costs of the nodes within the cluster and the differential privacy noise-adding loss; the leader V i determines the valuation coefficient a i of the model, the upper limit i of the data volume D ψ i the lower limit of the cost coefficient The revenue function can be expressed as:
[0101]
[0102] where σ(·) represents the model performance, quantified by the model accuracy. In this invention, the sigmoid function is used to represent the impact of noise addition on the model accuracy, and a(0 < a < 1) is used to control the growth rate; to pursue the maximization of social welfare, the auction problem is defined as:
[0103]
[0104] In the formula, η D * [[ID=四十一]]表示最优接收策略;S* (·) represents the total social surplus; a i represents the valuation coefficient; ψ i represents the cost coefficient; Indicates the lower limit of the cost coefficient; D i Indicates the amount of data; Indicates the upper limit of data volume; represents the comprehensive cost function; n represents the number of leaders.
[0105] That is, to solve the optimal receiving strategy η D * , so that the total utility of the entire alliance is maximized, where S * (·) represents the total social surplus, which is the sum of the revenue minus the cost of the entire federation. After determining the optimal strategy, the smart contract will calculate the compensation plan O D =[o1,o2,…o n ]. Leader v i The compensation payment can be expressed as:
[0106]
[0107] Where, represents the compensation payment of leader i; S / (·) represents the total social surplus; represents the model performance after adding differential privacy noise, and T represents the transpose of the matrix. Indicates the cost obtained based on the reported cost coefficient, It's about A monotonically increasing function of . Denote the privacy budget as The cost of the noise injection operation required.
[0108] In this optional embodiment, when the leader and the producer conduct a Stackelberg game through the unit price of training data volume and computing resources to determine the producer's data volume and the unit price of data volume, and transmit the initial model parameters and data to the producer locally, the leader can calculate the initial unit price based on the producer's data volume and the total payment amount; the producer determines the producer's training data volume by maximizing the utility function and based on the relationship between the unit price of data volume and the data volume; when the training data volume is insufficient, the leader increases the unit price of low-cost producers to encourage data contribution; when there is a surplus of data, the leader reduces the unit price of high-cost producers; when the Nash equilibrium of the Stackelberg game is reached, the producer's data volume and the unit price of data volume are determined, and the initial model parameters and data are transmitted to the producer locally.
[0109] It should be explained that if the alliance's capital pool has no surplus, Then adjust the valuation coefficient and recalculate the compensation payment plan O. The smart contract issues or receives tokens, and the leader confirms the maximum training volume and privacy budget of the current federated learning task Then the Stackelberg game is carried out within its cluster. If there is still a surplus in the fund pool after the auction is completed, the final result will be distributed according to the contribution of each model in the cluster. The final profit can be distributed according to the contribution of each model in the cluster (such as accuracy, loss function, and completion time). The leaders and producers will play the Stackelberg game based on the unit price of training data volume and computing resources. (This game, that is, step 1.5.1 first calculates the payment unit price of the optimal utility, and then step 1.5.2 calculates the optimal data volume to maximize the utility, and repeats it until the constraints such as data volume and utility are met, and an equilibrium solution is obtained) After reaching the Nash equilibrium point, the leader v i Determine the amount of training data for the producer Price per data volume And transfer the initial model parameters and data to the producer locally; leader v i The utility function can be further expressed as:
[0110]
[0111] Where, represents the utility function of the i-th leader; T represents the transpose of the matrix; d j Represents producer p j The amount of data, q j Indicates that the producer p j The unit price paid. Leader v i Total payment amount Equivalent to comprehensive cost q j The initial unit price is
[0112] For leaders v i Producer p in the cluster j , whose goal is to maximize utility by To determine the amount of training data. The production game problem is defined as:
[0113]
[0114] in, Represents producer p j Two cost coefficients. Performing first-order and second-order derivative operations on them, we get the maximum utility:
[0115]
[0116] Considering the total data volume constraint Need to q j The value of is adjusted to achieve the optimal allocation of resources when the total payment amount is fixed. When the total amount of data is insufficient, producers with relatively low costs should be encouraged to contribute more data; when the amount of data is excessive, the data output of producers with higher production costs should be reduced. i In addition, the following constraints need to be met:
[0117]
[0118] Therefore, when the amount of data is insufficient, the unit price q of some producers with lower production costs can be increased. j To increase its data contribution; when the total payment exceeds the limit, the unit price q of some producers with higher production costs should be reduced j The adjustment function is defined as:
[0119]
[0120] Where k is the adjustment factor.
[0121] Finally, the optimal payment solution can be obtained The corresponding optimal production plan is:
[0122]
[0123] In this optional embodiment, when the global model is downloaded from the Byzantine fault-tolerant main chain and distributed to each participant for local training, the gradient value is calculated by stochastic gradient descent, the differential privacy budget is allocated in combination with the reputation score and Laplace noise is added, and the cluster model is uploaded to the Byzantine fault-tolerant main chain using a two-layer consensus algorithm, the latest global model can be obtained from the Byzantine fault-tolerant main chain through the cluster leader and distributed to all participants in the cluster to ensure that each participant synchronously updates the local model and prepares for local training; each participant uses the local data set for training, calculates the loss function of the local data set, and uses stochastic gradient descent to calculate the gradient value of the local model; based on the participant's reputation score, the differential privacy budget is reasonably allocated, and Laplace noise is added to the gradient of each participant's local training model to ensure data privacy; the participants upload the local model to the cluster subchain through the consensus algorithm (i.e., the FB-Raft algorithm) to form a cluster model, and the leader uploads the formed cluster model to the Byzantine fault-tolerant main chain using the Byzantine fault tolerance mechanism (i.e., the PBFT algorithm).
[0124] It needs to be explained that, Figure 4-Figure 5 As shown in Figure 2, the cluster leader downloads the latest global model from the PBFT main chain and distributes it to each participant in the cluster. Each participant downloads the latest global model The system sets the participant's differential privacy budget based on their reputation score and adds Laplace noise to the gradient of their local training model. Participants upload their local models to the blockchain using the "FB-Raft + PBFT" two-layer consensus algorithm. Participants first upload their local models to the cluster sub-chain using the FB-Raft algorithm, and the cluster leader then uploads them to the global consortium chain using the PBFT algorithm. The participant with the highest reputation score in the cluster is elected as the leader, responsible for log replication and model parameter synchronization, and achieving fast consistency within the cluster based on the FB-Raft consensus mechanism. The leader aggregates the participants' local models to form a cluster model and prepares for inter-cluster synchronization while ensuring data privacy. Parameter interaction between clusters is achieved through the PBFT consensus mechanism. After each cluster completes internal aggregation, the leader uploads the cluster model to the PBFT main chain, which integrates the models submitted by all clusters through consensus verification to ultimately form a global model. Cluster model synchronization and aggregation phase: After completing local training within the cluster, participants upload the cluster model to the main chain, and then aggregate the models within the cluster to generate a global model. During the iteration process, the cluster model is continuously updated and aggregated with the global model until the model converges or the maximum number of training rounds or time is reached. Finally, rewards are settled based on the number of tokens held in the participant's account.
[0125] Specifically, the clusters include cluster 1, cluster 2, cluster 3, cluster 4, and so on.
[0126] Specifically, Raft is a distributed consensus algorithm designed to simplify understanding and implementation while providing the same reliability as Paxos. It ensures that nodes in a distributed system reach consensus on data changes through three core mechanisms: leader election, log replication, and safety.
[0127] It's important to clarify that a consortium blockchain is a type of blockchain technology, a network jointly managed by multiple organizations or institutions. Unlike public and private blockchains, consortium blockchains offer the decentralization and trustworthiness of public blockchains, combined with the efficiency and controllability of private blockchains, making them widely accepted and used.
[0128] Figure 2 An embodiment of the federated learning system of the present invention is shown.
[0129] In this optional embodiment, the federated learning system includes:
[0130] The multi-party computing and smart contract optimization module 201 is used to calculate the training data volume and privacy protection strategy of each cluster model based on the relevant information reported by each leader's own cluster using smart contracts, implement an auction mechanism to determine the compensation plan, and determine the training data volume and unit price of the producer through the Stackelberg game to complete the distribution of initial model parameters;
[0131] The federated learning and privacy protection mechanism module 202 is used to download the global model from the Byzantine fault-tolerant main chain and distribute it to each participant for local training. The module calculates the gradient value through stochastic gradient descent, allocates the differential privacy budget based on the reputation score and adds Laplace noise, and uploads the cluster model to the Byzantine fault-tolerant main chain using a two-layer consensus algorithm.
[0132] The global model aggregation and incentive settlement module 203 is used to aggregate and generate a global model based on the cluster model uploaded to the Byzantine fault-tolerant main chain and iteratively update it until the cluster model reaches the preset termination condition, and finally complete the reward settlement according to the number of tokens in the participant account.
[0133] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment are implemented.
[0134] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0135] In addition, the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.
[0136] In addition, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0137] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0138] The present invention is not limited to the structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A federated learning method, characterized in that: include: Based on the cluster information reported by each leader, the smart contract is used to calculate the training data volume and privacy protection strategy of each cluster model. The auction mechanism is implemented to determine the compensation plan. The Stackelberg game is used to determine the training data volume and unit price of the producer, and the initial model parameters are distributed. The global model is downloaded from the Byzantine Fault Tolerant main chain and distributed to each participant for local training. The gradient value is calculated through stochastic gradient descent. The differential privacy budget is allocated based on the reputation score and Laplace noise is added. The cluster model is uploaded to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm. Based on the cluster model uploaded to the Byzantine Fault Tolerant main chain, a global model is generated and iteratively updated until the cluster model reaches the preset termination condition, and finally the reward settlement is completed according to the number of tokens in the participant's account.
2. The federated learning method according to claim 1, characterized in that: Based on the cluster information reported by each leader, the smart contract is used to calculate the training data volume and privacy protection strategy of each cluster model, the auction mechanism is implemented to determine the compensation plan, and the training data volume and unit price of the producer are determined through the Stackelberg game. The initial model parameters are issued, including: Each cluster leader reports its own cluster information to the smart contract, including data volume, expected privacy protection, maximum model valuation coefficient, and minimum cost coefficient; Based on the reported cluster information, the smart contract is used to maximize the benefits of the cluster model, calculate the amount of training data and privacy protection level of each cluster model, and form a privacy protection acceptance strategy; Based on the amount of training data and the acceptance strategy for privacy protection, the compensation scheme of the auction mechanism is calculated using smart contracts; The auction mechanism is divided into differential privacy budget auction and training data auction. The differential privacy budget auction is used to minimize privacy loss, while the training data auction is used to maximize the benefits of federated model training. The leader and the producer conduct a Stackelberg game by comparing the unit price of training data volume and computing resources. After reaching a Nash equilibrium, the producer's data volume and unit price are determined, and the initial model parameters and data are transmitted to the producer locally.
3. The federated learning method according to claim 2, characterized in that: The method of minimizing privacy loss through differential privacy budget auction includes: Participants report their privacy budget requirements and privacy payment amounts to the smart contract, and calculate the average privacy protection level of the alliance; Based on the reported privacy budget, the cost function of adding differential privacy noise to the local model is calculated. Then, based on the privacy budget and the cost function of adding noise, the privacy utility function is calculated. In the auction mechanism, the optimal privacy budget receiving strategy is determined based on the privacy budget and privacy payment amount of the participants; If the privacy utility function is greater than the preset value, the smart contract successfully executes the noise addition task, collects the privacy computing payment, and enters the next stage of the auction mechanism for the amount of training data; otherwise, the smart contract adjusts the receiving strategy and adjusts the privacy payment or privacy budget according to the needs of the participants, and re-auctions.
4. The federated learning method according to claim 2, wherein: The method of utilizing the training data auction to maximize the benefits of alliance model training includes: Collect the estimated data volume and privacy loss information within the cluster and construct a comprehensive cost function; Determine the valuation coefficient, upper limit of data volume, and lower limit of training cost of the alliance model, and construct the profit function; The auction mechanism is divided into differential privacy budget auction and training data auction. The differential privacy budget auction problem is defined and the optimal privacy budget acceptance strategy is solved. At the same time, the training data auction problem is defined and the optimal acceptance strategy is solved to maximize the total social surplus. Based on the optimal acceptance strategy, the compensation plan is calculated using smart contracts to determine the leader's compensation payment; If the fund pool cannot pay compensation, the valuation coefficient will be adjusted and the compensation payment plan will be recalculated. If compensation can be paid, the smart contract will receive tokens; The leader confirms the final training data volume and privacy budget and conducts the Stackelberg game within the cluster.
5. The federated learning method according to claim 4, characterized in that: The formula for defining the differential privacy budget auction problem and solving the optimal privacy budget acceptance strategy is: In the formula, α and β are adjustment factors, represents the best receiving strategy for privacy protection requirements, represents the average privacy protection level of the entire alliance; Indicates the privacy protection level a is a non-negative real number used for adjustment.
6. The federated learning method according to claim 4, characterized in that: The formula for defining the training data auction problem and solving the optimal acceptance strategy is: Where η D * represents the optimal receiving strategy; S * (·) represents the total social surplus; a i represents the valuation coefficient; ψ i represents the cost coefficient; Indicates the lower limit of the cost coefficient; D i Indicates the amount of data; Indicates the upper limit of the data volume; n indicates the number of leaders; Expressed as a profit function; represents the optimal receiving strategy for each cluster’s data volume; σ(·) represents the model performance; is the comprehensive cost function, where ψ i is the comprehensive coefficient of training cost that takes into account the training cost of nodes in the cluster and the differential privacy noise loss.
7. The federated learning method according to claim 4, characterized in that: The formula for determining the leader's compensation payment is: represents the model performance after adding differential privacy noise, Indicates the cost obtained based on the reported cost coefficient, It's about A monotonically increasing function of Denote the privacy budget as The noise injection operation cost required, η D * represents the optimal receiving strategy for the training data auction, and T represents the transpose of the matrix.
8. The federated learning method according to claim 2, wherein: The leader and the producer conduct a Stackelberg game based on the unit price of training data volume and computing resources to determine the producer's data volume and unit price, and transmit the initial model parameters and data to the producer's local area, including: The leader calculates the initial unit price based on the producer’s data volume and total payment amount; The producer determines the amount of training data by maximizing the utility function and based on the relationship between the unit price of data and the amount of data; When the amount of training data is insufficient, the leader increases the unit price of low-cost producers to encourage data contribution; when data is excessive, the leader reduces the unit price of high-cost producers; When the Nash equilibrium of the Stackelberg game is reached, the producer's data volume and unit price are determined, and the initial model parameters and data are transmitted to the producer's local area; The formula of the utility function is: Where U v,i represents the utility function of the i-th leader; T represents the transpose of the matrix; q j Indicates that the producer P j Unit price paid; d j Represents producer P j The amount of data; g represents; C v,i represents the comprehensive cost function; σ(·) represents the performance of the alliance model; d j Represents producer p j The amount of data, q j Indicates that the producer p j The unit price paid. Leader v i Total payment amount Equivalent to comprehensive cost q j The initial unit price is 9. The federated learning method according to claim 1, wherein: The method of using the Byzantine Fault Tolerant main chain to download the global model and distribute it to each participant for local training, calculating the gradient value through stochastic gradient descent, allocating the differential privacy budget based on the reputation score and adding Laplace noise, and uploading the cluster model to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm includes: The cluster leader obtains the latest global model from the Byzantine Fault Tolerant main chain and distributes it to all participants in the cluster, ensuring that each participant synchronously updates the local model and prepares for local training; Each participant uses the local dataset for training, calculates the loss function of the local dataset, and uses the stochastic gradient descent method to calculate the gradient value of the local model; Based on the participant's reputation score, the differential privacy budget is reasonably allocated, and Laplace noise is added to the gradient of each participant's local training model to ensure data privacy; Participants upload their local models to the cluster sub-chain through the consensus algorithm to form a cluster model, and the leader uploads the formed cluster model to the Byzantine fault-tolerant main chain using the Byzantine fault-tolerant mechanism.
10. A federated learning system, characterized in that: include: The multi-party computing and smart contract optimization module is used to calculate the training data volume and privacy protection strategy of each cluster model based on the relevant information reported by each leader's own cluster using smart contracts, implement an auction mechanism to determine the compensation plan, and determine the training data volume and unit price of producers through the Stackelberg game to complete the distribution of initial model parameters; The federated learning and privacy protection mechanism module uses the Byzantine Fault Tolerant main chain to download the global model and distribute it to each participant for local training. It calculates the gradient value through stochastic gradient descent, allocates the differential privacy budget based on the reputation score and adds Laplace noise, and uploads the cluster model to the Byzantine Fault Tolerant main chain using a two-layer consensus algorithm. The global model aggregation and incentive settlement module is used to aggregate and generate a global model based on the cluster model uploaded to the Byzantine Fault Tolerant main chain and iteratively update it until the cluster model reaches the preset termination condition, and finally complete the reward settlement based on the number of tokens in the participant account.