A method, apparatus, medium and device for constructing a federated learning framework

By using private key signatures and blockchain verification in the federated learning framework, the problem of local models being unable to guarantee correctness before aggregation is solved, and the authenticity and security of model training results are achieved.

CN114897190BActive Publication Date: 2025-10-17AGRICULTURAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210548254.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-18
Publication Date
2025-10-17
Estimated Expiration
2042-05-18

AI Technical Summary

Technical Problem

The existing federated learning framework cannot guarantee the correctness of local models before model aggregation, making it difficult to meet the security requirements of practical applications.

Method used

The authenticity and integrity of the model training results are ensured by signing the local model and local gradients with a private key and verifying and recording them by the committee nodes in the blockchain.

Benefits of technology

Improves the security of the federated learning framework, ensures the authenticity and integrity of model training results, and prevents malicious attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114897190B_ABST
    Figure CN114897190B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method, device, medium and equipment for constructing a federated learning framework. The method comprises: collecting, by a committee node, a local model and a local gradient trained by a training execution node; wherein the local model and the local gradient are signed by the training execution node using a private key; verifying, by any node in a blockchain, the signature of the local model and synchronously recording the verification result in all blockchain nodes; verifying, by the committee node, the validity of the local model; and aggregating, by the committee node, the verified local model to generate an aggregated model, and distributing the aggregated model to the training execution node for iterative training until the iteration is completed. The technical solution ensures the authenticity of the model training result by signing the local model and the local gradient using a private key, thereby improving the security of the federated learning framework.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, apparatus, medium, and equipment for constructing a federated learning framework. Background Art

[0002] With the rapid development of artificial intelligence (AI), advanced machine learning techniques such as federated learning are widely used in fields such as image recognition, speech recognition, smart cities, and disease diagnosis. Therefore, designing a secure federated learning framework to ensure the correctness of the training process is an urgent problem that needs to be solved.

[0003] Current federated learning frameworks primarily use a shared key to sign local models. A central server, such as a cloud server, is responsible for distributing, aggregating, and updating the final model used for data analysis tasks. Each participant receives an initial model distributed by the cloud and trains it using local data. Each participant uses a hash algorithm to obtain a digital digest of the updated local gradients (i.e., model parameters). This digital digest is encrypted using the shared key to create a digital signature. The digital signature is then encapsulated with the original electronic document and the public key of the signing certificate to form a signed local gradient, which is then transmitted back to the cloud. The cloud then decrypts the digital signature using the public key of the data from each participant to obtain a digital digest. The original document is then hashed using the same algorithm to obtain a new digital digest. The two digital digests are compared. If they match, the digitally signed electronic document has been successfully transmitted. The model is then aggregated to form a new model and distributed. This process repeats.

[0004] However, existing solutions require each participant to sign the gradients using a shared key before model aggregation, which cannot guarantee the correctness of the local model. Therefore, current federated learning frameworks are difficult to meet the security requirements of practical applications. Summary of the Invention

[0005] The embodiments of the present application provide a method, apparatus, medium, and equipment for constructing a federated learning framework, which can ensure the authenticity of the model training results by signing the local model and local gradient using a private key, thereby improving the security of the federated learning framework.

[0006] In a first aspect, an embodiment of the present application provides a method for constructing a federated learning framework, the method comprising:

[0007] The committee node collects the local model and local gradient trained by the training execution node; wherein the local model and local gradient are signed by the training execution node using a private key;

[0008] Any node in the blockchain verifies the signature of the local model and synchronously records the verification result in all blockchain nodes;

[0009] verify the validity of the local model by the committee node;

[0010] The committee node aggregates the verified local model to generate an aggregated model, and distributes the aggregated model to the training execution node for iterative training until the iteration is completed.

[0011] In a second aspect, the embodiments of the present application provide a construction device of a federated learning framework, which comprises:

