A blockchain-based federated learning method with fair resource allocation

By dividing participant teams in the blockchain and adopting average or weighted aggregation methods, the problem of unfair resource allocation in horizontal federated learning is solved, model performance and robustness are improved, free-rider attacks are prevented, and participants are ensured The contribution of data resource quality to model performance.

CN112540926BActive Publication Date: 2024-10-15HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202011499218.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-17
Publication Date
2024-10-15
Estimated Expiration
2040-12-17

AI Technical Summary

Technical Problem

In horizontal federated learning, unfair resource allocation causes participants with excellent data quality and participants with poor quality to obtain the same model performance, affecting the enthusiasm of participants, and the existing blockchain combines the overall synchronous training method of federated learning Failure to effectively address the issue of unfair resource distribution.

Method used

By establishing ordinary block nodes and super block nodes for participants in the blockchain, establishing smart contracts, and dividing teams according to the test accuracy of desensitized sample data. Each team independently conducts federated learning, using average or weighted aggregation methods. Obtain federated learning models to ensure fairness in resource allocation and model performance.

Benefits of technology

It achieves fairness in resource allocation, improves the robustness and fault tolerance of model performance, prevents free-rider attacks, and ensures that the quality of participants' data resources effectively contributes to model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112540926B_ABST
    Figure CN112540926B_ABST
Patent Text Reader

Abstract

The invention discloses a blockchain-based resource allocation fair federated learning method, the following steps: establish a common block node for a participant in the blockchain, establish a super block node for a collaborator, and establish a smart contract between the participant and the collaborator through the blockchain; after the smart contract is established, the registered participant obtains the model from the blockchain and trains and keeps it locally, and uploads the desensitized sample data to the blockchain; the registered participants are divided into teams according to the test accuracy of the desensitized sample data by the registered participants, and a sub-collaborator is elected in each team, and the sub-collaborator organizes the registered participants in the team to learn the federation, and obtains the corresponding federated learning model. The federated learning method solves the problem of uneven resource allocation of each participant in the federated learning by introducing the technology of the blockchain, and at the same time, enables the learning model to achieve a good defense effect against some free-rider attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain and federated learning, and in particular to a blockchain-based federated learning method with fair resource allocation. Background Art

[0002] With the continuous development of distributed computing devices, a large number of devices in distributed networks will generate a large amount of data. The mutual isolation of private data generated by these distributed devices will cause data island problems. If the data in these distributed devices are directly stored and processed centrally, it will bring data privacy and security issues. Different from the traditional machine learning technology based on data aggregation, sharing, centralized storage and centralized processing, Google proposed a privacy-preserving federated learning in 2016. Distributed devices only need to exchange trained model information with the server locally. In this process, private data does not leave the local area, which largely protects the privacy and security of users. Weizhong has expanded the concept of federated learning, which is divided into horizontal federated learning, vertical federated learning and federated transfer learning according to the differences in data feature distribution. In horizontal federated learning, the data sets of all participants have highly overlapping feature dimensions and small sample overlap. Compared with vertical federated learning, the model information sent by the server to different user terminals in horizontal federated learning is consistent each time, which leads to a fairness problem in resource allocation. That is, participants who provide large and high-quality data and participants who provide small and poor-quality data will eventually obtain models with the same performance, which will affect the enthusiasm of participants to participate. In the real environment of protecting the data privacy of participants, the fairness of resource allocation among training participants also needs to be guaranteed.

[0003] Solving the fairness problem of federated learning by introducing a decentralized mechanism can effectively solve this problem, in which decentralization is achieved through blockchain. Blockchain technology is a new distributed infrastructure and computing paradigm that uses block chain data structure to verify and store data, uses distributed node consensus algorithm to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses smart contracts composed of automated script code to program and operate data. The core of blockchain technology is decentralized distributed ledger, which has the characteristics of tamper-proof and traceability. Blockchain can be divided into three categories: public chain, alliance chain, and private chain. Among them, the alliance chain adopts a hybrid networking mechanism and has partial control over the nodes in the network. The alliance chain retains some of the transparency, openness, and tamper-proof characteristics of the public chain, and has the characteristics of permission management and identity authentication. It is widely favored and mainly focuses on the application of blockchain in data security and trusted authentication.

[0004] At present, all participants in horizontal federated learning obtain the same model. Currently, blockchain combined with federated learning mainly adopts the overall synchronous training method, which still does not solve the problem of unfair resource allocation in the existing federated learning joint training process. Given that horizontal federated learning has a wide range of practical applications on many distributed computing devices, the data resources of distributed devices participating in federated training and the performance of the final model have a great impact on the enthusiasm of participants in training. Therefore, it is necessary to study the fairness of resource allocation in such federated learning. Summary of the invention

