WO2021114929A1 - Blockchain-based model combination training method and device - Google Patents

Blockchain-based model combination training method and device Download PDF

Info

Publication number
WO2021114929A1
WO2021114929A1 PCT/CN2020/124489 CN2020124489W WO2021114929A1 WO 2021114929 A1 WO2021114929 A1 WO 2021114929A1 CN 2020124489 W CN2020124489 W CN 2020124489W WO 2021114929 A1 WO2021114929 A1 WO 2021114929A1
Authority
WO
WIPO (PCT)
Prior art keywords
result
training
node
chain
fusion
Prior art date
Application number
PCT/CN2020/124489
Other languages
French (fr)
Chinese (zh)
Inventor
倪翔
汲小溪
王维强
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021114929A1 publication Critical patent/WO2021114929A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Definitions

  • One or more embodiments of this specification relate to the field of computer technology, and in particular to a method and device for joint training of models based on blockchain.
  • Federated Learning also known as joint learning
  • Its design goal is to carry out high-efficiency machine learning among multiple parties (or computing nodes or subjects) under the premise of ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legal compliance.
  • One or more embodiments of this specification describe a method and device for joint training of models based on blockchain, which can efficiently perform joint training on models while ensuring the security of data of all parties.
  • a method for joint training of models based on blockchain including: receiving a first training result sent by a corresponding upper node; the first training result is determined based on at least a first type of result; the first The type result is obtained by the upper-level node based on its private data maintained off-chain, after training the target model in the multiple models maintained on the chain; based on the private data maintained off-chain, it is obtained on-chain
  • the target model among the multiple models maintained is trained to obtain the second training result; the first training result and the second training result are fused to obtain the fusion result; it is judged whether the current layer node is the last One level; if the current layer node is at the last level, the fusion result is broadcast on the blockchain, so that the multiple nodes can compare the various models maintained on the chain based on the fusion result
  • the target model in is updated.
  • a method for joint training of models based on blockchain which includes: receiving a first training result sent by a corresponding upper node; the first training result includes at least a first type of result; the first type The result is obtained by the upper node after training the target model in the multiple models maintained on the chain based on its private data maintained off-chain; based on the private data maintained off-chain, it is maintained on-chain Training the target model of the multiple models to obtain the second training result; judging whether the current layer node is in the last level; if the current layer node is in the last level, then the first training result Fusion with the second training result to obtain the fusion result; broadcast the fusion result on the blockchain, so that the multiple nodes can compare each of the multiple models maintained on the chain based on the fusion result The target model is updated.
  • a block chain-based model joint training device including: a receiving unit for receiving a first training result sent by a corresponding upper node; the first training result is determined based on at least a first type of result The first type of result is obtained by the upper node based on its private data maintained under the chain after training the target model in the multiple models maintained on the chain; the training unit is used to base its off-chain For the maintained private data, train the target model among the multiple models maintained on the chain to obtain the second training result; the fusion unit is used to perform the training on the first training result received by the receiving unit and all the training results.
  • the second training result obtained by the training unit is fused to obtain the fusion result; the judging unit is used to judge whether the current layer node is at the last level; the broadcasting unit is used to if the judging unit judges the current layer If the layer node is at the last level, the fusion result is broadcast on the blockchain, so that the multiple nodes perform the target model of the multiple models maintained on the chain based on the fusion result. Update.
  • a block chain-based model joint training device including: a receiving unit configured to receive a first training result sent by a corresponding upper node; the first training result includes at least a first type result; The first type of result is obtained by the upper node after training the target model in the multiple models maintained on the chain based on its private data maintained off-chain; the training unit is used for maintenance based on its off-chain To train the target model in the multiple models maintained on the chain to obtain the second training result; the judgment unit is used to judge whether the current layer node is at the last level; the fusion unit is used If the judging unit judges that the current layer node is at the last level, then the first training result and the second training result are fused to obtain the fusion result; the broadcasting unit is used for logging in the blockchain The fusion result obtained by the fusion unit is broadcast on the above, so that the multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
  • a computer storage medium is provided with a computer program stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method of the first aspect or the method of the second aspect.
  • a computing device including a memory and a processor, the memory stores executable code, and when the processor executes the executable code, the method of the first aspect or the method of the second aspect is implemented method.
  • One or more embodiments of this specification provide a blockchain-based model joint training method and device.
  • Each layer node of the blockchain can receive the training result sent by the corresponding upper node, and can compare the received training result with its own The training results are fused and sent to the corresponding lower-level nodes, or the two training results are directly forwarded to the corresponding lower-level nodes, until the last-level node is reached.
  • the last layer of nodes integrates all the training results to obtain the final training result, and broadcasts the final training result on the blockchain, so that each node can update the corresponding model, thus achieving the blockchain-based model Joint training. That is to say, the solution provided in this specification can realize the joint training of the model based on the blockchain, thereby ensuring the safety and reliability of the joint training process of the model.
  • Figure 1 is a schematic diagram of the implementation scenario of the blockchain-based model joint training method provided in this manual
  • FIG. 2 is a flowchart of a model joint training method based on blockchain provided by an embodiment of this specification
  • FIG. 3 is a flowchart of a model joint training method based on blockchain provided by another embodiment of this specification.
  • Figure 4 is a schematic diagram of a block chain-based model joint training device provided by an embodiment of this specification.
  • Fig. 5 is a schematic diagram of a block chain-based model joint training device provided by another embodiment of this specification.
  • Blockchain is a series of text records that are connected and protected by cryptography. Each block contains the encrypted hash of the previous block, the corresponding time stamp and transaction data. This design makes the block content difficult to tamper with.
  • the distributed ledger connected by blockchain technology allows two parties to effectively record the transaction, and the transaction can be permanently checked.
  • each node in the blockchain can be divided into multiple levels, and the corresponding relationship between the nodes of two adjacent levels can be established.
  • each layer node of the blockchain can receive the training result sent by the corresponding upper node, and can merge the received training result with its own training result and send it to the corresponding lower node, or directly forward the two training results To the corresponding lower-level node, until reaching the last-level node.
  • the last layer of nodes integrates all the training results to obtain the final training result, and broadcasts the final training result on the blockchain, so that each node can update the corresponding model, thus achieving the blockchain-based model Joint training.
  • Figure 1 is a schematic diagram of the implementation scenario of the blockchain-based model joint training method provided in this specification.
  • nodes 1 to 15 are nodes in the blockchain, and each node is organized according to a hierarchical relationship. Specifically, node 1 to node 8 is in the first level, node 9 to node 12 is in the second level, node 13 to node 14 is in the third level, and node 15 is in the fourth level (that is, the last level) .
  • node 1-node 2 of the first level corresponds to node 9 of the second level
  • node 3-node 4 of the first level corresponds to node 10 of the second level
  • node 5 of the first level nodes 1 to 15 are nodes in the blockchain, and each node is organized according to a hierarchical relationship. Specifically, node 1 to node 8 is in the first level, node 9 to node 12 is in the second level, node 13 to node 14 is in the third level, and node 15 is in the fourth level (that is, the last
  • the node 6 corresponds to the node 11 of the second level
  • the node 7-node 8 of the first level corresponds to the node 12 of the second level
  • the node 9-node 10 of the second level corresponds to the node 13 of the third level
  • the node 11-node 12 of the second level corresponds to the node 14 of the third level
  • the node 13-node 14 of the third level corresponds to the node 15 of the last level.
  • Each node in Figure 1 can represent a participant.
  • Each of the above nodes can maintain multiple models on the chain.
  • the multiple models here may include at least one of a Logistic Regression (LR) model, a Gradient Boosting Decision Tree (GBDT) model, and a (Deep Neural Networks, DNN) model.
  • LR Logistic Regression
  • GBDT Gradient Boosting Decision Tree
  • DNN Deep Neural Networks
  • Any one of the above-mentioned multiple models may be submitted to the blockchain in advance by a certain node. It is understandable that for the model submitted to the blockchain, each node can perform corresponding calculations (eg, training).
  • each node in the blockchain can also maintain its own private data under the chain.
  • each node can implement the maintenance of the off-chain data by including a pointer to the off-chain data in the corresponding block record.
  • the task rebuilder can publish model training tasks on the blockchain.
  • the task processor here can be a separate server, or it can be set on any node in the blockchain.
  • the aforementioned model training task at least indicates the target model to be trained. It should be noted that after the above-mentioned model training task is released, only the nodes of the first level will perform the training task, and the nodes of other levels will wait to receive the training result of the corresponding node before starting the training task.
  • node 1 to node 2 can select the target model from a variety of models maintained on the chain, and based on its The private data maintained under the chain trains the selected target model.
  • node 1 and node 2 may send their respective training results (eg, model gradient and/or model parameters) to node 9.
  • the node 9 can obtain the corresponding training result, and merge the received training result with the training result obtained by itself, or directly forward all the training results to the node 13 and so on, and so on, until the node 15 is reached.
  • the node 15 can fuse all the training results and publish the fusion result to the blockchain, so that each node updates the target model maintained by each node based on the fusion result.
  • Figure 1 only lists four levels of nodes, and each node of the next level only corresponds to the two nodes of the previous level.
  • the blockchain can also include more than There are four levels of nodes, and each node of the next level can correspond to more than two nodes of the previous level, which is not limited in this specification.
  • the chain hash pointer on the blockchain can ensure that it is almost impossible to change or delete records on the blockchain.
  • records on the blockchain can also contain pointers to private data off-chain. The pointer and hash pointer together can be used to verify the integrity of the data off the chain. In this way, the blockchain can also protect the integrity of off-chain data. Protecting the integrity of on-chain and off-chain records essentially prevents fraudulent deletion or alteration of records for personal gain.
  • the blockchain provides near real-time transparency of records attached to the blockchain, that is, these new records are visible to each node of the blockchain. This improves the ability of such nodes to detect fraudulent records. The existence of this transparency and the mere possibility of being discovered will greatly deter fraud.
  • this solution can ensure the safety of the model joint training process.
  • Fig. 2 is a flowchart of a model joint training method based on blockchain provided by an embodiment of this specification.
  • the execution subject of the method can be any node among the nodes of the 2-4th level of the blockchain in FIG. 1.
  • the method may specifically include step 202 to step 210.
  • Step 202 Receive the first training result sent by the corresponding upper node.
  • the above-mentioned upper-level node does not have a corresponding upper-level node, that is, the upper-level node is a node of the first level, and the first training result is based on the first type
  • the result is determined, for example, the first type of result is used as the first training result.
  • the first type of result here is obtained by the upper node based on the private data maintained off-chain by the target model of the multiple models maintained on the chain.
  • the above-mentioned upper-level node also has a corresponding upper-level node, that is, the upper-level node is a non-first-level node, then the first training result is determined based on the first-type result and the second-type result, where the second-type result It is determined by the upper node based on the result received from its corresponding upper node.
  • the first training result can be obtained by averaging the results of the first type and the second type, or by calculating the weighted average.
  • the above-mentioned target model may be specified by the task processor when issuing the model training task.
  • it can be any of LR model, GBDT model or DNN model.
  • the above-mentioned first type result or second type result may refer to the intermediate model gradient and/or the intermediate model parameter of the target model.
  • the number of the aforementioned first training results may be determined based on the number of corresponding upper-level nodes. That is, when the number of corresponding upper-layer nodes is multiple, the number of the above-mentioned first training results may also be multiple.
  • node 9 can receive the first training results sent by node 1 and node 2, that is, the number of first training results received by node 9 is two .
  • the first training result sent by node 1 (or node 2) is the first type result, that is, when node 1 (or node 2) receives the model training task issued by the task processor on the blockchain, It is obtained after training the target model based on the private data maintained under the chain.
  • the node 13 of the third level it can receive the first training results sent by the node 9 and the node 10 respectively, that is, the number of the first training results received by the node 13 is two.
  • the first training result sent by the node 9 (or the node 10) is determined based on the first type result and the second type result.
  • the corresponding first type result is obtained by node 9 after receiving the first training result sent by node 1 and node 2, based on the private data maintained under the chain, after training the target model.
  • the corresponding second type result is obtained by node 9 after fusing the first training results sent by node 1 and node 2.
  • Step 204 based on the private data maintained off-chain, train the target model among the multiple models maintained on the chain to obtain a second training result.
  • the node 9 of the second level can train the target model to obtain the second training result.
  • the node 13 of the third level can train the target model to obtain the second training result.
  • step 206 the first training result and the second training result are fused to obtain a fusion result.
  • the first training result can be used as the new second type result
  • the second training result can be used as the new first type result for averaging or weighted average to obtain the fusion result.
  • the node 9 of the second level can use the two first training results received from node 1 and node 2 as two new second-type results, in addition, it can also use the second training results obtained by itself.
  • the result is the new first type result.
  • the two new second-type results and the new first-type results are averaged or weighted to obtain the fusion result. It is understandable that the fusion result is the first training result sent by node 9 to node 13.
  • the node 13 at the third level can use the two first training results received from the node 9 and the node 10 as two new second-type results, and in addition, it can also use the second-type results obtained by itself.
  • the training result is regarded as the new first type result.
  • the two new second-type results and the new first-type results are averaged or weighted to obtain the fusion result. It can be understood that the fusion result is the first training result sent by node 13 to node 15.
  • Step 208 Determine whether the current layer node is in the last layer.
  • Step 210 If the current layer node is at the last level, broadcast the fusion result on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
  • the node 15 of the fourth level in FIG. 1 since the node 15 is at the last level, it can broadcast the fusion result on its blockchain. It is understandable that the fusion result here may refer to the total model gradient or the total model parameters of the target model.
  • each node can determine the total model parameters based on the total model gradient after receiving the total model gradient. After that, based on the total model parameters, the corresponding target models are updated.
  • the fusion result is the overall model parameter
  • each node After each node receives the overall model parameter, it can directly update the corresponding target model based on the overall model parameter.
  • the fusion result is used as the first training result sent to the corresponding lower layer node.
  • the node 9 of the second level can send the corresponding fusion result to the node 13 as the first training result.
  • the node 13 of the third level can send the corresponding fusion result to the node 15 as the first training result.
  • step 210 only one round of iterative training of the target model is completed. If after one round of iteration, the loss function corresponding to the target model reaches the predetermined convergence condition, the joint model training ends; otherwise, the next round of iteration is entered until the loss function corresponding to the target model reaches the predetermined convergence condition. It is understandable that the next iteration of the process is executed based on the updated target model.
  • the task processor can call the smart contract, and the smart contract is used to calculate the respective rewards of multiple nodes, and distribute the respective rewards to the multiple nodes, so as to increase the respective virtual resources of the multiple nodes.
  • the implementation principle of a smart contract is as follows: Assuming that the t-th submitted data (or algorithm) gains A_t to the existing model, for each submitted data (or algorithm) h, define a loss function L(h,t ). The reward corresponding to the last node is A_t–L(h,t).
  • Shapley value is to fairly distribute the benefits of cooperation by considering the contributions made by each node.
  • step 202 to step 210 are operations performed by nodes other than the first level in the model joint training process. It is understandable that, for each node of the first level, when it receives the model training task issued by the task processor on the blockchain, it can maintain it on the chain based on the private data maintained under the chain. The target model among multiple models is trained, and the second training result is obtained. After that, the second training result can be used as the first training result sent to the corresponding lower-level node (that is, the second-level node). Therefore, the corresponding lower-level node can execute the above-mentioned step 202-step 210 until the node of the last level is reached.
  • the blockchain-based model joint training method provided by the embodiments of this specification has made the following innovations: First, innovatively propose to introduce blockchain into federated learning. Second, use the hash pointer technology of the blockchain to solve the integrity of the data on and off the chain. Third, use the digital signature technology of the blockchain to solve the authenticity of the data source of the machine learning model. Fourth, the use of blockchain's smart contract technology solves the problem of incentive and punishment mechanisms that promote data sharing and algorithm co-construction in federated learning. Fifth, the process of federated learning is realized on the blockchain.
  • Fig. 3 is a flowchart of a model joint training method based on blockchain provided by another embodiment of this specification.
  • the execution subject of the method can be any node among the nodes of the 2-4th level of the blockchain in FIG. 1.
  • the method may specifically include step 302 to step 310.
  • Step 302 Receive the first training result sent by the corresponding upper node.
  • the above-mentioned upper-level node does not have a corresponding upper-level node, that is, the upper-level node is a node of the first level, and the first training result only includes the first-level node.
  • Type results are obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node.
  • the above-mentioned upper-level node also has a corresponding upper-level node, that is, the upper-level node is a non-first-level node, and the first training result includes a first-type result and a second-type result.
  • the second type result is determined by the upper node based on the result received from its corresponding upper node.
  • the second type result is composed of the training results of each upper node corresponding to the upper node.
  • the above-mentioned target model may be specified by the task processor when issuing the model training task.
  • it can be any of LR model, GBDT model or DNN model.
  • the above-mentioned first type result or second type result may refer to the intermediate model gradient and/or the intermediate model parameter of the target model.
  • the number of the aforementioned first training results may be determined based on the number of corresponding upper-level nodes. That is, when the number of corresponding upper-layer nodes is multiple, the number of the above-mentioned first training results may also be multiple.
  • node 9 can receive the first training results sent by node 1 and node 2, that is, the number of first training results received by node 9 is two .
  • the first training result sent by node 1 (or node 2) only includes the first type of result, that is, when node 1 (or node 2) receives the model training task issued by the task processor on the blockchain, It is obtained after training the target model based on the private data maintained under the chain.
  • the node 13 of the third level it can receive the first training results sent by the node 9 and the node 10 respectively, that is, the number of the first training results received by the node 13 is two.
  • the first training result sent by the node 9 includes the first type result and the second type result.
  • the corresponding first type result is obtained by node 9 after receiving the first training result sent by node 1 and node 2, based on the private data maintained under the chain, after training the target model.
  • the corresponding second type result is composed of the first training result sent by node 1 and node 2 corresponding to node 9.
  • Step 304 Based on the private data maintained off-chain, train the target model among the multiple models maintained on-chain to obtain a second training result.
  • the node 9 of the second level can train the target model to obtain the second training result.
  • the node 13 of the third level can train the target model to obtain the second training result.
  • Step 306 Determine whether the current layer node is in the last layer.
  • Step 308 If the current layer node is in the last layer, the first training result and the second training result are fused to obtain the fusion result.
  • the first training result and the second training result can be averaged or weighted averaged to obtain the fusion result.
  • the node 15 of the fourth level can average or calculate the weighted average of the two first training results received from the node 13 and the node 14 and the second training result obtained by itself to obtain the fusion result.
  • the first training result is used as the second type result of the first training result sent to the corresponding lower layer node, and the second training result is used as the first training result sent to the corresponding lower layer node.
  • the first type of training result is used as the second type result of the first training result sent to the corresponding lower layer node.
  • the node 9 of the second level can use the two first training results received from node 1 and node 2 as two new second-type results, in addition, it can also use the second training results obtained by itself.
  • the result is the new first type result.
  • the two new results of the second type and the new results of the first type are used as two parts of the first training result sent to the node 13.
  • Step 310 Broadcast the fusion result on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
  • the fusion result may refer to the total model gradient or the total model parameters of the target model.
  • each node can determine the total model parameters based on the total model gradient after receiving the total model gradient. After that, based on the total model parameters, the corresponding target models are updated.
  • the fusion result is the overall model parameter
  • each node After each node receives the overall model parameter, it can directly update the corresponding target model based on the overall model parameter.
  • step 310 only one round of iterative training of the target model is completed. If after one round of iteration, the loss function corresponding to the target model reaches the predetermined convergence condition, the joint model training ends; otherwise, the next round of iteration is entered until the loss function corresponding to the target model reaches the predetermined convergence condition. It is understandable that the next iteration of the process is executed based on the updated target model.
  • steps 302 to 310 are operations performed by nodes other than the first level in the model joint training process. It is understandable that, for each node of the first level, when it receives the model training task issued by the task processor on the blockchain, it can maintain it on the chain based on the private data maintained under the chain. The target model among multiple models is trained, and the second training result is obtained. After that, the second training result can be used as the first training result sent to the corresponding lower-level node (that is, the second-level node). Therefore, the corresponding lower-level node can execute the above-mentioned steps 302-310 until the node of the last level is reached.
  • the block chain-based model joint training method provided in the embodiment of this specification can realize the joint training of the model based on the block chain, thereby ensuring the safety and reliability of the model joint training process.
  • an embodiment of this specification also provides a blockchain-based model joint training device.
  • the blockchain includes multiple nodes with hierarchical relationships and adjacent There is a correspondence between the nodes of the two levels. Each of the multiple nodes maintains private data off-chain, and there are multiple models for on-chain maintenance.
  • the device is set at the current layer node of the blockchain. As shown in Figure 4, the device may include the following units.
  • the receiving unit 402 is configured to receive the first training result sent by the corresponding upper node.
  • the first training result is determined based on at least the first type of result, and the first type of result is obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node.
  • the first training result is determined based on the first type result and the second type result
  • the second type result is determined by the upper node based on the result received from its corresponding upper node.
  • the training unit 404 is used to train the target model among the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result.
  • the fusion unit 406 is configured to fuse the first training result received by the receiving unit 402 and the second training result obtained by the training unit 404 to obtain a fusion result.
  • the fusion unit 406 is specifically configured to: use the first training result as the new second-type result, and use the second training result as the new first-type result to average or calculate a weighted average to obtain the fusion result.
  • the fusion result here may include the total model gradient and/or the total model parameters of the target model.
  • the judging unit 408 is used to judge whether the current layer node is in the last layer.
  • the broadcasting unit 410 is configured to, if the judging unit 408 judges that the current layer node is at the last level, broadcast the fusion result on the blockchain, so that multiple nodes can respond to the targets in the multiple models maintained on the chain based on the fusion result The model is updated.
  • the device may further include: a sending unit (not shown in the figure), configured to use the fusion result as the first training result sent to the corresponding lower-layer node if the current layer node is not in the last layer.
  • a sending unit (not shown in the figure), configured to use the fusion result as the first training result sent to the corresponding lower-layer node if the current layer node is not in the last layer.
  • the device may further include: a calling unit (not shown in the figure) for calling a smart contract when the loss function corresponding to the target model meets a predetermined convergence condition, and the smart contract is used to calculate multiple nodes Respectively corresponding rewards, and issue respective rewards to multiple nodes, so as to increase the virtual resources corresponding to multiple nodes.
  • a calling unit (not shown in the figure) for calling a smart contract when the loss function corresponding to the target model meets a predetermined convergence condition
  • the smart contract is used to calculate multiple nodes Respectively corresponding rewards, and issue respective rewards to multiple nodes, so as to increase the virtual resources corresponding to multiple nodes.
  • the block chain-based model joint training device provided in an embodiment of this specification can ensure the safety and reliability of the model joint training process.
  • an embodiment of this specification also provides a blockchain-based model joint training device.
  • the blockchain includes multiple nodes with hierarchical relationships and adjacent There is a correspondence between the nodes of the two levels. Each of the multiple nodes maintains private data off-chain, and there are multiple models for on-chain maintenance.
  • the device is set at the current layer node of the blockchain. As shown in Figure 5, the device may include the following units.
  • the receiving unit 502 is configured to receive the first training result sent by the corresponding upper node.
  • the first training result includes at least a first type result, and the first type result is obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node.
  • the first training result also includes a second type result, and the second type result is determined by the upper node based on the result received from its corresponding upper node.
  • the training unit 504 is used to train the target model of the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result.
  • the judging unit 506 is used to judge whether the current layer node is in the last layer.
  • the fusion unit 508 is used for fusing the first training result and the second training result to obtain the fusion result if the judging unit 506 judges that the current layer node is at the last level.
  • the fusion unit 508 may be specifically configured to: average or obtain a weighted average of the first training result and the second training result to obtain the fusion result.
  • the broadcasting unit 510 is configured to broadcast the fusion result obtained by the fusion unit 508 on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
  • the device may further include: a sending unit (not shown in the figure), configured to, if the judging unit 506 judges that the current layer node is not in the last layer, use the first training result as the first training result sent to the corresponding lower layer node.
  • a sending unit (not shown in the figure), configured to, if the judging unit 506 judges that the current layer node is not in the last layer, use the first training result as the first training result sent to the corresponding lower layer node.
  • a result of the second type in the training result using the second training result as the result of the first type in the first training result sent to the corresponding lower-level node.
  • the block chain-based model joint training device provided in an embodiment of this specification can ensure the safety and reliability of the model joint training process.
  • the embodiments of this specification provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed in a computer, the computer is caused to execute the method shown in FIG. 2 or FIG. 3.
  • the embodiment of this specification provides a computing device, including a memory and a processor, the memory is stored with executable code, and when the processor executes the executable code, the implementation shown in FIG. Indicates the method.
  • the steps of the method or algorithm described in conjunction with the disclosure of this specification can be implemented in a hardware manner, or can be implemented in a manner in which a processor executes software instructions.
  • Software instructions can be composed of corresponding software modules, which can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage known in the art Medium.
  • An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium.
  • the storage medium may also be an integral part of the processor.
  • the processor and the storage medium may be located in the ASIC.
  • the ASIC may be located in the server.
  • the processor and the storage medium may also exist as discrete components in the server.
  • the functions described in the present invention can be implemented by hardware, software, firmware, or any combination thereof.
  • these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on the computer-readable medium.
  • the computer-readable medium includes a computer storage medium and a communication medium, where the communication medium includes any medium that facilitates the transfer of a computer program from one place to another.
  • the storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

Abstract

A blockchain-based model combination training method and device, wherein in the training method, a current layer node of a blockchain receives a first training result sent by a corresponding upper layer node. The first training result is determined at least on the basis of a first type of result, the first type of result is obtained by the upper layer node on the basis of its private data maintained off the chain, after training a target model in multiple models maintained on the chain. The current layer node trains the target model in the multiple models maintained on the chain on the basis of the private data maintained off the chain to obtain a second training result. The first training result and the second training result are fused to obtain a fusion result. It is determined whether the current layer node is in the last layer. If the current layer node is in the last layer, the fusion result is broadcast on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain on the basis of the fusion result.

Description

基于区块链的模型联合训练方法及装置Model joint training method and device based on blockchain 技术领域Technical field
本说明书一个或多个实施例涉及计算机技术领域,尤其涉及一种基于区块链的模型联合训练方法及装置。One or more embodiments of this specification relate to the field of computer technology, and in particular to a method and device for joint training of models based on blockchain.
背景技术Background technique
联邦学习(Federated Learning),也称联合学习,是一种新兴的人工智能基础技术。其设计目标是在保障大数据交换时的信息安全、保护终端数据和个人数据隐私、保证合法合规的前提下,在多参与方(或者计算节点或者主体)之间开展高效率的机器学习。Federated Learning, also known as joint learning, is an emerging basic technology of artificial intelligence. Its design goal is to carry out high-efficiency machine learning among multiple parties (or computing nodes or subjects) under the premise of ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legal compliance.
在传统的模型联合学习或训练过程中,为了确保各方数据的安全性,通常会对各方间交互的数据进行加密,然而其仍然存在数据泄露的风险。In the traditional model joint learning or training process, in order to ensure the security of the data of all parties, the data interacting between the parties is usually encrypted, but there is still a risk of data leakage.
因此,需要提供一种更安全地模型联合训练方法。Therefore, it is necessary to provide a safer model joint training method.
发明内容Summary of the invention
本说明书一个或多个实施例描述了一种基于区块链的模型联合训练方法及装置,可以在确保各方数据安全的情况下,高效地对模型进行联合训练。One or more embodiments of this specification describe a method and device for joint training of models based on blockchain, which can efficiently perform joint training on models while ensuring the security of data of all parties.
第一方面,提供了一种基于区块链的模型联合训练方法,包括:接收对应的上层节点发送的第一训练结果;所述第一训练结果至少基于第一类型结果确定;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;判断所述当前层节点是否在最后一个层级;若所述当前层节点在最后一个层级,则在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。In a first aspect, a method for joint training of models based on blockchain is provided, including: receiving a first training result sent by a corresponding upper node; the first training result is determined based on at least a first type of result; the first The type result is obtained by the upper-level node based on its private data maintained off-chain, after training the target model in the multiple models maintained on the chain; based on the private data maintained off-chain, it is obtained on-chain The target model among the multiple models maintained is trained to obtain the second training result; the first training result and the second training result are fused to obtain the fusion result; it is judged whether the current layer node is the last One level; if the current layer node is at the last level, the fusion result is broadcast on the blockchain, so that the multiple nodes can compare the various models maintained on the chain based on the fusion result The target model in is updated.
第二方面,提供了一种基于区块链的模型联合训练方法,包括:接收对应的上层节点发送的第一训练结果;所述第一训练结果至少包括第一类型结果;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;基于其链下维护的私有数据,对其在链上维护的多种模型中的所述 目标模型进行训练,得到第二训练结果;判断所述当前层节点是否在最后一个层级;若所述当前层节点在最后一个层级,则对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。In a second aspect, a method for joint training of models based on blockchain is provided, which includes: receiving a first training result sent by a corresponding upper node; the first training result includes at least a first type of result; the first type The result is obtained by the upper node after training the target model in the multiple models maintained on the chain based on its private data maintained off-chain; based on the private data maintained off-chain, it is maintained on-chain Training the target model of the multiple models to obtain the second training result; judging whether the current layer node is in the last level; if the current layer node is in the last level, then the first training result Fusion with the second training result to obtain the fusion result; broadcast the fusion result on the blockchain, so that the multiple nodes can compare each of the multiple models maintained on the chain based on the fusion result The target model is updated.
第三方面,提供了一种基于区块链的模型联合训练装置,包括:接收单元,用于接收对应的上层节点发送的第一训练结果;所述第一训练结果至少基于第一类型结果确定;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;训练单元,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;融合单元,用于对所述接收单元接收的所述第一训练结果和所述训练单元训练得到的所述第二训练结果进行融合,得到融合结果;判断单元,用于判断所述当前层节点是否在最后一个层级;广播单元,用于若所述判断单元判断所述当前层节点在最后一个层级,则在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。In a third aspect, there is provided a block chain-based model joint training device, including: a receiving unit for receiving a first training result sent by a corresponding upper node; the first training result is determined based on at least a first type of result The first type of result is obtained by the upper node based on its private data maintained under the chain after training the target model in the multiple models maintained on the chain; the training unit is used to base its off-chain For the maintained private data, train the target model among the multiple models maintained on the chain to obtain the second training result; the fusion unit is used to perform the training on the first training result received by the receiving unit and all the training results. The second training result obtained by the training unit is fused to obtain the fusion result; the judging unit is used to judge whether the current layer node is at the last level; the broadcasting unit is used to if the judging unit judges the current layer If the layer node is at the last level, the fusion result is broadcast on the blockchain, so that the multiple nodes perform the target model of the multiple models maintained on the chain based on the fusion result. Update.
第四方面,提供了一种基于区块链的模型联合训练装置,包括:接收单元,用于接收对应的上层节点发送的第一训练结果;所述第一训练结果至少包括第一类型结果;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;训练单元,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;判断单元,用于判断所述当前层节点是否在最后一个层级;融合单元,用于若所述判断单元判断所述当前层节点在最后一个层级,则对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;广播单元,用于在所述区块链上广播所述融合单元得到的融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。In a fourth aspect, a block chain-based model joint training device is provided, including: a receiving unit configured to receive a first training result sent by a corresponding upper node; the first training result includes at least a first type result; The first type of result is obtained by the upper node after training the target model in the multiple models maintained on the chain based on its private data maintained off-chain; the training unit is used for maintenance based on its off-chain To train the target model in the multiple models maintained on the chain to obtain the second training result; the judgment unit is used to judge whether the current layer node is at the last level; the fusion unit is used If the judging unit judges that the current layer node is at the last level, then the first training result and the second training result are fused to obtain the fusion result; the broadcasting unit is used for logging in the blockchain The fusion result obtained by the fusion unit is broadcast on the above, so that the multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
第五方面,提供了一种计算机存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行第一方面的方法或第二方面的方法。In a fifth aspect, a computer storage medium is provided with a computer program stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method of the first aspect or the method of the second aspect.
第六方面,提供了一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现第一方面的方法或第二方面的方法。In a sixth aspect, a computing device is provided, including a memory and a processor, the memory stores executable code, and when the processor executes the executable code, the method of the first aspect or the method of the second aspect is implemented method.
本说明书一个或多个实施例提供的基于区块链的模型联合训练方法及装置,区块链 的每层节点可以接收对应的上层节点发送的训练结果,并可以将接收的训练结果与自身的训练结果进行融合后发送至对应的下层节点,或者直接将两种训练结果转发至对应的下层节点,直至到达最后一层节点。最后一层节点将全部的训练结果进行融合,得到最终训练结果,并在区块链上广播该最终训练结果,从而使得各节点均可以更新对应的模型,至此就实现了基于区块链的模型联合训练。也即本说明书提供的方案,可以基于区块链来实现模型的联合训练,由此可以保证模型联合训练过程的安全可靠。One or more embodiments of this specification provide a blockchain-based model joint training method and device. Each layer node of the blockchain can receive the training result sent by the corresponding upper node, and can compare the received training result with its own The training results are fused and sent to the corresponding lower-level nodes, or the two training results are directly forwarded to the corresponding lower-level nodes, until the last-level node is reached. The last layer of nodes integrates all the training results to obtain the final training result, and broadcasts the final training result on the blockchain, so that each node can update the corresponding model, thus achieving the blockchain-based model Joint training. That is to say, the solution provided in this specification can realize the joint training of the model based on the blockchain, thereby ensuring the safety and reliability of the joint training process of the model.
附图说明Description of the drawings
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to explain the technical solutions of the embodiments of this specification more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the specification. A person of ordinary skill in the art can obtain other drawings based on these drawings without creative work.
图1为本说明书提供的基于区块链的模型联合训练方法实施场景示意图;Figure 1 is a schematic diagram of the implementation scenario of the blockchain-based model joint training method provided in this manual;
图2为本说明书一个实施例提供的基于区块链的模型联合训练方法流程图;FIG. 2 is a flowchart of a model joint training method based on blockchain provided by an embodiment of this specification;
图3为本说明书另一个实施例提供的基于区块链的模型联合训练方法流程图;FIG. 3 is a flowchart of a model joint training method based on blockchain provided by another embodiment of this specification;
图4为本说明书一个实施例提供的基于区块链的模型联合训练装置示意图;Figure 4 is a schematic diagram of a block chain-based model joint training device provided by an embodiment of this specification;
图5为本说明书另一个实施例提供的基于区块链的模型联合训练装置示意图。Fig. 5 is a schematic diagram of a block chain-based model joint training device provided by another embodiment of this specification.
具体实施方式Detailed ways
下面结合附图,对本说明书提供的方案进行描述。The following describes the solutions provided in this specification with reference to the accompanying drawings.
在描述本说明书提供的方案之前,先对本方案的发明构思作以下说明。Before describing the solution provided in this specification, the following description of the inventive concept of this solution is provided.
如背景技术所述,传统的模型联合训练方法存在数据泄露的风险,为了确保各方数据的安全性,本方案将基于区块链实现模型的联合训练。区块链是借由密码学串接并保护内容的串连文字记录。每一个区块包含了前一个区块的加密散列、相应时间戳记以及交易数据,这样的设计使得区块内容具有难以篡改的特性。用区块链技术所串接的分布式账本能让两方有效记录交易,且可永久查验此交易。As described in the background art, the traditional model joint training method has the risk of data leakage. In order to ensure the security of the data of all parties, this solution will implement the joint training of the model based on the blockchain. Blockchain is a series of text records that are connected and protected by cryptography. Each block contains the encrypted hash of the previous block, the corresponding time stamp and transaction data. This design makes the block content difficult to tamper with. The distributed ledger connected by blockchain technology allows two parties to effectively record the transaction, and the transaction can be permanently checked.
其具体实现思路可以为:首先可以将区块链中的各节点划分为多个层级,并建立相邻两个层级的节点之间的对应关系。之后,区块链的每层节点可以接收对应的上层节点 发送的训练结果,并可以将接收的训练结果与自身的训练结果进行融合后发送至对应的下层节点,或者直接将两种训练结果转发至对应的下层节点,直至到达最后一层节点。最后一层节点将全部的训练结果进行融合,得到最终训练结果,并在区块链上广播该最终训练结果,从而使得各节点均可以更新对应的模型,至此就实现了基于区块链的模型联合训练。The specific realization idea can be as follows: first, each node in the blockchain can be divided into multiple levels, and the corresponding relationship between the nodes of two adjacent levels can be established. After that, each layer node of the blockchain can receive the training result sent by the corresponding upper node, and can merge the received training result with its own training result and send it to the corresponding lower node, or directly forward the two training results To the corresponding lower-level node, until reaching the last-level node. The last layer of nodes integrates all the training results to obtain the final training result, and broadcasts the final training result on the blockchain, so that each node can update the corresponding model, thus achieving the blockchain-based model Joint training.
以上就是本说明书提供的发明构思,基于该发明构思就可以得到本方案,以下对本方案进行详细阐述。The above is the inventive concept provided in this specification, and the solution can be obtained based on the inventive concept. The solution will be described in detail below.
图1为本说明书提供的基于区块链的模型联合训练方法实施场景示意图。图1中,节点1-节点15为区块链中的节点,各个节点按照层级关系组织。具体地,节点1-节点8在第1个层级,节点9-节点12在第2个层级,节点13-节点14在第3个层级,节点15在第4个层级(也即最后一个层级)。此外,第1个层级的节点1-节点2对应于第2个层级的节点9,第1个层级的节点3-节点4对应于第2个层级的节点10,第1个层级的节点5-节点6对应于第2个层级的节点11,第1个层级的节点7-节点8对应于第2个层级的节点12。第2个层级的节点9-节点10对应于第3个层级的节点13,第2个层级的节点11-节点12对应于第3个层级的节点14。第3个层级的节点13-节点14对应于最后一个层级的节点15。Figure 1 is a schematic diagram of the implementation scenario of the blockchain-based model joint training method provided in this specification. In Figure 1, nodes 1 to 15 are nodes in the blockchain, and each node is organized according to a hierarchical relationship. Specifically, node 1 to node 8 is in the first level, node 9 to node 12 is in the second level, node 13 to node 14 is in the third level, and node 15 is in the fourth level (that is, the last level) . In addition, node 1-node 2 of the first level corresponds to node 9 of the second level, node 3-node 4 of the first level corresponds to node 10 of the second level, and node 5 of the first level. The node 6 corresponds to the node 11 of the second level, and the node 7-node 8 of the first level corresponds to the node 12 of the second level. The node 9-node 10 of the second level corresponds to the node 13 of the third level, and the node 11-node 12 of the second level corresponds to the node 14 of the third level. The node 13-node 14 of the third level corresponds to the node 15 of the last level.
图1中的每个节点可以表征一个参与方。上述每个节点在链上可以维护多种模型。这里的多种模型可以包括逻辑回归(Logistic Regression,LR)模型、梯度提升决策树(Gradient Boosting Decision Tree,GBDT)模型以及(Deep Neural Networks,DNN)模型中的至少一项。上述多种模型中的任一模型可以是由某个节点预先提交到区块链上。可以理解的是,针对提交到区块链上的模型,各节点均可以执行相应的计算(如,训练)。此外,区块链中的每个节点在链下还可以维护自身的私有数据。在一个示例中,各节点可以通过在相应区块记录中包含指向的链下数据的指针,来实现各自对链下数据的维护。Each node in Figure 1 can represent a participant. Each of the above nodes can maintain multiple models on the chain. The multiple models here may include at least one of a Logistic Regression (LR) model, a Gradient Boosting Decision Tree (GBDT) model, and a (Deep Neural Networks, DNN) model. Any one of the above-mentioned multiple models may be submitted to the blockchain in advance by a certain node. It is understandable that for the model submitted to the blockchain, each node can perform corresponding calculations (eg, training). In addition, each node in the blockchain can also maintain its own private data under the chain. In an example, each node can implement the maintenance of the off-chain data by including a pointer to the off-chain data in the corresponding block record.
图1中,任务处理器(task rebuilder)可以在区块链上发布模型训练任务。这里的任务处理器可以为单独的服务器,也可以设置于区块链中的任一节点。此外,上述模型训练任务至少指示待训练的目标模型。需要说明的是,在发布上述模型训练任务后,只有第1个层级的各个节点会执行训练任务,而其它层级的节点则等待接收对应节点的训练结果,之后才开始执行训练任务。In Figure 1, the task rebuilder can publish model training tasks on the blockchain. The task processor here can be a separate server, or it can be set on any node in the blockchain. In addition, the aforementioned model training task at least indicates the target model to be trained. It should be noted that after the above-mentioned model training task is released, only the nodes of the first level will perform the training task, and the nodes of other levels will wait to receive the training result of the corresponding node before starting the training task.
以第1个层级的节点1-节点2为例来说,在发布上述模型训练任务后,节点1-节点 2可以从其在链上维护的多种模型中选取出目标模型,并基于其在链下维护的私有数据,对选取的目标模型进行训练。之后,节点1和节点2可以将各自的训练结果(如,模型梯度和/或模型参数)发送至节点9。节点9可以获取对应的训练结果,并将接收的训练结果和自身获取的训练结果融合后,或者直接全部转发至节点13等等,依次类推,直至到达节点15。节点15可以融合所有的训练结果,并将融合结果发布到区块链上,从而各节点基于该融合结果,更新各自维护的目标模型。Take node 1 to node 2 of the first level as an example. After publishing the above model training task, node 1 to node 2 can select the target model from a variety of models maintained on the chain, and based on its The private data maintained under the chain trains the selected target model. After that, node 1 and node 2 may send their respective training results (eg, model gradient and/or model parameters) to node 9. The node 9 can obtain the corresponding training result, and merge the received training result with the training result obtained by itself, or directly forward all the training results to the node 13 and so on, and so on, until the node 15 is reached. The node 15 can fuse all the training results and publish the fusion result to the blockchain, so that each node updates the target model maintained by each node based on the fusion result.
在此说明,受限于篇幅,图1只列出了四个层级的节点,且下一层级的各节点只与上一层级的两个节点相对应,实际上区块链中还可以包括超过四个层级的节点,且下一层级的各节点可以与上一层级的超过两个的节点相对应,本说明书对此不作限定。It is explained here that due to space limitations, Figure 1 only lists four levels of nodes, and each node of the next level only corresponds to the two nodes of the previous level. In fact, the blockchain can also include more than There are four levels of nodes, and each node of the next level can correspond to more than two nodes of the previous level, which is not limited in this specification.
需要说明的是,区块链上的链式哈希指针可以确保几乎不可能存在更改或删除区块链上的记录的可能性。此外,区块链上的记录还可以包含指向链下私有数据的指针。指针与哈希指针一起可用于验证链下数据的完整性。这样一来,区块链还可以保护链下数据的完整性。保护链上和链下记录的完整性从本质上阻止了欺诈性删除或更改记录以谋取个人利益。It should be noted that the chain hash pointer on the blockchain can ensure that it is almost impossible to change or delete records on the blockchain. In addition, records on the blockchain can also contain pointers to private data off-chain. The pointer and hash pointer together can be used to verify the integrity of the data off the chain. In this way, the blockchain can also protect the integrity of off-chain data. Protecting the integrity of on-chain and off-chain records essentially prevents fraudulent deletion or alteration of records for personal gain.
另外,区块链提供附加到区块链的记录的近实时透明性,即这些新记录对区块链的各个节点可见。这提高了此类节点检测欺诈性记录的能力。这种透明性的存在和仅被发现的可能性就将极大地阻止欺诈行为。In addition, the blockchain provides near real-time transparency of records attached to the blockchain, that is, these new records are visible to each node of the blockchain. This improves the ability of such nodes to detect fraudulent records. The existence of this transparency and the mere possibility of being discovered will greatly deter fraud.
综上,本方案可以确保模型联合训练过程的安全性。In summary, this solution can ensure the safety of the model joint training process.
图2为本说明书一个实施例提供的基于区块链的模型联合训练方法流程图。所述方法的执行主体可以为图1中区块链的第2-4个层级的节点中任一节点。如图2所示,所述方法具体可以包括步骤202至步骤210。Fig. 2 is a flowchart of a model joint training method based on blockchain provided by an embodiment of this specification. The execution subject of the method can be any node among the nodes of the 2-4th level of the blockchain in FIG. 1. As shown in FIG. 2, the method may specifically include step 202 to step 210.
步骤202,接收对应的上层节点发送的第一训练结果。Step 202: Receive the first training result sent by the corresponding upper node.
关于上述第一训练结果,这里分两种情况进行说明,第一种,上述上层节点不存在对应的上层节点,也即上层节点为第1个层级的节点,则第一训练结果基于第一类型结果确定,如,将第一类型结果作为第一训练结果。这里的第一类型结果由上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到。第二种,上述上层节点还存在对应的上层节点,也即上层节点为非第1个层级的节点,则第一训练结果基于第一类型结果和第二类型结果确定,其中,第二类型结果由上层节点基于从其对应的上层节点接收的结果确定。在一个示例中,可以对第一类型结果和第 二类型结果进行求平均或者求加权平均得到第一训练结果。Regarding the above-mentioned first training result, here is explained in two cases. In the first case, the above-mentioned upper-level node does not have a corresponding upper-level node, that is, the upper-level node is a node of the first level, and the first training result is based on the first type The result is determined, for example, the first type of result is used as the first training result. The first type of result here is obtained by the upper node based on the private data maintained off-chain by the target model of the multiple models maintained on the chain. In the second type, the above-mentioned upper-level node also has a corresponding upper-level node, that is, the upper-level node is a non-first-level node, then the first training result is determined based on the first-type result and the second-type result, where the second-type result It is determined by the upper node based on the result received from its corresponding upper node. In an example, the first training result can be obtained by averaging the results of the first type and the second type, or by calculating the weighted average.
需要说明的是,上述目标模型可以由任务处理器在发布模型训练任务时指定。如,可以为LR模型、GBDT模型或者DNN模型中的任一种。此外,上述第一类型结果或者第二类型结果可以是指目标模型的中间模型梯度和/或中间模型参数。It should be noted that the above-mentioned target model may be specified by the task processor when issuing the model training task. For example, it can be any of LR model, GBDT model or DNN model. In addition, the above-mentioned first type result or second type result may refer to the intermediate model gradient and/or the intermediate model parameter of the target model.
还需要说明的是,上述第一训练结果的个数可以基于对应的上层节点的个数确定。也即在对应的上层节点的个数为多个时,上述第一训练结果的个数也可以为多个。It should also be noted that the number of the aforementioned first training results may be determined based on the number of corresponding upper-level nodes. That is, when the number of corresponding upper-layer nodes is multiple, the number of the above-mentioned first training results may also be multiple.
以下结合图1对上述第一训练结果进行说明。The above-mentioned first training result will be described below in conjunction with FIG. 1.
以图1中第2个层级的节点9为例来说,节点9可以接收节点1和节点2各自发送的第一训练结果,也即节点9接收到的第一训练结果的个数为两个。其中,节点1(或节点2)发送的第一训练结果即为第一类型结果,即其由节点1(或节点2)在接收到任务处理器在区块链上发布的模型训练任务时,基于在链下维护的私有数据,对目标模型进行训练后得到。Taking node 9 at the second level in Figure 1 as an example, node 9 can receive the first training results sent by node 1 and node 2, that is, the number of first training results received by node 9 is two . Among them, the first training result sent by node 1 (or node 2) is the first type result, that is, when node 1 (or node 2) receives the model training task issued by the task processor on the blockchain, It is obtained after training the target model based on the private data maintained under the chain.
而对于第3个层级的节点13,其可以接收节点9和节点10各自发送的第一训练结果,也即节点13接收到的第一训练结果的个数为两个。其中,节点9(或节点10)发送的第一训练结果基于第一类型结果和第二类型结果确定。对于节点9,对应的第一类型结果由节点9在接收到节点1和节点2发送的第一训练结果时,基于在链下维护的私有数据,对目标模型进行训练后得到。而对应的第二类型结果是由节点9在对节点1和节点2发送的第一训练结果融合后得到。For the node 13 of the third level, it can receive the first training results sent by the node 9 and the node 10 respectively, that is, the number of the first training results received by the node 13 is two. Wherein, the first training result sent by the node 9 (or the node 10) is determined based on the first type result and the second type result. For node 9, the corresponding first type result is obtained by node 9 after receiving the first training result sent by node 1 and node 2, based on the private data maintained under the chain, after training the target model. The corresponding second type result is obtained by node 9 after fusing the first training results sent by node 1 and node 2.
步骤204,基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。Step 204, based on the private data maintained off-chain, train the target model among the multiple models maintained on the chain to obtain a second training result.
如,第2个层级的节点9可以对目标模型进行训练,从而得到第二训练结果。再如,第3个层级的节点13可以对目标模型进行训练,从而得到第二训练结果。For example, the node 9 of the second level can train the target model to obtain the second training result. For another example, the node 13 of the third level can train the target model to obtain the second training result.
步骤206,对第一训练结果和第二训练结果进行融合,得到融合结果。In step 206, the first training result and the second training result are fused to obtain a fusion result.
如,可以将第一训练结果作为新的第二类型结果,并将第二训练结果作为新的第一类型结果进行求平均或者求加权平均,得到融合结果。For example, the first training result can be used as the new second type result, and the second training result can be used as the new first type result for averaging or weighted average to obtain the fusion result.
如,第2个层级的节点9,其可以将从节点1和节点2接收的两个第一训练结果分别作为两个新的第二类型结果,此外,还可以将其自身得到的第二训练结果作为新的第一类型结果。之后,对两个新的第二类型结果以及新的第一类型结果进行求平均或者求 加权平均,得到融合结果。可以理解的是,该融合结果即为节点9发送到节点13的第一训练结果。For example, the node 9 of the second level can use the two first training results received from node 1 and node 2 as two new second-type results, in addition, it can also use the second training results obtained by itself. The result is the new first type result. After that, the two new second-type results and the new first-type results are averaged or weighted to obtain the fusion result. It is understandable that the fusion result is the first training result sent by node 9 to node 13.
再如,第3个层级的节点13,其可以将从节点9和节点10接收的两个第一训练结果分别作为两个新的第二类型结果,此外,还可以将其自身得到的第二训练结果作为新的第一类型结果。之后,对两个新的第二类型结果以及新的第一类型结果进行求平均或者求加权平均,得到融合结果。可以理解的是,该融合结果即为节点13发送到节点15的第一训练结果。For another example, the node 13 at the third level can use the two first training results received from the node 9 and the node 10 as two new second-type results, and in addition, it can also use the second-type results obtained by itself. The training result is regarded as the new first type result. After that, the two new second-type results and the new first-type results are averaged or weighted to obtain the fusion result. It can be understood that the fusion result is the first training result sent by node 13 to node 15.
步骤208,判断当前层节点是否在最后一个层级。Step 208: Determine whether the current layer node is in the last layer.
步骤210,若当前层节点在最后一个层级,则在区块链上广播融合结果,以使得多个节点基于融合结果对各自在链上维护的多种模型中的目标模型进行更新。Step 210: If the current layer node is at the last level, broadcast the fusion result on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
以图1中的第4个层级的节点15为例来说,由于节点15在最后一个层级,其可以其区块链上广播融合结果。可以理解的是,这里的融合结果可以是指目标模型的总模型梯度或者总模型参数。Taking the node 15 of the fourth level in FIG. 1 as an example, since the node 15 is at the last level, it can broadcast the fusion result on its blockchain. It is understandable that the fusion result here may refer to the total model gradient or the total model parameters of the target model.
若融合结果为总模型梯度,那么各节点在接收到总模型梯度之后,可以基于该总模型梯度,确定总模型参数。之后,基于总模型参数,对各自对应的目标模型进行更新。If the fusion result is the total model gradient, each node can determine the total model parameters based on the total model gradient after receiving the total model gradient. After that, based on the total model parameters, the corresponding target models are updated.
若融合结果为总模型参数,各节点在接收到总模型参数之后,可以直接基于总模型参数,对各自对应的目标模型进行更新。If the fusion result is the overall model parameter, after each node receives the overall model parameter, it can directly update the corresponding target model based on the overall model parameter.
以上是对当前层节点在最后一个层级的情况说明,以下对当前层节点不在最后一个层级的情况进行描述。The above is the description of the case where the current layer node is at the last level, and the following describes the case where the current layer node is not at the last level.
若当前层节点不在最后一个层级,则将融合结果作为发送到对应的下层节点的第一训练结果。If the current layer node is not in the last layer, the fusion result is used as the first training result sent to the corresponding lower layer node.
以第2个层级的节点9为例来说,其可以将对应的融合结果作为第一训练结果发送到节点13。Taking the node 9 of the second level as an example, it can send the corresponding fusion result to the node 13 as the first training result.
再以第3个层级的节点13为例来说,其可以将对应的融合结果作为第一训练结果发送到节点15。Taking the node 13 of the third level as an example, it can send the corresponding fusion result to the node 15 as the first training result.
需要说明的是,在执行步骤210之后,只完成了目标模型的一轮迭代训练。若一轮迭代结束之后,目标模型对应的损失函数是否达到预定的收敛条件,则模型联合训练结束;否则,进入下一轮迭代,直至目标模型对应的损失函数达到预定的收敛条件。可以 理解的是,下一轮迭代的过程基于更新后的目标模型执行。It should be noted that after step 210 is executed, only one round of iterative training of the target model is completed. If after one round of iteration, the loss function corresponding to the target model reaches the predetermined convergence condition, the joint model training ends; otherwise, the next round of iteration is entered until the loss function corresponding to the target model reaches the predetermined convergence condition. It is understandable that the next iteration of the process is executed based on the updated target model.
在目标模型对应的损失函数满足预定的收敛条件时,模型联合训练结束。任务处理器可以调用智能合约,智能合约被用于计算多个节点各自对应的奖励,并向多个节点发放各自对应的奖励,以使多个节点各自对应的虚拟资源增加。When the loss function corresponding to the target model meets the predetermined convergence condition, the joint training of the model ends. The task processor can call the smart contract, and the smart contract is used to calculate the respective rewards of multiple nodes, and distribute the respective rewards to the multiple nodes, so as to increase the respective virtual resources of the multiple nodes.
在一个例子中,智能合约的实现原理如下:假设第t次提交数据(或算法)对已有模型增益是A_t,对于每次提交数据(或者算法)h,定义一个loss function L(h,t)。最后节点对应的奖励是A_t–L(h,t)。In an example, the implementation principle of a smart contract is as follows: Assuming that the t-th submitted data (or algorithm) gains A_t to the existing model, for each submitted data (or algorithm) h, define a loss function L(h,t ). The reward corresponding to the last node is A_t–L(h,t).
上述模型增益可以通过计算Shapley value值得到。Shapley value是通过考虑各个节点做出的贡献,来公平地分配合作收益。The above model gain can be obtained by calculating the Shapley value. Shapley value is to fairly distribute the benefits of cooperation by considering the contributions made by each node.
还需要说明的是,步骤202-步骤210是在模型联合训练过程中,非第1个层级的节点所进行的操作。可以理解的是,对于第1个层级的各节点,其可以在接收到任务处理器在区块链上发布的模型训练任务时,基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。之后,可以将第二训练结果作为发送到对应的下层节点(即第2个层级的节点)的第一训练结果。从而对应的下层节点就可以执行上述步骤202-步骤210,直至到达最后一个层级的节点。It should also be noted that step 202 to step 210 are operations performed by nodes other than the first level in the model joint training process. It is understandable that, for each node of the first level, when it receives the model training task issued by the task processor on the blockchain, it can maintain it on the chain based on the private data maintained under the chain. The target model among multiple models is trained, and the second training result is obtained. After that, the second training result can be used as the first training result sent to the corresponding lower-level node (that is, the second-level node). Therefore, the corresponding lower-level node can execute the above-mentioned step 202-step 210 until the node of the last level is reached.
综上,本说明书实施例提供的基于区块链的模型联合训练方法作出了以下几点创新:第一,创新性的提出把区块链引入联邦学习中。第二,运用区块链的哈希指针技术解决链上和链下数据的完整性。第三,运用区块链的数字签名技术解决机器学习模型数据来源的真实性。第四,利用区块链的智能合约技术解决了联邦学习中的促进数据共享和算法共建的激励和惩罚机制问题。第五,在区块链上实现了联邦学习的过程。In summary, the blockchain-based model joint training method provided by the embodiments of this specification has made the following innovations: First, innovatively propose to introduce blockchain into federated learning. Second, use the hash pointer technology of the blockchain to solve the integrity of the data on and off the chain. Third, use the digital signature technology of the blockchain to solve the authenticity of the data source of the machine learning model. Fourth, the use of blockchain's smart contract technology solves the problem of incentive and punishment mechanisms that promote data sharing and algorithm co-construction in federated learning. Fifth, the process of federated learning is realized on the blockchain.
基于上述几方面的创新点,可以保证各参与方的私有数据和模型训练结果的真实性,完整性,可溯源性。此外,智能合约的使用可以促进各参与方之间的协作能力。Based on the above innovations, the authenticity, completeness, and traceability of the private data and model training results of each participant can be guaranteed. In addition, the use of smart contracts can promote collaboration capabilities among various participants.
图3为本说明书另一个实施例提供的基于区块链的模型联合训练方法流程图。所述方法的执行主体可以为图1中区块链的第2-4个层级的节点中任一节点。如图3所示,所述方法具体可以包括步骤302至步骤310。Fig. 3 is a flowchart of a model joint training method based on blockchain provided by another embodiment of this specification. The execution subject of the method can be any node among the nodes of the 2-4th level of the blockchain in FIG. 1. As shown in FIG. 3, the method may specifically include step 302 to step 310.
步骤302,接收对应的上层节点发送的第一训练结果。Step 302: Receive the first training result sent by the corresponding upper node.
关于上述第一训练结果,这里分两种情况进行说明,第一种,上述上层节点不存在对应的上层节点,也即上层节点为第1个层级的节点,则第一训练结果只包括第一类型 结果,这里的第一类型结果由上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到。第二种,上述上层节点还存在对应的上层节点,也即上层节点为非第1个层级的节点,则第一训练结果包括第一类型结果和第二类型结果。其中,第二类型结果由上层节点基于从其对应的上层节点接收的结果确定。如,该第二类型结果由上层节点对应的各上层节点的训练结果构成。Regarding the above-mentioned first training result, here are two cases for explanation. In the first case, the above-mentioned upper-level node does not have a corresponding upper-level node, that is, the upper-level node is a node of the first level, and the first training result only includes the first-level node. Type results. The first type results here are obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node. In the second type, the above-mentioned upper-level node also has a corresponding upper-level node, that is, the upper-level node is a non-first-level node, and the first training result includes a first-type result and a second-type result. Wherein, the second type result is determined by the upper node based on the result received from its corresponding upper node. For example, the second type result is composed of the training results of each upper node corresponding to the upper node.
需要说明的是,上述目标模型可以由任务处理器在发布模型训练任务时指定。如,可以为LR模型、GBDT模型或者DNN模型中的任一种。此外,上述第一类型结果或者第二类型结果可以是指目标模型的中间模型梯度和/或中间模型参数。It should be noted that the above-mentioned target model may be specified by the task processor when issuing the model training task. For example, it can be any of LR model, GBDT model or DNN model. In addition, the above-mentioned first type result or second type result may refer to the intermediate model gradient and/or the intermediate model parameter of the target model.
还需要说明的是,上述第一训练结果的个数可以基于对应的上层节点的个数确定。也即在对应的上层节点的个数为多个时,上述第一训练结果的个数也可以为多个。It should also be noted that the number of the aforementioned first training results may be determined based on the number of corresponding upper-level nodes. That is, when the number of corresponding upper-layer nodes is multiple, the number of the above-mentioned first training results may also be multiple.
以图1中第2个层级的节点9为例来说,节点9可以接收节点1和节点2各自发送的第一训练结果,也即节点9接收到的第一训练结果的个数为两个。其中,节点1(或节点2)发送的第一训练结果只包括第一类型结果,即其由节点1(或节点2)在接收到任务处理器在区块链上发布的模型训练任务时,基于在链下维护的私有数据,对目标模型进行训练后得到。Taking node 9 at the second level in Figure 1 as an example, node 9 can receive the first training results sent by node 1 and node 2, that is, the number of first training results received by node 9 is two . Among them, the first training result sent by node 1 (or node 2) only includes the first type of result, that is, when node 1 (or node 2) receives the model training task issued by the task processor on the blockchain, It is obtained after training the target model based on the private data maintained under the chain.
而对于第3个层级的节点13,其可以接收节点9和节点10各自发送的第一训练结果,也即节点13接收到的第一训练结果的个数为两个。其中,节点9(或节点10)发送的第一训练结果包括第一类型结果和第二类型结果。对于节点9,对应的第一类型结果由节点9在接收到节点1和节点2发送的第一训练结果时,基于在链下维护的私有数据,对目标模型进行训练后得到。而对应的第二类型结果由对应于节点9的节点1和节点2发送的第一训练结果构成。For the node 13 of the third level, it can receive the first training results sent by the node 9 and the node 10 respectively, that is, the number of the first training results received by the node 13 is two. Wherein, the first training result sent by the node 9 (or the node 10) includes the first type result and the second type result. For node 9, the corresponding first type result is obtained by node 9 after receiving the first training result sent by node 1 and node 2, based on the private data maintained under the chain, after training the target model. The corresponding second type result is composed of the first training result sent by node 1 and node 2 corresponding to node 9.
步骤304,基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。Step 304: Based on the private data maintained off-chain, train the target model among the multiple models maintained on-chain to obtain a second training result.
如,第2个层级的节点9可以对目标模型进行训练,从而得到第二训练结果。再如,第3个层级的节点13可以对目标模型进行训练,从而得到第二训练结果。For example, the node 9 of the second level can train the target model to obtain the second training result. For another example, the node 13 of the third level can train the target model to obtain the second training result.
步骤306,判断当前层节点是否在最后一个层级。Step 306: Determine whether the current layer node is in the last layer.
步骤308,若当前层节点在最后一个层级,则对第一训练结果和第二训练结果进行融合,得到融合结果。Step 308: If the current layer node is in the last layer, the first training result and the second training result are fused to obtain the fusion result.
如,可以对第一训练结果和第二训练结果进行求平均或者求加权平均,得到融合结果。For example, the first training result and the second training result can be averaged or weighted averaged to obtain the fusion result.
如,第4个层级的节点15,其可以将从节点13和节点14接收的两个第一训练结果和其自身得到的第二训练结果进行求平均或者求加权平均,得到融合结果。For example, the node 15 of the fourth level can average or calculate the weighted average of the two first training results received from the node 13 and the node 14 and the second training result obtained by itself to obtain the fusion result.
可以理解的是,这里相当于是对所有的节点的训练结果进行汇总计算。It is understandable that this is equivalent to a summary calculation of the training results of all nodes.
而若当前层节点不在最后一个层级,则将第一训练结果作为发送到对应的下层节点的第一训练结果中的第二类型结果,将第二训练结果作为发送到对应的下层节点的第一训练结果中的第一类型结果。If the current layer node is not in the last layer, the first training result is used as the second type result of the first training result sent to the corresponding lower layer node, and the second training result is used as the first training result sent to the corresponding lower layer node. The first type of training result.
如,第2个层级的节点9,其可以将从节点1和节点2接收的两个第一训练结果分别作为两个新的第二类型结果,此外,还可以将其自身得到的第二训练结果作为新的第一类型结果。之后,将该两个新的第二类型结果以及新的第一类型结果作为发送到节点13的第一训练结果中的两部分。For example, the node 9 of the second level can use the two first training results received from node 1 and node 2 as two new second-type results, in addition, it can also use the second training results obtained by itself. The result is the new first type result. After that, the two new results of the second type and the new results of the first type are used as two parts of the first training result sent to the node 13.
步骤310,在区块链上广播融合结果,以使得多个节点基于融合结果对各自在链上维护的多种模型中的目标模型进行更新。Step 310: Broadcast the fusion result on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
可以理解的是,这里的融合结果可以是指目标模型的总模型梯度或者总模型参数。It is understandable that the fusion result here may refer to the total model gradient or the total model parameters of the target model.
若融合结果为总模型梯度,那么各节点在接收到总模型梯度之后,可以基于该总模型梯度,确定总模型参数。之后,基于总模型参数,对各自对应的目标模型进行更新。If the fusion result is the total model gradient, each node can determine the total model parameters based on the total model gradient after receiving the total model gradient. After that, based on the total model parameters, the corresponding target models are updated.
若融合结果为总模型参数,各节点在接收到总模型参数之后,可以直接基于总模型参数,对各自对应的目标模型进行更新。If the fusion result is the overall model parameter, after each node receives the overall model parameter, it can directly update the corresponding target model based on the overall model parameter.
同样地,在执行步骤310之后,只完成了目标模型的一轮迭代训练。若一轮迭代结束之后,目标模型对应的损失函数是否达到预定的收敛条件,则模型联合训练结束;否则,进入下一轮迭代,直至目标模型对应的损失函数达到预定的收敛条件。可以理解的是,下一轮迭代的过程基于更新后的目标模型执行。Similarly, after performing step 310, only one round of iterative training of the target model is completed. If after one round of iteration, the loss function corresponding to the target model reaches the predetermined convergence condition, the joint model training ends; otherwise, the next round of iteration is entered until the loss function corresponding to the target model reaches the predetermined convergence condition. It is understandable that the next iteration of the process is executed based on the updated target model.
还需要说明的是,步骤302-步骤310是在模型联合训练过程中,非第1个层级的节点所进行的操作。可以理解的是,对于第1个层级的各节点,其可以在接收到任务处理器在区块链上发布的模型训练任务时,基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。之后,可以将第二训练结果作为发送到对应的下层节点(即第2个层级的节点)的第一训练结果。从而对应的下层节点 就可以执行上述步骤302-步骤310,直至到达最后一个层级的节点。It should also be noted that steps 302 to 310 are operations performed by nodes other than the first level in the model joint training process. It is understandable that, for each node of the first level, when it receives the model training task issued by the task processor on the blockchain, it can maintain it on the chain based on the private data maintained under the chain. The target model among multiple models is trained, and the second training result is obtained. After that, the second training result can be used as the first training result sent to the corresponding lower-level node (that is, the second-level node). Therefore, the corresponding lower-level node can execute the above-mentioned steps 302-310 until the node of the last level is reached.
本说明书实施例提供的基于区块链的模型联合训练方法,可以基于区块链来实现模型的联合训练,由此可以保证模型联合训练过程的安全可靠。The block chain-based model joint training method provided in the embodiment of this specification can realize the joint training of the model based on the block chain, thereby ensuring the safety and reliability of the model joint training process.
与上述基于区块链的模型联合训练方法对应地,本说明书一个实施例还提供的一种基于区块链的模型联合训练装置,该区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系。多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型。该装置设置于区块链的当前层节点,如图4所示,该装置可以包括以下单元。Corresponding to the aforementioned blockchain-based model joint training method, an embodiment of this specification also provides a blockchain-based model joint training device. The blockchain includes multiple nodes with hierarchical relationships and adjacent There is a correspondence between the nodes of the two levels. Each of the multiple nodes maintains private data off-chain, and there are multiple models for on-chain maintenance. The device is set at the current layer node of the blockchain. As shown in Figure 4, the device may include the following units.
接收单元402,用于接收对应的上层节点发送的第一训练结果。该第一训练结果至少基于第一类型结果确定,第一类型结果由上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到。The receiving unit 402 is configured to receive the first training result sent by the corresponding upper node. The first training result is determined based on at least the first type of result, and the first type of result is obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node.
若上层节点还存在对应的上层节点,则第一训练结果基于第一类型结果和第二类型结果共同确定,第二类型结果由上层节点基于从其对应的上层节点接收的结果确定。If the upper node still has a corresponding upper node, the first training result is determined based on the first type result and the second type result, and the second type result is determined by the upper node based on the result received from its corresponding upper node.
训练单元404,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。The training unit 404 is used to train the target model among the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result.
融合单元406,用于对接收单元402接收的第一训练结果和训练单元404训练得到的第二训练结果进行融合,得到融合结果。The fusion unit 406 is configured to fuse the first training result received by the receiving unit 402 and the second training result obtained by the training unit 404 to obtain a fusion result.
融合单元406具体用于:将第一训练结果作为新的第二类型结果,并将第二训练结果作为新的第一类型结果进行求平均或者求加权平均,得到融合结果。The fusion unit 406 is specifically configured to: use the first training result as the new second-type result, and use the second training result as the new first-type result to average or calculate a weighted average to obtain the fusion result.
这里的融合结果可以包括目标模型的总模型梯度和/或总模型参数。The fusion result here may include the total model gradient and/or the total model parameters of the target model.
判断单元408,用于判断当前层节点是否在最后一个层级。The judging unit 408 is used to judge whether the current layer node is in the last layer.
广播单元410,用于若判断单元408判断当前层节点在最后一个层级,则在区块链上广播融合结果,以使得多个节点基于融合结果对各自在链上维护的多种模型中的目标模型进行更新。The broadcasting unit 410 is configured to, if the judging unit 408 judges that the current layer node is at the last level, broadcast the fusion result on the blockchain, so that multiple nodes can respond to the targets in the multiple models maintained on the chain based on the fusion result The model is updated.
可选地,该装置还可以包括:发送单元(图中未示出),用于若当前层节点不在最后一个层级,则将融合结果作为发送到对应的下层节点的第一训练结果。Optionally, the device may further include: a sending unit (not shown in the figure), configured to use the fusion result as the first training result sent to the corresponding lower-layer node if the current layer node is not in the last layer.
可选地,该装置还可以包括:调用单元(图中未示出),用于在目标模型对应的损 失函数满足预定的收敛条件时,调用智能合约,该智能合约被用于计算多个节点各自对应的奖励,并向多个节点发放各自对应的奖励,以使多个节点各自对应的虚拟资源增加。Optionally, the device may further include: a calling unit (not shown in the figure) for calling a smart contract when the loss function corresponding to the target model meets a predetermined convergence condition, and the smart contract is used to calculate multiple nodes Respectively corresponding rewards, and issue respective rewards to multiple nodes, so as to increase the virtual resources corresponding to multiple nodes.
本说明书上述实施例装置的各功能模块的功能,可以通过上述方法实施例的各步骤来实现,因此,本说明书一个实施例提供的装置的具体工作过程,在此不复赘述。The function of each functional module of the device in the above-mentioned embodiment of this specification can be realized by the steps of the above-mentioned method embodiment. Therefore, the specific working process of the device provided in an embodiment of this specification will not be repeated here.
本说明书一个实施例提供的基于区块链的模型联合训练装置,可以保证模型联合训练过程的安全可靠。The block chain-based model joint training device provided in an embodiment of this specification can ensure the safety and reliability of the model joint training process.
与上述基于区块链的模型联合训练方法对应地,本说明书一个实施例还提供的一种基于区块链的模型联合训练装置,该区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系。多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型。该装置设置于区块链的当前层节点,如图5所示,该装置可以包括以下单元。Corresponding to the aforementioned blockchain-based model joint training method, an embodiment of this specification also provides a blockchain-based model joint training device. The blockchain includes multiple nodes with hierarchical relationships and adjacent There is a correspondence between the nodes of the two levels. Each of the multiple nodes maintains private data off-chain, and there are multiple models for on-chain maintenance. The device is set at the current layer node of the blockchain. As shown in Figure 5, the device may include the following units.
接收单元502,用于接收对应的上层节点发送的第一训练结果。该第一训练结果至少包括第一类型结果,第一类型结果由上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到。The receiving unit 502 is configured to receive the first training result sent by the corresponding upper node. The first training result includes at least a first type result, and the first type result is obtained by the upper node after training the target model among the multiple models maintained on the chain based on the private data maintained off-chain by the upper node.
若上层节点还存在对应的上层节点,则第一训练结果还包括第二类型结果,第二类型结果由上层节点基于从其对应的上层节点接收的结果确定。If the upper node still has a corresponding upper node, the first training result also includes a second type result, and the second type result is determined by the upper node based on the result received from its corresponding upper node.
训练单元504,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练,得到第二训练结果。The training unit 504 is used to train the target model of the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result.
判断单元506,用于判断当前层节点是否在最后一个层级。The judging unit 506 is used to judge whether the current layer node is in the last layer.
融合单元508,用于若判断单元506判断当前层节点在最后一个层级,则对第一训练结果和第二训练结果进行融合,得到融合结果。The fusion unit 508 is used for fusing the first training result and the second training result to obtain the fusion result if the judging unit 506 judges that the current layer node is at the last level.
融合单元508具体可以用于:对第一训练结果和第二训练结果进行求平均或者求加权平均,得到融合结果。The fusion unit 508 may be specifically configured to: average or obtain a weighted average of the first training result and the second training result to obtain the fusion result.
广播单元510,用于在区块链上广播融合单元508得到的融合结果,以使得多个节点基于融合结果对各自在链上维护的多种模型中的目标模型进行更新。The broadcasting unit 510 is configured to broadcast the fusion result obtained by the fusion unit 508 on the blockchain, so that multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
可选地,该装置还可以包括:发送单元(图中未示出),用于若判断单元506判断当前层节点不在最后一个层级,则将第一训练结果作为发送到对应的下层节点的第一训练结果中的第二类型结果,将第二训练结果作为发送到对应的下层节点的第一训练 结果中的第一类型结果。Optionally, the device may further include: a sending unit (not shown in the figure), configured to, if the judging unit 506 judges that the current layer node is not in the last layer, use the first training result as the first training result sent to the corresponding lower layer node. A result of the second type in the training result, using the second training result as the result of the first type in the first training result sent to the corresponding lower-level node.
本说明书上述实施例装置的各功能模块的功能,可以通过上述方法实施例的各步骤来实现,因此,本说明书一个实施例提供的装置的具体工作过程,在此不复赘述。The function of each functional module of the device in the above-mentioned embodiment of this specification can be realized by the steps of the above-mentioned method embodiment. Therefore, the specific working process of the device provided in an embodiment of this specification will not be repeated here.
本说明书一个实施例提供的基于区块链的模型联合训练装置,可以保证模型联合训练过程的安全可靠。The block chain-based model joint training device provided in an embodiment of this specification can ensure the safety and reliability of the model joint training process.
另一方面,本说明书的实施例提供了一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行图2或图3所示的方法。On the other hand, the embodiments of this specification provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed in a computer, the computer is caused to execute the method shown in FIG. 2 or FIG. 3.
另一方面,本说明书的实施例提供一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现图2或图3所示的方法。On the other hand, the embodiment of this specification provides a computing device, including a memory and a processor, the memory is stored with executable code, and when the processor executes the executable code, the implementation shown in FIG. Indicates the method.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
结合本说明书公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于RAM存储器、闪存、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于服务器中。当然,处理器和存储介质也可以作为分立组件存在于服务器中。The steps of the method or algorithm described in conjunction with the disclosure of this specification can be implemented in a hardware manner, or can be implemented in a manner in which a processor executes software instructions. Software instructions can be composed of corresponding software modules, which can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage known in the art Medium. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in the ASIC. In addition, the ASIC may be located in the server. Of course, the processor and the storage medium may also exist as discrete components in the server.
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。Those skilled in the art should be aware that, in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on the computer-readable medium. The computer-readable medium includes a computer storage medium and a communication medium, where the communication medium includes any medium that facilitates the transfer of a computer program from one place to another. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than in the embodiments and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
以上所述的具体实施方式,对本说明书的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本说明书的具体实施方式而已,并不用于限定本说明书的保护范围,凡在本说明书的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本说明书的保护范围之内。The specific implementations described above further describe the purpose, technical solutions and beneficial effects of this specification. It should be understood that the above are only specific implementations of this specification and are not intended to limit the description of this specification. The scope of protection, any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of this specification shall be included in the scope of protection of this specification.

Claims (22)

  1. 一种基于区块链的模型联合训练方法,所述区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系;所述多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型;所述方法由所述区块链的当前层节点执行,包括:A joint training method for a model based on a block chain. The block chain includes a plurality of nodes having a hierarchical relationship, and there is a corresponding relationship between the nodes of two adjacent hierarchies; each node of the plurality of nodes Private data is maintained off-chain, and there are multiple models for on-chain maintenance; the method is executed by the current layer nodes of the blockchain, including:
    接收对应的上层节点发送的第一训练结果;所述第一训练结果至少基于第一类型结果确定;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;Receive the first training result sent by the corresponding upper-layer node; the first training result is determined based on at least the first-type result; the first-type result is determined by the upper-layer node based on the private data maintained off-chain by the upper-layer node The target model in the multiple models maintained on the chain is obtained after training;
    基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;Based on the private data maintained off-chain, train the target model among the multiple models maintained on-chain to obtain the second training result;
    对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;Fusing the first training result and the second training result to obtain a fusion result;
    判断所述当前层节点是否在最后一个层级;Judging whether the current layer node is in the last layer;
    若所述当前层节点在最后一个层级,则在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。If the current layer node is at the last level, the fusion result is broadcast on the blockchain, so that the multiple nodes can compare all of the multiple models maintained on the chain based on the fusion result. The target model is updated.
  2. 根据权利要求1所述的方法,若所述上层节点还存在对应的上层节点,则所述第一训练结果基于所述第一类型结果和第二类型结果共同确定;所述第二类型结果由所述上层节点基于从其对应的上层节点接收的结果确定。According to the method of claim 1, if the upper node still has a corresponding upper node, the first training result is determined based on the first type result and the second type result; the second type result is determined by The upper node is determined based on the result received from its corresponding upper node.
  3. 根据权利要求2所述的方法,所述对所述第一训练结果和所述第二训练结果进行融合,得到融合结果,包括:The method according to claim 2, said fusing the first training result and the second training result to obtain a fusion result, comprising:
    将所述第一训练结果作为新的第二类型结果,并将所述第二训练结果作为新的第一类型结果进行求平均或者求加权平均,得到融合结果。The first training result is used as a new second type result, and the second training result is used as a new first type result for averaging or weighted average to obtain a fusion result.
  4. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    若所述当前层节点不在最后一个层级,则将所述融合结果作为发送到对应的下层节点的第一训练结果。If the current layer node is not in the last layer, the fusion result is used as the first training result sent to the corresponding lower layer node.
  5. 根据权利要求1所述的方法,所述融合结果包括所述目标模型的总模型梯度和/或总模型参数。The method according to claim 1, wherein the fusion result includes a total model gradient and/or a total model parameter of the target model.
  6. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    在所述目标模型对应的损失函数满足预定的收敛条件时,调用智能合约,所述智能合约被用于计算所述多个节点各自对应的奖励,并向所述多个节点发放各自对应的奖励,以使所述多个节点各自对应的虚拟资源增加。When the loss function corresponding to the target model satisfies a predetermined convergence condition, a smart contract is called, and the smart contract is used to calculate the respective rewards of the multiple nodes, and issue respective rewards to the multiple nodes , So that the virtual resources corresponding to each of the multiple nodes are increased.
  7. 一种基于区块链的模型联合训练方法,所述区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系;所述多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型;所述方法由所述区块链的当前层节点执行,包括:A joint training method for a model based on a block chain. The block chain includes a plurality of nodes having a hierarchical relationship, and there is a corresponding relationship between the nodes of two adjacent hierarchies; each node of the plurality of nodes Private data is maintained off-chain, and there are multiple models for on-chain maintenance; the method is executed by the current layer nodes of the blockchain, including:
    接收对应的上层节点发送的第一训练结果;所述第一训练结果至少包括第一类型结果;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;Receive the first training result sent by the corresponding upper node; the first training result includes at least the first type of result; the first type of result is registered by the upper node on the chain based on the private data maintained by the upper node The target model in the multiple models maintained on the above is obtained after training;
    基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;Based on the private data maintained off-chain, train the target model among the multiple models maintained on-chain to obtain the second training result;
    判断所述当前层节点是否在最后一个层级;Judging whether the current layer node is in the last layer;
    若所述当前层节点在最后一个层级,则对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;If the current layer node is in the last layer, fusing the first training result and the second training result to obtain a fusion result;
    在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。Broadcasting the fusion result on the blockchain, so that the multiple nodes update the target model in the multiple models maintained on the chain based on the fusion result.
  8. 根据权利要求7所述的方法,若所述上层节点还存在对应的上层节点,则所述第一训练结果还包括第二类型结果,所述第二类型结果由所述上层节点基于从其对应的上层节点接收的结果确定。According to the method of claim 7, if the upper node still has a corresponding upper node, the first training result further includes a second type result, and the second type result is determined by the upper node based on its corresponding The result received by the upper node is determined.
  9. 根据权利要求8所述的方法,还包括:The method according to claim 8, further comprising:
    若所述判断单元判断所述当前层节点不在最后一个层级,则将所述第一训练结果作为发送到对应的下层节点的第一训练结果中的第二类型结果,将所述第二训练结果作为发送到对应的下层节点的第一训练结果中的第一类型结果。If the judgment unit judges that the current layer node is not in the last layer, the first training result is taken as the second type result in the first training result sent to the corresponding lower layer node, and the second training result is As a result of the first type in the first training result sent to the corresponding lower-level node.
  10. 根据权利要求7所述的方法,所述对所述第一训练结果和所述第二训练结果进行融合,得到融合结果,包括:The method according to claim 7, said fusing the first training result and the second training result to obtain a fusion result, comprising:
    对所述第一训练结果和所述第二训练结果进行求平均或者求加权平均,得到融合结果。The first training result and the second training result are averaged or weighted averaged to obtain a fusion result.
  11. 一种基于区块链的模型联合训练装置,所述区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系;所述多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型;所述装置设置于所述区块链的当前层节点,包括:A model joint training device based on a block chain, the block chain includes a plurality of nodes having a hierarchical relationship, and there is a corresponding relationship between the nodes of two adjacent hierarchies; each node of the plurality of nodes Private data is maintained under the chain, and there are multiple models for maintenance on the chain; the device is set at the current layer node of the blockchain, including:
    接收单元,用于接收对应的上层节点发送的第一训练结果;所述第一训练结果至少基于第一类型结果确定;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;The receiving unit is configured to receive the first training result sent by the corresponding upper node; the first training result is determined based on at least the first type of result; the first type of result is determined by the upper node based on the privately maintained off-chain Data, obtained after training the target model in the multiple models maintained on the chain;
    训练单元,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的所述目标模型进行训练,得到第二训练结果;The training unit is used to train the target model of the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result;
    融合单元,用于对所述接收单元接收的所述第一训练结果和所述训练单元训练得到的所述第二训练结果进行融合,得到融合结果;A fusion unit, configured to fuse the first training result received by the receiving unit and the second training result obtained by the training unit to obtain a fusion result;
    判断单元,用于判断所述当前层节点是否在最后一个层级;A judging unit for judging whether the current layer node is in the last layer;
    广播单元,用于若所述判断单元判断所述当前层节点在最后一个层级,则在所述区块链上广播所述融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。The broadcasting unit is configured to, if the judging unit judges that the current layer node is at the last level, broadcast the fusion result on the blockchain, so that the plurality of nodes are in each position based on the fusion result. The target model among the multiple models maintained on the chain is updated.
  12. 根据权利要求11所述的装置,若所述上层节点还存在对应的上层节点,则所述第一训练结果基于所述第一类型结果和第二类型结果共同确定;所述第二类型结果由所述上层节点基于从其对应的上层节点接收的结果确定。The device according to claim 11, if the upper node still has a corresponding upper node, the first training result is determined based on the first type result and the second type result; the second type result is determined by The upper node is determined based on the result received from its corresponding upper node.
  13. 根据权利要求12所述的装置,所述融合单元具体用于:The device according to claim 12, wherein the fusion unit is specifically configured to:
    将所述第一训练结果作为新的第二类型结果,并将所述第二训练结果作为新的第一类型结果进行求平均或者求加权平均,得到融合结果。The first training result is used as a new second type result, and the second training result is used as a new first type result for averaging or weighted average to obtain a fusion result.
  14. 根据权利要求11所述的装置,还包括:The device according to claim 11, further comprising:
    发送单元,用于若所述当前层节点不在最后一个层级,则将所述融合结果作为发送到对应的下层节点的第一训练结果。The sending unit is configured to, if the current layer node is not in the last layer, use the fusion result as the first training result sent to the corresponding lower layer node.
  15. 根据权利要求11所述的装置,所述融合结果包括所述目标模型的总模型梯度和/或总模型参数。The device according to claim 11, wherein the fusion result includes a total model gradient and/or a total model parameter of the target model.
  16. 根据权利要求11所述的装置,还包括:The device according to claim 11, further comprising:
    调用单元,用于在所述目标模型对应的损失函数满足预定的收敛条件时,调用智能合约,所述智能合约被用于计算所述多个节点各自对应的奖励,并向所述多个节点发放各自对应的奖励,以使所述多个节点各自对应的虚拟资源增加。The calling unit is used to call a smart contract when the loss function corresponding to the target model meets a predetermined convergence condition, and the smart contract is used to calculate the rewards corresponding to each of the multiple nodes and send them to the multiple nodes. Respectively corresponding rewards are issued so as to increase the virtual resources corresponding to each of the multiple nodes.
  17. 一种基于区块链的模型联合训练装置,所述区块链包括多个具有层级关系的节点,且相邻两个层级的节点之间具有对应关系;所述多个节点中的每个节点在链下维护有私有数据,在链上维护有多种模型;所述装置设置于所述区块链的当前层节点,包括:A model joint training device based on a block chain, the block chain includes a plurality of nodes having a hierarchical relationship, and there is a corresponding relationship between the nodes of two adjacent hierarchies; each node of the plurality of nodes Private data is maintained under the chain, and there are multiple models for maintenance on the chain; the device is set at the current layer node of the blockchain, including:
    接收单元,用于接收对应的上层节点发送的第一训练结果;所述第一训练结果至少包括第一类型结果;所述第一类型结果由所述上层节点基于其在链下维护的私有数据,对其在链上维护的多种模型中的目标模型进行训练后得到;The receiving unit is configured to receive a first training result sent by a corresponding upper-layer node; the first training result includes at least a first-type result; the first-type result is determined by the upper-layer node based on its private data maintained off-chain , Which is obtained after training the target model among the multiple models maintained on the chain;
    训练单元,用于基于其链下维护的私有数据,对其在链上维护的多种模型中的所述 目标模型进行训练,得到第二训练结果;The training unit is used to train the target model among the multiple models maintained on the chain based on the private data maintained off-chain to obtain the second training result;
    判断单元,用于判断所述当前层节点是否在最后一个层级;A judging unit for judging whether the current layer node is in the last layer;
    融合单元,用于若所述判断单元判断所述当前层节点在最后一个层级,则对所述第一训练结果和所述第二训练结果进行融合,得到融合结果;A fusion unit, configured to merge the first training result and the second training result to obtain a fusion result if the judgment unit judges that the current layer node is at the last level;
    广播单元,用于在所述区块链上广播所述融合单元得到的融合结果,以使得所述多个节点基于所述融合结果对各自在链上维护的多种模型中的所述目标模型进行更新。The broadcasting unit is configured to broadcast the fusion result obtained by the fusion unit on the blockchain, so that the multiple nodes can, based on the fusion result, report on the target model among the multiple models maintained on the chain. Update.
  18. 根据权利要求17所述的装置,若所述上层节点还存在对应的上层节点,则所述第一训练结果还包括第二类型结果,所述第二类型结果由所述上层节点基于从其对应的上层节点接收的结果确定。According to the device of claim 17, if the upper node still has a corresponding upper node, the first training result further includes a second type result, and the second type result is determined by the upper node based on its corresponding The result received by the upper node is determined.
  19. 根据权利要求18所述的装置,还包括:The device according to claim 18, further comprising:
    发送单元,用于若所述判断单元判断所述当前层节点不在最后一个层级,则将所述第一训练结果作为发送到对应的下层节点的第一训练结果中的第二类型结果,将所述第二训练结果作为发送到对应的下层节点的第一训练结果中的第一类型结果。The sending unit is configured to, if the judging unit judges that the current layer node is not in the last layer, use the first training result as the second type result in the first training result sent to the corresponding lower layer node, and then The second training result is taken as the first type result in the first training result sent to the corresponding lower-level node.
  20. 根据权利要求17所述的装置,所述融合单元具体用于:The device according to claim 17, wherein the fusion unit is specifically configured to:
    对所述第一训练结果和所述第二训练结果进行求平均或者求加权平均,得到融合结果。The first training result and the second training result are averaged or weighted averaged to obtain a fusion result.
  21. 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行权利要求1-6中任一项所述的方法或权利要求7-10中任一项所述的方法。A computer-readable storage medium with a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the method described in any one of claims 1-6 or any one of claims 7-10. The method described in one item.
  22. 一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-6中任一项所述的方法或权利要求7-10中任一项所述的方法。A computing device, comprising a memory and a processor, the memory is stored with executable code, and when the processor executes the executable code, the method or claim in any one of claims 1 to 6 is implemented The method of any one of 7-10.
PCT/CN2020/124489 2019-12-09 2020-10-28 Blockchain-based model combination training method and device WO2021114929A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911252312.0 2019-12-09
CN201911252312.0A CN111062044B (en) 2019-12-09 2019-12-09 Model joint training method and device based on block chain

Publications (1)

Publication Number Publication Date
WO2021114929A1 true WO2021114929A1 (en) 2021-06-17

Family

ID=70300426

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/124489 WO2021114929A1 (en) 2019-12-09 2020-10-28 Blockchain-based model combination training method and device

Country Status (3)

Country Link
CN (2) CN113268776B (en)
TW (1) TWI732557B (en)
WO (1) WO2021114929A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114785810A (en) * 2022-03-31 2022-07-22 海南师范大学 Tree broadcast data synchronization algorithm suitable for federal learning

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113268776B (en) * 2019-12-09 2023-03-07 支付宝(杭州)信息技术有限公司 Model joint training method and device based on block chain
CN111581671B (en) * 2020-05-11 2021-05-25 笵成科技南京有限公司 Digital passport protection method combining deep neural network and block chain
CN111539731A (en) * 2020-06-19 2020-08-14 支付宝(杭州)信息技术有限公司 Block chain-based federal learning method and device and electronic equipment
CN111966698B (en) * 2020-07-03 2023-06-13 华南师范大学 Block chain-based trusted federation learning method, system, device and medium
CN112257063B (en) * 2020-10-19 2022-09-02 上海交通大学 Cooperative game theory-based detection method for backdoor attacks in federal learning
CN112714050B (en) * 2020-12-22 2022-05-31 齐鲁工业大学 Data sharing and privacy protection method based on block chain and federal learning
CN113111124B (en) * 2021-03-24 2021-11-26 广州大学 Block chain-based federal learning data auditing system and method
CN112733967B (en) * 2021-03-30 2021-06-29 腾讯科技(深圳)有限公司 Model training method, device, equipment and storage medium for federal learning
CN113177645B (en) * 2021-06-29 2021-09-28 腾讯科技(深圳)有限公司 Federal learning method and device, computing equipment and storage medium
CN113609508B (en) * 2021-08-24 2023-09-26 上海点融信息科技有限责任公司 Federal learning method, device, equipment and storage medium based on blockchain
TWI797808B (en) * 2021-11-02 2023-04-01 財團法人資訊工業策進會 Machine learning system and method
CN113836566B (en) * 2021-11-26 2022-03-29 腾讯科技(深圳)有限公司 Model processing method, device, equipment and medium based on block chain system
TWI807961B (en) * 2022-08-11 2023-07-01 財團法人亞洲大學 Multi-layer federated learning system and methodology based on distributed clustering

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160256480A1 (en) * 2015-03-03 2016-09-08 Wintley PHIPPS Therapeutic composition for wound healing
CN109167695A (en) * 2018-10-26 2019-01-08 深圳前海微众银行股份有限公司 Alliance Network construction method, equipment and readable storage medium storing program for executing based on federation's study
CN109698822A (en) * 2018-11-28 2019-04-30 众安信息技术服务有限公司 Combination learning method and system based on publicly-owned block chain and encryption neural network
CN111062044A (en) * 2019-12-09 2020-04-24 支付宝(杭州)信息技术有限公司 Model joint training method and device based on block chain

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180089587A1 (en) * 2016-09-26 2018-03-29 Google Inc. Systems and Methods for Communication Efficient Distributed Mean Estimation
US10270599B2 (en) * 2017-04-27 2019-04-23 Factom, Inc. Data reproducibility using blockchains
EP3477527A1 (en) * 2017-10-31 2019-05-01 Twinpeek Privacy management
US11249982B2 (en) * 2018-01-19 2022-02-15 Acronis International Gmbh Blockchain-based verification of machine learning
US11526745B2 (en) * 2018-02-08 2022-12-13 Intel Corporation Methods and apparatus for federated training of a neural network using trusted edge devices
CN108491266B (en) * 2018-03-09 2021-11-16 联想(北京)有限公司 Data processing method and device based on block chain and electronic equipment
EP3564873B1 (en) * 2018-04-30 2022-11-30 Hewlett Packard Enterprise Development LP System and method of decentralized machine learning using blockchain
CN108898219A (en) * 2018-06-07 2018-11-27 广东工业大学 A kind of neural network training method based on block chain, device and medium
CN110135846A (en) * 2019-05-17 2019-08-16 杭州云象网络技术有限公司 A kind of behavior sequence automatic classification method of block chain node
CN110472745B (en) * 2019-08-06 2021-04-27 深圳前海微众银行股份有限公司 Information transmission method and device in federated learning
CN110490738A (en) * 2019-08-06 2019-11-22 深圳前海微众银行股份有限公司 A kind of federal learning method of mixing and framework
CN110490330A (en) * 2019-08-16 2019-11-22 安徽航天信息有限公司 A kind of distributed machines learning system based on block chain
CN110991622B (en) * 2019-08-22 2021-06-04 腾讯科技(深圳)有限公司 Machine learning model processing method based on block chain network and node

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160256480A1 (en) * 2015-03-03 2016-09-08 Wintley PHIPPS Therapeutic composition for wound healing
CN109167695A (en) * 2018-10-26 2019-01-08 深圳前海微众银行股份有限公司 Alliance Network construction method, equipment and readable storage medium storing program for executing based on federation's study
CN109698822A (en) * 2018-11-28 2019-04-30 众安信息技术服务有限公司 Combination learning method and system based on publicly-owned block chain and encryption neural network
CN111062044A (en) * 2019-12-09 2020-04-24 支付宝(杭州)信息技术有限公司 Model joint training method and device based on block chain

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114785810A (en) * 2022-03-31 2022-07-22 海南师范大学 Tree broadcast data synchronization algorithm suitable for federal learning
CN114785810B (en) * 2022-03-31 2023-05-16 海南师范大学 Tree-like broadcast data synchronization method suitable for federal learning

Also Published As

Publication number Publication date
CN111062044B (en) 2021-03-23
CN113268776A (en) 2021-08-17
TWI732557B (en) 2021-07-01
CN113268776B (en) 2023-03-07
CN111062044A (en) 2020-04-24
TW202123047A (en) 2021-06-16

Similar Documents

Publication Publication Date Title
WO2021114929A1 (en) Blockchain-based model combination training method and device
JP7319404B2 (en) Rapid decentralized consensus on blockchain
TWI737944B (en) Block chain-based transaction execution method and device, and electronic equipment
EP3659086B1 (en) Computer-implemented system and method for managing a large distributed memory pool in a blockchain network
Thin et al. Formal analysis of a proof-of-stake blockchain
US10355869B2 (en) Private blockchain transaction management and termination
US11367055B2 (en) Decentralized pooled mining for enabling proof-of-work on blockchains
EP3399446B1 (en) Methods and apparatus for distributed database within a network
CN111125779A (en) Block chain-based federal learning method and device
JP2023018116A (en) Consensus of safety block chain basis
JP2020522927A (en) Blockchain for general calculation
US20210350363A1 (en) Transaction system and method of operation thereof
US20220067730A1 (en) Data processing method and device and computer-readable storage medium
CA3152588A1 (en) Pruning entries in tamper-evident data stores
Liu et al. MDP-based quantitative analysis framework for proof of authority
CN108615195B (en) Resource transfer information transmission method and device, storage medium and electronic device
US20230153806A1 (en) Method and device for preventing forking of blockchain
CN110070445A (en) A kind of transaction processing method and device based on block catenary system
JP2020530958A (en) Computer implementation systems and methods related to binary blockchains that make up a pair of combined blockchains
TW202014926A (en) Blockchain-based data processing method and apparatus, and electronic device
CN112597240B (en) Federal learning data processing method and system based on alliance chain
CN109886712A (en) Data processing method and device based on block chain
CN115796261A (en) Block chain-based lightweight group consensus federated learning method
CN113726758A (en) Data privacy calculation method and system based on block chain
Charalampidis et al. When distributed ledger technology meets internet of things--benefits and challenges

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20900381

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20900381

Country of ref document: EP

Kind code of ref document: A1