Blockchain-driven incentive mechanism and federated learning for vehicular network behavior detection
Through the blockchain-driven reward and punishment mechanism and federated learning method, the problems of network security, irrational resource allocation and insufficient data privacy protection in the Internet of Vehicles system are solved, and efficient and secure Internet of Vehicles behavior detection is achieved.
Patent Information
- Application Number
- CN202411632081.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The Internet of Vehicles system faces network security risks, irrational resource allocation, passive node participation, and insufficient data privacy protection. Traditional methods are unable to effectively address the security and transparency challenges of large-scale data processing and model training.
It adopts a blockchain-driven reward and punishment mechanism and federated learning method, incentivizes high-quality node participation through a reputation value evaluation mechanism, designs a pre-payment game mechanism to optimize resource utilization, and combines the Interstellar File System to store abnormal logs to ensure model security and transparency.
It improves the security, transparency and resource utilization efficiency of the Internet of Vehicles system, enhances the loyalty of nodes and the stability of the system, reduces resource waste and communication overhead, and improves the accuracy and efficiency of behavior detection.
Smart Images

Figure CN119363469B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of blockchain and Internet of Vehicles, and specifically relates to a vehicle Internet of Things behavior detection method using a blockchain-driven reward and punishment mechanism and federated learning in a blockchain-based vehicle Internet of Things system. BACKGROUND
[0002] With the development of information and communication technology (ICT), the Internet of Vehicles (IoV) aims to improve the efficiency of intelligent transportation systems through all-round connection between vehicles and the environment. However, with the popularity of autonomous vehicles (CAVs), the vehicle Internet of Things system becomes more complex, and the risk of cyber attacks increases significantly. According to relevant data, hundreds of vehicle network attack incidents have occurred in the past decade, highlighting the importance of network security. Many countries have enacted regulations to strengthen intrusion detection. Traditional machine learning and deep learning methods are difficult to cope with large-scale data processing problems in the vehicle Internet of Things due to resource limitations. Federated learning (FL) as a distributed machine learning method overcomes the storage and computing difficulties of centralized methods by training models locally and aggregating updates. However, FL relies on a central server for model aggregation, which has single-point failure and privacy security problems. To solve these challenges, the application introduces blockchain technology to build a decentralized federated learning architecture (BlockFL), which realizes safe storage and transparent recording of models, and enhances system security and transparency. In addition, the traditional blockchain reward and punishment mechanism has limitations in resource allocation, and some nodes do not participate due to resource shortages or high costs. Therefore, the application designs a blockchain prepayment game mechanism combined with reputation value evaluation to ensure high-quality nodes participate in training and improve the resource utilization efficiency of the system and the loyalty of participants. SUMMARY
[0003] The application aims to address the increasingly complex security challenges and resource limitations in the vehicle Internet of Things (IoV) and proposes a vehicle Internet of Things behavior detection method using a blockchain-driven reward and punishment mechanism and federated learning. First, a reputation value evaluation mechanism is introduced to measure the trustworthiness and contribution of autonomous vehicles (CAVs), encouraging high-quality nodes to participate and excluding bad nodes to ensure the safety and credibility of model training. Second, a dynamic anomaly detection method based on federated learning is proposed, which realizes dynamic aggregation of local models through a distributed node selection algorithm and records the optimal global model on the blockchain, improving the transparency and security of the system. In addition, a blockchain prepayment game mechanism is designed, which requires CAVs nodes to pay fees before training, and selects participants by combining reputation values to optimize resource utilization efficiency. The prepayment mechanism not only prevents resource waste, but also improves the loyalty and enthusiasm of participants through economic incentives, ensuring the stable operation of the system.
[0004] Technical Solution: A method for detecting IoV behavior in a blockchain-based IoV system using a blockchain-driven reward and punishment mechanism and federated learning. This method includes the following steps:
[0005] 1) Build a multi-level federated learning model driven by blockchain;
[0006] 2) Blockchain-based federated learning vehicle selection algorithm;
[0007] 3) Blockchain-based Internet of Vehicles federated learning optimization algorithm;
[0008] 4) Vehicle reward and punishment mechanism based on reputation value.
[0009] Furthermore, in step 1), a multi-level federated learning vehicle network anomaly system model driven by blockchain is constructed. The above network model is mainly divided into the following four layers:
[0010] Autonomous Vehicles (CAVs): The primary task of CAVs is to participate in the training of local intrusion detection models in federated learning using local data and to send the resulting parameters to the roadside unit (RSU). The local dataset only contains normal traffic, ensuring privacy. Each CAV acts as a worker node in federated learning, executing learning and training tasks through an onboard unit (OBU). CAVs can request access to multiple models from the RSU. Upon successful application, they download the latest block from the blockchain to obtain the latest global model and are required to participate in the global learning process.
[0011] Roadside Units (RSUs): RSUs play a core role in the model distribution and aggregation of CAVs model results. During the training of the intrusion detection model, the RSUs mainly undertake three key tasks. First, the RSUs use the federated learning vehicle selection algorithm to dynamically screen the CAVs nodes that are most suitable for participating in the federated learning (FL) model training to ensure the effectiveness and diversity of the training. Secondly, the RSUs aggregate the model application results of CAVs, review them through smart contracts, and distribute the required models. After the CAVs complete the model training, the RSUs use the federated learning model calculation method to aggregate and verify the model to ensure the accuracy of the results and create new blocks in the consensus process. Finally, before the federated learning task is started, the RSUs dynamically calculate and collect prepaid fees based on the CAV's reputation value and historical model training records. After the task is completed, rewards are issued based on the performance using the CAVs node's reward and punishment mechanism to encourage the active participation of participants.
[0012] Blockchain: This framework uses blockchain technology to ensure the security and transparency of federated learning model updates. Each roadside unit creates a trusted and immutable ledger for securely storing and distributing anomaly detection model updates. The decentralized nature of blockchain effectively prevents a single node from controlling the entire IoV network, minimizing the risk of data tampering and single points of failure.
[0013] InterPlanetary File System (IPFS): IPFS is used in conjunction with blockchain in this framework to store anomaly logs. When the IoV network system detects an anomaly, IPFS is used to store the anomaly log and generate a corresponding hash value. These hash values are then recorded on the blockchain to ensure the log's immutability and traceability. Anomaly detection system administrators regularly access and analyze anomaly logs stored in IPFS, using the analysis results to optimize the IoV anomaly detection system and continuously improve the federated learning training model to enhance the system's overall security and responsiveness.
[0014] Furthermore, in step 2), a blockchain-based federated learning vehicle selection algorithm is designed to calculate the prepayment amount of the node and select N max Nodes participate in federated learning.
[0015] Step 2-1: Calculate vehicle driving records
[0016]
[0017] Among them, γ1 and γ2 are the weight coefficients of driving records, VC i is the number of violation records, ML i For mileage.
[0018] Step 2-2: Calculate the complexity of the current task
[0019]
[0020] Among them, θ1 and θ2 are the weight coefficients of the complexity of the current task, D i is the data volume of the current task of node i (MB), is the single-round training time of model j of vehicle node i, T max Limiting the total training time for federated learning, EO i,j,max is the maximum number of convergence rounds of vehicle node i trained in model j obtained from historical records, and n is the number of models of vehicle i. and EO i,j,max A smaller value ensures that the number of training rounds does not exceed the maximum number of convergence rounds of the node to prevent overfitting.
[0021] Step 2-3: The total prepayment amount P i
[0022]
[0023] Among them, λ is the adjustment coefficient, which is used to adjust the overall level of prepayment amount, Reward i For the last reward, is the historical reputation value, DR i For driving records, BW i For network broadband.
[0024] Step 2-4: Based on the calculated prepayment amount P i , sort from high to low, select the top N max This method increases the prepayment amount by improving reputation value and reducing energy consumption, ensuring the participation of high-quality nodes, thereby improving model accuracy and efficiency, while enhancing node participation enthusiasm and data quality, and ensuring the fairness and efficiency of the federated learning process.
[0025] Furthermore, in step 3), a blockchain-based federated learning optimization algorithm for the Internet of Vehicles is invented. The federated learning network is considered as a monopoly market, which includes several operator headquarters (full roadside unit nodes), M operator branches (light roadside unit nodes) and N vehicle nodes. Vehicle node i is the data owner and has a local data sample size of S. i and multiple models. Each vehicle node can choose X i A model is used to participate in federated learning tasks. Samples consist of input-output pairs. The input samples contain data feature vectors of various messages, and the output samples are message traffic classifications used to determine the security of message communication. The model is used to classify message traffic on local data samples for training behavior detection of vehicle nodes in the Internet of Vehicles. Vehicle nodes contain multiple models and undergo a multi-level federated learning algorithm to improve the accuracy of federated learning and make behavior detection more precise.
[0026] Step 3-1: The aggregation of the federated learning model and the rewards and penalties assigned by the roadside unit light node to the vehicle node depend on the vehicle node's local reputation value. When a vehicle node registers to join the federated learning network, it must submit information such as the number of CPU cores, memory capacity, power supply capacity, and driver violation record to form a reputation attribute matrix (ReputationAttribute Matrix - RAM).
[0027] RAM={ra1,ra2,…,ra l ,…,ra m} (4)
[0028] Step 3-2: Calculate the initial reputation value IR of the vehicle node ii ,in Represents the reputation attribute ra g The related metric function of the credible measurement.
[0029]
[0030] Step 3-3: During the driving process, vehicle node i defines the local reputation value by the path transmission loss and the accuracy of the provided message, and feeds back the reputation generated in the area to the roadside unit. The local reputation value of the vehicle node in the calculation area is defined as:
[0031]
[0032] Where ω1 and ω2 represent the weights of path loss and message transmission accuracy, and λ1 and λ2 are additional parameters used to adjust the impact of path loss and message transmission accuracy. i Accuracy of the message:
[0033]
[0034] Where T and F represent the number of correct and incorrect messages sent by vehicle node i to the roadside unit light node in the federated learning network, respectively.
[0035] Step 3-4: Since the local reputation value of a vehicle is time-sensitive, the roadside unit light node for message transmission will change as the vehicle moves. Therefore, the local reputation of vehicle node i at time t is defined as the set If no information exchange occurs within time t, the initial reputation is used for assignment. When vehicle node i changes the roadside unit light node it communicates with, the weighted update method of the historical reputation value is used for update.
[0036]
[0037] in represents the local trust value of the τth history within the window time, and σ is a decay function used to control the weight of the historical trust value.
[0038] Step 3-7: The learning results θ generated by each model j of vehicle node i ij , uploaded to the roadside unit light node through transactions. θ ij The local precision ε is included ij and model parameters The light node of the roadside unit will be θ B ={θ1,θ2,…,θ i ,…θ M}Packed into blocks and uploaded to the blockchain (BC). And the learning results are initially aggregated to form a preliminary global model for model j
[0039]
[0040] Among them LR ix is the local reputation value between vehicle node i and roadside unit light node x, and t represents the number of rounds.
[0041] Step 3-8: The roadside unit light node will update the global model parameters The global model is broadcast to all vehicles so that they can be used in the next round of training. After the vehicle receives the global model, it is further trained and updated based on the local data model j. Training is repeated multiple times until the roadside unit light node converges on the local data model j or reaches a predetermined number of training rounds.
[0042]
[0043] Step 3-9: In order to obtain the best detection model for classification, the full RSU node uses the global model results of the q RSU light nodes in the federated learning network. The results are selected and optimized, where j = 1, 2, ..., q. The global model structure is divided into B seed models according to the model type. The weighted average fusion method is used to fuse the global parameter model of the roadside unit light node with the B model of q roadside unit light nodes to obtain the comprehensive global parameter model of the B model.
[0044]
[0045] Where b = 1, 2, …, B. The full roadside unit node fine-tunes each model using local data to further improve its accuracy. All optimized sub-models are deployed on the original vehicle node, and the optimal model is used for the actual message detection task. The remaining sub-models are used for the next global model training. New local data is continuously collected, and the models are regularly optimized and updated.
[0046] Furthermore, in step 4), a vehicle reward and punishment mechanism based on reputation value is constructed.
[0047] Step 4-1: Define the iterative computation time of the local training model j of vehicle node i.
[0048]
[0049] where f ij is the CPU cycle frequency of vehicle node i during the local model j training process. ijis the number of CPU cycles required for vehicle node i to train local model j using a single data sample.
[0050] Step 4-2: Calculate the CPU energy consumption of one iteration in the local training model j.
[0051]
[0052] in is the effective capacitance parameter of the computing chipset of vehicle node i. In each round of training, the learning rate η is dynamically adjusted according to the convergence of the model to accelerate model convergence and improve accuracy. During the global model training process, all vehicle nodes in the federated learning network undergo multi-level global iterations to achieve multi-model global learning. The vehicle node sends its local model update results to the roadside unit light node via wireless communication. The result contains ε ij is the local accuracy achieved by updating the local model j, corresponding to the local data quality of vehicle node i. ij The higher the value, the fewer the local iterations.
[0053] Step 4-3: Calculate the data transmission rate of vehicle node i.
[0054]
[0055] Among them BW i represents broadband, ρ i is the transmission power of the vehicle node, h i is the point-to-point channel gain from vehicle node i to roadside unit light node x, N0 is the background noise. Assuming that the data size updated by each model j of all vehicle nodes is the same, it is a constant σ j The transmission time for each vehicle node to update the local model j is
[0056] Step 4-4: The total time of global iteration includes the computation time of local iteration and the uplink communication time of local model update. Therefore, the total time for a vehicle node to participate in a global multi-level model iteration is
[0057]
[0058] Step 4-5: Calculate the transmission energy consumption of local model j of vehicle node i in the global iteration.
[0059]
[0060] Step 4-6: During one global iteration, the total energy consumption of vehicle node i is:
[0061]
[0062] Step 4-7: Finally, calculate the rewards and penalties received by vehicle node i in the federated learning network from the roadside unit light node x that issued the task. The calculation formula for its reward value Reward is:
[0063]
[0064] Among them, α, β, γ and δ are weight coefficients, which can be adjusted through experiments or experience to ensure the rationality and effectiveness of the reward and punishment mechanism; E i is the total energy consumption of vehicle i during a global iteration; T i is the global trust of the vehicle; FLPO is the result of the federated learning model; ε ij is the local accuracy of the model of vehicle i in predicting the message event of j, and n is the number of models of vehicle i.
[0065] Beneficial effects: The present invention is a method for detecting Internet of Vehicles (IoV) behavior using a blockchain-driven reward and punishment mechanism and federated learning, aiming to address the issues of insufficient data privacy, node trust, and system transparency in existing methods. By introducing a reputation value evaluation mechanism, the present invention dynamically measures the credibility and contribution of autonomous vehicles (CAVs) participating in federated learning, effectively manages and incentivizes node behavior, avoids the negative impact of selfish nodes on the system, and thus improves the overall efficiency and security of the system. At the same time, a dynamic anomaly detection method based on federated learning is proposed, which utilizes multi-level dynamic aggregation of vehicle local models and stores the optimal global model on the blockchain to achieve data transparency and immutability.
[0066] Furthermore, this paper proposes a blockchain-based prepayment game mechanism that optimizes resource utilization, enhances the loyalty of participating nodes and system stability in the connected vehicle environment, and avoids the performance degradation often associated with irrational resource allocation in traditional approaches. This mechanism effectively reduces unnecessary communication overhead and resource waste, and enhances the effectiveness of federated learning in detecting anomalies in connected vehicles. This invention provides a secure, efficient, and scalable solution for detecting connected vehicle behavior in intelligent transportation systems, laying the theoretical and technical foundation for future security management and anomaly detection in connected vehicles. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 A blockchain-driven multi-level federated learning model of vehicle network anomaly system.
[0068] Figure 2 Comparison of the accuracy of federated learning under five models.
[0069] Figure 3Savings value in federated learning varies with learning rounds. DETAILED DESCRIPTION
[0070] The technical method of the present invention will be further described in detail below with reference to the accompanying drawings.
[0071] like Figure 1 As shown in the figure, a multi-level federated learning model driven by blockchain is constructed. The above network model is mainly divided into the following four layers:
[0072] Autonomous Vehicles (CAVs): The primary task of CAVs is to participate in the training of local intrusion detection models in federated learning using local data and to send the resulting parameters to the roadside unit (RSU). The local dataset only contains normal traffic, ensuring privacy. Each CAV acts as a worker node in federated learning, executing learning and training tasks through an onboard unit (OBU). CAVs can request access to multiple models from the RSU. Upon successful application, they download the latest block from the blockchain to obtain the latest global model and are required to participate in the global learning process.
[0073] Roadside Units (RSUs): RSUs play a core role in the model distribution and aggregation of CAVs model results. During the training of the intrusion detection model, the RSUs mainly undertake three key tasks. First, the RSUs use the federated learning vehicle selection algorithm to dynamically screen the CAVs nodes that are most suitable for participating in the federated learning (FL) model training to ensure the effectiveness and diversity of the training. Secondly, the RSUs aggregate the model application results of CAVs, review them through smart contracts, and distribute the required models. After the CAVs complete the model training, the RSUs use the federated learning model calculation method to aggregate and verify the model to ensure the accuracy of the results and create new blocks in the consensus process. Finally, before the federated learning task is started, the RSUs dynamically calculate and collect prepaid fees based on the CAV's reputation value and historical model training records. After the task is completed, rewards are issued based on the performance using the CAVs node's reward and punishment mechanism to encourage the active participation of participants.
[0074] Blockchain: This framework uses blockchain technology to ensure the security and transparency of federated learning model updates. Each roadside unit creates a trusted and immutable ledger for securely storing and distributing anomaly detection model updates. The decentralized nature of blockchain effectively prevents a single node from controlling the entire IoV network, minimizing the risk of data tampering and single points of failure.
[0075] Interplanetary File System (IPFS): IPFS is used in this framework in conjunction with the blockchain to store abnormal logs. When the IoV network system detects abnormal events, IPFS is used to store abnormal logs and generate corresponding hash values, which are then recorded in the blockchain to ensure the non-tamperability and traceability of the logs. The abnormal detection system administrator regularly accesses and analyzes the abnormal logs stored in IPFS, uses the analysis results to optimize the IoV abnormal detection system, and continuously improves the federated learning training model to improve the overall security and response capability of the system.
[0076] In step 2, a blockchain-based federated learning vehicle selection algorithm is designed, and the prepayment amount of the computing node is calculated, and N max nodes are selected to participate in federated learning.
[0077] Step 2-1: Calculate vehicle driving record
[0078]
[0079] where γ1 and γ2 are the weight coefficients of the driving record, VC i is the number of violation records, and ML i is the driving mileage.
[0080] Step 2-2: Calculate current task complexity
[0081]
[0082] where θ1 and θ2 are the weight coefficients of the current task complexity, D i is the data volume (MB) of node i's current task, is the single-round training time of vehicle node i's model j, T max is the total training time limit of federated learning, EO i,j,max is the maximum convergence round number of vehicle node i's training in model j obtained through historical records, and n is the number of models of vehicle i. By taking the smaller value of and EO i,j,max , it is ensured that the training round number does not exceed the maximum convergence round number of the node to prevent overfitting.
[0083] Step 2-3: The prepayment amount P i
[0084]
[0085] where λ is an adjustment coefficient used to adjust the overall level of the prepayment amount, Reward i is the reward obtained last time, is the historical reputation value, DR i is the driving record, and BWi For network broadband.
[0086] Step 2-4: Based on the calculated prepayment amount P i , sort from high to low, select the first N max This method increases the prepayment amount by improving reputation value and reducing energy consumption, ensuring the participation of high-quality nodes, thereby improving model accuracy and efficiency, while enhancing node participation enthusiasm and data quality, and ensuring the fairness and efficiency of the federated learning process.
[0087] In step 3, a blockchain-based federated learning optimization algorithm for the Internet of Vehicles is invented. The federated learning network is considered as a monopoly market, which includes several operator headquarters (full roadside unit nodes), M operator branches (light roadside unit nodes) and N vehicle nodes. Vehicle node i is the data owner and has a local data sample size of S. i and multiple models. Each vehicle node can choose X i A model is used to participate in federated learning tasks. Samples consist of input-output pairs. The input samples contain data feature vectors of various messages, and the output samples are message traffic classifications used to determine the security of message communication. The model is used to classify message traffic on local data samples for training behavior detection of vehicle nodes in the Internet of Vehicles. Vehicle nodes contain multiple models and undergo a multi-level federated learning algorithm to improve the accuracy of federated learning and make behavior detection more precise.
[0088] Step 3-1: The aggregation of the federated learning model and the rewards and penalties assigned by the roadside unit light node to the vehicle node depend on the vehicle node's local reputation value. When a vehicle node registers to join the federated learning network, it must submit information such as the number of CPU cores, memory capacity, power supply capacity, and driver violation record to form a reputation attribute matrix (ReputationAttribute Matrix - RAM).
[0089] RAM={ra1,ra2,…,ra l ,…,ra m}
[0090] Step 3-2: Calculate the initial reputation value IR of the vehicle node i i ,in Represents the reputation attribute ra g The related metric function of the credible measurement.
[0091]
[0092] Step 3-3: Vehicle node i defines a local reputation value during its travel by path transmission loss and the accuracy of the provided messages, and feeds the reputation generated within the region back to the road-side unit. The local reputation value of vehicle node i within the region is defined as:
[0093]
[0094] where ω1and ω2represent the weights of path loss and message transmission accuracy, λ1and λ2are additional parameters to adjust the influence of path loss and message transmission accuracy. Ture i Message accuracy:
[0095]
[0096] where T, F represent the number of correct and incorrect messages sent by vehicle node i to the road-side unit light node in the federated learning network, respectively.
[0097] Step 3-4: Since the local reputation value of the vehicle is time-sensitive, the road-side unit light node that performs message passing will change as the vehicle moves. Therefore, the local reputation of vehicle node i is defined as a function of time t If no information interaction occurs within time t, the initial reputation is assigned. When the road-side unit light node that vehicle node i communicates with changes, the historical reputation value is updated using a weighted update method.
[0098]
[0099] where represents the local reputation value of the τth history within the window time, and σ is a decay function that controls the weight of the historical reputation value.
[0100] Step 3-5: The learning achievement θ ij of each model j of vehicle node i is uploaded to the road-side unit light node through transaction. θ ij contains local precision ε ij and model parameters The road-side unit light node packs θ B = {θ1, θ2, …, θ i , …, θ M} into a block and uploads it to the blockchain (BC). The learning achievement is preliminarily aggregated, and a preliminary global model
[0101]
[0102] where LR ixis the local reputation value between vehicle node i and roadside unit light node x, and t represents the round number.
[0103] Step 3-6: The roadside unit light node broadcasts the updated global model parameters to all vehicles so that they use them in the next round of training. After the vehicles receive the global model, further training and updating are performed based on the local data model j. The training is repeated multiple times until the roadside unit light node converges or reaches a predetermined number of training rounds for the local data model j.
[0104]
[0105] Step 3-7: In order to obtain the best detection model for classification, the roadside unit full node combines the global model results of the q roadside unit light nodes in the federated learning network The results are selected and optimized, where j = 1, 2,..., q. According to The global model structure is split into B seed models according to the model category, and the global parameter model of the roadside unit light node is fused using a weighted average fusion method for the B models of the q roadside unit light nodes, resulting in a comprehensive global
[0106]
[0107] where b = 1, 2,..., B. The roadside unit full node fine-tunes each model using local data to further improve its accuracy. All optimized sub-models are selected and deployed on the original vehicle nodes, and the best model is used for actual message detection tasks. Other sub-models are used for the next global model training, continuously collecting new local data, and regularly optimizing and updating the model.
[0108] In step 4, a reputation value-based vehicle reward and punishment mechanism is constructed.
[0109] Step 4-1: Define the iterative computation time of the local training model j of vehicle node i.
[0110]
[0111] where f ij is the CPU cycle frequency of vehicle node i during the training of local model j. c ij is the number of CPU cycles required by vehicle node i during the training of local model j using a single data sample. is
[0112] Step 4-2: Calculate the CPU energy consumption of one iteration of the local training model j.
[0113]
[0114] in is the effective capacitance parameter of the computing chipset of vehicle node i. In each round of training, the learning rate η is dynamically adjusted according to the convergence of the model to accelerate model convergence and improve accuracy. During the global model training process, all vehicle nodes in the federated learning network undergo multi-level global iterations to achieve multi-model global learning. The vehicle node sends its local model update results to the roadside unit light node via wireless communication. The result contains ε ij is the local accuracy achieved by updating the local model j, corresponding to the local data quality of vehicle node i. ij The higher the value, the fewer the local iterations.
[0115] Step 4-3: Calculate the data transmission rate of vehicle node i.
[0116]
[0117] Among them BW i represents broadband, ρ i is the transmission power of the vehicle node, h i is the point-to-point channel gain from vehicle node i to roadside unit light node x, N0 is the background noise. Assuming that the data size updated by each model j of all vehicle nodes is the same, it is a constant σ j The transmission time for each vehicle node to update the local model j is
[0118] Step 4-4: The total time of global iteration includes the computation time of local iteration and the uplink communication time of local model update. Therefore, the total time for a vehicle node to participate in a global multi-level model iteration is
[0119]
[0120] Step 4-5: Calculate the transmission energy consumption of local model j of vehicle node i in the global iteration.
[0121]
[0122] Step 4-6: During one global iteration, the total energy consumption of vehicle node i is:
[0123]
[0124] Step 4-7: Finally, calculate the rewards and penalties received by vehicle node i in the federated learning network from the roadside unit light node x that issued the task. The calculation formula for its reward value Reward is:
[0125]
[0126] Among them, α, β, γ and δ are weight coefficients, which can be adjusted through experiments or experience to ensure the rationality and effectiveness of the reward and punishment mechanism; E i is the total energy consumption of vehicle i during a global iteration; T i is the global trust of the vehicle; FLPO is the result of the federated learning model; ε ij is the local accuracy of the model of vehicle i in predicting the message event of j, and n is the number of models of vehicle i.
[0127] The present invention addresses the issues of privacy protection, node selection, and resource utilization efficiency in existing federated learning for IoV behavior detection, and proposes a blockchain-driven federated learning behavior detection optimization framework. First, the present invention designs a multi-level federated learning method based on a vehicle selection algorithm, which can dynamically select distributed autonomous vehicles (CAVs) to participate in local model training, and aggregate the optimal global model in the roadside unit (RSU) through a weighted average algorithm, and record the model on the blockchain to improve the transparency and network security of the system. Secondly, a reputation value evaluation mechanism is constructed to measure the credibility and contribution of CAVs nodes, and an incentive mechanism is used to encourage active nodes, punish or exclude poorly performing nodes, and improve system fairness and node participation. Finally, a blockchain-based prepayment reward mechanism is proposed, which requires CAVs nodes to make prepayments before participating in model training, and rewards nodes after generating a global model, so as to optimize resource utilization efficiency and enhance the stability and effectiveness of federated learning.
[0128] The above is only an implementation method of the present invention under the blockchain-based Internet of Vehicles model. The scope of protection of the present invention is not limited to the above implementation method. Any equivalent modifications and other modifications made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the scope of protection recorded in the claims.
Claims
1. A blockchain-driven reward and punishment mechanism and a federated learning-based vehicle network behavior detection method, characterized by: The following steps are involved: Step 1: The roadside unit uses the federated learning vehicle selection algorithm to dynamically select the most suitable autonomous vehicle nodes for participating in the federated learning model training. The prepaid amount serves as a deposit for the autonomous vehicle to participate in the federated learning. Step 2: The autonomous vehicle requests the latest parameters of the locally trained model in federated learning from the roadside unit. The roadside unit aggregates the model application results of the autonomous vehicle, reviews them through the smart contract, and distributes the required model. Step 3: After successfully applying for the model, the autonomous vehicle downloads the latest block of the blockchain to obtain the latest global model parameters. The autonomous vehicle then uses local data to participate in the local training model training in federated learning. The federated learning model includes several roadside unit full nodes, M roadside unit light nodes, and N vehicle nodes. The roadside unit full nodes form the blockchain. Step 4: The autonomous vehicle transmits the learning results generated by local training to the light node of the roadside unit. After receiving the learning results, the light node uploads them to the full node of the roadside unit. After the consensus process, all nodes upload the learning results to the chain and aggregate the models of each participating node through the federated learning method to generate a global model; Subsequently, the RSU broadcasts the parameters of the global model to all autonomous vehicles participating in federated learning; After receiving the global model parameters, the autonomous vehicle will further train and update based on its own local training model. Step 4 specifically includes: Step 4-1: The learning results θ generated by each model j of vehicle node i ij , uploaded to the roadside unit light node through transactions; θ ij The local precision ε is included ij and model parameters The roadside unit light node will θ B ={θ1,θ2,…,θ i ,…θ M The learning results are initially aggregated and the preliminary global model of model j is formed. The calculation formula is: Among them LR ix is the local reputation value between vehicle node i and roadside unit light node x, t represents the number of rounds; Step 4-2: The roadside unit light node will update the global model parameters Broadcast to all vehicles participating in federated learning so that they can use it in the next round of training; after the vehicle receives the global model, further training and updating are performed based on the local data model j; training is repeated multiple times until the roadside unit light node converges for the local data model j or reaches the predetermined number of training rounds. The calculation formula is: Step 5: The RSU full node performs weighted average fusion on the global model parameters of the RSU light nodes to obtain a comprehensive global model, and broadcasts the comprehensive global model to all RSU light nodes; Step 6: Compare the local model training of the autonomous driving vehicle with the global model, and give a certain amount of reward to the autonomous driving vehicle participating in federated learning based on the accuracy and reputation value of the model.
2. The blockchain-driven reward and punishment mechanism and federated learning vehicle network behavior detection method according to claim 1 is characterized by: Step 1 specifically includes: Step 1-1: Calculate the driving record DR of vehicle node i i , the calculation formula is: Among them, γ1 and γ2 are the weight coefficients of driving records, VC i is the number of violation records, ML i is the mileage; Step 1-2: Calculate the current task complexity TC of vehicle node i i : Among them, θ1 and θ2 are the weight coefficients of the complexity of the current task, D i is the data volume of the current task of node i, is the single-round training time of model j of vehicle node i, T max Limiting the total training time for federated learning, EO i,j,max is the maximum number of convergence rounds of vehicle node i trained in model j obtained from historical records, and n is the number of models of vehicle i; Step 1-3: Calculate the prepayment amount P i : Among them, λ is the adjustment coefficient, which is used to adjust the overall level of prepayment amount, Reward i For the last reward, is the historical reputation value, DR i For driving records, BW i For network width; Step 1-4: Based on the calculated prepayment amount P i , sort from high to low, select the first N max Nodes participate in federated learning.
3. The blockchain-driven reward and punishment mechanism and federated learning vehicle network behavior detection method according to claim 2 is characterized by: Step 5 specifically includes: the full roadside unit node is based on the global model results of q roadside unit light nodes in the federated learning network The results are selected and optimized, where j = 1, 2, ..., q; according to The global model structure is divided into B seed models according to the model type. The weighted average fusion method is used to fuse the global parameter model of the roadside unit light node with the B model of q roadside unit light nodes to obtain the comprehensive global parameter model of the B model. Where b = 1, 2, …, B; all roadside unit nodes use local data to fine-tune each model to improve model accuracy; all optimized sub-models are selected and deployed on the original vehicle node, and the best model is used for actual message detection tasks; other sub-models are used for the next global model training, and new local data is continuously collected to regularly optimize and update the model.
4. The blockchain-driven reward and punishment mechanism and federated learning vehicle network behavior detection method according to claim 2 is characterized by: Step 6 specifically includes: before starting the federated learning task, the roadside unit dynamically calculates and collects a prepaid deposit based on the reputation value of the autonomous vehicle and historical model training records. After the task is completed, rewards are distributed based on performance using the autonomous vehicle node's reward and punishment mechanism to encourage the active participation of participants. The specific steps include: Step 6-1: When registering a vehicle node to join the federated learning network, it is necessary to submit the device's CPU core number, memory capacity, power capacity, and driver violation record information to form a reputation attribute set. RAM={ra1,ra2,…,ra l ,…,on m } Step 6-2: Calculate the initial reputation value IR of the vehicle node i i ,in Represents the reputation attribute ra l The relevant metric function of the credible measurement is calculated as follows: Step 6-3: During the driving process, vehicle node i defines the local reputation value by the path transmission loss and the accuracy of the provided message, and feeds back the reputation generated in the area to the roadside unit. The local reputation value of the vehicle node in the area is calculated and defined as: Where ω1 and ω2 represent the weights of path loss and message transmission accuracy, and λ1 and λ2 are additional parameters used to adjust the impact of path loss and message transmission accuracy; Ture i Accuracy of the message: Where T and F represent the number of correct and incorrect messages sent by vehicle node i to the roadside unit light node in the federated learning network, respectively; Step 6-4: Define the set of local reputations of vehicle node i with respect to round number t If no information exchange is performed within round t, the initial reputation is used for assignment; when vehicle node i changes the roadside unit light node to communicate, the weighted update method of the historical reputation value is used for update in represents the local trust value of the τth history within a fixed number of rounds, and σ is a decay function used to control the weight of the historical trust value; Step 6-5: Calculate the rewards and penalties received by vehicle node i in the federated learning network from the roadside unit light node x that issues the task. The calculation formula for its reward value Reward is: Among them, α, β, γ and δ are weight coefficients; E i is the total energy consumption of vehicle i during a global iteration; T i is the global trust of the vehicle; FLPO is the result of the federated learning model; ε ij is the local accuracy of model j for vehicle i, and n is the number of models for vehicle i.
5. A blockchain-driven reward and punishment mechanism and federated learning vehicle network behavior detection system based on the method described in any one of claims 1-4, characterized in that: including autonomous vehicles, roadside units, blockchain, and the InterPlanetary File System; Autonomous vehicles use local data to participate in local model training in federated learning and send the parameters of the training results to the roadside unit. Each autonomous vehicle acts as a working node in federated learning and performs learning and training tasks through the vehicle-mounted unit. Autonomous vehicles apply to the roadside unit for the use of multiple models. If the application is successful, the autonomous vehicle downloads the latest block of the blockchain to obtain the latest global model and must participate in the global learning process. The RSU's tasks include: using the federated learning vehicle selection algorithm to dynamically select the most suitable autonomous vehicle nodes for participating in federated learning model training; aggregating the model application results of autonomous vehicles, reviewing and distributing the required models through smart contracts; and after the autonomous vehicles complete model training, the RSU uses the federated learning model calculation method to aggregate and verify the model to ensure the accuracy of the results and create new blocks during the consensus process. Before the start of a federated learning task, a prepaid fee is dynamically calculated and collected based on the reputation value of the autonomous vehicle and its historical model training records. After the task is completed, rewards are distributed based on performance using the autonomous vehicle node's reward and punishment mechanism to encourage active participation. The blockchain consists of trusted and immutable blocks created by each autonomous vehicle for securely storing and distributing updates to anomaly detection models. The function of the InterPlanetary File System is: when the Internet of Vehicles detects an abnormal event, the InterPlanetary File System is used to store the abnormality log and generate corresponding hash values, which are then recorded in the blockchain.
Citation Information
Patent Citations
Autonomous vehicle credible lane changing method based on block chain and federal reinforcement learning
CN115660077A
Internet of Things intrusion detection method, system and equipment
CN118250042A