[0012] A local parameter collection module is configured to collect a local model and a local gradient trained by the training execution node through the committee node, wherein the local model and the local gradient are signed by the training execution node through a private key.

[0013] A signature verification module is configured to verify the signature of the local model by any node in the blockchain and record the verification result in all blockchain nodes.

[0014] A local model verification module is configured to verify the validity of the local model by the committee node.

[0015] A model aggregation and distribution module is configured to aggregate the verified local model by the committee node to generate an aggregated model, and distribute the aggregated model to the training execution node for iterative training until the iteration is completed.

[0016] In a third aspect, the embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the construction method of the federated learning framework as described in the embodiments of the present application.

[0017] In a fourth aspect, the embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the construction method of the federated learning framework as described in the embodiments of the present application when executing the computer program.

[0018] The technical solutions provided by the embodiments of the present application ensure the authenticity of the model training result by signing the local model and the local gradient using a private key, thereby improving the security of the federated learning framework. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 is a flowchart of the construction method of the federated learning framework provided by the first embodiment of the present application;

[0020] Figure 2 is a flowchart of the construction method of the federated learning framework in the second embodiment of the present application;

[0021] Figure 3 A structural diagram of a construction device of a federal learning framework provided for Embodiment Three of the present application;

[0022] Figure 4 is a structural schematic diagram of an electronic device provided in Embodiment Five of the present application. DETAILED DESCRIPTION

[0023] The present application will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, but not all the structures.

[0024] Before the example embodiments are discussed in more detail, it should be mentioned that some example embodiments are described as processes or methods depicted as flow diagrams. Although the flow diagrams depict the steps in sequential order, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps can be re-arranged. The processes can be terminated when their operations are completed, but can also have additional steps not included in the figure. The processes can correspond to methods, functions, routines, subroutines, subprograms, etc.

[0025] Embodiment One

[0026] Figure 1 is a flowchart of a construction method of a federal learning framework provided in Embodiment One of the present application. The present embodiment can be applicable to a scenario of model training using a federal learning framework. The method can be executed by a construction device of a federal learning framework provided in the present embodiment. The device can be realized by software and / or hardware, and can be integrated in an electronic device.

[0027] As shown in Figure 1 , the construction method of the federal learning framework comprises:

[0028] S110, collecting, by the committee node, a local model and a local gradient trained by a training execution node; wherein the local model and the local gradient are signed by the training execution node through a private key.

[0029] The method is executed by a blockchain system, and the blockchain system comprises a committee node and a common node.

[0030] The execution subject of the scheme is a blockchain system, which can be a whole system composed of all blockchain nodes. The system includes committee nodes and ordinary nodes. The blockchain can be a distributed ledger that stores all transactions and states in the entire network. The committee nodes can be elected by ordinary nodes according to trust values. The committee nodes can be used for global model aggregation and verification nodes. The election rules can include performance of each node, such as the need for comprehensive work by committee nodes, which requires higher performance. Therefore, the election can be based on the performance level. The ordinary nodes can be lower-performance blockchain nodes.

[0031] The local model can be a training model distributed to the training execution node in federated learning. Each training execution node independently trains the local model with its own private data. The training execution node can be a node that has local data and can perform individual training. The local gradient can be the training result of the training execution node using local data through the local model. Therefore, federated learning can be considered a distributed machine learning framework that does not collect training data for the model centrally, but distributes the training model to multiple data owners for individual training, while generating a final model through intermediate gradient aggregation in an iterative manner.

[0032] The signature can be an asymmetric encryption technology that ensures data cannot be tampered with in the entire system through private key signature by each training execution node, and ensures that the identity of the transaction parties is real and reliable.

[0033] In this embodiment, optionally, before the committee nodes collect the local models and local gradients trained by the training execution nodes, the method further includes: if an election trigger event of the committee nodes is detected, obtaining node trust values of each node in the blockchain; and replacing the committee members according to the comparison result of the node trust values.

