Federated learning method, device, electronic device, and medium

By using blockchain systems and asymmetric encryption algorithms in federated learning, the inefficiency and security risks caused by centralized coordination are solved, and a more efficient and secure model training process is achieved, improving model accuracy.

CN113988318BActive Publication Date: 2025-08-26BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111229404.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-21
Publication Date
2025-08-26
Estimated Expiration
2041-10-21

AI Technical Summary

Technical Problem

In the existing federated learning method, the training process relies on a centralized coordinator, resulting in inefficiency and the risk of data being maliciously tampered with and privacy leaks.

Method used

The blockchain system is used to summarize and calculate the model parameter values, and the final model parameter values ​​are obtained in the blockchain system through the target summary and aggregation node, and data protection is used to achieve non-trust-based collaboration between the participants.

Benefits of technology

It reduces the risk of data being maliciously tampered with and privacy leaks, improves the accuracy and efficiency of the federated learning model, and establishes a collaboration mechanism that is not based on trust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988318B_ABST
    Figure CN113988318B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a federated learning method, apparatus, electronic device, and medium. The method comprises: responding to a message issued by a technical party announcing the start of a current round of model training, training a federated learning base model based on a local training sample set to obtain model parameter values ​​for the current round of training; obtaining the final model parameter values ​​for the current round of training from a blockchain system; and updating the parameter values ​​of the federated learning base model based on the final model parameter values. Embodiments of the present disclosure can reduce the risk of malicious data tampering and privacy leakage, enable trust-free collaboration between different participants, and improve the accuracy of the federated learning base model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of federated learning, and in particular to a federated learning method, apparatus, electronic device, and medium. Background Art

[0002] At present, various organizations and institutions have accumulated a large amount of business data in the course of their business operations, but these data basically exist in the form of data islands and their value has not been effectively utilized.

[0003] To address data silos and protect data, existing technologies often employ federated learning methods, enabling participants to collaboratively train machine learning models without directly exchanging raw data, achieving mutual benefit. However, the training process relies on a centralized coordinator, making federated learning inefficient. Summary of the Invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a federated learning method, apparatus, electronic device and medium.

[0005] In a first aspect, the present disclosure provides a federated learning method, comprising:

[0006] In response to the technical party's announcement of the start of this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​for this round of training;

[0007] Obtain the final model parameter value of this round of training process from the blockchain system, wherein the final model parameter value is obtained by the blockchain system obtaining all model parameter values ​​through the target aggregation node and aggregating and calculating all model parameter values;

[0008] The parameter values ​​of the federated learning basic model are updated according to the final model parameter values.

[0009] Optionally, in response to the message issued by the technical party to start the current round of model training, the federated learning basic model is trained based on the local training sample set, and before obtaining the model parameter values ​​of the current round of training process, the method further includes:

[0010] Obtain a target aggregation node from the blockchain system, wherein the target aggregation node is determined by the blockchain system according to a preset random method, and the number of the target aggregation node is greater than a preset number.

[0011] Optionally, the target aggregation node includes a first aggregation node;

[0012] Before obtaining the final model parameter value of this round of training process from the blockchain system, the following steps are also included:

[0013] Encrypting the model parameter value according to the public key of the first aggregation node to obtain a first model parameter value, and storing the first model parameter value in the blockchain system;

[0014] Correspondingly, the final model parameter value is obtained by the blockchain system when the first summary aggregation node is online, obtaining all first model parameter values ​​through the first summary aggregation node, decrypting all first model parameter values ​​through the private key of the first summary aggregation node, and summarizing and calculating all model parameter values ​​obtained after decryption.

[0015] Optionally, the target aggregation node further includes a second aggregation node;

[0016] Correspondingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value through proxy re-encryption, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and summarize and calculate all the model parameter values ​​obtained after decryption, wherein the second model parameter value is obtained by encrypting the model parameter value according to the public key of the second summary aggregation node.

[0017] Optionally, after updating the parameter values ​​of the federated learning basic model according to the final model parameter values, the method further includes:

[0018] Waiting for a message to start the next round of model training, and responding to the message to start the next round of model training to perform a new round of training process;

[0019] Respond to the message issued by the technical party indicating that the training process of the federated learning basic model is completed, and end the training process of the federated learning basic model according to the message.

[0020] Optionally, the message is released after the technical party determines that the new final model parameter value meets the preset accuracy or the number of training rounds reaches a preset threshold.

[0021] Optionally, the local training sample set is obtained by:

[0022] Based on the type of local data, calling the data specification style and / or training sample set generation tool provided by the technical party to extract the features required to generate the local training sample set from the local data;

[0023] Generate a local training sample set corresponding to the federated learning basic model according to the features.

[0024] In a second aspect, the present disclosure provides a federated learning apparatus, comprising:

[0025] The training module is used to respond to the message issued by the technical party to start the current round of model training, train the federated learning basic model based on the local training sample set, and obtain the model parameter values ​​of the current round of training process;

[0026] An acquisition module is used to obtain the final model parameter value of the current round of training process from the blockchain system, wherein the final model parameter value is obtained by the blockchain system obtaining all model parameter values ​​through the target aggregation node and summarizing and calculating all model parameter values;

[0027] An updating module is used to update the parameter values ​​of the federated learning basic model according to the final model parameter values.

[0028] Optionally, the above device further includes:

[0029] A node determination module is configured to respond to a message issued by the technical party to start this round of model training, train the federated learning basic model based on the local training sample set, and obtain a target summary aggregation node from the blockchain system before obtaining the model parameter value of this round of training process, wherein the target summary aggregation node is determined by the blockchain system according to a preset random method, and the number of the target summary aggregation nodes is greater than a preset number.

[0030] Optionally, the target aggregation node includes a first aggregation node; and the apparatus further includes:

[0031] a storage module, configured to, before obtaining the final model parameter value of the current round of training process from the blockchain system, encrypt the model parameter value according to the public key of the first aggregation node to obtain a first model parameter value, and store the first model parameter value in the blockchain system;

[0032] Correspondingly, the final model parameter value is obtained by the blockchain system when the first summary aggregation node is online, obtaining all first model parameter values ​​through the first summary aggregation node, decrypting all first model parameter values ​​through the private key of the first summary aggregation node, and summarizing and calculating all model parameter values ​​obtained after decryption.

[0033] Optionally, the target aggregation node further includes a second aggregation node;

[0034] Correspondingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value through proxy re-encryption, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and summarize and calculate all the model parameter values ​​obtained after decryption, wherein the second model parameter value is obtained by encrypting the model parameter value according to the public key of the second summary aggregation node.

[0035] Optionally, the above device further includes:

[0036] a response module, configured to update the parameter values ​​of the federated learning basic model according to the final model parameter values, wait for a message to start the next round of model training, and respond to the message to start the next round of model training to perform a new round of training;

[0037] An ending module is used to respond to the message issued by the technical party indicating that the training process of the federated learning basic model has ended, and to end the training process of the federated learning basic model according to the message.

[0038] Optionally, the message is released after the technical party determines that the new final model parameter value meets the preset accuracy or the number of training rounds reaches a preset threshold.

[0039] Optionally, the local training sample set is obtained by:

[0040] Based on the type of local data, calling the data specification style and / or training sample set generation tool provided by the technical party to extract the features required to generate the local training sample set from the local data;

[0041] Generate a local training sample set corresponding to the federated learning basic model according to the features.

[0042] In a third aspect, the present disclosure further provides an electronic device, comprising:

[0043] one or more processors;

[0044] a storage device for storing one or more programs,

[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the federated learning methods described in the embodiments of the present disclosure.

[0046] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any one of the federated learning methods described in the embodiments of the present disclosure.

[0047] The technical solution provided by the disclosed embodiments offers the following advantages over existing technologies: First, in response to a message issued by a technical party announcing the start of a current round of model training, the federated learning base model is trained based on a local training sample set to obtain the model parameter values ​​for this round of training. The final model parameter values ​​for this round of training are then obtained from the blockchain system. Finally, the parameters of the federated learning base model are updated based on the final model parameter values. This disclosed embodiment reduces the risk of malicious data tampering and privacy leaks, enables trust-free collaboration between different participants, and improves the accuracy of the federated learning base model. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0049] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0050] Figure 1 is a schematic diagram of the logical relationship between the three types of participants involved in the method provided by the embodiment of the present disclosure;

[0051] Figure 2 is a flowchart of a federated learning method provided by an embodiment of the present disclosure;

[0052] Figure 3A is a flowchart of another federated learning method provided by an embodiment of the present disclosure;

[0053] Figure 3B is a schematic diagram of the functional modules and their interrelationships provided by an embodiment of the present disclosure;

[0054] Figure 4 is a structural diagram of a federated learning device provided by an embodiment of the present disclosure;

[0055] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0056] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0058] Figure 1 This is a schematic diagram of the logical relationship between the three types of participants involved in the method provided by the embodiment of the present disclosure, such as Figure 1 As shown:

[0059] The parties involved in this embodiment may include: data party (short for data owner) 110, technical party (short for technical support provider) 120, and security auditor 140. The federated learning process primarily involves data party 110 and technical party 120, and is implemented based on blockchain system 130. Security auditor 140 does not participate in the federated learning process. Data party 110 and blockchain system 130 can exchange data, and technical party 120 and blockchain system 130 can also exchange data.

[0060] Data Entity 110 can be understood as an organization that accumulates a large amount of raw data in its daily production and business activities and continuously generates business data in a production environment, but has relatively weak data analysis capabilities and requires external organizations to provide data analysis support. For example, this may include various enterprises, scientific research institutions, and educational institutions that produce important materials. This disclosure may involve one or more data entities, and the figure uses one as an example for illustration.

[0061] Technical party 120 can be understood as an organization with extensive experience in data analysis technology and capabilities, but lacking the raw business data required for data analysis due to its non-production environment. For example, this organization may include a high-tech enterprise or a data analysis-related research institution. The present disclosure may involve one or more technical parties, and the figure illustrates one such organization as an example.

[0062] Blockchain system 130 can be understood as a blockchain network jointly established by data provider 110, technology provider 120, and security auditor 140 to support and implement the federated learning process. Federated learning can be understood as a method that enables all participating parties to collaboratively train the basic federated learning model without directly exchanging raw data, achieving mutual benefit. This blockchain network is a consortium chain network, so network nodes belonging to each participating party must complete identity authentication through the access authentication module in blockchain system 130. Only after passing identity authentication can network nodes join the blockchain network. Network nodes can be understood as computers connected to the blockchain network.

[0063] Security auditor 140 can be understood as an organization that monitors data provider 110 and technical provider 120 for violations, as well as privacy breaches and other security issues during model training. This role can be performed by a government regulatory agency or other third-party security auditing organization. Security auditor 140 includes a security audit module, whose primary function is to monitor the entire model training process to promptly identify security issues such as violations and privacy data breaches. This disclosure may involve one or more security auditors, and the figure illustrates one as an example.

[0064] Figure 2 This is a flow chart of a federated learning method provided by an embodiment of the present disclosure. This embodiment is applicable to the case of federated learning based on blockchain. The method of this embodiment can be executed by a federated learning device, which can be implemented in hardware / or software and can be configured in an electronic device. Figure 2 As shown, the method specifically includes the following:

[0065] S210 , in response to the message released by the technical party to start this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​of this round of training process.

[0066] The technical team deployed a model training synchronization module, primarily responsible for synchronizing the start and end times of each round of federated learning basic model training and monitoring whether the model parameter values ​​of each data provider have been uploaded to the blockchain through consensus. Consensus upload can be understood as storage on the blockchain after verification by the blockchain system. The local training sample set can be understood as the training sample set generated by each data provider. The federated learning basic model can be understood as the training model provided by the technical team.

[0067] For different data types, the technical party can determine the initial machine learning algorithm model based on practical experience and negotiation, and then use simulated data or locally accumulated real data to train the initial machine learning algorithm model to generate a federated learning basic model. The federated learning basic model and the initialized model parameter values ​​are synchronized to each data party through the blockchain system. In addition, the technical party can publish a message to start this round of model training through the model training synchronization module. After receiving the message issued by the technical party to start this round of model training, each data party can respond to the message to start this round of model training and train the federated learning basic model synchronized by the technical party based on the local training sample set. After this round of training, each data party obtains the model parameter values ​​for this round of training process.

[0068] S220, obtain the final model parameter value of this round of training process from the blockchain system.

[0069] The final model parameter values ​​are obtained by the blockchain system through the target aggregation node, which aggregates and calculates all model parameter values. The final model parameter values ​​can be understood as the optimal model parameter values ​​obtained after the current round of model training for each data provider. The target aggregation node can be understood as a node selected from each data provider or technical provider, primarily used to aggregate and calculate the model parameter values ​​obtained during each round of training for each data provider.

[0070] After obtaining the model parameter values ​​for this round of training, each data provider will store them in the blockchain system. Because this round of training involves a large number of model parameter values, the blockchain system needs to obtain all model parameter values ​​through a target aggregation node and aggregate them using a corresponding aggregation algorithm to determine the final model parameter values ​​for this round of training. Once the blockchain system determines the final model parameter values ​​for this round of training, each data provider can retrieve them from the blockchain system for subsequent model training.

[0071] S230: Update the parameter values ​​of the federated learning basic model according to the final model parameter values.

[0072] Each data party can obtain the final model parameter value of this round of training through the model parameter value update contract in the smart contract module deployed in the blockchain system. According to the final model parameter value, the parameter value of the federated learning basic model can be updated, that is, the final model parameter value of this round is used as the initial model parameter value of the next round of model training, so that the federated learning basic model with the updated parameter value can be trained further.

[0073] In this embodiment, first, in response to the message released by the technical party to start this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​of this round of training process, and then the final model parameter values ​​of this round of training process are obtained from the blockchain system. Finally, according to the final model parameter values, the parameter values ​​of the federated learning basic model are updated. The above method can reduce the risk of malicious data tampering and privacy leakage, enable non-trust-based collaboration between different participants, and improve the accuracy of the federated learning basic model.

[0074] In some embodiments, optionally, in response to the message issued by the technical party to start this round of model training, the federated learning basic model is trained based on the local training sample set, and before obtaining the model parameter values ​​of this round of training process, it can also specifically include: obtaining a target summary aggregation node from the blockchain system, wherein the target summary aggregation node is determined by the blockchain system according to a preset random method, and the number of the target summary aggregation nodes is greater than a preset number.

[0075] The preset randomization method can be a Verifiable Random Function (VRF) or other randomization algorithm, and this embodiment does not impose any specific limitations. The preset number can also be a predetermined value or determined based on actual conditions. Preferably, the preset number is greater than or equal to 1. The target number is the number of target aggregation nodes, for example, 2.

[0076] Specifically, the blockchain system deploys a rollup and aggregation node selection module. This module uses VRF to randomly select a target number of rollup and aggregation nodes (i.e., target rollup and aggregation nodes) before each round of model training, before the initial model training, or at other times. The election results are then broadcasted across the blockchain system. Because the election results for the target rollup and aggregation nodes are broadcasted across the entire blockchain system, each data provider can obtain relevant information, such as the target rollup and aggregation nodes' public keys, from the blockchain system.

