Asynchronous federal learning method based on regularity DAG block chain

By designing a regular structure and asynchronous federated learning on the DAG blockchain, combined with the cutting-edge selection algorithm of deep reinforcement learning, the problems of low efficiency and chaotic training in the traditional blockchain federated learning system are solved, and efficient and efficient in the Internet of Vehicles are achieved. Secure federated learning training process.

CN118627593AActive Publication Date: 2024-09-10NORTHEASTERN UNIV CHINA

Patent Information

Application Number
CN202410669002.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-09-10
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

In traditional blockchain-based federated learning systems, the synchronous consensus method inhibits the efficiency of asynchronous federated learning and cannot meet the real-time requirements of the Internet of Vehicles. At the same time, the DAG blockchain lacks regularity, which leads to confusion in the training process and affects model performance. .

Method used

Design a regular DAG blockchain structure, combined with asynchronous federated learning, to ensure the orderly progress of the training process by defining different transaction types and connecting edges, and propose a two-hop tip selection algorithm based on deep reinforcement learning to optimize the security of the consensus process sex and efficiency.

Benefits of technology

It improves the efficiency of federated learning training, ensures the orderliness and safety of the training process, improves the performance of the final model, and is suitable for efficient and safe federated learning requirements in Internet of Vehicles scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627593A
    Figure CN118627593A
Patent Text Reader

Abstract

The invention belongs to the technical field of machine learning in communication and distributed environments, and provides a regular DAG block chain-based asynchronous federated learning method, which comprises the following steps of designing a regular DAG structure according to the characteristics of a federated learning training process; the participating nodes jointly construct and maintain a regular DAG, and perform federal learning model training according to a designed training rule; in the consensus process, a two-hop tip selection algorithm based on deep reinforcement learning is adopted to perform tip model selection, and finally a federated learning target model is obtained. By designing the DAG structure and the training rule, the efficient and ordered federated learning process based on the relationship between models is established in the DAG, and by improving the tip selection algorithm in the consensus process, the safety of the federated learning process is ensured, and the efficiency of the consensus process is further improved, so that the safe and efficient federated learning is realized, and the method is suitable for popularization and application. And the method has a certain reference value for research of federal learning based on the block chain in the future.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning technology in a communication and distributed environment, and in particular to an asynchronous federated learning method based on a regular DAG blockchain. Background Art

[0002] With the rapid development of the Internet of Vehicles and intelligent transportation systems, machine learning technology based on artificial intelligence has been widely used in the Internet of Vehicles. In order to solve the data island and data privacy problems caused by traditional centralized machine learning methods and make full use of distributed data on various devices, Federated Learning (FL) has gained widespread attention as a distributed machine learning framework in recent years. Among them, asynchronous federated learning is more suitable for application in the Internet of Vehicles environment due to its high efficiency and strong adaptability. However, the existence of centralized servers in federated learning makes it prone to security issues such as single point failures and poisoning attacks. Therefore, if the security risks brought by the federated learning architecture cannot be solved, the final performance of the model will be affected.

[0003] Blockchain technology originates from the decentralized cryptocurrency system. As a distributed ledger, blockchain has the characteristics of decentralization, tamper-proof, and traceability, and has the ability to solve the security issues caused by the centralization of federated learning. By integrating blockchain into the federated learning system, the federated learning participants act as blockchain nodes, and upload the models generated during the training process to the blockchain for verification and storage. All nodes participate in the maintenance process of the blockchain, and use the distributed blockchain and consensus mechanism to solve the security issues caused by the central server of federated learning.

[0004] In the existing blockchain-based federated learning systems, most of them adopt the traditional chain blockchain structure. Chain blockchain adopts the principle of synchronous consensus. This consensus method inhibits the high efficiency of asynchronous federated learning, reduces the overall efficiency of the system, and cannot meet the real-time requirements of applications in the Internet of Vehicles. Therefore, the blockchain with a directed acyclic graph (DAG) structure supports asynchronous consensus, making it more suitable for asynchronous federated learning. However, federated learning training is a process of orderly development and continuous improvement of model performance, but the DAG blockchain structure lacks rules. When combined with federated learning, it will cause confusion in the training process, thereby affecting the training efficiency and the final model performance. Summary of the invention

[0005] In view of the shortcomings of the existing technology, in order to solve the security issues faced by federated learning in the Internet of Vehicles and improve the training efficiency of federated learning based on DAG blockchain, the present invention proposes a new DAG structure, namely regular DAG, according to the characteristics of the federated learning training process; at the same time, the overall training process after combining regular DAG with asynchronous federated learning is designed to ensure that the training process can proceed in an orderly manner; finally, for the consensus process of regular DAG, a two-hop tip selection algorithm based on deep reinforcement learning is proposed to ensure the security of the training process and improve the consensus efficiency of regular DAG.

[0006] The technical solution of the present invention is as follows: an asynchronous federated learning method based on a regular DAG blockchain, comprising the following steps:

[0007] S1: The vehicle and RSU obtain federated learning task information from the Internet of Vehicles. The task information includes the initial model parameters of federated learning and the accuracy requirements of the final model.

[0008] S2: The vehicle responsible for the federated learning task and the RSU jointly build a regular DAG blockchain;

[0009] S3: The vehicle and RSU perform asynchronous federated learning training, where the vehicle is responsible for local model training and the RSU is responsible for global model aggregation;

[0010] S4: The vehicle and RSU package the trained local model parameters and the aggregated global model parameters into a transaction and upload them to the regular DAG blockchain;

[0011] S5: The vehicle and RSU select the tip in the regular DAG blockchain by running a two-hop tip selection algorithm based on deep learning, and perform the regular DAG consensus process;

[0012] S6: Steps S3-S5 are performed asynchronously in a loop. When the global model performance reaches the requirements of the federated learning task, the training ends and the final target model is obtained.

[0013] The structural components of the regular DAG blockchain in S2 include three types of transactions and two types of connection edges; the transaction published by the RSU in the regular DAG blockchain is called the main transaction, and the global model parameters are recorded in the main transaction; the vehicle can publish two types of transactions in the regular DAG blockchain, one is the secondary transaction, which records the local model parameters, and the other is the confirmation transaction, which is used to confirm the main transaction; the two types of connection edges are real edges and virtual edges, respectively. The real edge includes the connection between the main transaction and the transaction it selects, and the connection between the confirmation transaction and the main transaction, reflecting the relationship between the models in the federated learning process. The virtual edge connects the secondary transactions and indicates the verification of other secondary transactions by the vehicle node.

[0014] The asynchronous federated learning training in S3 is as follows:

[0015] The vehicle and RSU are jointly responsible for the training process of federated learning. The ultimate goal of the training is to minimize the average loss function so that the global model performs well on the overall data set.

[0016] For each vehicle node i, the vehicle collects data related to the federated learning task from the Internet of Vehicles in real time to form a local dataset. The loss function on the vehicle is defined as quantifying the local dataset D i The difference between the estimated and actual values ​​of the sample in :

[0017]

[0018] Among them, F i (ω) is the vehicle i in the local dataset D i The loss function on ; f(ω; z i ) is the machine learning loss function, which represents the prediction error of the sample under the model parameter ω; z i For the dataset D i The sample in can be expressed as (x i ,y i ), x i is the eigenvalue, y i is the label; E is the expected function;

[0019] Vehicle node i calculates the local model update locally through the distributed gradient descent method:

[0020]

[0021] Where η is the learning rate of the distributed gradient descent method; ω t is the local model parameter of vehicle i in the previous round; Update the parameters of the local model of the current wheel of vehicle i;

[0022] The global model average loss function is:

[0023]

[0024] Among them, V is the set of all vehicles participating in the training;

[0025] RSU uses the federated average algorithm when aggregating, and the aggregation model parameters are:

[0026]

[0027] in, is the time weight, is the numerical weight, ω t g is the global model parameter, ωt l are local model parameters.

[0028] In the process of consensus between the vehicle and the RSU node, the S5 adopts a two-hop tip selection algorithm based on deep reinforcement learning to quickly select the optimal tip model for federated learning according to the attributes of the tip and its forward connection transaction, i.e., the parent node, in the regular DAG blockchain and the model performance recorded in the transaction, as follows:

[0029] S5-1: Define transaction attributes and model performance; the transaction attributes include security, number of verifications, and data fairness;

[0030] S5-2: Establish the vehicle and RSU node tip selection optimization problem;

[0031] S5-3: Solving the cutting-edge selection optimization problem using deep reinforcement learning:

[0032] The three key elements of reinforcement learning, namely state space, action space and reward function, are defined, and the tip selection optimization problem of vehicles and RSU nodes is transformed into the reward maximization problem in reinforcement learning.

[0033] The transaction attributes and model performance are defined as follows:

[0034] Security: Ensure the basic security of the regular DAG blockchain; each transaction tx in the regular DAG blockchain has its own weight W tx , then the cumulative weight of transaction tx for:

[0035]

[0036] Among them, J is the set of all subsequent child nodes of transaction tx;

[0037] The security of this tip transaction tx is expressed as:

[0038]

[0039] Where n is the total number of tips and their connected parent nodes, W tx asum The smaller the value, the higher the security of the cutting-edge transaction tx;

[0040] Verification times: The number of times the tip transaction tx is verified by other vehicle nodes is c tx ;

[0041] Data fairness: The data fairness of a transaction can reflect whether the model recorded in the transaction can balance the data between different vehicles. The data fairness of the transaction tx is defined using variance:

[0042]

[0043] Among them, V and |V| represent the set and set size of vehicles participating in the training, respectively, and f v represents the total number of times that the vehicle v directly or indirectly connected to the tip transaction in the regular DAG blockchain participates in the training process; F tx The smaller the value, the greater the fairness of the data represented by the record model in the transaction;

[0044] Model performance: The model performance recorded in the transaction can intuitively reflect the quality of the model. The model performance recorded in the transaction tx is defined as:

[0045]

[0046] in, is the absolute error between the actual output and the predicted output, c tx is the number of verifications for the transaction, θ tx The smaller the value, the higher the accuracy of the model recorded in the transaction tx, and the more times it has been verified c tx The larger the value, the better the obtained θ tx The more reliable.

[0047] The specific problem of establishing the vehicle and RSU node tip selection optimization problem is as follows:

[0048] The goal of the vehicle node in the consensus process is to select a primary transaction and perform local model training based on the global model recorded in the selected primary transaction tip. Secondly, in order to assist the subsequent RSU nodes in selecting tips for global aggregation, the vehicle node also needs to select secondary transactions issued by other vehicles and verify the local models recorded therein using local test data;

[0049] When selecting a tip, the vehicle node needs to verify the current main transaction tip and select a main transaction with the best accuracy and data fairness. At the same time, among the secondary transaction tips, the vehicle selects a secondary transaction with fewer verification times for verification, thereby increasing the reliability of the accuracy verification of the transaction.

[0050] Therefore, the vehicle node tip selection optimization problem is formulated as:

[0051]

[0052] The constraints are:

[0053] C1:α n ,β m ∈{0,1}

[0054] C2:α n ·W nasum ,β m ·W m asum ≤W

[0055] C3:tt n ,tt m ≤T

[0056]

[0057] Among them, α n and β m is a decision variable, which represents the selected secondary transaction tip and the main transaction tip, and takes 0 or 1. Constraint C2 constrains the security of the selected tip. When it is less than a given value W, the tip transaction is considered safe and is an optional tip; in constraint C3, t n and t m is the time when the tip is generated, constraining the freshness of the transaction. If the time between the time when the node selects the tip and the time when the transaction is published is less than T, then the transaction is an optional tip; Constraint C4 means that when the vehicle node selects the tip, it needs to select one from all the main transaction tips; K in constraint C5 v is the number of secondary transactions that the vehicle can verify, indicating the number of secondary transaction tips that the vehicle node can still select after verifying all M primary transaction tips;

[0058] The goal of the RSU node in the consensus process is to select the cutting-edge aggregated global model. In order to make the aggregated global model have better performance, under the constraints of security, the cutting-edge with higher model accuracy, more verification times and higher data fairness of the aggregated global model is selected;

[0059] The RSU node tip selection optimization problem is formulated as:

[0060]

[0061] The constraints are:

[0062] C1:α n ,β m ∈{0,1}

[0063] C2:α n ·W n asum ,β m ·W m asum ≤W

[0064] C3:tt n ,tt m ≤T

[0065]

[0066] Among them, F' is the data fairness of the global model after aggregation, the constraints of C1, C2, and C3 are the same as those of the vehicle nodes, and the constraints of K in C4 are r Indicates the total number of tips that the RSU node can select.

[0067] The state space: For the vehicle node, when the tip selection is performed in the current time slot, the observed state information S v (t) It consists of four parts v (t) =[W i sum ,c n ,θ m ,F m ] (t) , where W i sum ={W1 sum ,W2 sum ,...,W i sum} is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current vehicle node, c n ={c1,c2,...,c n} represents the number of verifications at the current transaction tip, θ m ={θ1,θ2,...,θ m} represents the accuracy of the model recorded in all current main tip transactions, F m ={F1,F2,...,F m} represents the data fairness of the recording model in all current main transaction tips; for the RSU node, when the tip is selected in the current time slot, the observed state information S r (t) It consists of three parts r (t) =[W i sum ,c i ,θ i ], where W i sum ={W1 sum ,W2 sum ,...,W i sum} is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current RSU node, c i ={c1,c2,...,c i} is the number of verifications of all current tips, θ i={θ1,θ2,...,θ i}Record the accuracy of the model for all current tips;

[0068] The action space: The action space of the vehicle and RSU nodes consists of the selection decisions of all tips in the current tip pool of the node, represented as the action vector A (t) =[α1,α2,...,α n ; β1,β2,...,β m ], where α n ,β m ∈{0,1,α n represents the decision of the transaction, β m Indicates the selection decision for the main transaction;

[0069] The reward function: In the reinforcement learning model, the agent is rewarded at each step in state S as it explores the best tip selection action towards the goal state. (t) Next, perform a possible action A (t) After acting on the environment, you will get an instant reward from environmental feedback;

[0070] Define vehicle node rewards With RSU node rewards They are:

[0071]

[0072] The agent explores and selects actions A with the goal of maximizing the cumulative reward (t) , in any state, the reward value corresponding to the best tip selection decision action is the highest.

[0073] Compared with the prior art, the present invention has the following beneficial effects:

[0074] The present invention provides an asynchronous federated learning method based on a regular DAG blockchain. The present invention innovates on the traditional DAG structure, defines the connection relationship between different transaction types and different transactions in the DAG, and designs the vehicle and RSU consensus rules to make it more suitable for the federated learning training process, so as to establish an orderly federated learning process based on the relationship between models in the regular DAG, thereby improving the efficiency of federated learning. In addition, in order to further ensure the security and efficiency of the training process and solve the problem of low efficiency and high randomness of the tip selection algorithm used in the traditional DAG consensus process, the present invention proposes a two-hop tip selection algorithm based on deep reinforcement learning. When the vehicle and RSU select the tip, only the transaction attributes of the tip and its parent node and the performance of the record model in the transaction are considered to achieve fast and optimal selection, ensuring that the selected tip is safe and conducive to the performance of the final model of federated learning.

[0075] Based on the above reasons, the present invention can be widely promoted in the fields of communications and federated learning, and can be applied in Internet of Vehicles scenarios where there are a large number of vehicles and there are obvious differences in computing power between vehicles. It has certain reference value for future research on blockchain-based federated learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0077] Figure 1 It is a system model diagram of the present invention;

[0078] Figure 2 It is a regular DAG structure diagram of the present invention;

[0079] Figure 3 This is a diagram illustrating the connection of the regular DAG tips of the present invention;

[0080] Figure 4 It is the regular DAG tip number convergence diagram of the present invention;

[0081] Figure 5 A comparison diagram of the tip selection delay between the regular DAG of the present invention and the existing DAG;

[0082] Figure 6 This is a security comparison diagram between the regular DAG of the present invention and the existing DAG;

[0083] Figure 7 This is a comparison chart of the regular DAG of the present invention and the existing DAG scale;

[0084] Figure 8 The figures are a comparison of the federated learning performance of the method of the present invention and the existing methods; (a) is a diagram of the overall training effect; (b) is a partial magnified diagram;

[0085] Fig. 9 A comparison chart of the ability of the method of the present invention and the existing method to resist poisoning attacks;

[0086] Fig.10 A comparison chart showing the ability of the method of the present invention to resist poisoning attacks of different degrees;

[0087] Fig.11 This is a comparison chart of the federated learning performance between the method described in the present invention and the baseline method. DETAILED DESCRIPTION

[0088] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0089] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0090] See also Figure 1 , which shows a system model diagram of asynchronous federated learning based on regular DAG blockchain in the Internet of Vehicles scenario in an embodiment of the present invention.

[0091] The system model mainly consists of three parts: vehicle nodes, RSU nodes and regular DAG, where the vehicle nodes are V1, V2, …, V n , equipped with an on-board unit, with limited computing and communication resources, the computing resources of the vehicle nodes are f1,f2,…,f n , which is responsible for collecting various data generated in the network in real time, so that vehicles can use the effective data they collect to complete the training of local models in the federated learning process. RSU nodes are R1, R2, …, R m , equipped with MEC servers, which have certain computing and storage capabilities compared to vehicle nodes. At the same time, RSU has a fixed position and better communication conditions. Therefore, RSU is used as an aggregator for global model training to improve the convergence speed of the model.

[0092] When a federated learning task request appears in the network, the vehicle node obtains the global model from the regular DAG and uses its local data set D1, D2, …, D nBased on the global model, the local model is trained and uploaded to the regular DAG. The RSU node obtains the model for aggregation from the regular DAG. The global model is aggregated and uploaded to the DAG blockchain network. During the whole process, asynchronous training and aggregation are realized between the vehicle and the RSU.

[0093] The asynchronous federated learning method based on the regular DAG blockchain specifically includes the following steps:

[0094] S1: The vehicle and RSU obtain federated learning task information from the network. The task information includes the initial model parameters of federated learning and the accuracy requirements of the final model.

[0095] S2: The vehicle responsible for the federated learning task and the RSU jointly build a regular DAG blockchain;

[0096] S3: The vehicle and RSU perform asynchronous federated learning training, where the vehicle is responsible for local model training and the RSU is responsible for global model aggregation;

[0097] S4: Vehicles and RSUs package the trained local model, the aggregated global model and related information into a transaction and upload it to the regular DAG;

[0098] S5: The vehicle and RSU select the tip in the regular DAG by running a two-hop tip selection algorithm based on deep learning, and perform the regular DAG consensus process;

[0099] S6: Steps S3-S5 are performed asynchronously in a loop. When the model performance meets the requirements of the federated learning task, the training ends and the final target model is obtained.

[0100] Furthermore, S2 specifically includes the following designs:

[0101] See also Figure 2 , which shows the specific design of the regular DAG structure. The designed regular DAG mainly consists of the following five parts:

[0102] (1) Main transaction: The transaction published by the RSU node in the regular DAG is called the main transaction. The global model parameters are recorded in the main transaction. The main transaction format is defined as:

[0103] TX G ={ω G ,W G ,F}∪{H,N,T,Sig r}

[0104] where ω G , W G and F is the newly designed field, ω G The parameters of the global model recorded in the main transaction, W Gis the weight of the main transaction, and F is the data fairness represented by the global model recorded in the main transaction. H, N, T and Sig r These are regular fields, representing the hash value, sequence number, timestamp of the main transaction, and the digital signature of the RSU node that issued the main transaction.

[0105] (2) Secondary transactions: Vehicle nodes can publish secondary transactions in the regular DAG, which record local model parameters and define the main transaction format as follows:

[0106] TX L ={ω L ,W L ,θ G ,θ L}∪{H,N,T,Sig v}

[0107] where ω L , W L ,θ G and θ L is a newly designed field, ω L is the parameter of the local model recorded in this transaction, W L is the weight of the transaction, θ G is the accuracy of the global model in the main transaction of vehicle verification, θ L The accuracy of the local model in all transactions for vehicle selection validation. H, N, T and Sig v These are regular fields, representing the hash value, serial number, timestamp, and digital signature of the vehicle node that issued the transaction.

[0108] (3) Confirmation transaction: Another transaction published by the vehicle node in the regular DAG is the confirmation transaction. The function of this transaction is to confirm the global model in the main transaction. The format of the confirmation transaction is defined as:

[0109] TX C = {W C ,H C}∪{H,N,T,Sig v}

[0110] Where W C ,H C These are newly designed fields, representing the transaction weight and the hash value of the transaction confirmed by the vehicle, H, N, T and Sig v These are regular fields, which respectively represent the hash value, serial number, timestamp of the confirmed transaction, and the digital signature of the vehicle node that issued the confirmed transaction.

[0111] (4) Real edge: The real edge connects the primary transaction and the secondary transaction, reflecting the development relationship between the models in the federated learning training process. The real edge format is defined as:

[0112] e R =(TX G ,TX L )

[0113] Among them, TX G and TX L Represents the main transaction and the secondary transaction respectively.

[0114] (5) Virtual edge: A virtual edge connects sub-transactions and represents the verification of other sub-transactions by the vehicle node. The virtual edge format is defined as:

[0115]

[0116] Among them, TX pre L and They respectively represent the previous transaction and the next transaction connected by the virtual edge.

[0117] Furthermore, S3 specifically includes the following designs:

[0118] The vehicle and RSU are jointly responsible for the training process of federated learning. The ultimate goal of the training is to minimize the average loss function so that the global model performs well on the overall data set.

[0119] The vehicle is responsible for local model training. For each vehicle node i, the loss function is defined as the quantized dataset D i The difference between the estimated and actual values ​​of the sample in :

[0120]

[0121] Vehicle node i calculates the local model update locally through the distributed gradient descent method:

[0122]

[0123] Where η is the learning rate of the distributed gradient descent method.

[0124] The global model average loss function is:

[0125]

[0126] Among them, V is the set of all vehicles participating in the training.

[0127] RSU adopts the federated averaging algorithm during aggregation, and considers the impact of model data volume and model generation time on global model parameters during the global aggregation process.

[0128] (1) Data weight

[0129] Data weight is used to measure the contribution to model training. The larger the sample size of a vehicle node, the greater the contribution of the node to model training. Data weight can be expressed as the ratio of the data stored in the vehicle node to the total data of all vehicle nodes:

[0130]

[0131] Where D i represents the amount of data stored on the i-th vehicle node, Represents the total data volume of all N vehicle nodes participating in the federated learning training.

[0132] (2) Time weight

[0133] In asynchronous aggregation, the models selected for aggregation may include local models trained from different global models. Therefore, it is necessary to evaluate the degree of lag of different models to determine the weight they should have in the aggregation process.

[0134] Define a version number Version for each global model. Each time a new global model is aggregated, the version number increases by one. All local models trained based on the same global model have the same version number as the global model. The outdatedness of the model version uploaded by the node can be expressed as:

[0135] α staleness =Version latest -Version upload

[0136] The greater the outdatedness, the smaller the time weight of the model in the aggregation process. Therefore, a monotonically decreasing inverse proportional function can be selected as the decay function of the time weight parameter. The time weight is defined as:

[0137]

[0138] Therefore, the global model obtained after aggregation is updated as:

[0139]

[0140] Among them, G is the global model of all the selected tips, L is the local model of all the selected tips, is the time weight, is the numerical weight, w t g is the global model parameter, w t l are local model parameters.

[0141] Furthermore, S5 specifically includes the following designs:

[0142] See also Figure 3 ,There are two types of tips in the regular DAG, the primary transaction tip and the secondary transaction tip. In the consensus process between the vehicle and the RSU node, a two-hop tip selection algorithm based on deep reinforcement learning is adopted to achieve fast optimal tip model selection that is conducive to federated learning according to the transaction attributes of the tip and its parent node in the regular DAG and the model performance recorded in the transaction. The specific design is as follows:

[0143] S5-1: Define transaction attributes and model performance:

[0144] Security: Ensure the basic security of the regular DAG to prevent lazy nodes and some malicious nodes from launching double consumption attacks. Each transaction tx in the regular DAG has its own weight W tx , then the cumulative weight of transaction i for:

[0145]

[0146] Among them, J is the set of all subsequent child nodes of transaction tx.

[0147] Based on this tip, the security of transaction i can be expressed as:

[0148]

[0149] Where n is the total number of tips and their connected parent nodes, W tx asum The smaller the value of , the higher the security of the tip transaction tx.

[0150] Verification times: The number of times the tip transaction tx is verified by other vehicle nodes is c tx .

[0151] Data fairness: The data fairness of a transaction can reflect whether the model recorded in the transaction can balance the data between different vehicles. The data fairness of the transaction tx is defined using variance:

[0152]

[0153] Among them, V and |V| represent the set and size of vehicles participating in the training, respectively, and f v It represents the total number of times that the vehicle v directly or indirectly connected to this tip transaction in the DAG participates in the training process. tx The smaller the value, the greater the fairness of the data represented by the record model in the transaction.

[0154] Model performance: The model performance recorded in the transaction can intuitively reflect the quality of the model. The model performance recorded in the transaction tx is defined as:

[0155]

[0156] in, is the absolute error between the actual output and the predicted output, c tx is the number of verifications for the transaction, θ tx The smaller the value, the higher the accuracy of the model recorded in the transaction tx, and the more times it has been verified c tx The larger the value, the better the obtained θ tx The more reliable.

[0157] S5-2: Establish the vehicle and RSU node tip selection optimization problem:

[0158] The goal of the vehicle node's tip selection during the consensus process is to select a main transaction and perform local model training based on the global model recorded in the selected main transaction tip. Secondly, in order to assist subsequent RSU nodes in selecting tips for global aggregation, the vehicle node also needs to use its own local test data to select secondary transactions released by other vehicles and verify the local models recorded therein.

[0159] Therefore, when selecting a tip, the vehicle node needs to verify the current main transaction tip and select a main transaction with the best accuracy and data fairness. At the same time, among the secondary transaction tips, the vehicle should select a secondary transaction that has been verified fewer times for verification, so as to increase the reliability of the accuracy verification of the transaction.

[0160] Therefore, the vehicle node tip selection optimization problem is formulated as:

[0161]

[0162] The constraints are:

[0163] C1:α n ,β m ∈{0,1}

[0164] C2:α n ·W n asum ,β m ·W m asum ≤W

[0165] C3:tt n ,tt m ≤T

[0166]

[0167] Among them, α n and β mis a decision variable, which represents the selected secondary transaction and primary transaction tip, and takes 0 or 1. Constraint C2 constrains the security of the selected tip. When it is less than a given value W, the tip transaction can be considered safe and is an optional tip; in constraint C3, t n and t m is the time when the tip is generated, which constrains the freshness of the transaction. If the time between the time when the node selects the tip and the time when the transaction is published is less than T, then the transaction is an optional tip; Constraint C4 means that when the vehicle node selects the tip, it needs to select one from all the main transaction tips; K in constraint C5 v is the number of secondary transactions that can be verified by the vehicle, indicating the number of secondary transaction tips that the vehicle node can still select after verifying all M main transaction tips.

[0168] The goal of the RSU node in the consensus process is to select the tip aggregated global model. In order to make the aggregated global model have better performance, under the constraints of security, the tip with higher model accuracy, more verification times and higher data fairness of the aggregated global model should be selected.

[0169] Therefore, the RSU node tip selection optimization problem is expressed as:

[0170]

[0171] The constraints are:

[0172] C1:α n ,β m ∈{0,1}

[0173] C2:α n ·W n asum ,β m ·W m asum ≤W

[0174] C3:tt n ,tt m ≤T

[0175]

[0176] Among them, F' is the data fairness of the global model after aggregation, the constraints of C1, C2, and C3 are the same as those of the vehicle nodes, and the constraints of K in C4 are r Indicates the total number of tips that the RSU node can select.

[0177] S5-3: Solving the cutting-edge selection optimization problem using deep reinforcement learning:

[0178] Based on the tip selection optimization problem established in step S5-2, the present invention adopts the proximal policy optimization algorithm (PPO) to solve the optimization problem. The algorithm is based on the actor-critic framework and can solve the reinforcement learning problem of both discrete action space and continuous action space. Since the model of the present invention has the characteristics of high-dimensional discrete action space, it is suitable for solving with this algorithm.

[0179] The present invention first defines in detail the three key elements of state, action and reward in reinforcement learning, and transforms the tip selection optimization problem of vehicles and RSU nodes into the problem of solving the reward maximization problem in reinforcement learning.

[0180] State: For a vehicle node, the state information S that can be observed when performing tip selection in the current time slot v (t) It consists of four parts v (t) =[W i sum ,c n ,θ m ,F m ] (t) , where W i sum ={W1 sum ,W2 sum ,...,W i sum} is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current vehicle node, c n ={c1,c2,...,c n} represents the number of verifications at the current transaction tip, θ m ={θ1,θ2,...,θ m} represents the accuracy of the model recorded in all current main tip transactions, F m ={F1,F2,...,F m} represents the data fairness of the record model in all current main transaction tips. For the RSU node, when selecting a tip in the current time slot, the state information S that can be observed r (t) It consists of three parts r (t) =[W i sum ,c i ,θ i ], where W i sum ={W1 sum ,W2 sum,...,W i sum} is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current RSU node, c i ={c1,c2,...,c i} is the number of verifications of all current tips, θ i ={θ1,θ2,...,θ i}Record the accuracy of the model for all current tips.

[0181] Action: The action space of the vehicle and RSU nodes consists of the selection decisions of all the tips in the current tip pool of the node, which can be represented as the action vector A (t) =[α1,α2,...,α n ; β1,β2,...,β m ], where α n ,β m ∈{0,1},α n represents the decision of the transaction, β m Indicates the selection decision for the main transaction.

[0182] Reward: In the reinforcement learning model, the agent is rewarded at each step in state S as it explores the best unloading decision action towards the goal state. (t) Next, perform a possible action A (t) After acting on the environment, you will get an instant reward from environmental feedback. The goal of reinforcement learning is to obtain the maximum cumulative reward. Therefore, the reward function designed by the present invention should be negatively correlated with the objective function of the optimization problem. Therefore, the present invention defines the vehicle node reward With RSU node rewards They are:

[0183]

[0184] In reinforcement learning, the agent explores and selects actions A with the goal of maximizing the cumulative reward. (t) Therefore, the reward value corresponding to the best cutting-edge selection decision action in any state is the highest, realizing the transformation of the problem.

[0185] Figure 4 This is the regular DAG tip number convergence graph of the present invention. The tip number of the DAG blockchain is crucial to the performance and security of the DAG. Maintaining a stable tip number is the key to ensuring the stable and effective operation of the DAG-based federated learning system. Figure 4The figure shows how the number of tips in the regular DAG proposed in the present invention changes over time during the entire federated learning training process. It can be seen that after a period of training, although the number of DAG tips will continue to change over time, the fluctuation of the number can be guaranteed to be within a certain range, which indicates that the regular DAG proposed in the present invention is able to converge.

[0186] Figure 5 This is a comparison chart of the tip selection delay of the regular DAG of the present invention and the existing DAG. As the particle depth continues to grow, the delay of the tip selection algorithm proposed by the present invention is mainly the delay of the reinforcement learning model operation, and this delay does not change significantly with the increase of the DAG size. The existing DAG uses a tip selection algorithm based on Markov Monte Carlo (MCMC), which needs to track the previous W particle depths, so the selection delay will continue to grow. It can be seen from the figure that although the tip selection time of the existing DAG structure is very short at the beginning due to the small DAG scale, as the DAG scale continues to grow, when the DAG particle depth grows to about 10, the tip selection delay of the existing DAG will exceed the algorithm proposed by the present invention, and the delay will continue to increase with the increase of particle depth. Therefore, from the perspective of the entire federated learning training process, the tip selection algorithm proposed by the present invention can reduce the delay in tip selection and improve time efficiency.

[0187] Figure 6 This is a security comparison diagram between the regular DAG of the present invention and the existing DAG, which shows the probability of selecting malicious transactions for three different DAG tip selection algorithms, namely the algorithm proposed in the present invention, the tip selection algorithm based on MCMC, and the random tip selection algorithm, under different proportions of malicious nodes. The tip selection algorithm based on MCMC in the existing DAG has been verified to be able to effectively improve the security of DAG and prevent malicious users from executing attacks on DAG. It can be seen from the figure that the probability of selecting malicious transactions for the tip selection algorithm proposed in the present invention under different malicious node proportions is close to that of the existing DAG, and is much lower than that of the random tip selection, indicating that the two-hop tip selection algorithm based on deep reinforcement learning proposed in the present invention can ensure the basic security of DAG.

[0188] Figure 7 This is a comparison chart of the scale of the regular DAG of the present invention and the existing DAG, which compares the changes in the total number of transactions contained in the DAG with the training time during the entire federated learning process, reflecting the change trend of the DAG scale. It can be seen from the figure that as the federated learning training continues, the scale of the regular DAG proposed by the present invention is always smaller than the existing DAG, indicating that the method proposed by the present invention can effectively reduce the number of unnecessary transactions during the entire federated learning process. The smaller the DAG scale, the more effectively it can reduce the occupation of vehicle storage resources. Therefore, the present invention is more practical.

[0189] Figure 8 This is a comparison chart of the federated learning performance of the method of the present invention and the existing methods. The figure shows the federated learning performance of different methods on the MNIST dataset and non-independent and identically distributed data. The method of the present invention is compared with four other existing methods, namely synchronous federated learning, asynchronous federated learning, federated learning based on chained blockchain, and federated learning based on existing DAG. It can be seen from the figure that the scheme proposed by the present invention is close to pure asynchronous federated learning in terms of convergence speed and final model accuracy. The federated learning based on chained blockchain has low blockchain consensus efficiency, and the synchronous federated learning needs to wait for the slowest vehicle to complete training each time due to the asynchrony of the vehicle. The federated learning based on the existing DAG does not consider the performance of the model selected each time, which leads to a decrease in their convergence speed.

[0190] Fig. 9 This is a comparison chart of the ability of the method of the present invention and the existing method to resist poisoning attacks. After adding the same proportion of 30% malicious vehicle nodes, the impact on the federated learning performance of different methods is compared. It can be seen from the figure that after adding poisoning attacks, the method of the present invention has the best resistance to poisoning attacks, and the convergence speed and accuracy of synchronous and asynchronous federated learning are significantly reduced. This is mainly because these two models cannot verify and distinguish the models released by the poisoned nodes, and can only dilute the harmful models uploaded by the poisoned nodes through the federated average algorithm. In the existing DAG, when the proportion of malicious vehicles is large, the proportion of malicious models in the DAG is large. Due to the randomness of the tip selection, there is a high probability that the malicious model will be selected each time the aggregation is aggregated, which significantly reduces the convergence speed and accuracy. In the method of adding a chain blockchain, since the blockchain has a certain verification ability for the uploaded model during consensus, the accuracy rate is reduced less than the other three schemes, but it is still not as good as the method of the present invention.

[0191] Fig.10 This is a comparison chart of the ability of the method of the present invention to resist poisoning attacks of different degrees, which compares the impact of adding different proportions of malicious vehicle nodes on the performance of federated learning in the present invention. The proportion of malicious vehicle nodes is set to 10%, 20%, and 30%. It can be seen from the figure that with the increase of the proportion of malicious vehicles, the convergence speed of the method of the present invention decreases slightly, but the efficiency is not significantly reduced. At the same time, there is no obvious impact on the accuracy of the final model, and the model can still achieve a high accuracy, indicating that the method of the present invention can still perform well in the case of containing malicious vehicle nodes.

[0192] Fig.11This is a comparison chart of the federated learning performance of the method described in the present invention and the baseline method. It can be seen from the figure that the performance of our proposed solution is close to that of the centralized CNN, but the centralized method will bring high data security and privacy risks. At the same time, the accuracy of the local CNN is far behind the other two methods, mainly because the local CNN can obtain the local optimal solution, but it may be far from the global optimal solution.

Claims

1. An asynchronous federated learning method based on a regular DAG blockchain, characterized in that: The steps include: S1: The vehicle and RSU obtain federated learning task information from the Internet of Vehicles. The task information includes the initial model parameters of federated learning and the accuracy requirements of the final model. S2: The vehicle responsible for the federated learning task and the RSU jointly build a regular DAG blockchain; S3: The vehicle and RSU perform asynchronous federated learning training, where the vehicle is responsible for local model training and the RSU is responsible for global model aggregation; S4: The vehicle and RSU package the trained local model parameters and the aggregated global model parameters into a transaction and upload them to the regular DAG blockchain; S5: The vehicle and RSU select the tip in the regular DAG blockchain by running a two-hop tip selection algorithm based on deep learning, and perform the regular DAG consensus process; S6: Steps S3-S5 are performed asynchronously in a loop. When the global model performance reaches the requirements of the federated learning task, the training ends and the final target model is obtained.

2. The asynchronous federated learning method based on the regular DAG blockchain according to claim 1 is characterized in that: The structural components of the regular DAG blockchain in S2 include three types of transactions and two types of connection edges; the transaction published by the RSU in the regular DAG blockchain is called the main transaction, and the global model parameters are recorded in the main transaction; the vehicle can publish two types of transactions in the regular DAG blockchain, one is the secondary transaction, which records the local model parameters, and the other is the confirmation transaction, which is used to confirm the main transaction; the two types of connection edges are real edges and virtual edges, respectively. The real edge includes the connection between the main transaction and the transaction it selects, and the connection between the confirmation transaction and the main transaction, reflecting the relationship between the models in the federated learning process. The virtual edge connects the secondary transactions and indicates the verification of other secondary transactions by the vehicle node.

3. The asynchronous federated learning method based on the regular DAG blockchain according to claim 2 is characterized in that: The asynchronous federated learning training in S3 is as follows: The vehicle and RSU are jointly responsible for the training process of federated learning. The ultimate goal of the training is to minimize the average loss function so that the global model performs well on the overall data set. For each vehicle node i, the vehicle collects data related to the federated learning task from the Internet of Vehicles in real time to form a local dataset. The loss function on the vehicle is defined as quantifying the local dataset D i The difference between the estimated and actual values ​​of the sample in : Among them, F i (ω) is the vehicle i in the local dataset D i The loss function on ; f(ω; z i ) is the machine learning loss function, which represents the prediction error of the sample under the model parameter ω; z i For the dataset D i The sample in can be expressed as (x i ,y i ), x i is the eigenvalue, y i is the label; E is the expected function; Vehicle node i calculates the local model update locally through the distributed gradient descent method: Where η is the learning rate of the distributed gradient descent method; ω t is the local model parameter of vehicle i in the previous round; Update the parameters of the local model of the current wheel for vehicle i; The global model average loss function is: Among them, V is the set of all vehicles participating in the training; RSU uses the federated average algorithm when aggregating, and the aggregation model parameters are: in, is the time weight, is the number weight, are global model parameters, are local model parameters.

4. The asynchronous federated learning method based on the regular DAG blockchain according to claim 3 is characterized in that: In the process of consensus between the vehicle and the RSU node, the S5 adopts a two-hop tip selection algorithm based on deep reinforcement learning to quickly select the optimal tip model for federated learning according to the attributes of the tip and its forward connection transaction, i.e., the parent node, in the regular DAG blockchain and the model performance recorded in the transaction, as follows: S5-1: Define transaction attributes and model performance; the transaction attributes include security, number of verifications, and data fairness; S5-2: Establish the vehicle and RSU node tip selection optimization problem; S5-3: Solving the cutting-edge selection optimization problem using deep reinforcement learning: The three key elements of reinforcement learning, namely state space, action space and reward function, are defined, and the tip selection optimization problem of vehicles and RSU nodes is transformed into the reward maximization problem in reinforcement learning.

