CN112132277A - Federal learning model training method and device, terminal equipment and storage medium - Google Patents
Federal learning model training method and device, terminal equipment and storage medium Download PDFInfo
- Publication number
- CN112132277A CN112132277A CN202010996298.1A CN202010996298A CN112132277A CN 112132277 A CN112132277 A CN 112132277A CN 202010996298 A CN202010996298 A CN 202010996298A CN 112132277 A CN112132277 A CN 112132277A
- Authority
- CN
- China
- Prior art keywords
- model
- parameters
- parameter
- learning model
- block chain
- 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 127
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000001514 detection method Methods 0.000 claims abstract description 79
- 230000002776 aggregation Effects 0.000 claims description 37
- 238000004220 aggregation Methods 0.000 claims description 37
- 238000004590 computer program Methods 0.000 claims description 17
- 238000004891 communication Methods 0.000 claims description 14
- 230000004931 aggregating effect Effects 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000013473 artificial intelligence Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000011176 pooling Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 208000015181 infectious disease Diseases 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
- G06F30/27—Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
- G06N20/20—Ensemble learning
Abstract
The application is applicable to the technical field of artificial intelligence, and provides a method, a device, a terminal device and a storage medium for training a federated learning model, wherein parameter detection is carried out on model update parameters to respectively judge whether the model update parameters obtained after different participating devices carry out local model training according to initial model parameters are false parameters, and the model update parameters qualified in parameter detection are stored in a block chain, so that the storage of the false parameters in the block chain is prevented, further, malicious attacks on the federated learning model by the participating devices are prevented, the accuracy and the safety of the federated learning model training are improved, and the data tampering of the initial model parameters and the model update parameters qualified in parameter detection is effectively prevented by storing the initial model parameters and the model update parameters qualified in parameter detection of the federated learning model in the block chain, the accuracy of the federal learning model training is further improved.
Description
Technical Field
The application relates to the technical field of artificial intelligence, in particular to a method and a device for training a federated learning model, terminal equipment and a storage medium.
Background
With the development of artificial intelligence, people propose a concept of 'federal learning' for solving the problem of data islanding, so that participating devices in the federal state can cooperate to train a federal learning model under the condition that own data is not given, and the problem of data privacy disclosure can be avoided.
In the existing federal learning model training process, some participating devices may maliciously attack the federal learning model, for example, false parameters are used for participating in the training process of the federal learning model, so that the federal learning model cannot be converged and a model training task cannot be completed, or the accuracy of the finally output federal learning model is low, and further the training efficiency of the federal learning model is reduced.
Disclosure of Invention
In view of this, embodiments of the present application provide a method and an apparatus for training a federated learning model, a terminal device, and a storage medium, so as to solve the problem in the prior art that in the process of training a federated learning model, a participating device may maliciously attack the federated learning model according to false parameters, which results in low efficiency of training the federated learning model.
A first aspect of an embodiment of the present application provides a method for training a bang learning model, including:
storing initial model parameters of a federated learning model to a block chain, and respectively instructing different participating devices to perform local model training according to the initial model parameters in the block chain to obtain model updating parameters;
respectively obtaining the model updating parameters in different participating devices, and performing parameter detection on the model updating parameters, wherein the parameter detection is used for detecting whether the model updating parameters are false parameters;
if the parameter detection of the model updating parameter is qualified, storing the model updating parameter to the block chain;
and carrying out model training on the federated learning model according to the model updating parameters in the block chain until the federated learning model after model training converges.
Further, the performing model training on the federal learning model according to the model update parameters in the block chain includes:
acquiring the model updating parameters in the block chain, and performing parameter aggregation on the acquired model updating parameters to obtain model aggregation parameters, wherein the parameter aggregation is used for aggregating different model updating parameters in the block chain into one model parameter;
storing the model aggregation parameters into the block chain, and performing parameter updating on the model parameters in the federated learning model according to the model aggregation parameters in the block chain;
and if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is smaller than the difference threshold, judging that the federal learning model after the parameters are updated is converged.
Further, the performing model training on the federal learning model according to the model update parameters in the block chain further includes:
if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is larger than or equal to the difference threshold, judging that the federal learning model after the parameters are updated does not converge;
and updating the initial model parameters in the block chain according to the model aggregation parameters, and deleting the model updating parameters in the block chain.
Further, the calculation formula adopted for performing parameter aggregation on the obtained model update parameters is as follows:
C=(A1*B1+A2*B2+A3*B3……+An*Bn)/n
wherein A isnThe model update corresponding to the nth of the participating devices in the blockchainParameter, BnThe parameter weighting coefficient is corresponding to the nth participating device, n is the total number of the model update parameters in the block chain, and C is the model aggregation parameter.
Further, before the parameter detection of the model update parameter, the method further includes:
acquiring historical network communication data of the participating equipment, and marking the historical network communication data as positive sample data;
acquiring preset false parameters, and marking the preset false parameters as negative sample data;
and respectively carrying out model training on a parameter detection model according to the positive sample data and the negative sample data until the parameter detection model converges.
Further, the performing parameter detection on the model update parameter includes:
inputting the model updating parameters into the converged parameter detection model for parameter detection so as to calculate the similarity probability between the model updating parameters and the positive sample data;
if the similarity probability is larger than a probability threshold, judging that the parameter detection of the model updating parameter is qualified;
and if the similarity probability is smaller than or equal to the probability threshold, judging that the parameter detection of the model updating parameter is unqualified.
Further, the respectively instructing different participating devices to perform local model training according to the initial model parameters in the blockchain to obtain model update parameters includes:
respectively instructing different participating devices to construct local learning models according to the initial model parameters in the blockchain;
respectively instructing different participating devices to perform model training on the local learning model according to local data until the local learning model converges;
and if the local learning model is converged, obtaining the model parameters of the converged local learning model to obtain the model updating parameters.
A second aspect of the embodiments of the present application provides a Federation learning model training device, including:
the local model training unit is used for storing initial model parameters of the federal learning model to a block chain, and respectively instructing different participating devices to carry out local model training according to the initial model parameters in the block chain to obtain model updating parameters;
the parameter detection unit is used for respectively acquiring the model updating parameters in different participating devices and carrying out parameter detection on the model updating parameters, and the parameter detection is used for detecting whether the model updating parameters are false parameters;
the parameter storage unit is used for storing the model updating parameters to the block chain if the parameter detection of the model updating parameters is qualified;
and the model training unit is used for carrying out model training on the federated learning model according to the model updating parameters in the block chain until the federated learning model after model training converges.
A third aspect of the embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the terminal device, where the processor implements the steps of the federal learning model training method provided in the first aspect when executing the computer program.
A fourth aspect of the embodiments of the present application provides a storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of the federal learning model training method provided in the first aspect.
The method, the device, the terminal equipment and the storage medium for training the federated learning model provided by the embodiment of the application have the following beneficial effects:
the method for training the federated learning model provided by the embodiment of the application obtains model updating parameters by respectively instructing different participating devices to carry out local model training according to initial model parameters in a block chain, thereby effectively obtaining the model training parameters provided by the different participating devices for the federated learning model, respectively judging whether the model updating parameters obtained by the different participating devices after carrying out the local model training according to the initial model parameters are false parameters by carrying out parameter detection on the model updating parameters, and preventing the storage of the false parameters in the block chain by storing the model updating parameters qualified in the parameter detection into the block chain, further preventing the participating devices from maliciously attacking the federated learning model, improving the accuracy and the safety of the federated learning model training, and storing the initial model parameters of the federated learning model and the model updating parameters qualified in the parameter detection into the block chain, data tampering of the initial model parameters and the model updating parameters qualified in parameter detection is effectively prevented, and the accuracy of the Federal learning model training is further improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart illustrating an implementation of a method for training a federated learning model according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating an implementation of a method for training a federated learning model according to another embodiment of the present application;
FIG. 3 is a flowchart illustrating an implementation of a method for training a federated learning model according to yet another embodiment of the present application;
FIG. 4 is a block diagram illustrating a structure of a Federation learning model training apparatus according to an embodiment of the present disclosure;
fig. 5 is a block diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The federal learning model training method according to the embodiment of the present application may be executed by a control device or a terminal (hereinafter, referred to as a "mobile terminal").
Referring to fig. 1, fig. 1 shows a flowchart of an implementation of a method for training a federated learning model provided in an embodiment of the present application, where the method includes:
and step S10, storing the initial model parameters of the federal learning model into a block chain, and respectively instructing different participating devices to carry out local model training according to the initial model parameters in the block chain to obtain model updating parameters.
The federal learning model training method is used for training the federal learning model based on cooperation of different participating devices, initial model parameters of the federal learning model can be set according to requirements, and the initial model parameters comprise the number of layers and weight parameters of a convolutional layer, a pooling layer or a full-link layer and the like.
Optionally, in this step, the model training instruction may be sent to different participating devices respectively to instruct the different participating devices to perform local model training according to the initial model parameter in the block chain, specifically, in this embodiment, a device communication table is prestored, a corresponding relationship between the different participating devices and corresponding communication addresses is stored in the device communication table, and the model training instruction carries the data access address of the block chain.
Optionally, in this step, the respectively instructing different participating devices to perform local model training according to the initial model parameters in the blockchain to obtain model update parameters includes:
respectively instructing different participating devices to construct local learning models according to the initial model parameters in the blockchain;
respectively instructing different participating devices to perform model training on the local learning model according to local data until the local learning model converges;
if the local learning model is converged, obtaining model parameters of the converged local learning model to obtain model updating parameters;
the method comprises the steps that in different pieces of participating equipment, a local learning model built according to initial model parameters in a block chain is the same as the initial state parameters of the federal learning model, and model parameters of the local learning model built among the different pieces of participating equipment are the same, so that the different pieces of participating equipment are guaranteed to respectively carry out model training on the same local learning model, and model updating parameters of the different pieces of participating equipment after training the federal learning model can be obtained by respectively indicating the different pieces of participating equipment to carry out model training on the local learning model according to local data as the local learning model is the same as the initial state parameters of the federal learning model.
For example, the embodiment includes a participating device a1Participating device a2And participating device a3Participating devices a1Participating device a2And participating device a3Respectively training the local learning models constructed by the local learning models to obtain model updating parameters b1Model update parameter b2And model update parameters b3。
Step S20, respectively obtaining the model update parameters in the different participating devices, and performing parameter detection on the model update parameters.
In this step, the parameter detection model may be used to perform parameter detection on the model update parameters in different participating devices, so as to respectively determine whether the model update parameters in different participating devices are dummy parameters.
Optionally, in this step, the parameter detection model adopts a binary model, and the binary model is used to calculate a similarity probability between the input model update parameter and a preset dummy parameter, so as to determine whether the model update parameter in the participating device is a dummy parameter.
Step S30, if the parameter of the model update parameter is detected to be qualified, storing the model update parameter to the block chain.
The method comprises the steps that model training is carried out on a local learning model based on participating equipment according to local data to obtain corresponding model updating parameters, and specifically, the model updating parameters are obtained by carrying out model training on the local learning model through the participating equipment. Uploading the model update parameters to the blockchain can ensure the safety and the fair transparency of the model update parameters to users. The user equipment may download the trip infection value from the blockchain to verify whether the model update parameter is tampered with. The blockchain referred to in this example is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Optionally, in this embodiment, if the parameter detection of any one of the model update parameters is not qualified, it is determined that the model update parameter is a dummy parameter, and the model update parameter does not need to be stored in the block chain, so that the dummy parameter is prevented from being stored in the block chain.
And step S40, performing model training on the federated learning model according to the model updating parameters in the block chain until the federated learning model after model training converges.
The federated learning model is subjected to model training according to the model updating parameters in the block chain, so that the federated learning model can train the same model based on data in different participating devices, and leakage of data of the participating devices is prevented.
In the embodiment, the model updating parameters are obtained by respectively instructing different participating devices to perform local model training according to the initial model parameters in the block chain, so that the model training parameters provided by the different participating devices for the federal learning model can be effectively obtained, the model updating parameters are subjected to parameter detection to respectively judge whether the model updating parameters obtained by the different participating devices after performing the local model training according to the initial model parameters are false parameters, the model updating parameters qualified in the parameter detection are stored in the block chain, the storage of the false parameters in the block chain is prevented, further the malicious attack of the participating devices on the federal learning model is prevented, the accuracy and the safety of the federal learning model training are improved, and the initial model parameters of the federal learning model and the model updating parameters qualified in the parameter detection are stored in the block chain, data tampering of the initial model parameters and the model updating parameters qualified in parameter detection is effectively prevented, and the accuracy of the Federal learning model training is further improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating an implementation of a method for training a federated learning model according to another embodiment of the present application. With respect to the embodiment corresponding to fig. 1, the federal learning model training method provided in this embodiment is further detailed in step S40 in the embodiment corresponding to fig. 1, and includes:
step S41, obtaining the model updating parameters in the block chain, and performing parameter aggregation on the obtained model updating parameters to obtain model aggregation parameters.
Wherein the parameter aggregation is used for aggregating different model update parameters in the block chain into one model parameter.
Optionally, in this step, the calculation formula adopted for performing parameter aggregation on the obtained model update parameters is as follows:
C=(A1*B1+A2*B2+A3*B3……+An*Bn)/n
wherein A isnIs the model update parameter corresponding to the nth participating device in the blockchain, BnThe parameter weighting coefficient corresponding to the nth participating device is n, n is the total number of the model update parameters in the block chain, and C is the model aggregation parameter.
Optionally, in this step, the parameter weighting coefficients corresponding to the participating devices may be set according to requirements, and a weighting coefficient lookup table is pre-stored in this embodiment, where the weighting coefficient lookup table stores corresponding relationships between different participating devices and corresponding parameter weighting coefficients.
And step S42, storing the model aggregation parameters into the block chain, and updating the parameters of the model in the federated learning model according to the model aggregation parameters in the block chain.
Specifically, in the step, the model aggregation parameters include weight parameters of a convolutional layer, a pooling layer or a full link layer.
Step S43, if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is smaller than the difference threshold, the federal learning model with the updated parameters is determined to be converged.
And judging whether the model parameter difference value is smaller than a difference threshold value or not by calculating the model parameter difference value between the updated model parameter and the updated model parameter in the federal learning model so as to judge whether the federal learning model is converged or not.
Optionally, in this step, it may be further determined whether the federal learning model converges by determining whether the number of times of updating the parameters of the federal learning model is greater than a number threshold, and if it is determined that the number of times of updating the parameters of the federal learning model is greater than the number threshold, it is determined that the federal learning model converges.
Optionally, in this step, it may be further determined whether the federal learning model converges by determining whether the training duration of the federal learning model is greater than a duration threshold, and when it is determined that the training duration of the federal learning model is greater than the duration threshold, it is determined that the federal learning model converges.
Step S44, if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is greater than or equal to the difference threshold, determining that the federal learning model after the parameters are updated does not converge.
Optionally, in this step, when it is determined that the number of times of updating the parameter of the federal learning model is less than or equal to the number threshold, it is determined that the federal learning model is converged, and when it is determined that the training duration of the federal learning model is less than or equal to the duration threshold, it is determined that the federal learning model is converged.
Step S45, updating the initial model parameters in the block chain according to the model aggregation parameters, and deleting the model update parameters in the block chain.
After the initial model parameters in the block chain are updated according to the model aggregation parameters, the step S10 to the step S40 are returned to be executed, namely different participating devices are respectively instructed to conduct local model training according to the initial model parameters updated according to the data in the block chain to obtain new model updating parameters, the new model updating parameters in the different participating devices are respectively obtained, parameter detection is conducted on the new model updating parameters, if the parameter detection of the new model updating parameters is qualified, the new model updating parameters are stored in the block chain, model training is conducted on the federal learning model again according to the new model updating parameters in the block chain, and the updating of the initial model parameters in the block chain is stopped until the convergence of the federal learning model after model training is detected.
In the embodiment, different model updating parameters in the block chain can be effectively aggregated into one model parameter by performing parameter aggregation on the obtained model updating parameters, so that the parameter update of the model parameters in the Federal learning model by the model aggregation parameters is facilitated, by calculating the model parameter difference between the post-update and pre-update model parameters in the federated learning model, and determining whether the model parameter difference is less than a difference threshold to determine whether the federated learning model converges, the initial model parameters in the block chain are updated according to the model aggregation parameters, the model update parameters in the block chain are deleted, and returns to perform steps S10 through S40, so that different participating devices can perform model training again on the joint learning model, and furthermore, the convergence effect of the federal learning model is improved, and the accuracy of the federal learning model after the model is converged is improved.
Referring to fig. 3, fig. 3 is a flowchart illustrating an implementation of a method for training a federated learning model according to another embodiment of the present application. With respect to the embodiment corresponding to fig. 1, the federal learning model training method provided in this embodiment is the embodiment corresponding to fig. 1, and before step S20, the method further includes:
step S50, obtaining historical network communication data of the participating device, and marking the historical network communication data as positive sample data.
Since the historical network communication data on the participating device is real data, the accuracy of subsequent parameter detection model training is effectively improved by recording the historical network communication data of the participating device as positive sample data.
Step S60, acquiring preset false parameters, and marking the preset false parameters as negative sample data.
The preset false parameters are marked as negative sample data, so that the characteristics in the preset false parameters can be effectively learned in the subsequent parameter detection model training process, and the accuracy of the parameter detection model after model training on the false parameter identification is improved.
And step S70, respectively carrying out model training on a parameter detection model according to the positive sample data and the negative sample data until the parameter detection model converges.
The parameter detection model is subjected to model training according to positive sample data and negative sample data respectively, model loss values in the parameter detection model training process are calculated, if the model loss values output by the parameter detection model are smaller than a loss threshold value, the parameter detection model is judged to be converged, and the converged parameter detection model can effectively detect whether input parameter data are false data or not.
Optionally, in this step, the performing parameter detection on the model update parameter includes:
inputting the model updating parameters into the converged parameter detection model for parameter detection so as to calculate the similarity probability between the model updating parameters and the positive sample data;
if the similarity probability is larger than a probability threshold, judging that the parameter detection of the model updating parameter is qualified;
if the similarity probability is smaller than or equal to the probability threshold, determining that the parameter detection of the model updating parameter is unqualified;
in the embodiment, the historical network communication data of the participatory equipment is marked as positive sample data, and the preset false parameters are marked as negative sample data, so that the accuracy of the parameter detection model training is effectively improved, and the accuracy of the parameter detection of the updated parameters of the model is further improved.
Referring to fig. 4, fig. 4 is a block diagram illustrating a bang learning model training apparatus 100 according to an embodiment of the present disclosure. The federal learning model training device 100 in this embodiment includes units for executing the steps in the embodiments corresponding to fig. 1 to 3. Please refer to fig. 1 to 3 and fig. 1 to 3 for the corresponding embodiments. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 4, the federal learning model training device 100 includes: a local model training unit 10, a parameter detection unit 11, a parameter storage unit 12, and a model training unit 13, wherein:
the local model training unit 10 is configured to store initial model parameters of the federal learning model in a blockchain, and instruct different pieces of participating equipment to perform local model training according to the initial model parameters in the blockchain, so as to obtain model update parameters.
Wherein the local model training unit 10 is further configured to: respectively instructing different participating devices to construct local learning models according to the initial model parameters in the blockchain;
respectively instructing different participating devices to perform model training on the local learning model according to local data until the local learning model converges;
and if the local learning model is converged, obtaining the model parameters of the converged local learning model to obtain the model updating parameters.
A parameter detecting unit 11, configured to obtain the model update parameters in different participating devices, respectively, and perform parameter detection on the model update parameters, where the parameter detection is used to detect whether the model update parameters are dummy parameters.
Wherein, the parameter detecting unit 11 is further configured to: acquiring historical network communication data of the participating equipment, and marking the historical network communication data as positive sample data;
acquiring preset false parameters, and marking the preset false parameters as negative sample data;
and respectively carrying out model training on a parameter detection model according to the positive sample data and the negative sample data until the parameter detection model converges.
Optionally, the parameter detecting unit 11 is further configured to: inputting the model updating parameters into the converged parameter detection model for parameter detection so as to calculate the similarity probability between the model updating parameters and the positive sample data;
if the similarity probability is larger than a probability threshold, judging that the parameter detection of the model updating parameter is qualified;
and if the similarity probability is smaller than or equal to the probability threshold, judging that the parameter detection of the model updating parameter is unqualified.
A parameter storage unit 12, configured to store the model update parameter to the block chain if the parameter detection of the model update parameter is qualified.
And the model training unit 13 is configured to perform model training on the federated learning model according to the model update parameters in the block chain until the federated learning model after model training converges.
Wherein the model training unit 13 is further configured to: acquiring the model updating parameters in the block chain, and performing parameter aggregation on the acquired model updating parameters to obtain model aggregation parameters, wherein the parameter aggregation is used for aggregating different model updating parameters in the block chain into one model parameter;
storing the model aggregation parameters into the block chain, and performing parameter updating on the model parameters in the federated learning model according to the model aggregation parameters in the block chain;
and if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is smaller than the difference threshold, judging that the federal learning model after the parameters are updated is converged.
Optionally, the model training unit 13 is further configured to: if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is larger than or equal to the difference threshold, judging that the federal learning model after the parameters are updated does not converge;
and updating the initial model parameters in the block chain according to the model aggregation parameters, and deleting the model updating parameters in the block chain.
Optionally, in this embodiment, the calculation formula adopted for performing parameter aggregation on the obtained model update parameter is as follows:
C=(A1*B1+A2*B2+A3*B3……+An*Bn)/n
wherein A isnIs the model update parameter corresponding to the nth participating device in the blockchain, BnThe parameter weighting coefficient is corresponding to the nth participating device, n is the total number of the model update parameters in the block chain, and C is the model aggregation parameter.
The above shows that the model update parameters provided by different participating devices for the federal learning model can be effectively obtained by respectively instructing the different participating devices to perform local model training according to the initial model parameters in the block chain, the model update parameters are subjected to parameter detection to respectively judge whether the model update parameters obtained by the different participating devices after performing local model training according to the initial model parameters are false parameters, the model update parameters qualified in parameter detection are stored in the block chain, the storage of the false parameters in the block chain is prevented, further the malicious attack of the participating devices on the federal learning model is prevented, the accuracy and the safety of the federal learning model training are improved, the initial model parameters of the federal learning model and the model update parameters qualified in parameter detection are stored in the block chain, data tampering of the initial model parameters and the model updating parameters qualified in parameter detection is effectively prevented, and the accuracy of the Federal learning model training is further improved.
Fig. 5 is a block diagram of a terminal device 2 according to another embodiment of the present application. As shown in fig. 5, the terminal device 2 of this embodiment includes: a processor 20, a memory 21 and a computer program 22, such as a program of the federal learning model training method, stored in said memory 21 and operable on said processor 20. The processor 20, when executing the computer program 23, implements the steps in each embodiment of the above-described federal learning model training method, such as S10 to S40 shown in fig. 1, or S41 to S45 shown in fig. 2, or S50 to S70 shown in fig. 3. Alternatively, when the processor 20 executes the computer program 22, the functions of the units in the embodiment corresponding to fig. 4, for example, the functions of the units 10 to 13 shown in fig. 4, are implemented, for which reference is specifically made to the relevant description in the embodiment corresponding to fig. 5, which is not repeated herein.
Illustratively, the computer program 22 may be divided into one or more units, which are stored in the memory 21 and executed by the processor 20 to accomplish the present application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 22 in the terminal device 2. For example, the computer program 22 may be divided into a cost model training unit 10, a parameter detection unit 11, a parameter storage unit 12, and a model training unit 13, each of which functions as described above.
The terminal device may include, but is not limited to, a processor 20, a memory 21. It will be appreciated by those skilled in the art that fig. 5 is merely an example of a terminal device 2 and does not constitute a limitation of the terminal device 2 and may include more or less components than those shown, or some components may be combined, or different components, for example the terminal device may also include input output devices, network access devices, buses, etc.
The Processor 20 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or a memory of the terminal device 2. The memory 21 may also be an external storage device of the terminal device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the terminal device 2. The memory 21 is used for storing the computer program and other programs and data required by the terminal device. The memory 21 may also be used to temporarily store data that has been output or is to be output.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. A method for training a federated learning model is characterized by comprising the following steps:
storing initial model parameters of a federated learning model to a block chain, and respectively instructing different participating devices to perform local model training according to the initial model parameters in the block chain to obtain model updating parameters;
respectively obtaining the model updating parameters in different participating devices, and performing parameter detection on the model updating parameters, wherein the parameter detection is used for detecting whether the model updating parameters are false parameters;
if the parameter detection of the model updating parameter is qualified, storing the model updating parameter to the block chain;
and carrying out model training on the federated learning model according to the model updating parameters in the block chain until the federated learning model after model training converges.
2. The federal learning model training method of claim 1, wherein the model training of the federal learning model according to the model update parameters in the blockchain comprises:
acquiring the model updating parameters in the block chain, and performing parameter aggregation on the acquired model updating parameters to obtain model aggregation parameters, wherein the parameter aggregation is used for aggregating different model updating parameters in the block chain into one model parameter;
storing the model aggregation parameters into the block chain, and performing parameter updating on the model parameters in the federated learning model according to the model aggregation parameters in the block chain;
and if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is smaller than the difference threshold, judging that the federal learning model after the parameters are updated is converged.
3. The federal learning model training method of claim 2, wherein the model training of the federal learning model according to the model update parameters in the blockchain further comprises:
if the model parameter difference between the updated model parameters and the updated model parameters in the federal learning model is larger than or equal to the difference threshold, judging that the federal learning model after the parameters are updated does not converge;
and updating the initial model parameters in the block chain according to the model aggregation parameters, and deleting the model updating parameters in the block chain.
4. The federal learning model training method of claim 2, wherein the calculation formula for performing parameter aggregation on the obtained model update parameters is as follows:
C=(A1*B1+A2*B2+A3*B3……+An*Bn)/n
wherein A isnIs the model update parameter corresponding to the nth participating device in the blockchain, BnThe parameter weighting coefficient is corresponding to the nth participating device, n is the total number of the model update parameters in the block chain, and C is the model aggregation parameter.
5. The federal learning model training method as claimed in claim 1, wherein before the parameter testing of the model update parameters, the method further comprises:
acquiring historical network communication data of the participating equipment, and marking the historical network communication data as positive sample data;
acquiring preset false parameters, and marking the preset false parameters as negative sample data;
and respectively carrying out model training on a parameter detection model according to the positive sample data and the negative sample data until the parameter detection model converges.
6. The federal learning model training method of claim 5, wherein the performing parameter testing on the model update parameters comprises:
inputting the model updating parameters into the converged parameter detection model for parameter detection so as to calculate the similarity probability between the model updating parameters and the positive sample data;
if the similarity probability is larger than a probability threshold, judging that the parameter detection of the model updating parameter is qualified;
and if the similarity probability is smaller than or equal to the probability threshold, judging that the parameter detection of the model updating parameter is unqualified.
7. The federal learning model training method as claimed in claim 1, wherein the instructing different participating devices to perform local model training according to the initial model parameters in the blockchain to obtain model update parameters comprises:
respectively instructing different participating devices to construct local learning models according to the initial model parameters in the blockchain;
respectively instructing different participating devices to perform model training on the local learning model according to local data until the local learning model converges;
and if the local learning model is converged, obtaining the model parameters of the converged local learning model to obtain the model updating parameters.
8. The utility model provides a bang learning model trainer, its characterized in that includes:
the local model training unit is used for storing initial model parameters of the federal learning model to a block chain, and respectively instructing different participating devices to carry out local model training according to the initial model parameters in the block chain to obtain model updating parameters;
the parameter detection unit is used for respectively acquiring the model updating parameters in different participating devices and carrying out parameter detection on the model updating parameters, and the parameter detection is used for detecting whether the model updating parameters are false parameters;
the parameter storage unit is used for storing the model updating parameters to the block chain if the parameter detection of the model updating parameters is qualified;
and the model training unit is used for carrying out model training on the federated learning model according to the model updating parameters in the block chain until the federated learning model after model training converges.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A storage medium storing a computer program, characterized in that the computer program realizes the steps of the method according to any one of claims 1 to 7 when executed by a processor.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010996298.1A CN112132277A (en) | 2020-09-21 | 2020-09-21 | Federal learning model training method and device, terminal equipment and storage medium |
PCT/CN2020/125084 WO2021159753A1 (en) | 2020-09-21 | 2020-10-30 | Federated learning model training method and apparatus, terminal device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010996298.1A CN112132277A (en) | 2020-09-21 | 2020-09-21 | Federal learning model training method and device, terminal equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112132277A true CN112132277A (en) | 2020-12-25 |
Family
ID=73842306
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010996298.1A Pending CN112132277A (en) | 2020-09-21 | 2020-09-21 | Federal learning model training method and device, terminal equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112132277A (en) |
WO (1) | WO2021159753A1 (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112784995A (en) * | 2020-12-31 | 2021-05-11 | 杭州趣链科技有限公司 | Federal learning method, device, equipment and storage medium |
CN112863175A (en) * | 2020-12-31 | 2021-05-28 | 平安科技(深圳)有限公司 | Automobile road monitoring data processing method, device, equipment and storage medium |
CN112990488A (en) * | 2021-03-16 | 2021-06-18 | 香港理工大学深圳研究院 | Federal learning method based on machine isomerism |
CN113269359A (en) * | 2021-05-20 | 2021-08-17 | 深圳易财信息技术有限公司 | User financial status prediction method, device, medium, and computer program product |
CN113283185A (en) * | 2021-07-23 | 2021-08-20 | 平安科技(深圳)有限公司 | Federal model training and client imaging method, device, equipment and medium |
WO2022227212A1 (en) * | 2021-04-25 | 2022-11-03 | 平安科技(深圳)有限公司 | Federated learning-based speech representation model training method and apparatus, device, and medium |
CN115526339A (en) * | 2022-11-03 | 2022-12-27 | 中国电信股份有限公司 | Federal learning method and device, electronic equipment and computer readable storage medium |
CN115577858A (en) * | 2022-11-21 | 2023-01-06 | 山东能源数智云科技有限公司 | Block chain-based carbon emission prediction method and device and electronic equipment |
CN115994588A (en) * | 2023-03-16 | 2023-04-21 | 杭州海康威视数字技术股份有限公司 | Federal learning method, device and equipment based on blockchain and contract theory |
CN112784995B (en) * | 2020-12-31 | 2024-04-23 | 杭州趣链科技有限公司 | Federal learning method, apparatus, device and storage medium |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113658689A (en) * | 2021-08-25 | 2021-11-16 | 深圳前海微众银行股份有限公司 | Multi-agent model training method and device, electronic equipment and storage medium |
CN113762528A (en) * | 2021-09-10 | 2021-12-07 | 北京航空航天大学 | Block chain-based federal credit assessment method |
KR20230094891A (en) * | 2021-12-21 | 2023-06-28 | 경희대학교 산학협력단 | A system for federated learning and a method of operation thereof |
CN114580009B (en) * | 2022-01-13 | 2023-05-30 | 唐彩焱 | Block chain data management method, system and storage medium based on federal learning |
CN114707663B (en) * | 2022-04-15 | 2024-02-23 | 中国电信股份有限公司 | Distributed machine learning method, device, electronic equipment and storage medium |
CN114978893B (en) * | 2022-04-18 | 2024-04-12 | 西安交通大学 | Block chain-based decentralization federation learning method and system |
CN115174404A (en) * | 2022-05-17 | 2022-10-11 | 南京大学 | Multi-device federal learning system based on SDN networking |
US11763000B1 (en) | 2022-06-17 | 2023-09-19 | Uab 360 It | Malware detection using federated learning |
CN115242559B (en) * | 2022-09-23 | 2022-12-02 | 北京航空航天大学 | Network flow intrusion detection method based on block chain and federal learning |
CN116258420B (en) * | 2023-05-11 | 2023-08-01 | 中南大学 | Product quality detection method, device, terminal equipment and medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109635462A (en) * | 2018-12-17 | 2019-04-16 | 深圳前海微众银行股份有限公司 | Model parameter training method, device, equipment and medium based on federation's study |
CN110490330A (en) * | 2019-08-16 | 2019-11-22 | 安徽航天信息有限公司 | A kind of distributed machines learning system based on block chain |
CN111598254A (en) * | 2020-05-22 | 2020-08-28 | 深圳前海微众银行股份有限公司 | Federal learning modeling method, device and readable storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3503012A1 (en) * | 2017-12-20 | 2019-06-26 | Accenture Global Solutions Limited | Analytics engine for multiple blockchain nodes |
CN110503207A (en) * | 2019-08-28 | 2019-11-26 | 深圳前海微众银行股份有限公司 | Federation's study credit management method, device, equipment and readable storage medium storing program for executing |
-
2020
- 2020-09-21 CN CN202010996298.1A patent/CN112132277A/en active Pending
- 2020-10-30 WO PCT/CN2020/125084 patent/WO2021159753A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109635462A (en) * | 2018-12-17 | 2019-04-16 | 深圳前海微众银行股份有限公司 | Model parameter training method, device, equipment and medium based on federation's study |
CN110490330A (en) * | 2019-08-16 | 2019-11-22 | 安徽航天信息有限公司 | A kind of distributed machines learning system based on block chain |
CN111598254A (en) * | 2020-05-22 | 2020-08-28 | 深圳前海微众银行股份有限公司 | Federal learning modeling method, device and readable storage medium |
Non-Patent Citations (1)
Title |
---|
KANG,JIAWEN 等: "Incentive Mechanism for Reliable Federated Learning: A Joint Optimization Approach to Combining Reputation and Contract Theory", 《IEEE INTERNET OF THINGS JOURNAL》 * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112863175B (en) * | 2020-12-31 | 2022-11-22 | 平安科技(深圳)有限公司 | Automobile road monitoring data processing method, device, equipment and storage medium |
CN112863175A (en) * | 2020-12-31 | 2021-05-28 | 平安科技(深圳)有限公司 | Automobile road monitoring data processing method, device, equipment and storage medium |
CN112784995A (en) * | 2020-12-31 | 2021-05-11 | 杭州趣链科技有限公司 | Federal learning method, device, equipment and storage medium |
CN112784995B (en) * | 2020-12-31 | 2024-04-23 | 杭州趣链科技有限公司 | Federal learning method, apparatus, device and storage medium |
CN112990488A (en) * | 2021-03-16 | 2021-06-18 | 香港理工大学深圳研究院 | Federal learning method based on machine isomerism |
CN112990488B (en) * | 2021-03-16 | 2024-03-26 | 香港理工大学深圳研究院 | Federal learning method based on machine isomerism |
WO2022227212A1 (en) * | 2021-04-25 | 2022-11-03 | 平安科技(深圳)有限公司 | Federated learning-based speech representation model training method and apparatus, device, and medium |
CN113269359A (en) * | 2021-05-20 | 2021-08-17 | 深圳易财信息技术有限公司 | User financial status prediction method, device, medium, and computer program product |
CN113283185B (en) * | 2021-07-23 | 2021-11-12 | 平安科技(深圳)有限公司 | Federal model training and client imaging method, device, equipment and medium |
CN113283185A (en) * | 2021-07-23 | 2021-08-20 | 平安科技(深圳)有限公司 | Federal model training and client imaging method, device, equipment and medium |
CN115526339A (en) * | 2022-11-03 | 2022-12-27 | 中国电信股份有限公司 | Federal learning method and device, electronic equipment and computer readable storage medium |
CN115577858A (en) * | 2022-11-21 | 2023-01-06 | 山东能源数智云科技有限公司 | Block chain-based carbon emission prediction method and device and electronic equipment |
CN115994588A (en) * | 2023-03-16 | 2023-04-21 | 杭州海康威视数字技术股份有限公司 | Federal learning method, device and equipment based on blockchain and contract theory |
CN115994588B (en) * | 2023-03-16 | 2023-07-25 | 杭州海康威视数字技术股份有限公司 | Data processing method, device and equipment based on blockchain and contract theory |
Also Published As
Publication number | Publication date |
---|---|
WO2021159753A1 (en) | 2021-08-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112132277A (en) | Federal learning model training method and device, terminal equipment and storage medium | |
TWI698808B (en) | Model testing method and device | |
US20130246290A1 (en) | Machine-Assisted Legal Assessments | |
CN111967609B (en) | Model parameter verification method, device and readable storage medium | |
CN113965359B (en) | Federal learning data poisoning attack-oriented defense method and device | |
JP2020522780A (en) | Training method for mesh pattern removal system, mesh pattern removal method, device, device and medium | |
CN112085056B (en) | Target detection model generation method, device, equipment and storage medium | |
CN107818301A (en) | Update the method, apparatus and electronic equipment of biometric templates | |
CN115577858B (en) | Block chain-based carbon emission prediction method and device and electronic equipment | |
CN111324764A (en) | Image detection method and device, electronic equipment and storage medium | |
CN112884016B (en) | Cloud platform credibility assessment model training method and cloud platform credibility assessment method | |
CN111027412A (en) | Human body key point identification method and device and electronic equipment | |
CN112883377A (en) | Feature countermeasure based federated learning poisoning detection method and device | |
WO2021042544A1 (en) | Facial verification method and apparatus based on mesh removal model, and computer device and storage medium | |
CN112017776B (en) | Disease prediction method based on dynamic graph and medical knowledge map and related equipment | |
CN112446507A (en) | Recommendation model training method and device, terminal device and storage medium | |
CN112348203A (en) | Model training method and device, terminal device and storage medium | |
CN111091194A (en) | Operation system identification method based on CAVWB _ KL algorithm | |
CN110647805B (en) | Reticulate pattern image recognition method and device and terminal equipment | |
CN113313245B (en) | Model processing method, system and device for shared learning and electronic equipment | |
US11537742B2 (en) | Sampling from a remote dataset with a private criterion | |
CN113987328A (en) | Topic recommendation method, equipment, server and storage medium | |
CN114510592A (en) | Image classification method and device, electronic equipment and storage medium | |
CN111241297A (en) | Map data processing method and device based on label propagation algorithm | |
CN116841650B (en) | Sample construction method, device, equipment and storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201225 |