[0077] It should be noted that this embodiment does not limit the time for determining the target aggregation node through the aggregation node selection module.

[0078] In this embodiment, obtaining the target summary aggregation node from the blockchain system is beneficial for each data party to subsequently obtain the final model parameter value and encrypt the model parameter value obtained in each round of training process according to the public key of the target summary aggregation node.

[0079] In some embodiments, optionally, the target summary aggregation node includes a first summary aggregation node; before obtaining the final model parameter value of this round of training process from the blockchain system, it can also specifically include: encrypting the model parameter value according to the public key of the first summary aggregation node to obtain the first model parameter value, and storing the first model parameter value in the blockchain system; accordingly, the final model parameter value is obtained by the blockchain system when the first summary aggregation node is online, obtaining all the first model parameter values ​​through the first summary aggregation node, decrypting all the first model parameter values ​​through the private key of the first summary aggregation node, and summarizing and calculating all the model parameter values ​​obtained after decryption.

[0080] Specifically, when the target aggregation node includes a first aggregation node, each data party encrypts the model parameter values ​​of the current training round using the public key of the first aggregation node to obtain the first model parameter values, which are then stored in the blockchain system. When the first aggregation node is online, the blockchain system can obtain all first model parameter values ​​through the first aggregation node and decrypt them using the private key of the first aggregation node. The first aggregation node aggregates and calculates all the decrypted model parameter values ​​to obtain the final model parameter values ​​of the current training round. The first aggregation node can extract the first model parameter values ​​uploaded by each data party and stored in the blockchain system through the model parameter acquisition contract in the smart contract module.

[0081] In this embodiment, the model parameter values ​​of this round of training process are encrypted and all first model parameter values ​​are decrypted using an asymmetric encryption algorithm, which can solve the privacy leakage problem that may occur during the storage of data in the blockchain system and further improve the security of the storage process.

[0082] In this embodiment, further, the first aggregation node encrypts the on-chain contract according to the model parameter value in the smart contract module, uses its own private key to encrypt the final model parameter value of this round of training process and stores it in the blockchain system, so that the technical party can obtain the final model parameter value of this round of training process from the blockchain system through the public key of the first aggregation node.

[0083] In some embodiments, optionally, the method further comprises:

[0084] In response to the message released by the technical party that this round of model training has ended, this round of training process ends.

[0085] Specifically, the technical party uses the model training synchronization module to determine the number of stored first model parameter values. When this number exceeds a threshold, the model training synchronization module issues a message to end the current round of model training, thereby preventing each round of training from taking too long. After receiving the message issued by the technical party, each data party responds to the message, thereby concluding the current round of training.

[0086] In this embodiment, ending the current round of training process by the above method can prevent each round of training from taking too long, improve work efficiency, and avoid increasing the time of model training.

[0087] In some embodiments, optionally, the target summary aggregation node also includes a second summary aggregation node; accordingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value through a proxy re-encryption method, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and summarize and calculate all the model parameter values ​​obtained after decryption, wherein the second model parameter value is obtained by encrypting the model parameter value according to the public key of the second summary aggregation node.

[0088] Specifically, the target aggregation node also includes a second aggregation node. When the blockchain system is offline at the first aggregation node, the first aggregation node generates a conversion key using its private key and the public key of the second aggregation node. This conversion key is encrypted using the public key of the technical party and sent to each technical party via an encrypted channel. Therefore, when the target aggregation node needs to be replaced, the blockchain system initiates a data conversion request to the technical party via the second aggregation node, so that the technical party can call its own proxy re-encryption module to implement the re-encryption process. The re-encryption process is as follows: the technical party converts the first model parameter value into the second model parameter value using proxy re-encryption according to the conversion key, and sends the second model parameter value to the second aggregation node via an encrypted channel. All second model parameter values ​​are decrypted using the private key of the second aggregation node. After the second aggregation node aggregates and calculates all the decrypted model parameter values, the final model parameter value of this round of training is obtained.

[0089] In this embodiment, the second aggregation node can replace the first aggregation node in time when the first aggregation node is offline, thereby avoiding the adverse impact of single point failure on the model training process. By combining blockchain, federated learning and proxy re-encryption, the risks of malicious data tampering and privacy leakage faced in traditional federated learning are effectively reduced.

[0090] In this embodiment, further, the second aggregation node encrypts the on-chain contract according to the model parameter value in the smart contract module, uses its own private key to encrypt the final model parameter value of this round of training process and stores it in the blockchain system, so that the technical party can obtain the final model parameter value of this round of training process from the blockchain system according to the public key of the second aggregation node.

[0091] In some embodiments, optionally, if all target aggregation nodes are offline, the blockchain system re-determines a new target aggregation node.

[0092] In this embodiment, when all target aggregation nodes are offline, that is, when a failure occurs, re-determining a new target aggregation node can ensure the smooth progress of the model training process, and when all target aggregation nodes are offline, each data party should use the initial model parameter value at the beginning of the previous round to re-train the model.

[0093] In some embodiments, optionally, the target aggregation node establishes and maintains a heartbeat connection with the technical party to verify whether the target aggregation node is online.

[0094] In this embodiment, the heartbeat connection can be used to determine whether the target summary aggregation node is online. When the first summary aggregation node is offline, it can be replaced with a new summary aggregation node in a timely manner, thereby ensuring the smooth progress of the summary calculation process of the model parameter value and improving the stability and robustness of the operation process of the federated learning method.

[0095] Figure 3A This is a flow chart of another federated learning method provided by an embodiment of the present disclosure. This embodiment is an optimization based on the above embodiment. Optionally, this embodiment provides a detailed explanation of the process after updating the parameter values ​​of the federated learning basic model.

[0096] like Figure 3A As shown, the method specifically includes the following:

[0097] S310 , in response to the message issued by the technical party to start this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​of this round of training process.

[0098] S320, obtaining the final model parameter values ​​of this round of training process from the blockchain system.

[0099] S330: Update the parameter values ​​of the federated learning basic model according to the final model parameter values.

[0100] S340, waiting for the message of starting the next round of model training, and responding to the message of starting the next round of model training to perform a new round of training process.

[0101] After completing the current round of training, each data party waits for the message to start the next round of model training. After receiving the message to start the next round of model training issued by the technical party through the model training synchronization module, each data party responds to the message to start the next round of model training and conducts a new round of training based on the model parameter values ​​updated in the previous round.

[0102] S350, responding to the message issued by the technical party indicating that the training process of the federated learning basic model has ended, and ending the training process of the federated learning basic model according to the message.

[0103] After each data party receives the message that the training process of the federated learning basic model has ended, which is released by the technical party through the model training synchronization module, it means that the training process of the federated learning basic model has ended. Each data party needs to end the training process of the federated learning basic model according to this message.

[0104] In this embodiment, optionally, the message is released after the technical party determines that the new final model parameter value meets a preset accuracy or the number of training rounds reaches a preset threshold.

[0105] The preset accuracy can be pre-set or determined according to specific circumstances, which is not specifically limited in this embodiment. The preset threshold can be pre-set or determined according to specific circumstances, which is not specifically limited in this embodiment.

[0106] In this embodiment, when the technical party determines that the new final model parameter value meets the preset accuracy or the number of training rounds reaches the preset threshold, the model training synchronization module publishes a message indicating the end of the training process of the federated learning basic model, which can promptly end the training process of the federated learning basic model and avoid wasting resources.

[0107] In this embodiment, optionally, the local training sample set can be obtained specifically in the following manner: according to the type of local data, calling the data specification style and / or training sample set generation tool provided by the technical party, extracting the features required to generate the local training sample set from the local data; generating the local training sample set corresponding to the federated learning basic model according to the features.

[0108] Specifically, for different data types, the technical party can provide corresponding data specification styles and / or training sample set generation tools. Before training the federated learning basic model, the data party can call the data specification style and / or training sample set generation tool provided by the technical party through the local training sample generation module deployed in the data party according to the type of local data, and extract the features required to generate the local training sample set from the local data. After extracting the features, the local training sample set corresponding to the federated learning basic model is generated based on the features.

[0109] In this embodiment, generating a local training sample set using the above method can save time and lower the technical threshold for participating in federated learning.

[0110] In this embodiment, further, after extracting the features required to generate the local training sample set from the local data, the features can also be preprocessed, for example, data enrichment or feature dimensionality reduction processing, etc., which is conducive to the subsequent generation of the local training sample set and can improve work efficiency.

[0111] In this embodiment, optionally, after the training process of the federated learning basic model is ended according to the message, the method further includes:

[0112] Receive incentives determined by the blockchain system according to pre-defined rules.

[0113] Specifically, the blockchain system uses pre-defined rules and incentive calculation and allocation contracts to determine the contribution of each participant (data provider and technology provider) during model training, thereby providing incentives to each participant based on their contribution. Data providers and technology providers receive incentives determined by the blockchain system based on pre-defined rules.

[0114] In this embodiment, the above method can enhance the work enthusiasm of each participant, which is beneficial to the subsequent new model training process.

[0115] For example, Figure 3B is a schematic diagram of the functional modules and their interrelationships provided by the embodiment of the present disclosure, such as Figure 3B As shown, one of the methods is given.

[0116] from Figure 3BAs can be seen, the following functional modules are involved in the embodiments of the present disclosure: an access authentication module, a local training sample generation module, a smart contract module, a model training synchronization module, a summary aggregation node selection module, a proxy re-encryption module, and a security audit module. The access authentication module, the local training sample generation module, the smart contract module, the model training synchronization module, the summary aggregation node selection module, and the security audit module can all interact with the blockchain system for data. The summary aggregation node selection module interacts with the proxy re-encryption module for data. The functions and deployment locations of these modules have been described in the embodiments of the present disclosure and will not be repeated here.

[0117] Illustratively, the federated learning method in the present disclosure can be applied to multiple institutions or organizations to generate a network security threat detection system in a distributed collaborative manner. The application process of the federated learning method in the present disclosure is illustrated below with a specific example.

