Blockchain-based federated learning system, method, electronic device, and medium

By using a decentralized federated learning system and smart contract mechanism based on blockchain, combined with model evolution algorithms, the difficulties in identifying noisy models and data security issues in traditional federated learning are solved. This enables the generation of high-quality training models and secure data management, and expands the exploration space of training models.

CN115983410BActive Publication Date: 2026-06-09SHANGHAI UNITED IMAGING HEALTHCARE +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI UNITED IMAGING HEALTHCARE
Filing Date
2023-01-19
Publication Date
2026-06-09

Smart Images

  • Figure CN115983410B_ABST
    Figure CN115983410B_ABST
Patent Text Reader

Abstract

The present disclosure provides a blockchain-based federated learning system, method, electronic device and medium. The federated learning system comprises a plurality of nodes, the nodes comprising a public chain layer and a private chain layer; the public chain layer comprises a training task chain and a qualified model chain, the training task chain being used to store training task data, and the qualified model chain being used to store qualified model data; the nodes are used to obtain training task data from the training task chain, obtain a to-be-trained model of a training task from the training task chain or the qualified model chain, train the to-be-trained model based on private data in the private chain layer to obtain a trained model, verify the trained model using test data to obtain an accuracy rate of the trained model, determine qualified model data from the trained model according to the accuracy rate, and publish the qualified model data to the qualified model chain. The present disclosure iterates the model through a decentralized and verifiable model accuracy rate based on the blockchain and the test data of the training task, thereby avoiding the introduction of noise models into the federated learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of federated learning technology, and in particular to a blockchain-based federated learning system, method, electronic device, and medium. Background Technology

[0002] Federated learning is a distributed machine learning technique. Its core idea is to train models in a distributed manner across multiple data sources that have local data. Without exchanging local individual or sample data, it constructs a global model based on virtual fused data by exchanging model parameters or intermediate results. This achieves a balance between data privacy protection and data sharing computation, namely, a new application paradigm of "data is available but not visible" and "the model moves while the data does not move".

[0003] Federated learning, based on homogeneous and homogenized data machine learning techniques, enables participating parties to jointly model data from multiple sources. The parties do not need to share data resources; that is, the data does not need to be uploaded to the network. The resulting machine learning model is trained through joint data training.

[0004] However, federated learning is a complex process. For different training tasks, it requires significant human and time resources for environment configuration and synchronized training. Furthermore, each round of federated learning involves a large amount of centralized data transmission and interaction. Therefore, in traditional federated learning, parameter collection, computation, and rebroadcasting consume substantial time and communication resources. Simultaneously, centralized federated learning cannot effectively identify and eliminate noisy models, resorting to simple averaging or weighted averaging of all model parameters. This results in high-quality training models being negated by noisy models, failing to retain the best training results.

[0005] Traditional databases suffer from drawbacks such as being easily modified without leaving a trace and being copied and disseminated without restriction. Blockchain, as a decentralized protocol or set of rules, ensures that data is extremely difficult to tamper with, possesses inherent anonymity and immutability, and can achieve data real-name authentication.

[0006] The existing blockchain architecture requires all parties to synchronize all data information. If medical images are used as big data storage, it will lead to the sharing of patient-related data by multiple parties. However, current blockchain technology faces challenges such as data security storage and access control in medical data storage and cross-hospital sharing of patient data. Summary of the Invention

[0007] To address the aforementioned technical issues, this disclosure provides a blockchain-based federated learning system, method, electronic device, and medium.

[0008] In one aspect, this disclosure provides a blockchain-based federated learning system, which includes multiple nodes, including a public blockchain layer and a private blockchain layer.

[0009] The public blockchain layer includes a training task chain and a benchmark model chain. The training task chain is used to store training task data in the federated learning system. The training task data includes training tasks and test data corresponding to the training tasks. The benchmark model chain is used to store benchmark model data in the federated learning system.

[0010] The private chain layer is used to store private data;

[0011] The node is used to obtain the training task data from the training task chain, obtain the model to be trained for the training task from the training task chain or the benchmark model chain, train the model to be trained based on the private data in the private chain layer to obtain the training model, verify the training model using the test data to obtain the accuracy of the training model, determine the benchmark model data from the training model based on the accuracy, and publish the benchmark model data to the benchmark model chain.

[0012] Optionally, the federated learning system further includes a model evolution layer, which is used to generate the model to be trained based on the qualifying model data corresponding to the training task in the qualifying model chain.

[0013] Optionally, the model evolution layer is used to generate the model to be trained based on at least two qualified model data corresponding to the training task in the qualified model chain.

[0014] Optionally, the model evolution layer is used to generate the model to be trained based on at least one of the genetic algorithm (GA), particle swarm optimization algorithm, artificial bee colony algorithm and / or automated machine learning algorithm, according to the plurality of qualified models.

[0015] Optionally, the training task data also includes the expected accuracy, and the node is used to determine the qualified model data from the training model when the accuracy of the training model reaches the expected accuracy, and publish the qualified model data to the qualified model chain.

[0016] Optionally, the node is also used to publish the training task data in the training task chain.

[0017] Optionally, the public blockchain layer further includes a training environment chain, which is used to store training environment data corresponding to the training task; the node is also used to publish the training environment data corresponding to the training task on the training environment chain; the node further includes a federated environment layer, which is used to obtain the training environment data corresponding to the training task from the training environment chain, deploy the training environment based on the training environment data, and unload the training environment after the training task is completed.

