Resource awareness federal knowledge distillation intrusion detection method and system for Internet of Vehicles

By using a resource-aware federated knowledge distillation method, dynamically allocating personalized models and combining consistency checks and knowledge distillation techniques, the problem of low training efficiency and insufficient detection accuracy caused by resource heterogeneity in the Internet of Vehicles environment is solved, achieving efficient and secure intrusion detection.

CN121509040APending Publication Date: 2026-02-10ANHUI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511800485.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing vehicle-to-everything (V2X) intrusion detection systems suffer from low training efficiency in heterogeneous resource environments and cannot effectively balance detection accuracy and data privacy protection. Current solutions fail to effectively address the synergistic optimization problem between resource heterogeneity and detection efficiency.

Method used

We employ a resource-aware federated knowledge distillation method, which dynamically allocates personalized models on the server and combines consistency checks and knowledge distillation techniques to achieve lightweight training and improved model performance for resource-constrained clients.

Benefits of technology

While protecting data privacy, the system's overall detection performance and resource utilization efficiency have been improved, the detection accuracy of resource-constrained clients has been significantly improved, and the system's robustness in adversarial environments has been enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509040A_ABST
    Figure CN121509040A_ABST
Patent Text Reader

Abstract

The invention discloses an internet of vehicles-oriented resource awareness federal knowledge distillation intrusion detection method and system, and the method comprises the steps: dynamically allocating matched model complexity according to the calculation capability, storage capacity and communication bandwidth of a vehicle client through a resource awareness model allocation strategy; by utilizing a federal knowledge distillation mechanism, logic output of each client is aggregated through a public data set to form global knowledge, and the global knowledge is fed back to the client to guide local model distillation training of the client; abnormal filtering based on consistency is introduced, and abnormal clients with predicted behaviors deviating from group consensus are detected and excluded through cosine similarity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to vehicle network security technology, specifically to a resource-aware federated knowledge distillation intrusion detection method and system for vehicle networks. Background Technology

[0002] Vehicle Ad Hoc Networks (VANETs), as a core supporting technology of intelligent transportation systems, enable collaborative interaction and intelligent decision-making of traffic information through real-time communication between vehicles (V2V) and between vehicles and infrastructure (V2I). However, with the rapid expansion of the scale of vehicle networks, security threats such as network attacks and privacy breaches are becoming increasingly prominent. Attackers can interfere with the normal operation of vehicles by forging information, seriously threatening driving safety. Against this backdrop, building an intrusion detection system capable of identifying threats in real time and protecting data privacy has become a key research focus.

[0003] In recent years, deep learning-based intrusion detection methods have been widely used due to their high-precision feature extraction and dynamic environment adaptability. However, these methods rely on large-scale, high-quality training data, while data acquisition from vehicle clients in connected vehicle environments is limited. Directly uploading all data using a centralized training model not only incurs huge communication overhead but also poses significant privacy risks.

[0004] Federated learning offers a novel solution for vehicle-to-everything (V2X) security. Its distributed training nature allows vehicles to process private data locally, uploading only model parameters rather than raw data, effectively protecting user privacy. However, existing federated learning schemes expose new problems in V2X scenarios: First, the heterogeneity of vehicle client resources leads to low training efficiency; resource-constrained vehicles cannot complete local training in a timely manner, creating a training bottleneck. Second, a unified model architecture cannot adapt to the resource configurations of different vehicles, resulting in resource waste and performance loss. While current research attempts to improve model adaptability through personalized federated learning and feature distillation, it has not yet effectively solved the problem of synergistic optimization between resource heterogeneity and detection efficiency in V2X.

[0005] Furthermore, the dynamic and complex nature of the connected vehicle environment places higher demands on intrusion detection systems. Existing solutions often overlook the differences in hardware configurations across vehicles, the spatiotemporal characteristics of data distribution, and the diversity of attack patterns. Therefore, there is an urgent need for a novel intrusion detection solution that comprehensively considers resource constraints, privacy protection, and detection performance. Summary of the Invention

[0006] Purpose of the invention: The purpose of this invention is to address the shortcomings of existing technologies and provide a resource-aware federated knowledge distillation intrusion detection method and system for the Internet of Vehicles.

[0007] Technical solution: The present invention provides a resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles, comprising the following steps:

[0008] S1, Model Allocation and Local Training;

[0009] S1.1 System initialization: The server sets up a complete set of resource types and initializes a baseline intrusion detection model for the client. (e.g., ResNet-9);

[0010] S1.2, Resource-aware model allocation, i-th vehicle client Report its computing power to the server Storage capacity With communication bandwidth Server-side computation of the client-side baseline intrusion detection model complexity And through the scaling factor (complexity ratio) This scales the number of convolutional layer filters in the baseline intrusion detection model, thereby increasing the number of filters per client. Generate personalized models ; ;

[0011] S1.3, Local Training and Logits Generation: Vehicle Client Utilizing its private dataset For the assigned personalized model Perform local training; after training is complete, the client... Using public datasets Generate logits prediction output ; Indicates the client The unnormalized prediction output for the j-th sample in the dataset;

[0012] S1.4 Secure Upload: Client The generated logits are uploaded to the server asynchronously.

[0013] S2, Server-side aggregation and purification;

[0014] S2.1 Consistency Filtering Verification: The server verifies the consistency of the client's data. The predicted output is obtained by calculating its logits. Average logits value of the prediction output compared with other client models Cosine similarity between them is used to obtain a consistency score. , ;

[0015] like Below the preset threshold Then mark the client as an abnormal node and set... = 0.85 and exclude the client, if Higher than or equal to the preset threshold Then the confidence level of the client. A value of 1 indicates that the client is trusted.

[0016] S2.2 Trusted Logits Aggregation: The server aggregates logits according to the formula... It aggregates the logits of all trusted clients to form global knowledge;

[0017] S2.3, Distribute global logits: The server will distribute the aggregated global logits ( Distribute to all vehicle clients;

[0018] S3, Client-side distillation optimization;

[0019] S3.1, Distillation Training, for each vehicle client In public datasets Above, to minimize the distillation loss function Update its local model parameters for the target;

[0020] S3.2 Model Deployment and Inference: After the distillation training is completed, the client will deploy the optimized model locally for real-time intrusion detection.

[0021] The resource perception and knowledge distillation collaborative mechanism of this invention is reflected in the following two levels:

[0022] During the model training phase, the server dynamically allocates model complexity appropriate to the resource conditions of different vehicle clients using a resource-aware strategy. Clients with limited resources receive lightweight models to ensure training efficiency, while clients with ample resources use complex models to improve detection accuracy. This differentiated allocation strategy effectively solves the training efficiency problem in resource-heterogeneous environments.

[0023] During the knowledge distillation phase, each client generates logits based on a public dataset and uploads them to the server. The server then uses a consistency check mechanism to filter out trustworthy client outputs, aggregates them to form global knowledge, and distributes it to each client to guide local model optimization. This process protects the privacy of the original data while improving the model performance of all clients through knowledge transfer, particularly significantly improving the detection accuracy of resource-constrained clients.

[0024] By leveraging the synergistic effect of resource perception and knowledge distillation, this invention achieves a dual improvement in overall system detection performance and resource utilization efficiency while protecting data privacy, effectively solving the technical challenge of balancing resource heterogeneity and detection accuracy in the Internet of Vehicles environment.

[0025] Furthermore, the detailed method of step S1.2 is as follows:

[0026] First, the server obtains the baseline deep learning model. complexity , Based on benchmark deep learning models The total number of parameters is represented;

[0027] The server sets a complete set of resource types and assigns a weight to each resource type, forming a weight vector. , , ), and satisfy ; , , These are the weights of computing power, storage capacity, and communication bandwidth, respectively.

