A blockchain-based health data federated learning method and system
By setting accuracy thresholds and maximum training rounds on the blockchain, the blockchain verification nodes are used to select local models with high accuracy to update the global model. Incentive rules are used to encourage participants to provide data, which solves the single point of failure and data privacy issues in federated learning systems and improves the accuracy and stability of the model.
Patent Information
- Application Number
- CN202410687922.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-05-30
AI Technical Summary
Existing federated learning systems have a single point of failure risk, with the central server prone to crashing, leading to inaccurate model updates. Furthermore, they lack effective data privacy protection and reward mechanisms, affecting the accuracy and stability of model training.
We adopt a blockchain-based federated learning method for health data. We set accuracy thresholds and maximum training rounds through smart contracts, use blockchain verification nodes to select local models with high accuracy to update the global model, and encourage participants to provide data through incentive rules to achieve encrypted training and reward mechanisms.
It reduces the risk of single points of failure, protects data privacy, improves the accuracy and generalization ability of the global model, and enhances the stability of the system and the enthusiasm of the participants.
Smart Images

Figure CN118471479B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the fields of blockchain, federated learning and auxiliary diagnosis, and particularly relates to a health data federated learning method and system based on blockchain. BACKGROUND
[0002] Health data is information about an individual's health status, including but not limited to medical records, medical history, medical image data, symptom descriptions, treatment history, vital signs (such as heart rate, blood pressure), and genetic information, etc. Health data has a wide range of uses, including clinical diagnosis, treatment plan development, medical research, public health management, etc. Traditional health data analysis requires analysis and diagnosis by professionals, which requires a large amount of medical resources, and there is an unavoidable risk of misdiagnosis. Deep learning models can overcome this problem, mine information hidden in health data, and complete a large amount of health data analysis in a short time to monitor the health status of patients. However, due to concerns about patient personal health information and privacy protection, data is difficult to share, resulting in a lack of training data for deep learning models. The federated learning method based on the client-server model can allow model training in a distributed environment while protecting user privacy and data security, to some extent, solving the above problems, but there is a risk of training collapse due to server failure. Federated learning based on P2P network is another solution, where each participant can directly communicate and exchange information with other participants, reducing the risk of single point failure and improving the stability and reliability of the system, but P2P federated learning lacks a reward mechanism and places higher demands on network load, making it difficult to be widely applied.
[0003] One of the current prior arts is a federated learning system for medical data proposed in the patent "Federated learning system, method, storage medium and program product for medical data", which can more accurately adjust the weight of each site in federated learning. The system includes a server and multiple clients. The feature is that the client trains through local data and sends the evaluation results to the server, and the server adjusts the parameters of the global model according to the evaluation results received from each client. The disadvantage of this method is that updating the parameters of the global model is achieved through the central server, and this centralized operation is vulnerable to server failure. The resulting inaccurate global model update distorts all local model updates, leading to the collapse of the entire training. SUMMARY
[0004] The purpose of the present application is to overcome the shortcomings of the prior art, and a health data federated learning method and system based on blockchain are proposed. The main problem solved by the present application is how to reduce the single point failure risk in federated learning, protect the data privacy of participants, encourage more medical institutions to provide local data as training participants through an incentive mechanism, so that the global model obtained by training has higher accuracy and generalization ability.
[0005] To solve the above problems, the present application proposes a health data federated learning method based on blockchain, which comprises the following steps:
[0006] Medical institutions as federated learning participants L i Join the blockchain, initialize the global model by a trusted authority, collect independent validation sets, deploy smart contracts, set the accuracy threshold θ and the maximum number of training rounds T for ending training, set the model verification task and the incentive rule, and send the initialized global model to all participants to obtain the initialized local model;
[0007] Repeat the following two steps until the prediction accuracy P t+1 of the global model is greater than or equal to the accuracy threshold θ or the number of training rounds t+1 is greater than or equal to the maximum number of training rounds T, end the training, obtain the trained global model, and the smart contract sends it to all participants:
[0008] First, the participants train and encrypt the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters Upload them to the nodes of the blockchain;
[0009] Second, the validation nodes of the blockchain perform the model verification task on the encrypted local model, calculate the accuracy of the encrypted local model, and perform screening to retain the encrypted local model with high accuracy to obtain the retained local model. The smart contract updates the global model according to the retained local model to obtain an updated global model, distributes incentives according to the incentive rule, and sends the updated global model to all participants. Calculate the prediction accuracy P t+1 of the updated global model.
[0010] The participants input local health data into the trained global model for subsequent diagnosis.
[0011] Preferably, medical institutions as federated learning participants L iThe trusted authority initializes a global model, collects an independent validation set, deploys a smart contract, sets an accuracy threshold θ and a maximum number of training rounds T for ending training, sets a model verification task and an incentive rule, and sends the initialized global model to all participants to obtain an initialized local model, specifically:
[0012] The medical institutions register on the blockchain, join the blockchain after identity verification and authorization, and serve as participants L of federated learning i ;
[0013] According to different health data learning tasks, an independent validation set invisible to a participant is collected, a corresponding deep learning model structure is developed, and the parameters of the model are randomly initialized to obtain an independent validation set and an initialized global model.
[0014] Deploy a smart contract, set an accuracy threshold θ and a maximum number of training rounds T for ending training, set a model verification task and an incentive rule:
[0015] The smart contract sends the initialized global model to all participants to obtain an initialized local model.
[0016] Preferably, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters Upload it to the nodes of the blockchain, specifically:
[0017] The participant preprocesses the local data, including supplementing missing values for numerical and text data, adjusting the size and resolution of image data, to obtain local training data.
[0018] The initialized local model is trained using the local training data and the gradient is updated according to the following formula to obtain a trained local model:
[0019]
[0020] where, is the gradient of the loss function F with respect to the parameter w, denotes the local model parameters of the participant L i , denotes the global model parameters at the tth iteration, x i denotes the i th local training data, y i is its corresponding label; η is the learning rate, and |D| is the number of local training samples.
[0021] The trained local model is homomorphically encrypted to obtain an encrypted local model and uploaded to the nodes of the blockchain.
[0022] Preferably, the verification nodes of the blockchain perform the model verification task on the encrypted local model, calculate the accuracy of the encrypted local model, and screen to retain the encrypted local model with high accuracy, to obtain a retained local model, the smart contract updates the global model according to the retained local model to obtain an updated global model, issues an incentive according to the incentive rule, and sends the updated global model to all the participants, and calculates the prediction accuracy P of the updated global model t+1 , specifically:
[0023] The smart contract homomorphically encrypts the independent verification set to obtain an encrypted verification set, and sends it to the verification nodes of the blockchain;
[0024] The verification nodes of the blockchain use the encrypted verification set to perform the model verification task, and calculate the accuracy of the encrypted local model according to the following formula:
[0025]
[0026] Where p i represents the accuracy of the i-th encrypted local model on the independent verification set, and |M| is the sample size of the independent verification set, for judging whether the prediction label and the true label are consistent, is the prediction label calculated by the local model, y i is the true label of the independent verification set; when and y i are equal, the value of is 1, otherwise 0;
[0027] The verification nodes of the blockchain screen the encrypted local model according to the accuracy p i of the encrypted local model, retain the local model with an accuracy higher than the accuracy P t of the current global model, and obtain a retained local model;
[0028] The smart contract calculates the weight a i of the retained local model according to the following formula:
[0029]
[0030] Where P t represents the accuracy of the global model after the t-th round of training, its initial value P 0 = 0, p i and p j represent the accuracy of the i-th local model, and |L *| indicates the number of local models retained;
[0031] The smart contract is based on the weight α of the retained local model. i and the encrypted local model parameters Obtain the global model parameters after the (t+1)th training round. The calculation formula is as follows:
[0032]
[0033] The smart contract issues incentives e to the participants corresponding to the retained local model. i The calculation formula is as follows:
[0034]
[0035] Where E represents the total amount of incentives distributed to the participants in this round of training;
[0036] The smart contract verifies the node v participating in the blockchain. i Incentives k i The calculation formula is as follows:
[0037]
[0038] Where |V| represents the total number of verification nodes participating in the verification, and |m i |For verifying node v i The number of verifications completed in this round of training, K is the total amount of incentives issued to the verification nodes in this round of training;
[0039] The smart contract will store the global model parameters after the (t+1)th training round. Send to all participating parties;
[0040] Calculate the prediction accuracy P of the global model after the (t+1)th training round. t+1 The calculation formula is as follows:
[0041]
[0042] in, The predicted label of the global model in the (t+1)th iteration.
[0043] Accordingly, the present invention also provides a blockchain-based federated learning system for health data, comprising:
[0044] Initialization unit, used by medical institutions as participants in federated learning. iBy incorporating blockchain technology, a trusted authority initializes the global model, collects independent validation sets, deploys smart contracts, sets the accuracy threshold θ for ending training and the maximum number of training rounds T, sets model validation tasks and incentive rules, and sends the initialized global model to all participants to obtain the initialized local model.
[0045] Federated learning units are used to repeatedly perform the following two steps until the global model's prediction accuracy P is achieved. t+1 If the accuracy threshold θ is greater than or equal to the accuracy value, or if the training epoch t+1 is greater than or equal to the maximum training epoch T, training ends, and the trained global model is obtained. The smart contract then sends this model to all participants. The first step involves each participant using local data to train and encrypt the initialized local model, resulting in an encrypted local model and its parameters. The process involves two steps: First, the encrypted local model is uploaded to a node on the blockchain. Second, the blockchain's verification node performs a model verification task on the encrypted local model, calculates its accuracy, and filters the encrypted local models with high accuracy, resulting in a retained local model. The smart contract then updates the global model based on the retained local models, resulting in an updated global model. Incentives are distributed according to the incentive rules, and the updated global model is sent to all participants. Finally, the prediction accuracy P of the updated global model is calculated. t+1 ;
[0046] The application unit is used by participants to input local health data into the trained global model locally to assist in subsequent diagnosis.
[0047] Accordingly, the present invention also provides a computer device including a memory and a processor, wherein the memory stores a computer program and the processor executes the steps of the above-described blockchain-based health data federated learning method.
[0048] Accordingly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described blockchain-based health data federated learning method.
[0049] Implementing this invention has the following beneficial effects:
[0050] This invention proposes a blockchain-based federated learning method and system for health data. This invention reduces the risk of single points of failure in federated learning, protects the data privacy of participating parties, and encourages more medical institutions to provide local data as participants in the training process through a reward mechanism, thereby enabling the trained global model to have higher accuracy and generalization ability. Attached Figure Description
[0051] Figure 1 is a flowchart of a health data federated learning method based on a blockchain according to an embodiment of the present application;
[0052] Figure 2 is a structural diagram of a health data federated learning system based on a blockchain according to an embodiment of the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0054] Figure 1 is a flowchart of a health data federated learning method based on a blockchain according to an embodiment of the present application, as Figure 1 shown, the method comprises:
[0055] S1, a medical institution as a federated learning participant L i joins a blockchain, a trusted authority initializes a global model, collects an independent validation set, deploys a smart contract, sets an accuracy threshold θ and a maximum number of training rounds T for ending training, sets a model validation task and an incentive rule, and sends the initialized global model to all participants to obtain an initialized local model;
[0056] S2, repeat the following 2-step operation until the prediction accuracy P t+1 of the global model is greater than or equal to the accuracy threshold θ or the number of training rounds t+1 is greater than or equal to the maximum number of training rounds T, end training, obtain a trained global model, and the smart contract sends it to all participants:
[0057] S2-1, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters upload them to the nodes of the blockchain;
[0058] S2-2, the validation nodes of the blockchain perform the model validation task on the encrypted local model, calculate the accuracy of the encrypted local model, and perform screening, retain the encrypted local model with high accuracy, obtain a retained local model, the smart contract updates the global model according to the retained local model, obtains an updated global model, issues an incentive according to the incentive rule, and sends the updated global model to all participants, calculates the prediction accuracy P t+1 of the updated global model;
[0059] S3, the participant inputs the local health data into the local trained global model for assisting subsequent diagnosis.
[0060] Step S1 is specifically as follows:
[0061] S1-1, the medical institution registers on the blockchain, and after identity verification and authorization, joins the blockchain as a participant L of federated learning i ;
[0062] S1-2, according to different health data learning tasks, an independent validation set invisible to the participant is collected, a corresponding deep learning model structure is formulated, and the parameters of the model are randomly initialized to obtain an independent validation set and an initialized global model;
[0063] S1-3, deploy a smart contract, set an accuracy threshold θ and a maximum number of training rounds T for ending training, set a model validation task and an incentive rule:
[0064] S1-4, the smart contract sends the initialized global model to all participants to obtain an initialized local model.
[0065] Step S2-1 is specifically as follows:
[0066] S2-1-1, the participant pre-processes the local data, including supplementing missing values for numerical and text data, and using scaling and Lanczos interpolation method to adjust the size and resolution of the local data to a preset size and image resolution to obtain local training data;
[0067] S2-1-2, train the initialized local model using the local training data and update the gradient according to the following formula to obtain a trained local model:
[0068]
[0069] wherein, is the gradient of the loss function F with respect to the parameter w, denotes the local model parameter of the participant L i , denotes the global model parameter at the tth iteration, x i denotes the i th local training data, y i is its corresponding label; η is the learning rate, and |D| is the number of local training samples;
[0070] S2-1-3, homomorphically encrypt the trained local model to obtain an encrypted local model and upload it to the node of the blockchain.
[0071] Step S2-2, specifically as follows:
[0072] S2-2-1, the smart contract homomorphically encrypts the independent verification set to obtain an encrypted verification set and sends it to the verification node of the blockchain;
[0073] S2-2-2, the verification node of the blockchain uses the encrypted verification set to perform the model verification task, and calculates the accuracy of the encrypted local model according to the following formula:
[0074]
[0075] wherein, p i represents the accuracy of the i-th encrypted local model on the independent verification set, |M| is the number of samples of the independent verification set, for judging whether the predicted label and the real label are consistent, is the predicted label calculated by the local model, y i is the real label of the independent verification set; when and y i are equal, the value of is 1, otherwise 0;
[0076] S2-2-3, the verification node of the blockchain screens the encrypted local model according to the accuracy p i of the encrypted local model, retains the local model with an accuracy higher than the current global model accuracy P t , and obtains a retained local model;
[0077] S2-2-4, the smart contract calculates the weight a i of the retained local model according to the following formula:
[0078]
[0079] wherein, P t represents the accuracy of the global model after the t-th round of training, its initial value P 0 = 0, p i and p j represent the accuracy of the i-th local model, |L * | represents the number of retained local models;
[0080] S2-2-5, the smart contract obtains the global model parameter after the (t+1)-th round of training according to the weight a i of the retained local model and the encrypted local model parameter , and the calculation formula is as follows:
[0081]
[0082] S2-2-6, the smart contract issues an incentive e to the participant corresponding to the reserved local model i , and the calculation formula is as follows:
[0083]
[0084] Wherein, E is the total amount of incentives issued to participants in the current round of training;
[0085] S2-2-7, the smart contract issues an incentive k to the node v participating in the verification of the blockchain i i , and the calculation formula is as follows:
[0086]
[0087] Wherein, |V| is the total number of verification nodes participating in the verification, |m i | is the number of verification nodes v i , K is the total amount of incentives issued to the verification nodes in the current round of training;
[0088] S2-2-8, the smart contract sends the global model parameters after the t+1 round of training To all participants;
[0089] S2-2-9, the prediction accuracy P of the global model after the t+1 round of training is calculated t+1 , and the calculation formula is as follows:
[0090]
[0091] Wherein, The prediction label of the global model in the t+1 round of iteration.
[0092] Correspondingly, the application also provides a health data federated learning method system based on a blockchain, as shown in Figure 2 , comprising:
[0093] An initialization unit 1 for medical institutions as federated learning participants L i Join the blockchain, initialize the global model by a trusted authority, collect independent verification sets, deploy smart contracts, set the accuracy threshold θ and the maximum number of training rounds T for ending training, set the model verification task and the incentive rule, and send the initialized global model to all participants to obtain the initialized local model;
[0094] Specifically, the medical institutions are registered on the blockchain, and after identity verification and authorization, they join the blockchain as participants L of federated learning i ;
[0095] According to different health data learning tasks, an independent validation set invisible to a participant is collected, a corresponding deep learning model structure is formulated, and the parameters of the model are randomly initialized to obtain an independent validation set and an initialized global model;
[0096] The smart contract is deployed, the accuracy threshold θ and the maximum number of training rounds T for ending training are set, the model verification task and the incentive rule are set:
[0097] The smart contract sends the initialized global model to all participants to obtain the initialized local model.
[0098] The federated learning unit 2 is used to repeatedly perform the following two steps until the prediction accuracy P t+1 of the global model is greater than or equal to the accuracy threshold θ or the training round t+1 is greater than or equal to the maximum number of training rounds T, the training is ended, and the trained global model is obtained, which is sent to all participants by the smart contract: first, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters Upload it to the nodes of the blockchain; second, the verification nodes of the blockchain perform the model verification task on the encrypted local model, calculate the accuracy of the encrypted local model, and perform screening to retain the encrypted local model with high accuracy to obtain the retained local model. The smart contract updates the global model according to the retained local model to obtain an updated global model, distributes incentives according to the incentive rule, and sends the updated global model to all participants, calculates the prediction accuracy P t+1 ;
[0099] Specifically, the participant pre-processes the local data, including supplementing missing values for numerical and text data, adjusting the size and resolution of the local data for image data, to obtain local training data;
[0100] The initialized local model is trained using the local training data and the gradient is updated according to the following formula to obtain a trained local model:
[0101]
[0102] wherein, is the gradient of the loss function F with respect to the parameter w, denotes the participant Li Local model parameters, Let x represent the global model parameters at iteration t. i Let y represent the i-th local training data. i These are its corresponding labels. η is the learning rate, and |D| is the number of local training samples;
[0103] The trained local model is homomorphically encrypted to obtain an encrypted local model, which is then uploaded to a node of the blockchain.
[0104] The smart contract performs homomorphic encryption on the independent verification set to obtain an encrypted verification set, and sends it to the verification node of the blockchain.
[0105] The blockchain's verification nodes use the encrypted verification set to execute the model verification task, calculating the accuracy of the encrypted local model according to the following formula:
[0106]
[0107] Where, p i Let |M| represent the accuracy of the i-th encrypted local model on the independent validation set, where |M| is the number of samples in the independent validation set. Used to determine whether the predicted label and the true label are consistent. For the predicted label computed by the local model, y i The true labels for the independent validation set. When and y i When they are equal, The value is 1, otherwise it is 0;
[0108] The blockchain's verification nodes are based on the accuracy p of the encrypted local model. i The encrypted local models are filtered, and those with an accuracy higher than the current global model accuracy P are retained. t The local model is obtained by preserving the local model;
[0109] The smart contract calculates the weight α of the retained local model according to the following formula. i :
[0110]
[0111] Among them, P t Let P represent the global model accuracy after the t-th training round, with an initial value of P. 0 =0, p i and p j Let |L| represent the accuracy of the i-th local model. * | indicates the number of local models retained;
[0112] The smart contract obtains the reserved local model according to the weight alpha i And the encrypted local model parameters Obtain the global model parameters after the t+1th round of training The calculation formula is as follows:
[0113]
[0114] The smart contract issues an incentive e to the participant corresponding to the reserved local model i The calculation formula is as follows:
[0115]
[0116] Wherein, E is the total amount of incentives issued to participants in this round of training;
[0117] The smart contract issues an incentive k to the node v participating in verification i i The calculation formula is as follows:
[0118]
[0119] Wherein, |V| is the total number of verification nodes participating in verification, |m i | is the number of times of verification completed by the verification node v i In this round of training, K is the total amount of incentives issued to the verification node;
[0120] The smart contract sends the global model parameters after the t+1th round of training to all participants
[0121] Calculate the prediction accuracy P of the global model after the t+1th round of training t+1 The calculation formula is as follows:
[0122]
[0123] Wherein, The prediction label of the global model in the t+1th iteration.
[0124] The application unit 3 is used for inputting the local health data into the trained global model locally by the participant to obtain a diagnosis result.
[0125] Correspondingly, the application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the health data federated learning method based on the blockchain.
[0126] Correspondingly, the application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the health data federated learning method based on the blockchain.
[0127] Therefore, the application can reduce the single point failure risk in federated learning, protect the data privacy of participants, encourage more medical institutions to provide local data as training participants through the reward mechanism, so that the global model obtained by training has higher accuracy and generalization ability.
[0128] The above describes in detail the health data federated learning method and system based on the blockchain provided by the embodiments of the application. The principles and implementation manners of the application are described by applying specific examples. The above embodiment description is only used to help understand the method of the application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the idea of the application. In summary, the content of the specification should not be understood as a limitation of the application.
Claims
1. A blockchain-based health data federated learning method, characterized in that, The method comprises: Medical institutions as federated learning participants L i Join the blockchain, the trusted authority initializes the global model, collects independent verification sets, deploys smart contracts, sets the accuracy threshold θ and the maximum number of training rounds T for ending training, sets the model verification task and incentive rules, and sends the initialized global model to all participants to obtain the initialized local model; Repeat the following 2 steps until the prediction accuracy P of the global model is greater than the accuracy threshold θ or the training round number t+1 is greater than the maximum training round number T t+1 greater than or equal to the accuracy threshold θ or the training round number t+1 is greater than or equal to the maximum training round number T, end the training, obtain the trained global model, and the smart contract sends it to all the participants: In a first step, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters uploading it to the nodes of the blockchain; Second, the verification node of the blockchain performs the model verification task on the encrypted local model, calculates the accuracy of the encrypted local model, and filters to retain the encrypted local model with high accuracy, obtaining a retained local model, the smart contract updates the global model according to the retained local model, obtains an updated global model, issues an incentive according to the incentive rule, and sends the updated global model to all participants, calculates the prediction accuracy P of the updated global model t+1 , Specifically: The smart contract homomorphically encrypts the independent verification set to obtain an encrypted verification set and sends it to the verification node of the blockchain; The verification node of the blockchain uses the encrypted verification set to perform the model verification task and calculates the accuracy of the encrypted local model according to the following formula: wherein p i represents the accuracy of the i-th encrypted local model on the independent verification set, |M| is the number of samples of the independent verification set, for determining whether the predicted label and the real label are consistent, is a predicted label calculated by the local model, y i is a real label of the independent verification set; when and y i are equal, the value of 1, otherwise 0; The verification node of the blockchain retains the local model with the accuracy p i The encrypted local model is screened, and the local model with an accuracy higher than the current global model accuracy P t is retained to obtain a retained local model. The smart contract calculates the weight a of the reserved local model according to the following formula i : where P t represents the accuracy of the global model after the tth training, its initial value P 0 = 0, p i and p j represent the accuracy of the ith and jth local models, |L * | represents the number of retained local models; The smart contract determines the weight α of the reserved local model according to the global model parameter i and the encrypted local model parameter The global model parameter after the t+1th round of training is obtained The calculation formula is as follows: The smart contract issues an incentive e to the participant corresponding to the reserved local model i The calculation formula is as follows: Wherein, E is the total amount of incentives issued to participants in the current round of training; The smart contract verifies the node v participating in the blockchain i Distribute incentives k i The calculation formula is as follows: Wherein, |V| is the total number of verification nodes participating in verification, |m i | is the verification node v i The number of verifications completed in this round of training, K is the total amount of incentives issued to the verification nodes in this round of training; The smart contract will store the global model parameters after the (t+1)th training round. Send to all participating parties; calculating a prediction accuracy P of the global model after the t+1th round of training t+1 The formula is as follows: wherein, predicted label of the global model in the t+1th iteration The participants input the local health data into the trained global model for subsequent diagnosis.
2. The blockchain-based federated learning method for health data according to claim 1, wherein, The medical institution serves as a federated learning participant L i Joining the blockchain, a trusted authority initializes a global model, collects an independent validation set, deploys a smart contract, sets an accuracy threshold θ and a maximum number of training rounds T for ending training, sets a model verification task and an incentive rule, and sends the initialized global model to all participants to obtain an initialized local model, specifically: The medical institutions are registered on the blockchain, and after identity verification and authorization, they join the blockchain as participants L of federated learning i ; According to different health data learning tasks, an independent verification set invisible to a participant is collected, a corresponding deep learning model structure is formulated, and the parameters of the model are randomly initialized to obtain an independent verification set and an initialized global model; Deploy a smart contract, set the accuracy threshold θ and the maximum number of training rounds T for ending training, set the model verification task and the incentive rule: The smart contract sends the initialized global model to all participants to obtain an initialized local model. 3.The blockchain-based health data federated learning method of claim 1, wherein, The participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters Upload the same to the nodes of the blockchain, specifically: The participants preprocess the local data, including supplementing missing values for numerical and text data, adjusting the size and resolution of image data, to obtain local training data; The initialized local model is trained using the local training data and the gradient is updated according to the following formula to obtain a trained local model: wherein, is the gradient of the loss function F with respect to the parameters w, denotes the local model parameters of the participant L i denotes the global model parameters at the t-th iteration, denotes the global model parameters at the t-th iteration, i denotes the i-th local training data, i is its corresponding label; η is the learning rate, |D| is the number of local training samples; The trained local model is homomorphically encrypted to obtain an encrypted local model and uploaded to the node of the blockchain. 4.A blockchain-based health data federated learning system, characterized in that, The system comprises: An initialization unit is configured to initialize a medical institution as a federated learning participant L i Joining the blockchain, the trusted authority initializes the global model, collects the independent verification set, deploys the smart contract, sets the accuracy threshold θ and the maximum number of training rounds T for ending training, sets the model verification task and the incentive rule, and sends the initialized global model to all participants to obtain the initialized local model. Federated learning units are used to repeatedly perform the following two steps until the global model's prediction accuracy P is achieved. t+1 If the accuracy threshold θ is greater than or equal to the training epoch number, or if the training epoch number t+1 is greater than or equal to the maximum training epoch number T, training ends, and the trained global model is obtained. The smart contract then sends this model to all participating parties. In a first step, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters uploading it to a node of the blockchain; Second, the verification node of the blockchain performs the model verification task on the encrypted local model, calculates the accuracy of the encrypted local model, and filters to retain the encrypted local model with high accuracy, obtaining a retained local model, the smart contract updates the global model according to the retained local model, obtains an updated global model, issues an incentive according to the incentive rule, and sends the updated global model to all participants, calculates the prediction accuracy P of the updated global model t+1 , Specifically: The smart contract homomorphically encrypts the independent verification set to obtain an encrypted verification set and sends it to the verification node of the blockchain; The verification node of the blockchain uses the encrypted verification set to perform the model verification task and calculates the accuracy of the encrypted local model according to the following formula: wherein p i represents the accuracy of the i-th encrypted local model on the independent verification set, |M| is the number of samples of the independent verification set, for determining whether the predicted label and the real label are consistent, is a predicted label calculated by the local model, y i is a real label of the independent verification set; when and y i are equal, the value of 1, otherwise 0; the verification nodes of the blockchain according to the accuracy p of the encrypted local model i screening the encrypted local model, retaining the local model with accuracy higher than the current global model accuracy P t , to obtain the retained local model; The smart contract calculates the weight a of the reserved local model according to the following formula i : where P t represents the accuracy of the global model after the tth training, its initial value P 0 = 0, p i and p j represent the accuracy of the ith and jth local models, |L * | represents the number of retained local models; The smart contract determines the weight α of the reserved local model according to the global model parameter i and the encrypted local model parameter The global model parameter after the t+1th round of training is obtained The calculation formula is as follows: The smart contract issues an incentive e to the participant corresponding to the reserved local model i The calculation formula is as follows: Wherein, E is the total amount of incentives issued to participants in the current round of training; The smart contract verifies the nodes v participating in the blockchain i Distribute incentives k i The calculation formula is as follows: Wherein, |V| is the total number of verification nodes participating in verification, |m i | is the verification node v i The number of verifications completed in this round of training, K is the total amount of incentives issued to the verification nodes in this round of training; The smart contract will store the global model parameters after the (t+1)th training round. Send to all participating parties; calculating a prediction accuracy P of the global model after the t+1th round of training t+1 The formula is as follows: wherein, predicted label of the global model in the t+1th iteration An application unit is configured to enable the participants to input the local health data into the trained global model for subsequent diagnosis.
5. The blockchain-based health data federated learning system of claim 4, wherein, The initialized unit is used for a medical institution as a federated learning participant L i Joining the blockchain, the trusted authority initializes the global model, collects the independent verification set, deploys the smart contract, sets the accuracy threshold θ and the maximum training round T for ending training, sets the model verification task and the incentive rule, and sends the initialized global model to all participants to obtain the initialized local model, specifically: The medical institutions are registered on the blockchain, and after identity verification and authorization, they join the blockchain as participants L of federated learning i ; According to different health data learning tasks, an independent verification set invisible to a participant is collected, a corresponding deep learning model structure is formulated, and the parameters of the model are randomly initialized to obtain an independent verification set and an initialized global model; Deploy a smart contract, set the accuracy threshold θ and the maximum number of training rounds T for ending training, set the model verification task and the incentive rule: The smart contract sends the initialized global model to all participants to obtain an initialized local model.
6. The blockchain-based health data federated learning system of claim 4, wherein, In the federated learning unit, the participant trains and encrypts the initialized local model using local data to obtain an encrypted local model and encrypted local model parameters Upload it to the nodes of the blockchain, specifically: The participants preprocess the local data, including supplementing missing values for numerical and text data, adjusting the size and resolution of image data, to obtain local training data; The initialized local model is trained using the local training data and the gradient is updated according to the following formula to obtain a trained local model: in, It is the gradient of the loss function F with respect to the parameter w. Indicates participant L i Local model parameters, Let x represent the global model parameters at iteration t. i Let y represent the i-th local training data. i It is its corresponding label; η is the learning rate, and |D| is the number of local training samples; The trained local model is homomorphically encrypted to obtain an encrypted local model and uploaded to the node of the blockchain. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor executes the computer program to realize the steps of the method of any one of claims 1 to 3.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, which is executed by a processor, implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Medical big data-oriented block chain and federal learning fusion method
CN115599799A
Medical data security sharing method based on federal learning and double-alliance block chain
CN115765965A