[0018] Optionally, the node further includes a permission management layer, which stores the permissions sent by the federated learning system to the node, and the node is used to obtain data in the public blockchain layer based on the permissions.

[0019] Secondly, this disclosure provides a blockchain-based federated learning method, applied to nodes in the blockchain-based federated learning system described in the first aspect, wherein the federated learning method includes:

[0020] Training task data is obtained from the training task chain, wherein the training task data includes training tasks and test data corresponding to the training tasks;

[0021] The model to be trained for the training task is obtained based on the training task data;

[0022] The model to be trained is trained based on the private data in the private chain layer to obtain the trained model;

[0023] The training model is validated using the test data to obtain the accuracy of the training model;

[0024] Based on the accuracy rate, qualifying model data is determined from the training model, and the qualifying model data is published to the qualifying model chain.

[0025] Thirdly, this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and used to run on the processor, wherein when the processor executes the computer program, it implements the blockchain-based federated learning method described in the third aspect.

[0026] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the blockchain-based federated learning method described in the third aspect.

[0027] The positive advancements of this disclosure are as follows: It provides a blockchain-based federated learning system, method, electronic device, and medium. Based on blockchain and test data from training tasks, it iterates to improve the model through decentralized and verifiable model accuracy, thereby preventing noisy models from being introduced into federated learning. This effectively solves the problem in federated learning where the inability to identify and eliminate noisy models leads to the cancellation of high-quality training models by noisy models, failing to retain the best training results. Specifically, to protect data security, blockchain technology is used to implement public and private chain layers, ensuring that data can be maximized locally, achieving an automated federated learning process based on a smart contract consensus mechanism. Furthermore, this disclosure utilizes the decentralized smart contract mechanism of blockchain to establish a decentralized multi-party consensus mechanism for federated training rules, mirroring requirements, and shared training environment files, simplifying the standardization of training data, rule formulation, and rule transmission among multi-party nodes. In particular, this disclosure improves and enhances the elasticity of model changes based on pre-defined consensus training rules through a model evolution layer, expanding the exploration space for optimization training and ultimately obtaining a superior training model. Attached Figure Description

[0028] Figure 1 A first architecture diagram of a federated learning system provided in an embodiment of this disclosure;

[0029] Figure 2 A schematic diagram of the search architecture of the automated machine learning algorithm search model provided in this embodiment of the disclosure;

[0030] Figure 3 A schematic diagram illustrating the process of federated learning based on a federated learning system, provided for embodiments of this disclosure;

[0031] Figure 4 A schematic diagram of the hospital task publishing process provided in this embodiment of the disclosure;

[0032] Figure 5 A schematic diagram illustrating the process of a federated learning requirement publisher issuing training tasks, provided in an embodiment of this disclosure;

[0033] Figure 6 A flowchart illustrating the federated learning method provided in this embodiment of the disclosure;

[0034] Figure 7 A second architecture diagram of a federated learning system provided in an embodiment of this disclosure;

[0035] Figure 8 A schematic diagram illustrating the process of a hospital participating in federated learning, provided as an embodiment of this disclosure;

[0036] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0037] The present invention will be further illustrated by way of embodiments below, but the present invention is not limited to the scope of the embodiments described herein.

[0038] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.

[0039] Figure 1 An embodiment of a blockchain-based federated learning system provided in this disclosure is illustrated. This federated learning system uses smart contracts defined on the blockchain of public attributes in each node, and connects the public blockchain layer of each node in a decentralized manner based on model training principles, model storage standards, and management standards agreed upon by the nodes.

[0040] See Figure 1 The federated learning system includes multiple nodes (such as...) Figure 1 The nodes shown are 1 to N, where each node includes a public chain layer and a private chain layer.

[0041] The public blockchain layer is mainly used to store various shareable data in the federated learning system, while the private blockchain layer is mainly used to store the private data of each node.

[0042] In some embodiments, the private chain layer includes one or more private data chains for storing private data. The purpose of multiple private data chains is to back up private data in case of loss.

[0043] The public blockchain layer comprises the training task chain and the achievement model chain, both being public blockchains. The training task chain stores training task data within the federated learning system, primarily including the training tasks and their corresponding test data. The achievement model chain stores achievement model data within the federated learning system.

[0044] The training tasks are primarily published by nodes that have assigned training tasks. Simultaneously, the corresponding test data for that training task must be uploaded to the training task chain. After a node with a training task publishes it on its own public blockchain's training task chain, the public blockchains of other nodes will synchronize with the node that published the training task. After synchronization, other nodes can then find the published training task on their own public blockchain's training task chain.

[0045] Nodes wishing to participate in the training task can obtain the corresponding training task data from the training task chain. Then, they can obtain the model to be trained for the training task from either the training task chain or the qualified model chain.

[0046] Typically, a node that publishes a training task will upload or specify a model to be trained.

[0047] Specifically, if you want to select an existing model in the federated learning system as the model to be trained for this training task, you need to provide the first identifier information of the model to be trained when publishing the training task. That is, the training task data should also include the first identifier information of the model to be trained. Nodes participating in the training task can obtain the model to be trained from the qualified model chain based on the first identifier information. Alternatively, you can provide a new model to be trained when publishing the training task. That is, the training task data also includes the model to be trained. Nodes participating in the training task can directly obtain the model to be trained from the training task data in the training task chain.