[0005] In view of the above, the purpose of the present invention is to provide a blockchain-based federated learning method with fair resource allocation, which solves the problem of uneven resource allocation among participants in federated learning by introducing blockchain technology. At the same time, the learning model can achieve a good defense effect against some free-rider attacks.

[0006] In order to achieve the above-mentioned invention object, the present invention provides the following technical solutions:

[0007] A blockchain-based federated learning method with fair resource allocation, the following steps:

[0008] In the blockchain, ordinary block nodes are established for participants, and super block nodes are established for collaborators. At the same time, smart contracts are established between participants and collaborators through the blockchain;

[0009] After the smart contract is established, the registered participants obtain the model from the blockchain, train it locally and keep it, and upload the desensitized sample data to the blockchain;

[0010] The registered participants are divided into teams according to their test accuracy on the desensitized sample data. A sub-collaborator is elected from each team. The sub-collaborator organizes the federated learning among the registered participants in the team to obtain the corresponding federated learning model.

[0011] Preferably, after the smart contract is established, the registered collaborator who established the smart contract initializes the model through the super block node and broadcasts it to the blockchain. After the ordinary block node obtains the model from the blockchain, the registered participant downloads the model through the corresponding ordinary block node and saves it locally after local training;

[0012] At the same time, the registered participants upload the desensitized sample data obtained by desensitizing the local sample data to the corresponding ordinary block nodes and broadcast it to the blockchain.

[0013] Preferably, when dividing the team, each registered participant uses the local model parameters to test the desensitized sample data of other registered participants and uploads the test results to the blockchain;

[0014] Each registered participant collects the test results of his / her own anonymized sample data, sorts the accuracy of the collected test results according to the local tags, and uploads the sorting results to the blockchain;

[0015] The registered collaborators score the ranking results uploaded by all registered parameter users and divide the teams according to the scores.

[0016] Preferably, when the registered collaborators score the ranking results uploaded by all the registered parameter users, they assign scores that are positively correlated with the readiness rate in order according to the accuracy of the test results, that is, the greater the accuracy, the higher the score;

[0017] The registered collaborator also sums the scores of each registered parameter user to obtain a total accuracy score, and saves the total accuracy score in the account book;

[0018] The registered participants are divided into multiple teams based on the distribution of the total accuracy scores.

[0019] Preferably, when the registered participants are divided into multiple teams according to the distribution status of the total accuracy score, multiple scores are first randomly set as cluster centers, and then the registered participants are divided into multiple teams according to the distance between each total accuracy score and the cluster center, and a registered participant is reselected from each team to be updated as the cluster center, and this step is iterated until the iteration ends to obtain the final team.

[0020] Preferably, each registered participant uploads the test results of the desensitized sample data of other registered participants to the corresponding ordinary block node and broadcasts it to the blockchain;

[0021] Each registered participant retrieves the test results of his / her own desensitized sample data from the corresponding ordinary block node, uploads the sorting results to the corresponding ordinary block node, and broadcasts them to the blockchain;

[0022] Registered collaborators download all sorting results from the blockchain through the corresponding super nodes and score them to divide the teams.

[0023] Preferably, registered participants in each team compete for sub-collaborators based on their own computing power, accuracy of historical prediction results, and network conditions.

[0024] Preferably, the desensitized sample data, test result data, and sorting result data uploaded by registered participants are encrypted before being uploaded.

[0025] Preferably, the sub-collaborator, as a temporary server in the team, aggregates the model parameters of all registered participants in the team to obtain the aggregated model parameters, and then distributes the aggregated model parameters to the registered participants in the team for further training.

[0026] Preferably, sub-collaborators aggregate model parameters of registered participants in two ways:

[0027] Method 1: Average aggregation method, that is, taking the average of the model parameters of all registered participants to obtain the aggregate model parameters;

[0028] Method 2: Weighted aggregation method, that is, assigning weights to the model parameters of each registered participant, and then weighted summing up the model parameters of all registered participants to obtain the aggregated model parameters.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] The blockchain-based resource allocation fair federated learning method provided by the present invention tests the desensitized sample data of other registered participants by registered participants, calculates the accuracy of the registered participants based on the test results, divides the registered participants into teams based on the accuracy, and each team separately conducts federated learning to share the federated learning model. In this way, the contribution of the data resource quality of each participant to the overall model and the final model performance can be effectively weighed through the mechanism of resource fairness allocation, while also ensuring strong robustness and a certain degree of fault tolerance. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 It is a flowchart of a blockchain-based federated learning method for fair resource allocation provided by an embodiment of the present invention;

