Decentralized training method, device, storage medium and equipment based on state channel
By establishing state channels on the blockchain for clustered training, the problem of training failure caused by loading too many parameters on a single node is solved, achieving faster training speed and efficiency.
Patent Information
- Application Number
- CN202111509609.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-12-10
AI Technical Summary
In existing technologies, a single node cannot handle a large number of parameters, leading to the inability to train.
By deploying computation contracts on the blockchain, a state channel is established between the task distribution node and multiple target task execution nodes to distribute training tasks and models, perform clustered training, and reduce the data load on each node.
This approach enables clustered training across multiple nodes, avoiding training failures caused by loading too many parameters onto a single node and improving training speed and efficiency.
Smart Images

Figure CN114372587B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a decentralized training method, apparatus, storage medium and device based on a state channel. Background Art
[0002] Most current machine learning training uses centralized or distributed computing methods, such as centralized training, distributed machine training, and federated training. Blockchain is a decentralized trust machine that is used by many people to implement decentralized training, that is, a node is randomly selected through the consensus mechanism of blockchain to aggregate all parameters. However, when only a single node is used to aggregate all parameters, when the amount of data is large, a single node cannot load a large number of parameters, resulting in the inability to perform training. Summary of the invention
[0003] In view of this, the embodiments of the present invention provide a decentralized training method, apparatus, storage medium and device based on a state channel to solve the problem that only a single node is used to aggregate all parameters. When the amount of data is large, a single node cannot load a large number of parameters, resulting in the inability to perform training.
[0004] In a first aspect, an embodiment of the present invention provides a decentralized training method based on a state channel, comprising:
[0005] The task distribution node obtains the computing contract on the blockchain, wherein the computing contract includes a computing task distribution strategy, a state channel opening strategy, a state channel closing strategy, and a task callback strategy;
[0006] The task distribution node sends a training task request to each execution task node based on the computing task distribution strategy, wherein the computing task distribution strategy includes a training model or a corresponding link, a global aggregation iteration round, a local iteration round, and the number of target execution task nodes, and the target execution task node is an execution task node that accepts the computing task request;
[0007] When the state channel opening condition is met, based on the state channel opening strategy, the state channel between the task distribution node and each target task execution node is opened;
[0008] The task distribution node sends the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain a training model aggregation result;
[0009] Based on the state channel closing strategy of the computing contract, close the state channel between the task distribution node and each target task execution node;
[0010] The task distribution node writes the model aggregation result into the task callback strategy.
[0011] Specifically, when the state channel opening condition is met, based on the state channel opening strategy, opening the state channel between the task distribution node and each target task execution node includes:
[0012] The task distribution node obtains the number of the target task execution nodes;
[0013] Determine whether the number of the target task execution nodes is greater than or equal to the preset number of nodes. If the number of the target task execution nodes is greater than or equal to the preset number of nodes, then based on the status channel opening strategy, open the status channel between the task distribution node and each target task execution node.
[0014] Specifically, the task distribution node sends the training model or the corresponding link and the local iteration round in the computing contract to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain the training model aggregation result, including:
[0015] The task distribution node sends the training model or the corresponding link and the local iteration round in the computing contract to each target task execution node through the state channel;
[0016] Each target task execution node performs local iterative training using local sample data based on the training model or the corresponding link and local iteration rounds, and sends the training result to the task distribution node through the state channel;
[0017] The task distribution node globally aggregates the received training results to obtain a global aggregation result;
[0018] The task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result to obtain an aggregation result of the training model.
[0019] Specifically, in the case where the computing task distribution strategy includes the link address of the training model, each target task execution node performs local iterative training using local sample data based on the training model or the corresponding link and the local iteration round, and sends the training result to the task distribution node through the state channel, including:
[0020] Each target execution task node receives the connection address of the training model;
[0021] Each target task execution node obtains the training model stored in other storage spaces based on the link address;
[0022] Each target execution task node uses local data to perform iterative training on the training model for the local iteration rounds to obtain a training result;
[0023] Each target task execution node sends the training result to the task distribution node through the state channel.
[0024] Specifically, the task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result, and before obtaining the training model aggregation result, it also includes:
[0025] If the task distribution node closes the state channel between itself and some target task execution nodes, the target task execution node determines whether to stop local iterative training based on the state channel closing event.
[0026] Specifically, the task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result, and before obtaining the training model aggregation result, it also includes:
[0027] If some target task execution nodes close the status channel between them and the task distribution node, the task distribution node increases the duration for receiving the training results of the target task execution nodes, so that within the duration, the target task execution nodes reopen the status channel between them and the task distribution nodes and continue training to obtain the training results.
[0028] Specifically, the task distribution node globally aggregates the received training results, and the global aggregation results obtained include:
[0029] The task distribution node verifies the received training results;
[0030] The task distribution node determines the accuracy of the training results of each target execution task node based on the verification result;
[0031] The task distribution node determines a target task execution node whose accuracy is greater than or equal to a preset accuracy as a better target task execution node;
[0032] The task distribution node globally aggregates the training results of the better target execution task nodes to obtain a global aggregation result.
[0033] Specifically, the task distribution node performs iterative training of the global aggregation iteration round based on the result of the global aggregation, and after obtaining the training model aggregation result, further includes:
[0034] After each round of global aggregation iteration, the task distribution node determines the total incentive resources allocated to each preferred target execution task node according to the following formula;
[0035] Inc i =stake*epoch;
[0036] Among them, Inc i It is the total incentive resources allocated to the better target execution task node after each round of global aggregation iteration. epoch is the number of global aggregation iterations in this round. Stake represents the incentive resources allocated to the target execution task node after each round of global aggregation iteration.
[0037] Specifically, the method further includes:
[0038] When the accuracy of all target task execution nodes is less than the preset accuracy, the task distribution node sends an empty model to each target task execution node so that each target task execution node re-performs local iterative training based on the global aggregation result obtained in the last global aggregation iteration.
[0039] In a second aspect, an embodiment of the present invention provides a decentralized training device based on a state channel, comprising:
[0040] An acquisition module is used for the task distribution node to obtain the computing contract on the blockchain, wherein the computing contract includes a computing task distribution strategy, a state channel opening strategy, a state channel closing strategy, and a task callback strategy;
[0041] A request sending module, used for the task distribution node to send a training task request to each execution task node based on the computing task distribution strategy, wherein the computing task distribution strategy includes a training model or a corresponding link, a global aggregation iteration round, a local iteration round, and the number of target execution task nodes, and the target execution task node is an execution task node that accepts the computing task request;
[0042] A state channel opening module, used to open the state channel between the task distribution node and each target task execution node based on the state channel opening strategy when the state channel opening condition is met;
[0043] An aggregation training module is used for the task distribution node to send the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain the training model aggregation result;
[0044] A state channel closing module, used to close the state channel between the task distribution node and each target task execution node based on the state channel closing strategy of the computing contract;
[0045] A writing module is used for the task distribution node to write the model aggregation result into the task callback strategy.
[0046] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned state channel-based decentralized training method.
[0047] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the above-mentioned state channel-based decentralized training method at runtime.
[0048] According to a state channel-based decentralized training method, apparatus, storage medium and device provided by an embodiment of the present invention, the method opens a state channel between a task distribution node and each target execution task node, and then the task distribution node sends a training model or a corresponding one to each target execution task node through a linked state channel, so that each target execution task node is trained based on training parameters, and the training results of each target execution task node are globally iterated to obtain a training model aggregation result. In this way, clustered training is performed by multiple target execution task nodes under the blockchain chain, which reduces the amount of data loaded by each target execution task node, avoids the problem that a large number of parameters are difficult to be loaded by a single node and thus cannot be trained, and improves the training speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The following drawings of the present invention are used as part of the embodiments of the present invention for understanding the present invention. The embodiments of the present invention are shown in the drawings and the description thereof is used to explain the principle of the present invention.
[0050] In the attached figure:
[0051] Figure 1 A flowchart of a decentralized training method based on a state channel according to an optional embodiment of the present invention;
[0052] Figure 2 is a flowchart of step S103;
[0053] Figure 3 is a flowchart of step S104;
[0054] Figure 4 is a flowchart of step S302;
[0055] Figure 5 is a flowchart of step S303;
[0056] Figure 6 The structure diagram of a decentralized training device based on a state channel according to an optional embodiment of the present invention. DETAILED DESCRIPTION
[0057] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features well known in the art are not described.
[0058] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, integral bodies, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integral bodies, steps, operations, elements, components and / or combinations thereof.
[0059] Now, exemplary embodiments according to the present invention will be described in more detail with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments set forth herein. It should be understood that these embodiments are provided to make the disclosure of the present invention thorough and complete, and to fully convey the concept of these exemplary embodiments to those of ordinary skill in the art.
[0060] First, as Figure 1 As shown, an embodiment of the present invention provides a decentralized training method based on a state channel, comprising:
[0061] Step S101: The task distribution node obtains the computing contract on the blockchain. The computing contract includes a computing task distribution strategy, a state channel opening strategy, a state channel closing strategy, and a task callback strategy.
[0062] The computing contract is deployed on the blockchain, and the task distribution node and the task execution node generate blockchain-related identity authentication on their own, thereby joining the blockchain network. Among them, the task execution node is the client that joins the blockchain network. The client device can be but is not limited to mobile phones, personal computers, tablets, etc.
[0063] Blockchain technology is a distributed database with the characteristics of decentralization, immutability and scalability. In the blockchain system, all data is stored in blocks, and newly written data forms new blocks and is added to the end chain of the current blockchain. While each block saves data, it also saves a number that uniquely corresponds to all the data recorded in the previous block. This number is often the hash value of all data. If someone tries to modify the data in the previous block alone, the number saved in the next block will not match and cannot form a chain. Therefore, the blockchain system can be considered as a system in which computers on a distributed network that do not fully trust each other jointly maintain a set of traceable and immutable chain data through consensus rules. Since the data and platform are not unilaterally controlled by any organization, the blockchain system can be regarded as a highly secure, reliable and trustworthy decentralized basic computing framework.
[0064] Step S102: The task distribution node sends a training task request to each execution task node based on the computing task distribution strategy. The computing task distribution strategy includes the training model or the corresponding link, the global aggregation iteration round, the local iteration round and the number of target execution task nodes. The target execution task node is the execution task node that accepts the computing task request.
[0065] Step S103: When the state channel opening condition is met, the state channel between the task distribution node and each target task execution node is opened based on the state channel opening strategy.
[0066] Step S104: The task distribution node sends the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node is trained based on the training model or the corresponding link and the local iteration round, and the training results of each target execution task node are globally iterated to obtain the training model aggregation result.
[0067] The task distribution node exchanges data with each target execution task node through the state channel. The task distribution node sends the training model or the corresponding link and the local iteration round to each target execution task node, and then each target execution task node performs training based on the training model or the corresponding link and the local iteration round. After that, the task distribution node performs global aggregation through the training results of each target execution task node, and then distributes the global aggregation results to each target execution task node. Each target execution task node then performs local iteration rounds of training based on the global aggregation results, and then sends the training results to the task distribution node for aggregation, and so on, until the global aggregation iteration rounds are repeated; in this way, the on-blockchain training is transferred to multiple nodes under the blockchain for cluster training, which reduces the amount of data loaded by each target execution task node, avoids the problem of a single node being unable to load a large number of parameters and thus being unable to perform training, and improves the training speed;
[0068] Step S105: Based on the state channel closing strategy of the computing contract, close the state channel between the task distribution node and each target task execution node.
[0069] Step S106: The task distribution node writes the model aggregation result into the task callback strategy.
[0070] The final training result, i.e. the model aggregation result, is transmitted to the blockchain through the task callback strategy and stored by the blockchain. Furthermore, the task distribution node can also screen the final training result and return the hash of the optimal training result to the task callback strategy.
[0071] According to a decentralized training method based on a state channel provided by an embodiment of the present invention, the method opens a state channel between a task distribution node and each target execution task node, and then the task distribution node sends a training model or a corresponding model to each target execution task node through a link state channel, so that each target execution task node is trained based on the training parameters, and the training results of each target execution task node are globally iterated to obtain a training model aggregation result. In this way, clustered training is performed by multiple target execution task nodes under the blockchain chain, which reduces the amount of data loaded by each target execution task node, avoids the problem that a large number of parameters are difficult to be loaded by a single node and thus cannot be trained, and improves the training speed.
[0072] Furthermore, if Figure 2 As shown, in the above embodiment, step S103 specifically includes the following steps:
[0073] Step S201: The task distribution node obtains the number of target task execution nodes.
[0074] Step S202: Determine whether the number of target task execution nodes is greater than or equal to the preset number of nodes. If the number of target task execution nodes is greater than or equal to the preset number of nodes, execute step S203.
[0075] Step S203: Based on the state channel opening strategy, the state channel between the task distribution node and each target task execution node is opened.
[0076] After the number of target task execution nodes reaches the preset number of nodes, the status channel between the task distribution node and each target task execution node is opened to ensure that there are enough target task execution nodes for cluster training.
[0077] Furthermore, in the above embodiment, if Figure 3 As shown, step S104 specifically includes the following steps:
[0078] Step S301: The task distribution node sends the training model or the corresponding link and local iteration round in the computing contract to each target execution task node through the state channel.
[0079] Step S302: Each target task execution node performs local iterative training using local sample data based on the training model or the corresponding link and local iteration rounds, and sends the training results to the task distribution node through the state channel.
[0080] Each target execution task node completes each local data update through the method specified in the model, such as using the stochastic gradient descent method (SGD), etc. Each target execution task node stores enough sample data locally, so there is no need for the task distribution node to transmit sample data to each target execution task.
[0081] In some embodiments, in order to facilitate the storage of some more complex training models, the training models are stored in other storage spaces, such as the cloud, and the link address of the training model is stored in the task distribution strategy.
[0082] Specifically, Figure 4 As shown, when the computing task distribution strategy includes the link address of the training model, this step specifically includes:
[0083] Step S3021: Each target task execution node receives the connection address of the training model.
[0084] Step S3022: Each target task execution node obtains the training model stored in other storage spaces based on the link address.
[0085] Step S3023: Each target task execution node uses local data to perform local iteration rounds of iterative training on the training model to obtain training results.
[0086] Step S3024: Each target task execution node sends the training result to the task distribution node through the state channel.
[0087] Step S303: The task distribution node globally aggregates the received training results to obtain a global aggregation result.
[0088] Specifically, Figure 5 As shown, this step specifically includes the following steps:
[0089] Step S3031: The task distribution node verifies the received training results.
[0090] Step S3032: The task distribution node determines the accuracy of the training results of each target execution task node based on the verification result.
[0091] Step S3033: The task distribution node determines the target task execution node whose accuracy is greater than or equal to the preset accuracy as a better target task execution node.
[0092] Step S3034: The task distribution node globally aggregates the training results of the better target execution task nodes to obtain a global aggregation result.
[0093] In the above steps, the task distribution node locally stores personalized data, such as the test data storage address and the model storage address to obtain the corresponding test data and training model, so as to verify the training results provided by the target execution task node through the small part of personalized data stored locally in the task distribution node. If the accuracy of the model parameter output of the target execution task node is lower than the preset accuracy, the training results of the target execution task node will not be aggregated. After the task distribution node verifies the training results of all target execution task nodes, the training results obtained by the target execution task nodes that exceed the preset accuracy will be aggregated.
[0094] Furthermore, step S303 also includes:
[0095] When the accuracy of all target execution task nodes is less than the preset accuracy, the task distribution node sends an empty model to each target execution task node, so that each target execution task node re-performs local iterative training based on the global aggregation result obtained in the last global aggregation iteration; then the new training result is retransmitted to the task distribution node, and the task distribution node re-executes steps S3033-S3034 to ensure the validity and accuracy of the training results.
[0096] Step S304: the task distribution node performs iterative training of global aggregation iteration rounds based on the global aggregation result to obtain the training model aggregation result.
[0097] In this step, the task distribution node performs global aggregation through the training results of each target execution task node, and then distributes the global aggregation results to each target execution task node, and then repeats steps S302-S303, that is, each target execution task node performs local iteration rounds of training based on the global aggregation results, and then sends the training results to the task distribution node for aggregation, and so on, until the global aggregation iteration rounds are repeated. The task distribution node can use a specified aggregation method to complete the update of global parameters, such as using the federated average algorithm (FedAvg).
[0098] Furthermore, the task distribution node may close the state channel in advance due to communication failure or other reasons. Therefore, in the above embodiment, before step S303, the following steps are further included:
[0099] If the task distribution node closes the state channel between itself and some of the target task execution nodes, the target task execution node determines whether to stop the local iterative training based on the closed state channel event.
[0100] In this step, when the task distribution node closes the state channel, the target task execution node determines to stop the local iterative training based on the state channel closing event.
[0101] Furthermore, the target task execution node can close the task channel proactively or due to a communication failure. Therefore, in the above embodiment, before step S303, the following is also included:
[0102] If some target task execution nodes close the status channel between them and the task distribution node, the task distribution node increases the duration for receiving the training results of the target task execution nodes, so that within this duration, the target task execution nodes reopen the status channel between them and the task distribution node and continue training to obtain the training results.
[0103] This step can extend the time it takes for the task distribution node to receive the training results of the target task execution node when the target task execution node closes the status channel between it and the task distribution node, so that the target task execution node has enough time to reopen the status channel between it and the task distribution node and continue training to obtain training results, thereby ensuring the reliability of the training process and the accuracy of the training results.
[0104] The extended duration can be obtained by rounding down the average time submitted by other target task execution nodes and summing it to a certain block height, and the block height can be specified by the task distribution node.
[0105] Furthermore, in order to improve the enthusiasm of the target task execution node to participate in the cluster training, after step S303, the following is further included:
[0106] After each round of global aggregation iteration, the task distribution node determines the total incentive resources allocated to each better target execution task node according to the following formula;
[0107] Inc i =stake*epoch;
[0108] Among them, Inc i It is the total incentive resources allocated to the better target execution task node after each round of global aggregation iteration. epoch is the number of global aggregation iterations in this round. Stake represents the incentive resources allocated to the target execution task node after each round of global aggregation iteration.
[0109] In this step, the target execution task node participates in the global aggregation iteration of this round, that is, the target execution task node that is aggregated by the task distribution node using the training results can obtain corresponding incentive resources. The higher the global aggregation iteration round it participates in, the more incentive resources it will get.
[0110] Exemplarily, if the incentive resources allocated after each round of global aggregation iteration are 3, the task distribution node performs the fifth round of global aggregation iteration and adopts the training result of a better target execution task node. In this way, the total incentive resources obtained by the better target execution task node for this round are 5*3, a total of 15.
[0111] Second, as Figure 6 As shown, an embodiment of the present invention provides a decentralized training device based on a state channel, comprising:
[0112] Acquisition module 401, used for the task distribution node to obtain the computing contract on the blockchain, the computing contract includes computing task distribution strategy, state channel opening strategy, state channel closing strategy and task callback strategy;
[0113] The request sending module 402 is used for the task distribution node to send the training task request to each execution task node based on the computing task distribution strategy, where the computing task distribution strategy includes the training model or the corresponding link, the global aggregation iteration round, the local iteration round and the number of target execution task nodes, where the target execution task node is the execution task node that receives the computing task request;
[0114] The state channel opening module 403 is used to open the state channel between the task distribution node and each target task execution node based on the state channel opening strategy when the state channel opening condition is met;
[0115] The aggregation training module 404 is used for the task distribution node to send the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node is trained based on the training model or the corresponding link and the local iteration round, and the training results of each target execution task node are globally iterated to obtain the training model aggregation result.
[0116] The state channel closing module 405 is used to close the state channel between the task distribution node and each target task execution node based on the state channel closing strategy of the computing contract;
[0117] The writing module 406 is used for the task distribution node to write the model aggregation result into the task callback strategy.
[0118] According to an embodiment of the present invention, a decentralized training device based on a state channel is provided. The device opens a state channel between a task distribution node and each target execution task node, and then the task distribution node sends a training model or a corresponding model to each target execution task node through a linked state channel, so that each target execution task node is trained based on the training parameters, and the training results of each target execution task node are globally iterated to obtain an aggregated result of the training model. In this way, clustered training is performed by multiple target execution task nodes under the blockchain chain, which reduces the amount of data loaded by each target execution task node, avoids the problem that a single node cannot load a large number of parameters and thus cannot be trained, and improves the training speed.
[0119] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned state channel-based decentralized training method.
[0120] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program, wherein the computer program is configured to execute the above-mentioned state channel-based decentralized training method at runtime.
[0121] The present invention has been described by the above embodiments, but it should be understood that the above embodiments are only for the purpose of example and description, and are not intended to limit the present invention to the scope of the described embodiments. In addition, it can be understood by those skilled in the art that the present invention is not limited to the above embodiments, and more variations and modifications can be made according to the teachings of the present invention, and these variations and modifications all fall within the scope of the protection claimed by the present invention. The protection scope of the present invention is defined by the attached claims and their equivalents.
Claims
1. A decentralized training method based on state channels, It is characterized in that include: The task distribution node obtains the computing contract on the blockchain, wherein the computing contract includes a computing task distribution strategy, a state channel opening strategy, a state channel closing strategy, and a task callback strategy; The task distribution node sends a training task request to each execution task node based on the computing task distribution strategy, wherein the computing task distribution strategy includes a training model or a corresponding link, a global aggregation iteration round, a local iteration round, and the number of target execution task nodes, and the target execution task node is an execution task node that accepts the computing task request; When the state channel opening condition is met, based on the state channel opening strategy, the state channel between the task distribution node and each target task execution node is opened; The task distribution node sends the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain a training model aggregation result; Based on the state channel closing strategy of the computing contract, close the state channel between the task distribution node and each target task execution node; The task distribution node writes the model aggregation result into the task callback strategy.
2. The method according to claim 1, It is characterized in that When the state channel opening condition is met, based on the state channel opening strategy, opening the state channel between the task distribution node and each target task execution node includes: The task distribution node obtains the number of the target task execution nodes; Determine whether the number of the target task execution nodes is greater than or equal to the preset number of nodes. If the number of the target task execution nodes is greater than or equal to the preset number of nodes, then based on the status channel opening strategy, open the status channel between the task distribution node and each target task execution node.
3. The method according to claim 1, It is characterized in that The task distribution node sends the training model or the corresponding link and the local iteration round in the computing contract to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain the training model aggregation result, including: The task distribution node sends the training model or the corresponding link and the local iteration round in the computing contract to each target task execution node through the state channel; Each target task execution node performs local iterative training using local sample data based on the training model or the corresponding link and local iteration rounds, and sends the training result to the task distribution node through the state channel; The task distribution node globally aggregates the received training results to obtain a global aggregation result; The task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result to obtain an aggregation result of the training model.
4. The method according to claim 3, It is characterized in that In the case where the computing task distribution strategy includes the link address of the training model, each target task execution node performs local iterative training using local sample data based on the training model or the corresponding link and the local iteration round, and sends the training result to the task distribution node through the state channel, including: Each target execution task node receives the connection address of the training model; Each target task execution node obtains the training model stored in other storage spaces based on the link address; Each target execution task node uses local data to perform iterative training on the training model for the local iteration rounds to obtain a training result; Each target task execution node sends the training result to the task distribution node through the state channel.
5. The method according to claim 3, It is characterized in that The task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result, and before obtaining the training model aggregation result, it also includes: If the task distribution node closes the state channel between itself and some target task execution nodes, the target task execution node determines whether to stop local iterative training based on the state channel closing event.
6. The method according to claim 3, It is characterized in that The task distribution node performs iterative training of the global aggregation iteration round based on the global aggregation result, and before obtaining the training model aggregation result, it also includes: If some target task execution nodes close the status channel between them and the task distribution node, the task distribution node increases the duration for receiving the training results of the target task execution nodes, so that within the duration, the target task execution nodes reopen the status channel between them and the task distribution nodes and continue training to obtain the training results.
7. The method according to claim 3, It is characterized in that The task distribution node globally aggregates the received training results, and the global aggregation results obtained include: The task distribution node verifies the received training results; The task distribution node determines the accuracy of the training results of each target execution task node based on the verification result; The task distribution node determines a target task execution node whose accuracy is greater than or equal to a preset accuracy as a better target task execution node; The task distribution node globally aggregates the training results of the better target execution task nodes to obtain a global aggregation result.
8. The method according to claim 3, It is characterized in that The task distribution node performs iterative training of the global aggregation iteration round based on the result of the global aggregation, and after obtaining the training model aggregation result, further includes: After each round of global aggregation iteration, the task distribution node determines the total incentive resources allocated to each preferred target execution task node according to the following formula; Inc i =stake*epoch; Among them, Inc i It is the total incentive resources allocated to the better target execution task node after each round of global aggregation iteration. epoch is the number of global aggregation iterations in this round. Stake represents the incentive resources allocated to the target execution task node after each round of global aggregation iteration.
9. The method according to claim 7, It is characterized in that The method further comprises: When the accuracy of all target task execution nodes is less than the preset accuracy, the task distribution node sends an empty model to each target task execution node so that each target task execution node re-performs local iterative training based on the global aggregation result obtained in the last global aggregation iteration.
10. A decentralized training device based on state channels, It is characterized in that include: An acquisition module is used for the task distribution node to obtain the computing contract on the blockchain, wherein the computing contract includes a computing task distribution strategy, a state channel opening strategy, a state channel closing strategy, and a task callback strategy; A request sending module, used for the task distribution node to send a training task request to each execution task node based on the computing task distribution strategy, wherein the computing task distribution strategy includes a training model or a corresponding link, a global aggregation iteration round, a local iteration round, and the number of target execution task nodes, and the target execution task node is an execution task node that accepts the computing task request; A state channel opening module, used to open the state channel between the task distribution node and each target task execution node based on the state channel opening strategy when the state channel opening condition is met; An aggregation training module is used for the task distribution node to send the training model or the corresponding link and the local iteration round to each target execution task node through the state channel, so that each target execution task node performs training based on the training model or the corresponding link and the local iteration round, and performs global iterative training on the training results of each target execution task node to obtain the training model aggregation result; A state channel closing module, used to close the state channel between the task distribution node and each target task execution node based on the state channel closing strategy of the computing contract; A writing module is used for the task distribution node to write the model aggregation result into the task callback strategy.
11. An electronic device, It is characterized in that It comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the decentralized training method based on the state channel as described in any one of claims 1-9.
12. A computer-readable storage medium storing a computer program. in, The computer program is configured to execute the decentralized training method based on state channels as described in any one of claims 1 to 9 when running.