[0048] After obtaining the model to be trained, the node trains the model based on the private data in the private chain layer to obtain the trained model. Then, the trained model is validated using test data to obtain the accuracy of the trained model, and the trained model and accuracy can be published to the qualified model chain as qualified model data.

[0049] Because blockchain-based data and systems are immutable, the fixed rules established in advance based on consensus tend to become rigid and lose their flexibility after a long period of task training. This is especially unfavorable for optimization learning tasks in federated learning that require expanding the exploration range of hyperparameters (such as network structure, learning rate, batch sample size, etc.).

[0050] Therefore, in some embodiments, the federated learning system further includes a model evolution layer. The model evolution layer is primarily used to generate a model to be trained based on the compliant model data corresponding to the training task in the compliant model chain.

[0051] That is, in addition to the first or first batch of nodes participating in the training task, the second or second batch of nodes participating in the training task may not directly use the existing model in the public chain layer, but instead evolve the model based on the qualified models that other nodes have already released for the training task, thereby generating a higher quality model to be trained.

[0052] The training model is stored as a config file, along with a local data path config file generated by the federated learning system and defined by the participants, for nodes to access and train the model in their respective training environments. Thus, the network structure can be configured by referencing the evolutionary model layers. gThe files are evolved and updated to achieve the goal of automatically training, evolving, and iterating the model according to the blockchain consensus contract.

[0053] Furthermore, to effectively identify and eliminate noisy models, in some embodiments, the model evolution layer is used to generate a model to be trained based on data from at least two qualified models corresponding to the training task in the qualified model chain. This allows model evolution to proceed based on the training model with higher accuracy, avoiding the influence of other noisy models with lower accuracy.

[0054] Similarly, in some embodiments, the training task data also includes the expected accuracy. When the accuracy of the training model reaches the expected accuracy, the node needs to determine the qualified model data from the training model and publish the qualified model data to the qualified model chain.

[0055] For a training task, if the accuracy of the latest qualified model is higher than the expected accuracy contained in the training task data, or if no new qualified model is released within a certain period of time, the federated learning system will mark the status of the training task as the end state on the training task chain.

[0056] The training task status is mainly divided into incomplete, completed, and timed out. The smart contract of the training task chain is automatically updated according to preset rules and training progress, and is decentralizedly synchronized to the training task chain of all nodes through the federated learning system.

[0057] In some embodiments, the model evolution layer may generate a model to be trained based on at least one of genetic algorithms, particle swarm optimization algorithms, artificial bee colony algorithms, and / or automated machine learning algorithms, according to multiple qualified models.

[0058] For example, the model evolution layer includes a genetic algorithm module, which includes a crossover module and a mutation module.

[0059] The crossover module of a genetic algorithm is used to generate a new model by replacing and recombinating parts of the structures of at least two parent models, using qualified models as parent models. The traditional genetic crossover formula is as follows:

[0060]

[0061] Where g is the number of evolutionary iterations and G is the size of the evolutionary set. As can be seen from the genetic crossover formula above, R is dynamic and increases with the number of evolutionary iterations. In the initial stage of the genetic algorithm, the similarity between models is very low, and the value of R is low to ensure that newly generated individuals will not destroy the superior genes of the parent models. In the later stages of evolution, the similarity between models is very high, and the value of R will increase accordingly.

[0062] The mutation module of a genetic algorithm is used to generate a trainable model by randomly altering certain structural points (such as hyperparameters of model layers) in the model generated by the crossover module. This random alteration, or mutation, is a method for maintaining genetic diversity from one population to another. Well-known mutation algorithms include shift mutation, simple inversion mutation, and scrambling mutation.

[0063] In embodiments of this disclosure, genetic crossover and partial structural permutations are performed on the internal structure of the parent model. In exchange mutation and insertion mutation operators, a portion of a single parent model is exchanged with another portion or inserted into another position. For example, this can involve transforming hyperparameters such as the learning rate, network optimization operators, and network depth in a certain layer.

[0064] Many of the newer crossover methods in genetic algorithms are also applicable to this system. For example, single-point crossover, multi-point crossover, shrinking surrogate crossover, sequential crossover (OX), circular crossover, and partially aligned crossover (PMX).

[0065] For example, the model evolution layer includes a particle swarm optimization algorithm module.