[0033] Figure 2 It is a schematic diagram of a team determined in a blockchain-based resource allocation fairness federated learning method provided in an embodiment of the present invention;

[0034] Figure 3 This is a schematic diagram of team training in a blockchain-based federated learning method for fair resource allocation provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0035] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0036] In order to solve the problem of uneven resource allocation among participants in federated learning, the embodiment provides a blockchain-based federated learning method with fair resource allocation. The specific technical concept is: by introducing the decentralized technology of blockchain to remove the central server in federated learning, the model framework without the central server can effectively carry out team training, that is, participants with different data quality conduct separate joint training, so that the final participants can obtain models with different performance according to their own data quality.

[0037] Figure 1 : is a flowchart of a blockchain-based resource allocation fairness federated learning method provided by an embodiment of the present invention. Figure 1 As shown, the blockchain-based resource allocation fair federated learning method provided by the embodiment includes the following steps:

[0038] Step 1: Establish ordinary block nodes for participants in the blockchain and super block nodes for collaborators. At the same time, establish smart contracts between participants and collaborators through the blockchain.

[0039] In the embodiment, two types of nodes are designed in the blockchain, one is a node for uploading participant information, named as a common block node, referred to as a node, usually including m nodes, where m is the number of participants, i.e., each participant corresponds to a node, and the other is a node for uploading collaborator information, named as a super node, usually 1, and the super node mainly contains some information about the model structure and message mechanism. The participants of the node conduct local training independently, and upload the model information and download after the local training is completed.

[0040] Before carrying out federated learning tasks, participants and collaborators need to establish smart contracts through blockchain. The specific smart contract construction process is as follows:

[0041] (1) Participants register and authenticate their identity information, and collaborators establish authority management. Participants register online, collaborators collect registration information, record participants' ID information, and request participants to authenticate their identity.

[0042] (2) Participants and collaborators establish data conventions. Participants use a questioning mechanism to mutually determine the type of data to be trained and prepare their own sample data {x 1 ,x 2 ,x 3 …x m}, and jointly discuss and determine the model structure. The collaborator records the model type and designs the training model structure M * .

[0043] (3) The collaborator publishes a message collection convention. The collaborator publishes a message code book, which includes the collaborator's accepted data status information.g , the participant requests to send data status information inf s , collaborator requests to receive data information inf r The code book is used to build information interaction between collaborators and participants, and monitor the status information of all parties in real time. During the entire interaction process, all participants and collaborators open the message monitoring model to monitor the message transmission information in real time.

[0044] (4) Collaborator information encryption stage. First, the collaborator compresses the model data information into a fixed-size string using digital summary technology, and then encrypts the summary information using asymmetric encryption technology, and the collaborator obtains a digital signature. After the signature is completed, the collaborator broadcasts the complete encrypted data information and digital signature to the miner, and the miner verifies it with the collaborator's public key. If the verification is successful, it means that the interactive information was indeed initiated by the transferor and the information has not been tampered with. Otherwise, the verification fails to prevent the collaborator's data information from being tampered with.

[0045] Step 2: After the smart contract is established, the registered participants obtain the model from the blockchain and train it locally, then upload the model parameters to the blockchain and upload the desensitized sample data to the blockchain.

[0046] After the smart contract is established, the participants in the smart contract are registered participants, and the collaborators in the smart contract are registered collaborators. In the initialization preparation phase, the collaborators initialize the model and run it in a trusted execution environment. By using the hash encryption mechanism (Hash), the model structure information M * Perform encryption operation and upload the encrypted model to the super node corresponding to the collaborating party * .

[0047] Specifically, the registered collaborators publish the model structure to the registered participants. The model structure generally adopts a multi-layer perceptron (MLP) or a convolutional neural network (CNN). The registered participants obtain the model structure from the super node node. * Download model structure M * , use local sample data to train the downloaded model structure M * , obtain the local model, and the local model is saved by the participant.

[0048] After the registered participants have trained locally, they upload the desensitized sample data at the same time. In the embodiment, the registered participants desensitize the data features of the node chain and send a completion message after completing the data chain. The registered participants use the K-Anonymity algorithm to desensitize the sample data. After desensitization, the desensitized sample data d * Perform chain processing and send chain request information inf s After receiving the desensitized sample data sent by the registered participants, the collaborator sends a receiving message infg , notify all registered participants.