5. The asynchronous federated learning method based on the regular DAG blockchain according to claim 4 is characterized in that: The transaction attributes and model performance are defined as follows: Security: Ensure the basic security of the regular DAG blockchain; each transaction tx in the regular DAG blockchain has its own weight W tx , then the cumulative weight of transaction tx for: Among them, J is the set of all subsequent child nodes of transaction tx; The security of this tip transaction tx is expressed as: Where n is the total number of tips and their connected parent nodes, W tx asum The smaller the value, the higher the security of the cutting-edge transaction tx; Verification times: The number of times the tip transaction tx is verified by other vehicle nodes is c tx ; Data fairness: The data fairness of a transaction can reflect whether the model recorded in the transaction can balance the data between different vehicles. The data fairness of the transaction tx is defined using variance: Among them, V and |V| represent the set and set size of vehicles participating in the training, respectively, and f v represents the total number of times that the vehicle v directly or indirectly connected to the tip transaction in the regular DAG blockchain participates in the training process; F tx The smaller the value, the greater the fairness of the data represented by the record model in the transaction; Model performance: The model performance recorded in the transaction can intuitively reflect the quality of the model. The model performance recorded in the transaction tx is defined as: in, is the absolute error between the actual output and the predicted output, c tx is the number of verifications for the transaction, θ tx The smaller the value, the higher the accuracy of the model recorded in the transaction tx, and the more times it has been verified c tx The larger the value, the better the obtained θ tx The more reliable.

6. The asynchronous federated learning method based on the regular DAG blockchain according to claim 5 is characterized in that: The specific problem of establishing the vehicle and RSU node tip selection optimization problem is as follows: The goal of the vehicle node in the consensus process is to select a primary transaction and perform local model training based on the global model recorded in the selected primary transaction tip. Secondly, in order to assist the subsequent RSU nodes in selecting tips for global aggregation, the vehicle node also needs to select secondary transactions issued by other vehicles and verify the local models recorded therein using local test data; When selecting a tip, the vehicle node needs to verify the current main transaction tip and select a main transaction with the best accuracy and data fairness. At the same time, among the secondary transaction tips, the vehicle selects a secondary transaction with fewer verification times for verification, thereby increasing the reliability of the accuracy verification of the transaction. Therefore, the vehicle node tip selection optimization problem is formulated as: The constraints are: Among them, α n and β m is a decision variable, which represents the selected secondary transaction tip and the main transaction tip, and takes 0 or 1. Constraint C2 constrains the security of the selected tip. When it is less than a given value W, the tip transaction is considered safe and is an optional tip; in constraint C3, t n and t m is the time when the tip is generated, constraining the freshness of the transaction. If the time between the time when the node selects the tip and the time when the transaction is published is less than T, then the transaction is an optional tip. Constraint C4 means that when the vehicle node selects the tip, it needs to select one from all the main transaction tips. In constraint C5, K v is the number of secondary transactions that the vehicle can verify, indicating the number of secondary transaction tips that the vehicle node can still select after verifying all M primary transaction tips; The goal of the RSU node in the consensus process is to select the cutting-edge aggregated global model. In order to make the aggregated global model have better performance, under the constraints of security, the cutting-edge with higher model accuracy, more verification times and higher data fairness of the aggregated global model is selected; The RSU node tip selection optimization problem is formulated as: The constraints are: Among them, F' is the data fairness of the global model after aggregation, the constraints of C1, C2, and C3 are the same as those of the vehicle nodes, and the constraints of K in C4 are r Indicates the total number of tips that the RSU node can select.

7. The asynchronous federated learning method based on the regular DAG blockchain according to claim 6 is characterized in that: The state space: For the vehicle node, when the tip selection is performed in the current time slot, the observed state information S v (t) It consists of four parts v (t) =[W i sum ,c n ,θ m ,F m ] (t) , where W i sum ={W1 sum ,W2 sum ,...,W i sum } is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current vehicle node, c n ={c1,c2,...,c n } represents the number of verifications at the current transaction tip, θ m ={θ1,θ2,...,θ m } represents the accuracy of the model recorded in all current main tip transactions, F m ={F1,F2,...,F m } represents the data fairness of the recording model in all current main transaction tips; for the RSU node, when the tip is selected in the current time slot, the observed state information S r (t) It consists of three parts r (t) =[W i sum ,c i ,θ i ], where W i sum ={W1 sum ,W2 sum ,...,W i sum } is the cumulative weight of all cutting-edge transactions in the regularity DAG of the current RSU node, c i ={c1,c2,...,c i } is the number of verifications of all current tips, θ i ={θ1,θ2,...,θ i }Record the accuracy of the model for all current tips; The action space: The action space of the vehicle and RSU nodes consists of the selection decisions of all tips in the current tip pool of the node, represented as the action vector A (t) =[α1,α2,...,α n ; β1,β2,...,β m ], where α n ,β m ∈{0,1,α n represents the decision of the transaction, β m Indicates the selection decision for the main transaction; The reward function: In the reinforcement learning model, the agent is rewarded at each step in state S as it explores the best tip selection action towards the goal state. (t) Next, perform a possible action A (t) After acting on the environment, you will get an instant reward from environmental feedback; Define vehicle node rewards With RSU node rewards They are: The agent explores and selects actions A with the goal of maximizing the cumulative reward (t) , in any state, the reward value corresponding to the best tip selection decision action is the highest.

Citation Information

Patent Citations

  • Sensing edge cloud blockchain network trusted offload cooperation node selection system and method

    CN112202928A

  • Distributed intelligent auxiliary automatic driving method based on block chain

    CN116588138A

  • Federal learning system and method based on DAG block chain

    CN116702880A

  • Federal learning method, system and device based on contract theory incentive mechanism

    CN116862016A

  • Differential privacy federal learning method based on random election verification block chain

    CN117077806A

Cited By

  • Federal learning and block chain-based ultrasonic data verification method and system

    CN121834864A

  • An ultrasonic data verification method and system based on federated learning and blockchain

    CN121834864B