[0066] The particle swarm optimization (PSO) algorithm module treats each individual particle as a volumeless particle (point) in a D-dimensional search space, flying at a certain speed. This speed is dynamically adjusted based on its own flight experience and that of its companions, thereby moving individuals in the swarm to desirable areas. The i-th particle is denoted as X. i =(x i1 ,x i2 ,…,x id The best position it has ever been is denoted as P. i =(p i1 ,p i2 ,…,p id The index of the best position experienced by all particles in the swarm is denoted by the symbol g, i.e., Pg, also known as gbest. The velocity of particle i is denoted by V. i =(v i1 ,v i2 ,…,v id ) represents the dimension. For each generation, its (d+1)th dimension (1≤d+1≤D) changes according to the following equation:

[0067] v id+1 =w·v id +C1·rand()·(p id -x id )+C2·Rand()·(p gd -x id ),

[0068] xid+1 =x id +v id+1 ;

[0069] Where w is the inertia weight, C1 and C2 are acceleration constants, and rand() and Rand() are random values ​​between 0 and 1. Furthermore, the particle velocity Vi is limited by a maximum velocity Vmax. In this invention, the particle swarm optimization algorithm module calculates the velocity vector v according to the above equations before each round of model evolution, using both the local training history (pbest) and the training history of the qualifying training chain (gbest). id+1 Based on this, the existing data model is updated and an effective model to be trained is obtained.

[0070] In addition to the basic method of controlling development and exploration through inertia weights w, subgroup optimization (PSO) algorithms can also control the scope of each development and exploration through adaptive PSO, discrete, and other methods.

[0071] For example, the model evolution layer includes an artificial bee colony algorithm module.

[0072] The artificial bee colony algorithm mainly includes four elements: nectar source, leader bee, follower bee, and scout bee, as well as two basic behaviors: recruiting bees and abandoning nectar sources.

[0073] Bees' search for nectar sources includes the following steps:

[0074] Guide bees to discover nectar sources (better model) and share nectar source information.

[0075] Follower bees select nectar sources for foraging based on the nectar source information provided by the lead bee, according to the following formula and probability.

[0076]

[0077] Among them, the number of leading bees and nectar sources is the same, both being sn, fit i For possible solutions X i The fitness evaluation (in this invention, the accuracy on the test data).

[0078] When the quality of the nectar source found by the lead bee after multiple searches does not improve, it abandons the existing nectar source and transforms into a scout bee to continue searching for new nectar sources near the hive. When a high-quality nectar source is found, its role will revert to that of a lead bee.

[0079] Artificial bee colony optimization (ACO) is a swarm intelligence algorithm that simulates the honey-gathering process of bees. Unlike genetic algorithms and other swarm algorithms, role switching is a unique mechanism of ACO. The bee colony collaborates to find high-quality nectar sources by switching between different roles: leader bees, follower bees, and scout bees. In this invention, based on the particle swarm optimization algorithm module's local training history and the training history of the qualifying training chain, the top N optimal solutions are selected as leader bees. M follower bees and X scout bees are generated locally. Through K-fold cross-validation and a certain number of iterative training iterations, the locally optimal model is finally obtained and trained on the entire dataset to obtain a new fitness evaluation value, *fiti*. The leader bees are used to maintain good solutions, the follower bees are used to improve convergence speed, and the scout bees are used to enhance the ability to escape local optima.

[0080] For example, the model evolution layer includes an AutoML (Automated Machine Learning) algorithm module.

[0081] AutoML is a technology for automatically designing machine learning or neural network architectures. It automatically selects and runs pre-set optimization algorithms or NAS (Neural Network Search) algorithms based on local datasets, and uses a recurrent neural network (RNN) as a controller to achieve automated end-to-end structure search.

[0082] One way to implement a search architecture is as follows: Figure 2 As shown, the RNN controller uses a generative architecture A with probability P, then trains architecture A to obtain the validation accuracy R, and then adjusts the probability P value based on R and updates the RNN controller.

[0083] For machine learning, typical optimization algorithms in the AutoML module, such as Bayesian optimization, are based on building probabilistic surrogate models. They evaluate the mean and variance of the unknown array in the objective function value by examining the function values ​​of the already searched trained model (a multidimensional array). Based on this, they construct acquisition functions such as PI (Probability Improvement) and EI (Expected Improvement) to evaluate the function extrema of the multidimensional array of each hyperparameter. For neural networks, typical NAS algorithms in AutoML include PNAS (Progressive Neural Architecture Search) and ENAS (Efficient Neural Architecture Search) to explore optimal neural network architectures.

[0084] In addition to Bayesian optimization, the AutoML module can also use basic cost optimization (CBO), reinforcement learning, and other machine learning optimization algorithms.

[0085] In addition to Progressive Neural Architecture Search (PNAS) and Efficient Neural Architecture Search (ENAS), AutoML can also use Hierarchical Neural Architecture Search (HNAS), Micro Neural Architecture Search (MicroNAS) combined with Q-learning, and other neural architecture search algorithms.

[0086] In addition to using the above algorithms to implement the model evolution layer, this disclosure can also use other evolutionary algorithms that can generate models with variable elasticity, such as differential evolution (DE), swarm optimization (GSO), and cuckoo search (CSA).

[0087] This disclosure also considers that different training tasks may require different training environments. When publishing a training task, a node can upload training environment data required for that task. To store the training environment data uploaded by the node, the public blockchain layer also includes a training environment chain, which is used to store the training environment data corresponding to the training task.

[0088] In other words, nodes can publish training environment data corresponding to a training task in the training environment chain. Alternatively, when publishing a training task, a node can specify a particular training environment data in the training environment chain as the training environment data required for that training task. Specifically, the training task data can also include a second identifier for the training environment data, allowing nodes participating in the training task to retrieve the corresponding training environment data from the training environment chain based on this second identifier.

[0089] In addition, to facilitate training tasks and automatically acquire the corresponding training environment data for deployment, the node also includes a federated environment layer. The federated environment layer is used to obtain the training environment data corresponding to the training task from the training environment chain, deploy the training environment based on the training environment data, and unload the training environment after the training task is completed.

[0090] Among them, training environment data mainly refers to environment image files, which contain the software architecture and environment variable configurations required for training tasks.

[0091] For example, a hospital with a training task publishes the training task, test data, and training environment data required for training to the training task chain. If the training environment data is not pre-stored in the training environment chain, the hospital uploads it to the training environment chain. The training environment data includes not only the environment image file but also the minimum hardware configuration required for the training environment, the storage format of the environment image file, software requirements, and the runtime environment (e.g., Python, Tensorflow, PyTorch, Caffe).

[0092] In practical applications, the federated learning system disclosed herein can be used for federated learning of medical data. Specifically, the nodes in the federated learning system are various hospitals, and the private data of the hospitals mainly refers to medical data. The process of federated learning based on the above federated learning system is as follows: Figure 3 As shown, it includes:

[0093] S101. Hospitals with training needs publish training tasks, test data, and training environment data to the training task chain in the Federated Learning System. If the training environment chain does not have the training environment data for the training task pre-stored, the corresponding training environment data is uploaded.

[0094] S102. Hospitals participating in federated learning download the corresponding training environment data from the training environment chain based on the unfinished and earliest released training task. Through the model evolution layer, they automatically generate new models to be trained based on the top N qualified models with the best accuracy in the qualified model chain, and use the hospital's local private medical data for model training.

[0095] S103. If the accuracy of the obtained training model on the test data is higher than the accuracy of the latest or best qualified model on the qualified model chain, then the training model becomes the new qualified model, and the hospital determines the qualified model data from the training model and publishes the qualified model data to the qualified model chain.

[0096] S104. The remaining hospitals decentralize the verification and accept the latest qualified models into their local qualified model chain. The incentive mechanism in the federated learning system is to provide the hospital with the right to access and use the trained models for a certain period of time. On this basis, new training models are generated through the model evolution layer and the next round of federated learning is carried out, and efforts are made to generate new qualified models.

[0097] S105. When the accuracy of the qualified model is higher than the expected accuracy of the demand issuer, or when no updated qualified model is added within a certain period of time, the system automatically updates the status of the training task in the training task chain to "completed", which means the start of the next training task.

[0098] In step S101, the federated learning training task includes training environment data, namely, training environment configuration requirements, reference training model, test data, and expected accuracy. The data on-chain incentive mechanism of the training task chain provides training hospitals with the right to access and use the completed training model for a certain period of time.

[0099] The training task mentioned in step S101 includes: 1) training environment data, such as the specified learning framework (e.g., scikit-learn, Keras, PyTorch) and its version, Python version, CUDA version, etc.; 2) the model file to be trained and the network structure of the model to be trained; 3) test data; and 4) the expected accuracy. The data on-chain incentive mechanism of the training task chain provides participating hospitals with access to and use of the completed training model for a certain period of time.

[0100] In step S104, the hospital is granted access to and use the trained model for a certain period of time. The hospital can use this access permission to selectively access and download the evolving model throughout its training process. Alternatively, it can extract one or more stages of the model's evolution as a foundation to initiate new training tasks.

[0101] In addition, the nodes disclosed herein also have a permission management layer. The permission management layer is used to store the permissions sent by the federated learning system to the nodes, based on which the nodes can access data in the public blockchain layer.

[0102] Based on the aforementioned access control layer, in the application scenario of federated learning of medical data, such as Figure 4 As shown, the process for a hospital to issue a task includes:

[0103] S201. Federated learning demand issuers obtain permission for NFTs (non-fungible tokens) by joining the federated learning system for the first time or by successfully adding a qualified model to the qualified model chain.

[0104] S202. Federated learning demand publishers publish training tasks and pay a certain number of permission NFTs to the training task chain.

[0105] like Figure 5 As shown, step S202 specifically includes:

[0106] S2021. The federated learning requirement issuer searches the training environment chain to see if there is already a training environment file that meets the training conditions.

[0107] If not, first execute step S2022, where the federated learning requirement publisher uploads and adds the training environment file for the training task to the training environment chain, and then execute step S2023.

[0108] If so, proceed to step S2023, pay a certain number of permission NFTs to the training task chain, and publish the training task.

[0109] In step S201, the federated learning request issuer obtains a permissioned NFT from the federated learning system. The permissioned NFT's attribute group includes the public key address granted to the user by the system and the NFT's state (valid or invalid), with the initial NFT state being valid. This attribute group information is encrypted using an RSA asymmetric signature via the blockchain contract's private key. Other users or the system can verify (decrypt) the signature in the permissioned NFT using the blockchain contract's public key (public). If the obtained public key address and NFT state in the plaintext match the holder's public key address and NFT state information, its authenticity can be determined.

[0110] In step S202, the federated learning requirement issuer pays a certain number of permission NFTs to the training task chain. The training task chain verifies the authenticity of the permission NFTs using the public key of the blockchain contract through RSA asymmetric decryption. After verification, the status of the permission NFTs is changed to invalid based on the blockchain contract.

[0111] In some embodiments, the federated environment layer further includes a training environment and an environment image management module. In step S203, the federated demand party can publish corresponding environment training files, such as Docker, VirtualMachine (VM) images, according to its own training conditions and environment. The environment training files contain the software architecture and environment variable configuration required for training, so that the federated training participants can automatically install the images through the environment image management module and start local training in the training environment.

[0112] In step S202, the model to be trained is provided by the federated learning request issuer. The network structure of this model is stored as a config file, which, along with a local data path config file generated by the blockchain contract and defined by the participants, is available for use by federated learning participants to train the model in the corresponding training environment. Thus, the blockchain contract can evolve and update the network structure config file by referencing the evolutionary model layer, achieving the goal of automatically training, evolving, and iterating the model according to the blockchain consensus contract.

