Hierarchical federated learning model training method and device, equipment and medium
By introducing hierarchical federated learning and blockchain technology into the Internet of Vehicles (IoV), the problems of gradient inconsistency and malicious node attacks during model training in IoV are solved, achieving efficient and secure model training, adapting to the complex and dynamic environment of IoV, and improving the efficiency and security of IoV applications.
Patent Information
- Application Number
- CN202510109822.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2045-01-23
AI Technical Summary
In the Internet of Vehicles (IoV) environment, traditional federated learning methods struggle to address the issue of inconsistent gradient directions among nodes during model training, leading to slow global model convergence, significant waste of communication resources, and the risk of malicious node attacks. Existing consensus mechanisms suffer from high computational complexity and low efficiency, making it difficult to meet the requirements of high real-time performance and high efficiency.
By adopting a hierarchical federated learning approach, the vehicle network is divided into a vehicle layer, an intermediate coordination layer, and a global coordination layer. Through an adaptive gradient alignment mechanism and blockchain technology, gradient alignment and consensus mechanisms are optimized, communication overhead is reduced, and model training efficiency and security are improved.
It significantly improves the efficiency and accuracy of distributed model training in the Internet of Vehicles (IoV) environment, reduces the utilization of communication and computing resources for model training, lowers the network burden, enhances the robustness and reliability of the system, and makes the model training process in IoV more transparent and traceable, adapting to the complex and dynamic requirements of the IoV environment.
Smart Images

Figure CN120050299B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present document relates to the technical field of federated learning model, and particularly relates to a hierarchical federated learning model training method and device, equipment and medium. BACKGROUND
[0002] As a distributed model training method, federated learning is applied in the vehicle Internet environment to realize data collaborative training among vehicle nodes and reduce the risk of data privacy leakage. However, due to different data sources of vehicle nodes in the vehicle Internet, there is great data heterogeneity, and the traditional federated learning method cannot solve the problem of inconsistent gradient direction of nodes in the model training process, resulting in slow convergence of the global model and poor training effect. At the same time, the communication resources in the vehicle Internet are limited, and the vehicle nodes frequently upload gradients or model parameters in the training process, causing high communication overhead, further aggravating network congestion, and being difficult to meet the requirements of high real-time and high efficiency of the vehicle Internet. In addition, some malicious nodes may upload abnormal gradients to interfere with model training through poisoning attacks and other means to reduce the reliability of the global model.
[0003] In order to improve the credibility of data, the blockchain technology is introduced into the federated learning framework in the prior art to ensure the security and non-tamperability of data through the distributed ledger storage and consensus mechanism. However, the existing consensus mechanism, such as proof of work and traditional Byzantine fault tolerance protocol, has high computational complexity and low consensus efficiency, which is difficult to meet the actual needs of high dynamics and large scale of the vehicle Internet. In addition, the single-layer blockchain architecture further increases the communication and storage burden of the system, and reduces the overall training efficiency.
[0004] In view of the shortcomings of the prior art, the present application provides a hierarchical federated learning method based on blockchain and adaptive gradient alignment. SUMMARY
[0005] The present application provides a hierarchical federated learning model training method, device, equipment and medium, aiming to solve the above problems.
[0006] The present application provides a hierarchical federated learning model training method, device, equipment and medium, aiming to solve the above problems.
[0007] S1, based on the overall architecture of the vehicle Internet, the vehicle Internet is divided into a vehicle layer, an intermediate coordination layer and a global coordination layer, the vehicle layer includes a plurality of vehicle nodes, and 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 gradients uploaded by the vehicle nodes, divides similar nodes in the vehicle nodes into a preset number of sets, and preliminarily aligns the average gradient of each set according to the calculation of the average gradient of each set.
[0009] S3, the roadside unit of the intermediate coordination layer performs final alignment on the preliminary aligned average gradient by using a preset alignment mechanism, the preset alignment mechanism adjusts the preliminary aligned average gradient 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 distribution mechanism to obtain an updated gradient uploaded to the global coordination layer;
[0010] S4, the global coordination layer uses a first-stage consensus mechanism to screen trusted vehicle nodes by evaluating gradient consistency and data quality on the updated gradient uploaded by the intermediate coordination layer;
[0011] S5, a second-stage consensus mechanism is used to globally aggregate the gradients of the screened trusted vehicle nodes to generate final hierarchical federated learning model parameters, and the hierarchical federated learning model parameters are fed back to the intermediate coordination layer and the vehicle layer for distribution.
[0012] The embodiment of the application provides a hierarchical federated learning model training device, which comprises:
[0013] A local gradient module, based on the overall architecture of the Internet of Vehicles, divides the Internet of Vehicles into a vehicle layer, an intermediate coordination layer and a global coordination layer, the vehicle layer comprises a plurality of vehicle nodes, and the vehicle nodes train the hierarchical federated learning model to obtain local gradients through initial global model parameters of the global coordination layer;
[0014] A preliminary alignment module, the intermediate coordination layer receives the local gradients uploaded by the vehicle nodes, divides similar nodes in the vehicle nodes into a preset number of sets, and preliminarily aligns the average gradient of each set according to the calculation of the average gradient of each set;
[0015] A complete alignment module, the roadside unit of the intermediate coordination layer performs final alignment on the preliminary aligned average gradient by using a preset alignment mechanism, the preset alignment mechanism adjusts the preliminary aligned average gradient 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 distribution mechanism to obtain an updated gradient uploaded to the global coordination layer;
[0016] A gradient verification module, the global coordination layer uses a first-stage consensus mechanism to screen trusted vehicle nodes by evaluating gradient consistency and data quality on the updated gradient uploaded by the intermediate coordination layer;
[0017] A distribution module, a second-stage consensus mechanism is used to globally aggregate the gradients of the screened trusted vehicle nodes to generate final hierarchical federated learning model parameters, and the hierarchical federated learning model parameters are fed back to the intermediate coordination layer and the vehicle layer for distribution.
[0018] An electronic device is provided, comprising:
[0019] A processor; and
[0020] A memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the steps of the layered federated learning model training method described above.
[0021] A storage medium is provided for storing computer-executable instructions that, when executed, implement the steps of the layered federated learning model training method described above.
[0022] The present application significantly improves the efficiency and accuracy of distributed model training in a vehicle networking environment by introducing a layered federated learning system and method based on blockchain and adaptive gradient alignment. Compared with the prior art, the present application can better cope with the heterogeneity problem of node data in vehicle networking. Through the multi-round gradient alignment mechanism of the intermediate coordination layer and the global coordination layer, the convergence process of the global model is effectively accelerated, and the decline in training performance caused by inconsistent data between nodes is avoided. The present application also optimizes the coordination and communication mechanism of different levels in vehicle networking through the design of a layered architecture, reducing the need for frequent gradient uploads between vehicle nodes, thereby significantly reducing communication overhead. Through the combination of dynamic weight distribution and 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 by malicious nodes, and enhancing the robustness and reliability of the system. The present application also ensures the non-tamperability and credibility of data upload through blockchain technology, making the model training process in vehicle networking more transparent and traceable. At the same time, the use of a lightweight consensus mechanism reduces the computational burden of the system, ensuring efficient real-time processing capabilities and adapting to the complex and dynamic requirements in a vehicle networking environment. The present application not only technically solves the problem of distributed training in a vehicle networking environment, but also brings considerable economic and social benefits. By optimizing the utilization of communication and computing resources, the network burden is reduced, and the efficiency and security of vehicle networking applications are improved, which plays an important role in promoting the practical application of intelligent transportation, autonomous driving and other fields. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the one or more embodiments of the present specification or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the present specification, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0024] Figure 1A flowchart of the hierarchical federated learning model training method of the embodiment of the present application is shown in FIG. 1.
[0025] Figure 2 A schematic diagram of the hierarchical federated learning model training device of the embodiment of the present application is shown in FIG. 2.
[0026] Figure 3 A schematic diagram of the vehicle layer, the intermediate coordination layer, and the global coordination layer of the hierarchical federated learning method of the embodiment of the present application is shown in FIG. 3.
[0027] Figure 4 A global model update flowchart based on adaptive gradient alignment of the embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the technical solutions in the one or more embodiments of the present specification, the technical solutions in the one or more embodiments of the present specification will be described clearly and completely in conjunction with the drawings in the one or more embodiments of the present specification. Obviously, the described embodiments are only a part of the embodiments of the present specification, rather than all the embodiments. Based on the one or more embodiments of the present specification, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the present document.
[0029] Method embodiment
[0030] According to the embodiment of the present application, a hierarchical federated learning model training method is provided, Figure 1 A flowchart of the hierarchical federated learning model training method of the embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the hierarchical federated learning model training method of the embodiment of the present application 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 a plurality of vehicle nodes, and 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 and is mainly responsible for model training using local data of the vehicle nodes. In the Internet of Vehicles, the vehicle nodes collect real-time data around them through the vehicle-mounted 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 images collected by the vehicle-mounted sensor to identify traffic signs and driving routes. The vehicle node uses 100 images collected as a local data set and uses these 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 application;
[0034] At the beginning of each round of training, the vehicle node receives the initial global model parameters from the global coordination layer, trains its model on the local data set using the mini-batch stochastic gradient descent method, and calculates its local gradient, as shown in the following formula:
[0035]
[0036] wherein, B is a mini-batch sample randomly selected from the local data set, is the loss function gradient of the sample x . 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 similar nodes in the vehicle node into a preset number of sets, and calculates the average gradient of each set according to the average gradient of each set, and preliminarily aligns the average gradient of each set;
[0038] The intermediate coordination layer is the second layer of the system, mainly responsible for receiving the gradient uploaded by the vehicle layer, and reducing the gradient deviation caused by data heterogeneity through the alignment mechanism, and its specific flow chart is shown in Figure 3 . According to the gradient information uploaded by the vehicle node, the roadside unit in the intermediate coordination layer first divides the vehicle node into different sets according to the similarity of the data. For example, the vehicle nodes in the same area are divided into a set because the road condition data collected by the vehicle nodes are similar.
[0039] The gradient in each set is calculated by calculating the average value and preliminarily aligning, as shown in the following formula:
[0040]
[0041] wherein, η is the learning rate, λ is the alignment strength parameter, which is a hyperparameter used to control the alignment degree between the local gradient and the average gradient of similar nodes. represents the average gradient of the similar node set, and the calculation method is as follows:
[0042]
[0043] For example, if the gradient of a vehicle node deviates greatly from the average gradient of the set, the above formula can adjust its gradient to be closer to the direction of the average gradient of the set, thereby reducing the influence of data heterogeneity on model training.
[0044] S3, the roadside unit of the intermediate coordination layer performs final alignment on the preliminary aligned average gradient using a preset alignment mechanism, which adjusts the preliminary aligned average gradient to be consistent with the globally optimal direction through multiple rounds of global calibration, and optimizes the contribution of each set through a dynamic weight distribution mechanism to obtain an updated gradient uploaded to the global coordination layer;
[0045] 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 set average gradient. The calculation formula is:
[0046]
[0047] wherein represents the Euclidean distance between the local gradient of node v and the average gradient of its similar node set, σ is a positive adjustment parameter for controlling the sensitivity of the gradient difference. The difference measure S i is between 0 and 1, and the value closer to 1 indicates that the gradient direction of node i is more consistent with the average gradient direction of similar nodes, reflecting the reliability of its gradient; while the value closer to 0 indicates a larger deviation. By calculating the value of S v , the weight of each node is further adjusted. The weight calculation formula is:
[0048]
[0049] wherein, Q v is the data quality of the node, reflecting the representativeness of the node data. For example, nodes with more sensors will have a higher Q v value, thus obtaining a larger weight in the global model. To ensure the weight normalization in the global range, the following formula is used:
[0050]
[0051] Finally, after weight normalization, the final model parameter update is performed based on the aligned gradient and the weight :
[0052]
[0053] S4, the global coordination layer uses a first-stage consensus mechanism to filter credible vehicle nodes by evaluating the gradient consistency and data quality based on the updated 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 meets the global optimization goal. Each road side unit generates a local gradient after preliminary alignment of the gradient data of the vehicle nodes under its jurisdiction These local gradients are packaged together with information related to the adaptive alignment mechanism to form candidate blocks. The core information in the candidate blocks includes local model parameters, local gradients, reputation scores of road side units, and metadata (road side unit ID, timestamp, signature, etc.), and a reputation verification mechanism is introduced to screen trusted candidate blocks. The reputation score of a road side unit is calculated by the gradient difference metric mean S RSU and the data quality mean Q RSU is dynamically calculated, and the specific formula is as follows:
[0055]
[0056] R RSU =S RSU ·Q RSU ;
[0057] Only candidate blocks with a reputation score R RSU exceeding the dynamic threshold R th are accepted into the next stage. The threshold R th is dynamically adjusted, and the specific calculation is as follows:
[0058]
[0059] where γ is a smoothing factor, is the average reputation score of all road side units. For example, if a road side unit manages vehicle nodes with high gradient consistency and good data quality, its reputation score will be high, and the gradients uploaded by this road side unit will be considered more contributive to global optimization. The global coordination layer selects trusted gradients to participate in global aggregation by calculating the reputation score of the road side unit. As shown in Figure 4 is the global model update flowchart based on adaptive gradient alignment according to the embodiment of the application.
[0060] S5, the gradients of the screened trusted vehicle nodes are globally aggregated through the second stage consensus mechanism to generate the final layered federated learning model parameters, and the layered federated learning model parameters are fed back 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] The formula ensures that the roadside unit with a higher reputation score contributes more to the global model update through weighted averaging. In practical applications, multiple roadside units are responsible for data in different areas, and the final global gradient represents the optimization direction of the entire vehicle networking system.
[0064] Finally, the global model parameters are updated using the global gradient, and the formula is as follows:
[0065]
[0066] The updated global model parameters are propagated to the vehicle layer through the intermediate coordination layer, completing the current round of training, and the results of the current round of training are packaged to generate a new block, which is stored in the blockchain. The generation of a new block requires aggregation of candidate blocks from multiple roadside units. Only when a sufficient number of candidate blocks pass the verification can a formal block be formed. The structure of the new block includes the following contents: block body: storing the global gradient of the current round of training List of participating roadside units, reputation score R of each roadside unit RSU , and related metadata. Block header: including 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 will return feedback information to promote dynamic optimization within the roadside unit. The roadside unit adjusts the similarity 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 and ensure that the uploaded gradient contributes more to the optimization of the global model.
[0068] The present application provides a layered federated learning method based on blockchain enhancement, which is suitable for data heterogeneity, communication overhead and security in vehicle networking environment. Through the design of layered architecture of vehicle layer, intermediate coordination layer and global coordination layer, combined with adaptive gradient alignment mechanism and gradient alignment proof consensus mechanism, efficient optimization of global model is realized.
[0069] The embodiments of the present application have the following beneficial effects:
[0070] The present application introduces a layered federated learning system and method based on blockchain and adaptive gradient alignment, which significantly improves the efficiency and accuracy of distributed model training in vehicle networking environment. Compared with the prior art, the present application can better cope with the heterogeneity of node data in vehicle networking. Through the multi-round gradient alignment mechanism of the intermediate coordination layer and the global coordination layer, the convergence process of the global model is effectively accelerated, and the decline in training performance caused by inconsistent data between nodes is avoided.
[0071] Furthermore, the present application also optimizes the coordination and communication mechanism of different levels in the Internet of Vehicles through the design of a layered architecture, reducing the need for frequent gradient uploads between vehicle nodes, thereby significantly reducing communication overhead. Through the combination of dynamic weight distribution and 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 by malicious nodes, and enhancing the robustness and reliability of the system.
[0072] The present application also ensures the non-tamperability 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 lightweight consensus mechanism reduces the computational burden of the system, ensuring efficient real-time processing capabilities, adapting to the complex and dynamic requirements in the Internet of Vehicles environment.
[0073] Overall, the present application not only technically solves the problem of distributed training in the Internet of Vehicles environment, but also brings considerable benefits in economic and social aspects. By optimizing the utilization of communication and computing resources, the network burden is reduced, and the efficiency and security of the Internet of Vehicles application are improved, which plays an important role in the practical application of intelligent transportation, autonomous driving, etc.
[0074] Device embodiment one
[0075] According to the embodiments of the present application, a layered federated learning model training device is provided, Figure 2 The schematic diagram of the layered federated learning model training device of the present application embodiment is shown in Figure 2 The layered federated learning model training device of the present application embodiment 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, and the vehicle nodes train the layered federated learning model to obtain local gradients through the initial global model parameters of the global coordination layer;
[0077] The preliminary alignment module 22 receives the local gradients uploaded by the vehicle nodes, divides similar nodes in the vehicle nodes into a preset number of sets, and preliminarily aligns the average gradient of each set according to the calculation of the average gradient of each set;
[0078] The complete alignment module 24 uses a preset alignment mechanism to perform final alignment on the preliminarily aligned average gradient, the preset alignment mechanism adjusts the preliminarily aligned average gradient 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 distribution mechanism to obtain an updated gradient uploaded to the global coordination layer;
[0079] The gradient verification module 26 adopts a first-stage consensus mechanism to verify the uploaded update gradient of the intermediate coordination layer by evaluating gradient consistency and data quality to screen credible vehicle nodes;
[0080] The distribution module 28 adopts a second-stage consensus mechanism to globally aggregate the screened gradient of the credible vehicle nodes, generates a final hierarchical federated learning model parameter, and feeds back the hierarchical federated learning model parameter to the intermediate coordination layer and the vehicle layer for distribution.
[0081] The device embodiment is one-to-one corresponding to the above-mentioned method embodiment, and the specific implementation manner is referred to the content of the above-mentioned method embodiment, which will not be described here.
[0082] Device embodiment two
[0083] According to the embodiment of the present application, an electronic device is provided, comprising:
[0084] a processor; and
[0085] a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the steps as described in the above method embodiments.
[0086] Device embodiment three
[0087] A storage medium for storing computer-executable instructions that, when executed, implement the steps as described in the above method embodiments.
[0088] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
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 to obtain local gradients through the initial global model parameters of the global coordination layer. 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, calculates the average gradient of each set, and performs preliminary alignment of the average gradient of each set. S3. The roadside units of the intermediate coordination layer use a preset alignment mechanism to perform final alignment on the average gradient after the initial alignment. The preset alignment mechanism adjusts the average gradient of the initial 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 to be uploaded to the global coordination layer. S4. The global coordination layer uses a first-stage consensus mechanism to filter trusted vehicle nodes by evaluating gradient consistency and data quality of the update gradient uploaded by the intermediate coordination layer. S5. The gradients of the selected 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 obtains its local gradient by training the hierarchical federated learning model using the initial global model parameters of the global coordination layer. Specifically, this includes: The vehicle node collects real-time data from its surroundings through its onboard unit, and then preprocesses the real-time data to create a local dataset. 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 mini-batch stochastic gradient descent, 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, S2 specifically includes: First, divide the vehicle nodes into different sets based on the similarity of the data; The gradients within each set are initially aligned by calculating the average value, as shown in the following formula: Formula 1: in, The index represents the vehicle node, indicating a specific vehicle node in the set; Represents vehicle node v Local model parameters, For learning rate, The alignment strength parameter controls the degree of alignment between the local gradient and the average gradient of similar nodes. Indicates the local gradient. This represents the average gradient of a set of similar nodes.
4. The method according to claim 2, characterized in that, S3 specifically includes: The consistency between the local gradient of a vehicle node and the ensemble average gradient is measured by the preset gradient deviation value of the vehicle node. The weights of each vehicle node are adjusted by a preset gradient deviation value. After the weights of each vehicle node are normalized, the alignment gradient and weights are obtained. Based on the alignment gradient and weights, the parameters of the hierarchical federated learning model are updated to complete the final alignment.
5. The method according to claim 1, characterized in that, The global coordination layer employs a first-phase consensus mechanism to filter trusted vehicle nodes by evaluating gradient consistency and data quality in the update gradient uploaded by the intermediate coordination layer. Specifically, this includes: Each roadside unit in the intermediate coordination layer generates local gradients from the initially aligned gradient data of vehicle nodes. These local gradients, along with information related to the adaptive alignment mechanism, are packaged into candidate blocks. The core information in the candidate blocks includes: local model parameters, local gradients, the reputation scores of the roadside units, and metadata. The reputation scores of the roadside units are measured by the average gradient difference. and data quality mean Dynamic calculation, the formula is as follows: Formula 2: Formula 3: in, Represents vehicle node Gradient difference metric Represents vehicle node Data quality, Indicates the number of vehicle nodes within the RSU's jurisdiction; Credit Score Exceeding the dynamic threshold The candidate block was accepted and moved to the next stage.
6. The method according to claim 5, characterized in that, The update formula for the dynamic threshold is: Formula 4: in, As a smoothing factor, The average credit score for all roadside units. Indicates dynamic threshold. This represents the updated dynamic threshold.
7. The method according to claim 1, characterized in that, S5 specifically includes: The gradients of the selected trustworthy vehicle nodes are globally aggregated, as shown in the following formula: Formula 5: in, This represents the local gradient generated by each RSU; By using a weighted average, roadside units with higher reputation scores are ensured to contribute more to the global model update. The global model parameters are then updated using the global gradient, as shown in the formula: Formula 6: in, Indicates the first The global model parameters after one round of training. This 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 prompt dynamic optimization within the roadside unit. Based on the feedback information, the roadside unit adjusts the alignment strength of similar nodes, the learning rate, and improves data quality to enhance 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, based on the overall architecture of the Internet of Vehicles (IoV), divides the IoV into a vehicle layer, an intermediate coordination layer, and a global coordination layer. The vehicle layer includes multiple vehicle nodes, and the vehicle nodes obtain local gradients by training the hierarchical federated learning model through the initial global model parameters of the global coordination layer. The preliminary alignment module, wherein 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, calculates the average gradient of each set, and performs preliminary alignment on the average gradient of each set. The fully aligned module uses a preset alignment mechanism to perform final alignment on the average gradient after the initial alignment by the roadside unit of the intermediate coordination layer. The preset alignment mechanism adjusts the average gradient of the initial 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 to be uploaded to the global coordination layer. The gradient verification module uses a first-stage consensus mechanism in the global coordination layer to screen trusted vehicle nodes by evaluating gradient consistency and data quality of the update gradient uploaded by the intermediate coordination layer. The distribution module uses a second-stage consensus mechanism to globally aggregate the gradients of the selected trusted vehicle nodes, generate the final hierarchical federated learning model parameters, and then feeds these parameters back to the intermediate coordination layer and the vehicle layer for distribution.
9. An electronic device, comprising: processor; as well as, A memory configured 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-7.
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-7.
Citation Information
Patent Citations
Federation learning model training method and device, equipment and storage medium
CN112733967A
Reprogramming resisting model and method
CN116383820A