Federal learning medical block chain data sharing method based on two-stage node selection
By employing a two-stage node selection and dynamic programming algorithm to select high-quality nodes in federated learning, and combining blockchain and consensus mechanisms, the problems of uneven node data quality and insufficient incentives are solved. This achieves an efficient node selection and incentive mechanism, improving model training performance and system security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-01
AI Technical Summary
In federated learning, uneven data quality among nodes leads to significant differences in model update quality, and the lack of effective incentive mechanisms results in insufficient node participation. How to select high-quality nodes and design reasonable incentive mechanisms under limited budget conditions has become a challenge.
A two-stage node selection mechanism is adopted, including an understanding stage and an auction stage. High-quality nodes are selected through a dynamic programming algorithm, and nodes are registered and verified on the blockchain. Combined with differential privacy protection and consensus mechanism, a contribution-based incentive mechanism is designed.
With a limited budget, select high-quality nodes to prevent malicious behavior, improve model training results, and incentivize node participation through a reward mechanism to enhance system security and transparency.
Smart Images

Figure CN121966985A_ABST
Abstract
Description
Federated Learning Healthcare Blockchain Data Sharing Method Based on Two-Phase Node Selection Technical Field
[0001] This invention belongs to the field of computer technology and relates to a federated learning method for sharing medical blockchain data based on two-stage node selection. Background Technology
[0002] With the widespread application of the Internet of Things (IoT) technology globally, people's work and lifestyles are being reshaped, driving the rapid development of smart healthcare. Internet of Medical Technology (IoMT) enables effective interaction between patients, medical personnel, and medical devices through IoT technology, generating massive amounts of medical data. Deep analysis of this medical data using artificial intelligence (AI) can support smart healthcare services such as remote health monitoring and early disease identification, thereby helping medical institutions develop more personalized treatment plans for patients. To effectively address public health challenges, it is often necessary to integrate medical data resources from multiple regions. Data from a single medical institution is often insufficient in volume and limited in dimensions, making it difficult to meet the needs of current smart healthcare applications. Promoting collaborative sharing of medical data among multiple institutions can achieve complementary and integrated data resources, thereby improving the level of service for patients. However, medical data is highly sensitive to privacy; data leaks during the sharing process can cause irreversible damage to patients' personal privacy. Currently, Internet of Things (FL) faces the following two problems in practical applications.
[0003] The first problem is that nodes possess varying amounts and qualities of local data, leading to differences in the quality of their submitted model updates. Furthermore, due to a lack of prior knowledge, the data quality and model training performance of each node are unknown before training. Therefore, selecting the highest possible quality nodes for federated learning tasks within a limited budget presents a significant challenge.
[0004] The second question is how to design a reasonable incentive mechanism that can motivate nodes to actively participate in federated learning tasks in the long term. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a federated learning medical blockchain data sharing method based on two-stage node selection, which can select high-quality nodes to participate as much as possible with limited budget, and provides triple protection for the security of the entire system in the node selection stage, aggregation stage and consensus verification stage. Finally, rewards are calculated on the performance of nodes in the system to encourage nodes to participate actively in the long term.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] A federated learning method for sharing medical blockchain data based on two-phase node selection includes the following steps:
[0008] S1: The model owner publishes the federated learning task and reward budget to the federated learning layer and uploads the initial global model to the blockchain;
[0009] S2: The data owner provides the server with their willingness to participate in the bidding and registers their information on the blockchain as a candidate node, including their ID, address, and cost. The training process is then divided into two phases: the understanding phase uses a round-robin approach to select all candidate nodes at least once, and the auction phase uses a reverse auction mechanism based on dynamic programming to select participating nodes from the candidate nodes.
[0010] S3: Participating nodes download the latest global model from the blockchain, train it using their own local dataset, add differential privacy noise, and then submit the updated model to the server. The server then aggregates the global model parameters, updates the information of all nodes, and uploads this information to the blockchain.
[0011] S4: In each round, the node with the highest contribution value is selected as the miner node. The miner node is responsible for packaging this information into a new block and broadcasting it to other nodes for PBFT consensus verification. When more than 2 / 3 of the weighted votes pass the verification, the block is put on the chain.
[0012] S5: Calculate the incentives for all nodes in this round, rewarding honest nodes with good performance and nodes that have engaged in malicious behavior during the penalty period.
[0013] Furthermore, step S1 specifically includes the following process: The system model consists of three parts: the model owner, the blockchain layer, and the federated learning layer. The model owner is also the entity that initiates the training task. It provides the initial global model parameters to the blockchain layer and provides the payment budget and reward mechanism for each round of federated learning to the federated learning layer. The blockchain layer uses its open, transparent, and tamper-proof characteristics as a medium for storing global model parameters and node information, thereby increasing the transparency and credibility of the system. The federated learning layer includes data owners, which are candidate nodes that have submitted their willingness to participate in the task, and selected participating nodes. Data owners submit their willingness to participate before the task begins and need to register their own accounts on the blockchain and pay a certain deposit. If any malicious behavior occurs during the training process, the deposit will be deducted. The account records the node's ID, address, training cost, and balance information, and generates a public-private key pair for subsequent signing and verification.
[0014] Furthermore, in step S2, the federated learning task training is divided into two stages, and the number of candidate nodes in the current task is... The candidate node set is Each round of selection From a node to a set of participating nodes Participate in mission training, among which Node selection specifically includes the following steps:
[0015] S21: Former The iterative training rounds are for understanding the phase, with different rounds selected each time. Each node participates in training to ensure... Each candidate node participates in at least one round of iterative training; its training quality value is calculated based on its performance during training and its contribution to the model. ;
[0016] S22: Auction phase from the... The round begins with the node quality calculated based on the understanding phase. and the training cost of node submission A reverse auction model is established, and a dynamic programming algorithm is used to select nodes for auction.
[0017] Further, in step S21, the system aggregates the local model parameters uploaded by all participating nodes using the FedAvg algorithm, calculates its accuracy on the test set, and denotes it as... The local models uploaded by all participating nodes except the current node are aggregated using FegAvg and their accuracy is calculated on the test set, denoted as . Participating nodes In the The training quality of the model during rounds of iterative training can be expressed as:
[0018]
[0019] Then, to avoid negative values for the mass, Perform normalization:
[0020]
[0021] After normalization, perform a linear compression and translation process:
[0022]
[0023] In the formula, It is the compression translation factor, when hour, , hour, ;
[0024] After each round of training, the historical quality values of nodes that were not selected remain unchanged, while the historical quality values of nodes selected for training need to be updated. The historical quality of the wheel:
[0025]
[0026] In the formula, Represents a node In the The number of times a participant is selected to participate in training, including the rotation time and previous training rounds.
[0027] Furthermore, in step S22, the model owner acts as the buyer and provides a cost budget for selecting nodes in each round. Candidate nodes act as sellers, submitting to the system the costs they incur for participating in local training. Buyers use a dynamic programming algorithm in each round based on the seller's historical quality. and cost Choose There are 10 participating nodes, ensuring that the total cost does not exceed the cost budget. At the same time, it maximizes the quality of the selected nodes; decision variables are introduced. To represent nodes Whether a node is selected can be modeled as a problem involving the selection of candidate nodes. Inside Select from nodes From a node to a set of participating nodes The set of participating nodes in each round of the task. The sum of the costs of each node in the process cannot exceed the cost budget. This problem can be represented as The objective function and constraints are as follows:
[0028]
[0029] First, define the state. In the past Among the nodes, exactly select There are 10 nodes, and the total cost does not exceed 1000. The maximum total mass that can be obtained at that time, of which Simultaneously, the following initial conditions must be met:
[0030]
[0031] In the formula, This means that when there are no nodes to choose from, you can only select 0 nodes. In this case, the quality will be 0 regardless of the budget. This means that it is impossible to select a number of nodes greater than 0 when no nodes are available;
[0032] Then construct the first The state transition equations for the nodes are as follows:
[0033]
[0034] In the formula, Represents a node Not selected, current status The optimal solution is equal to the previous one. Select from the nodes Number of nodes and cost not exceeding The optimal solution; Represents a node Selected, current status The optimal solution is equal to the previous one. Select from the nodes Number of nodes and cost not exceeding The optimal solution plus nodes Historical quality The final decision is to take the maximum of the two options, meaning the optimal solution for the current state is always derived from the optimal solutions of smaller subproblems; the ultimate goal is to make... The largest, that is, after watching all After selecting candidate nodes, the following was chosen. Number of participating nodes and total cost not exceeding The maximum mass under the condition, where This maximum value is within the budget. Internal energy can be selected The globally optimal total mass that each node can achieve;
[0035] Finally, backtrack to find the selected node and add it to the set of participating nodes. The backtracking process is as follows: from the final state... In the beginning, among them It makes The largest Reverse traversal from Go to 1, check Is it equal to If they are not equal, it means the nodes If selected, it will be added to the set of participating nodes. ,renew and , Then continue backtracking upwards until... or So far; this has led to finding the cost of choosing a finite number of nodes. The optimal set of participating nodes .
[0036] Furthermore, in step S3, the set of participating nodes... The nodes in the blockchain obtain the latest global model parameters for the current iteration round. Local model training is performed, and the DP-SGD algorithm is used to obtain local model parameters in a differential privacy-preserving manner. Because the participating nodes selected through the dynamic programming auction mechanism are the highest quality nodes possible within a limited budget, it cannot be ruled out that some nodes may be of lower quality. Furthermore, the quality considered during the selection process is based on the node's historical quality in previous iterations and cannot fully represent its performance in the current iteration. Additionally, in the preceding... In each round of iterative training, all nodes are included in the training to prevent malicious nodes from launching poison attacks during this period. A quality threshold is set when the model is aggregated. Only participating nodes exceeding this threshold are included in an aggregate set. Only nodes within this set are eligible to participate in the global model aggregation. The aggregation method not only considers the size of each node's local dataset in the aggregation set but also comprehensively considers the node's quality in the current training round, incorporating a Softmax function to amplify differences and increase the aggregation weight of high-quality nodes. Simultaneously, it avoids nodes with good historical performance but poor performance in the current round from receiving high weights, taking into account the node's quality in the current round during the aggregation process. The formula for global model parameter aggregation is as follows:
[0037]
[0038] In the formula, Represents a node In the Quality in round training; Represents a node The size of the local dataset;
[0039] The Softmax function is represented as follows:
[0040]
[0041] Furthermore, in step S4, all candidate nodes are initially registered on the blockchain, and only nodes selected to participate in training in each round are eligible to enter the consensus node pool to verify new blocks; although only aggregate sets... The nodes in the dataset participated in the aggregation of global model parameters, but in this round, all participating nodes used their own datasets for local training and were not included in the aggregate set. Nodes still have the right to participate in consensus verification; a node's contribution in a given round is primarily determined by its training quality and the amount of data it has collected in that round. In the The contribution values in each iteration are:
[0042]
[0043] In the formula, Represents a node The quality of the current round; Represents a node Local data size;
[0044] The contribution-based consensus process involves the following steps: After each training round, the server sends the aggregated global model parameters and node quality to the blockchain as transactions; the node with the highest contribution value is selected as a miner node, which packages this transaction information into a new block and leaves its signature; the miner node broadcasts the new block to other consensus nodes; all consensus nodes verify whether the signature in the new block belongs to the miner node, rejecting it if it doesn't, and verifying whether the global model parameters in the block are from the set... The nodes in the consensus mechanism aggregate and calculate according to the formula, and if the result is correct, it is accepted. A weighted voting mechanism is used, where each consensus node's vote weight is its contribution value. When a new block receives more than 2 / 3 of the total weighted votes, it is considered a valid block and is added to the blockchain after confirmation. The correctness of a node's response is determined by comparing the final result of the new block's addition with the node's response. Nodes that respond incorrectly are penalized as follows:
[0045]
[0046] In the formula, This is a penalty for nodes that make incorrect responses; the penalty is deducted from the node's account balance. When the node's balance is 0, it will no longer be allowed to participate in federated learning tasks.
[0047] Furthermore, in step S5, a deposit penalty is introduced into the incentive calculation. At the beginning of the task, nodes pay a certain deposit upon registration as the basic balance of the node account, which is only refunded after the task is completed. If malicious behavior occurs during the task, a certain amount of the deposit will be deducted as a penalty for malicious nodes. The Median Absolute Deviation (MAD) method is used to identify malicious nodes. First, the absolute deviation of each node's quality in this round from the median is calculated:
[0048]
[0049] In the formula, Represents a node In the Quality in round training; Indicates the first The median quality of all participating nodes in the round;
[0050] Then, the median of these absolute deviations is used to obtain the MAD:
[0051]
[0052] Then set the threshold:
[0053]
[0054] In the formula, It is a threshold adjustment factor, and nodes whose quality is less than this threshold are considered malicious nodes;
[0055] Penalty on margin deposit:
[0056]
[0057] In the formula, It is the margin penalty coefficient;
[0058] The reward for each node, provided it is at least greater than the cost, is allocated based on the proportion of quality, with the remaining budget being the difference between the budget and the sum of the costs of all participating nodes. The rewards for participating nodes in this phase are as follows:
[0059]
[0060] The reward budget for the auction phase needs to meet the following requirements. The rewards for this stage are divided into basic rewards and aggregate rewards; the sum of the costs of all selected nodes will not exceed the cost budget. The remaining budget is based on the historical quality when the node was selected. The proportion is used to appropriately incentivize nodes to participate in training; as long as they are selected to participate in training and do not engage in malicious behavior during the subsequent process, their earnings are guaranteed to be positive; the reward for this stage is:
[0061]
[0062] Aggregate rewards, on the other hand, incentivize successful entry into the aggregate set. The additional rewards for nodes that participate in global model parameter aggregation are:
[0063]
[0064] In the formula, It refers to the quality of this round at the node;
[0065] The rewards for each auction phase node are:
[0066]
[0067] The utility gain of participating nodes is:
[0068]
[0069] The beneficial effects of this invention are as follows:
[0070] 1) This invention proposes a two-stage node selection mechanism and designs a reverse auction mechanism based on dynamic programming algorithm in the auction stage. Under the condition of limited cost budget, high-quality nodes are selected to participate as much as possible, and malicious nodes are initially filtered.
[0071] 2) This invention designs a consensus mechanism based on proof of contribution, which uses the actual contribution of each node to the global model as its voting weight to participate in block verification, thereby significantly weakening the impact of malicious nodes on the consensus result. At the same time, it combines contribution to dynamically calculate node income, giving higher rewards to honest and high-quality participants and implementing income penalties for nodes with malicious behavior, so as to incentivize nodes to actively participate in the long term.
[0072] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0073] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:
[0074] Figure 1 illustrates the working process of the federated learning medical blockchain data sharing method based on two-stage node selection according to the present invention.
[0075] Figure 2 shows the system configuration of the federated learning medical blockchain data sharing method based on two-stage node selection according to the present invention. Detailed Implementation
[0076] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0077] Please refer to Figures 1 and 2. This invention provides a federated learning method for sharing medical blockchain data based on two-stage node selection. As shown in Figure 1, this method mainly includes the following steps:
[0078] Step 1: The model owner publishes the federated learning task and reward budget to the federated learning layer and uploads the initial global model to the blockchain;
[0079] Step 2: The data owner provides the server with their willingness to participate in the bidding and registers their information on the blockchain as a candidate node, including their ID, address, and cost. The training process is then divided into two phases: the understanding phase uses a round-robin approach to select all candidate nodes at least once, and the auction phase uses a reverse auction mechanism based on dynamic programming to select participating nodes from the candidate nodes.
[0080] Step 3: Participating nodes download the latest global model from the blockchain, train it using their own local datasets, add differential privacy noise, and then submit the updated model to the server. The server then aggregates the global model parameters, updates the information of all nodes, and uploads this information to the blockchain.
[0081] Step 4: In each round, the node with the highest contribution value is selected as the miner node. The miner node is responsible for packaging this information into a new block and broadcasting it to other nodes for PBFT consensus verification. When more than 2 / 3 of the weighted votes pass the verification, the block is put on the chain.
[0082] Step 5: Calculate the incentives for all nodes in this round, rewarding honest nodes that perform well and nodes that engage in malicious behavior during the penalty period.
[0083] Figure 2 is a system configuration diagram of the present invention, which mainly consists of four parts: the model owner, the blockchain layer, and the federated learning layer. The following description, in conjunction with the accompanying drawings, includes the following steps:
[0084] Step 1: The model owner publishes the federated learning task and reward budget to the federated learning layer and uploads the initial global model to the blockchain;
[0085] Step 2: Data owners interested in the task training provide the server with their willingness to participate in the bidding and register their information on the blockchain as candidate nodes, including their ID, address, cost, etc.
[0086] Step 3: The server uses a reverse auction mechanism based on dynamic programming to select participating nodes from the candidate nodes;
[0087] Step 4: Participating nodes download the latest global model from the blockchain, train it using their own local dataset, add differential privacy noise, and then submit the updated model to the server;
[0088] Step 5: The server aggregates global model parameters and updates the information of all nodes, and uploads this information to the blockchain;
[0089] Step 6: Miner nodes package this information into a new block and broadcast it to other nodes for PBFT consensus verification. The block is added to the blockchain when more than 2 / 3 of the weighted votes pass the verification.
[0090] Optionally, step 3) in Figure 2 is the node selection process, which includes a two-stage node selection mechanism and an auction mechanism based on dynamic programming, specifically:
[0091] Algorithm 4-1: Two-Phase Node Selection Input: Number of candidate nodes Number of nodes selected in each round Node comprehensive cost Auction stage node selection cost budget Understand the training phases and rounds Current training round Global training rounds Output: Set of participating nodes .1: for do2: if then3: From the candidate node set Select in order From a node to a set of participating nodes 4: Calculate the training quality of participating nodes in this round. 5: Update the historical training quality of participating nodes. 6: else 7: Construct a reverse auction model, with the task publisher as the buyer and candidate nodes as sellers; 8: Execute Algorithm 4-2, a dynamic programming auction mechanism, to select the set of participating nodes. ;9: end if 10: end for 11: return . surface
[0092] Algorithm 4-2: Dynamic Programming Auction Mechanism Input: The first... Historical quality of each node , No. The total cost of submissions by each node Number of candidate nodes The number of participating nodes to be selected in each round Cost budget for each round of node selection Output: Set of participating nodes .1: Define the state 2: Set initial conditions ;3: if the first option is not selected Then4: ;5: else6: ;7: end if8: State transition equation 9: if then10: Node Selected and included in the set of participating nodes. ;11: end if 12: return . surface
[0093] Optionally, steps 5) and 6) in Figure 2 represent the global model aggregation, consensus verification, and incentive calculation process, specifically as follows:
[0094] Participating node set The nodes in the blockchain obtain the latest global model parameters for the current iteration round. Local model training is performed, and the DP-SGD algorithm is used to obtain local model parameters in a differential privacy-preserving manner. .
[0095] Because the participating nodes selected through the dynamic programming auction mechanism are chosen as high-quality nodes as possible within a limited budget, it cannot be ruled out that some nodes may be of lower quality. Furthermore, the quality considered during the selection process is based on the node's historical quality in previous iterations, and cannot fully represent the node's potential performance in the current iteration. Meanwhile, in the previous... In each round of iterative training, all nodes are included in the training. To prevent malicious nodes from launching poison attacks during this period, a quality threshold is set during model aggregation. Only participating nodes exceeding this threshold are included in an aggregate set. Only nodes within this set are eligible to participate in the global model aggregation. The aggregation method considers not only the size of each node's local dataset within the aggregation set, but also the quality of that node in the current training round, incorporating a Softmax function to amplify differences and increase the aggregation weights of high-quality nodes. Simultaneously, to prevent nodes with good historical performance but poor performance in the current round from receiving high weights, the quality of the node in the current round is considered during the aggregation process. The formula for global model parameter aggregation is as follows:
[0096]
[0097] In the formula, Represents a node In the Quality in round training; Represents a node The size of the local dataset.
[0098] The Softmax function is represented as follows:
[0099]
[0100] Initially, all candidate nodes registered on the blockchain, and in each round, only nodes selected for training were eligible to enter the consensus node pool to verify new blocks. Although only aggregate sets... The nodes in the dataset participated in the aggregation of global model parameters, but since all participating nodes used their own datasets for local training in this round, they were not included in the aggregation set. Nodes in the process still have the right to participate in consensus verification. A node's contribution in a given round is primarily determined by its training quality and the amount of data it has collected in that round. In the The contribution values in each iteration are:
[0101]
[0102] In the formula, Represents a node The quality of the current round; Represents a node Local data volume.
[0103] The contribution-based consensus process involves the following steps:
[0104] Step 1: After each round of training, the server sends the aggregated global model parameters, node quality, and other information to the blockchain in the form of transactions.
[0105] Step 2: Select the node with the highest contribution value as the miner node, package the transaction information into a new block, and leave its own signature;
[0106] Step 3: The miner node broadcasts the new block to other consensus nodes;
[0107] Step 4: All consensus nodes verify whether the signature in the new block belongs to a miner node. If not, reject the block; if it does, verify whether the global model parameters in the block are from a set. If the nodes in the calculation are aggregated according to the formula and the result is correct, then it is accepted.
[0108] Step 5: A weighted voting mechanism is adopted, where the voting weight of each consensus node is its contribution value. When a new block receives more than 2 / 3 of the total weight of votes, it is considered a valid block. After confirmation, the new block is added to the blockchain.
[0109] Step 6: Determine whether the node's response was correct based on the final result of adding the new block and the node's response. Nodes that respond incorrectly should be penalized as follows:
[0110]
[0111] In the formula, This is a penalty for nodes that make incorrect responses; the penalty is deducted from the node's account balance. When the node's balance is 0, it will no longer be allowed to participate in federated learning tasks.
[0112] A deposit penalty is introduced into the incentive calculation. At the start of the task, nodes pay a certain amount of deposit upon registration as the base balance of their node accounts, which is refunded only after the task is completed. If malicious behavior occurs during the task, a certain amount of the deposit will be deducted as a penalty for malicious nodes. To identify malicious nodes, the Median Absolute Deviation (MAD) method is used. First, the absolute deviation of each node's quality in this round from the median is calculated:
[0113]
[0114] In the formula, Represents a node In the Quality in round training; Indicates the first The median quality of all participating nodes in the round.
[0115] Then, the median of these absolute deviations is used to obtain the MAD:
[0116]
[0117] Then set the threshold:
[0118]
[0119] In the formula, It is a threshold adjustment factor, and nodes whose quality is less than this threshold are considered malicious nodes.
[0120] Penalty on margin deposit:
[0121]
[0122] In the formula, It is the margin penalty coefficient.
[0123] The incentive calculation for nodes needs to be divided into two phases: an understanding phase and an auction phase. Since the understanding phase uses a round-robin approach to select all nodes at least once, aiming to assess the quality of candidate nodes, the reward for this phase must cover its cost to attract node participation. Each node's reward, while ensuring it is at least greater than its cost, is then allocated the remaining budget based on its quality proportion, i.e., the difference between the budget and the sum of the costs of all participating nodes. Therefore, the reward for participating nodes in this phase is as follows:
[0124]
[0125] To attract nodes to participate in training for subsequent auction phases, the reward budget for that phase needs to meet certain requirements. The rewards for this stage are divided into basic rewards and aggregate rewards. The sum of the costs of all selected nodes will not exceed the cost budget. Therefore, the remaining budget is based on the historical quality when the node was selected. The percentage is used to appropriately incentivize nodes to participate in training. In other words, as long as a node is selected to participate in training and does not engage in malicious behavior subsequently, its reward is guaranteed to be positive. The reward for this stage is:
[0126]
[0127] Aggregate rewards, on the other hand, incentivize successful entry into the aggregate set. The additional rewards for nodes that participate in global model parameter aggregation are:
[0128]
[0129] In the formula, It is the quality of this round of nodes.
[0130] The rewards for each node in the auction phase are as follows:
[0131]
[0132] The utility gain of participating nodes is:
[0133]
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A federated learning method for sharing medical blockchain data based on two-phase node selection, characterized in that: This method Includes the following steps: S1: The model owner publishes the federated learning task and reward budget to the federated learning layer and uploads the initial global model to the blockchain; S2: The data owner provides the server with their willingness to participate in the bidding and registers their information on the blockchain as a candidate node, including their ID, address, and cost. The training process is then divided into two phases: the understanding phase uses a round-robin approach to select all candidate nodes at least once, and the auction phase uses a reverse auction mechanism based on dynamic programming to select participating nodes from the candidate nodes. S3: Participating nodes download the latest global model from the blockchain, train it using their local dataset, add differential privacy noise, and then submit the updated model to the server. The server then aggregates the global model parameters, updates the information of all nodes, and uploads this information to the blockchain. S4: In each round, the node with the highest contribution value is selected as the miner node. The miner node is responsible for packaging this information into a new block and broadcasting it to other nodes for PBFT consensus verification. When more than 2 / 3 of the weighted votes pass the verification, the block is put on the chain. S5: Calculate the incentives for all nodes in this round, reward honest nodes with good performance and punish nodes with malicious behavior during the period.
2. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 1, characterized in that, The specific process of step S1 includes: the system model consists of three parts: the model owner, the blockchain layer, and the federated learning layer; the model owner is also the entity that initiates the training task, providing the initial global model parameters to the blockchain layer and the payment budget and reward mechanism for each round of federated learning to the federated learning layer; the blockchain layer uses its open, transparent, and tamper-proof characteristics as a medium for storing global model parameters and node information, thereby increasing the transparency and credibility of the system; the federated learning layer includes data owners, which are candidate nodes that have submitted their willingness to participate in the task, and selected participating nodes. Data owners submit their willingness to participate before the task begins, and all need to register their own accounts on the blockchain and pay a certain deposit. If any malicious behavior occurs during the training process, the deposit will be deducted. The account records the node's ID, address, training cost, and balance information, and generates a public-private key pair for subsequent signing and verification.
3. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 1, characterized in that, In step S2, the federated learning task training is divided into two stages, and the number of candidate nodes in the current task is... The candidate node set is Each round of selection From a node to a set of participating nodes Participate in mission training, among which Node selection specifically includes the following steps: S21: Previous The iterative training rounds are for understanding the phase, with different rounds selected each time. Each node participates in training to ensure... Each candidate node participates in at least one round of iterative training; its training quality value is calculated based on its performance during training and its contribution to the model. S22: Auction phase from the... The round begins with the node quality calculated based on the understanding phase. and the training cost of node submission A reverse auction model is established, and a dynamic programming algorithm is used to select nodes for auction.
4. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 3, characterized in that, In step S21, the system aggregates the local model parameters uploaded by all participating nodes using the FedAvg algorithm, calculates the accuracy on the test set, and denotes it as . The local models uploaded by all participating nodes except the current node are aggregated using FegAvg and their accuracy is calculated on the test set, denoted as . Participating nodes In the The training quality of the model during rounds of iterative training can be expressed as: Then, to avoid negative values for the mass, Perform normalization: After normalization, perform a linear compression and translation process: In the formula, It is the compression translation factor, when hour, , hour, ; After each round of training, the historical quality values of nodes that were not selected remain unchanged, while the historical quality values of nodes selected for training need to be updated. The historical quality of the wheel: In the formula, Represents a node In the The number of times a participant is selected to participate in training, including the rotation time and previous training rounds.
5. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 3, characterized in that, In step S22, the model owner acts as the buyer and provides a cost budget for selecting nodes in each round. ; Candidate nodes act as sellers, submitting to the system the costs they incur for participating in local training. Buyers use a dynamic programming algorithm in each round based on the seller's historical quality. and cost Choose There are 10 participating nodes, ensuring that the total cost does not exceed the cost budget. At the same time, this maximizes the quality of the selected nodes; Introducing decision variables To represent nodes Whether a node is selected can be modeled as a problem involving the selection of candidate nodes. Inside Select from nodes From a node to a set of participating nodes The set of participating nodes in each round of the task. The sum of the costs of each node in the process cannot exceed the cost budget. This problem can be represented as The objective function and constraints are as follows: First, define the state. In the past Among the nodes, exactly select There are 10 nodes, and the total cost does not exceed 1000. The maximum total mass that can be obtained at that time, of which Simultaneously, the following initial conditions must be met: In the formula, This means that when there are no nodes to choose from, you can only select 0 nodes. In this case, the quality will be 0 regardless of the budget. This indicates that it's impossible to select a number of nodes greater than 0 when no nodes are available; then, the first... The state transition equations for the nodes are as follows: In the formula, Represents a node Not selected, current status The optimal solution is equal to the previous one. Select from the nodes Number of nodes and cost not exceeding The optimal solution; Represents a node Selected, current status The optimal solution is equal to the previous one. Select from the nodes Number of nodes and cost not exceeding The optimal solution plus nodes Historical quality The final decision is to take the maximum of the two options, meaning the optimal solution for the current state is always derived from the optimal solutions of smaller subproblems; the ultimate goal is to make... The largest, that is, after watching all After selecting candidate nodes, the following was chosen. Number of participating nodes and total cost not exceeding The maximum mass under the condition, where ; This maximum value is within the budget. Internal energy can be selected The goal is to determine the globally optimal total quality achievable by each node; finally, backtrack to identify the selected node and add it to the set of participating nodes. The backtracking process is as follows: from the final state... In the beginning, among them It makes The largest Reverse traversal from Go to 1, check Is it equal to If they are not equal, it means the nodes If selected, it will be added to the set of participating nodes. ,renew and , Then continue backtracking upwards until... or So far; this has led to finding the cost of choosing a finite number of nodes. The optimal set of participating nodes 。 6. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 1, characterized in that, The specific process of step S3 includes: setting up a set of participating nodes. The nodes in the blockchain obtain the latest global model parameters for the current iteration round. Local model training is performed, and the DP-SGD algorithm is used to obtain local model parameters in a differential privacy-preserving manner. Because the participating nodes selected through the dynamic programming auction mechanism are the highest quality nodes possible within a limited budget, it cannot be ruled out that some nodes may be of lower quality. Furthermore, the quality considered during the selection process is based on the node's historical quality in previous iterations and cannot fully represent its performance in the current iteration. Additionally, in the preceding... In each round of iterative training, all nodes are included in the training to prevent malicious nodes from launching poison attacks during this period. A quality threshold is set when the model is aggregated. Only participating nodes exceeding this threshold are included in an aggregate set. Only nodes within this set are eligible to participate in the global model aggregation. The aggregation method not only considers the size of each node's local dataset in the aggregation set but also comprehensively considers the node's quality in the current training round, incorporating a Softmax function to amplify differences and increase the aggregation weight of high-quality nodes. Simultaneously, it avoids nodes with good historical performance but poor performance in the current round from receiving high weights, taking into account the node's quality in the current round during the aggregation process. The formula for global model parameter aggregation is as follows: In the formula, Represents a node In the Quality in round training; Represents a node The size of the local dataset; the Softmax function is expressed as follows: 。 7. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 1, characterized in that, The specific process of step S4 includes: initially, all candidate nodes are registered on the blockchain, and in each round, only the nodes selected to participate in training are eligible to enter the consensus node pool to verify new blocks; although only aggregate sets The nodes in the dataset participated in the aggregation of global model parameters, but in this round, all participating nodes used their own datasets for local training and were not included in the aggregate set. Nodes still have the right to participate in consensus verification; a node's contribution in a given round is primarily determined by its training quality and the amount of data it has collected in that round. In the The contribution values in each iteration are: In the formula, Represents a node The quality of the current round; Represents a node The local data volume size; the contribution-based consensus process includes the following steps: After each round of training, the server sends the aggregated global model parameters and node quality to the blockchain as transactions; the node with the highest contribution value is selected as the miner node, which packages the transaction information into a new block and leaves its own signature; the miner node broadcasts the new block to other consensus nodes; all consensus nodes verify whether the signature in the new block belongs to the miner node, and if not, reject it; if it does, they verify whether the global model parameters in the block are from the set. The nodes in the consensus mechanism aggregate and calculate according to the formula, and if the result is correct, it is accepted. A weighted voting mechanism is used, where each consensus node's vote weight is its contribution value. When a new block receives more than 2 / 3 of the total weighted votes, it is considered a valid block and is added to the blockchain after confirmation. The correctness of a node's response is determined by comparing the final result of the new block's addition with the node's response. Nodes that respond incorrectly are penalized as follows: In the formula, This is a penalty for nodes that make incorrect responses; the penalty is deducted from the node's account balance. When the node's balance is 0, it will no longer be allowed to participate in federated learning tasks.
8. The federated learning medical blockchain data sharing method based on two-stage node selection according to claim 1, characterized in that, The specific process of step S5 includes: introducing a deposit penalty in the incentive calculation; at the beginning of the task, nodes pay a certain deposit as the basic balance of the node account when registering, which is only refunded after the task is completed; if malicious behavior occurs during the task, a certain amount of deposit will be deducted to punish malicious nodes; the median absolute deviation method (MAD) is used to identify malicious nodes, first calculating the absolute deviation of each node's quality in this round from the median: In the formula, Represents a node In the Quality in round training; Indicates the first The median of the quality of all participating nodes is used; then the median of these absolute deviations is taken to obtain the MAD: Then set the threshold: In the formula, This is a threshold adjustment factor; nodes with quality below this threshold are considered malicious and subject to margin penalties. In the formula, This is the margin penalty coefficient; the reward for each node, provided it is guaranteed to be at least greater than the cost, is allocated based on the proportion of quality, i.e., the difference between the budget and the sum of the costs of all participating nodes. The rewards for participating nodes at this stage are: The reward budget for the auction phase needs to meet the following requirements. The rewards for this stage are divided into basic rewards and aggregate rewards; the sum of the costs of all selected nodes will not exceed the cost budget. The remaining budget is based on the historical quality when the node was selected. The proportion is used to appropriately incentivize nodes to participate in training; as long as they are selected to participate in training and do not engage in malicious behavior during the subsequent process, their earnings are guaranteed to be positive; the reward for this stage is: Aggregate rewards, on the other hand, incentivize successful entry into the aggregate set. The additional rewards for nodes that participate in global model parameter aggregation are: In the formula, The quality of the node in this round; the reward for the node during the auction phase is: The utility gain of participating nodes is: 。