[0113] For example, when a node joins the federated learning system disclosed herein, the federated learning system sends an initial permission to the joining node. Based on the initial permission, the node can synchronize its public blockchain layer with various data in the public blockchain layers of other nodes in this federated learning system.

[0114] Nodes can acquire new permissions through various means, such as participating in training tasks and publishing qualified model data. Nodes can also pay a certain number of permissions to the training task chain to publish training tasks according to their needs.

[0115] For example, the permission is a permission NFT, and the attribute group of the permission NFT includes the public key address granted to the node by the federated learning system of this disclosure and the NFT state. Among them, the NFT state is divided into two states: valid and invalid. The initial state of the permission NFT is a valid state.

[0116] When a node publishes a training task, it needs to pay a certain number of permission NFTs to the training task chain. The training task chain can then decrypt and verify the authenticity of the permission NFTs using the public key address of the blockchain contract. Once verified, the permission NFT's status is changed to invalid. Specifically, the attribute group of the permission NFT is digitally signed and encrypted using the private key of the blockchain contract. The training task chain can verify and decrypt the digital signature in the permission NFT using the public key address of the blockchain contract. If the public key address of the blockchain contract and the status of the permission NFT match the node's public key address and the status of the permission NFT, respectively, then the verification is successful.

[0117] Compared to existing technologies, the advantages of this disclosure lie in its ability to iterate and improve models based on verifiable and effective iterative methods and test data released in the training task chain, thereby avoiding the introduction of noisy models into federated learning. This effectively solves the problems in federated learning where noisy models cannot be identified and eliminated, high-quality training models are negated by noisy models, and the best training results cannot be retained. Furthermore, this disclosure utilizes the decentralized smart contract mechanism of the federated learning system to formulate federated training rules, mirror requirements, and a decentralized multi-party consensus mechanism for sharing training environment files, simplifying the standardization of training data, rule formulation, and rule transmission in multi-party system consensus. Additionally, based on genetic algorithms and Darwinian theory, it dynamically increases the variable elasticity of the trained model structure on the basis of a pre-defined static consensus contract, expanding the exploration range of the optimal model in federated learning.

[0118] Figure 6 An embodiment of a blockchain-based federated learning method provided in this disclosure is shown, applied to nodes in the aforementioned federated learning system.

[0119] See Figure 6 The federated learning method includes:

[0120] S301. Obtain training task data from the training task chain. The training task data includes training tasks and corresponding test data.

[0121] S302. Obtain the model to be trained for the training task based on the training task data;

[0122] S303. Train the model to be trained based on the private data in the private chain layer to obtain the trained model;

[0123] S304. Use test data to validate the trained model in order to obtain the accuracy of the trained model;

[0124] S305. Publish the training model and accuracy as qualifying model data to the qualifying model chain.

[0125] Specifically, the node first obtains training task data from the training task chain. This training task data includes the training task and its corresponding test data. Then, it obtains the model to be trained based on the training task data and trains the model based on private data to obtain the trained model. Finally, it uses the test data to verify the trained model, obtains the accuracy of the trained model, and packages the trained model and the accuracy into qualified model data and publishes it to the qualified model chain.

[0126] In some embodiments, the nodes disclosed herein also include a permission management layer. The permission management layer stores the permissions sent by the federated learning system to the nodes, based on which the nodes can access data in the public blockchain layer.

[0127] Specifically, the permissions management layer includes an NFT storage module and an NFT transaction module. The NFT storage module is used to store permission NFTs automatically generated by the blockchain system when the hospital first joins the federated learning network or successfully publishes a qualified model. In addition to publishing federated training requirements or training environment images on the training requirement chain and the training environment chain, these permission NFTs can also provide the hospital with access to and use of the trained model and its complete evolution process for a certain period of time.

[0128] For example, when a node joins the federated learning system disclosed herein, the federated learning system sends an initial permission to the joining node. Based on the initial permission, the node can synchronize its public blockchain layer with various data in the public blockchain layers of other nodes in this federated learning system.

[0129] Nodes can acquire new permissions through various means, such as participating in training tasks and publishing qualified model data. Nodes can also pay a certain number of permissions to the training task chain to publish training tasks according to their needs.

[0130] For example, the permission is a permission NFT, and the attribute group of the permission NFT includes the public key address granted to the node by the federated learning system of this disclosure and the NFT state. Among them, the NFT state is divided into two states: valid and invalid. The initial state of the permission NFT is a valid state.

[0131] When a node publishes a training task, it needs to pay a certain number of permission NFTs to the training task chain. The training task chain can then decrypt and verify the authenticity of the permission NFTs using the public key address of the blockchain contract. Once verified, the permission NFT's status is changed to invalid. Specifically, the attribute group of the permission NFT is digitally signed and encrypted using the private key of the blockchain contract. The training task chain can verify and decrypt the digital signature in the permission NFT using the public key address of the blockchain contract. If the public key address of the blockchain contract and the status of the permission NFT match the node's public key address and the status of the permission NFT, respectively, then the verification is successful.

[0132] In some embodiments, the training task data includes a model to be trained or first identification information of the model to be trained. Accordingly, step S302 includes: obtaining the model to be trained from the training task data, or obtaining the model to be trained from the qualified model chain according to the first identification information.

[0133] That is, a node can directly obtain the model to be trained from the training task data, or obtain the model to be trained from the qualified model chain based on the first identifier information.

