Novel asynchronous federal learning method based on DAG block chain
By adopting the asynchronous federated learning method of DAG blockchain and smart contracts in federated learning, the security and performance bottlenecks of the central server in traditional federated learning are solved, and efficient and secure federated learning is achieved.
Patent Information
- Application Number
- CN202411788749.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-04
AI Technical Summary
Traditional federated learning methods rely on central servers, which have security and performance bottlenecks, and the differences in computing power of participating nodes lead to low training efficiency.
The asynchronous federated learning method based on DAG blockchain is adopted, and the central server is replaced by DAG blockchain. Identity registration, grouping, local model update, global model aggregation and asynchronous model accuracy detection modules are deployed using smart contracts, and a learning framework of in-group synchronization and inter-group asynchronous model is grouped according to the computing power.
Decentralized and high-performance federated learning is realized, the security and performance bottlenecks of central servers are overcome, training efficiency is improved, and the model is quickly converged and privacy is secure.
Smart Images

Figure CN119766820A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an asynchronous federated learning (FL) method based on directed acyclic graph (DAG) blockchain technology in the Internet of Things. The basic idea is: first deploy the DAG blockchain and the FL task publishing module in the system, and then deploy the identity registration module, the grouping module, the local model update module, the global model aggregation module, and the asynchronous model accuracy detection module in the blockchain. All participating nodes of the federated learning need to call the identity registration module for registration. The task publisher calls the FL task publishing module to send the FL task to the grouping module, the grouping module groups the participating nodes, and then all participants in the group synchronously call the local update module to obtain the local model, and send the local model with added noise to the global model aggregation module. The global model aggregation module performs weighted aggregation on the local models with added noise of all participating nodes in the group to obtain the global model of each group, and then sends it to the asynchronous model accuracy detection module. The asynchronous model accuracy detection module will build the final FL task global model. If the model accuracy meets the FL task requirements, the FL task will be terminated. Otherwise, the asynchronous model accuracy detection module will call the grouping module and repeat the previous learning process until a global model that meets the requirements is found. The present invention uses blockchain to replace the central server, and adopts DAG structure to improve transaction throughput and reduce transaction delay, which not only solves the bottleneck problem of the central server, but also can better overcome the performance limitations of traditional blockchain. In addition, the present invention groups participating nodes according to their computing power, greatly overcomes the differences between different participating nodes, and can ensure the synchronization of nodes in the same group when performing global model aggregation. In addition, the FL learning framework with intra-group synchronization and inter-group asynchronous is adopted in the model aggregation process, so that the model has a faster convergence rate, effectively solving the problem of low training efficiency. It belongs to the field of computer artificial intelligence. Background Art
[0002] Federated learning is an emerging machine learning paradigm that allows participants to collaborate on training models without directly sharing raw data, providing an innovative path to solve the technical difficulties of large model application implementation. However, traditional federated learning methods face huge challenges in practical applications. First, the aggregation process of traditional federated learning relies heavily on the central server. If the central server is damaged, the entire learning process will not be able to continue, and attackers will have the opportunity to steal private information from model parameters through the central server. Even malicious central servers can send specially crafted malicious models to participating nodes to infer the data information of participating nodes. During the data aggregation process of federated learning, some malicious participating nodes may also upload false or low-quality local model updates to the central server, which will lead to a decrease in model training accuracy, or even fail to achieve the required model accuracy. Some scholars have tried to apply blockchain technology to solve the above problems brought by the central server, but traditional blockchain does not have an advantage in performance, and there are problems such as low transaction throughput and long transaction confirmation time.
[0003] Secondly, in the IoT environment, the state of FL's participating nodes is not stable and may be disconnected due to equipment failure or network interruption. In addition, there are large differences in the processor performance and storage capacity of the participating nodes. During the training process, some nodes require a long time to complete the learning task. For these "lagging" nodes, the central server needs to wait a long time to collect the model updates of these nodes, which greatly reduces the training efficiency. Therefore, it is urgent to explore more effective FL learning methods to solve the above problems. Summary of the invention
[0004] The technical problem to be solved by the present invention is to overcome the differences between different participating nodes and provide a decentralized, high-performance asynchronous federated learning method to solve the problems of low blockchain throughput, transaction delays and low efficiency of federated learning training.
[0005] The method sends the FL task of the task publisher to the grouping module of the asynchronous federated learning system based on the DAG blockchain. The grouping module first uses the K-means clustering algorithm to group the participants according to their computing power. Then all participants in the group synchronously call the local update module to obtain the local model, and send the local model with noise added to the global model aggregation module. The global model aggregation module performs weighted aggregation on the local models with noise added by all participants in the group to obtain the global model of each group, and then sends it to the asynchronous model accuracy detection module. The asynchronous model accuracy detection module will build the final FL task global model. If the model accuracy meets the FL task requirements, the FL task will be terminated. Otherwise, the asynchronous model accuracy detection module will call the grouping module and repeat the previous learning process until a global model that meets the requirements is found. When building the final FL task global model, the asynchronous model accuracy detection module does not need to wait for the global models of all groups to be collected. It only needs to select n global models with the highest accuracy from the global models of some groups that have been collected to build the final FL task global model. This FL learning framework with synchronization within the group and asynchrony between groups avoids the insufficiency of waiting for the "laggard" nodes. At the same time, grouping the participating nodes according to computing power also greatly overcomes the differences between different participating nodes, and can ensure the synchronization of the same group of nodes when performing global model aggregation. In addition, the identity registration module, grouping module, local update module, global model aggregation module, and asynchronous model accuracy detection module are all deployed in the DAG blockchain, and its internal core is the smart contract. This method not only replaces the central server, but also uses the DAG structure to eliminate the defects of insufficient throughput and transaction delays in traditional blockchains.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] The specific implementation of the present invention includes a functional module deployment stage; a federated learning task release stage; a grouping stage; a local model update stage; a global model aggregation stage; an asynchronous model accuracy detection stage; and Figure 1 First, deploy the DAG blockchain and FL task publishing module in the DAG-based asynchronous federated learning system, and then deploy the identity registration module, grouping module, local model update module, global model aggregation module, and asynchronous model accuracy detection module in the DAG blockchain, as shown in Figure 2As shown. The core of the identity registration module, grouping module, local update module, global model aggregation module, and asynchronous model accuracy detection module is the smart contract. All participating nodes of federated learning need to call the identity registration module for registration. The identity registration module uses the elliptic curve cryptography (ECC) mechanism to calculate the public key and private key of the client node to complete the registration. The task publisher calls the FL task publishing module to send the FL task to the grouping module. The task information contains the initialized global model of the FL task and the final global model accuracy ACC0. The grouping module uses the K-means clustering algorithm to group the participating nodes according to their computing power. After the grouping is completed, the participating nodes in the same group synchronously call the local model update module to use the local data set to train and initialize the global model. In order to protect the privacy of the updated parameters, the local model update module applies the Gaussian mechanism to add noise perturbation parameters to the local model, and finally obtains the local model with added noise. After all participating nodes of group Gn have completed the local model update, the local model update module sends the local models with added noise of all participating nodes of group Gn to the global model aggregation module. The global model aggregation module weights and aggregates them to obtain the global model ω of group Gn. Gn , then ω Gn The asynchronous model accuracy detection module selects n global models with the highest accuracy from the collected global model set and constructs the final FL task global model ω FL , ACC t Yes FL Model accuracy, if ACC t ≥ACC0, the asynchronous model accuracy detection module broadcasts an end signal to all participating nodes to terminate the FL task, ω FL is the final target model. Otherwise, the asynchronous model accuracy detection module will call the grouping module to regroup the participating nodes and repeat the previous learning process until a model that meets the requirements is found. FL .
[0008] Compared with the existing technology, the asynchronous federated learning method based on DAG blockchain proposed in this invention has the following advantages and technical effects:
[0009] The identity registration module, grouping module, local update module, global model aggregation module, and asynchronous model accuracy detection module of this method are all deployed in the DAG blockchain, and its internal core is the smart contract. This method not only replaces the central server, but also uses the DAG structure to eliminate the defects of insufficient throughput and transaction delays in traditional blockchains, and better overcomes the performance limitations of traditional blockchains.
[0010] The asynchronous model accuracy detection module of this method does not need to wait for the global models of all groups to be collected when constructing the final FL task global model. It only needs to select n global models with the highest accuracy from the global models of some groups that have been collected to construct the final FL task global model. On the contrary, all participants in the group synchronously call the local update module to obtain the local model, and send the local model with added noise to the global model aggregation module. This intra-group synchronous and inter-group asynchronous FL learning framework avoids the shortcomings of waiting for the "laggard" node, making the model have a faster convergence rate and improving the learning efficiency of FL. At the same time, grouping the participating nodes according to computing power also greatly overcomes the differences between different participating nodes, and can ensure the synchronization of the same group of nodes when performing global model aggregation. In addition, the method of adding noise perturbations to the local model also effectively protects the privacy of the model update parameters and improves the privacy security of the FL learning process. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 Key stages of the implementation process
[0012] Figure 2 Functional modules for specific implementation process DETAILED DESCRIPTION
[0013] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments:
[0014] The specific implementation process is as follows Figure 1 , with the following characteristics:
[0015] The entire DAG-based asynchronous federated learning system includes task publishers; participating nodes; DAG blockchain, FL task publishing module, identity registration module, grouping module, local model update module, global model aggregation module, asynchronous model accuracy detection module, global model, and local model.
[0016] The specific implementation of the present invention includes a functional module deployment stage; a federated learning task release stage; a grouping stage; a local model update stage; a global model aggregation stage; an asynchronous model accuracy detection stage;
[0017] Functional module deployment phase:
[0018] First, a DAG blockchain and a FL task publishing module are deployed in the DAG-based asynchronous federated learning system. Then, an identity registration module, a grouping module, a local model update module, a global model aggregation module, and an asynchronous model accuracy detection module are deployed in the DAG blockchain. The core of the five modules deployed in the DAG blockchain is the smart contract.
[0019] Federated learning task release phase:
[0020] The task publisher calls the FL task publishing module to send the FL task to the grouping module. The task content includes the initialized global model of the FL task and the final global model accuracy ACC0.
[0021] Grouping stage:
[0022] The grouping module groups participating nodes according to their computing capabilities. The grouping process uses the K-means algorithm.
[0023] In the present invention, CPU speed and RAM size are used as evaluation indicators of the computing power of participating nodes, and M participants are randomly selected as the initial center points C1, C2, ..., C m . Calculate the distance from each participant to the M center points, where the distance is the Euclidean distance in the multidimensional space based on the evaluation indicator. Each device is assigned to the nearest center point, forming M groups. Repeat the above process until the center point no longer changes, and get the final M groups.
[0024] In the grouping process, a threshold for the number of groups is set to deal with the problem that some participating nodes respond slowly and affect FL efficiency. The threshold is set as follows:
[0025]
[0026] Among them, α represents the acceptable proportion of grouping problems, which is set to 0.3, M is the total number of groups, Indicates rounding up. If the number of groups with grouping problems reaches or exceeds this threshold, the re-grouping process will be triggered.
[0027] Local model update phase:
[0028] After the grouping is completed, all participating nodes in the group synchronously call the local model update module to obtain the initialization global model ω of the FL task from the task content, and use the local data set to train the initialization global model ω to obtain the local model. For each participating node i, its data set D i The objective function on is F i (ω i ). During the training of the local model, in the opposite direction of the gradient of the objective function Update the parameters to minimize the objective function F i (ω i ) goal. For the participating node i at time t, the local update model ω is calculated according to the following formula i (t):
[0029]
[0030] where α t is the step size to move in the opposite direction of the gradient.
[0031] In order to protect the privacy of the updated parameters, the Gaussian mechanism is applied to the update model of the participating nodes and the noise perturbation parameters are added, as shown in the following formula:
[0032]
[0033] is Gaussian noise with a mean of 0 and a standard deviation of σ·S f , the participating node i adds noise to the local training at time t to obtain the local model After multiple rounds of local training, the participating node i of group Gn finally obtains the local model
[0034] Global model aggregation stage:
[0035] After all n participating nodes of group Gn complete the local model update, the local model update module sends the local models of all participating nodes of group Gn with added noise to the global model aggregation module, and the global model aggregation module performs weighted aggregation to obtain the global model ω of group Gn Gn , then ω Gn Send to the asynchronous model accuracy detection module. The specific steps are as follows:
[0036] The local models of all n participating nodes in the collected group Gn Use weighted aggregation to calculate and obtain the global model ω of group Gn Gn
[0037]
[0038] in v i Represents the local model with added noise The impact factor.
[0039] Asynchronous model accuracy detection stage:
[0040] The asynchronous model accuracy detection module selects n global models with the highest accuracy from the collected global model set and constructs the final FL task global model ω FL , ACC t Yes FL Model accuracy, if ACC t ≥ACC0, the asynchronous model accuracy detection module broadcasts an end signal to all participating nodes to terminate the FL task, ω FLis the final target model. Otherwise, the asynchronous model accuracy detection module will call the grouping module to regroup the participating nodes and repeat the previous learning process until a model that meets the requirements is found. FL .
[0041] In order to prevent the asynchronous model accuracy detection module from using transactions with poor data timeliness when calculating the global model, a data timeliness threshold τ is set for unconfirmed transactions on the DAG max The participating nodes will select data with a timeliness no greater than τ max Aggregate unconfirmed transactions.
Claims
1. In an asynchronous federated learning system based on DAG blockchain, an asynchronous federated learning method based on directed acyclic graph DAG (DAG) blockchain technology requires the deployment of DAG blockchain and a FL task publishing module in the system, and then deploying an identity registration module, a grouping module, a local model update module, a global model aggregation module, and an asynchronous model accuracy detection module in the DAG blockchain; all participating nodes in federated learning need to call the identity registration module for registration, and the identity registration module uses the elliptic curve encryption mechanism (elliptic curvecryptography, ECC) calculates the public key and private key of the client node to complete the registration. The task publisher calls the FL task publishing module to send the FL task to the grouping module. The task information includes the initialized global model of the FL task and the final global model accuracy ACC0. The grouping module uses the K-means clustering algorithm to group the participating nodes according to their computing power. After the grouping is completed, the participating nodes in the same group synchronously call the local model update module to use the local data set to train and initialize the global model. In order to protect the privacy of the updated parameters, the local model update module applies the Gaussian mechanism to add noise perturbation parameters to the local model, and finally obtains the local model with added noise. After all participating nodes of group Gn have completed the local model update, the local model update module sends the local models of all participating nodes of group Gn with added noise to the global model aggregation module. The global model aggregation module performs weighted aggregation to obtain the global model ω of group Gn. Gn , then ω Gn The data is sent to the asynchronous model accuracy detection module, which selects n global models with the highest accuracy from the collected global model set to construct the final FL task global model. If the model accuracy is equal to or higher than the model accuracy required by the FL task, the FL task is terminated. Otherwise, the asynchronous model accuracy detection module will call the grouping module to regroup the participating nodes and repeat the previous learning process until a global model that meets the requirements is found. The present invention uses blockchain to replace the central server and adopts a DAG structure to improve transaction throughput and reduce transaction delay, which not only solves the bottleneck problem of the central server, but also better overcomes the performance limitations of traditional blockchains. In addition, the present invention groups participating nodes according to their computing power, greatly overcomes the differences between different participating nodes, and can ensure the synchronization of nodes in the same group when performing global model aggregation. In addition, the FL learning framework of intra-group synchronization and inter-group asynchronous is adopted in the model aggregation process, so that the model has a faster convergence rate, effectively solving the problem of low training efficiency. It is characterized by The following steps are involved: Functional module deployment phase: First, deploy the DAG blockchain and a FL task publishing module in the DAG-based asynchronous federated learning system. Then deploy an identity registration module, a grouping module, a local model update module, a global model aggregation module, and an asynchronous model accuracy detection module in the DAG blockchain. The core of the five modules deployed in the DAG blockchain is the smart contract. Federated learning task release phase: The task publisher calls the FL task publishing module to send the FL task to the grouping module. The task content includes the initialization global model of the FL task and the final global model accuracy ACC0; Grouping stage: The grouping module groups participating nodes according to their computing capabilities, and the grouping process uses the K-means algorithm; Local model update phase: After the grouping is completed, all participating nodes in the group synchronously call the local model update module to obtain the initialization global model ω of the FL task from the task content, and use the local data set to train the initialization global model ω to obtain the local model; Global model aggregation stage: After all n participating nodes of group Gn complete the local model update, the local model update module sends the local models of all participating nodes of group Gn with added noise to the global model aggregation module, and the global model aggregation module performs weighted aggregation to obtain the global model ω of group Gn Gn , then ω Gn Send to the asynchronous model accuracy detection module; Asynchronous model accuracy detection stage: The asynchronous model accuracy detection module selects n global models with the highest accuracy from the collected global model set and constructs the final FL task global model ω FL , ACC t Yes FL Model accuracy, if ACC t ≥ACC0, the asynchronous model accuracy detection module broadcasts an end signal to all participating nodes to terminate the FL task, ω FL is the final target model; otherwise, the asynchronous model accuracy detection module will call the grouping module to regroup the participating nodes and repeat the previous learning process until a model that meets the requirements is found. FL .
2. In the asynchronous federated learning system based on the DAG blockchain according to claim 1, an asynchronous federated learning method based on the directed acyclic graph DAG blockchain technology is characterized by: In the grouping stage, CPU speed and RAM size are used as evaluation indicators of the computing power of participating nodes, and M participants are randomly selected as the initial center points C1, C2, ..., C m . Calculate the distance from each participant to the M center points, where the distance is the Euclidean distance in the multidimensional space based on the evaluation index. Each device is assigned to the nearest center point to form M groups. Repeat the above process until the center point does not change, and get the final M groups. In the grouping process, set a threshold for the number of groups to deal with the problem that some participating nodes respond slowly and affect FL efficiency. The threshold is set as follows: Among them, α represents the acceptable proportion of grouping problems, which is set to 0.3, M is the total number of groups, Indicates rounding up. If the number of groups with grouping problems reaches or exceeds this threshold, the re-grouping process will be triggered.
3. In the asynchronous federated learning system based on the DAG blockchain according to claim 1, an asynchronous federated learning method based on the directed acyclic graph DAG blockchain technology is characterized by: In the local model update phase, in order to protect the privacy of the updated parameters, the Gaussian mechanism is applied to the update model of the participating nodes and the noise perturbation parameters are added, as shown in the following formula: is Gaussian noise with a mean of 0 and a standard deviation of σ·S f , the participating node i adds noise to the local training at time t to obtain the local model After multiple rounds of local training, the participating node i of group Gn finally obtains the local model 4. In the asynchronous federated learning system based on the DAG blockchain according to claim 1, an asynchronous federated learning method based on the directed acyclic graph DAG blockchain technology is characterized by: In the asynchronous model accuracy detection phase, in order to prevent the asynchronous model accuracy detection module from using transactions with poor data timeliness when calculating the global model, a data timeliness threshold τ is set for unconfirmed transactions on the DAG. max , the participating nodes will select data with a timeliness no greater than τ max Aggregate unconfirmed transactions.