[0118] Based on the technical requirements for collaborative network security threat detection, the following describes how the federated learning method disclosed in this disclosure uses blockchain to ensure secure storage of distributed learning process data and implements trusted re-encryption of model parameter values ​​through proxy re-encryption during the generation of a distributed network security threat detection system, thereby improving the accuracy of security threat detection and addressing the problem of insufficient data samples. The specific process is as follows:

[0119] 1. Construction of blockchain system

[0120] All participating parties (including data parties, technical parties and security auditors) jointly establish a consortium chain network, and the network nodes belonging to each participating party need to complete the identity authentication process by accessing the identity authentication module. Only network nodes that pass the access identity authentication can join the consortium chain network.

[0121] 2. Local training sample set generation

[0122] Before model training, the data provider needs to call the data specification style and / or training sample set generation tool provided by the technology provider based on the type of local data, extract the features required to generate the local training sample set from the local data, and generate the local training sample set corresponding to the federated learning basic model based on the features. Local data can come from various network security devices deployed by the data provider, such as alarm event data from intrusion detection systems (IDS), intrusion prevention systems (IPS), or unified threat management (UTM), mixed with normal data.

[0123] Among them, the federated learning method can adopt horizontal federated learning.

[0124] 3. Determination and synchronization of the basic model of federated learning

[0125] For different data types, the network security technical party selects the corresponding machine learning algorithm model based on practical experience and after consultation, and trains the machine learning algorithm model with simulated data or local real data to generate a federated learning basic model. The federated learning basic model and the initialized model parameter values ​​are synchronized to each data party through the blockchain system.

[0126] 4. Selection of target aggregation nodes

[0127] Before each round of model training begins, the aggregation node selection module determines the target aggregation nodes, such as the first and second aggregation nodes, and broadcasts the election results to the entire network. Before each round of model training begins, the first aggregation node uses its own private key and the public key of the second aggregation node to generate a conversion key. This conversion key is encrypted with the public key of each technical party and sent to each technical party via an encrypted channel. The technical party then announces the start of this round of model training through the blockchain system's model training synchronization module.

[0128] 5. Iterative training of model parameters

[0129] The specific training process of iterative training of model parameters is as follows:

[0130] (1) The data party trains the federated learning basic model based on the local training sample set. After completing this round of model training, the model parameter values ​​of this round of training process are encrypted through the public key of the first aggregation node and stored in the blockchain system after consensus verification by the blockchain system.

[0131] (2) The technical party determines the number of encrypted model parameter values ​​that have been stored (also called on-chain) through the model training synchronization module. When the number exceeds a certain threshold (for example, more than 2 / 3 of the total number of data parties), the model training synchronization module broadcasts the message that the current round of model training has ended. Data parties that have not completed the storage of model parameter values ​​within this time period will stop model training or stop storing the model parameter values ​​obtained from this round of training.

[0132] (3) The first aggregation node extracts the encrypted model parameter values ​​published by each data party stored in the blockchain system through the model parameter acquisition contract, decrypts them using their private keys, obtains the final model parameter value of this round after aggregation calculation, signs it with its private key, and stores it in the blockchain system through the blockchain network consensus mechanism.

[0133] If the first aggregation node fails (for example, the first aggregation node loses the heartbeat connection with all technical parties), the second aggregation node will perform aggregation and obtain the final model parameter value of this round, sign it with its private key, and store it in the blockchain system after verification by the blockchain network consensus.

[0134] If the second aggregation node also fails, the technical party will publish a message that the model parameter aggregation of this round has failed through the model training synchronization module, and notify the aggregation node selection module to re-determine a new target aggregation node. Each data party will use the model parameter values ​​at the beginning of the previous round to re-train the model.

[0135] (4) Each data party obtains the encrypted model parameter value of this round through the model parameter value update contract, decrypts it using the public key of the first or second aggregation node, and updates the parameter value of the federated learning basic model.

[0136] (5) The above training process is repeated until the final model parameter value meets the preset accuracy or the number of training rounds reaches the preset threshold, and the model parameter iterative training process is terminated.

[0137] 6. Model generation contribution statistics and incentive distribution

[0138] The blockchain system uses incentive calculation and distribution contracts based on pre-defined rules to count the contributions of each participant in model training. For example, contributions are counted based on whether the participant actively participates in model training, and certain economic incentives are given, such as cash rewards.

[0139] The training process described above is repeated for each security threat detection model. After each model is trained, the final model derived from federated learning can be applied in production environments for cybersecurity threat detection. It can also be integrated into the existing cybersecurity threat monitoring and analysis systems of the participating parties. By training multiple models, a comprehensive distributed cybersecurity threat detection system is formed, capable of distributed detection of a wide range of cybersecurity threats.