[0134] In particular, in order to avoid training based on a fixed model for a long time, which would cause the trained model to become rigid and lose its flexibility, step S303 includes: obtaining multiple qualified model data for the corresponding training task from the qualified model chain, and obtaining the model to be trained through the model evolution layer.

[0135] The model evolution layer is mainly based on at least one of the following algorithms: genetic algorithm, particle swarm optimization algorithm, artificial bee colony algorithm and / or automated machine learning algorithm, to generate a model to be trained based on multiple qualified models.

[0136] In other embodiments, the training task data further includes training environment data or second identification information of the training environment data. Accordingly, step S303 further includes: obtaining training environment data from the training task data, or obtaining training environment data from the training environment chain according to the second identification information; deploying the training environment corresponding to the training task according to the training environment data; and training the model to be trained in the training environment based on private data in the private chain layer to obtain the training model.

[0137] In addition, to effectively identify and eliminate noisy models and reduce their impact on the model to be trained, in some embodiments, step S303 includes: obtaining target compliant model data for the corresponding training task from the compliant model chain, and obtaining the model to be trained through the model evolution layer. The target compliant model data may include the top N compliant models in terms of accuracy. Here, N is a positive integer, and its specific value can be set according to actual needs.

[0138] Similarly, in order to effectively eliminate noisy models, the training task data also includes the expected accuracy. Accordingly, step S305 includes: when the accuracy of the training model reaches the expected accuracy, determining the qualified model data from the training model and publishing the qualified model data to the qualified model chain.

[0139] In practical applications, the federated learning system disclosed herein can be used for federated learning of medical data. Specifically, the nodes in the federated learning system are various hospitals, and the private data of the hospitals mainly refers to medical data.

[0140] See Figure 7 The federated learning system includes hospitals E1 through EN. The hospital's private blockchain layer includes a medical data chain, which is used to store the hospital's medical data.

[0141] For example, hospitals with training tasks can act as publishers on the training task chain to publish training task data. This includes the training task, its test data and expected accuracy, the model to be trained or its first identifier, and the training environment data or its second identifier. Hospitals wishing to participate in the training task, after obtaining the training task data, can directly obtain the model to be trained or obtain it from the qualified model chain based on the first identifier, and directly obtain the training environment data or obtain it from the training environment chain based on the second identifier. They then deploy the corresponding training environment based on the training environment data. After the training environment is deployed, the model to be trained is trained based on private data to obtain the trained model. The test data is then used to verify the trained model to obtain its accuracy. First, determine whether the accuracy of the trained model meets the publisher's expected accuracy. If it does, the trained model and its accuracy can be published as qualified model data to the qualified model chain. If it does not meet the expected accuracy, then determine whether the accuracy of the trained model meets the expected accuracy. If it does, the trained model and its accuracy can be published as qualified model data to the qualified model chain. If it does not meet the expected accuracy, the trained model can continue to be trained.

[0142] The specific process of hospitals participating in federal learning is as follows: Figure 8 As shown, it includes:

[0143] S401. Federated learning participants search for the earliest unfinished and published training task in the training task chain, which includes training environment data, including the model file to be trained, the network structure of the model to be trained, test data, and the expected accuracy of the federated learning publisher.

[0144] S402. Based on the training environment data, the participants in the federated learning process search, download and install the corresponding training environment in the training environment chain.

[0145] S403: Federated learning participants randomly generate new models to be trained based on the historical compliant models in the model evolution layer and train them to obtain the trained model;

[0146] S404: Determine if the accuracy of the trained model is higher than that of the existing highest-accuracy model. If not, execute step S403 again. If yes, execute step S405.

[0147] S405. The federated learning participants publish the trained model parameters and accuracy on the qualified model chain. After multi-party decentralized verification, the model is uploaded to the chain. The system will then reward NFTs with permissions proportional to the training time and model accuracy.

[0148] S406: If the accuracy of the latest qualified model is higher than the accuracy specified by the publisher in the training task, or if no new qualified model is generated within a certain period of time, the system marks the current training task as the end state on the training task chain and starts the next training task.

[0149] In step S401, the status attributes of the training task include three categories: incomplete, completed, and timed out. The training task chain's smart contract automatically updates the status according to pre-defined consensus rules and training progress, and then remotely synchronizes it to all hospitals through a federated learning system.

[0150] In step S402, the federated learning participants automatically download the training environment files required for the training task through the environment mirror management module, which facilitates the federated training participants to quickly participate in the training task and start local training.

[0151] In step S405, the multi-party decentralized verification mechanism involves each federated learning participant publishing the compliant model data, including the compliant model and its accuracy on test data, to the compliant model chain. The remaining federated learning participants then decentralizedly synchronize this compliant model data, verify its validity, and choose to accept or reject the model.

[0152] The specific verification method is to download the qualified model data and verify the accuracy of the model on the test data submitted by the demand issuer. If the verified accuracy is consistent with the accuracy provided in the qualified model data and is higher than the previous best model result, then the model is accepted and added to the qualified model chain.

[0153] In step S405, the data on-chain incentive mechanism involves feeding back a certain number of valid permission NFTs, signed by the blockchain contract private key, to the hospital that packages the data on the chain. In addition to publishing training tasks or training environment data on the training task chain and the training environment chain, these permission NFTs can also provide the hospital with access to and use of the trained model and its complete (or partial) model evolution process for a certain period of time.

