Blockchain-based deep neural network model federated recombination method and system
Constructing alliance chains and smart contracts between multiple nodes through blockchain technology, combined with the interstellar file system, solves the problems of single node restrictions and data security in the reorganization of deep neural network models, and achieves safe cooperation and fair contribution distribution among multiple nodes. , improving model reorganization efficiency and performance.
Patent Information
- Application Number
- PCT/CN2023/091677
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-11
- Filing Date
- 2023-04-28
- Publication Date
- 2024-10-17
AI Technical Summary
In the existing technology, deep neural network model reorganization is mainly performed on a single node, which is limited by user computing power and data and cannot be effectively expanded. Moreover, federated learning lacks the security of data sharing and a fair contribution distribution mechanism.
Using a blockchain-based multi-node federation reorganization method, Hyperledger Fabric is used to build alliance chains and smart contracts, combined with the interstellar file system for data storage and sharing, to achieve secure cooperation and contribution distribution among multiple nodes.
It achieves safe and trusted cooperation among multiple nodes, improves the efficiency of model reorganization and data privacy, ensures fairness in contribution distribution and steady improvement in target model performance.
Smart Images

Figure CN2023091677_17102024_PF_FP_ABST
Abstract
Description
A blockchain-based deep neural network model federated reorganization method and system Technical Field
[0001] The present invention belongs to the field of federated deep learning and blockchain, and relates to a method and system for federated reorganization of a deep neural network model based on blockchain. Background Art
[0002] Blockchain technology is a distributed database technology originally developed to support transactions in the cryptocurrency Bitcoin. Bitcoin's creator, Satoshi Nakamoto, proposed a decentralized digital currency system that leverages blockchain technology to ensure transaction security and reliability. The core of blockchain technology is decentralized data management. Unlike traditional centralized data management methods, blockchain technology stores data across multiple nodes through a distributed network, ensuring data immutability and security.
[0003] Deep neural network model recombineering is a deep neural network model reuse task. With the rapid development of deep learning, a vast number of pre-trained deep neural network models are available online. Reusing pre-trained models can reduce the cost of training new models from scratch. The goal of model recombineering is to extract knowledge from multiple source models that handle different tasks, given only the source models and their inference outputs, and without access to their training data. This knowledge is then integrated into a single, compact target model, resulting in a lightweight target model that can handle all source tasks with high performance.
[0004] Model reorganization tasks are only performed on a single node. However, the limited computing power and data of single-node users restrict further expansion of model reorganization, and the target task settings are relatively restricted. Federated learning methods are based on the mutual trust between multiple nodes, but this trust foundation cannot be achieved across multiple nodes in the entire network, and the security of data sharing between nodes cannot be guaranteed during the integration process. At the same time, model federation reorganization requires fair and reasonable distribution of contributions among the nodes participating in the model reorganization process.
[0005] Summary of the Invention
[0006] To solve the above problems, the present invention provides a blockchain-based deep neural network model federated reorganization method and system.
[0007] Taking into account the limited computing power and data of single-node users, this paper proposes a method for the federated reorganization of multi-node models. Based on blockchain technology, cooperation agreements between multiple nodes are reached through blockchain smart contracts, ensuring the security, reliability, and fairness of multi-node cooperation. Furthermore, a method and system for the federated reorganization of deep neural network models based on blockchain are proposed. The technical solution of this invention is:
[0008] A blockchain-based deep neural network model federated reorganization method and system includes the following steps:
[0009] 1. Build a consortium chain for model federation reorganization;
[0010] Based on the Hyperledger Fabric framework, a consortium chain is built that supports model federation and collaboration. A consortium chain consists of four roles: consortium members, consortium operators responsible for consortium chain maintenance and updates, smart contract auditors, and blockchain developers. Nodes participating in model federation and collaboration are considered consortium members. Hyperledger Fabric is the foundational framework for consortium chains, providing blockchain technologies such as permission management, ledger maintenance, and smart contracts. Users only need to configure the corresponding business logic. Building on this framework, the business operations between consortium members are model federation and collaboration. Business operations are published by clients and received by model trainers and model reconstructors. These three parties collaborate through smart contracts, thus building a consortium chain that supports model federation and collaboration.
[0011] 2. Set up the smart contract for the model federation reorganization;
[0012] The smart contract is signed between the client, the model trainer, and the model reorganization verifier, and is automatically executed according to the settings to achieve cooperation and constraints among the three parties. The basic smart contract for setting up the model federation reorganization is as follows:
[0013] 1) Customer:
[0014] a) Establishing the objectives and tasks for the reorganization of the model federation and the criteria for acceptance of the final model;
[0015] b) Provide the model reconstruction verifier with the target task’s detection data (i.e., a subset of the target task dataset after sampling) and set the task reward for the model reconstruction verifier;
[0016] c) Specify the source model that the model trainer needs to provide, set the minimum transferability score for the model trainer to participate in the reorganization process in step 5.1, set the training reward and distribute the corresponding reward to the model trainer according to the contribution calculation method in step 6.
[0017] 2) Model training:
[0018] a) After the Model Restructuring Verifier performs the first transferability assessment in step 5.1, the Model Training Nodes that fail to be selected may choose to exit the task early, or continue to participate in the task and ultimately receive corresponding rewards through the contribution calculation method in step 6;
[0019] b) Provide the source model of the target task to the model reconstruction verifier;
[0020] 3) Model Reorganization Verification Party:
[0021] a) Based on the detection data of the target task, the federation reconstructs the source model to obtain the target model, and submits the target model that meets the acceptance criteria to the client;
[0022] b) Calculate the contribution value for each model training party using the contribution calculation method in step 6.
[0023] 3.Store data during the model federation reorganization process;
[0024] Sharing of probe data and target models between clients and model reconstruction verifiers, as well as sharing of source models between model trainers and model reconstruction verifiers, is achieved through a decentralized storage (DS) system to ensure the security of data and private machine learning model sharing. The DS system makes access to these data and learning models more affordable, faster, and more secure, better meeting the communication needs of federated learning. After nodes store data or private models in the DS system, they generate and share unique hash addresses representing these network assets, ensuring the integrity and authorization of the sharing process. Specifically, we will use the InterPlanetary File System (IPFS) for distributed storage in the subsequent process.
[0025] 4. Training model: the source model of the training party;
[0026] Model federation and reconstruction consists of two parts: training the source model and verifying the target model through federation. These two parts are completed by the model trainer and the model reconstruction verifier, respectively. The model trainer provides the source model required by the model reconstruction verifier. Source model training is completed in two steps: local pre-training and knowledge distillation.
[0027] The model training method is based on local data, and the local pre-training model is trained, using M={M1,M2,…,M N} represents the local pre-trained models of N model training nodes. To ensure privacy, knowledge distillation is performed on the local pre-trained models to obtain the source model, which is then provided to the model reconstruction and verification parties for federated reconstruction and verification.
[0028] The source model learns knowledge from the local pre-trained model through a feature-based knowledge distillation method. During the knowledge distillation process, due to the heterogeneity of the network structure, a translation module is used to align the feature output dimensions of the local pre-trained model and the source model, and the source model output is converted to a predefined output length through the translation module. and Represents the source model and local pre-trained model M of the nth node respectively n The length of the features after alignment. They represent the source model and local pre-trained model parameters of the nth node during the tth communication with the model reconstruction verifier. X is the model M n At the same time, the intermediate output of the source model is made to mimic the pre-trained model, and the feature knowledge distillation loss is calculated as follows:
[0029] The source model parameters are updated using gradient descent as follows:
[0030] After local knowledge extraction, the source model parameters The source model uploaded to the InterPlanetary File System is used as the model reconstruction verifier. The model reconstruction verifier obtains the model parameters through the unique hash address provided by the model training party.
[0031] 5. Model federal reorganization;
[0032] The source model obtained in step 4 is federated by the model reorganization verification party. The source models provided by the model training party are trained based on different local data. It is necessary to select a model that is more favorable to the target model for federation reorganization. Therefore, model federation reorganization has the following two steps: (1) source model selection; (2) federation reorganization and performance verification.
[0033] 5.1. Select a favorable model from the source model set for federated reorganization in step 5.2. In order to measure whether the source model is favorable to the target model, a saliency map is used to measure the transferability of the knowledge contained in the source model, thereby measuring the favorability. Specifically, based on the probe data and model requirements provided by the client, the model reorganization verification party first trains the original target model and calculates the average saliency map of the target model for the probe data. Then, based on the source model, the average saliency map of each source model for the probe data is calculated. The two are calculated in pairs to obtain the transferability score of the source model. The formula for calculating the saliency map is as follows:
[0034] where Ψ k represents the implicit features of the k-th layer of the source model, The k-th layer of the source model representing the n-th node detects the data D T An input image x j The salient map.
[0035] The kth layer of the source model of the nth node has all the detection data D T The saliency map of Through all The average value Where S is D T Total number of images. Transferability of two models γ n,T The normalized selection probability p of the source modeln It can be estimated as follows, where is the saliency map of the k-th layer of the target model,
[0036] Select the probability according to the source model, and choose p n The top K source models with a transferability score not lower than the minimum transferability score set by the client are reorganized and updated in step 5.2.
[0037] 5.2. Federate the selected source model and verify the performance of the target model obtained after the reorganization. Based on the original target model parameters obtained in the first step 5.1, the source model is federated and reorganized in a greedy manner, so that after each target model is federally reorganized, the target model parameters are updated and the target model performance is improved. In the greedy reorganization process, the source model to be added is first verified and tested using the detection data provided by the client, and then the source model parameters are averaged with the target model parameters in descending order of the verification test performance. The fused target model is again verified and tested based on the detection data. If the performance is improved, the updated target model parameters are retained and the accuracy is recorded. i Repeat the above steps for the source models to be added, sorted in descending order by the value of the target model's performance improvement achieved by the i-th source model training node, until the end. This is considered the completion of one iteration of the federation reorganization. When the target model's performance meets the acceptance criteria set by the client, the model reorganization verifier uploads the target model to the InterPlanetary File System and provides the client with the corresponding hash address.
[0038] 6. Calculate the contribution value of the model training party;
[0039] Based on the transferability scores of the source models provided by each model training party in step 5 and the target model performance index improvement number during the federation reorganization process, a normalized calculation is performed to obtain the contribution measure of each model training party to the target model. t,i It represents the contribution value of the i-th model training node of the model training party and the model reorganization verification party in the t-th federated communication iteration. The contribution calculation is as follows: R t,i =α*acc t,i +β*p t,i (4)
[0040] where acc t,i The performance improvement of the target model caused by the selected source model in step 5.2, p t,i is the transferability score of the source model selected in step 5.1. If it is not selected, p t,i =0, α, β are variable parameters used to adjust acc t,i ,p t,iThe weight ratio of the two parameters and the unification of the two numerical magnitudes.
[0041] Considering that the growth of the target model performance is approximately logarithmic nonlinear growth, the contribution value of each iteration cannot be directly accumulated and averaged. Therefore, the exponential moving average method with bias correction is used. As the number of iterations increases, the weight of the contribution value of the recent iteration is increased, and the weight of the contribution value of the previous iteration is reduced. Finally, the cumulative contribution value of the i-th model training square after t rounds of communication iterations is The calculation is as follows:
[0042] Where t = 0 By default, the contribution value R t,i All are adopted, so according to the formula The μ value can be calculated. Through the following deviation correction, the final contribution value E of the final i-th model training square can be obtained: i , and according to the final contribution value E i The model training party can obtain the corresponding task reward after calculation. Where B is the total reward of the model training task given by the client, B i The corresponding reward for training the i-th model:
[0043] The method and system for implementing the federal reorganization of a deep neural network model based on blockchain of the present invention include a consortium chain module for model federal reorganization, a smart contract module for model federal reorganization, a distributed storage data sharing module, a source model training module, a model federal reorganization module, and a model reorganization contribution distribution module.
[0044] This blockchain-based deep neural network model federation method and system first builds a consortium chain based on the Hyperledger Fabric framework, tailored to the model federation collaboration task. Based on the specific characteristics of the model federation task, a corresponding smart contract is developed to define the business logic, establishing a secure and trustworthy collaboration method among the client, model trainer, and model reassembly verifier. Leveraging the fast and secure transmission and storage capabilities of the InterPlanetary File System (IPFS), a distributed storage system, this method further ensures data sharing security during the model federation process and meets the communication and transmission requirements required during the process. Secondly, the model trainer performs knowledge distillation on a pre-trained model trained on local data. The resulting model serves as the source model for the model federation process, ensuring the privacy of the pre-trained model while transferring model knowledge. The model reassembly verifier selects source models with the highest transferability to the target task based on the saliency map. These selected source models are then sequentially integrated into the target model through a greedy reassembly process, with multiple communication iterations until the target model meets the client's acceptance criteria. Finally, according to the contribution calculation method, the transferability score of the source model provided by the model training party and the improvement of the target model performance index during the reorganization process are normalized to obtain the contribution value of each iteration, and all iterative contribution values are subjected to exponential moving average calculation with bias correction to obtain the corresponding final contribution value of each model training party, and this is used as the weight for task reward distribution.
[0045] The advantages of the present invention are: taking into account the reusability of deep neural network models and the limited computing power and data when reorganizing single-node user models, a multi-node model federation is performed. At the same time, considering the data security and privacy in the federation process, as well as the mutual distrust of cooperation between multiple nodes in the federation, a consortium chain and smart contract based on Hyperledger Fabric are established to provide a method for multi-node security and trusted cooperation. The InterPlanetary File System is introduced to ensure data security and privacy. Secondly, the parameter update process of the federation uses greedy reorganization to ensure a stable growth in the performance of the target model and facilitate the calculation of the model reorganization contribution. Finally, based on the source model portability and the target model performance improvement number in the model federation reorganization process, a fair contribution distribution is made to the model training party through normalization calculation and exponential moving average calculation with bias correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] FIG1 is a schematic diagram of the federal reorganization process of the blockchain-based deep neural network model of the present invention.
[0047] FIG2 is a schematic diagram of source model training of the present invention.
[0048] FIG3 is a schematic diagram of the model federation reorganization and performance verification process of the present invention. DETAILED DESCRIPTION
[0049] The following clearly and completely explains and describes the technical solution of the present invention in conjunction with the accompanying drawings, and illustrates exemplary embodiments of the present invention. This detailed description should not be considered as a limitation of the present invention, but should be understood as a more detailed description of certain aspects and features of the present invention when applied.
[0050] The present invention provides a multi-party collaborative vehicle detection and classification method based on a blockchain-based deep neural network model federation reorganization method, comprising the following steps:
[0051] 1. Build a consortium chain for model federation reorganization;
[0052] Based on the Hyperledger Fabric framework, a consortium chain compliant with model federation and collaboration is constructed. A consortium chain is composed of four roles: consortium members, consortium operators responsible for consortium chain maintenance and updates, smart contract auditors, and blockchain developers. Nodes participating in model federation and collaboration are considered consortium members. The Hyperledger Fabric framework is the foundational framework for consortium chains, providing blockchain technologies such as permission management, ledger maintenance, and smart contracts. Users only need to configure the corresponding business logic. Building on this framework, the business model between consortium members is set up as model federation and collaboration. Vehicle inspection and classification services are issued by the client and received by the model trainer and model reconstructor verifier. These three parties collaborate through smart contracts, thus constructing a consortium chain compliant with model federation and collaboration (Figure 1).
[0053] 2. Set up the smart contract for the model federation reorganization;
[0054] The smart contract is signed between the client, the model trainer, and the model reorganization verifier, and is automatically executed according to the settings to achieve cooperation and constraints among the three parties. The basic smart contract for setting up the model federation reorganization is as follows:
[0055] 1) Customer:
[0056] a) Establishing the target tasks of the model federation reorganization for vehicle detection and classification and final model acceptance criteria;
[0057] b) Provide the target task detection data D for the model reconstruction verification party T (i.e., a subset of the vehicle detection and classification image dataset collected by the client) and setting the task reward for the model reconstruction verification party;
[0058] c) Specify the source model that the model trainer needs to provide, and set the minimum transferability score p for the model trainer to participate in the reorganization process in step 5.1 thres , set the training reward and follow the contribution calculation method in step 6 to allocate corresponding rewards to the model training party.
[0059] 2) Model training:
[0060] a) After the Model Restructuring Verifier performs the first transferability assessment in step 5.1, the Model Training Nodes that fail to be selected may choose to exit the task early, or continue to participate in the task and ultimately receive corresponding rewards through the contribution calculation method in step 6;
[0061] b) Provide the source model of the target task to the model reconstruction verifier;
[0062] 3) Model Reorganization Verification Party:
[0063] a) Based on the detection data of the target task, the federation reconstructs the source model to obtain the target model, and submits the target model that meets the acceptance criteria to the client;
[0064] b) Calculate the contribution value for each model training party using the contribution calculation method in step 6.
[0065] 3.Store data during the model federation reorganization process;
[0066] Sharing of probe data and target models between clients and model reconstruction verifiers, as well as sharing of source models between model trainers and model reconstruction verifiers, is achieved through a decentralized storage (DS) system to ensure the security of data and private machine learning model sharing. The DS system makes access to these data and learning models more affordable, faster, and more secure, better meeting the communication needs of federated learning. After nodes store data or private models in the DS system, they generate and share unique hash addresses representing these network assets, ensuring the integrity and authorization of the sharing process. Specifically, we will use the InterPlanetary File System (IPFS) for distributed storage in the subsequent process.
[0067] 4. Training model: the source model of the training party;
[0068] Model federation and reconstruction consists of two parts: training the source model and verifying the federated reconstruction of the source model to obtain the target model. These two parts are completed by the model trainer and the model reconstruction verifier, respectively. The model trainer provides the source model required by the model reconstruction verifier. Source model training is completed in two steps: local pre-training and knowledge distillation (Figure 2).
[0069] The model training method is based on local data, and the local pre-training model is trained, using M={M1,M2,…,M N} represents the local pre-trained models of N model training nodes. To protect customer data privacy, the model training nodes cannot access the customer's vehicle detection and classification image data. Instead, they train the local pre-trained models based on local datasets highly relevant to vehicle detection and classification. Furthermore, to ensure data privacy for the model training nodes, knowledge distillation is performed on the local pre-trained models to generate the source model, which is then provided to the model reconstruction and verification nodes for federated reconstruction and verification.
[0070] The source model learns knowledge from the local pre-trained model through a feature-based knowledge distillation method. During the knowledge distillation process, due to the heterogeneity of the network structure, a translation module is used to align the feature output dimensions of the local pre-trained model and the source model, and the source model output is converted to a predefined output length through the translation module. For example, here our translation module is composed of 3 convolutions with 1×1 kernels. and Represents the source model and local pre-trained model M of the nth node respectively n The length of the features after alignment. They represent the source model and local pre-trained model parameters of the nth node during the tth communication with the model reconstruction verifier. X is the model M n At the same time, the intermediate output of the source model is made to mimic the pre-trained model, and the feature knowledge distillation loss is calculated as follows:
[0071] The source model parameters are updated using gradient descent as follows:
[0072] After local knowledge extraction, the source model parameters The source model uploaded to the InterPlanetary File System is used as the model reconstruction verifier. The model reconstruction verifier obtains the model parameters through the unique hash address provided by the model training party.
[0073] 5. Model federal reorganization;
[0074] The source model obtained in step 4 is federated by the model reorganization verification party. The source models provided by the model training party are trained based on different local data. It is necessary to select a source model that is more favorable to the target model for federation reorganization. Therefore, model federation reorganization has the following two steps: (1) source model selection; (2) federation reorganization and performance verification (Figure 3).
[0075] 5.1. Select a favorable model from the source model set for federated reorganization in step 5.2. To measure whether the source model is favorable to the target model, a saliency map is used to measure the transferability of the knowledge contained in the source model, thereby measuring the favorableness. To ensure customer data privacy, the model reorganization verifier only has the target task's detection data D T(i.e., a subset of the image dataset collected by the client for vehicle detection and classification). Based on the client's model requirements, the model reconstruction verification party first trains the original target model and calculates the average saliency map of the target model for the detection data. Then, based on the source model, the average saliency map of each source model for the detection data is calculated. The two are calculated in pairs to obtain the transferability score of the source model. The saliency map calculation formula is as follows:
[0076] where Ψ k represents the implicit features of the k-th layer of the source model, The k-th layer of the source model representing the n-th node detects the data D T An input image x j Here, it is calculated by one forward and backward pass.
[0077] The kth layer of the source model of the nth node has all the detection data D T The saliency map of Through all The average value Where S is D T Total number of images. Transferability of two models γ n,T The normalized selection probability p of the source model n It can be estimated as follows, where is the saliency map of the k-th layer of the target model,
[0078] In order to make full use of the implicit features extracted by the model, we use the implicit features of the last layer before the output layer of the model to calculate the saliency map and selection probability. According to the source model selection probability, we select p n Not less than the minimum transferability score p set by the client thres Perform the reorganization update in step 5.2 on the top K source models.
[0079] 5.2. Federate the selected source model and verify the performance of the target model obtained after the reorganization. Based on the original target model parameters obtained when performing step 5.1 for the first time, the source model is federated and reorganized in a greedy manner, so that each time the target model is federally reorganized, the target model parameters are updated and the target model performance is improved. In the greedy reorganization process, the source model to be added is first verified and tested using the detection data provided by the client, and then the source model parameters are averaged with the target model parameters in descending order of the verification test performance. The fused target model is again verified and tested based on the detection data. If the performance is improved, the updated target model parameters are retained and the accuracy is recorded. iThe value by which the i-th source model training node improves the target model's performance is repeated for the source models to be added in descending order until completion, which is considered the completion of one iteration of federated reorganization. When the target model performance for vehicle detection and classification meets the acceptance criteria set by the client, the model reorganization verifier uploads the target model to the InterPlanetary File System and provides the client with the corresponding hash address.
[0080] 6. Calculate the contribution value of the model training party;
[0081] Based on the transferability scores of the source models provided by each model training party in step 5 and the performance index improvement of the target model during the federation reorganization process, a normalized calculation is performed to obtain the contribution value of each model training party to the target model. t,i It represents the contribution value of the i-th model training node of the model training party and the model reorganization verification party in the t-th federated communication iteration. The contribution calculation is as follows: R t,i =α*acc t,i +β*p t,i (6)
[0082] where acc t,i The performance improvement of the target model caused by the selected source model in step 5.2, p t,i is the transferability score of the source model selected in step 5.1. If it is not selected, p t,i =0, α, β are variable parameters used to adjust acc t,i ,p t,i The weight ratio of the two parameters and the unification of the two numerical magnitudes, for example, here, acc t,i ,p t,i They are all scores between 0 and 1. We set α = 0.8 and β = 0.2, which means that more emphasis is placed on the improvement of the target model's performance by the source model during each iteration of the model federation reorganization.
[0083] Considering that the growth of the target model performance is approximately logarithmic nonlinear growth, the contribution value of each iteration cannot be directly accumulated and averaged. Therefore, the exponential moving average method with bias correction is used. As the number of iterations increases, the weight of the contribution value of the recent iteration is increased, and the weight of the contribution value of the previous iteration is reduced. Finally, the cumulative contribution value of the i-th model training square after t rounds of communication iterations is The calculation is as follows:
[0084] Where t = 0 By default, the contribution value R t,i All the contributions of all rounds are used in the calculation, and the formula of moving window size and weight parameter is The corresponding μ value can be calculated based on the final iteration round. At the same time, the final contribution value E of the final i-th model training square can be obtained through the following deviation correction: i , and according to the final contribution value E i The calculated model training party can obtain the corresponding task reward. Rewards:
[0085] Where B is the total reward value of the model training task given by the client, B i is the corresponding reward value that the i-th model trainer can obtain. As a result, the smart contract in the alliance chain is automatically executed, and the model trainer nodes participating in the vehicle detection and classification business released by the client automatically obtain the corresponding reward value. At the same time, the model reorganization verifier obtains the specified reward value agreed in the contract, and the client obtains the final target model of vehicle detection and classification.
[0086] The method and system for implementing the federal reorganization of a deep neural network model based on blockchain of the present invention include a consortium chain module for model federal reorganization, a smart contract module for model federal reorganization, a distributed storage data sharing module, a source model training module, a model federal reorganization module, and a model reorganization contribution distribution module.
[0087] The specific contents of each module correspond to steps 1 to 6 of the inventive method of this embodiment.
[0088] Considering the reusability of deep neural network models and the limited computing power and data available for single-node user model reorganization, multi-node model federation collaboration and corresponding contribution allocation are implemented. Furthermore, considering data security and privacy during the federation process, as well as the mutual distrust between multiple nodes in the federation, a blockchain-based deep neural network model federation method and system is proposed based on Hyperledger Fabric's consortium chain and smart contracts. First, a consortium chain tailored to the model federation collaboration task is constructed based on the Hyperledger Fabric framework. A corresponding smart contract is developed to define the business logic, establishing a secure and trustworthy collaboration method among clients, model trainers, and model reorganization verifiers. Furthermore, the InterPlanetary File System (IPFS), a distributed storage system, ensures data sharing security during the model federation process and meets the communication and transmission requirements. The model trainer then performs knowledge distillation on the local pre-trained model trained on local data, and the resulting model serves as the source model for the model federation reorganization process. The model reorganization verifier selects source models with higher transferability to the target task based on the saliency map. These selected source models are then successively integrated into the target model through greedy reorganization, with multiple communication iterations until the target model meets the client's acceptance criteria. Finally, according to the contribution calculation method, the transferability score of the source model provided by the model trainer and the performance improvement of the target model during the reorganization process are normalized to obtain the contribution value of each iteration. All iterative contribution values are then subjected to a bias-corrected exponential moving average calculation to obtain the corresponding final contribution value for each model trainer, which is used as the weight for task reward allocation. This invention combines blockchain technology with model reorganization methods in the field of artificial intelligence, making a new attempt in the field of secure and trusted collaborative model federation reorganization research, achieving good results and having high application value and development prospects.
[0089] The contents described in the embodiments of this specification are merely an enumeration of the implementation forms of the inventive concept. The scope of protection of the present invention should not be regarded as limited to the specific forms described in the embodiments. The scope of protection of the present invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.
Claims
1. A method for federal reorganization of a deep neural network model based on blockchain, comprising the following steps: Step 1. Build a consortium chain based on the Hyperledger Fabric framework that complies with the model federation reorganization cooperation; The alliance chain is composed of four roles: alliance members, alliance operators responsible for the maintenance and update of the alliance chain, smart contract auditors, and blockchain developers. Nodes participating in the model federal restructuring cooperation are alliance members; Hyperledger Fabric framework is a basic framework for alliance chains, providing blockchain technologies such as permission management, ledger maintenance, and smart contracts. Users only need to set the corresponding business logic; based on this framework, the business between alliance members is set as model federal restructuring cooperation. The business is released by the client and received by the model training party and the model restructuring verification party. The three parties reach cooperation through smart contracts, thereby constructing a model federal restructuring alliance chain; Step 2. Set up the smart contract for the model federation reorganization; Smart contracts are signed between the client, the model training party, and the model reorganization verification party, and are automatically executed according to the settings to achieve tripartite cooperation and constraints, ensuring the security of the model federation reorganization process; Step 3. Store data during the model federation reorganization process; The sharing of probe data and target models between the client and the model reconstruction verifier, as well as the sharing of source models between the model trainer and the model reconstruction verifier, are achieved through a decentralized storage (DS) system to ensure the security of data and private machine learning model sharing. The DS system makes access to these data and learning models more affordable, faster, and more secure, and better meets the communication needs of the federated learning process. After the node stores the data or private model in the DS system, it will generate a unique hash value address representing these network assets and share them, ensuring the integrity and authorization of the sharing process. Step 4. The source model of the training model training party is handed over to the model reconstruction verification party for federated reconstruction; Model federation reorganization is divided into two parts: one is the source model training task, and the other is the federation reorganization of the source model and verification to obtain the target model; the two parts are completed by the model training party and the model reorganization verification party respectively, and the model training party provides the source model required by the model reorganization verification party; the source model training is completed in two steps: local pre-training and knowledge distillation; The model training method is based on local data, and the local pre-training model is trained, using M = {M1, M2, ..., M N } represents the local pre-trained models of N model training nodes; To ensure privacy, knowledge distillation is performed on the local pre-trained model to obtain the source model, which is then provided to the model reconstruction and verification party for federated reconstruction and verification. The source model learns knowledge from the local pre-trained model through a feature-based knowledge distillation method; During the knowledge distillation process, due to the heterogeneity of the network structure, a translation module is used to align the feature output dimensions of the local pre-trained model and the source model, and the source model output is converted to a predefined output length through the translation module; and Represents the source model and local pre-trained model M of the nth node respectively n The length of the features after alignment; They represent the source model and local pre-training of the nth node during the tth communication with the model reorganization verifier. Training model parameters; X is model M n training data; at the same time, the intermediate output of the source model is made to mimic the pre-trained model, and the feature knowledge distillation loss is calculated as follows: The source model parameters are updated using gradient descent as follows: After local knowledge extraction, the source model parameters Upload to Interstellar File System as the source model for the model reconstruction verifier. The model reconstruction verifier obtains the model parameters through the unique hash address provided by the model trainer. Step 5. Model federation reorganization: the model reorganization verifier conducts federation reorganization on the source model to obtain the target model; The source model obtained from step 4 is submitted to the model reorganization verification party for model federation reorganization. The source model provided by the model training party is trained based on different local data. It is necessary to select a model that is more favorable to the target model for federation reorganization. Therefore, model federation reorganization has the following two steps: (1) Select a favorable model from the source model set for federation reorganization; (2) Federate the selected source model to verify the performance of the target model obtained after reorganization. Step 6: Calculate the contribution value of the model training party; According to the transferability scores of the source models provided by each model trainer in step 5 and the performance index improvement of the target model in the federated reorganization process, a normalized calculation is performed to obtain the contribution measure of each model trainer to the target model; R t,i It represents the contribution value of the i-th model training node of the model training party and the model reorganization verification party in the t-th federated communication iteration. The contribution calculation is as follows: R t,i =α*acc t,i +β*p t,i (3) where acc t,i is the performance improvement of the target model caused by the selected source model in step 5.2, p t,i is the transferability score of the source model selected in step 5.
1. If it is not selected, p t,i =0, α, β are variable parameters used to adjust acc t,i ,p t,i The weight ratio of the two parameters and the unification of the two numerical magnitudes; Considering that the growth of the target model performance is approximately logarithmic nonlinear growth, it is not possible to directly accumulate and average each iteration to obtain the contribution value. Therefore, the exponential moving average method with bias correction is used. Increase, increase the weight of the contribution value of the recent iteration, reduce the weight of the contribution value in the previous iteration, and finally the cumulative contribution value of the i-th model training after t rounds of communication iterations The calculation is as follows: Where t = 0 By default, the contribution value R t,i All are adopted, so according to the formula The μ value can be calculated; through the following deviation correction, the final contribution value E of the i-th model training party can be obtained: i , and according to the final contribution value E i The model training party can obtain the corresponding task reward after calculation; B is the total reward for the model training task given by the client, and B i The corresponding reward for training the i-th model is:
2. The method of claim 1, wherein the step 2 of setting the smart contract for the model federation reorganization comprises: The smart contract described in step 2 is signed between the client, the model training party, and the model reorganization verification party, and is automatically executed according to the settings to achieve tripartite cooperation and constraints; the basic smart contract for setting up the model federation reorganization is as follows: 1) Customer side: a) Establishing the objectives and tasks of the model federation reorganization and the final model acceptance criteria; b) Provide the model reconstruction verifier with the detection data of the target task (i.e., a subset of the target task data set after sampling) and set the task reward for the model reconstruction verifier; c) Specify the source model that the model trainer needs to provide, set the minimum transferability score for the model trainer to participate in the reorganization process in step 5.1, set the training reward and distribute the corresponding reward to the model trainer according to the contribution calculation method in step 6; 2) Model training: a) After the model reorganization verifier conducts the first transferability assessment in step 5.1, the model training node that failed to be selected can choose to exit the task early, or continue to participate in the task and eventually obtain corresponding rewards through the contribution calculation method in step 6; b) Provide the source model of the target task to the model reconstruction verifier; 3) Model reorganization verification party: a) Based on the detection data of the target task, the federation reorganizes the source model to obtain the target model, and submits the target model that has been verified to meet the acceptance criteria to the client; b) Calculate the contribution value for each model training party through the contribution calculation method of step 6.
3. The method according to claim 1, wherein the model federation reorganization described in step 5 comprises the following two steps: (1) selecting a favorable model from the source model set for the federation reorganization in step 5.2; (2) federating the selected source model to verify the performance of the target model obtained after the reorganization; Step 5.1 selects a favorable model from the source model set for the federated reorganization in step 5.2; in order to measure whether the source model is favorable to the target model, a saliency map is used to measure the transferability of the knowledge contained in the source model, thereby measuring the favorability; specifically, based on the detection data and model requirements provided by the client, the model reorganization verification party first trains the original target model and calculates the average saliency map of the target model for the detection data, and then calculates the average saliency map of each source model for the detection data based on the source model, and the two are calculated in pairs to obtain the transferability score of the source model; the calculation formula of the saliency map is as follows: Among them Ψ k represents the hidden features of the kth layer of the source model, The k-th layer of the source model representing the n-th node detects the data D T An input image x j The salient map of The kth layer of the source model of the nth node has all the detection data D T The saliency map of Through all The average value Where S is D T Total number of images; transferability of the two models γ n,T The normalized selection probability p of the source model n It can be estimated as follows, where is the saliency map of the kth layer of the target model, According to the source model selection probability, select p n The top K source models with a transferability score not lower than the minimum set by the client are reorganized and updated in step 5.2; Step 5.2 Federate the selected source model and verify the performance of the target model obtained after the reorganization; Based on the original target model parameters obtained in step 5.1, the source model is federally reorganized in a greedy manner, so that each time the target model is federally reorganized, the target model parameters are updated and the target model performance is improved; in the greedy reorganization process, the source model to be added is first verified and tested with the detection data provided by the customer, and then the source model parameters are averaged with the target model parameters in descending order of verification test performance, and the fused target model is verified and tested again based on the detection data. If the performance is improved, the updated target model parameters are retained and the accuracy is recorded. i Repeat the above operation for the source models to be added in descending order according to the value of the target model performance improvement made by the i-th source model training node until the end, which is regarded as the completion of one iteration of federal reorganization; when the target model performance reaches the acceptance standard set by the client, the model reorganization verifier uploads the target model to the Interstellar File System and provides the client with the corresponding hash address.
4. The method for federal reorganization of a deep neural network model based on blockchain as claimed in claim 1, characterized in that: In step 3, the InterPlanetary File System (IPFS) is used for distributed storage in the subsequent process.
5. A system for implementing the blockchain-based deep neural network model federated reorganization method as claimed in claim 1, characterized in that: include: The alliance chain module of model federal reorganization, the smart contract module of model federal reorganization, the distributed storage data sharing module, the source model training module, the model federal reorganization module, and the model reorganization contribution allocation module correspond to steps 1 to 6 of claim 1 respectively.
Citation Information
Patent Citations
Incentive-driven block chain federal learning method
CN113657608A
Ocean data sharing method and system based on block chain and federated learning, and medium
CN114493594A
Intelligent software behavior management and control method based on block chain and federal learning
CN114692098A
Cited By
Distributed intrusion detection system based on parallel chain and federated learning framework
CN119835014A
Federal learning-based energy data asset right confirmation method, system and device, and medium
CN119848910A
Federal learning generalization method and system for network traffic
CN119854227A
Product package quality inspection classification method based on federal transfer learning
CN119884838A
Artificial intelligence model training method and system based on block chain
CN119892377A