[0034] The committee will replace the central server to collaboratively aggregate and verify the model. In the committee establishment stage, the initial committee nodes are composed of the first batch of workers in the blockchain system who successfully generate blocks in different rounds. The initial committee nodes collect and verify the local gradients, aggregate the local models that pass the verification to generate an aggregated model, and then distribute the aggregated model to the training execution nodes. The training execution nodes verify the deviation degree of the aggregated model and the local model in identifying the local data. The election trigger event can be triggered by the blockchain worker when he considers that the trust value of a certain committee is too low, and actively initiates a vote to elect himself as a committee member and broadcast.

[0035] The trust value can be determined according to the degree of deviation of the identification results of the test data by the aggregation model and the local model. For example, the local model has a recognition rate of 90% after training the test data, and the aggregation model only has a recognition rate of 50%. The committee node trust value is reduced, and when the trust value of a committee node is too low, it will be kicked out of the committee, and a new committee node with a higher trust value will be selected by all blockchain nodes to replace it. Among them, the local recognition rate can be the prediction ability of the local model for the test data, and the aggregation model recognition rate can be the prediction ability of the aggregation model for the test data.

[0036] In this embodiment, the reliability of the committee node is measured by the trust value, a trust committee that is constantly replaced is established, and the trustworthiness of the committee can be improved to improve the security of the system.

[0037] In this embodiment, optionally, before collecting the local model and local gradient trained by the training execution node through the committee node, the method further comprises: constructing a system architecture of the federated learning framework based on the blockchain system.

[0038] Among them, the system architecture can be an abstract description of the overall structure and components of the blockchain system. For example, in this embodiment, the system architecture mainly consists of participants, workers, a committee based on a blockchain, and users. The participants can be defined as the same entity in the traditional federated learning model. Participants contribute their local training data and collaborate to train a global machine learning model. The worker can be similar to the miner in the ordinary blockchain system, and the worker processes transactions, including updating the relevant signature of the model for verification and auditing. The committee can be composed of a group of trustees, and the trustee is essentially a worker in the blockchain. In fact, the same node in the blockchain can simultaneously assume the roles of a trustee and a worker on a physical machine. In addition to performing mining tasks, the trustees in the committee also perform global model aggregation and verification based on the gradients collected from the participants. The user can be a customer of the framework, who can publish various learning tasks and request well-trained models for practical applications.

[0039] In this embodiment, by improving the system architecture of the blockchain, the roles of each node in the blockchain network and the mutual conversion of the node roles are described in detail, which can be more suitable for the federated learning framework.

[0040] In this embodiment, optionally, after constructing the system architecture of the federated learning framework based on the blockchain system, the method further comprises: distributing, by the committee node, a training model to each ordinary node based on the system architecture of the federated learning framework, so that the training execution node with data trains the local model to obtain a local model and a local gradient.

[0041] The committee node can distribute the training model to each normal node through network communication.

[0042] In the embodiment, the committee replaces the central server to perform model aggregation and verification, further improving the credibility of the system.

[0043] In S120, any node in the blockchain verifies the signature of the local model and synchronously records the verification result in all blockchain nodes.

[0044] Any node can be any one of all normal nodes and committee nodes in the blockchain. Verifying the signature of the local model can be to determine whether the local model is maliciously changed according to the signature of the local model. The verification result can be that the local model is normal or tampered by a malicious attacker.

[0045] In the embodiment, by verifying the signature of the local model, the integrity and authenticity of the local model in the entire training process can be ensured, and malicious attacks can be avoided.

[0046] In S130, the committee node verifies the validity of the local model.

[0047] Verifying the validity of the local model can be to verify whether the collected training result data is correct through the committee node. The committee node can use the average value of the training result data to verify whether the collected training result data is correct. If the deviation between a certain collected training result data and the average value is greater than a preset value, the data is considered incorrect. For example, the parameters sent by three training execution nodes are 1, 2, and 3, respectively, and the average value 2 is taken to aggregate the parameters. If one node sends -1, it can be discarded because it looks obviously incorrect.

[0048] In the embodiment, by verifying the validity of the local model, the correctness of the data used by the committee when performing model aggregation can be ensured.

[0049] In S140, the committee node aggregates the verified local model to generate an aggregated model, and distributes the aggregated model to the training execution nodes for iterative training until the iteration is completed.

[0050] The aggregation model can be a model that aggregates local models together to improve their classification performance. Iteration can be an activity that repeats a feedback process, usually to approximate a desired target or result. Each repetition of the process is called an "iteration", and the result of each iteration is used as the initial value for the next iteration. In this embodiment, iterative training can be a process in which committee nodes repeatedly collect and aggregate local gradients to generate an aggregation model, which is then distributed to training execution nodes. The training execution nodes verify the deviation of the aggregation model from the identification results of the local data by the local models until the identification rate of the aggregation model meets the requirements.

[0051] In this embodiment, the committee nodes aggregate the validated local models to generate an aggregation model, including: counting the number of local models and local gradients validated by each committee node; and if the number of each committee node exceeds a threshold θ, the local models are aggregated to generate the aggregation model.

[0052] In this embodiment, a threshold θ is predefined to determine the minimum number of valid participant signatures required to generate an aggregation model update. Model aggregation is triggered only when each committee node validates at least θ participant signatures. This solves the liquidity problem of training execution nodes, and an attacker who attempts to forge a valid aggregation model update needs to control the keys of θ training execution nodes, further ensuring the validity of the aggregation model.

[0053] In this embodiment, the aggregation model is distributed to the training execution nodes for iterative training until the iteration is complete, including: if the results of the aggregation model validated by the local data of the training execution nodes meet the identification rate requirements, the iteration is determined to be complete.

[0054] The local data can be training data contributed by participants in their local area. The identification rate can be the prediction ability of the local data.

[0055] In this embodiment, the identification rate of the results of the aggregation model validated by the local data is used to determine the completion of the iteration, which can ensure that the aggregation model meets the identification rate requirements.

[0056] The technical solutions provided by the embodiments of the present application improve the security of the federated learning framework by signing the local models and local gradients using private keys to ensure the correctness of the training process.

[0057] Embodiment two

[0058] Figure 2For the flowchart of the construction method of the federated learning framework in Embodiment Two of the present application, the present embodiment is optimized based on the above-mentioned embodiment. The specific optimization is that when synchronously recording the local model signature verification result in all blockchain nodes, the method further comprises: reconstructing the data in the blockchain system to obtain a data bidirectional jump chain of the blockchain system, wherein the data bidirectional jump chain is a chain structure comprising ordinary blocks and anchor blocks; and the anchor block comprises a hash value of a previous block in the chain structure and a signature of a future block.

[0059] As shown in Figure 2 , the method of the present embodiment specifically comprises the following steps:

[0060] S210, collecting the local model and local gradient trained by the training execution node through the committee node; wherein the local model and local gradient are signed by the training execution node through a private key.

[0061] S220, verifying the signature of the local model by any node in the blockchain.

[0062] S230, reconstructing the data structure in the blockchain system to obtain a data bidirectional jump chain of the blockchain system, and synchronously recording the verification result in all blockchain nodes. Wherein the data bidirectional jump chain is a chain structure comprising ordinary blocks and anchor blocks; and the anchor block comprises a hash value of a previous block in the chain structure and a hash value of a future block provided by a chameleon hash function.

[0063] Wherein the data structure can be a storage mode of data. For example, in the present embodiment, the data structure in the blockchain system without any modification to the blockchain system can be an ordered, reverse-linked, one-way transaction block chain table constructed based on a hash pointer. The bidirectional jump chain can be a new type of blockchain structure comprising a chain structure of ordinary blocks and anchor blocks. The anchor block comprises a hash value of a previous block in the chain structure and a hash value of a future block provided by a chameleon hash function. The hash value provided by the chameleon hash function constructs a backward link for the future block, i.e. when the subsequent block has not been generated, the hash of the subsequent block is calculated and stored in the form of chameleon hash. Wherein the hash function can be a function that converts an input string of arbitrary length into a fixed-length string, and the original string can be easily calculated from the converted string, and the original string can be difficult to restore from the converted string. The chameleon hash function can be a "backdoor" or "private key" set by a person, so that a person with a private key can perform hash calculation on other information to obtain the same string.

[0064] In the fact instance, the data structure of the blockchain is reconstructed into a bidirectional skip chain, a backward link is added, and the complexity of finding a gradient or a global model is reduced, so that an auditor can quickly find a gradient or a global model that needs to be audited.

[0065] S240, verifying validity of the local model by the committee node;

[0066] S250, the committee node aggregates the verified local model to generate an aggregated model, and distributes the aggregated model to the training execution node for iterative training until the iteration is completed.

[0067] In the scheme, the data structure of the blockchain is reconstructed into a bidirectional skip chain, a backward link is added, and the complexity of finding a gradient or a global model is reduced, so that an auditor can quickly find a gradient or a global model that needs to be audited.

[0068] Embodiment three

[0069] Figure 3 A structure block diagram of a construction device of a federated learning framework is provided for the third embodiment of the present application. The device can execute the construction method of the federated learning framework provided by any embodiment of the present application, and has function modules and beneficial effects corresponding to the execution method. The device is configured in a blockchain system, and the blockchain system includes committee nodes and ordinary nodes. As shown in the figure, the device can include: Figure 3

[0070] The local parameter collection module 310 is configured to collect local models and local gradients trained by the training execution node through the committee node. The local models and local gradients are signed by the training execution node through a private key.

[0071] The signature verification module 320 is configured to verify the signature of the local model by any node in the blockchain and record the verification result in all blockchain nodes.

[0072] The local model verification module 330 is configured to verify the validity of the local model by the committee node.

[0073] The model aggregation and distribution module 340 is configured to aggregate the verified local model by the committee node to generate an aggregated model, and distribute the aggregated model to the training execution node for iterative training until the iteration is completed.

[0074] On the basis of the above technical solutions, the model aggregation and distribution module can include:

[0075] The number counting unit is configured to count the number of local models and local gradients verified by each committee node. ​

[0076] a model aggregation unit configured to, if the statistical quantity of each committee node exceeds a threshold θ, perform gradient aggregation on the local model to generate the aggregated model.

[0077] On the basis of each of the technical solutions described above, the device further includes:

[0078] a committee replacement module configured to, if an election trigger event of a committee node is detected, acquire node trust values of each node in the blockchain, and perform replacement of committee members according to a comparison result of the node trust values.

[0079] On the basis of each of the technical solutions described above, the device further includes:

[0080] a data reconstruction module configured to reconstruct a data structure in the blockchain system to obtain a data bidirectional jump chain of the blockchain system, wherein the data bidirectional jump chain is a chain structure including normal blocks and anchor blocks, and the anchor block includes a hash value of a previous block in the chain structure and a hash value of a future block provided by a chameleon hash function.

[0081] On the basis of each of the technical solutions described above, the device further includes:

[0082] a system architecture construction module configured to construct a system architecture of the federated learning framework based on the blockchain system.

[0083] On the basis of each of the technical solutions described above, the model aggregation and distribution module further includes:

[0084] a model distribution unit configured to, based on the system architecture of the federated learning framework, distribute, by a committee node, a training model to each normal node, so that a training execution node having data trains a local part of the model to obtain a local model and a local gradient.

[0085] On the basis of each of the technical solutions described above, the model aggregation and distribution module further includes:

[0086] an iteration completion determination unit configured to, if a result of verifying, by the training execution node, the aggregated model with local data reaches a recognition rate requirement, determine that iteration is completed.

[0087] The product can perform the construction method of the federated learning framework provided in the embodiments of the present application, and has the corresponding functional modules and beneficial effects of the execution method.

[0088] Embodiment Four

[0089] The embodiment four of the present application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement a construction method of a federated learning framework provided by all the embodiments of the present application.

[0090] The local model and the local gradient trained by the training execution node are collected by the committee node, and the local model and the local gradient are signed by the training execution node through a private key;

[0091] The signature of the local model is verified by any node in the blockchain, and the verification result is synchronously recorded in all blockchain nodes;

[0092] The validity of the local model is verified by the committee node;

[0093] The committee node aggregates the verified local model to generate an aggregated model, and distributes the aggregated model to the training execution node for iterative training until the iteration is completed.

[0094] Any combination of one or more computer readable medium can be employed. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0095] The computer readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, in which a computer readable program code is carried. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.

[0096] The program code embodied on the computer readable media can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, and the like, or any suitable combination of the foregoing.

[0097] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0098] Embodiment Five

[0099] An electronic device is provided in the embodiment five of the present application. Figure 4 is a structural schematic diagram of an electronic device provided in the embodiment five of the present application. As shown in the figure, Figure 4 The embodiment provides an electronic device 400, which includes one or more processors 420 and a storage device 410 configured to store one or more programs. When the one or more programs are executed by the one or more processors 420, the one or more processors 420 implement a method for constructing a federated learning framework, which includes the following steps.

[0100] The committee node collects the local model and the local gradient trained by the training execution node; wherein the local model and the local gradient are signed by the training execution node through a private key;

[0101] Any node in the blockchain verifies the signature of the local model and synchronously records the verification result in all blockchain nodes;

[0102] The committee node verifies the validity of the local model;

[0103] The committee node aggregates the verified local model to generate an aggregated model, and distributes the aggregated model to the training execution node for iterative training until the iteration is completed.

[0104] Of course, those skilled in the art can understand that the processor 420 also implements the technical solutions of the construction method of the federated learning framework provided by any embodiment of the present application.

[0105] Figure 4 The electronic device 400 shown is merely an example and should not impose any limitations on the functions and use range of the embodiments of the present application.

[0106] As Figure 4 shown, the electronic device 400 includes a processor 420, a storage device 410, an input device 430, and an output device 440; the number of processors 420 in the electronic device can be one or more, Figure 4 one processor 420 is taken as an example; the processor 420, the storage device 410, the input device 430, and the output device 440 in the electronic device can be connected through a bus or other means, Figure 4 for example, connected through the bus 450.

[0107] The storage device 410, as a kind of computer readable storage medium, can be used to store software programs, computer executable programs, and module units, such as the program instructions corresponding to the construction method of the federated learning framework in the embodiments of the present application.

[0108] The storage device 410 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function; the data storage area can store data created according to the use of the terminal, etc. In addition, the storage device 410 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some examples, the storage device 410 can further include a memory disposed remotely with respect to the processor 420, and these remote memories can be connected through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0109] The input device 430 can be used to receive input digital, character information or voice information, and generate key signal input related to user settings and function control of the electronic device. The output device 440 can include a display screen, a speaker, and other electronic devices.

[0110] The electronic device provided by the embodiments of the present application can deploy agent nodes, so that the nodes can communicate in time and effectively, ensure the immediacy and accuracy of data information interaction, and also ensure the security of the blockchain nodes.

[0111] The construction apparatus, medium and electronic device of the federated learning framework provided in the above embodiments can execute the construction method of the federated learning framework provided in any of the embodiments of the present application, and have corresponding function modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be referred to the construction method of the federated learning framework provided in any of the embodiments of the present application.

[0112] Note that the above only describes the preferred embodiments of the present application and the principles of the technology applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims

1. A method for constructing a federated learning framework, characterized in that: The method is performed by a blockchain system, wherein the blockchain system includes committee nodes and ordinary nodes; the method includes: The committee node collects the local model and local gradient trained by the training execution node; wherein the local model and local gradient are signed by the training execution node using a private key; Any node in the blockchain verifies the signature of the local model and synchronously records the verification result in all blockchain nodes; Verifying the validity of the local model through the committee node; The committee node aggregates the verified local models to generate an aggregate model, and distributes the aggregate model to the training execution node for iterative training until the iteration is completed; The committee nodes are nodes elected by ordinary nodes based on their trust values ​​and are used for global model aggregation and verification. The method further comprises: Reconstructing the data structure in the blockchain system to obtain a bidirectional data jump chain of the blockchain system, wherein the bidirectional data jump chain is a chain structure including ordinary blocks and anchor blocks; the anchor block includes a hash value of a previous block in the chain structure and a hash value of a future block provided by a chameleon hash function; Before collecting the local models and local gradients trained by the training execution nodes through the committee nodes, the method further includes: If a committee node election trigger event is detected, the node trust value of each node in the blockchain is obtained; wherein the trust value is determined based on the degree of deviation between the recognition results of the aggregate model and the local model on the test data; Committee members are replaced based on the comparison results of node trust values.

2. The method according to claim 1, characterized in that The committee node aggregates the verified local models to generate an aggregate model, including: Count the number of local models and local gradients that are verified to be effective by each committee node; If the statistical number of each committee node exceeds a threshold θ, gradient aggregation is performed on the local model to generate the aggregated model.

3. The method according to claim 1, characterized in that Before collecting the local models and local gradients trained by the training execution nodes through the committee nodes, the method further includes: Build a system architecture for a federated learning framework based on the blockchain system.

4. The method according to claim 3, characterized in that After constructing the system architecture of the blockchain-based federated learning framework, the method further includes: Based on the system architecture of the federated learning framework, the committee node distributes the training model to each ordinary node, so that the training execution node with data can train the local part of the model to obtain the local model and local gradient.

5. The method according to claim 1, wherein Distributing the aggregate model to the training execution node for iterative training until the iteration is completed, including: If the training execution node verifies with local data that the result of the aggregation model meets the recognition rate requirement, it is determined that the iteration is completed.

6. A device for constructing a federated learning framework, characterized in that: The device is configured in a blockchain system, wherein the blockchain system includes committee nodes and ordinary nodes; and includes: A local parameter collection module, configured to collect, through the committee node, the local model and local gradient trained by the training execution node; wherein the local model and local gradient are signed by the training execution node using a private key; A signature verification module, configured to verify the signature of the local model by any node in the blockchain and synchronously record the verification result in all blockchain nodes; A local model verification module, configured to verify the validity of the local model through the committee node; A model aggregation and distribution module is configured for the committee node to aggregate the verified local models to generate an aggregate model, and distribute the aggregate model to the training execution node for iterative training until the iteration is completed; The committee nodes are nodes elected by ordinary nodes based on their trust values ​​and are used for global model aggregation and verification. Wherein, the device further includes: a data reconstruction module, configured to reconstruct the data structure in the blockchain system to obtain a bidirectional data jump chain of the blockchain system, wherein the bidirectional data jump chain is a chain structure including ordinary blocks and anchor blocks; the anchor block includes a hash value of a previous block in the chain structure and a hash value of a future block provided by a chameleon hash function; Wherein, the device further includes: A committee replacement module, configured to obtain the node trust value of each node in the blockchain upon detecting a committee node election trigger event; wherein the trust value is determined based on the degree of deviation between the recognition results of the aggregate model and the local model on the test data; Committee members are replaced based on the comparison results of node trust values.

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 for constructing a federated learning framework as described in any one of claims 1 to 5 is implemented.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein: When the processor executes the computer program, the method for constructing a federated learning framework according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Cooperative training method and system based on drug research and development model, and storage medium

    CN113782111A