[0140] In this embodiment, first, in response to the message issued by the technical party to start this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​of this round of training process, and then the final model parameter values ​​of this round of training process are obtained from the blockchain system. According to the final model parameter values, the parameter values ​​of the federated learning basic model are updated, and then the message to start the next round of model training is waited for, and the message to start the next round of model training is responded to, and a new round of training process is carried out. Finally, in response to the message issued by the technical party to end the training process of the federated learning basic model, the training process of the federated learning basic model is ended according to the message. Through the above method, the training process of the federated learning basic model can be ended in time to avoid waste of resources, effectively reduce the risks of malicious data tampering and privacy leakage faced in traditional federated learning, enable non-trust-based collaboration between different participants, improve the accuracy of the federated learning basic model, and effectively alleviate the problem of insufficient training samples in certain scenarios.

[0141] Figure 4 This is a schematic diagram of the structure of a federated learning device provided in an embodiment of the present disclosure; the device is configured in an electronic device and can implement the federated learning method described in any embodiment of the present application. The device specifically includes the following:

[0142] A training module 410 is configured to respond to a message issued by the technical party regarding the start of this round of model training and train the federated learning basic model based on the local training sample set to obtain model parameter values ​​for this round of training.

[0143] An acquisition module 420 is configured to obtain the final model parameter value of the current round of training from the blockchain system, wherein the final model parameter value is obtained by the blockchain system obtaining all model parameter values ​​through a target aggregation node and performing aggregating calculation on all model parameter values;

[0144] The updating module 430 is configured to update the parameter values ​​of the federated learning basic model according to the final model parameter values.

[0145] In this embodiment, optionally, the apparatus further includes:

[0146] A node determination module is configured to respond to a message issued by the technical party to start this round of model training, train the federated learning basic model based on the local training sample set, and obtain a target summary aggregation node from the blockchain system before obtaining the model parameter value of this round of training process, wherein the target summary aggregation node is determined by the blockchain system according to a preset random method, and the number of the target summary aggregation nodes is greater than a preset number.

[0147] In this embodiment, optionally, the target aggregation node includes a first aggregation node; and the apparatus further includes:

[0148] a storage module, configured to, before obtaining the final model parameter value of the current round of training process from the blockchain system, encrypt the model parameter value according to the public key of the first aggregation node to obtain a first model parameter value, and store the first model parameter value in the blockchain system;

[0149] Correspondingly, the final model parameter value is obtained by the blockchain system when the first summary aggregation node is online, obtaining all first model parameter values ​​through the first summary aggregation node, decrypting all first model parameter values ​​through the private key of the first summary aggregation node, and summarizing and calculating all model parameter values ​​obtained after decryption.

[0150] In this embodiment, optionally, the target aggregation node further includes a second aggregation node;

[0151] Correspondingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value through proxy re-encryption, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and summarize and calculate all the model parameter values ​​obtained after decryption, wherein the second model parameter value is obtained by encrypting the model parameter value according to the public key of the second summary aggregation node.

[0152] In this embodiment, optionally, the apparatus further includes:

[0153] a response module, configured to update the parameter values ​​of the federated learning basic model according to the final model parameter values, wait for a message to start the next round of model training, and respond to the message to start the next round of model training to perform a new round of training;

[0154] An ending module is used to respond to the message issued by the technical party indicating that the training process of the federated learning basic model has ended, and to end the training process of the federated learning basic model according to the message.

[0155] In this embodiment, optionally, the message is released after the technical party determines that the new final model parameter value meets a preset accuracy or the number of training rounds reaches a preset threshold.

[0156] In this embodiment, optionally, the local training sample set is obtained by:

[0157] Based on the type of local data, calling the data specification style and / or training sample set generation tool provided by the technical party to extract the features required to generate the local training sample set from the local data;

[0158] Generate a local training sample set corresponding to the federated learning basic model according to the features.

[0159] The federated learning device provided by the embodiment of the present disclosure first responds to the message issued by the technical party to start this round of model training, trains the federated learning basic model based on the local training sample set, obtains the model parameter values ​​of this round of training process, then obtains the final model parameter values ​​of this round of training process from the blockchain system, and finally updates the parameter values ​​of the federated learning basic model based on the final model parameter values. The above method can reduce the risk of malicious tampering of data and privacy leakage, enable non-trust-based collaboration between different participants, and improve the accuracy of the federated learning basic model.

[0160] The federated learning device provided in the embodiments of the present disclosure can execute the federated learning method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0161] Figure 5 Schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5 As shown, the electronic device includes a processor 510 and a storage device 520; the number of processors 510 in the electronic device can be one or more. Figure 5 In the figure, a processor 510 is taken as an example; the processor 510 and the storage device 520 in the electronic device can be connected via a bus or other means. Figure 5 The bus connection is taken as an example.

[0162] Storage device 520, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the federated learning method in the embodiments of the present disclosure. Processor 510 executes the software programs, instructions, and modules stored in storage device 520 to execute various functional applications and data processing of the electronic device, thereby implementing the federated learning method provided in the embodiments of the present disclosure.

[0163] The storage device 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created based on the use of the terminal, etc. In addition, the storage device 520 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 520 may further include a memory remotely located relative to the processor 510, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0164] An electronic device provided in this embodiment can be used to execute the federated learning method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0165] The embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to implement the federated learning method provided by the embodiments of the present disclosure.

