Training method, device and alliance chain of medical model based on alliance chain
By adopting alliance chain technology and federated learning in medical model training, medical data sharing and authenticity, malicious nodes and trust problems are solved, and safe and reliable medical model training is achieved.
Patent Information
- Application Number
- CN202111284979.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-11-01
AI Technical Summary
When multiple medical institutions jointly conduct medical model training, there are problems with medical data sharing, difficulty in ensuring data authenticity, malicious nodes exist, and centralized trust.
By building a network based on alliance chains, using blockchain technology consensus mechanism, federated learning, threshold signature and homomorphic encryption and other technologies, off-chain storage and trusted privacy sharing of medical data can be realized, ensuring data authenticity and preventing malicious node behavior.
It effectively solves the problems of medical data sharing and authenticity, prevents the behavior of malicious nodes, and solves the trust problem through decentralized aggregation, improving the security and reliability of medical model training.
Smart Images

Figure CN114186204B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and specifically to a training method, device and alliance chain for a medical model based on an alliance chain. Background Art
[0002] In the process of medical data sharing, medical institutions at all levels are unwilling to share medical data for reasons such as user privacy protection and commercial considerations, resulting in serious medical data island problems. At the same time, it is difficult for medical institutions at all levels to ensure that the parameters shared by other medical institutions are true, and it is difficult for medical institutions at all levels to ensure that other medical institutions do not do evil in the process of collaborative training. Finally, it is difficult for medical institutions at all levels to trust a certain node to perform centralized training tasks. Therefore, there are many problems in the process of multiple institutions jointly training medical models, such as the difficulty of sharing medical data; the authenticity of medical data; the problem of malicious nodes in the medical model training process; the problem of centralized trust in the medical model training process, etc. Summary of the invention
[0003] To solve the above problems, the embodiments of the present application provide a training method, device and alliance chain for a medical model based on an alliance chain to overcome or partially overcome the above problems.
[0004] In a first aspect, a training method for a medical model based on an alliance chain is provided, wherein the alliance chain includes a plurality of training nodes, and the method includes:
[0005] The alliance chain allocates identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0006] The alliance chain uses the block height of the alliance chain as a seed, generates a threshold random number, and broadcasts it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0007] Each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcasts the encrypted model parameters to the aggregation node;
[0008] The aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters and the aggregation signature generated according to the key pair of each training node; and writes the obtained aggregation parameters and the aggregation signature into the smart contract of the alliance chain to broadcast to each training node;
[0009] Each training node verifies the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and verifies the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0010] Optionally, in the above method, each training node trains the medical model based on local medical data in multiple rounds;
[0011] During each round of training, each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, until each training node obtains the aggregation parameters from the smart contract of the alliance chain, and updates the parameters of the local medical model according to the aggregation parameters.
[0012] Optionally, in the above method, when starting a new round of training or training of a new medical model, the alliance chain also controls each training node to select a new aggregation node, and verifies the identity of the new training node based on its key pair, random number, and identity certificate.
[0013] Optionally, in the above method, the aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters, including:
[0014] Determine a test medical model according to the above model parameters of a training node;
[0015] Based on the test medical model, predict the test data set to obtain the test accuracy;
[0016] If the obtained test accuracy is less than the preset accuracy threshold, the model parameters uploaded by the training node are discarded;
[0017] If the obtained test accuracy is greater than or equal to the preset accuracy threshold, the model parameters uploaded by the training node are aggregated to obtain aggregated parameters.
[0018] Optionally, in the above method, the key pair includes a threshold signature;
[0019] The aggregate signature generated based on the key pair of each training node includes:
[0020] The threshold signature of the key pair of each training node is calculated based on the preset encryption algorithm to obtain an aggregate signature.
[0021] Optionally, in the above method, allocating identity authentication information to each training node includes:
[0022] Determine the verification seed based on the data of each training node;
[0023] Based on the verification seed, a key pair is generated using a multiplication cyclic group, wherein the key pair includes a public key, a private key, and a threshold signature;
[0024] The threshold signature includes a linear mapping, so that the multiplication cycle group has a specified property, and the threshold signature has a homomorphic property.
[0025] Optionally, in the above method, allocating identity authentication information to each training node includes:
[0026] Based on the verifiable random function, a random number and an identity certificate are generated for each training node, wherein the random number and the identity certificate satisfy the following formula:
[0027]
[0028] Among them, sk vi is the private key, d i is a random number, π i is the identity proof, α is the message string, β i For digital signature.
[0029] Optionally, in the above method, each training node determines one of the training nodes as the aggregation node according to the random number of each training node and the threshold random number, including:
[0030] Determine the relative size of the random number of each training node and the threshold random number, and take the training nodes whose random numbers are smaller than the threshold random number as candidate aggregation nodes;
[0031] If the number of the candidate aggregation node is one, use the candidate aggregation node as the aggregation node;
[0032] If there are multiple candidate aggregation nodes, one of the multiple candidate aggregation nodes is randomly selected as the aggregation node.
[0033] In a second aspect, a training device for a medical model based on an alliance chain is provided, wherein the alliance chain includes multiple training nodes, and the device is deployed in the alliance chain and each training node, and the device includes:
[0034] An allocating unit, configured to allocate identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0035] A generating unit, configured to generate a threshold random number using the block height of the alliance chain as a seed, and broadcast the generated random number to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0036] A training unit, used to train the medical model based on local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node;
[0037] An integration unit, used to integrate the model parameters uploaded by each training node, and write the obtained aggregated parameters and the aggregated signature generated according to the key pair of each training node into the smart contract of the alliance chain to broadcast to each training node;
[0038] A verification unit, used to verify the identity of the aggregation node according to the key pair and identity certificate of the aggregation node, and verify the validity of the aggregation signature;
[0039] An updating unit is used to update the parameters of the local medical model according to the aggregation parameters when the identity authentication of the aggregation node is passed and the aggregation signature is valid.
[0040] In a third aspect, a consortium chain is provided, wherein the consortium chain includes a plurality of training nodes;
[0041] The alliance chain is used to allocate identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0042] The alliance chain is used to generate a threshold random number using the block height of the alliance chain as a seed, and broadcast it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0043] Each training node is used to train the medical model based on local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node;
[0044] The aggregation node is used to integrate the model parameters uploaded by each training node, and write the obtained aggregation parameters and the aggregation signature generated according to the key pair of each training node into the smart contract of the alliance chain to broadcast to each training node;
[0045] Each training node is used to verify the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and to verify the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0046] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform any of the above methods.
[0047] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes any of the above methods.
[0048] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0049] This application proposes a training method, device and alliance chain for a medical model based on an alliance chain. This application realizes the off-chain storage of medical data and the trusted privacy sharing of data by building an alliance chain network and based on the idea of federated learning; it organically integrates the consensus mechanism, federated learning, threshold signature and homomorphic encryption guarantee of blockchain technology, which not only ensures the authenticity of medical data, but also solves the problem of malicious nodes in the medical model training process; and solves the centralized trust problem in the medical model training process through verifiable random functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0051] Figure 1 A schematic diagram showing the structure of a consortium chain network according to an embodiment of the present application is shown;
[0052] Figure 2 A flowchart of a method for training a medical model based on an alliance chain according to an embodiment of the present application is shown;
[0053] Figure 3 A flowchart of a method for training a medical model based on an alliance chain according to another embodiment of the present application is shown;
[0054] Figure 4 A schematic diagram showing the structure of a training device for a medical model based on an alliance chain according to an embodiment of the present application is shown;
[0055] Figure 5 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0057] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0058] The idea of this application is that, in response to the problem of data islands in the medical field, this application proposes a training method for medical models based on blockchain technology and federated learning mechanism. In this method, a consortium chain based on blockchain technology is constructed, and the tamper-resistant nature of blockchain is used to achieve traceability of medical data; the "data does not leave the local" feature of federated learning is used to achieve medical data sharing; homomorphic encryption and threshold signatures are used to verify aggregation parameters and protect parameter privacy; and verifiable random functions are used to achieve decentralized aggregation.
[0059] Figure 1 A schematic diagram of the structure of a consortium chain network according to an embodiment of the present application is shown. Figure 1 It can be seen that the alliance chain network 100 includes an alliance chain 110 and multiple blockchain node clients registered on the alliance chain. In the present application, the blockchain node client is a training node 120, and one of these training nodes is an aggregation node 130.
[0060] In practice, this includes but is not limited to various medical institutions. It should be noted that training nodes need to register to join the alliance chain. Nodes participating in the alliance chain must first register in the alliance chain network and obtain a public key. Private Key And digital certificates Only nodes registered in the alliance chain network can participate in querying and reading the alliance chain network after passing the verification of digital certificates. Each time the medical model is trained, each training node runs the blockchain node client to form an alliance chain network.
[0061] Figure 2 The flowchart of the training method of the medical model based on the alliance chain of the present application is shown. Figure 2 It can be seen that the present application at least includes steps S210 to S250:
[0062] Step S210: The alliance chain allocates identity authentication information to each training node, where the identity authentication information includes: key pair, random number, and identity certificate.
[0063] The following is a brief introduction to the technologies that may be involved in this application, including but not limited to federated learning, homomorphic encryption, threshold signatures, and verifiable random functions.
[0064] Federated Learning is an emerging basic artificial intelligence technology first proposed by Google in 2016. It was originally used to solve the problem of local model update for Android mobile phone users. Its design goal is to carry out efficient machine learning among multiple participants or multiple computing nodes while ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legality and compliance.
[0065] Homomorphic encryption is a form of encryption that allows people to perform specific forms of algebraic operations on ciphertext to obtain a result that is still encrypted, and the result obtained by decrypting it is the same as the result of the same operation on the plaintext. In other words, this technology allows people to perform operations such as retrieval and comparison on encrypted data and obtain the correct result without decrypting the data during the entire processing process.
[0066] The essence of the Threshold Signature is an m-of-n signature method. Under the condition of knowing m signatures, a unique legal signature can be synthesized. Any combination of m signature fragments is the same verifiable signature. Moreover, since each person has only one private key fragment, m private key fragments need to be combined together to form a legal and complete private key. If less than m private key fragments are shared in the network, no one will know the complete private key.
[0067] A Verifiable Random Function (VRF) is a cryptographic scheme that maps input to a verifiable pseudo-random output.
[0068] In this application, the above-mentioned methods are organically combined and blockchain technology is used to effectively solve the problem of data islands in the medical field.
[0069] First, the alliance chain assigns identity authentication information to each training node, where the identity authentication information includes but is not limited to: key pairs, random numbers, identity certificates, etc. In the subsequent process of interaction between nodes or between nodes and the alliance chain, the identity authentication information of each training node is used as the basis. Only when the identity authentication is passed can data interaction be carried out to ensure data security and prevent some training nodes from doing evil.
[0070] In some embodiments of the present application, a key pair is allocated to each training node based on a combination of homomorphic encryption technology and threshold signature technology. The key pair includes but is not limited to a public key. Private Key and the threshold signature x i ,
[0071] Random number d i 、Identity verification i It is generated based on a verifiable random function.
[0072] It should be noted that in this application, symbol subscripts, such as public key b i It has no specific meaning and only represents a training node.
[0073] It should be noted that the above information will be written into the alliance chain in a timely manner for ready use and to prevent tampering. Specifically, it can be written into the smart contract of the alliance chain. At the same time, the necessary information that each training node needs to know will be transmitted to each training node through the broadcast function of the alliance chain so that each training node can know it.
[0074] Step S220: The alliance chain uses the block height of the alliance chain as a seed, generates a threshold random number, and broadcasts it to each training node, so that each training node determines one of the training nodes as an aggregation node based on the random number of each training node and the threshold random number.
[0075] Then the alliance chain uses the block height of the alliance chain as the seed, and generates a threshold random number τ based on a verifiable random function, writes it into the smart contract of the alliance chain, and broadcasts it to each training node. After each training node reads the random number and threshold random number of each training node from the blockchain, it can determine which training node meets the requirements of the aggregation node based on these two items, and thus determine which training node serves as the aggregation node. In this way, each training node has the potential to become an aggregation node, thereby solving the problem of decentralized aggregation.
[0076] In some embodiments of the present application, the following method can be used for selecting aggregation nodes: determine the relative size of the random number of each training node and the threshold random number, and use the training node whose random number is less than the threshold random number as a candidate aggregation node; if the number of the candidate aggregation node is one, then the candidate aggregation node is used as the aggregation node; if the number of the candidate aggregation nodes is multiple, then randomly select one from the multiple candidate aggregation nodes as the aggregation node.
[0077] Compare the random number of each training node with the threshold random number. If the random number of a training node is less than the threshold random number, the aggregation node is selected as a candidate aggregation node. If there is only one candidate aggregation node, it will be used as the aggregation node, and the other training nodes are ordinary client nodes. If there are multiple candidate aggregation nodes, one can be randomly selected as the aggregation node. Similarly, the other training nodes are ordinary client nodes. At the same time, the selected training node can be set as an aggregation node in the smart contract of the alliance chain, which is responsible for the scheduling and aggregation of the training of the medical model.
[0078] Since the block height is used as the seed, it can be guaranteed that there must be a training node that meets the requirements of the aggregation node, that is, at least one aggregation node can be elected.
[0079] Step S230: Each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain.
[0080] When training the model, each training node is based on its own local medical data. It should be noted here that the local medical data of the training node does not need to be uploaded to the chain, which ensures the privacy of the medical data. After the training is completed, each training node writes the model parameters obtained from its own training to the alliance chain, which can be specifically in the smart contract of the alliance chain, which also ensures that the model parameters will not be tampered with.
[0081] The model training process can refer to existing technologies, such as pre-setting the model architecture, hyperparameters, seeds and other necessary training data, and then iterating locally several times based on the local training data set until the convergence requirements are met, ending the training and obtaining the model parameters.
[0082] In some embodiments of the present application, each training node can train the entire medical model, and the subsequent aggregation node can comprehensively consider the training results of each training node when aggregating the model parameters to obtain the final aggregate model parameters, so that the number of training samples is very large, the data is comprehensive, and the accuracy is high; in other embodiments of the present application, each training node can train part of the medical model, such as each training node trains several layers of the entire medical model, and the subsequent aggregation node can integrate the training results of each training node into the corresponding position when aggregating the model parameters to obtain the final aggregate model parameters, so that the training process is fast, the training efficiency is high, and the task of each training node is light. This application does not limit this, and it can be selected according to actual needs.
[0083] After obtaining the model parameters uploaded by each training node, the consortium chain encrypts them and then broadcasts them to the aggregation node, waiting for the aggregation node to aggregate them. The smart contract can use the threshold signature in the key pair of each training node to encrypt the model parameters uploaded by each training node. This encryption process is to prepare for the subsequent interaction between the aggregation node and each ordinary training node.
[0084] Step S240: The aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters and the aggregation signature generated according to the key pair of each training node; and writes the obtained aggregation parameters and aggregation signature into the smart contract of the alliance chain and broadcasts them to each training node.
[0085] After receiving the encrypted model parameters of each training node, the aggregation node mainly performs two tasks. First, it aggregates the model parameters of each training node to form aggregate parameters. Second, it uses the threshold signatures of each training node carried in the encrypted model parameters of each training node to form an aggregate signature for subsequent data interaction with each training node.
[0086] This application does not impose any restrictions on the aggregation of model parameters, which can be performed based on the actual distribution of training tasks.
[0087] For the generation of threshold signatures, in some embodiments of the present application, the threshold signatures of the key pairs of each training node can be calculated based on a preset encryption algorithm to obtain an aggregate signature. The aggregation node first parses the threshold signature of each training node from the encrypted model parameters of each training node. For example, if there are three training nodes in total, and the threshold signatures of the three training nodes are A, B, and C, respectively, the aggregation node uses a certain algorithm to aggregate them together to form an aggregate signature, assuming it is ABC.
[0088] The aggregation node writes the aggregate signature ABC together with the aggregated parameters obtained through aggregation into the smart contract of the alliance chain and transmits it to each training node through broadcasting.
[0089] Step S250: Each training node verifies the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and verifies the validity of the aggregation signature. When the identity authentication of the aggregation node passes and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0090] After receiving the aggregation parameters and aggregation signature, each training node first performs verification. On the one hand, it verifies the identity of the aggregation node to confirm that it is indeed an aggregation node. On the other hand, it verifies the validity of the aggregation signature. If both verifications are passed, each training node updates the parameters of the local medical model according to the aggregation parameters to obtain a trained medical model.
[0091] The identity of the aggregation node can be verified based on the key pair and identity certificate of the aggregation node, and the key pair (mainly the public key) can be verified by the signature verification module of the verifiable random function. ) and identity certificate (π i ) is valid. If it is valid, the node is determined to be an aggregation node. If it is invalid, it means that there is a problem with the node and the aggregation parameters it broadcasts are unreliable.
[0092] When the identity authentication of the aggregation node passes, the validity of the aggregation signature is verified. This verification is mainly to verify whether the aggregation node has truly aggregated the model parameters of other nodes, that is, to verify whether the aggregation signature is valid through the homomorphic encryption characteristics of the threshold signature verification module. If valid, each training node updates the parameters of the local medical model according to the aggregation parameters to obtain a trained medical model; if invalid, the aggregation parameters are unreliable.
[0093] It should be noted that the signature verification modules are all in the smart contract, and the signature verification process is a completely on-chain operation. Each training node can implement it by calling the verification method.
[0094] Depend on Figure 2 It can be seen from the method shown that this application proposes a training method, device and alliance chain for a medical model based on an alliance chain. This application realizes the off-chain storage of medical data and the trusted privacy sharing of data by building an alliance chain network and based on the idea of federated learning; it organically integrates the consensus mechanism, federated learning, threshold signature and homomorphic encryption guarantee of blockchain technology, which not only ensures the authenticity of medical data, but also solves the problem of malicious nodes in the medical model training process; and solves the centralized trust problem in the medical model training process through verifiable random functions.
[0095] In some embodiments of the present application, each training node trains the medical model based on local medical data in multiple rounds; in each round of training, each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, until each training node obtains the aggregation parameters from the smart contract of the alliance chain, and updates the parameters of the local medical model according to the aggregation parameters.
[0096] In the actual training process, it is usually not possible to achieve a relatively ideal effect with just one round of training for a model. Usually, multiple rounds of training are required, and the model parameters obtained in the previous round are used as the basis for the training of the next round. In some embodiments of the present application, it is assumed that a relatively ideal effect is achieved after three rounds of training. In the first round, steps S210 to S250 are executed; in the second round, steps S230 to S250 are executed; in the third round, steps S230 to S250 are executed. When training a model, it is not known in advance how many rounds of training are required, and the convergence situation needs to be used as a benchmark.
[0097] In some embodiments of the present application, when starting a new round of training or training of a new medical model, the alliance chain also controls each training node to select a new aggregation node, and verifies the identity of the new training node based on its key pair, random number, and identity certificate.
[0098] For the aggregation nodes that have been elected, it cannot be guaranteed that they will not do evil all the time. When a computing task is completed, the next computing task will be started. In some embodiments of the present application, when a new round of training or training of a new medical model is started, it can be considered that the next computing task will be started after the completion of a computing task. The alliance chain can control the training node to re-elect the aggregation node for the next computing task based on the verifiable random function, and judge the identity of the newly elected aggregation node and whether it is malicious based on threshold signatures and homomorphic encryption. The signature verification method is as described above and will not be repeated here.
[0099] In some embodiments of the present application, the aggregation node integrates the model parameters uploaded by each training node to obtain aggregation parameters, including: determining a test medical model based on the above-mentioned model parameters of a training node; predicting the test data set based on the test medical model to obtain a test accuracy; if the obtained test accuracy is less than a preset accuracy threshold, discarding the model parameters uploaded by the training node; if the obtained test accuracy is greater than or equal to the preset accuracy threshold, aggregating the model parameters uploaded by the training node to obtain aggregation parameters.
[0100] In order to further prevent training nodes from uploading randomly generated parameters, i.e., malicious behavior, and also to verify the training effect, when the aggregation node receives the model parameters of each training node through the blockchain, it uses part of the test set to verify the validity of the model parameters uploaded by each training node. Specifically, an accuracy threshold can be set. If the aggregation node uses the model parameters provided by a training node to form a test medical model and makes predictions based on the test data set, if the test accuracy is lower than the set accuracy threshold, then these parameters will not be aggregated; if it exceeds the set accuracy threshold, these parameters will be aggregated. The accuracy setting can be based on the industry's common standards, and should not be too large or too small, because if it is too large, it will easily filter out the model parameters of some training nodes that are not malicious but have low accuracy; if it is too small, it may not be possible to exclude the model parameters generated by some training nodes that are malicious.
[0101] In some embodiments of the present application, the assigning of identity authentication information to each training node includes: determining a verification seed based on data of each training node; based on the verification seed, generating a key pair using a multiplication cyclic group, the key pair including a public key, a private key and a threshold signature; wherein the threshold signature includes a linear mapping so that the multiplication cyclic group has specified properties and the threshold signature has homomorphic characteristics.
[0102] Specifically, assuming there are k training nodes in the alliance chain network, k positive integers s1, s2, ..., s are required. k , and gcd(s i ,s j )=1(i≠j) are relatively prime, and these positive integers are used as verification seeds. Then, these verification seeds (seeds) and the multiplication cyclic group G1 are used to generate the key pair key(sk i , pk i , x i ), where sk i is the private key, pk i is the public key, x i is a threshold signature. The threshold signature contains a linear mapping e that makes the multiplication cycle group have the property G1xG2→G3; in addition, the threshold signature also has the homomorphic property, that is, for any two transactions tx1 and tx2, if the transaction satisfies tx∈G2, then h(tx1+tx2)=h(tx1)+h(tx2), where h is a hash function.
[0103] In some embodiments of the present application, the assigning of identity authentication information to each training node includes: generating a random number and an identity certificate for each training node based on a verifiable random function, wherein the random number and the identity certificate satisfy the following formula: Among them, sk vi is the private key, di is a random number, π i is the identity proof, α is the message string, β i In the signature verification process of step S250, when verifying whether the node is an aggregation node, that is, through verification (pk i , α, β i , π i ) is valid. Figure 3 A flowchart of a method for training a medical model based on an alliance chain according to another embodiment of the present application is shown. Figure 3 It can be seen that this embodiment includes:
[0104] Authentication information is allocated to each training node. The authentication information includes: key pair, random number, identity proof, where the key pair includes public key, private key and threshold signature.
[0105] Using the block height of the alliance chain as a seed, a threshold random number is generated and broadcast to each training node.
[0106] One of the training nodes is determined as an aggregation node according to the random number of each training node and the threshold random number.
[0107] Each training node trains the medical model based on local medical data and writes the obtained model parameters into the smart contract of the alliance chain.
[0108] The alliance's smart contract uses the threshold signature of each training node to encrypt the model parameters uploaded by each training node and broadcast them to the aggregation node.
[0109] The model parameters uploaded by each training node are integrated to obtain the aggregate parameters, and an aggregate signature is generated according to the threshold signature of each training node. The obtained aggregate signature and aggregate parameters are written into the smart contract of the alliance chain.
[0110] The alliance's smart contract broadcasts the aggregate signature and aggregate parameters to each training node.
[0111] The identity of the aggregation node is verified according to the public key and identity certificate of the aggregation node, and the validity of the aggregation signature is verified. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0112] Figure 4 The schematic diagram of the structure of the medical model training device based on the alliance chain according to an embodiment of the present application is shown. The device can be deployed in the alliance chain and each training node. It should be noted that the devices deployed in different locations have different tasks. In the process of medical model training, the devices deployed in different locations can call the corresponding modules according to the tasks they undertake. Figure 4 It can be seen that the device 400 comprises:
[0113] The allocating unit 410 is used to allocate identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0114] A generating unit 420 is used to generate a threshold random number using the block height of the alliance chain as a seed, and broadcast the generated random number to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0115] The training unit 430 is used to train the medical model based on the local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node;
[0116] The integration unit 440 is used to integrate the model parameters uploaded by each training node, and write the obtained aggregated parameters and the aggregated signature generated according to the key pair of each training node into the smart contract of the alliance chain to broadcast to each training node;
[0117] A verification unit 450, configured to verify the identity of the aggregation node according to the key pair and identity certificate of the aggregation node, and verify the validity of the aggregation signature;
[0118] The updating unit 460 is configured to update the parameters of the local medical model according to the aggregation parameters when the identity authentication of the aggregation node is passed and the aggregation signature is valid.
[0119] In some embodiments of the present application, in the above-mentioned device, each training node trains the medical model based on local medical data in multiple rounds; in each round of training, the training unit 430 is used to train the medical model based on local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key pairs of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node; the integration unit 440 is used to integrate the model parameters uploaded by each training node, and write the obtained aggregation parameters and the aggregation signature generated according to the key pairs of each training node into the smart contract of the alliance chain to broadcast them to each training node; the verification unit 450 is used to verify the identity of the aggregation node according to the key pair and identity certificate of the aggregation node, and verify the validity of the aggregation signature; the update unit 460 is used to update the parameters of the local medical model according to the aggregation parameters when the identity authentication of the aggregation node is passed and the aggregation signature is valid.
[0120] In some embodiments of the present application, in the above-mentioned device, when starting a new round of training or training of a new medical model, the generation unit 420 is also used to select a new aggregation node, and the verification unit 450 is also used to verify the identity of the new training node based on its key pair, random number, and identity certificate.
[0121] In some embodiments of the present application, in the above-mentioned device, the integration unit 440 is used to determine the test medical model based on the above-mentioned model parameters of a training node; based on the test medical model, predict the test data set to obtain the test accuracy; if the obtained test accuracy is less than the preset accuracy threshold, discard the model parameters uploaded by the training node; if the obtained test accuracy is greater than or equal to the preset accuracy threshold, aggregate the model parameters uploaded by the training node to obtain aggregated parameters.
[0122] In some embodiments of the present application, in the above-mentioned device, the key pair includes a threshold signature; the integration unit 440 is used to calculate the threshold signature of the key pair of each training node based on a preset encryption algorithm to obtain an aggregate signature.
[0123] In some embodiments of the present application, in the above-mentioned device, the allocation unit 410 is used to determine a verification seed according to the data of each training node; based on the verification seed, a key pair is generated using a multiplication cyclic group, and the key pair includes a public key, a private key and a threshold signature; wherein the threshold signature includes a linear mapping, so that the multiplication cyclic group has a specified property, and the threshold signature has a homomorphic property.
[0124] In some embodiments of the present application, in the above-mentioned device, the allocation unit 410 is used to generate a random number and an identity certificate for each training node based on a verifiable random function, wherein the random number and the identity certificate satisfy the following formula:
[0125]
[0126] Among them, sk vi is the private key, d i is a random number, π i is the identity proof, α is the message string, β i For digital signature.
[0127] In some embodiments of the present application, in the above-mentioned device, the generation unit 420 is used to determine the relative size of the random number of each training node and the threshold random number, and take the training node whose random number is less than the threshold random number as a candidate aggregation node; if the number of the candidate aggregation node is one, then the candidate aggregation node is used as the aggregation node; if the number of the candidate aggregation nodes is multiple, then randomly select one from the multiple candidate aggregation nodes as the aggregation node.
[0128] It should be noted that the above-mentioned devices can implement the above-mentioned methods one by one, and will not be described in detail.
[0129] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0130] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0131] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0132] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a training device for the medical model based on the alliance chain at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0133] The alliance chain allocates identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0134] The alliance chain uses the block height of the alliance chain as a seed, generates a threshold random number, and broadcasts it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0135] Each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcasts the encrypted model parameters to the aggregation node;
[0136] The aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters and the aggregation signature generated according to the key pair of each training node; and writes the obtained aggregation parameters and the aggregation signature into the smart contract of the alliance chain to broadcast to each training node;
[0137] Each training node verifies the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and verifies the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0138] The above application Figure 4The method performed by the training device of the medical model based on the alliance chain disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0139] The electronic device may also perform Figure 4 A method for executing a training device for a medical model based on a consortium chain, and implementing a training device for a medical model based on a consortium chain in Figure 4 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0140] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 4 The method performed by the training device of the medical model based on the alliance chain in the embodiment shown is specifically used to perform:
[0141] The alliance chain allocates identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate;
[0142] The alliance chain uses the block height of the alliance chain as a seed, generates a threshold random number, and broadcasts it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number;
[0143] Each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcasts the encrypted model parameters to the aggregation node;
[0144] The aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters and the aggregation signature generated according to the key pair of each training node; and writes the obtained aggregation parameters and the aggregation signature into the smart contract of the alliance chain to broadcast to each training node;
[0145] Each training node verifies the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and verifies the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
[0146] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0147] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0148] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0149] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0150] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0151] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0152] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0153] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0154] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0155] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A training method for a medical model based on alliance chain, characterized in that: The alliance chain includes multiple training nodes, and the method includes: The alliance chain allocates identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate; The alliance chain uses the block height of the alliance chain as a seed, generates a threshold random number, and broadcasts it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number; Each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcasts the encrypted model parameters to the aggregation node; The aggregation node integrates the model parameters uploaded by each training node to obtain the aggregation parameters and the aggregation signature generated according to the key pair of each training node; and writes the obtained aggregation parameters and the aggregation signature into the smart contract of the alliance chain to broadcast to each training node; Each training node verifies the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and verifies the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
2. The method according to claim 1, characterized in that Each training node trains the medical model based on local medical data in multiple rounds; During each round of training, each training node trains the medical model based on local medical data, and writes the obtained model parameters into the smart contract of the alliance chain, until each training node obtains the aggregation parameters from the smart contract of the alliance chain, and updates the parameters of the local medical model according to the aggregation parameters.
3. The method according to claim 2, characterized in that When starting a new round of training or training a new medical model, the alliance chain also controls each training node to select a new aggregation node, and verifies the identity of the new training node based on its key pair, random number, and identity certificate.
4. The method according to claim 1, characterized in that: The aggregation node integrates the model parameters uploaded by each training node to obtain aggregation parameters, including: Determine a test medical model according to the above model parameters of a training node; Based on the test medical model, predict the test data set to obtain the test accuracy; If the obtained test accuracy is less than the preset accuracy threshold, the model parameters uploaded by the training node are discarded; If the obtained test accuracy is greater than or equal to the preset accuracy threshold, the model parameters uploaded by the training node are aggregated to obtain aggregated parameters.
5. The method according to claim 1, characterized in that The key pair includes a threshold signature; The aggregate signature generated based on the key pair of each training node includes: The threshold signature of the key pair of each training node is calculated based on the preset encryption algorithm to obtain an aggregate signature.
6. The method according to claim 1, characterized in that The allocating identity authentication information to each training node includes: Determine the verification seed based on the data of each training node; Based on the verification seed, a key pair is generated using a multiplication cyclic group, wherein the key pair includes a public key, a private key, and a threshold signature; The threshold signature includes a linear mapping, so that the multiplication cycle group has a specified property, and the threshold signature has a homomorphic property.
7. The method according to claim 1, characterized in that The allocating identity authentication information to each training node includes: Based on the verifiable random function, a random number and an identity certificate are generated for each training node, wherein the random number and the identity certificate satisfy the following formula: Among them, sk vi is the private key, d i is a random number, π i is the identity proof, α is the message string, β i For digital signature.
8. The method according to claim 1, characterized in that The training nodes determining one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number includes: Determine the relative size of the random number of each training node and the threshold random number, and take the training nodes whose random numbers are smaller than the threshold random number as candidate aggregation nodes; If the number of the candidate aggregation node is one, use the candidate aggregation node as the aggregation node; If there are multiple candidate aggregation nodes, one of the multiple candidate aggregation nodes is randomly selected as the aggregation node.
9. A training device for a medical model based on an alliance chain, characterized in that: The alliance chain includes multiple training nodes, and the device is deployed in the alliance chain and each training node. The device includes: An allocating unit, configured to allocate identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate; A generating unit, configured to generate a threshold random number using the block height of the alliance chain as a seed, and broadcast the generated random number to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number; A training unit, used to train the medical model based on local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node; An integration unit, used to integrate the model parameters uploaded by each training node, and write the obtained aggregated parameters and the aggregated signature generated according to the key pair of each training node into the smart contract of the alliance chain to broadcast to each training node; A verification unit, used to verify the identity of the aggregation node according to the key pair and identity certificate of the aggregation node, and verify the validity of the aggregation signature; An updating unit is used to update the parameters of the local medical model according to the aggregation parameters when the identity authentication of the aggregation node is passed and the aggregation signature is valid.
10. A consortium chain, characterized in that: The alliance chain includes multiple training nodes; The alliance chain is used to allocate identity authentication information to each training node, wherein the identity authentication information includes: a key pair, a random number, and an identity certificate; The alliance chain is used to generate a threshold random number using the block height of the alliance chain as a seed, and broadcast it to each training node, so that each training node determines one of the training nodes as an aggregation node according to the random number of each training node and the threshold random number; Each training node is used to train the medical model based on local medical data, and write the obtained model parameters into the smart contract of the alliance chain, so that the smart contract uses the key of each training node to encrypt the model parameters uploaded by each training node, and broadcast the encrypted model parameters to the aggregation node; The aggregation node is used to integrate the model parameters uploaded by each training node, and write the obtained aggregation parameters and the aggregation signature generated according to the key pair of each training node into the smart contract of the alliance chain to broadcast to each training node; Each training node is used to verify the identity of the aggregation node based on the key pair and identity certificate of the aggregation node, and to verify the validity of the aggregation signature. When the identity authentication of the aggregation node is passed and the aggregation signature is valid, the parameters of the local medical model are updated according to the aggregation parameters.
Citation Information
Patent Citations
Safe distributed federation deep learning method
CN112232527A
Data processing method and system for federated learning based on alliance chain
CN112597240A