CN114764707A - Federal learning model training method and system - Google Patents
Federal learning model training method and system Download PDFInfo
- Publication number
- CN114764707A CN114764707A CN202110001486.0A CN202110001486A CN114764707A CN 114764707 A CN114764707 A CN 114764707A CN 202110001486 A CN202110001486 A CN 202110001486A CN 114764707 A CN114764707 A CN 114764707A
- Authority
- CN
- China
- Prior art keywords
- user
- training
- model
- organization
- model parameters
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012549 training Methods 0.000 title claims abstract description 194
- 238000000034 method Methods 0.000 title claims abstract description 55
- 230000008520 organization Effects 0.000 claims abstract description 142
- 230000008569 process Effects 0.000 claims abstract description 16
- 238000012545 processing Methods 0.000 claims description 20
- 238000004590 computer program Methods 0.000 claims description 9
- 230000007246 mechanism Effects 0.000 description 11
- 230000006870 function Effects 0.000 description 8
- 230000000694 effects Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000002790 cross-validation Methods 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 239000003814 drug Substances 0.000 description 1
- 229940079593 drug Drugs 0.000 description 1
- 230000005284 excitation Effects 0.000 description 1
- 230000001747 exhibiting effect Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3829—Payment protocols; Details thereof insuring higher security of transaction involving key management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/008—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Accounting & Taxation (AREA)
- Evolutionary Computation (AREA)
- Finance (AREA)
- Mathematical Physics (AREA)
- Medical Informatics (AREA)
- Data Mining & Analysis (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a method and a system for training a federated learning model, wherein the method comprises the following steps: creating a blockchain network for use in the training of the federal learning model; receiving local training model parameters uploaded by an organization user in each round of the training process of the federal learning model, wherein the organization user is a block chain user for locally training the federal learning model by using local user data; sending the local training model parameters uploaded by all organization users to worker users, and performing joint training on the federal learning model by the worker users by using all the local training model parameters; updating the federal learning model by adopting the parameters of the joint training model uploaded by the worker user who successfully creates the block; and sending the joint training model parameters to the organization user to update the local training model parameters of the organization user. In the invention, users of other participants except the data provider participate in the training of the federal learning model, so that the user range is expanded.
Description
Technical Field
The embodiment of the invention relates to the technical field of business support, in particular to a method and a system for training a federated learning model.
Background
Federal Learning (Federal Learning) is an emerging artificial intelligence basic technology for developing high-efficiency machine Learning among multiple parties or multiple computing nodes on the premise of guaranteeing information security during big data exchange, protecting terminal data and personal data privacy and guaranteeing legal compliance. Currently, some federal learning models are trained by federal learning.
However, the current method of training the federal learning model through federal learning has the following problems: federal learning participants are limited to data providers, leading to problems of low user coverage and training efficiency.
Disclosure of Invention
The embodiment of the invention provides a method and a system for training a federated learning model, which are used for solving the problems of small user range and low training efficiency of the existing method for training the federated learning model through federated learning.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a method for training a federated learning model, including:
creating a blockchain network for use in the training of the federal learning model;
receiving local training model parameters uploaded by an organization user in each round of training process of the federal learning model, wherein the organization user is a block chain user for locally training the federal learning model by using local user data;
sending the local training model parameters uploaded by all the organization users to worker users, and performing joint training on the federal learning model by the worker users by using the local training model parameters uploaded by all the organization users;
updating the federal learning model by adopting the joint training model parameters uploaded by the worker users who successfully create the blocks;
and sending the joint training model parameters to the organization user to update the local training model parameters of the organization user.
Optionally, the local training model parameters uploaded by the organization user are encrypted by using a homomorphic encryption algorithm.
Optionally, the organization user performs homomorphic encryption on the local training model parameters by using a customized key.
Optionally, in each round of the training process of the federal learning model, the receiving, by the blockchain link point of the blockchain network, the local training model parameters uploaded by the organization user includes:
when receiving local training model parameters uploaded by the organization user, judging whether the organization user uploads an encryption certificate at the same time, wherein the encryption certificate is issued by any N endorsement nodes of the block chain network based on zero knowledge certificate;
and if the organization user does not send the encrypted certificate, judging the organization user as a malicious party.
Optionally, the method further includes:
before the training of the Federal learning model, receiving additional samples uploaded by an organization user to form an additional sample library, wherein the additional samples comprise a plurality of input sample and output sample pairs, the input samples are generated by the organization user by using a random algorithm, and the output samples are output obtained by adding the input samples into local user data of the organization user to train the Federal learning model;
receiving local training model parameters uploaded by an organization user;
randomly extracting K samples from the extra sample library by any N endorsement nodes of the block chain network, and judging the accuracy of the local training model parameters according to the K samples;
and if the average accuracy of the N endorsement nodes is higher than a preset threshold value, issuing an encryption certificate for the organization user.
Optionally, the method further includes:
after creating the blockchain network, assigning an initial asset to each user;
after the converged federal learning model is obtained, asset settlement is performed for each user based on the transactions that occur in each round.
Optionally, before performing asset settlement for each user according to the transaction occurring in each round, the method further includes:
after a user joins the blockchain network, deploying an intelligent contract set on a blockchain link point of the user, wherein if the user is an organization user, the intelligent contract set comprises at least one of the following items: the state inquires about the contract, the model upgrades the contract and model and downloads the contract; if the user is a worker user, the intelligent contract set comprises at least one of the following items: a state inquiry contract, a model processing contract and a model downloading contract;
when the state query contract is called by a user, submitting a query transaction to query the current remaining available assets of the user side;
when the model updating contract is called by the organization user, uploading the local training model of the organization user to the block chain network to complete a model parameter updating transaction;
when the model download contract is called by the worker user, downloading all local training model parameters uploaded by the organization user from the blockchain network, and when the model download contract is called by the organization user, downloading the joint training model parameters uploaded by the worker user from the blockchain network to complete a model parameter download transaction;
and when the model processing contract is called by the worker user, uploading the joint training model parameters to the blockchain network to complete one-time processing model parameter transaction.
In a second aspect, an embodiment of the present invention provides a system for training a bang learning model, including:
the creating module is used for creating a block chain network for the training of the federal learning model;
the system comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving local training model parameters uploaded by an organization user in each round of training process of the federal learning model, and the organization user is a block chain user for locally training the federal learning model by using local user data;
the first sending module is used for sending the local training model parameters uploaded by all the organization users to worker users, and the worker users carry out joint training on the federated learning model by using the local training model parameters uploaded by all the organization users;
the updating module is used for updating the federal learning model by adopting the joint training model parameters uploaded by the worker users who successfully create the blocks;
and the second sending module is used for sending the joint training model parameters to the organization user so as to update the local training model parameters of the organization user.
Optionally, the local training model parameters uploaded by the organization user are encrypted by using a homomorphic encryption algorithm.
Optionally, the organization user performs homomorphic encryption on the local training model parameters by using a customized key.
Optionally, the system further includes:
the encryption module is used for judging whether the organization user uploads an encryption certificate at the same time when receiving the local training model parameters uploaded by the organization user, wherein the encryption certificate is issued by any N endorsement nodes of the block chain network based on zero knowledge certificate; and if the organization user does not send the encrypted certificate, judging the organization user as a malicious party.
Optionally, the system further includes:
the system comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving additional samples sent by an organization user before the training of a federated learning model to form an additional sample library, the additional samples comprise a plurality of input sample and output sample pairs, the input samples are generated by the organization user through a random algorithm, and the output samples are output obtained by adding the input samples into local user data of the organization user by the organization user and training the federated learning model;
the second receiving module is used for receiving the local training model parameters uploaded by the organization user;
the judging module is used for randomly extracting K samples from the extra sample library and judging the accuracy of the local training model parameters according to the K samples;
and the certification module is used for issuing an encryption certification for the organization user if the average accuracy of the N endorsement nodes is higher than a preset threshold value.
Optionally, the system further includes:
an initial asset assignment module for assigning an initial asset to each user after the blockchain network is created;
and the settlement module is used for performing asset settlement on each user according to the transaction occurring in each round after the converged federal learning model is obtained.
Optionally, the system further includes:
a contract deployment module, configured to deploy an intelligent contract set on a block link point of a user after the user joins the block chain network, where the intelligent contract set includes at least one of the following: inquiring the contract according to the state, updating the contract by the model and downloading the contract by the model; if the user is a worker user, the intelligent contract set comprises at least one of the following items: a state inquiry contract, a model processing contract and a model downloading contract;
when the state query contract is called by a user, submitting a query transaction to query the current remaining available assets of the user side;
when the model updating contract is called by the organization user, uploading the local training model of the organization user to the block chain network to complete a model parameter updating transaction;
when the model download contract is called by the worker user, downloading all local training model parameters uploaded by the organization user from the blockchain network, and when the model download contract is called by the organization user, downloading the joint training model parameters uploaded by the worker user from the blockchain network to complete a model parameter download transaction;
and when the model processing contract is called by the worker user, uploading the joint training model parameters to the blockchain network to complete one-time processing model parameter transaction.
In a third aspect, an embodiment of the present invention provides a computing device, including: a processor, a memory, and a program stored on the memory and executable on the processor, the program, when executed by the processor, implementing the steps of the federated learning model training method of the first aspect described above.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the federal learning model training method in the first aspect are implemented.
In the embodiment of the invention, by combining block chains and federal learning and introducing other users except for data providers, users who do not have enough user data or do not want to share the user data can also have the right to participate in the federal learning, so that the user range can be enlarged, the model training efficiency can be effectively improved, rewards can be obtained by generating blocks through model training, and the rewards can be used for deducting the use fee of the model and the like and are superior to the prior technical scheme in the aspects of user range and incentive mechanism.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a schematic flow chart of a Federal learning model training method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a federated learning model training system in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
The block chain technology is a combined innovation application of four technologies, namely an intelligent contract, a point-to-point network, an encryption algorithm and a consensus mechanism. The blockchain is essentially a linked list storage structure based on time stamps, also called a distributed ledger or decentralized database, because the nodes of the blockchain form a peer-to-peer network, exhibiting decentralized characteristics. The block chain determines a writer based on a consensus mechanism, and meanwhile, the data of nodes of the whole network are ensured to be consistent; the data is guaranteed to be safe and reliable based on an encryption algorithm, and meanwhile, automatic transaction processing is carried out by using intelligent contracts deployed on nodes. In summary, the blockchain has the characteristics of decentralization, collective maintenance, cross validation, openness and transparency, difficulty in tampering, traceability of data and the like, and is applied to various application scenarios requiring novel database support, multi-subject business, non-trust of subjects and no trusted third party, such as typical examples of digital finance, food and drug traceability, judicial deposit evidence and the like.
The block chain is used as a decentralized, data encryption and non-falsifiable distributed shared database, data confidentiality can be provided for data exchange of federal learning to guarantee user privacy, data safety among all participants is guaranteed, a value-driven incentive mechanism of the data consistency block chain for model training by providing data by multiple participants can be guaranteed, and the enthusiasm of providing data among all participants and updating network model parameters can be increased.
In the invention, a block chain and federal learning are combined, and a federal learning model is trained. The federal learning model can be a business recommendation model and the like.
Referring to fig. 1, an embodiment of the present invention provides a method for training a bang learning model, including:
step 11: creating a blockchain network for use in the training of the federal learning model;
in the embodiment of the invention, the participants of the block chain network are collectively called block chain users, and the block chain users can be divided into organization users and worker users according to the contribution mode of the block chain users.
(a) An organizational user refers to a business vendor that owns user data and is willing to use the user data to participate in federal learning. The contribution mode of the organization is a shared sample and participates in the training of the federal learning model. Each time the organization submits updated model parameters, a corresponding reward may be obtained.
(b) Worker users refer to users who do not have sufficient user data, or who possess user data but are unwilling to use their own user data to participate in federal learning, but who still wish to use a federal learning model, such as small business vendors and the like. The contribution mode of the worker user comprises work such as federal learning model training, model parameter updating and the like, and a new block is produced. Like a bitcoin miner, multiple worker users compete to complete the work for one block, while the worker user who completes the first block and is identified by consensus may receive a reward.
In the embodiment of the invention, a plurality of service providers in the same field negotiate a deep learning model together as a federal learning model. Considering that services provided by a plurality of service providers belong to the same field, the feature fields of the data are often overlapped to a higher degree, and the user group is overlapped to a lower degree. Therefore, by adopting a sample-based federated learning method, a part of data with overlapped characteristic fields and non-overlapped user samples is taken as a shared sample.
When a service provider provides services, according to actual service requirements, a local data collection module is built in software (e.g., an APP such as an e-commerce, news, and the like) or hardware (e.g., equipment such as home theater video on demand, cloud game service, and the like) and is used for collecting user data and uploading the user data to a manufacturer server to form a manufacturer local user database.
Step 12: receiving local training model parameters uploaded by an organization user in each round of training process of the federal learning model, wherein the organization user is a block chain user for locally training the federal learning model by using local user data;
the local user data is used by the organization user locally to train the federal learning model, and the local user data does not need to be uploaded, so that the privacy of the user data can be protected, and the user data can be prevented from being leaked.
Step 13: sending the local training model parameters uploaded by all the organization users to worker users, and performing joint training on the federal learning model by the worker users by using the local training model parameters uploaded by all the organization users;
step 14: updating the federated learning model by adopting the joint training model parameters uploaded by the worker user who successfully creates the block;
step 15: and sending the joint training model parameters to the organization user to update the local training model parameters of the organization user.
In the embodiment of the invention, by combining block chains and federal learning and introducing other users except for data providers, users who do not have enough user data or do not want to share the user data can also have the right to participate in the federal learning, so that the user range can be enlarged, the model training efficiency can be effectively improved, rewards can be obtained by generating blocks through model training, and the rewards can be used for deducting the use fee of the model and the like and are superior to the prior technical scheme in the aspects of user range and incentive mechanism.
The reward mechanism of the present invention is described below.
In this embodiment of the present invention, optionally, the method further includes:
after creating the blockchain network, assigning an initial asset to each user; where the participants include organizational users and worker users, the initial assets are used to reflect the cost (monetary or data) paid for the users to participate in federal learning.
After the converged federal learning model is obtained, asset settlement is performed for each user based on the transactions that occur in each round.
In this embodiment of the present invention, optionally, before performing asset settlement for each user according to the transaction occurring in each round, the method further includes:
after a user joins the blockchain network, deploying an intelligent contract set S on a blockchain link point of the user, wherein if the user is an organization user, the intelligent contract set S comprises at least one of the following items: state query contract S1Model update contract S2Contract S for model download3(ii) a If the user is a worker user, the intelligent contract set comprises at least one of the following items: state query contract S1Model processing contract S4Contract S for model download3(ii) a It should be noted that, besides the contract, the intelligent contract set S should have extensibility, and add other intelligent contracts according to actual business requirements.
Wherein the status query contract S1When the user calls the account, submitting an inquiry transaction to inquire the world states of all distributed accounts owned by the participant, namely inquiring the current remaining available assets of the user; that is, participants can query contracts S with state1A query transaction is submitted.
The model update contract S2When the local training model of the organization user is called by the organization user, uploading the local training model of the organization user to the block chain network, and completing one-time model parameter updating transaction; i.e. the organisation user can update the contract S by calling the model2Uploading the encrypted local training model parameters to the blockchain. In each iteration of federal learning, all organization users (organization users) need to complete model parameter uploading so that worker users can use all model parameters for joint training.
The model downloads the contract S3When the local training model parameters are called by the worker user, downloading all the local training model parameters uploaded by the organization user from the blockchain network, wherein the model downloads a contract S3When the combined training model parameters are called by the organization user, the combined training model parameters uploaded by the worker user are downloaded from the blockchain network so as to complete a model parameter downloading transaction; i.e. the participants download the contract S by calling the model3A model parameter download transaction may be submitted.
The model processing contract S4And when the combined training model is called by the worker user, uploading the combined training model parameters to the blockchain network so as to complete one-time processing model parameter transaction. After the joint training is completed, the worker user who successfully creates the block can call the model processing contract S4Parameters of the federated learning model are updated using the joint training model parameters.
A complete round of federal learning iteration consists of the following steps:
(a) and organizing users to train the federal learning model by using the local user data to obtain local training model parameters. Invoking model update contract S2And generating a transaction, encrypting the local training model parameters and uploading the encrypted local training model parameters to a block chain, namely exchanging the encrypted local training model parameters by all users. For a transaction initiated by multiple users, each user needs to pay for the transaction fee according to the data amount owned by the user. Generally, the larger the amount of data a party has, the less the fee is paid.
(b) The worker user collects model update contracts S proposed by all organization users2Trading, calling model download contract S3Downloading all encrypted model parameters, finishing joint training of the Federal learning model by using all the model parameters, and calling a model processing contract S by a worker user who successfully creates a block4And completing the parameter updating of the model.
(c) Organizing user-invoked model download contracts S3And downloading the parameters of the joint training model, decrypting and updating the parameters of the local training model.
To this point, a complete round of federal learning iterations is completed. At this time, a block in the block chain is successfully created, the worker user who creates the block obtains the mine digging reward, and the organization user who participates in training completes one-time updating of the local model. At this time, each organization user calculates whether the loss function meets the requirement, if not, the next iteration is continuously initiated, and the three steps (a), (b) and (c) are repeated until the loss function is converged.
And after all users complete multiple rounds of federal learning iteration to obtain a converged federal learning model, carrying out actual asset settlement according to user asset change caused by transactions in each round of iteration.
Although the organizational users carry out the training of the federal learning model locally, the model parameters obtained by training contain partial characteristics of local user data. If a malicious party acquires the plaintext model parameters and the predetermined federal learning model, the characteristics of local user data can be reversely deduced from the plaintext model parameters and the predetermined federal learning model, so that data leakage is caused. Therefore, in the embodiment of the present invention, in order to avoid leakage of data characteristic information caused by leakage of the model parameters, optionally, the local training model parameters uploaded by the organization user are encrypted by using a homomorphic encryption algorithm. Further optionally, the organization user performs homomorphic encryption on the local training model parameters by using a customized key.
Homomorphic encryption is characterized by processing homomorphic encrypted data to obtain an output, decrypting the output, and the result is the same as the output obtained by processing unencrypted original data in the same way. Therefore, as a worker user actually performing the joint training, the training task of the model can be completed even without decrypting the gradient. Namely, the worker user can not contact any unencrypted data in the whole process, and the leakage of the characteristic information of the local model data is avoided.
In the embodiment of the disclosure, by using a homomorphic encryption algorithm, model parameters uploaded by an organization user are encrypted by one layer, and information leakage caused by plaintext model parameters is avoided. And the data contacted by the worker user in the model training process are encrypted data, and the worker user can not decrypt the encrypted data completely, so that the problem that the organization user and the worker user do not trust each other is solved.
In the federal learning process, a plurality of participants exist, each participant may have a malicious participant, and the malicious participants acquire the parameters of the joint training model through malicious uploading of wrong or forged model parameters without paying or with little cost, so that the precision of the joint training model is reduced.
In order to avoid attack by a malicious party, in the embodiment of the present invention, in each round of training of the federal learning model, the receiving, by a block chain node of the block chain network, of the local training model parameters uploaded by an organization user includes:
when receiving local training model parameters uploaded by the organization user, judging whether the organization user uploads an encryption certificate at the same time, wherein the encryption certificate is issued by any N endorsement nodes of the block chain network based on zero knowledge certificate;
and if the organization user does not send the encryption certificate, judging that the organization user is a malicious party.
In this embodiment of the present invention, optionally, the method further includes:
before the training of the Federal learning model, receiving additional samples uploaded by an organization user to form an additional sample library, wherein the additional samples comprise a plurality of input sample and output sample pairs, the input samples are generated by the organization user by using a random algorithm, and the output samples are output obtained by adding the input samples into local user data of the organization user to train the Federal learning model;
receiving local training model parameters uploaded by an organization user;
randomly extracting K samples from the extra sample library by any N endorsement nodes of the block chain network, and judging the accuracy of the local training model parameters according to the K samples;
and if the average accuracy of the N endorsement nodes is higher than a preset threshold value, issuing an encryption certificate for the organization user.
Wherein N is a positive integer greater than 1, and K is a positive integer greater than 1.
That is, before federal learning begins, the organizational users generate additional samples using a stochastic algorithm, and all organizational users collectively generate an additional sample library. The data in the additional sample library is automatically generated and is irrelevant to the user data of any organization user. Each user needs to add the extra sample library into the own user database as a supplementary training set for model training. In each round of federal learning iteration, in the step of uploading the encrypted model parameters by the organization users, each organization user needs to submit an encryption certificate at the same time. The encrypted proof is issued by any N endorsement nodes based on a zero knowledge proof. The specific method for opening the tool comprises the following steps: and the endorsement node randomly extracts K samples from the extra sample library and judges the encrypted model parameters uploaded by the organization user. And if the average accuracy of the N endorsement nodes is higher than the threshold lambda, the encrypted model parameters uploaded by the organization user are considered to be correct. The method comprises the steps of inputting input samples in samples into a federal learning model formed by encrypted model parameters to obtain output samples, and judging the average accuracy of the output samples of N endorsement nodes.
In the embodiment of the invention, an encryption certification mechanism is provided based on a zero-knowledge certification thought. The mechanism can verify the correctness of the encrypted model parameters without acquiring the model parameters uploaded by the organization user, prevents malicious participants from uploading wrong parameters or forged parameters, and solves the problem that malicious attacks which can be faced by the Federation learning partner in the prior art are difficult to trace and punish.
Referring to fig. 2, an embodiment of the present invention further provides a system 20 for training a bang learning model, including:
a creating module 21, configured to create a blockchain network for training of a federal learning model;
the first receiving module 22 is configured to receive local training model parameters uploaded by an organization user in each round of training of the federal learning model, where the organization user is a block chain user who uses local user data to train the federal learning model locally;
the first sending module 23 is configured to send the local training model parameters uploaded by all the organization users to a worker user, and the worker user performs joint training on the federal learning model by using the local training model parameters uploaded by all the organization users;
an updating module 24, configured to update the federal learning model with the joint training model parameters uploaded by the worker user who successfully creates a block;
a second sending module 25, configured to send the joint training model parameters to the organization user to update the local training model parameters of the organization user.
Optionally, the local training model parameters uploaded by the organization user are encrypted by using a homomorphic encryption algorithm.
Optionally, the organization user performs homomorphic encryption on the local training model parameters by using a customized key.
Optionally, the method further includes:
the encryption module is used for judging whether the organization user uploads an encryption certificate at the same time when receiving the local training model parameters uploaded by the organization user, wherein the encryption certificate is issued by any N endorsement nodes of the block chain network based on zero knowledge certificate; and if the organization user does not send the encrypted certificate, judging the organization user as a malicious party.
Optionally, the system further includes:
the system comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving additional samples sent by an organization user before the training of a federal learning model to form an additional sample library, the additional samples comprise a plurality of input sample and output sample pairs, the input samples are generated by the organization user by using a random algorithm, and the output samples are output obtained by adding the input samples into local user data of the organization user by the organization user to train the federal learning model;
the second receiving module is used for receiving the local training model parameters uploaded by the organization user;
the judging module is used for randomly extracting K samples from the extra sample library and judging the accuracy of the local training model parameters according to the K samples;
and the certification module is used for issuing an encryption certification for the organization user if the average accuracy of the N endorsement nodes is higher than a preset threshold value.
Optionally, the system further includes:
the initial asset endowing module is used for endowing each user with an initial asset after the blockchain network is established;
and the settlement module is used for performing asset settlement on each user according to the transaction occurring in each round after the converged federal learning model is obtained.
Optionally, the system further includes:
a contract deployment module, configured to deploy an intelligent contract set on a block link point of a user after the user joins the block chain network, where the intelligent contract set includes at least one of the following: the state inquires about the contract, the model upgrades the contract and model and downloads the contract; if the user is a worker user, the intelligent contract set comprises at least one of the following items: a state inquiry contract, a model processing contract and a model downloading contract;
when the state query contract is called by a user, submitting a query transaction to query the current remaining available assets of the user side;
when the model updating contract is called by the organization user, uploading a local training model of the organization user to the block chain network to complete a model parameter updating transaction;
when the model download contract is called by the worker user, downloading all local training model parameters uploaded by the organization user from the blockchain network, and when the model download contract is called by the organization user, downloading the joint training model parameters uploaded by the worker user from the blockchain network to complete a model parameter download transaction;
and when the model processing contract is called by the worker user, uploading the joint training model parameters to the blockchain network to complete one processing model parameter transaction.
In summary, the scheme of the invention mainly comprises the following parts:
a federal learning network. Multiple services in the same service field (such as cloud service, video or communication) provide user data collected by each service, and deep learning model training is performed locally. And encrypting the model parameters of the trained intermediate model, uploading the model parameters to a block chain network formed by all manufacturers for joint training, downloading the model parameters after the joint training for local model updating, and repeating iteration in such a way to obtain a federal learning model in the service field, such as a service recommendation model, wherein each manufacturer can use the model for more accurately recommending the service to the user. In the whole training process, all the user privacy data are stored locally in a service manufacturer, so that the user privacy data leakage caused by sample sharing is avoided.
And the block chain network is used for ensuring that the uplink data of all parties involved in the federal study cannot be tampered and can be traced. When the malicious party tries to update and destroy the effect of the overall model by using wrong parameters, the malicious party can be quickly positioned by using a cross validation mechanism of the block chain network, so that wrong updating is avoided. In addition, the incentive mechanism inherent in the blockchain network may allow the more contributing participants to gain additional revenue compensation.
A set of encryption certification mechanism based on homomorphic encryption and zero knowledge certification is used for guaranteeing local data characteristics of all participants not to be leaked and avoiding attack of malicious participants.
The federal learning model training system is used for realizing all functions related to the technical scheme, such as local data acquisition, local modeling, model parameter and multi-party combined training final model, data uploading block chain, block chain contribution excitation, tracing of malicious attacks which a federal learning partner can face, and the like.
In one embodiment, the federated learning model training system according to the present solution includes: the system comprises a user information management module, a local model training module, a block chain operation module, a settlement module and an encryption module.
And the user information management module is used for carrying out basic information management such as user registration, information recording, information modification and the like. In addition, the module also has the functions of classifying the users according to the user asset identification (money asset or data asset) and limiting the functional authority of the users according to the categories of the users.
And the local model training module is used for finishing the work of training, updating, maintaining and the like of the local model of the user. The organization user calls the module to perform preliminary model training by using user data in a local owned database and updates the local model by using the federate learning model parameters after the worker user completes the joint training; the worker user invokes the module to jointly train all the collected encrypted models.
And the block chain operation module is used for providing the functions of adding or quitting the block chain for the user, initiating asset transaction, uploading or downloading model parameters, submitting encryption certification, tracing data and the like, and submitting the operation result of the user to the block chain.
The encryption module is used for providing a user with a function of homomorphic encryption according to a self-defined key and an encryption correctness auditing function based on zero knowledge proof. In the step of uploading the encrypted model parameters, the function of presenting the cryptographic proof is done by this module.
Referring to fig. 3, an embodiment of the present invention further provides a computing device 30, which includes a processor 31, a memory 32, and a computer program stored in the memory 32 and capable of running on the processor 31, where the computer program, when executed by the processor 31, implements each process of the above-mentioned federate learning model training method embodiment, and can achieve the same technical effect, and is not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned federate learning model training method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the computer program is not described herein again. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a computing device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the particular illustrative embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but is intended to cover various modifications, equivalent arrangements, and equivalents thereof, which may be made by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (10)
1. A method for training a federated learning model is characterized by comprising the following steps:
creating a blockchain network for use in the training of the federal learning model;
receiving local training model parameters uploaded by an organization user in each round of training process of the federal learning model, wherein the organization user is a block chain user for training the federal learning model by using local user data locally;
sending the local training model parameters uploaded by all the organization users to worker users, and performing joint training on the federal learning model by the worker users by using the local training model parameters uploaded by all the organization users;
updating the federated learning model by adopting the joint training model parameters uploaded by the worker user who successfully creates the block;
and sending the joint training model parameters to the organization user to update the local training model parameters of the organization user.
2. The method of claim 1, wherein the local training model parameters uploaded by the organization user are encrypted using a homomorphic encryption algorithm.
3. The method of claim 2, wherein the organizational user homomorphically encrypts local training model parameters using a custom key.
4. The method of claim 1, wherein receiving local training model parameters uploaded by an organization user at a blockchain link point of the blockchain network during each round of training of the federal learning model comprises:
when receiving local training model parameters uploaded by the organization user, judging whether the organization user uploads an encryption certificate at the same time, wherein the encryption certificate is issued by any N endorsement nodes of the block chain network based on zero knowledge certificate;
and if the organization user does not send the encrypted certificate, judging the organization user as a malicious party.
5. The method of claim 4, further comprising:
before the training of the Federal learning model, receiving additional samples uploaded by an organization user to form an additional sample library, wherein the additional samples comprise a plurality of input sample and output sample pairs, the input samples are generated by the organization user by using a random algorithm, and the output samples are output obtained by adding the input samples into local user data of the organization user to train the Federal learning model;
receiving local training model parameters uploaded by an organization user;
randomly extracting K samples from the extra sample library by any N endorsement nodes of the block chain network, and judging the accuracy of the local training model parameters according to the K samples;
and if the average accuracy of the N endorsement nodes is higher than a preset threshold value, issuing an encryption certificate for the organization user.
6. The method of claim 1, further comprising:
after creating the blockchain network, assigning an initial asset to each user;
after the converged federal learning model is obtained, asset settlement is performed for each user based on the transactions that occur in each round.
7. The method of claim 6, wherein prior to settling the assets for each user based on the transactions occurring in each round, further comprising:
after a user joins the blockchain network, deploying an intelligent contract set on blockchain link points of the user, wherein if the user is an organization user, the intelligent contract set comprises at least one of the following items: inquiring the contract according to the state, updating the contract by the model and downloading the contract by the model; if the user is a worker user, the intelligent contract set comprises at least one of the following items: a state inquiry contract, a model processing contract and a model downloading contract;
when the state inquiry contract is called by a user, submitting an inquiry transaction to inquire the current remaining available assets of the user side;
when the model updating contract is called by the organization user, uploading the local training model of the organization user to the block chain network to complete a model parameter updating transaction;
when the model downloading contract is called by the worker user, downloading all local training model parameters uploaded by the organization user from the blockchain network to complete a model parameter downloading transaction; when the model downloading contract is called by the organization user, downloading the joint training model parameters uploaded by the worker user from the blockchain network to complete a model parameter downloading transaction;
and when the model processing contract is called by the worker user, uploading the joint training model parameters to the blockchain network to complete one-time processing model parameter transaction.
8. The utility model provides a bang learning model training system which characterized in that includes:
the creating module is used for creating a block chain network for the training of the federal learning model;
the system comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving local training model parameters uploaded by an organization user in each round of training process of the federal learning model, and the organization user is a block chain user for locally training the federal learning model by using local user data;
the first sending module is used for sending the local training model parameters uploaded by all the organization users to worker users, and the worker users carry out joint training on the federated learning model by using the local training model parameters uploaded by all the organization users;
the updating module is used for updating the federal learning model by adopting the joint training model parameters uploaded by the worker users who successfully create the blocks;
and the second sending module is used for sending the joint training model parameters to the organization user so as to update the local training model parameters of the organization user.
9. A computing device, comprising: a processor, a memory, and a program stored on the memory and executable on the processor, the program when executed by the processor implementing the steps of the federal learning model training method as claimed in any of claims 1 to 7.
10. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the federal learning model training method as claimed in any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110001486.0A CN114764707A (en) | 2021-01-04 | 2021-01-04 | Federal learning model training method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110001486.0A CN114764707A (en) | 2021-01-04 | 2021-01-04 | Federal learning model training method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114764707A true CN114764707A (en) | 2022-07-19 |
Family
ID=82363262
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110001486.0A Pending CN114764707A (en) | 2021-01-04 | 2021-01-04 | Federal learning model training method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114764707A (en) |
Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180316502A1 (en) * | 2017-04-27 | 2018-11-01 | Factom | Data Reproducibility Using Blockchains |
CN110262819A (en) * | 2019-06-04 | 2019-09-20 | 深圳前海微众银行股份有限公司 | A kind of the model parameter update method and device of federal study |
CN111125779A (en) * | 2019-12-17 | 2020-05-08 | 山东浪潮人工智能研究院有限公司 | Block chain-based federal learning method and device |
CN111368319A (en) * | 2020-03-04 | 2020-07-03 | 西安电子科技大学 | Block chain-based data security access method in federated learning environment |
CN111552986A (en) * | 2020-07-10 | 2020-08-18 | 鹏城实验室 | Block chain-based federal modeling method, device, equipment and storage medium |
CN111598254A (en) * | 2020-05-22 | 2020-08-28 | 深圳前海微众银行股份有限公司 | Federal learning modeling method, device and readable storage medium |
CN111914277A (en) * | 2020-08-07 | 2020-11-10 | 平安科技(深圳)有限公司 | Intersection data generation method and federal model training method based on intersection data |
CN112084256A (en) * | 2019-06-12 | 2020-12-15 | 国际商业机器公司 | Aggregated machine learning validation for databases |
CN112132198A (en) * | 2020-09-16 | 2020-12-25 | 建信金融科技有限责任公司 | Data processing method, device and system and server |
EP3846062A1 (en) * | 2020-01-06 | 2021-07-07 | Tata Consultancy Services Limited | Method and system for processing transactions in a blockchain network |
WO2021208721A1 (en) * | 2020-11-23 | 2021-10-21 | 平安科技(深圳)有限公司 | Federated learning defense method, apparatus, electronic device, and storage medium |
CN113645020A (en) * | 2021-07-06 | 2021-11-12 | 北京理工大学 | Alliance chain privacy protection method based on safe multi-party computing |
CN114338045A (en) * | 2022-01-14 | 2022-04-12 | 中国人民解放军战略支援部队信息工程大学 | Information data verifiability safety sharing method and system based on block chain and federal learning |
CN115361145A (en) * | 2022-10-19 | 2022-11-18 | 北京理工大学 | Supervision-supporting alliance chain privacy protection method based on zero-knowledge proof |
WO2024016548A1 (en) * | 2022-07-20 | 2024-01-25 | 天津科技大学 | Blockchain-based ai model training method |
CN117540376A (en) * | 2023-11-08 | 2024-02-09 | 浙江师范大学 | Federal learning method and system supporting anti-poisoning and reasoning attack |
CN117875456A (en) * | 2023-12-22 | 2024-04-12 | 重庆邮电大学 | Federal learning method based on CKS homomorphic encryption and Fabric |
-
2021
- 2021-01-04 CN CN202110001486.0A patent/CN114764707A/en active Pending
Patent Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180316502A1 (en) * | 2017-04-27 | 2018-11-01 | Factom | Data Reproducibility Using Blockchains |
CN110262819A (en) * | 2019-06-04 | 2019-09-20 | 深圳前海微众银行股份有限公司 | A kind of the model parameter update method and device of federal study |
CN112084256A (en) * | 2019-06-12 | 2020-12-15 | 国际商业机器公司 | Aggregated machine learning validation for databases |
CN111125779A (en) * | 2019-12-17 | 2020-05-08 | 山东浪潮人工智能研究院有限公司 | Block chain-based federal learning method and device |
EP3846062A1 (en) * | 2020-01-06 | 2021-07-07 | Tata Consultancy Services Limited | Method and system for processing transactions in a blockchain network |
CN111368319A (en) * | 2020-03-04 | 2020-07-03 | 西安电子科技大学 | Block chain-based data security access method in federated learning environment |
CN111598254A (en) * | 2020-05-22 | 2020-08-28 | 深圳前海微众银行股份有限公司 | Federal learning modeling method, device and readable storage medium |
CN111552986A (en) * | 2020-07-10 | 2020-08-18 | 鹏城实验室 | Block chain-based federal modeling method, device, equipment and storage medium |
CN111914277A (en) * | 2020-08-07 | 2020-11-10 | 平安科技(深圳)有限公司 | Intersection data generation method and federal model training method based on intersection data |
CN112132198A (en) * | 2020-09-16 | 2020-12-25 | 建信金融科技有限责任公司 | Data processing method, device and system and server |
WO2021208721A1 (en) * | 2020-11-23 | 2021-10-21 | 平安科技(深圳)有限公司 | Federated learning defense method, apparatus, electronic device, and storage medium |
CN113645020A (en) * | 2021-07-06 | 2021-11-12 | 北京理工大学 | Alliance chain privacy protection method based on safe multi-party computing |
CN114338045A (en) * | 2022-01-14 | 2022-04-12 | 中国人民解放军战略支援部队信息工程大学 | Information data verifiability safety sharing method and system based on block chain and federal learning |
WO2024016548A1 (en) * | 2022-07-20 | 2024-01-25 | 天津科技大学 | Blockchain-based ai model training method |
CN115361145A (en) * | 2022-10-19 | 2022-11-18 | 北京理工大学 | Supervision-supporting alliance chain privacy protection method based on zero-knowledge proof |
CN117540376A (en) * | 2023-11-08 | 2024-02-09 | 浙江师范大学 | Federal learning method and system supporting anti-poisoning and reasoning attack |
CN117875456A (en) * | 2023-12-22 | 2024-04-12 | 重庆邮电大学 | Federal learning method based on CKS homomorphic encryption and Fabric |
Non-Patent Citations (2)
Title |
---|
张桉: "一种基于区块链与联邦学习的数据隐私保护方法", 《企业科技与发展》, no. 10, 31 October 2022 (2022-10-31) * |
郑立志;: "基于联邦学习的数据安全在银行领域的探索", 中国金融电脑, no. 09, 7 September 2020 (2020-09-07) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108650270B (en) | Data sharing method and system based on alliance chain and incentive mechanism | |
CN110870254B (en) | Method and system for providing distributed private subspaced data structures | |
CN110599181B (en) | Data processing method, device and equipment based on block chain and storage medium | |
CN109819443B (en) | Registration authentication method, device and system based on block chain | |
CN112003858B (en) | Block chain-based platform docking method, electronic device and storage medium | |
CN111125779A (en) | Block chain-based federal learning method and device | |
CN110751485B (en) | Data processing method and equipment | |
CN111681007B (en) | Credit scoring method, transaction method and related device for blockchain | |
EP3718069A1 (en) | Blockchain system for confidential and anonymous smart contracts | |
CN111340494B (en) | Asset type consistency evidence generation, transaction and transaction verification method and system | |
CN113268776A (en) | Model joint training method and device based on block chain | |
Rondelet et al. | Zeth: On integrating zerocash on ethereum | |
CN114386043B (en) | Decentralised privacy maintenance reputation evaluation method for crowd sensing | |
WO2015140745A2 (en) | A system and method for managing workflows associated with a document exchanged between a first service provider and a second service provider | |
Tennant | Improving the Anonymity of the IOTA Cryptocurrency | |
CN114565386A (en) | Block chain escrow transaction method and system with multi-party cooperative privacy protection | |
Bhatia et al. | WorkerRep: Building trust on crowdsourcing platform using blockchain | |
CN113298404A (en) | Method and device for determining workload of federal learning participator | |
CN111292057A (en) | Service processing method based on block chain | |
CN113037827A (en) | Voting method based on block chain, self-organization management method and computer equipment | |
CN116975901A (en) | Identity verification method, device, equipment, medium and product based on block chain | |
CN117150518A (en) | Communication carrier data security encryption method and system | |
CN117036023A (en) | Method, system, equipment and medium for identifying abnormal transaction network in meta universe | |
KR20210025802A (en) | Blockchain based project evaluation method and system | |
CN114764707A (en) | Federal learning model training method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |