Layered federal learning model training method and device, equipment and medium
By adopting hierarchical federated learning method and blockchain technology in the Internet of Vehicles environment, combined with the adaptive gradient alignment mechanism, data heterogeneity, communication overhead and security problems in the Internet of Vehicles are solved, efficient and accurate distributed model training is achieved, and the reliability of the system is enhanced.
Patent Information
- Application Number
- CN202510109822.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-01-23
AI Technical Summary
In the Internet of Vehicles environment, due to the heterogeneity of vehicle node data, the node gradient direction is inconsistent during model training, resulting in slow convergence of the global model and poor training effect. At the same time, there is a risk of high communication overhead and malicious node attacks.
The hierarchical federated learning method is adopted, and by dividing the Internet of Vehicles into a vehicle layer, an intermediate coordination layer and a global coordination layer, combining blockchain technology and an adaptive gradient alignment mechanism, the gradient alignment and consensus mechanism are optimized, so as to reduce communication overhead and improve data security.
It significantly improves the efficiency and accuracy of distributed model training in the Internet of Vehicles environment, reduces communication overhead, enhances data quality and security, avoids the risk of attacks from malicious nodes, and improves the robustness and reliability of the system.
Smart Images

Figure CN120050299A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the technical field of federated learning models, and in particular to a hierarchical federated learning model training method, device, equipment and medium. Background Art
[0002] Federated learning is used as a distributed model training method in the Internet of Vehicles environment to achieve data collaborative training between vehicle nodes and reduce the risk of data privacy leakage. However, due to the different data sources of vehicle nodes in the Internet of Vehicles and the large data heterogeneity, traditional federated learning methods are difficult to solve the problem of inconsistent node gradient directions during model training, resulting in slow convergence of the global model and poor training results. At the same time, the communication resources in the Internet of Vehicles are limited. Vehicle nodes frequently upload gradients or model parameters during training, resulting in excessive communication overhead, further exacerbating network congestion and making it difficult to meet the requirements of the Internet of Vehicles for high real-time performance and high efficiency. In addition, some malicious nodes may upload abnormal gradients, interfere with model training through poisoning attacks and other means, and reduce the reliability of the global model.
[0003] In order to improve the credibility of data, the existing technology introduces blockchain technology into the federated learning framework, and ensures the security and immutability of data through distributed ledger storage and consensus mechanism. However, the existing consensus mechanisms, such as proof of work and traditional Byzantine fault-tolerant protocols, have problems such as high computational complexity and low consensus efficiency, which are difficult to meet the actual needs of high-dynamic and large-scale Internet of Vehicles. In addition, the single-layer blockchain architecture further increases the communication and storage burden of the system, reducing the overall training efficiency.
[0004] In view of the shortcomings of the prior art, the present invention proposes a hierarchical federated learning method based on blockchain and adaptive gradient alignment. Summary of the invention
[0005] The present invention provides a hierarchical federated learning model training method, device, equipment and medium, aiming to solve the above-mentioned problems.
[0006] The embodiment of the present invention provides a hierarchical federated learning model training method, including:
[0007] S1. Based on the overall architecture of the Internet of Vehicles, the Internet of Vehicles is divided into a vehicle layer, an intermediate coordination layer, and a global coordination layer. The vehicle layer includes multiple vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients.
[0008] S2, the intermediate coordination layer receives the local gradient uploaded by the vehicle node, divides the similar nodes in the vehicle node into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated;
[0009] S3. The roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after the preliminary alignment. The preset alignment mechanism adjusts the average gradient of the preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer;
[0010] S4. The global coordination layer uses the first-stage consensus mechanism to screen trusted vehicle nodes by evaluating the gradient consistency and data quality of the update gradient uploaded by the intermediate coordination layer;
[0011] S5. The gradients of the screened trusted vehicle nodes are globally aggregated through the second-stage consensus mechanism to generate the final hierarchical federated learning model parameters, and the hierarchical federated learning model parameters are fed back to the intermediate coordination layer and vehicle layer for distribution.
[0012] An embodiment of the present invention provides a hierarchical federated learning model training device, comprising:
[0013] The local gradient module divides the Internet of Vehicles into a vehicle layer, an intermediate coordination layer, and a global coordination layer based on the overall architecture of the Internet of Vehicles. The vehicle layer includes multiple vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients.
[0014] A preliminary alignment module, wherein the intermediate coordination layer receives the local gradients uploaded by the vehicle nodes, divides the similar nodes in the vehicle nodes into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated;
[0015] In the full alignment module, the roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after preliminary alignment. The preset alignment mechanism adjusts the average gradient of preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer;
[0016] Gradient verification module: the global coordination layer uses the first-stage consensus mechanism to evaluate the gradient consistency and data quality of the updated gradient uploaded by the intermediate coordination layer to screen the trusted vehicle nodes;
[0017] The distribution module globally aggregates the gradients of the screened trusted vehicle nodes through the second-stage consensus mechanism, generates the final hierarchical federated learning model parameters, and feeds the hierarchical federated learning model parameters back to the intermediate coordination layer and vehicle layer for distribution.
[0018] An embodiment of the present invention provides an electronic device, including:
[0019] processor; and,
[0020] A memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the steps of the above-mentioned hierarchical federated learning model training method.
[0021] An embodiment of the present invention provides a storage medium for storing computer-executable instructions, which, when executed, implement the steps of the above-mentioned hierarchical federated learning model training method.
[0022] The present invention significantly improves the efficiency and accuracy of distributed model training in the Internet of Vehicles environment by introducing a hierarchical federated learning system and method based on blockchain and adaptive gradient alignment. Compared with the prior art, the present invention can better cope with the heterogeneity problem of node data in the Internet of Vehicles, and effectively accelerates the convergence process of the global model through the multi-round gradient alignment mechanism of the intermediate coordination layer and the global coordination layer, avoiding the degradation of training performance caused by inconsistent data between nodes. The present invention also optimizes the coordination and communication mechanisms at different levels in the Internet of Vehicles through the design of a hierarchical architecture, reduces the need for frequent gradient uploads between vehicle nodes, and thus greatly reduces communication overhead. By combining dynamic weight allocation with a consensus mechanism, the influence of low-quality gradients can be effectively avoided, the data quality and security in the training process can be further improved, the risk of attack by malicious nodes can be avoided, and the robustness and reliability of the system can be enhanced. The present invention also ensures the immutability and credibility of data upload through blockchain technology, making the model training process in the Internet of Vehicles more transparent and traceable. At the same time, the adoption of a lightweight consensus mechanism reduces the computational burden of the system, ensures efficient real-time processing capabilities, and adapts to the complex and dynamic requirements in the Internet of Vehicles environment. The present invention not only solves the problem of distributed training in the Internet of Vehicles environment technically, but also brings considerable benefits at the economic and social levels. By optimizing the use of communication and computing resources, it reduces the network burden, improves the efficiency and security of Internet of Vehicles applications, and plays an important role in promoting practical applications in the fields of intelligent transportation, autonomous driving, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate one or more embodiments of this specification 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 only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0024] Figure 1A flowchart of a hierarchical federated learning model training method according to an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of a hierarchical federated learning model training device according to an embodiment of the present invention;
[0026] Figure 3 A schematic diagram of a vehicle layer, an intermediate coordination layer, and a global coordination layer of a hierarchical federated learning method according to an embodiment of the present invention;
[0027] Figure 4 This is a flowchart of a global model update based on adaptive gradient alignment according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0029] Method Embodiment
[0030] According to an embodiment of the present invention, a hierarchical federated learning model training method is provided. Figure 1 is a flowchart of the hierarchical federated learning model training method according to an embodiment of the present invention. Figure 1 As shown, the hierarchical federated learning model training method of the embodiment of the present invention specifically includes:
[0031] S1. Based on the overall architecture of the Internet of Vehicles, the Internet of Vehicles is divided into a vehicle layer, an intermediate coordination layer, and a global coordination layer. The vehicle layer includes multiple vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients.
[0032] The vehicle layer is the first layer of the entire system, which is mainly responsible for using the local data of the vehicle node for model training. In the Internet of Vehicles, the vehicle node collects real-time data around it through the on-board unit, such as road images, obstacle detection, vehicle speed and other information.
[0033] For example, an autonomous vehicle equipped with a high-precision camera can use the images collected by the on-board sensors to identify traffic signs and driving routes. The vehicle node uses the 100 collected images as a local data set and uses this data for model training. Figure 3A schematic diagram of a vehicle layer, an intermediate coordination layer, and a global coordination layer of a hierarchical federated learning method according to an embodiment of the present invention;
[0034] At the beginning of each round of training, the vehicle node receives the initial global model parameters from the global coordination layer. The vehicle node trains its model on the local dataset using the mini-batch stochastic gradient descent method and calculates its local gradient as follows:
[0035]
[0036] in, B is a small batch of samples randomly drawn from the local dataset, For sample x The loss function gradient of . Through the above formula, the vehicle node can train the model according to the local data set and calculate the gradient. After the calculation is completed, the vehicle node uploads the updated local gradient to the intermediate coordination layer.
[0037] S2, the intermediate coordination layer receives the local gradient uploaded by the vehicle node, divides the similar nodes in the vehicle node into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated;
[0038] The middle coordination layer is the second layer of the system. It is mainly responsible for receiving the gradients uploaded by the vehicle layer and reducing the gradient deviation caused by data heterogeneity through the alignment mechanism. The specific flow chart is shown in Figure 3 The roadside unit in the middle coordination layer first divides the vehicle nodes into different sets based on the similarity of the data according to the gradient information uploaded by the vehicle nodes. For example, vehicle nodes in the same area are assigned to the same set because the collected road condition data are similar.
[0039] The gradients within each set are averaged and preliminarily aligned using the following formula:
[0040]
[0041] in, η is the learning rate, λ is the alignment strength parameter, which is a hyperparameter that controls the degree of alignment between the local gradient and the average gradient of similar nodes. Represents the average gradient of a set of similar nodes, calculated as:
[0042]
[0043] For example, if the gradient of a vehicle node deviates significantly from the ensemble average gradient, the above formula can adjust its gradient to a direction closer to the ensemble average gradient, thereby reducing the impact of data heterogeneity on model training.
[0044] S3. The roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after the preliminary alignment. The preset alignment mechanism adjusts the average gradient of the preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer;
[0045] In order to further optimize the contribution of each node, the intermediate coordination layer also calculates the gradient deviation value of each node to measure the consistency between the node local gradient and the ensemble average gradient. The calculation formula is:
[0046]
[0047] in Representation Node v The Euclidean distance between the local gradient of and the average gradient of a set of similar nodes, σ is a positive tuning parameter that controls the sensitivity of the gradient difference. The difference measure S i The value of is between [0, 1]. The closer the value is to 1, the more consistent the gradient direction of node i is with the average gradient direction of similar nodes, reflecting the reliability of its gradient. The closer the value is to 0, the greater the deviation. v value, and further adjust the weight of each node. The weight calculation formula is:
[0048]
[0049] Among them, Q v Q is the data quality of the node, which reflects the representativeness of the node data. For example, a node with more sensors will have a higher Q v value, thereby obtaining a larger weight in the global model. To ensure global weight normalization, the following formula is used:
[0050]
[0051] Finally, after weight normalization, based on the aligned gradient and weight Perform the final model parameter update:
[0052]
[0053] S4. The global coordination layer uses the first-stage consensus mechanism to screen trusted vehicle nodes by evaluating the gradient consistency and data quality of the update gradient uploaded by the intermediate coordination layer;
[0054] The global coordination layer is the third layer of the system, responsible for verifying the gradients uploaded by the intermediate coordination layer and ensuring that the contribution of each gradient conforms to the global optimization goal. Each roadside unit initially aligns the gradient data of the vehicle nodes under its jurisdiction and generates local gradients These local gradients, together with the information related to the adaptive alignment mechanism, are packed to form candidate blocks. The core information in the candidate blocks includes local model parameters, local gradients, the reputation scores of roadside units, and metadata (roadside unit ID, timestamp, signature, etc.). A reputation verification mechanism is introduced to filter out trustworthy candidate blocks. The reputation score of a roadside unit is dynamically calculated by the mean of the gradient difference metric S RSU and the mean of the data quality Q RSU The specific formula is as follows:
[0055]
[0056] R RSU = S RSU ·Q RSU ;
[0057] Only the candidate blocks with a reputation score R RSU exceeding the dynamic threshold R th will be accepted into the next stage. The threshold R th is dynamically adjusted, and the specific calculation is as follows:
[0058]
[0059] where γ is the smoothing factor, is the average reputation score of all roadside units. For example, when the gradient consistency of the vehicle nodes managed by a certain roadside unit is relatively high and its data quality is good, its reputation score is relatively high, and the gradients uploaded by this roadside unit will be considered more contributive to the global optimization. The global coordination layer selects the trusted gradients to participate in the global aggregation by calculating the reputation scores of roadside units. As Figure 4 shown is the flowchart of the global model update based on adaptive gradient alignment in an embodiment of the present invention.
[0060] S5. Through the second-stage consensus mechanism, globally aggregate the gradients of the screened trustworthy vehicle nodes to generate the final hierarchical federated learning model parameters, and feedback the hierarchical federated learning model parameters to the intermediate coordination layer and the vehicle layer for distribution.
[0061] After the first-stage consensus is completed, the trusted gradients are weighted and aggregated by the global coordination layer, and the formula is as follows:
[0062]
[0063] This formula ensures that roadside units with higher reputation scores contribute more to the global model update by weighted average. In practical applications, multiple roadside units are responsible for data in different areas, and the global gradient generated in the end will represent the optimization direction of the entire Internet of Vehicles system.
[0064] Finally, the global model parameters are updated using the global gradient, using the formula:
[0065]
[0066] The updated global model parameters will be propagated to the vehicle layer through the intermediate coordination layer to complete this round of training, and the results of this round of training will be packaged to generate a new block and stored in the blockchain. The generation of a new block requires the aggregation of candidate blocks from multiple roadside units. Only when a sufficient number of candidate blocks pass verification can a formal block be formed. The structure of the new block includes the following: Block body: stores the global gradient of this round of training List of participating roadside units and the credit score R of each roadside unit RSU , and related metadata. Block header: includes the hash value of the previous block, the timestamp of the current block, block version information, and the Merkle tree root.
[0067] For roadside units with a reputation score below the threshold, the global coordination layer returns feedback information to promote dynamic optimization within the roadside unit. The roadside unit adjusts similar node alignment strength, learning rate, and improves data quality parameters based on the feedback information to improve the gradient consistency and representativeness of the next round of candidate blocks. Through these adaptive adjustments, the roadside unit strives to obtain a higher reputation score in future consensus to ensure that the gradients it uploads contribute more to the optimization of the global model.
[0068] The present invention provides a blockchain-enhanced hierarchical federated learning method, which is applicable to the problems of data heterogeneity, communication overhead and security in the Internet of Vehicles environment. By designing a hierarchical architecture of the vehicle layer, the intermediate coordination layer and the global coordination layer, combined with the adaptive gradient alignment mechanism and the gradient alignment proof consensus mechanism, efficient optimization of the global model is achieved.
[0069] The embodiments of the present invention have the following beneficial effects:
[0070] The present invention significantly improves the efficiency and accuracy of distributed model training in the Internet of Vehicles environment by introducing a hierarchical federated learning system and method based on blockchain and adaptive gradient alignment. Compared with the prior art, the present invention can better deal with the heterogeneity of node data in the Internet of Vehicles, and effectively accelerates the convergence process of the global model through the multi-round gradient alignment mechanism of the intermediate coordination layer and the global coordination layer, avoiding the degradation of training performance caused by inconsistent data between nodes.
[0071] In addition, the present invention optimizes the coordination and communication mechanisms at different levels in the Internet of Vehicles through the design of a layered architecture, reduces the need for frequent gradient uploads between vehicle nodes, and thus significantly reduces communication overhead. By combining dynamic weight allocation with a consensus mechanism, the influence of low-quality gradients can be effectively avoided, further improving the data quality and security during the training process, avoiding the risk of attacks from malicious nodes, and enhancing the robustness and reliability of the system.
[0072] The present invention also ensures the immutability and credibility of data upload through blockchain technology, making the model training process in the Internet of Vehicles more transparent and traceable. At the same time, the use of a lightweight consensus mechanism reduces the system's computing burden, ensures efficient real-time processing capabilities, and adapts to the complex and dynamic requirements of the Internet of Vehicles environment.
[0073] In general, the present invention not only solves the problem of distributed training in the Internet of Vehicles environment in terms of technology, but also brings considerable benefits at the economic and social levels. By optimizing the use of communication and computing resources, the network burden is reduced, the efficiency and security of Internet of Vehicles applications are improved, and it plays an important role in promoting practical applications in the fields of intelligent transportation, autonomous driving, etc.
[0074] Device Example 1
[0075] According to an embodiment of the present invention, a hierarchical federated learning model training device is provided. Figure 2 Schematic diagram of a hierarchical federated learning model training device according to an embodiment of the present invention. Figure 2 As shown, the hierarchical federated learning model training device of the embodiment of the present invention specifically includes:
[0076] The local gradient module 20 divides the Internet of Vehicles into a vehicle layer, an intermediate coordination layer, and a global coordination layer based on the overall architecture of the Internet of Vehicles. The vehicle layer includes a plurality of vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients.
[0077] A preliminary alignment module 22, wherein the intermediate coordination layer receives the local gradients uploaded by the vehicle nodes, divides the similar nodes in the vehicle nodes into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated;
[0078] The complete alignment module 24, the roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after the preliminary alignment. The preset alignment mechanism adjusts the average gradient of the preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, and optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer;
[0079] Gradient verification module 26, the global coordination layer uses the first-stage consensus mechanism to evaluate the gradient consistency and data quality of the updated gradient uploaded by the intermediate coordination layer to select the trusted vehicle nodes;
[0080] The distribution module 28 globally aggregates the gradients of the screened trusted vehicle nodes through the second-stage consensus mechanism, generates the final hierarchical federated learning model parameters, and feeds back the hierarchical federated learning model parameters to the intermediate coordination layer and the vehicle layer for distribution.
[0081] This device embodiment is a device embodiment that corresponds one-to-one to the above method embodiment. For specific implementation methods, please refer to the contents of the above method embodiment, which will not be repeated here.
[0082] Device Example 2
[0083] According to an embodiment of the present invention, there is provided an electronic device, including:
[0084] processor; and,
[0085] A memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the steps as described in the above method embodiment.
[0086] Device Example 3
[0087] A storage medium is used to store computer executable instructions, and the computer executable instructions, when executed, implement the steps described in the above method embodiment.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A hierarchical federated learning model training method, characterized in that include: S1. Based on the overall architecture of the Internet of Vehicles, the Internet of Vehicles is divided into a vehicle layer, an intermediate coordination layer, and a global coordination layer. The vehicle layer includes multiple vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients. S2, the intermediate coordination layer receives the local gradient uploaded by the vehicle node, divides the similar nodes in the vehicle node into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated; S3. The roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after the preliminary alignment. The preset alignment mechanism adjusts the average gradient of the preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer; S4. The global coordination layer uses the first-stage consensus mechanism to screen trusted vehicle nodes by evaluating the gradient consistency and data quality of the update gradient uploaded by the intermediate coordination layer; S5. The gradients of the screened trusted vehicle nodes are globally aggregated through the second-stage consensus mechanism to generate the final hierarchical federated learning model parameters, and the hierarchical federated learning model parameters are fed back to the intermediate coordination layer and vehicle layer for distribution.
2. The method according to claim 1, characterized in that The vehicle node trains the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain the local gradient, specifically including: The vehicle node collects surrounding real-time data through the vehicle-mounted unit, and pre-processes the real-time data as a local data set; The vehicle node receives the initial hierarchical federated learning model parameters from the global coordination layer, trains the hierarchical federated learning model on the local dataset using the mini-batch stochastic gradient descent method, and calculates the local gradient; After the calculation is completed, the vehicle node uploads the local gradient to the intermediate coordination layer.
3. The method according to claim 1, characterized in that The S2 specifically includes: First, divide the vehicle nodes into different sets according to the similarity of the data; The gradients within each set are averaged and preliminarily aligned using the following formula: Among them, υ represents the index of the vehicle node, representing a certain vehicle node in the set; θ υ represents the local model parameters of the vehicle node v, η is the learning rate, λ is the alignment strength parameter, which is used to control the degree of alignment between the local gradient and the average gradient of similar nodes, represents the local gradient, Represents the average gradient of a set of similar nodes.
4. The method according to claim 2, characterized in that: The S3 specifically includes: The consistency between the local gradient of the vehicle node and the ensemble average gradient is measured by the preset gradient deviation value of the vehicle node; The weight of each vehicle node is adjusted by a preset gradient deviation value. After the weight of each vehicle node is normalized, the alignment gradient and weight are obtained. The parameters of the hierarchical federated learning model are updated based on the alignment gradient and weight to complete the final alignment.
5. The method according to claim 1, characterized in that The global coordination layer uses the first-stage consensus mechanism to evaluate the gradient consistency and data quality of the updated gradient uploaded by the intermediate coordination layer to select the trusted vehicle nodes, which specifically includes: Each roadside unit in the intermediate coordination layer generates local gradients from the gradient data of the preliminary alignment of the vehicle nodes. The local gradients are packaged together with the information related to the adaptive alignment mechanism to form candidate blocks. The core information in the candidate blocks includes: local model parameters, local gradients, roadside unit reputation scores and metadata. The reputation score of the roadside unit is determined by the mean value S of the gradient difference metric. RSU and data quality mean Q RSU Dynamic calculation, the formula is as follows: R RSU =S RSU Q RSU Formula 3; Among them, S i represents the gradient difference metric of vehicle node i, Q i represents the data quality of vehicle node i, |V RSU | represents the number of vehicle nodes within the jurisdiction of the RSU; Reputation score R RSU Exceeding the dynamic threshold R th The candidate blocks are admitted to the next stage.
6. The method according to claim 1, characterized in that The updating formula of the dynamic threshold is: in, γ is the smoothing factor, is the average reputation score of all RSUs, represents the dynamic threshold, Indicates the updated dynamic threshold.
7. The method according to claim 1, characterized in that The S5 specifically includes: The gradients of the screened trusted vehicle nodes are globally aggregated, and the formula is as follows: in, represents the local gradient generated by each RSU; By weighted averaging, we ensure that roadside units with higher reputation scores contribute more to the global model update, and use the global gradient to update the global model parameters. The formula is: in, Indicated in t The global model parameters after rounds of training, Represents the gradient after global aggregation; The updated global model parameters will be propagated to the vehicle layer through the intermediate coordination layer to complete this round of training. The results of this round of training will be packaged to generate a new block and stored in the blockchain. For roadside units with reputation scores below the threshold, the global coordination layer returns feedback information to promote dynamic optimization within the roadside unit. The roadside unit adjusts similar node alignment strength, learning rate, and improves data quality parameters based on the feedback information to improve the gradient consistency and representativeness of the next round of candidate blocks.
8. A hierarchical federated learning model training device, characterized in that include: The local gradient module divides the Internet of Vehicles into a vehicle layer, an intermediate coordination layer, and a global coordination layer based on the overall architecture of the Internet of Vehicles. The vehicle layer includes multiple vehicle nodes. The vehicle nodes train the hierarchical federated learning model through the initial global model parameters of the global coordination layer to obtain local gradients. A preliminary alignment module, wherein the intermediate coordination layer receives the local gradients uploaded by the vehicle nodes, divides the similar nodes in the vehicle nodes into a preset number of sets, and performs preliminary alignment on the average gradient of each set based on the average gradient of each set calculated; In the full alignment module, the roadside unit of the intermediate coordination layer uses a preset alignment mechanism to perform final alignment on the average gradient after preliminary alignment. The preset alignment mechanism adjusts the average gradient of preliminary alignment to be consistent with the global optimal direction through multiple rounds of global calibration, optimizes the contribution of each set through a dynamic weight allocation mechanism, and obtains the updated gradient and uploads it to the global coordination layer; Gradient verification module: the global coordination layer uses the first-stage consensus mechanism to evaluate the gradient consistency and data quality of the updated gradient uploaded by the intermediate coordination layer to screen the trusted vehicle nodes; The distribution module globally aggregates the gradients of the screened trusted vehicle nodes through the second-stage consensus mechanism, generates the final hierarchical federated learning model parameters, and feeds the hierarchical federated learning model parameters back to the intermediate coordination layer and vehicle layer for distribution.
9. An electronic device, comprising: processor; as well as, A memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the steps of the hierarchical federated learning model training method as described in any one of claims 1-8.
10. A storage medium for storing computer-executable instructions, which, when executed, implement the steps of the hierarchical federated learning model training method as described in any one of claims 1-8.
Citation Information
Patent Citations
Federation learning model training method and device, equipment and storage medium
CN112733967A
Reprogramming resisting model and method
CN116383820A
Heterogeneous model federal learning method through layered self-distillation
CN117454964A
Internet of vehicles reputation consensus method and device based on block chain, and medium
CN119011212A
Federated mixture models
EP4162405A1