[0028] Then, each vehicle client Report its resource triples to the server ( , , The server calculates the corresponding global resource maximum value. , and For each client Normalize the three resources: , , ;

[0029] ;

[0030] ;

[0031] ;

[0032] , , These refer to the Nth client. The computing power, storage capacity, and communication bandwidth;

[0033] Next, for each client The server calculates the complexity of its personalized model based on its normalized resource vector. : ,

[0034] Finally, the server is based on the complexity ratio. Each convolutional layer of the baseline model is structurally adjusted by scaling the number of filters in the convolutional layers to generate a personalized model that matches the client's resource conditions. and personalized models The model parameters are distributed to the corresponding vehicle clients. In this case, since the more convolutional layer filters there are, the more parameters there are, and the more complex the calculation becomes, resulting in greater computational and time overhead. Therefore, the original number of convolutional layer filters is multiplied by [the factor needed]. The number of convolutional layer filters in the sub-model is determined and used to create a personalized model.

[0035] Furthermore, in the local model training phase of step S1.3, the vehicle client... Utilizing its private dataset For the assigned personalized model Perform local training and optimize model parameters by minimizing the cross-entropy loss function. The specific objective function is:

[0036] ;

[0037] In the above formula, Indicates the first Input of each sample, This is the corresponding output. Cross-entropy loss function is used to measure the difference between the model's predicted probability distribution and the true label;

[0038] Among them, personalized models The model parameters are iteratively updated using the gradient descent algorithm, with the update formula as follows: ;

[0039] The preset learning rate, This represents the gradient of the loss function with respect to the model parameters;

[0040] After local training is completed during the logits generation phase, the client... Using public datasets Generate logits output for each sample in the public dataset. Client calculate ;

[0041] in, Personalized model The output of the penultimate layer, The model represents the samples The prediction confidence level;

[0042] Considering that clients may be offline or encounter transmission delays in the vehicle-to-everything (V2X) environment, logits adopts an asynchronous upload mechanism. The client sends the generated logits to the server asynchronously, and the server maintains a buffer to store the received logits before performing the aggregation operation.

[0043] Further, in step S2, the server preprocesses the received client logits to construct a comparison sample set corresponding to each client; the specific method is as follows:

[0044] For each client The server calculates the rest. A client in the public dataset Each sample The average logits are used to form a reference vector. ;

[0045] Based on reference vector The server performs consistency checks on each client individually: for each client... The cosine similarity between the logits of all its samples and the corresponding reference vectors is calculated, and the average value is taken to obtain the overall consistency score of the client. ;

[0046] In the above formula, It refers to the first One sample;

[0047] The server will obtain the consistency score. With preset threshold Perform a consistency check comparison;

[0048] After completing the consistency check on all clients, the server begins the aggregation process. The specific aggregation method is as follows:

[0049] For each sample in the public dataset The server collects logits from all trusted clients and assigns them to their respective resource-aware weights. By performing a weighted summation, we finally obtain the global logits of this sample: ;

[0050] Finally, the server packages and distributes the calculated global logits of all samples to each vehicle client. In specific trusted environments or test scenarios, the system supports configuring all logits to be distributed. By forcing it to be set to 1, the anomaly detection mechanism is bypassed, and the aggregation phase is entered directly.

[0051] Furthermore, in step S3, after each vehicle client receives the aggregated logits containing global knowledge from the server, it initiates a multi-round distillation training process locally:

[0052] First, the client loads the public dataset from local storage. and the received global logits Samples in the dataset Establish the corresponding relationships and complete the training data preparation work;

[0053] At the start of each round of distillation training, the client... First, use the current model parameters. For public datasets The samples in the model are used for forward propagation to obtain the output of the penultimate layer of the local model. As local logits ;

[0054] Subsequently, based on global logits With local logits Calculate the distribution difference and construct a distillation loss function based on KL divergence:

[0055] ;

[0056] in This represents the total number of categories in the attack detection task, including normal traffic and various attack types. Representing global knowledge in categories Confidence level on Indicates the local model in category The prediction confidence level;

[0057] During backpropagation, the client calculates the distillation loss function on the model parameters. gradient The model parameters are updated using the gradient descent algorithm: ;

[0058] The distillation training process continues to iterate in multiple rounds until each round of training makes the prediction distribution of the local model closer to the consensus distribution of the global knowledge representation, ensuring that the client does not completely forget the local data features while absorbing global knowledge, thus achieving a balance between global consensus and local characteristics.

[0059] After completing the preset training rounds, the client evaluates and verifies the optimized model to ensure that the model performance meets the deployment requirements;

[0060] Ultimately, each client will deploy the knowledge-distilled and optimized model on its local intrusion detection system to monitor security threats in the connected vehicle environment in real time, including denial-of-service attacks, spoofing attacks, and replay attacks.

[0061] This invention also discloses a resource-aware federated knowledge distillation intrusion detection system for the Internet of Vehicles (IoV), comprising a server, roadside units, and vehicle clients. The server, as the core control unit of the system, is responsible for executing resource-aware model allocation strategies, dynamically generating personalized models based on the computing power, storage capacity, and communication bandwidth of the vehicle clients. It is also responsible for aggregating logits uploaded by each client, performing cosine similarity-based consistency checks to filter abnormal clients, and calculating global knowledge to distribute to each client. The roadside units are deployed at key locations on the road, forming edge computing nodes for the IoV, undertaking data relay tasks between the server and vehicle clients, forwarding model parameters, logits data, and training instructions, and providing local computing support at the network edge layer, effectively reducing server load and communication latency. The vehicle clients, as distributed computing nodes equipped with heterogeneous hardware resources, are responsible for receiving personalized models and performing local training, generating logits output using public datasets, performing distillation training based on the global knowledge distributed by the server, and finally deploying the optimized model locally to achieve real-time intrusion detection. The system achieves resource-aware federated knowledge distillation through a three-layer collaborative architecture, effectively addressing the resource heterogeneity and security threats of the IoV environment while protecting data privacy.

[0062] Beneficial effects: Compared with the prior art, the present invention has the following advantages:

[0063] (1) This invention achieves effective adaptation to the heterogeneity of vehicle client resources through a resource-aware model allocation strategy. The system can dynamically adjust the model complexity according to the computing power, storage capacity and communication bandwidth of each client, which not only ensures the training efficiency of resource-constrained clients, but also makes full use of the computing power of resource-rich clients, significantly improving the overall training efficiency of the system.

[0064] (2) This invention combines federated learning with knowledge distillation techniques, and through logits aggregation and global knowledge sharing, effectively improves model performance while protecting data privacy. In particular, resource-constrained clients have achieved significant performance improvements through knowledge distillation, and the lightweight model has achieved high detection accuracy while maintaining high efficiency.

[0065] (3) The present invention effectively identifies and eliminates abnormal clients through a consistency verification mechanism, which enhances the robustness of the system in adversarial environments. At the same time, it supports the optimization of system overhead through configuration adjustment in trusted environments, and has good practicality and adaptability. Attached Figure Description

[0066] Figure 1 This is a system architecture diagram of the present invention;

[0067] Figure 2 This is a system application scenario diagram of the present invention;

[0068] Figure 3 This is an overall flowchart of the present invention;

[0069] Figure 4 shows the model training performance curve in the embodiment;

[0070] Figure 5 shows the multi-category detection confusion matrix in the embodiment;

[0071] Figure 6 is a comparison chart of the performance improvement of knowledge distillation in the embodiments;

[0072] In Figure 4, (a) shows the accuracy of RAFD-IDS on the CICIDS2017 dataset, (b) shows the accuracy of RAFD-IDS on the ToN-IOT dataset, and (c) shows the accuracy of RAFD-IDS on the VeReMi dataset. In Figure 5, (a) shows the confusion matrix of the CICIDS2017 dataset, (b) shows the confusion matrix of the ToN-IOT dataset, and (c) shows the confusion matrix of the VeReMi dataset. In Figure 6, (a) shows the impact of knowledge distillation on the CICIDS2017 dataset, (b) shows the impact of knowledge distillation on the ToN-IOT dataset, and (c) shows the impact of knowledge distillation on the VeReMi dataset. Detailed Implementation

[0073] The technical solution of the present invention will be described in detail below, but the scope of protection of the present invention is not limited to the embodiments described.

[0074] like Figure 1 and Figure 3 As shown, the resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles of the present invention includes the following steps:

[0075] S1, Model Allocation and Local Training;

[0076] S1.1 System initialization: The server sets the complete set of resource types and initializes a baseline intrusion detection model M;

[0077] S1.2, Resource-aware model allocation, i-th vehicle client Report its computing power to the server Storage capacity With communication bandwidth The complexity of the server-side benchmark intrusion detection model for client computation. The number of convolutional layer filters in the benchmark intrusion detection model is scaled by a complexity ratio, thereby increasing the efficiency for each client. Generate personalized models ; ;

[0078] S1.3, Local Training and Logits Generation: Vehicle Client Utilizing its private dataset For the assigned personalized model Perform local training; after training is complete, the client... Using public datasets Generate logits output ;

[0079] S1.4 Secure Upload: Client The generated logits are uploaded to the server asynchronously.

[0080] S2, Server-side aggregation and purification;

[0081] S2.1 Consistency Filtering Verification: The server verifies the consistency of the client's data. Calculate its logits( ) and other clients' average logits ( Cosine similarity between ;

[0082] like Below the preset threshold If so, the client is marked as an abnormal node and excluded. Higher than or equal to the preset threshold Then the confidence level of the client. A value of 1 indicates that the client is trusted.

[0083] S2.2 Trusted Logits Aggregation: The server aggregates logits according to the formula... Aggregate the logits of all trusted clients to form global knowledge. ;

[0084] S2.3, Distribute global logits: The server will distribute the aggregated global logits. Distribute to all vehicle clients;

[0085] S3, Client-side distillation optimization;

[0086] S3.1, Distillation Training, for each vehicle client In public datasets Above, to minimize the distillation loss function Update its local model parameters for the target;

[0087] S3.2 Model Deployment and Inference: After the distillation training is completed, the client will deploy the optimized model locally for real-time intrusion detection.

[0088] The detailed method of step S1.2 in this embodiment is as follows:

[0089] First, the server selects the baseline intrusion detection model M as the complete model, and its complexity is defined as... The total number of parameters in the model is used to characterize it.

[0090] The server sets a complete set of resource types and assigns a weight to each resource type, forming a weight vector. , , ), and satisfy ; , , These are the weights of computing power, storage capacity, and communication bandwidth, respectively.

[0091] Then, each vehicle client Report its resource triples to the server ( , , The server calculates the corresponding global resource maximum value. , and For each client Normalize the three resources: , , ;

[0092] ;

[0093] ;

[0094] ;

[0095] , , These refer to the Nth client. The computing power, storage capacity, and communication bandwidth;

[0096] Next, for each client The server calculates the complexity of its personalized model based on its normalized resource vector. : ,

[0097] Finally, the server is based on the complexity ratio. Each convolutional layer of the baseline intrusion detection model M is structurally adjusted by scaling the number of filters in the convolutional layers to generate a personalized model that matches the client's resource conditions. and personalized models The model parameters are distributed to the corresponding vehicle clients. .

[0098] In the local model training phase of step S1.3 of this embodiment, the vehicle client... Utilizing its private dataset For the assigned personalized model Perform local training and optimize model parameters by minimizing the cross-entropy loss function. The specific objective function is:

[0099] ;

[0100] In the above formula, Indicates the first Input of each sample, This is the corresponding output. The cross-entropy loss function;

[0101] Among them, personalized models The model parameters are iteratively updated using the gradient descent algorithm, with the update formula as follows: ;

[0102] The preset learning rate, This represents the gradient of the loss function with respect to the model parameters;

[0103] After local training is completed during the logits generation phase, the client... Using public datasets Generate logits output for each sample in the public dataset. Client calculate ;

[0104] in, Personalized model The output of the penultimate layer, Representation Model For the sample The prediction confidence level.

[0105] In step S2 of this embodiment, the server preprocesses the received logits from each client to construct a comparison sample set corresponding to each client; the specific method is as follows:

[0106] For each client The server calculates the rest. A client in the public dataset Each sample The average logits are used to form a reference vector. ;

[0107] Based on reference vector The server performs consistency checks on each client individually: for each client... The cosine similarity between the logits of all its samples and the corresponding reference vectors is calculated, and the average value is taken to obtain the overall consistency score of the client. ;

[0108] In the above formula, It refers to the first One sample;

[0109] The server will obtain the consistency score. With preset threshold Perform a consistency check comparison;

[0110] After completing the consistency check on all clients, the server begins the aggregation process. The specific aggregation method is as follows:

[0111] For each sample in the public dataset The server collects logits from all trusted clients and assigns them to their respective resource-aware weights. By performing a weighted summation, we finally obtain the global logits of this sample: ;

[0112] Finally, the server packages and distributes the calculated global logits of all samples to each vehicle client. In specific trusted environments or test scenarios, the system supports configuring all logits to be distributed. By forcing it to be set to 1, the anomaly detection mechanism is bypassed, and the aggregation phase is entered directly.

[0113] In step S3 of this embodiment, after each vehicle client receives the aggregated logits containing global knowledge from the server, it starts a multi-round distillation training process locally:

[0114] First, the client loads the public dataset from local storage. and the received global logits Samples in the dataset Establish the corresponding relationships and complete the training data preparation work;

[0115] At the start of each round of distillation training, the client... First, use the current model parameters. For public datasets The samples in the model are used for forward propagation to obtain the output of the penultimate layer of the local model. As local logits ;

[0116] Subsequently, based on global logits With local logits Calculate the distribution difference and construct a distillation loss function based on KL divergence:

[0117] ;

[0118] in This represents the total number of categories in the attack detection task, including normal traffic and various attack types. Representing global knowledge in categories Confidence level on Indicates the local model in category The prediction confidence level;

[0119] During backpropagation, the client calculates the distillation loss function on the model parameters. gradient The model parameters are updated using the gradient descent algorithm: ;

[0120] The distillation training process continues through multiple iterations until each round of training makes the prediction distribution of the local model closer to the consensus distribution of the global knowledge representation.

[0121] After completing the preset training rounds, the client evaluates and verifies the optimized model to ensure that the model performance meets the deployment requirements;

[0122] Ultimately, each client will deploy the knowledge-distilled and optimized model on its local intrusion detection system.

[0123] like Figure 2As shown, the resource-aware federated knowledge distillation intrusion detection system for the Internet of Vehicles (IoV) in this embodiment includes a server, roadside units (RSUs), and vehicle clients. The server executes a resource-aware model allocation strategy, dynamically generating personalized models based on the computing power, storage capacity, and communication bandwidth of the vehicle clients. It is also responsible for aggregating logits uploaded by each client, performing cosine similarity-based consistency checks to filter out abnormal clients, and calculating global knowledge to distribute to each client. The roadside units constitute the edge computing nodes of the IoV, undertaking data relay tasks between the server and vehicle clients, forwarding model parameters, logits data, and training instructions, and providing local computing support at the network edge layer. The vehicle clients receive personalized models and perform local training, generate logits output using public datasets, perform distillation training based on the global knowledge distributed by the server, and finally deploy the optimized model locally to achieve real-time intrusion detection.

[0124] To further verify the feasibility and technical effect of the present invention, this embodiment uses the Python deep learning framework PyTorch to simulate the solution of the present invention. The effectiveness of RAFD-IDS is verified using three different datasets: CICIDS2017, ToN-IOT, and VeReMi. ResNet-9 is used as the initial detection model for the server, and the models of other vehicle clients are compressed based on this.

[0125] In this embodiment, a total of 150 rounds of communication are conducted. Within each communication interval, the vehicle client will perform 3-5 rounds of training on its private dataset and 3-5 rounds of knowledge distillation on the public dataset. This process ensures that the model can efficiently learn and absorb global knowledge. To optimize the model training process, the learning rate is set to 0.001. This parameter value was determined after preliminary experimental adjustments to balance convergence speed and training stability.

[0126] This implementation also constructed a vehicle-mounted ad hoc network communication simulation environment including servers and vehicle clients, and deployed RAFD-IDS on a cloud server equipped with an NVIDIA A100 GPU. To simulate heterogeneous resource scenarios, three computers with different configurations were selected to simulate vehicle clients under different resource conditions, used for optimizing and training the server-allocated model. The specific equipment configurations of the servers and vehicle clients are shown in Table 1.

[0127] Table 1 Server and Vehicle Client Configuration

[0128]

[0129] (1) Verification of the effect of resource-aware model allocation: Table 2 shows the performance comparison results of RAFD-IDS on the CICIDS2017, ToN-IOT, and VeReMi datasets with and without the resource-aware model allocation strategy. The results show that resource-aware model allocation can significantly shorten the local training time of the vehicle client. (The last sentence appears to be incomplete and possibly refers to a separate, unrelated point about resource constraints.) For example, its training time on the VeReMi dataset decreased from 513 minutes to 403 minutes, while the accuracy only decreased slightly (from 96.97% to 96.54%). Furthermore, the assigned model achieved a good balance between accuracy and training time under various resource conditions, which is particularly evident in resource-rich environments. With limited resources This is fully reflected in the above.

[0130] Table 2. Impact of Resource-Aware Model Allocation on Training Time and Model Accuracy

[0131]

[0132] (2) Adversarial Test Results: To evaluate the effectiveness of the logit consistency check mechanism in defending against malicious attacks, an adversarial test scenario was constructed. The results are shown in Table 3. In the 10-node test environment, two malicious nodes v9 (Gaussian noise injection) and v 10 The similarity scores for (logits random permutation) were 0.62 and 0.58, respectively, both below the threshold τ=0.85, and were successfully filtered out. All eight benign nodes passed the verification, with a false positive rate of zero. Experiments demonstrate that this mechanism can effectively identify abnormal clients.

[0133] Table 3. Filtering results based on cosine similarity (τ = 0.85)

[0134]

[0135] (3) Overall performance results: As shown in Figure 4, after 150 rounds of training, the three clients achieved performance convergence on the three datasets. (CICIDS2017 dataset) The accuracies reached 97.7%, 97.2%, and 97.1% respectively; 96.7%, 96.8%, and 96.4% for the ToN-IOT dataset; and 96.7%, 96.5%, and 96.3% for the VeReMi dataset. All clients showed a steady improvement with increasing training rounds, validating the general adaptability of the method.

[0136] (4) Multi-class detection performance: The accuracy of the v1 client in identifying specific attack types was evaluated by using a confusion matrix. As shown in Figure 5, tests on the CICIDS2017, ToN-IOT, and VeReMi datasets show that the model achieves stable identification of high-frequency attack categories, while also demonstrating effective detection capabilities for minority class attacks with limited samples, reflecting the system's good adaptability under unbalanced data distribution.

[0137] (5) Validation of Knowledge Distillation: As shown in Figure 6, the detection accuracy of all clients was significantly improved after the introduction of knowledge distillation technology. Of particular note is the improvement in the detection accuracy of resource-constrained clients. The improvement on the VeReMi dataset reached 2.42%, significantly higher than that of resource-rich clients. (0.37%), demonstrating that knowledge distillation technology can effectively improve the detection performance of lightweight models and significantly alleviate the accuracy loss problem caused by model compression.

[0138] (6) Comparative Experiment Results: On three standard datasets, the technical solution of this invention was comprehensively compared with baseline methods such as DnRaNN, Fed-IoV, FedAvg, and Fed-RAC. Table 1 shows that the technical solution of this invention performs best in core metrics such as accuracy, precision, recall, and F1 score. In particular, while maintaining data privacy, its detection accuracy surpasses that of the DnRaNN method, which relies on centralized data, and it also demonstrates a significant advantage among all federated learning comparison methods, verifying the effectiveness of the resource-aware model allocation and knowledge distillation mechanism.

[0139] Table 4 Performance comparison of baseline methods across datasets

[0140]

[0141] In summary, this invention can reduce the training time of resource-constrained clients by 15%-21%, and achieve detection accuracies of 97.43%, 97.18%, and 96.38% on the CICIDS2017, ToN-IoT, and VeReMi datasets, respectively, significantly improving intrusion detection efficiency and system adaptability in resource-heterogeneous environments.

Claims

1. A resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles, characterized in that, Includes the following steps: S1, Model Allocation and Local Training; S1.1 System initialization: The server sets up a complete set of resource types and initializes a baseline intrusion detection model for the client. ; S1.2, Resource-aware model allocation, i-th vehicle client Report its computing power to the server Storage capacity With communication bandwidth ; The complexity of the server-side benchmark intrusion detection model for client computation The number of convolutional layer filters in the benchmark intrusion detection model is scaled by a complexity ratio, thereby increasing the efficiency for each client. Generate personalized models ; ; S1.3, Local Training and Logits Generation: Vehicle Client Utilizing its private dataset For the assigned personalized model Perform local training; After training is complete, the client Using public datasets Generate logits prediction output ; Indicates the client The unnormalized prediction output for the j-th sample in the dataset; S1.4 Secure Upload: Client The generated logits are uploaded to the server asynchronously. S2, Server-side aggregation and purification; S2.1 Consistency Filtering Verification: The server verifies the consistency of the client's data. The predicted output is obtained by calculating its logits. Average logits value of the prediction output compared with other client models Cosine similarity between them is used to obtain a consistency score. ; like Below the preset threshold If so, the client is marked as an abnormal node and excluded. Higher than or equal to the preset threshold Then the confidence level of the client. A value of 1 indicates that the client is trusted. S2.2 Trusted Logits Aggregation: The server aggregates logits according to the formula... Aggregate the logits of all trusted clients to form global knowledge. ; S2.3, Distribute global logits: The server will distribute the aggregated global logits. Distribute to all vehicle clients; S3, Client-side distillation optimization; S3.1, Distillation Training, for each vehicle client In public datasets Above, to minimize the distillation loss function Update its local model parameters for the target; S3.2 Model Deployment and Inference: After the distillation training is completed, the client will deploy the optimized model locally for real-time intrusion detection.

2. The resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles according to claim 1, characterized in that, The detailed method for step S1.2 is as follows: First, the server obtains the baseline deep learning model. complexity , Based on benchmark deep learning models The total number of parameters is represented; The server sets a complete set of resource types and assigns a weight to each resource type, forming a weight vector. , , ), and satisfy ; , , These are the weights of computing power, storage capacity, and communication bandwidth, respectively. Then, each vehicle client Report its resource triples to the server ( , , The server calculates the corresponding global resource maximum value. , and For each client Normalize the three resources: , , ; ; ; ; , , These refer to the Nth client. The computing power, storage capacity, and communication bandwidth; Next, for each client The server calculates the complexity of its personalized model based on its normalized resource vector. : , Finally, the server is based on the complexity ratio. Each convolutional layer of the baseline model is structurally adjusted by scaling the number of filters in the convolutional layers to generate a personalized model that matches the client's resource conditions. and personalized models The model parameters are distributed to the corresponding vehicle clients. .

3. The resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles according to claim 1, characterized in that, In the local model training phase of step S1.3, the vehicle client Utilizing its private dataset For the assigned personalized model Perform local training and optimize model parameters by minimizing the cross-entropy loss function. The specific objective function is: ; In the above formula, Indicates the first Input of each sample, This is the corresponding output. The cross-entropy loss function; Among them, personalized models The model parameters are iteratively updated using the gradient descent algorithm, with the update formula as follows: ; The preset learning rate, This represents the gradient of the loss function with respect to the model parameters; After local training is completed during the logits generation phase, the client... Using public datasets Generate logits output for each sample in the public dataset. Client calculate ; in, Personalized model The output of the penultimate layer, Representation Model For the sample The prediction confidence level.

4. The resource-aware federated knowledge distillation intrusion detection method for the Internet of Vehicles according to claim 1, characterized in that, In step S2, the server preprocesses the received client logits to construct a comparison sample set for each client; the specific method is as follows: For each client The server calculates the rest. A client in the public dataset Each sample The average logits are used to form a reference vector. ; Based on reference vector The server performs consistency checks on each client individually: for each client... The cosine similarity between the logits of all its samples and the corresponding reference vectors is calculated, and the average value is taken to obtain the overall consistency score of the client. ; In the above formula, It refers to the first One sample; The server will obtain the consistency score. With preset threshold Perform a consistency check comparison; After completing the consistency check on all clients, the server begins the aggregation process. The specific aggregation method is as follows: For each sample in the public dataset The server collects logits from all trusted clients and assigns them to their respective resource-aware weights. By performing a weighted summation, we finally obtain the global logits of this sample: ; Finally, the server packages and distributes the calculated global logits of all samples to each vehicle client. In specific trusted environments or test scenarios, the system supports configuring all logits to be distributed. By forcing it to be set to 1, the anomaly detection mechanism is bypassed, and the aggregation phase is entered directly.

5. The resource-aware federated knowledge distillation intrusion detection method for vehicle-to-everything (V2X) networks according to claim 1, characterized in that, In step S3, after each vehicle client receives the aggregated logits containing global knowledge from the server, it starts a multi-round distillation training process locally: First, the client loads the public dataset from local storage. and the received global logits Samples in the dataset Establish the corresponding relationships and complete the training data preparation work; At the start of each round of distillation training, the client... First, use the current model parameters. For public datasets The samples in the model are used for forward propagation to obtain the output of the penultimate layer of the local model. As local logits ; Subsequently, based on global logits With local logits Calculate the distribution difference and construct a distillation loss function based on KL divergence: ; in This represents the total number of categories in the attack detection task, including normal traffic and various attack types. Representing global knowledge in categories Confidence level on Indicates the local model in category The prediction confidence level; During backpropagation, the client calculates the distillation loss function on the model parameters. gradient The model parameters are updated using the gradient descent algorithm: ; The distillation training process continues through multiple iterations until each round of training makes the prediction distribution of the local model closer to the consensus distribution of the global knowledge representation. After completing the preset training rounds, the client evaluates and verifies the optimized model to ensure that the model performance meets the deployment requirements; Ultimately, each client will deploy the knowledge-distilled and optimized model on its local intrusion detection system.

6. A system for implementing the resource-aware federated knowledge distillation intrusion detection method for vehicle-to-everything (V2X) networks as described in any one of claims 1 to 5, characterized in that: This includes servers, roadside units, and vehicle clients; The server executes a resource-aware model allocation strategy, dynamically generating personalized models based on the vehicle client's computing power, storage capacity, and communication bandwidth; it is also responsible for aggregating the logits uploaded by each client, performing a consistency check based on cosine similarity to filter out abnormal clients, and calculating global knowledge to distribute to each client. The roadside unit constitutes the edge computing node of the vehicle network, undertakes the data relay task between the server and the vehicle client, is responsible for forwarding model parameters, logits data and training instructions, and provides local computing support at the network edge layer. The vehicle client receives the personalized model and trains it locally, generates logits output using a public dataset, performs distillation training based on global knowledge distributed by the server, and finally deploys the optimized model locally to achieve real-time intrusion detection.