A blockchain-based federated learning method, device and blockchain node
By publishing collaborative training requests on the blockchain and using a consensus mechanism to select the globally optimal segmentation gain value, the model accuracy problem caused by feature inconsistency in blockchain federated learning is solved, achieving high-precision and privacy-preserving model training.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE M2M
- Filing Date
- 2021-06-22
- Publication Date
- 2026-04-24
AI Technical Summary
In existing blockchain-based federated learning frameworks, the inconsistent characteristics of the participants lead to poor model training accuracy and make it difficult to effectively utilize multi-party data.
By having the requesting party publish a collaborative training request on the blockchain, carrying the target sample residual, and using the common samples of the participants to collaboratively train the blockchain model, the global optimal segmentation gain value is selected through a consensus mechanism to achieve collaborative optimization of the model parameters.
It achieves high accuracy and privacy protection in model training while sharing data among different enterprises, and provides a trust mechanism and fair distribution of benefits.
Smart Images

Figure CN115510935B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a blockchain-based federated learning method, apparatus, and blockchain node. Background Technology
[0002] In some Industrial Internet of Things (IIoT) scenarios, different companies possess different business data, but their customer bases may be similar. Utilizing this combined data for model training can yield more accurate models. However, concerns about privacy breaches have led to reluctance among companies to share data. To address this, blockchain-based federated learning technology has emerged. However, existing blockchain-based federated learning frameworks in IIoT require all participants to have identical features during training, which is difficult to achieve in real-world applications. This hinders the effective utilization of data from multiple participants, resulting in poor model accuracy. Summary of the Invention
[0003] This invention provides a blockchain-based federated learning method, apparatus, and blockchain node to address the problem that existing blockchain-based federated learning frameworks struggle to effectively utilize data from multiple participants, resulting in poor accuracy of the trained models.
[0004] In a first aspect, embodiments of the present invention provide a blockchain-based federated learning method applied to a first node, wherein the first node is a requester in a consortium blockchain, the method comprising:
[0005] The initial model is trained using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium chain members have different attribute features.
[0006] A collaborative training request is issued to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0007] The blockchain model is collaboratively trained using common samples from the participating parties, and the trained model parameters are submitted to the blockchain.
[0008] Optionally, training the initial model using its own samples until a target sample residual that meets preset conditions is obtained includes:
[0009] After each training iteration of the initial model, the sample residuals are calculated;
[0010] If the correlation between the sample residual and the sample label is less than a preset threshold, training is stopped, and the sample residual is recorded as the target sample residual.
[0011] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0012] Optionally, the step of collaboratively training the blockchain model using common samples with the participants and submitting the trained model parameters to the blockchain includes:
[0013] The blockchain model is trained locally using common samples with the participants to determine the optimal split gain value, and the optimal split gain value is published to the blockchain so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0014] If the target member is not the requester, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the first split information, and the first split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participant;
[0015] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0016] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0017] Secondly, embodiments of the present invention also provide another blockchain-based federated learning method, applied to a second node, which is a participant in a consortium blockchain, the method comprising:
[0018] The blockchain forwards a collaborative training request, which carries request record information, including the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0019] In response to the collaborative training request, identify common samples with the requesting party;
[0020] The blockchain model is co-trained using the residuals of the common samples and the target samples, and the trained model parameters are submitted to the blockchain.
[0021] Optionally, the step of co-training the blockchain model using the residuals of the common samples and the target samples, and submitting the trained model parameters to the blockchain, includes:
[0022] The blockchain model is trained locally using the residuals of the common samples and the target samples to determine the optimal splitting gain value. The optimal splitting gain value is then published to the blockchain so that the requester and the participants can select the globally optimal splitting gain value through a consensus mechanism. The target member holding the globally optimal splitting gain value splits the local samples according to the globally optimal splitting gain value and publishes the target splitting information to the blockchain.
[0023] If the target member is not the participating party, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain second split information, and the second split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participating party;
[0024] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0025] Thirdly, embodiments of the present invention also provide a blockchain-based federated learning device, comprising:
[0026] The first training module is used to train the initial model using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium chain members have different attribute features.
[0027] The publishing module is used to publish a collaborative training request to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0028] The second training module is used to collaboratively train the blockchain model using common samples from the participants, and submit the trained model parameters to the blockchain.
[0029] Optionally, the first training module includes:
[0030] The computation unit is used to calculate the sample residuals after each training of the initial model;
[0031] The processing unit is used to stop training and record the sample residual as the target sample residual when the correlation between the sample residual and the sample label is less than a preset threshold.
[0032] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0033] Optionally, the second training module includes:
[0034] The first training unit is used to train the blockchain model locally using common samples with the participants, determine the optimal split gain value, and publish the optimal split gain value to the blockchain, so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0035] The first splitting unit is configured to, when the target member is not the requester, perform the same split on the local sample according to the target splitting information recorded in the blockchain to obtain the first splitting information, and publish the first splitting information to the blockchain so that the blockchain can calculate the loss sum based on the splitting information of the requester and the participant;
[0036] The second training unit is used to continue training the blockchain model with the goal of minimizing the loss, until the requirements in the collaborative training request are met.
[0037] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0038] Fourthly, embodiments of the present invention also provide another blockchain-based federated learning device, comprising:
[0039] The receiving module is used to receive the collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, which includes the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0040] The determination module is used to respond to the collaborative training request and determine the common samples with the requesting party;
[0041] The third training module is used to collaboratively train the blockchain model using the residuals of the common samples and the target samples, and submit the trained model parameters to the blockchain.
[0042] Optionally, the third training module includes:
[0043] The third training unit is used to train the blockchain model locally using the residuals of the common samples and the target samples, determine the optimal split gain value, and publish the optimal split gain value to the blockchain, so that the requester and the participants can select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local samples according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0044] The second splitting unit is used to split the local sample in the same way according to the target splitting information recorded in the blockchain when the target member is not the participant, to obtain the second splitting information, and to publish the second splitting information to the blockchain so that the blockchain can calculate the loss sum according to the splitting information of the requester and the participant;
[0045] The fourth training unit is used to continue training the blockchain model with the goal of minimizing the loss, until the requirements in the collaborative training request are met.
[0046] Fifthly, embodiments of the present invention also provide a blockchain node, comprising: a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the blockchain-based federated learning method as described in the first aspect; or to implement the steps in the blockchain-based federated learning method as described in the second aspect.
[0047] In a sixth aspect, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the blockchain-based federated learning method as described in the first aspect; or implements the steps in the blockchain-based federated learning method as described in the second aspect.
[0048] In this embodiment of the invention, an initial model is trained using its own samples until a target sample residual that meets preset conditions is obtained. Different consortium blockchain members possess different attribute characteristics. A collaborative training request is published to the blockchain, enabling participating parties in the consortium blockchain to collaboratively train the blockchain model. The collaborative training request carries request record information, including the target sample residual. The blockchain model is then collaboratively trained using shared samples with the participating parties, and the trained model parameters are submitted to the blockchain. In this way, by publishing the initial training residual on the blockchain, the requesting party enables each participating party to collaboratively train the blockchain model using its unique data characteristics, achieving higher-precision model training. Attached Figure Description
[0049] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is one of the flowcharts of the blockchain-based federated learning method provided in the embodiments of the present invention;
[0051] Figure 2 This is the second flowchart of the blockchain-based federated learning method provided in this embodiment of the invention;
[0052] Figure 3 This is a schematic diagram of the collaborative training process of the blockchain model provided in this embodiment of the invention;
[0053] Figure 4 This is one of the structural diagrams of the blockchain-based federated learning device provided in the embodiments of the present invention;
[0054] Figure 5 This is the second structural diagram of blockchain-based federated learning provided in this embodiment of the invention;
[0055] Figure 6 This is a structural diagram of a blockchain node provided in an embodiment of the present invention. Detailed Implementation
[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0057] See Figure 1 , Figure 1 This is a flowchart of a blockchain-based federated learning method provided in an embodiment of the present invention, applied to a first node, which is the requester in a consortium blockchain, such as... Figure 1 As shown, the method includes the following steps:
[0058] Step 101: Train the initial model using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium chain members have different attribute features.
[0059] This invention can be applied to industrial IoT and smart wearable scenarios based on cross-data silos. For example, in smart wearable devices, some companies possess information such as users' heart rate and exercise time, while others possess information such as users' weight, body fat percentage, or dietary information. In other words, each participant in a consortium blockchain has different attribute characteristics. These characteristics can be combined to train a more accurate model. The introduction of blockchain can solve the trust problem between different data owners, making the model training process immutable and traceable. It can measure the contributions of different participants and provides a basis for the fair and equitable distribution of benefits.
[0060] First, the requesting party, i.e., a node in the consortium blockchain that initiates the model training request, can utilize its existing samples (x) A ,y A Train the initial model M0, which can be any statistical learning model, such as a neural network, ensemble learning model, etc., and can be determined according to actual needs.
[0061] When training the initial model, the requesting party can calculate the residual of all samples at the end of each iteration of the training process, which is the error between the model output and the true label value. It can also determine whether the residual is highly correlated with the sample label to determine whether the current residual will reveal the original information of the sample's category label. If it is determined that the current residual is highly correlated with the sample label, the next training can continue. If it is determined that the current residual is not highly correlated with the sample label, the training can be stopped and the current residual can be recorded.
[0062] Optionally, step 101 includes:
[0063] After each training iteration of the initial model, the sample residuals are calculated;
[0064] If the correlation between the sample residual and the sample label is less than a preset threshold, training is stopped, and the sample residual is recorded as the target sample residual.
[0065] In order to determine whether the model sample residuals after each training session meet the preset conditions, the sample residuals can be calculated after each training of the initial model. The residuals ε and the Pearson correlation coefficient of the sample label Y can also be calculated using the following formula:
[0066] Then, it can be determined whether the Pearson correlation coefficient between the calculated sample residual and the sample label is less than a preset threshold, such as 0.5, 0.4, etc. If it is less than the preset threshold, it can be determined that the current residual will not reveal the original information of the sample category label. At this time, training can be stopped and the current residual value ε can be recorded and published later.
[0067] Step 102: Publish a collaborative training request to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0068] After training the initial model M0, the requesting party can initiate a model co-training request to the blockchain. The blockchain can forward this request to other members in the consortium blockchain. The consortium blockchain members that respond to the request are the participants in this co-training. The participating parties and the requesting party form a model committee. The requesting party can include the target sample residual in the co-training request, that is, it can publish the target sample residual ε. Since the residual ε has little correlation with the sample labels, privacy will not be leaked during co-training.
[0069] After responding to the collaborative training request, the participating parties can identify common samples with the requester, i.e., samples with the same user ID. Specifically, common sample IDs can be found through encrypted sample alignment. Assuming A and B are the requester and the participating party, respectively, the encrypted sample alignment process is roughly as follows: B generates a public key n using the RSA algorithm and has the decryption key algorithm d and the encryption algorithm e. B sends (n, e) to A. A first maps all its user IDs through a hash function, then encrypts them using e and sends them back to B, i.e., what is sent is Y(A). After receiving Y(A), B decrypts it, calculates Z(A) and Z(B), and sends Z(A) and Z(B) back to A. A eliminates Z(A) by decryption, performs another hash mapping on it, forming D(A). A obtains the intersection of D(A) and Z(B). B uses the same method as the previous step and also obtains an intersection, which is the common sample of the two parties.
[0070] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0071] The request record information carried in the collaborative training request issued by the requesting party may include one or more of the following: requesting party ID, collaborative training model type, hyperparameter settings, target sample residual, investment size, and timestamp. In one embodiment, the request record information may include all of the above information, that is, the data structure of the request record may be as shown in Table 1 below.
[0072] Table 1 Data Structure of Request Records
[0073]
[0074] That is, for a collaborative training request, the requester's ID registered on the consortium blockchain, the type of model to be trained, etc., need to be recorded on the blockchain. For example, collaborative training optimization can be performed on an extreme gradient boosting (XGBoost) model, but other possible machine learning models are not excluded, as well as hyperparameter settings, such as the number of base classifiers, the maximum tree depth, the number of iterations, etc.
[0075] Step 103: Use the common samples with the participants to perform collaborative training on the blockchain model, and submit the trained model parameters to the blockchain.
[0076] After determining the common samples, both the requester and the participants can use their respective common samples to collaboratively train the blockchain model M1 and continuously fit the sample residuals during training. After training is completed, both the requester and each participant will submit the training results to the blockchain, which will then construct the entire collaborative model based on the training records of all nodes.
[0077] To achieve faster computation speed and higher model prediction accuracy, the blockchain model can utilize the XGBoost model, an improved version of the Gradient Boosting Decision Tree (GBDT) algorithm. This model obtains the optimal solution by generating a second-order Taylor expansion of the loss function and adding a regularization term outside the loss function. The prediction model of a standard decision tree is... f k This is the base learning period, where K is the number of trees, and the expanded objective function is... Where n is the number of training function samples, and l is the loss for a single sample. Let y be the predicted values of the samples by the first t-1 ensemble learners. i Ω(f) represents the true label value of the training samples. t ) is the regularization term of the t-th learner.
[0078] XGBoost follows the gradient boosting framework, performing numerical optimization in function space. In machine learning, the learning task is based on the definition of the loss function. Defined to measure label y and estimated value The difference lies in that XGBoost supports all second-differentiable loss functions, such as log loss. It then iteratively minimizes the sum of losses for all samples. For each tree fit, the algorithm first computes the necessary statistic, namely the first-order gradient g of sample i. i and second-order gradient h i They are respectively,
[0079] Then, the sum of derivatives can be accumulated over the instance set Ij at each node j, where, It employs a second-order Taylor expansion approximation of the objective function and incorporates regularization into the model. The optimal leaf weight w is then calculated based on the objective function. * j and target obj * , specifically, It can be used to determine the weight of leaf nodes. It can be used to determine the structure of a tree, where γ and T are manually set parameters, and T is the number of leaf nodes.
[0080] Optionally, step 103 includes:
[0081] The blockchain model is trained locally using common samples with the participants to determine the optimal split gain value, and the optimal split gain value is published to the blockchain so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0082] If the target member is not the requester, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the first split information, and the first split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participant;
[0083] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0084] In one implementation, the collaborative training process can be as follows: 1) The Requester publishes the target sample residual ε (i.e., the Error label field in Table 1) in the collaborative training request on the blockchain; 2) The Provider, responding to the request, downloads the target sample residual ε from the blockchain and begins local training, while the Requester also begins local training; 3) The Requester and Provider calculate the local feature segmentation gain value based on the node's segmentation gain. Specifically, this is done by using local features and formulas when each node of the tree is generated. Calculate the optimal split score under the current decision tree. Each node calculates the split gain value based on its own features and split threshold, and then publishes its local optimal split gain value on the blockchain; 4) The global optimal split gain value is selected by consensus among all nodes; 5) The target member holding the global optimal split gain value starts splitting the node and sends the node's split information (sample IDs falling in the left and right subtrees respectively) to each participant; 6) Other participants or requesters perform the same split on their local samples according to the blockchain model split record; 7) The blockchain calculates the loss sum based on the split information of the requester and participants; With minimizing the loss sum as the training objective, repeat steps 3) to 7) above until the hyperparameter settings in the request record (Table 1) are reached. At this point, the collaborative model training is complete, and the entire collaborative model can be constructed from the split records of all model nodes on the blockchain. In summary, the model training is completed through the collaboration of various consortium blockchain participants (Provider and Requester). The overall training structure of the collaborative model can be described as follows: Figure 2 As shown.
[0085] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0086] The node splitting information for the requester and each participant may include one or more of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp. In one embodiment, the splitting information may include all of the above information, i.e., the data structure of the splitting record may be as shown in Table 2 below.
[0087] Table 2 Data Structure of Split Records
[0088]
[0089] This invention's blockchain-based federated learning method trains an initial model using its own samples until a target sample residual that meets preset conditions is obtained. Different consortium blockchain members possess different attribute characteristics. A collaborative training request is published to the blockchain, enabling participating parties in the consortium blockchain to collaboratively train the blockchain model. This collaborative training request carries request record information, including the target sample residual. The blockchain model is then collaboratively trained using shared samples with the participating parties, and the trained model parameters are submitted to the blockchain. In this way, by publishing the initial training residual on the blockchain, the requesting party enables each participating party to collaboratively train the blockchain model using its unique data characteristics, achieving higher-precision model training.
[0090] See Figure 3 , Figure 3 This is a flowchart of another blockchain-based federated learning method provided in this embodiment of the invention, applied to a second node, which is a participant in a consortium blockchain, such as... Figure 3 As shown, it includes the following steps:
[0091] Step 301: Receive the collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, which includes the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0092] Step 302: Respond to the collaborative training request and determine the common samples with the requester.
[0093] Step 303: Use the residuals of the common samples and the target samples to perform collaborative training on the blockchain model, and submit the trained model parameters to the blockchain.
[0094] Optionally, step 303 includes:
[0095] The blockchain model is trained locally using the residuals of the common samples and the target samples to determine the optimal splitting gain value. The optimal splitting gain value is then published to the blockchain so that the requester and the participants can select the globally optimal splitting gain value through a consensus mechanism. The target member holding the globally optimal splitting gain value splits the local samples according to the globally optimal splitting gain value and publishes the target splitting information to the blockchain.
[0096] If the target member is not the participating party, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain second split information, and the second split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participating party;
[0097] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0098] It should be noted that this embodiment is as a comparison with... Figure 1 The implementation methods of the participating parties in the illustrated embodiments can be found in the foregoing related descriptions. To avoid repetition, they will not be repeated here.
[0099] This invention discloses a blockchain-based federated learning method that receives a collaborative training request forwarded by the blockchain. The request carries request record information, including the target sample residuals obtained by the requester during initial model training. Different consortium blockchain members possess different attribute characteristics. In response to the collaborative training request, the method identifies common samples with the requester. It then uses these common samples and the target sample residuals to collaboratively train the blockchain model and submits the trained model parameters to the blockchain. In this way, by publishing the initial training residuals on the blockchain, the requester enables each participating party to collaboratively train the blockchain model using their unique data characteristics, achieving higher-precision model training.
[0100] This invention also provides a blockchain-based federated learning device. See [link to related document]. Figure 4 , Figure 4 This is a structural diagram of the blockchain-based federated learning device provided in an embodiment of the present invention. Since the principle by which the blockchain-based federated learning device solves the problem is similar to the blockchain-based federated learning method in this embodiment of the present invention, the implementation of this blockchain-based federated learning device can refer to the implementation of the method; repeated details will not be elaborated further.
[0101] like Figure 4 As shown, the blockchain-based federated learning device 400 includes:
[0102] The first training module 401 is used to train the initial model using its own samples until the target sample residuals that meet the preset conditions are obtained. Different alliance chain members have different attribute features.
[0103] The publishing module 402 is used to publish a collaborative training request to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0104] The second training module 403 is used to collaboratively train the blockchain model using common samples with the participants, and submit the trained model parameters to the blockchain.
[0105] Optionally, the first training module 401 includes:
[0106] The computation unit is used to calculate the sample residuals after each training of the initial model;
[0107] The processing unit is used to stop training and record the sample residual as the target sample residual when the correlation between the sample residual and the sample label is less than a preset threshold.
[0108] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0109] Optionally, the second training module 403 includes:
[0110] The first training unit is used to train the blockchain model locally using common samples with the participants, determine the optimal split gain value, and publish the optimal split gain value to the blockchain, so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0111] The first splitting unit is configured to, when the target member is not the requester, perform the same split on the local sample according to the target splitting information recorded in the blockchain to obtain the first splitting information, and publish the first splitting information to the blockchain so that the blockchain can calculate the loss sum based on the splitting information of the requester and the participant;
[0112] The second training unit is used to continue training the blockchain model with the goal of minimizing the loss, until the requirements in the collaborative training request are met.
[0113] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0114] The blockchain-based federated learning device provided in this embodiment of the invention can execute the above-described method embodiments, and its implementation principle and technical effects are similar, so they will not be described again here.
[0115] The blockchain-based federated learning device 400 of this invention trains an initial model using its own samples until a target sample residual that meets preset conditions is obtained. Different members of the consortium blockchain possess different attribute characteristics. A collaborative training request is published to the blockchain, enabling participating parties in the consortium blockchain to collaboratively train the blockchain model. This collaborative training request carries request record information, including the target sample residual. The blockchain model is then collaboratively trained using shared samples with the participating parties, and the trained model parameters are submitted to the blockchain. In this way, by publishing the initial training residual on the blockchain, the requesting party enables each participating party to collaboratively train the blockchain model using its unique data characteristics, achieving higher-precision model training.
[0116] This invention also provides a blockchain-based federated learning device. See [link to related document]. Figure 5 , Figure 5 This is a structural diagram of the blockchain-based federated learning device provided in an embodiment of the present invention. Since the principle by which the blockchain-based federated learning device solves the problem is similar to the blockchain-based federated learning method in this embodiment of the present invention, the implementation of this blockchain-based federated learning device can refer to the implementation of the method; repeated details will not be elaborated further.
[0117] like Figure 5 As shown, the blockchain-based federated learning device 500 includes:
[0118] The receiving module 501 is used to receive the collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, which includes the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0119] The determination module 502 is used to respond to the collaborative training request and determine the common samples with the requester;
[0120] The third training module 503 is used to collaboratively train the blockchain model using the residuals of the common samples and the target samples, and submit the trained model parameters to the blockchain.
[0121] Optionally, the third training module 503 includes:
[0122] The third training unit is used to train the blockchain model locally using the residuals of the common samples and the target samples, determine the optimal split gain value, and publish the optimal split gain value to the blockchain, so that the requester and the participants can select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local samples according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0123] The second splitting unit is used to split the local sample in the same way according to the target splitting information recorded in the blockchain when the target member is not the participant, to obtain the second splitting information, and to publish the second splitting information to the blockchain so that the blockchain can calculate the loss sum according to the splitting information of the requester and the participant;
[0124] The fourth training unit is used to continue training the blockchain model with the goal of minimizing the loss, until the requirements in the collaborative training request are met.
[0125] The blockchain-based federated learning device provided in this embodiment of the invention can execute the above-described method embodiments, and its implementation principle and technical effects are similar, so they will not be described again here.
[0126] The blockchain-based federated learning device 500 of this invention receives a collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, including the target sample residuals obtained by the requester when training the initial model. Different consortium blockchain members possess different attribute characteristics. In response to the collaborative training request, the device identifies common samples with the requester. It then uses the common samples and the target sample residuals to collaboratively train the blockchain model and submits the trained model parameters to the blockchain. In this way, by publishing the initial training residuals on the blockchain, the requester enables each participating party to collaboratively train the blockchain model using their unique data characteristics, achieving higher-precision model training.
[0127] This invention also provides a blockchain node. Since the principle by which the blockchain node solves the problem is similar to the blockchain-based federated learning method in this invention, the implementation of this blockchain node can be found in the implementation of the method, and repeated details will not be elaborated further. Figure 6 As shown, the blockchain node in this embodiment of the invention includes:
[0128] In one embodiment, the processor 600, where the blockchain node is a requester in the consortium blockchain, is used to read the program from the memory 620 and execute the following processes:
[0129] The initial model is trained using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium chain members have different attribute features.
[0130] A collaborative training request is published to the blockchain via transceiver 610, so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0131] The blockchain model is collaboratively trained using common samples from the participating parties, and the trained model parameters are submitted to the blockchain via transceiver 610.
[0132] Transceiver 610 is used to receive and send data under the control of processor 600.
[0133] Among them, Figure 6 In this context, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 600) and memory (memory 620). The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. A bus interface provides an interface. Transceiver 610 may be multiple elements, including transmitters and transceivers, providing a unit for communicating with various other devices over a transmission medium. Processor 600 is responsible for managing the bus architecture and general processing, and memory 620 may store data used by processor 600 during operation.
[0134] Optionally, the processor 600 is also used to read the program from the memory 620 and perform the following steps:
[0135] After each training iteration of the initial model, the sample residuals are calculated;
[0136] If the correlation between the sample residual and the sample label is less than a preset threshold, training is stopped, and the sample residual is recorded as the target sample residual.
[0137] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0138] Optionally, the processor 600 is also used to read the program from the memory 620 and perform the following steps:
[0139] The blockchain model is trained locally using common samples with the participants to determine the optimal split gain value. The optimal split gain value is then published to the blockchain via transceiver 610, so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0140] If the target member is not the requester, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the first split information, and the first split information is published to the blockchain through transceiver 610 so that the blockchain can calculate the loss sum according to the split information of the requester and the participant.
[0141] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0142] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0143] In another implementation, the blockchain node is a participant in the consortium blockchain, and the processor 600 is used to read the program from the memory 620 and execute the following processes:
[0144] The transceiver 610 receives the collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, which includes the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0145] In response to the collaborative training request, identify common samples with the requesting party;
[0146] The blockchain model is co-trained using the residuals of the common samples and the target samples, and the trained model parameters are submitted to the blockchain via transceiver 610.
[0147] Optionally, the processor 600 is also used to read the program from the memory 620 and perform the following steps:
[0148] The blockchain model is trained locally using the residuals of the common samples and the target samples to determine the optimal segmentation gain value. The optimal segmentation gain value is then published to the blockchain via transceiver 610, so that the requester and the participants select the globally optimal segmentation gain value through a consensus mechanism. The target member holding the globally optimal segmentation gain value splits the local samples according to the globally optimal segmentation gain value and publishes the target splitting information to the blockchain.
[0149] If the target member is not the participating party, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the second split information, and the second split information is published to the blockchain through transceiver 610 so that the blockchain can calculate the loss sum according to the split information of the requester and the participating party;
[0150] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0151] The blockchain node provided in this embodiment of the invention can execute the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described again here.
[0152] Furthermore, the computer-readable storage medium of this invention is used to store a computer program. In one embodiment, the computer program can be executed by a processor to implement the following steps:
[0153] The initial model is trained using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium chain members have different attribute features.
[0154] A collaborative training request is issued to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual.
[0155] The blockchain model is collaboratively trained using common samples from the participating parties, and the trained model parameters are submitted to the blockchain.
[0156] Optionally, training the initial model using its own samples until a target sample residual that meets preset conditions is obtained includes:
[0157] After each training iteration of the initial model, the sample residuals are calculated;
[0158] If the correlation between the sample residual and the sample label is less than a preset threshold, training is stopped, and the sample residual is recorded as the target sample residual.
[0159] Optionally, the request record information may also include at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment size, and timestamp.
[0160] Optionally, the step of collaboratively training the blockchain model using common samples with the participants and submitting the trained model parameters to the blockchain includes:
[0161] The blockchain model is trained locally using common samples with the participants to determine the optimal split gain value, and the optimal split gain value is published to the blockchain so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain.
[0162] If the target member is not the requester, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the first split information, and the first split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participant;
[0163] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0164] Optionally, the splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
[0165] In another embodiment, the computer program may be executed by a processor to perform the following steps:
[0166] The blockchain forwards a collaborative training request, which carries request record information, including the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics.
[0167] In response to the collaborative training request, identify common samples with the requesting party;
[0168] The blockchain model is co-trained using the residuals of the common samples and the target samples, and the trained model parameters are submitted to the blockchain.
[0169] Optionally, the step of co-training the blockchain model using the residuals of the common samples and the target samples, and submitting the trained model parameters to the blockchain, includes:
[0170] The blockchain model is trained locally using the residuals of the common samples and the target samples to determine the optimal splitting gain value. The optimal splitting gain value is then published to the blockchain so that the requester and the participants can select the globally optimal splitting gain value through a consensus mechanism. The target member holding the globally optimal splitting gain value splits the local samples according to the globally optimal splitting gain value and publishes the target splitting information to the blockchain.
[0171] If the target member is not the participating party, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain second split information, and the second split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participating party;
[0172] The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
[0173] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0174] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically comprised separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or in the form of hardware plus software functional units.
[0175] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute some steps of the transmission and reception methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0176] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A blockchain-based federated learning method, characterized in that, Applied to the first node, which is the requester in the consortium blockchain, the method includes: The initial model is trained using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium blockchain members have different attribute characteristics; the different consortium blockchain members include different smart wearable device manufacturers. A collaborative training request is issued to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual. The blockchain model is collaboratively trained using common samples from the participating parties, and the trained model parameters are submitted to the blockchain; wherein, the common samples are obtained through encrypted sample alignment. The request record information also includes at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment amount, and timestamp.
2. The method according to claim 1, characterized in that, The step of training the initial model using its own samples until the target sample residuals that meet the preset conditions are obtained includes: After each training iteration of the initial model, the sample residuals are calculated; If the correlation between the sample residual and the sample label is less than a preset threshold, training is stopped, and the sample residual is recorded as the target sample residual.
3. The method according to claim 1, characterized in that, The step of collaboratively training the blockchain model using shared samples with the participants and submitting the trained model parameters to the blockchain includes: The blockchain model is trained locally using common samples with the participants to determine the optimal split gain value, and the optimal split gain value is published to the blockchain so that the requester and the participants select the globally optimal split gain value through a consensus mechanism. The target member holding the globally optimal split gain value splits the local sample according to the globally optimal split gain value and publishes the target split information to the blockchain. If the target member is not the requester, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the first split information, and the first split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participant; The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
4. The method according to claim 3, characterized in that, The splitting information includes at least one of the following: member ID, tree index, layer index, splitting feature, splitting threshold, left node ID, right node ID, and timestamp.
5. A blockchain-based federated learning method, characterized in that, Applied to a second node, which is a participant in the consortium blockchain, the method includes: The system receives collaborative training requests forwarded by the blockchain. These requests carry request record information, which includes the target sample residuals obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics. These different consortium blockchain members include different smart wearable device manufacturers. In response to the collaborative training request, identify common samples with the requesting party; The blockchain model is co-trained using the residuals of the common samples and the target samples, and the trained model parameters are submitted to the blockchain; wherein, the common samples are obtained through encrypted sample alignment. The request record information also includes at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment amount, and timestamp.
6. The method according to claim 5, characterized in that, The step of co-training the blockchain model using the residuals of the common samples and the target samples, and submitting the trained model parameters to the blockchain, includes: The blockchain model is trained locally using the residuals of the common samples and the target samples to determine the optimal splitting gain value. The optimal splitting gain value is then published to the blockchain so that the requester and the participants can select the globally optimal splitting gain value through a consensus mechanism. The target member holding the globally optimal splitting gain value splits the local samples according to the globally optimal splitting gain value and publishes the target splitting information to the blockchain. If the target member is not the participating party, the local sample is split in the same way according to the target split information recorded in the blockchain to obtain the second split information, and the second split information is published to the blockchain so that the blockchain can calculate the loss sum according to the split information of the requester and the participating party; The blockchain model is trained to minimize the loss and with the training objective as the goal, until the requirements in the collaborative training request are met.
7. A blockchain-based federated learning device, characterized in that, include: The first training module is used to train the initial model using its own samples until the target sample residuals that meet the preset conditions are obtained. Different consortium blockchain members have different attribute characteristics; the different consortium blockchain members include different smart wearable device manufacturers. The publishing module is used to publish a collaborative training request to the blockchain so that the participants in the consortium blockchain who respond to the collaborative training request can collaboratively train the blockchain model. The collaborative training request carries request record information, which includes the target sample residual. The second training module is used to collaboratively train the blockchain model using common samples with the participants, and submit the trained model parameters to the blockchain; wherein, the common samples are obtained through encrypted sample alignment. The request record information also includes at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment amount, and timestamp.
8. A blockchain-based federated learning device, characterized in that, include: The receiving module is used to receive the collaborative training request forwarded by the blockchain. The collaborative training request carries request record information, which includes the target sample residual obtained by the requester when training the initial model. Different consortium blockchain members have different attribute characteristics. The different consortium blockchain members include different smart wearable device manufacturers. The determination module is used to respond to the collaborative training request and determine the common samples with the requesting party; The third training module is used to co-train the blockchain model using the residuals of the common samples and the target samples, and submit the trained model parameters to the blockchain; wherein, the common samples are obtained through encrypted sample alignment. The request record information also includes at least one of the following: requester ID, type of model for collaborative training, hyperparameter settings, investment amount, and timestamp.
9. A blockchain node, comprising: A transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor; characterized in that the processor is configured to read the program in the memory to implement the steps in the blockchain-based federated learning method as described in any one of claims 1 to 4; or to implement the steps in the blockchain-based federated learning method as described in claim 5 or 6.
10. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps in the blockchain-based federated learning method as described in any one of claims 1 to 4; or implements the steps in the blockchain-based federated learning method as described in claim 5 or 6.
Citation Information
Patent Citations
Longitudinal federation learning optimization method, device and equipment and storage medium
CN110851785A
Longitudinal federated learning data processing method, device and system based on block chain
CN112132292A