[0154] Figure 9 The structure of one type of electronic device disclosed herein is illustrated. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the aforementioned federated learning method. Figure 9 The electronic device 50 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0155] like Figure 9 As shown, the electronic device 50 can also be represented in the form of a general computing device, such as a server device. The components of the electronic device 50 may include, but are not limited to: at least one processor 51, at least one memory 52, and a bus 53 connecting different system components (including memory 52 and processor 51).

[0156] Bus 53 includes a data bus, an address bus, and a control bus.

[0157] The memory 52 may include volatile memory, such as random access memory (RAM) 521 and / or cache memory 522, and may further include read-only memory (ROM) 523.

[0158] The memory 52 may also include a program / utility 525 having a set (at least one) of program modules 524, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0159] The processor 51 performs various functional applications and data processing, such as the federated learning method described above, by running computer programs stored in the memory 52.

[0160] Electronic device 50 can also communicate with one or more external devices 54 (e.g., keyboard, pointing device, etc.). This communication can be performed via input / output (I / O) interface 55. Furthermore, the model-generating device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 56. Figure 9 As shown, network adapter 56 communicates with other modules of the model-generated device 50 via bus 53. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 50, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.

[0161] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.

[0162] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described federated learning method.

[0163] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.

[0164] In a possible implementation, this disclosure can also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to execute and implement the above-described federated learning method.

[0165] The program code for executing this disclosure can be written using any combination of one or more programming languages. The program code can be executed entirely on a user device, partially on a user device, as a standalone software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0166] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but all such changes and modifications fall within the scope of protection of the present invention.

Claims

1. A blockchain-based federated learning system, characterized in that, Federated learning for medical data, the federated learning system includes multiple nodes, the nodes being hospitals, and the nodes include a public chain layer, a private chain layer, a federated environment layer, and a model evolution layer; The public blockchain layer includes a training task chain and a benchmark model chain. The training task chain is used to store training task data in the federated learning system. The training task data includes training tasks and test data corresponding to the training tasks. The benchmark model chain is used to store benchmark model data in the federated learning system. The public blockchain layer also includes a training environment blockchain, which is used to store the training environment data corresponding to the training task. The training environment data is shared. The private chain layer is used to store private data, including medical data. The node is used to obtain training task data from the training task chain, obtain the model to be trained for the training task from the training task chain or the benchmark model chain, train the model to be trained based on the private data in the private chain layer to obtain a training model, verify the training model using the test data to obtain the accuracy of the training model, determine benchmark model data from the training model based on the accuracy, and publish the benchmark model data to the benchmark model chain. The node is also used to publish the training environment data corresponding to the training task in the training environment chain; The federated environment layer is used to obtain the training environment data corresponding to the training task from the training environment chain, deploy the training environment based on the training environment data, and unload the training environment after the training task is completed. The model evolution layer is used to generate the model to be trained based on the qualified model data corresponding to the training task in the qualified model chain; The node also includes a permission management layer, which stores the permissions sent by the federated learning system to the node, and the node is used to obtain data in the public blockchain layer based on the permissions. Based on the aforementioned permission management layer, the process for hospitals to issue tasks includes: Federated learning demand providers obtain permission NFTs by joining the federated learning system for the first time or by successfully adding a qualified model to the qualified model chain; Federated learning demand providers publish training tasks and pay a certain number of permission NFTs to the training task chain. The federated learning request issuer obtains a permissioned NFT from the federated learning system. The attribute group of the permissioned NFT contains the public key address granted to the user by the system and the NFT state. The initial NFT state is valid. The attribute group information is RSA asymmetric signed by the private key of the blockchain contract. Other users or the system verify the signature in the permissioned NFT using the public key of the blockchain contract. If the public key address and NFT state in the plaintext match the holder's public key address and the NFT state information, its authenticity can be determined. The federated learning demand issuer pays a certain number of permission NFTs to the training task chain. The training task chain verifies the authenticity of the permission NFTs using RSA asymmetric decryption with the blockchain contract public key. After successful verification, the status of the permission NFTs is changed to invalid based on the blockchain contract.

2. The blockchain-based federated learning system according to claim 1, characterized in that, The model evolution layer is used to generate the model to be trained based on at least two qualified model data corresponding to the training task in the qualified model chain; And / or, The model evolution layer is used to generate the model to be trained based on at least one of genetic algorithms, particle swarm optimization algorithms, artificial bee colony algorithms, and automated machine learning algorithms, according to multiple qualified models.

3. The blockchain-based federated learning system according to claim 1, characterized in that, The training task data also includes the expected accuracy. The node is used to determine the qualified model data from the training model when the accuracy of the training model reaches the expected accuracy, and publish the qualified model data to the qualified model chain.

4. The blockchain-based federated learning system according to any one of claims 1-3, characterized in that, The node is also used to publish the training task data in the training task chain.

5. A blockchain-based federated learning method, characterized in that, A node applied to a blockchain-based federated learning system according to any one of claims 1-4, wherein the federated learning method comprises: Training task data is obtained from the training task chain, wherein the training task data includes training tasks and test data corresponding to the training tasks; The model to be trained for the training task is obtained based on the training task data; The model to be trained is trained based on the private data in the private chain layer to obtain the trained model; The training model is validated using the test data to obtain the accuracy of the training model; Based on the accuracy rate, qualifying model data is determined from the training model, and the qualifying model data is published to the qualifying model chain.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the blockchain-based federated learning method as described in claim 5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the blockchain-based federated learning method as described in claim 5.