[0049] Step 3: Divide the registered participants into teams based on their test accuracy on the desensitized sample data.

[0050] When the registered collaborators have counted the desensitized sample data of all registered participants and it is ready, they will issue a test command. After receiving the message, all registered members will download the desensitized data from the chain node, use the trained local model for testing, and upload the test results to the chain again.

[0051] In the embodiment, the registered participants use the trained local model to test the desensitized sample data, and the test is completed to record the prediction information pre i , prediction informationpre i The prediction information is encrypted using a hash algorithm and uploaded to the blockchain. After the data is uploaded to the blockchain, the participant sends a test completion message to the collaborator. s .

[0052] After the test results are uploaded to the chain, registered participants collect the test results, use local tags to sort the accuracy of the test results uploaded by other members, and broadcast the sorting results.

[0053] The collaborator monitors the test data collection message in real time, and sends the test data verification command to the registered participants after collecting all the test results of the registered participants. The registered participants download the test results of other registered participants on their own desensitized sample data from the corresponding node, verify the test accuracy by using the local corresponding label, and rank the accuracy information to sort the results in the identity-accuracy vector (id i ∷acc i ) to publish the accuracy information of each registered participant's corresponding test data i , where i = 1, 2, 3…m, id i is the member i information identification code, acc i For the test accuracy of member i, the registered participant uploads the accuracy information to the chain and publishes it to other nodes through the broadcast mechanism. After the registered participant completes the accuracy information publication, it sends the publication completion information to the collaborating party.

[0054] After the collaborator receives the ranking results published by all registered participants, it starts statistical processing. The collaborator calculates the identity-accuracy vector (id i ∷acc i) for scoring. Assuming that there are m participants in total, the highest ranking in accuracy is set to m points, and the others are ranked in descending order. The scoring result of the identity-accuracy vector sent by the participant is recorded and saved. Finally, the collaborator sums the scores according to the participant id information in turn, that is, by consulting the historical account book information to find the total accuracy score obtained by each participant from other participants. Participant i iterates m-1 times in turn, and the collaborator saves the score vector after scoring the accuracy of each participant's user id.

[0055] After obtaining the sum of the accuracy scores, the teams are divided. The collaborators perform density division on the scored vectors and randomly divide by expanding the members with large score differences, where k is set to the number of training groups set by the collaborators.

[0056] Randomly select k team training centers {a1, a2, a3…a k}, the score vector of the participant is {v1,v2,v3…v m}, where the score vector v of the participant m ∈R n .

[0057] The distance between each component of the score vector and the center point is defined as,

[0058]

[0059] After reselecting the Team Center:

[0060] a (i) = argmin{d ij (a,v)}

[0061] This process is iterated until the distance between classes is large and the iteration stops.

[0062] Step 4: Each team elects a sub-collaborator, who organizes the registered participants in the team to conduct federated learning and obtain the corresponding federated learning model.

[0063] In the embodiment, a sub-collaborator c is elected from each training team * , which is responsible for updating model information. Specifically, a committee mechanism is established based on the team members who have been divided. Each participant i in the team elects a sub-collaborator by publishing his own computing power, the accuracy of the historical ledger, and the network status. The sub-collaborator is responsible for publishing model parameter updates and establishing team message conventions, as well as team private key distribution.

[0064] In team federated learning, each sub-collaborator publishes the team key to the team training members. Specifically, the sub-collaborator randomly generates a set of encrypted private key data and distributes it to each ID member in the training team. After each member receives the private key data, it feedbacks that the secret information verification is successful.

[0065] During team federated learning, team members upload encrypted model parameters θ, collaborators aggregate model parameters and send updated model information, and continue the next round of model training. This iteration continues until the model error falls within the standard error range.

[0066] Each participant in the team hashes and encrypts their own model information and attaches a private key to the asset chain. After the data is uploaded to the chain, a successful upload message is sent to the sub-collaborator. After the sub-collaborator listens to the chain information of all participants in the team, the data decryption operation is performed. The decrypted model information is aggregated, and the aggregation strategy usually uses the federal average aggregation strategy or the federal security aggregation strategy. After the aggregation is completed, the collaborator encrypts the aggregated model information and uploads it to the blockchain node, and sends a training loading request. After the participants in the team listen to the request, they download the model for local training, and iterate the whole process in sequence, and iterate until the model error reaches the standard error range and stops the iteration.

[0067] There are two main ways of federated average aggregation operation:

[0068]

[0069] Where n is the number of participants in the group, M * is the intra-team aggregation model, M 1 A local model for participants within a team.

[0070] The security aggregation method is as follows:

[0071] M * =w1M 1 +w2M 2 +…+w i M n

[0072] st∑w i =1,w i ≥0.

[0073] In the above-mentioned blockchain-based federated learning method with fair resource allocation, (1) during the test phase of desensitized sample data, registered participants evaluate the quality and quality of sample data, which can effectively prevent some free-rider attacks in federated learning. (2) By introducing decentralized technology, the central server of federated learning is removed. In the initial stage, the data resource quality of all parties involved is measured, and participants with similar data resource quality are clustered to divide training groups with different data quality levels. During the training phase, each training group elects a coordinator to handle the data training process, which has a good defense effect against some honest and curious servers and prevents data from being leaked or maliciously tampered by the server during the federated learning process. (3) During the data release process, collaborators conduct audits to provide a safe and reliable transaction environment, thereby realizing an overall secure sharing framework.

[0074] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A blockchain-based federated learning method for fair resource allocation, characterized in that: The following steps are involved: In the blockchain, ordinary block nodes are established for participants, and super block nodes are established for collaborators. At the same time, smart contracts are established between participants and collaborators through the blockchain; After the smart contract is established, the registered participants obtain the model from the blockchain, train it locally and keep it, and upload the desensitized sample data to the blockchain; The registered participants are divided into teams based on the test accuracy of the desensitized sample data by the registered participants. When dividing the teams, each registered participant uses the local model parameters to test the desensitized sample data of other registered participants and uploads the test results to the blockchain; each registered participant collects the test results of his or her own desensitized sample data, and sorts the accuracy of the collected test results according to the local tags, and uploads the sorting results to the blockchain; the registered collaborators score the sorting results uploaded by all registered parameter users and divide the teams according to the scoring values; Each team elects a sub-collaborator, who organizes the registered participants in the team to conduct federated learning and obtain the corresponding federated learning model.

2. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: After the smart contract is established, the registered collaborators who established the smart contract initialize the model through the super block node and broadcast it to the blockchain. After the ordinary block node obtains the model from the blockchain, the registered participants download the model through the corresponding ordinary block node and save it locally after local training; At the same time, the registered participants upload the desensitized sample data obtained by desensitizing the local sample data to the corresponding ordinary block nodes and broadcast it to the blockchain.

3. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: When the registered collaborators score the ranking results uploaded by all the registered parameter users, they will assign scores that are positively correlated with the readiness rate according to the accuracy of the test results, that is, the higher the accuracy, the higher the score; The registered collaborator also sums the scores of each registered parameter user to obtain a total accuracy score, and saves the total accuracy score in the account book; The registered participants are divided into multiple teams based on the distribution of the total accuracy scores.

4. The blockchain-based resource allocation fair federated learning method as claimed in claim 3, characterized in that: When the registered participants are divided into multiple teams according to the distribution of the total accuracy score, multiple scores are first randomly set as cluster centers, and then the registered participants are divided into multiple teams according to the distance between each total accuracy score and the cluster center, and a registered participant is reselected from each team to be updated as the cluster center. This step is iterated until the iteration ends to obtain the final team.

5. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: Each registered participant uploads the test results of the desensitized sample data of other registered participants to the corresponding ordinary block node and broadcasts it to the blockchain; Each registered participant retrieves the test results of his / her own desensitized sample data from the corresponding ordinary block node, uploads the sorting results to the corresponding ordinary block node, and broadcasts them to the blockchain; Registered collaborators download all sorting results from the blockchain through the corresponding super nodes and score them to divide the teams.

6. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: Registered participants in each team will compete for sub-collaborators based on their own computing power, the accuracy of historical prediction results, and network conditions.

7. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: The desensitized sample data, test result data, and sorting result data uploaded by registered participants are encrypted before being uploaded.

8. The blockchain-based resource allocation fair federated learning method as claimed in claim 1, characterized in that: The sub-collaborator acts as a temporary server within the team, aggregating the model parameters of all registered participants in the team to obtain the aggregated model parameters, and then distributes the aggregated model parameters to the registered participants in the team to continue training.

9. The blockchain-based resource allocation fair federated learning method as claimed in claim 8, characterized in that: Sub-collaborators aggregate model parameters of enrolled participants in two ways: Method 1: Average aggregation method, that is, taking the average of the model parameters of all registered participants to obtain the aggregate model parameters; Method 2: Weighted aggregation method, that is, assigning weights to the model parameters of each registered participant, and then weighted summing up the model parameters of all registered participants to obtain the aggregated model parameters.

Citation Information

Cited By

  • Fair incentive mechanism design method of block chain federated learning system

    CN120031161A