[0166] Of course, the computer-executable instructions of a storage medium provided by an embodiment of the present disclosure are not limited to the operations of the method described above, but can also execute related operations in the federated learning method provided by any embodiment of the present disclosure.

[0167] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present disclosure can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer's floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0168] It is worth noting that in the above-mentioned embodiment of the federated learning device, the various units and modules included are divided only according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other and are not used to limit the scope of protection of this disclosure.

[0169] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0170] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. A federated learning method, characterized in that: The method comprises: In response to the technical party's announcement of the start of this round of model training, the federated learning basic model is trained based on the local training sample set to obtain the model parameter values ​​for this round of training; Obtain the final model parameter value of this round of training process from the blockchain system, wherein the final model parameter value is obtained by the blockchain system obtaining all model parameter values ​​through the target aggregation node and aggregating and calculating all model parameter values; The method further includes: updating the parameter values ​​of the federated learning basic model according to the final model parameter values; and training the federated learning basic model based on the local training sample set in response to the message issued by the technical party to start the current round of model training, and obtaining the model parameter values ​​of the current round of training. Obtaining a target aggregation node from the blockchain system, wherein the target aggregation node is determined by the blockchain system according to a preset random method, and the number of the target aggregation nodes is greater than a preset number; the target aggregation node includes a first aggregation node; Before obtaining the final model parameter value of this round of training process from the blockchain system, the following steps are also included: Encrypting the model parameter value according to the public key of the first aggregation node to obtain a first model parameter value, and storing the first model parameter value in the blockchain system; Accordingly, the final model parameter value is obtained by the blockchain system when the first aggregation node is online, by obtaining all first model parameter values ​​through the first aggregation node, decrypting all first model parameter values ​​using the private key of the first aggregation node, and aggregating and calculating all the decrypted model parameter values; the target aggregation node also includes a second aggregation node; Correspondingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value after encrypting the model parameter value according to the public key of the second summary aggregation node through a proxy re-encryption method, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and obtain it by summarizing and calculating all the model parameter values ​​obtained after decryption.

2. The method according to claim 1, characterized in that After updating the parameter values ​​of the federated learning basic model according to the final model parameter values, the method further includes: Waiting for a message to start the next round of model training, and responding to the message to start the next round of model training to perform a new round of training process; Respond to the message issued by the technical party indicating that the training process of the federated learning basic model is completed, and end the training process of the federated learning basic model according to the message.

3. The method according to claim 2, characterized in that The message is published after the technical party determines that the new final model parameter value meets the preset accuracy or the number of training rounds reaches a preset threshold.

4. The method according to any one of claims 1 to 3, characterized in that The local training sample set is obtained in the following way: Based on the type of local data, calling the data specification style and / or training sample set generation tool provided by the technical party to extract the features required to generate the local training sample set from the local data; Generate a local training sample set corresponding to the federated learning basic model according to the features.

5. A federated learning device, characterized in that: The device comprises: The training module is used to respond to the message issued by the technical party to start the current round of model training, train the federated learning basic model based on the local training sample set, and obtain the model parameter values ​​of the current round of training process; An acquisition module is used to obtain the final model parameter value of the current round of training process from the blockchain system, wherein the final model parameter value is obtained by the blockchain system obtaining all model parameter values ​​through the target aggregation node and summarizing and calculating all model parameter values; an updating module, configured to update the parameter values ​​of the federated learning basic model according to the final model parameter values; and The method of responding to the message issued by the technical party to start the current round of model training, training the federated learning basic model based on the local training sample set, and obtaining the model parameter values ​​of the current round of training process also includes: Obtaining a target aggregation node from the blockchain system, wherein the target aggregation node is determined by the blockchain system according to a preset random method, and the number of the target aggregation nodes is greater than a preset number; the target aggregation node includes a first aggregation node; Before obtaining the final model parameter value of this round of training process from the blockchain system, the following steps are also included: Encrypting the model parameter value according to the public key of the first aggregation node to obtain a first model parameter value, and storing the first model parameter value in the blockchain system; Accordingly, the final model parameter value is obtained by the blockchain system when the first aggregation node is online, by obtaining all first model parameter values ​​through the first aggregation node, decrypting all first model parameter values ​​using the private key of the first aggregation node, and aggregating and calculating all the decrypted model parameter values; the target aggregation node also includes a second aggregation node; Correspondingly, the final model parameter value is obtained by the blockchain system initiating a data conversion request to the technical party through the second summary aggregation node when the first summary aggregation node is not online, so that the technical party can convert the first model parameter value into a second model parameter value after encrypting the model parameter value according to the public key of the second summary aggregation node through a proxy re-encryption method, and send the second model parameter value to the second summary aggregation node, decrypt all the second model parameter values ​​through the private key of the second summary aggregation node, and obtain it by summarizing and calculating all the model parameter values ​​obtained after decryption.

6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Federated learning system and method based on block chain

    CN111212110A

  • Federal learning data participant contribution value calculation and excitation method based on block chain

    CN112784994A

  • Longitudinal federated learning linear regression and logistic regression model training method and device

    CN113505894A