Lightweight Internet of Vehicles intrusion detection method based on liquid multi-scale time sequence distillation

By constructing a collaborative distillation mechanism of multi-scale temporal autoencoders and convolutionally gated liquid neural units, the problems of unstable network communication and limited resources in vehicle-to-everything (V2X) networks are solved, and a lightweight and efficient intrusion detection system is realized.

CN121888262APending Publication Date: 2026-04-17SUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUZHOU UNIV
Filing Date
2025-12-10
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

The Internet of Vehicles (IoV) suffers from problems such as unstable network communication, limited resources, and insufficient modeling of complex multi-scale temporal patterns, making it difficult for existing intrusion detection systems to effectively detect malicious attacks.

Method used

A multi-scale temporal autoencoder is constructed as the teacher model. Through the collaborative distillation mechanism of convolutional gated liquid neural units and double loss constraints, a lightweight feature extractor is transferred to perform intrusion detection.

Benefits of technology

It achieves efficient and lightweight intrusion detection in the vehicle-to-everything (V2X) environment, can capture complex traffic patterns and improve detection accuracy, and adapts to vehicle resource constraints.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121888262A_ABST
    Figure CN121888262A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight Internet of Vehicles intrusion detection method based on liquid multi-scale time sequence distillation, and relates to the technical field of Internet of Vehicles safety. The method comprises the steps that a multi-scale time sequence auto-encoder is constructed and trained, and the trained multi-scale time sequence auto-encoder serves as a teacher feature extractor; and constructing a teacher model based on the teacher feature extractor, constructing a student model taking a convolution gating liquid neural unit as a core, and migrating the feature extraction capability of the teacher model to the student model through a dual-loss constraint collaborative distillation mechanism to obtain a lightweight feature extractor. According to the invention, through the model distillation technology, the characterization capability of the multi-scale space-time auto-encoder is migrated to the lightweight student model constructed based on the convolution gating liquid neural unit, and the intrusion detection system is finally constructed by using the encoder or the student model through migration learning, so that the false alarm rate and the missing report rate can be effectively and synchronously reduced, and the detection accuracy is improved. And a feasible scheme is provided for vehicle-mounted network security protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of vehicle network security technology, specifically a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation. Background Technology

[0002] With the rapid popularization of intelligent connected vehicles, information interaction between vehicles and the outside world is becoming increasingly frequent, and the Internet of Vehicles (IoV) has become an important part of modern transportation systems. However, the open network environment exposes vehicles to severe cybersecurity threats, and malicious attacks may lead to serious consequences such as loss of vehicle control and privacy leaks. Intrusion Detection Systems (IDS), as a key technology for ensuring IoV security, identify abnormal behavior by monitoring network traffic in real time, and have become a research hotspot in the industry. Based on detection theory, they are mainly divided into two categories: Misuse-Based IDS (MIDS) and Anomaly-Based IDS (AIDS). MIDS relies on predefined feature libraries to match attacks, but it is easily circumvented and difficult to detect zero-day attacks. AIDS, on the other hand, detects attacks by identifying deviations from normal behavior. However, the special environment of IoV poses severe challenges to IDS: firstly, high-speed movement easily leads to unstable network communication; secondly, onboard resources are limited, making it difficult to deploy large models, and lightweight models are prone to performance loss; finally, existing methods are insufficient in modeling long-term dependencies and complex multi-scale temporal patterns in traffic. Therefore, this invention proposes a lightweight IoV intrusion detection method based on liquid multi-scale temporal distillation. Summary of the Invention

[0003] The purpose of this invention is to provide a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation, so as to solve the problems mentioned in the background art.

[0004] According to a first aspect of the present invention, in order to achieve the above-mentioned objective, the present invention provides the following technical solution: a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation, comprising the following steps: A multi-scale temporal autoencoder was constructed and trained, and the trained multi-scale temporal autoencoder was used as a teacher feature extractor. A teacher model is constructed based on the teacher feature extractor, and a student model with a convolutional gated liquid neural unit as its core is constructed. The feature extraction capability of the teacher model is transferred to the student model through a collaborative distillation mechanism with double loss constraints, resulting in a lightweight feature extractor. A classification head is added to the teacher feature extractor and the lightweight feature extractor respectively to form an intrusion detection system. The classification head is trained through transfer learning and the teacher feature extractor and the lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system.

[0005] Furthermore, a multi-scale temporal autoencoder is constructed and trained, and the trained multi-scale temporal autoencoder is used as the teacher feature extractor, as follows: (21) Multi-scale spatial feature extraction: (21.1) Input the vehicle network raw traffic data tensor x within the input time window, process it in parallel through multi-branch dilated convolution, capture the instantaneous burst mode and periodic evolution mode of traffic with three complementary receptive fields of 1×1, 3×3 and 5×5, and output three feature maps of different scales. (21.2) The three feature maps are spliced ​​along the channel dimension to achieve the initial fusion of multi-scale features. Then, the spliced ​​features are input into an SE channel attention module. This module captures the global information of each channel through global average pooling, and then generates channel weights through two fully connected layers. The features of each channel are weighted and the multi-scale fusion features enhanced by the channel attention module are output. (21.3) Perform max pooling on the multi-scale fused features, then flatten the features, and concatenate the feature vectors of all time steps t in order to form a feature sequence; (22) Temporal dependency modeling: (22.1) Use a bidirectional long short-term memory network to encode the feature sequence in both forward and backward directions to fully capture the forward and backward dependencies of the traffic data; (22.2) Introduce a self-attention mechanism, calculate the attention weights at each time step through a learnable query, key and value mapping, and then perform weighted aggregation on the features after Softmax normalization to obtain a low-dimensional representation z; (22.3) Channel attention and temporal attention form a two-stage collaborative optimization mechanism in the spatial-temporal dimension, enabling multi-scale temporal autoencoders to jointly learn the most discriminative spatial patterns and temporal segments. The decoder then gradually reconstructs the input through deconvolution layers and upsampling operations, completing end-to-end representation learning. In the formula, x represents the input to each convolutional layer, Conv represents a 2-dimensional convolutional layer, N×N represents the kernel size of the corresponding convolutional layer, MaxPool represents the max pooling layer, "[]" means concatenating the outputs of the convolutional layer and the pooling layer, and SE means using the channel attention mechanism for weighting; This represents multi-scale convolution; This represents a time step data point in the data input into the model. represents a multi-scale convolutional layer, and Flatten represents a flattened layer; This indicates that spatial features are extracted from the input data according to time steps; (23) The training process of the multi-scale temporal autoencoder is as follows: (23.1) Initialize encoder parameters and decoder parameters And build the Adam optimizer to update the parameters; (23.2) Perform the following operations for each round of training: Read each batch of data B from the training set sequentially: Forward propagation: For each time step t From 1 to T Spatial features are extracted sequentially. ; Concatenate all time-step features into a sequence ; Input bidirectional LSTM to obtain temporal modeling features ; Extracting global context vectors using an attention mechanism ; Obtained through a fully connected layer ; Repeat z' and input it into BiLSTM to obtain the reconstructed feature sequence. ; For each time step t Obtain reconstructed samples from the decoder ; Loss Calculation: Calculate the mean square error loss ; Backpropagation and parameter update: Calculate the encoder and decoder gradients ∇ ,∇ ; Update parameters and ; (23.3) Return the optimal encoder parameters With decoder parameters .

[0006] Furthermore, a teacher model is constructed based on a teacher feature extractor, and a student model is constructed with a convolutionally gated liquid neural unit as its core, as detailed below: (31) The teacher model is a multi-scale temporal encoder after training. After the teacher feature extractor, the projection layer and the classification layer are connected in sequence to form the teacher model T. The projection layer reduces the feature dimension to the same dimension as the student model output, and the classification layer outputs the logits probability distribution. (32) The student model consists of an initial convolutional layer, T cascaded convolutional gated liquid time constant units, a feature aggregator, a fully connected network, and a classification layer. The specific construction of the student model is as follows: (32.1) Initial spatial feature extraction: The input data of the student model is a five-dimensional tensor. x First, the spatial information of each time step is processed through a shared initial convolutional layer, which maps the original input data to a high-dimensional feature space to extract basic spatial patterns and outputs a feature map. (32.2) Temporal modeling: After restoring the time dimension, by T A sequence module composed of sequentially connected liquid time constant units processes the sequence in order to perform time modeling. Among them, the liquid time constant unit network enhances the recurrent neural network's ability to express complex time patterns by explicitly modeling gating mechanisms and dynamic systems. Its state evolution equation is shown below: in It is in a hidden state. It is a time-related input. It is the fundamental time constant. These are network parameters. A The coefficients are constants; the function f It is a neural network with Sigmoid activation; the liquid time constant network dynamically adjusts the time constant through an input-dependent gating mechanism, enabling the model to adaptively respond to time patterns of different speeds; Each liquid time constant unit in the student model receives the feature map of the current time step. and the cell state of the previous time step As input, the information flow is controlled through four key gating components: Input gate Determine which parts of the current input feature map should be updated in the state; Forgotten Gate Determine how much of the previous cell's state to retain. ; Candidate gate Calculate a new candidate state based on the current input; Output gate Control the current cell state How many were output to the hidden state? ; (32.3) Feature aggregation and output: The feature aggregator concatenates and flattens the hidden state outputs from all time steps, then passes them to a fully connected network. The fully connected layer integrates the spatiotemporal features learned over the entire time window, generating a fixed-length comprehensive feature representation. Finally, a simple classification layer aligns with the logits probability distribution of the teacher model. Furthermore, in the cooperative distillation mechanism with dual loss constraints, the mixing loss function is as follows: (41) Introduce a balance factor α The KL divergence probability distribution alignment and feature layer structured matching MSE loss, which integrates responsive knowledge, are defined as follows: KL divergence focuses on guiding students to learn the inter-class relationships and confidence characteristics implied in the probability distribution predicted by the teacher model, while MSE loss ensures that the student model's original output value logits is numerically closely aligned with the teacher model. The combination of the two provides richer and more comprehensive supervision signals.

[0007] Furthermore, through a collaborative distillation mechanism with dual loss constraints, the feature extraction capability of the teacher model is transferred to the student model, resulting in a lightweight feature extractor, as detailed below: (51) Input: Teacher model T, student model S, training data , verify data Temperature coefficient τ, loss weight α, number of training rounds E, learning rate η; (52) Processing steps: 52.1) Initialize student model parameters And use the Adam optimizer to update parameters; 52.2) Set the optimal verification loss It is infinite; 52.3) Perform the following operations for each round of training: a) Read each batch (X, y) in the training set sequentially: The input X is forward-propagated using the teacher model T to obtain the category output. and intermediate features ; By performing forward propagation on the input X using the student model S, the category input is obtained. and intermediate features ; Calculate the overall loss ; Based on the loss, the student model parameters Perform an Adam update; b) In the validation set Calculate the validation loss of the current model. ; c) If Less than Then update And save the current student model parameters; 52.4) Return the optimal student model parameters ; (53) Output: Optimal student model parameters .

[0008] Furthermore, classification heads are added to the teacher feature extractor and the lightweight feature extractor respectively to form an intrusion detection system. The classification head is a lightweight multilayer perceptron, whose structure includes, in sequence: a fully connected layer, a batch normalization layer, a ReLU activation function, a Dropout layer, and a final classification fully connected layer. The input to the classification head is intermediate layer features x from the teacher encoder or student model. The classification head performs initial compression and information focusing on the input data through a fully connected layer, then standardizes the features using a batch normalization layer, and introduces the ReLU activation function to increase non-linear expressive power. The Dropout layer enhances the robustness of the classification head by randomly masking neuron nodes. Finally, a classification fully connected layer generates the class probability distribution. In the formula, ReLU is the activation function.

[0009] Furthermore, the classification head is trained through transfer learning, and the teacher feature extractor and lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system, as follows: (71) Input: pre-trained encoder Enc Classifier C Training data , verify data Test data Number of training rounds E Learning rate η ; (72) Processing steps: 72.1) Initialize the optimizer Adam, and input the encoder and classifier parameters together; 72.2) Set the optimal verification accuracy =0; 72.3) For each round of training ( E (poch) performs the following operations: a) Read each batch in the training set sequentially. (X, y) : Using encoder Enc For inputX Feature extraction is performed to obtain intermediate representations. h ; Will h Input classifier C To obtain the prediction results ŷ ; Calculate the cross-entropy loss and update the parameters of the encoder and classifier using Adam based on the loss; b) In the validation set Calculate the accuracy of the current model. ; c) If Above the accuracy threshold Then update And save the current model parameters; 72.4) In the test set The final model performance is evaluated. 72.5) Returns the encoder corresponding to the optimal parameters. Enc With classifier C ; (73) Output: Optimal encoder Enc and classifier C .

[0010] Furthermore, it also includes dataset construction and preprocessing, as detailed below: Sample data were collected using three public datasets: CIC IDS2017, NSL KDD, and KDD CUP99. The specific sample data preprocessing methods included encoding conversion, numerical processing, and time window sampling.

[0011] According to a second aspect of the present invention, the present invention provides a lightweight vehicle network intrusion detection system based on liquid multi-scale time-series distillation, for implementing the lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation described in the first aspect, comprising: The architecture module is used to build and train a multi-scale temporal autoencoder, and the trained multi-scale temporal autoencoder is used as a teacher feature extractor. The transfer training module is used to build a teacher model based on the teacher feature extractor and a student model with a convolutional gated liquid neural unit as the core. Through a collaborative distillation mechanism with double loss constraints, the feature extraction capability of the teacher model is transferred to the student model to obtain a lightweight feature extractor. The training output module is used to add classification heads to the teacher feature extractor and the lightweight feature extractor respectively, forming an intrusion detection system. The classification heads are trained through transfer learning, and the teacher feature extractor and the lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system.

[0012] According to a third aspect of the present invention, the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor. When the processor loads and executes the computer program, it employs a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation as described in the first aspect.

[0013] This invention has at least the following beneficial effects: (1) This invention designs a multi-scale temporal feature enhancement encoder, constructs a parallel multi-scale convolution module based on SE attention, and adaptively captures the local burst patterns and multi-scale periodic features of traffic data through differentiated receptive fields, coupled with bidirectional LSTM layers to model the long-range dependencies of data, forming a teacher encoder with high expressive power.

[0014] (2) This invention proposes a spatiotemporally decoupled liquid architecture with convolutional gating. The front end uses lightweight convolutional layers to decouple spatial features. The back end innovatively designs a convolutional gating mechanism in the liquid unit and achieves feature condensation through adaptive pooling, ultimately constructing a lightweight student model with spatiotemporal joint modeling capabilities.

[0015] (3) This invention proposes a spatiotemporal co-distillation mechanism, constructs a co-distillation mechanism with dual loss constraints, attacks the category prediction distribution by KL divergence alignment, and forces the student model to reproduce the multi-scale spatiotemporal activation mode of the teacher encoder, thereby achieving high-fidelity spatiotemporal knowledge transfer.

[0016] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall architecture of the detection method described in this invention; Figure 2 This is a schematic diagram of the structure of the multi-scale temporal autoencoder in this invention; Figure 3 This is a schematic diagram of the student model based on convolution-gated liquid neural units in this invention; Figure 4 This is a schematic diagram of the structure of the convolution-gated liquid neural unit in this invention; Figure 5 This is a schematic diagram of the synergistic distillation mechanism with dual loss constraints in this invention; Figure 6 This is a schematic diagram of the training structure of the intrusion detection system in this invention; Figure 7 This is a schematic diagram of the data preprocessing process in this invention; Figure 8 This is a schematic diagram of the Stu_IDS binary classification confusion matrix of the present invention, where (a) is CIC IDS2017, (b) is NSLKDD, and (c) is KDD CUP99; Figure 9 This is a schematic diagram of the Enc_IDS binary classification confusion matrix of the present invention. (a) is CIC IDS2017, (b) is NSL KDD, and (c) is KDD CUP99. Figure 10 This is a schematic diagram of the Stu_IDS multi-class confusion matrix of the present invention, where (a) is CIC IDS2017, (b) is NSLKDD, and (c) is KDD CUP99; Figure 11 This is a schematic diagram of the Enc_IDS multi-class confusion matrix of the present invention, where (a) is CIC IDS2017, (b) is NSLKDD, and (c) is KDD CUP99; Figure 12 This is a schematic diagram of the ablation experiment results for the binary classification task of the present invention, where (a) is Stu_IDS and (b) is Enc_IDS; Figure 13 This is a schematic diagram of the ablation experiment results of the multi-classification task of the present invention, where (a) is Stu_IDS and (b) is Enc_IDS; Figure 14 This is a schematic flowchart of the detection method described in this invention. Detailed Implementation

[0018] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0019] Example 1: Explanation of related terms: Stu_IDS: The final intrusion detection system built based on the student model obtained by distillation; in short, an intrusion detection system based on the student model.

[0020] Enc_IDS: The final intrusion detection system built on the encoder model in the first-stage multi-scale temporal autoencoder. In short, it is an intrusion detection system based on the encoder model.

[0021] Conv2d: refers to a two-dimensional convolutional layer.

[0022] BN: refers to batch normalization.

[0023] ReLU: is the name of an activation function.

[0024] Sigmoid: is the name of an activation function.

[0025] The existing technologies for intrusion detection in vehicle networks are as follows: Machine learning-based intrusion detection methods Wahab et al. proposed a support vector machine-based intelligent detection model called CEAP for detecting malicious nodes in clustered vehicle self-organizing networks. Liu et al. used recursive feature elimination to filter key features and then used a decision tree model for intrusion detection. Tu et al. integrated three machine learning algorithms—logistic regression, random forest, and decision tree—using a soft voting mechanism and employed Bayesian optimization for hyperparameter optimization. Qin et al. addressed the issue of heterogeneity in vehicle data by integrating features from three dimensions: time, traffic, and voltage. Jeong et al. proposed two novel features for malicious injection packets on the CAN bus: inter-frame interval and counter information of the CAN data payload. Yang et al. integrated three algorithms—XGBoost, LightGBM, and CatBoost—selecting the best-performing model for different types of attacks and utilizing prediction confidence information to improve detection accuracy. Du et al. achieved fine-grained classification of known categories and identification of unknown attacks by having the model learn compact intra-class and distinguishable inter-class feature representations. Machine learning methods are gradually showing limitations when dealing with large-scale, highly complex data: their performance is severely constrained by cumbersome and poorly generalizable feature engineering, and the models themselves are difficult to effectively capture long-range dependencies and complex nonlinear relationships.

[0026] Deep learning-based intrusion detection methods Liu et al. effectively addressed the issues of feature redundancy, class imbalance, and insufficient single-scale feature extraction in intrusion detection through feature selection, multi-scale modeling, and loss function optimization. Li et al. reduced the model's dependence on labels and significantly decreased its size through self-supervised contrastive learning and self-knowledge distillation. Xue et al. proposed the HAE-HRL intrusion detection system based on a CNN-GRU encoder and residual network, which, while showing significant performance, suffers from high model complexity. Lu et al. fused convolutional autoencoders and factorization machines to detect CAN bus attacks, capturing local features and high-order interactions, but currently only supports binary classification. Djaidja et al. combined attention mechanisms with recurrent neural networks, utilizing stream sequence information to achieve early network intrusion detection, significantly reducing detection latency while maintaining high accuracy. Li et al. transferred BERT's semantic understanding capabilities to a lightweight CNN-BiLSTM model using knowledge distillation, achieving high accuracy and low resource consumption in vehicle network intrusion detection. Ding et al. proposed a multi-generator adversarial network, effectively mitigating class imbalance and inter-class overlap through a joint adversarial training framework, improving minority class attack detection performance. Given the powerful advantages of deep learning in automatically capturing complex traffic patterns... This embodiment addresses the long-term dependencies and multi-scale temporal patterns in vehicle network traffic by designing a multi-scale temporal feature encoder to construct a teacher model with high expressive power. At the same time, considering the low resource characteristics of vehicles, a liquid neural network is optimized to construct a lightweight student model, which maximizes the retention of teacher capabilities while reducing the model size.

[0027] The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation proposed in this embodiment has the following overall process: Figure 1 As shown, it consists of three main stages.

[0028] The first stage involves constructing and training a multi-scale temporal autoencoder (MsstAE) to obtain an encoder with strong feature extraction capabilities. The second stage builds a teacher model based on this encoder and designs a student model centered on a Convolutional Gated Liquid Neural Unit (CGLNU). A collaborative distillation mechanism with dual loss constraints transfers the feature extraction capabilities of the teacher model to the student model. The third stage adds classification heads to both the encoder and student model, forming the final IDS. In this stage, the classification head is trained using a transfer learning strategy, and the encoder and student model are fine-tuned to further improve overall detection performance. The implementation details of each part will be described in detail below.

[0029] Please see Figures 1-13 This invention provides a technical solution: a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation, comprising the following steps: S1. Construct and train a multi-scale temporal autoencoder, and use the trained multi-scale temporal autoencoder as a teacher feature extractor. S11 constructs a multi-scale temporal autoencoder (S11.1) A traditional autoencoder is an unsupervised learning neural network primarily used for tasks such as data dimensionality reduction, feature extraction, and data denoising. Its structure typically consists of two parts: an encoder and a decoder. The encoder takes the input data... x Mapping to low-dimensional representation z As shown in formula (1): (1) in, x It is the input data. W It is the hidden layer weight matrix. b It is a bias vector; furthermore, σ It is the activation function; the decoder then tries from z The ability to automatically learn data features makes autoencoders particularly well-suited for analyzing large and complex network traffic; (S11.2) In view of the characteristics of vehicle network traffic, this embodiment proposes to construct a multi-scale temporal autoencoder (MsstAE), the structure of which is as follows: Figure 2 As shown, the input tensor x First, multi-branch dilated convolutions are used in parallel processing to capture the instantaneous burst patterns and periodic evolution patterns of traffic using three complementary receptive fields: 1×1, 3×3, and 5×5. Then, multi-scale features are concatenated along the channel dimension to fuse these complementary features. To further enhance the representational power of key channels, a Squeeze-and-Excitation (SE) channel attention module is embedded after the concatenated features. This module adaptively learns channel weights through global average pooling and two fully connected layers, thereby enhancing important features and suppressing unnecessary features, providing spatial priors for subsequent BiLSTM temporal modeling. (S11.3) In the time series modeling stage, a bidirectional long short-term memory network (BiLSTM) is used to encode the feature sequence in both forward and backward directions to fully model the dependencies between traffic data. On this basis, a self-attention mechanism is introduced: the attention weights of each time step are calculated through learnable query, key and value mappings, and the features are weighted and aggregated after Softmax normalization, thereby highlighting key time frames and suppressing noise and redundant information. Channel attention and temporal attention form a two-stage collaborative optimization mechanism in the space-time dimension, enabling the encoder to jointly learn the most discriminative spatial patterns and temporal segments, significantly improving the robustness and discriminativeness of feature representation. The decoder, on the other hand, gradually reconstructs the input through deconvolution layers and upsampling operations, completing end-to-end representation learning. (2) (3) For formula (2), x represents the input to each convolutional layer, Conv represents a 2-dimensional convolutional layer, N×N represents the kernel size of the corresponding convolutional layer, MaxPool represents the max pooling layer, "[]" means concatenating the outputs of the convolutional layer and the pooling layer, and SE means using the channel attention mechanism for weighting. This represents multi-scale convolution; For formula (3) This represents a time step of data input into the model, and MaxPool represents the max pooling layer. represents a multi-scale convolutional layer, and Flatten represents a flattened layer; This indicates that spatial features are extracted from the input data according to time steps; (S11.4) The training objective of MsstAE is to provide a high-quality feature extraction encoder for the subsequent distillation process and to serve as the backbone network of the encoder-based intrusion detection system (Enc_IDS). Its training process is as follows: For each time window sample x, the encoder sequentially performs multi-scale dilated convolution, SE attention weighting, BiLSTM temporal modeling, and self-attention aggregation to finally obtain a low-dimensional representation z. The decoder reconstructs the representation using a symmetric structure. The loss function uses mean squared error (MSE), and the optimizer uses Adam. After each training epoch, the model is evaluated on the validation set, and the encoder weights with the lowest validation loss are retained. Algorithm 1 details its training process: Algorithm 1: Training Process of Encoder and Decoder enter: Training dataset D Time window length T The learning rate of the Adam optimizer η Maximum number of training rounds E ; Output: Optimal encoder parameters Used for feature extraction and temporal modeling; optimal decoder parameters Used for sequence reconstruction; step: 1) Initialize encoder parameters and decoder parameters And build the Adam optimizer to update the parameters; 2) For each round of training ( E (poch) performs the following operations: a) Read each batch of data B in the training set sequentially: Forward propagation: For each time step t From 1 to T Spatial features are extracted sequentially. ; Concatenate all time-step features into a sequence ; Input bidirectional LSTM to obtain temporal modeling features ; Extracting global context vectors using an attention mechanism ; Obtained through a fully connected layer ; Repeat z' and input it into BiLSTM to obtain the reconstructed feature sequence. ; For each time step t Obtain reconstructed samples from the decoder ; Loss Calculation: Calculate the mean square error loss ; Backpropagation and parameter update: Calculate the encoder and decoder gradients ∇ , ∇ ; Update parameters and ; 3) Return the optimal encoder parameters With decoder parameters ; S2. Construct a teacher model based on the teacher feature extractor, and construct a student model with a convolutional gated liquid neural unit as the core. Through a collaborative distillation mechanism with double loss constraints, transfer the feature extraction capability of the teacher model to the student model to obtain a lightweight feature extractor. S21. Hybrid Loss Function Knowledge distillation (KD) achieves efficient knowledge transfer and model compression by guiding lightweight student models to mimic the behavior of complex teacher models. Its core elements include knowledge form, teacher-student architecture, and distillation algorithm design. Response-based knowledge is widely used due to its simplicity of implementation. It typically uses the Kullback-Leibler (KL) divergence between the output distributions of the teacher and student models as a key objective, as shown in Equation (4). (4) in, and Let represent the probability distributions of students and teachers, respectively. T For temperature parameters; However, such methods only utilize the prediction information of the output layer and ignore the structured representation of intermediate features. To introduce richer supervision signals, Feature-Based Knowledge has been proposed to improve the distillation effect by matching the feature representations of the intermediate layers of the teacher-student network, as shown in Equation (5): (5) in, It is a feature adaptation function. and These are the feature maps of the teacher model and the student model, respectively. However, since MSE only constrains the similarity of feature values, it makes it difficult for the student model to capture the inherent structured relationships in the teacher model. Therefore, this embodiment proposes a mixed distillation loss function by introducing a balance factor. α The probability distribution alignment (KL divergence) of the responsive knowledge is fused with the structured matching of the feature layer (MSE loss), as defined in equation (6): (6) KL divergence focuses on guiding students to learn the inter-class relationships and confidence characteristics implied in the probability distribution predicted by the teacher model, while MSE loss ensures that the student model's original output values ​​(logits) are numerically closely aligned with the teacher model. The combination of the two provides richer and more comprehensive supervisory signals; simultaneously, by adjusting the balance factor... α It can dynamically balance the influence of the two supervision signals according to the specific task requirements and dataset characteristics. In addition, this hybrid strategy effectively alleviates the limitations of a single loss, overcomes the problem that the single KL loss is sensitive to temperature and ignores absolute numerical differences, and also makes up for the potential shortcomings of the single MSE loss in terms of the fine relationship in the transmission probability distribution. S22. Constructing a student model of a convolutionally gated liquid neural unit. To adapt to the resource constraints in the vehicle environment, this embodiment designs a liquid neural unit based on convolutional gating as the student model. The teacher model is a multi-scale temporal encoder pre-trained in the first stage. After the teacher feature extractor, a projection layer and a classification layer are connected in sequence to form the teacher model T. The projection layer reduces the feature dimension to the same dimension as the student model output, and the classification layer outputs the logits probability distribution. Liquid Time Constant Networks (LTCs)

[10] enhance the ability of recurrent neural networks to express complex time patterns by explicitly modeling gating mechanisms and dynamic systems. Their state evolution equation is shown in equation (7).

[0030] (7) in It is in a hidden state. It is a time-related input. It is the fundamental time constant. These are network parameters. A The coefficients are constants; the function f Typically, it is a neural network with Sigmoid activation (such as tanh); LTCs dynamically adjust the time constant through an input-dependent gating mechanism, enabling the model to adaptively respond to time patterns at different speeds; Based on the excellent properties of LTC, this embodiment designs a convolution-gated liquid neural unit as a student model, the structure of which is as follows: Figure 3 As shown: Input five-dimensional tensor x First, a shared initial convolutional layer processes the spatial information at each time step, mapping the original input to a higher-dimensional feature space to extract basic spatial patterns; after restoring the temporal dimension, the... T A module consisting of (time window size) Liquid Time-Constant Cells (LTCCs) processes the sequence sequentially to perform temporal modeling; a feature aggregator concatenates and flattens the hidden state outputs of all time steps and then passes them to a fully connected network; the fully connected layer integrates the spatiotemporal features learned throughout the time window to generate a fixed-length, information-rich comprehensive representation; finally, a simple classification layer is aligned with the logits probability distribution of the teacher model to facilitate subsequent distillation. The structure of the liquid time constant cell (LTCC) in the student model is as follows: Figure 4 As shown, each LTCC receives the feature map of the current time step. and the cell state of the previous time step As input, information flow is controlled through four key gating components. Input gate Determines which parts of the current input feature map should be updated in the state. Forget gate. Determine how much of the previous cell's state to retain. Candidate gate Calculate a new candidate state based on the current input. Output gate. Control the current cell state How many were output to the hidden state? .

[0031] It is worth noting that all gating mechanisms in this embodiment are implemented using convolutional operations rather than fully connected layers. This design brings two main advantages. First, LTCC operates directly on the feature map through convolutional gates, simultaneously capturing both spatial local patterns and temporal dynamic evolution. Second, the parallelism of convolutions makes processing high-dimensional inputs more efficient.

[0032] S23. Model Distillation The previous section introduced the loss function, teacher model, and student model used in distillation. This section will elaborate on the model distillation process. Figure 5 The process of model distillation is demonstrated: The teacher model consists of an encoder obtained in the first stage and two fully connected layers. The encoder computes a low-dimensional representation of the input data. z After that, the first fully connected layer... z Dimensionality reduction is performed to adapt to the feature representation output by the student model. The second fully connected layer outputs the logits probability distribution of the data. The student model is composed of the feature representation and logits probability distribution of the data output by the fully connected layer and the classification layer. Finally, the loss value is calculated by the mixture loss function based on the feature representation and logits probability distribution output by both. After each training cycle, the model distillation process is performed using a validation set to verify the distillation effect. The student model with the lowest validation loss is retained as the final model. Algorithm 2 details its training process.

[0033] The training process for knowledge distillation in Algorithm 2 is as follows: enter: Teacher Model T Student Model S Training data , verify data Temperature coefficient τ Loss weight α Number of training rounds E Learning rate η ; Output: Optimal student model parameters ; step: 1) Initialize student model parameters And use the Adam optimizer to update parameters; 2) Set the optimal validation loss It is infinite; 3) For each round of training ( E (poch) performs the following operations: a) Read each batch in the training set sequentially. (X, y) : Through the teacher model T For input X Perform forward propagation to obtain the category output. and intermediate features ; Through student model S For input X Perform forward propagation to obtain the category input. and intermediate features ; Calculate the overall loss ; Based on the loss, the student model parameters Perform an Adam update; b) In the validation set Calculate the validation loss of the current model. ; c) If Less than Then update And save the current student model parameters; 4) Return the optimal student model parameters ; S3. Add classification heads to the teacher feature extractor and the lightweight feature extractor respectively to form an intrusion detection system. Train the classification heads through transfer learning and fine-tune the teacher feature extractor and the lightweight feature extractor to obtain the final lightweight intrusion detection system. S31. This embodiment will describe the final construction and training of the IDS. The final IDS uses an encoder model or a student model to perform feature extraction, and obtains classification output by adding a classification head, such as... Figure 6 As shown, the classification head proposed in this embodiment is a lightweight multilayer perceptron, whose structure includes, in sequence: a fully connected layer, a batch normalization layer, a ReLU activation function, a Dropout layer, and a final fully connected classification layer, as shown in equation (8), where xThe intermediate layer features come from the encoder or student model; the classification head performs initial compression and information focusing on the input data through a fully connected layer, then standardizes the features using a batch normalization layer, and introduces the ReLU activation function to increase non-linear expressive power. The Dropout layer enhances the robustness of the classification head by randomly masking neuron nodes, reducing its overfitting risk. Finally, a fully connected layer generates the class probability distribution. (8) S32. Training of IDS is described as follows: As shown in Algorithm 3, IDS receives training data from the DataLoader for training, validation, and testing; the IDS model is generated by the encoder. Enc and classifier C It consists of two parts, with parameters optimized using the Adam optimizer. Unlike the previous experiment, the encoder... Enc Before training, first load the parameters of the encoder model or student model, and then fine-tune them with the classifier. C The parameters are jointly optimized. Cross-entropy loss is used as the loss function for training. After each round of training, the current model is validated on a validation set, and the encoder with the highest classification accuracy is retained. Enc and classifier C This serves as the final IDS. After all training rounds are completed, the best IDS is used for performance testing on the test set to provide feedback on the final IDS performance. Algorithm 3 details the IDS training process: The transfer learning process for Algorithm 3 classification task is as follows: enter: pre-trained encoder Enc Classifier C Training data , verify data Test data Number of training rounds E Learning rate η .

[0034] Output: Optimal encoder Enc and classifier C .

[0035] step: 1) Initialize the optimizer Adam and input the encoder and classifier parameters together.

[0036] 2) Set the optimal verification accuracy It is 0.

[0037] 3) For each round of training ( E(poch) performs the following operations: a) Read each batch in the training set sequentially. (X, y) : Using encoder Enc For input X Feature extraction is performed to obtain intermediate representations. h ; Will h Input classifier C To obtain the prediction results ŷ ; Calculate the cross-entropy loss and update the parameters of the encoder and classifier using Adam based on the loss; b) In the validation set Calculate the accuracy of the current model. }; c) If Higher than }, then update } and save the current model parameters.

[0038] 4) In the test set The final model performance is then evaluated.

[0039] 5) Return the encoder corresponding to the optimal parameters. Enc With classifier C .

[0040] Regarding the technical solution of this embodiment, the intrusion detection method proposed in this embodiment further includes dataset construction and data preprocessing, as detailed below: This embodiment uses three benchmark datasets, CIC IDS2017, NSL KDD, and KDD CUP99, to conduct a large number of binary and multi-class classification experiments. Since deep learning models usually have specific requirements for the format, size, and distribution of input data, preprocessing not only ensures that the data meets the model input requirements, but also helps the optimization algorithm converge faster and more stably. The following is a brief description of the three datasets used in the experiment: The CIC IDS2017 dataset, created by the Canadian Cyber ​​Security Institute, collects all traffic data from a simulated network over five days. This dataset contains a total of 2,830,743 samples, covering 14 attack subcategories. Due to hardware limitations, this embodiment uses stratified sampling to select 200,000 samples and merges some attack categories. Table 1 shows the detailed data distribution of the CIC IDS2017 dataset used in this embodiment.

[0041] As a widely used benchmark dataset in the field of network security, KDD CUP99 covers normal traffic and 38 attack variants across four major categories (DoS, Probe, U2R, R2L), providing a 41-dimensional feature space for intrusion detection model validation. Table 2 describes the distribution of the KDD CUP99 dataset: To overcome the data redundancy and distribution bias issues of KDD CUP99, this embodiment simultaneously adopts its improved version, the NSLKDD dataset. This dataset reconstructs the training / test set by removing 78% of duplicate records, introduces 14 new attack variants, and reduces the proportion of normal traffic from 78.3% to 53.5%, thus constructing a more balanced intrusion detection evaluation benchmark. Its data distribution is shown in the NSL KDD column of Table 5.

[0042] like Figure 7 As shown, the data preprocessing in this embodiment mainly includes the following three steps: encoding conversion, numerical processing, and time window sampling, as detailed below: 1) Encoding conversion The model employs a deep learning network architecture, therefore, the non-numerical features in the dataset must be converted into numerical features. Taking the NSL KDD dataset as an example, it contains four non-numerical features: protocol type (proto), state, service, and label. This embodiment uses One-Hot encoding for the protocol type, state, and service features, completing the numerical conversion while avoiding the introduction of spurious ordered relationships; and uses Labelencoder to encode the labels, enabling automatic adaptation to different classification tasks.

[0043] 2) Numerical processing For the numerical features in the dataset, the main processing includes missing value handling, normalization, and other feature processing. Specifically, this embodiment first deletes samples containing missing values ​​to prevent missing values ​​from affecting the data input. Secondly, the numerical features are normalized. Considering the sensitivity of outliers to max-min normalization and the sensitivity of zero and negative values ​​to logarithmic transformation, this embodiment uses two normalization methods in combination, as shown in equation (9).

[0044] (9) in This is the result after normalization. Indicates the first i The value of each feature, It is the first i The minimum value among the features, and Indicates the first iThe maximum value among the features. Finally, for invalid features in the dataset, this embodiment uses a deletion method. Taking NSL KDD as an example, its last feature is "difficulty level", which is obviously irrelevant to the traffic classification task and may even mislead the model. This embodiment deletes this feature when using the dataset.

[0045] 3) Time window sampling To model the temporal characteristics of network traffic, this embodiment employs a sliding time window mechanism. T=5 Constructing input samples: This involves taking the original samples from five consecutive time steps. Combine into a window and the label of the sample at the end of the window. As its label, it ensures correspondence with the latest state. Each sample within the window is independently transformed through feature imputation and dimensionality reshaping. The image ultimately forms a five-dimensional tensor. This provides regularized tensor inputs for spatiotemporal network models.

[0046] The technical effects of the present invention will be further verified by referring to specific embodiments below. 1. Results and Analysis 1.1 Evaluation Indicators To evaluate the method proposed in this embodiment, four metrics are used: accuracy, precision, recall, and F1 score. The calculation formulas for each metric are as follows: Where TP, TN, FP, and FN represent true positives, true negatives, false positives, and false negatives, respectively.

[0047] 1.2 Experimental Results of the Proposed Method 1.2.1 Binary Classification Experiment The intrusion detection task was initially formulated as a binary classification problem by categorizing all abnormal traffic into attack categories. The results are shown in Table 3. On the CIC IDS2017 dataset, Stu_IDS achieved 98.88% accuracy, precision, recall, and F1 score, while Enc_IDS slightly improved to 99.04%. For the NSL KDD dataset, both models achieved 99.30% and 99.40%, respectively, while on KDD CUP99, both reached 99.96%. These consistently high values ​​demonstrate that the proposed framework can effectively distinguish between normal and attack traffic across different datasets.

[0048] To visually demonstrate the detection performance, a confusion matrix was used for visualization. For example... Figure 8 and Figure 9As shown, most samples are distributed along the diagonal, confirming that the proposed method can effectively distinguish between normal traffic and attack traffic. According to the data in Table 3, both Stu_IDS and Enc_IDS achieved excellent binary classification performance, with Enc_IDS consistently outperforming the student model across all metrics. This indicates that the proposed distillation framework successfully transfers temporal and multi-scale features, enabling the lightweight student model to maintain high detection accuracy while reducing computational complexity.

[0049] On the CIC IDS2017 dataset—which contains a diverse range of attack types—the proposed model achieves a balanced performance in terms of precision and recall (both exceeding 98%), demonstrating its stability in real-world traffic scenarios. Although its performance on the CIC IDS2017 dataset is slightly lower than the other two datasets, indicating a sensitivity to modern heterogeneous attack patterns, the near-perfect results on the NSL KDD and KDD CUP99 datasets further validate the strong generalization ability of the proposed method. Overall, these results demonstrate the effectiveness of the proposed method in achieving high-precision and efficient intrusion detection in connected vehicle environments.

[0050] 1.2.2 Multiclassification Experiment Since different types of attacks require different defense strategies, this embodiment further evaluates the performance of the intrusion detection system in a multi-classification scenario. Table 4 summarizes the experimental results on the two datasets. Both Stu_IDS and Enc_IDS maintain excellent performance, with all evaluation metrics exceeding 98%.

[0051] On the CIC IDS2017 dataset, the accuracy slightly decreased compared to binary classification tasks due to the increased complexity of distinguishing various modern attack types (such as DoS, port scanning, and web attacks). Nevertheless, Figure 10 (a) and Figure 11 (a) shows that most samples can still be accurately identified, demonstrating that the model can effectively capture discriminative spatiotemporal patterns between different attack categories. The consistently superior performance of Enc_IDS indicates that the encoder-based representation preserves richer temporal dependencies, while the small performance gap between the two confirms that the distillation process effectively compresses this information into a lightweight student model. Furthermore, both models achieve accuracies exceeding 99.2% on NSL KDD and close to 99.96% on KDD CUP99.

[0052] Overall, the proposed multi-scale temporal distillation framework achieves a good balance between detection accuracy and computational efficiency, making it particularly suitable for real-time intrusion detection scenarios in the Internet of Vehicles environment.

[0053] 1.3 Comparison with existing methods To further explore the effectiveness of the proposed method in this embodiment, this section compares the proposed method with relatively novel methods in the literature according to task type and dataset. Tables 5 to 10 show the performance of different methods in detail, where the symbol "-" indicates that the result of this indicator was not provided in the original study.

[0054] 1.3.1 Binary Classification Comparison As shown in Table 5, on the CIC IDS2017 dataset, traditional models such as BAE and SADE-ELM achieve an accuracy of less than 94%, while recent representation learning methods such as IBYOL-IDS reach approximately 96.7%. In contrast, the proposed Stu_IDS and Enc_IDS achieve 98.88% and 99.04% respectively, significantly outperforming all baseline methods. This demonstrates the powerful ability of the proposed multi-scale temporal distillation framework to extract discriminative representations from complex, heterogeneous flows.

[0055] On NSL KDD (Table 6), the best-performing baseline method, HAE-HRL, achieved an accuracy of 95.7%, while the proposed Stu_IDS and Enc_IDS achieved 99.30% and 99.40%, respectively. On KDD CUP99 (Table 7), both models achieved near-perfect performance, with Enc_IDS and Stu_IDS reaching 99.96% across all metrics. Although CMAE achieved a competitive recall (98.30%), its overall performance was slightly inferior.

[0056] Overall, the proposed model demonstrates superior detection capabilities across all datasets. The sustained performance improvement over traditional machine learning and deep learning baseline models indicates that introducing temporal dependency modeling and multi-scale knowledge transfer effectively enhances representation quality while maintaining model efficiency. Furthermore, the small performance gap between Stu_IDS and Enc_IDS validates that the distillation process successfully transfers key knowledge to the lightweight student model, significantly reducing computational costs while ensuring high accuracy.

[0057] Among them, BAE (Backward Attack with Embedding) is a text adversarial sample generation algorithm; IBYOL-IDS model is a 5G-V2X network intrusion detection system based on federated learning and privacy protection; SADE-ELM algorithm (Adaptive Differential Evolutionary Extreme Learning Machine) is a hybrid optimization algorithm that combines Extreme Learning Machine (ELM) and Adaptive Differential Evolutionary Algorithm (SaDE). Among them, the HAE-HRL algorithm is a novel algorithmic framework that combines latent space coding and hierarchical reinforcement learning (HRL), aiming to optimize high-level policies through latent space representation and solve the long-term dependency problem in complex tasks; the AE-GRU algorithm is a deep learning model that combines autoencoders (AE) and gated recurrent units (GRU); the HHO-DNN algorithm is a hybrid optimization method that combines Harris Eagle Optimization (HHO) algorithm and deep neural networks (DNN), mainly used to improve the parameter optimization efficiency and prediction performance of the model; Among them, the CMA-ES algorithm (Covariance Matrix Adaptive Evolution Strategy) is a stochastic optimization algorithm based on an evolutionary strategy; 1.3.2 Multi-class comparison For multi-class classification scenarios, Tables 8 to 10 present the comparison results. At CIC IDS2017, KD-TCNN achieved the highest overall accuracy (99.44%), but the proposed Enc_IDS achieved 98.97%, surpassing most non-distillation baselines and remaining competitive even against specialized temporal distillation architectures. Stu_IDS also reached 98.63%, indicating that the student model effectively preserved its discriminative power after compression.

[0058] On NSL KDD and KDD CUP99, Stu_IDS and Enc_IDS exceeded 99% on all metrics, significantly outperforming baseline models such as AE-GRU and HHO-DNN, which typically remain below 90%. Although traditional algorithms such as SVM and DT perform relatively well on KDD CUP99 (around 98%), the proposed model still outperforms them.

[0059] An interesting phenomenon is that Stu_IDS slightly outperforms Enc_IDS on the KDD CUP99 dataset. This may be because the distillation process mitigates the influence of redundancy and biased patterns in this historical dataset, allowing the lightweight student model to achieve better generalization ability.

[0060] In summary, the proposed multi-scale temporal distillation method demonstrates excellent overall performance and stability across different datasets and classification tasks, verifying its applicability to practical vehicle network intrusion detection scenarios that require both detection accuracy and computational efficiency.

[0061] Among them, the KD-TCNN algorithm is a deep learning denoising method based on point cloud data, which combines the advantages of Gaussian filtering and convolutional neural networks (CNN) to deal with noise problems in 3D point clouds; TAC-GAN (Text-Adversarial Conditional GAN) is a generative adversarial network (GAN) model that combines text adversarial generation; Transfer-enhanced models are a class of algorithmic frameworks that improve model performance through transfer learning strategies, and are mainly applied in fields such as structural dynamic response analysis, deep learning optimization, and multimodal reasoning; Among them, SVM (Support Vector Machine) is the Support Vector Machine algorithm; DT (Decision Tree) is the Decision Tree algorithm; TAC-GAN (Text-Adversarial Conditional GAN) is a Generative Adversarial Network (GAN) model that combines text adversarial generation. 1.4 Lightweight Model Analysis The ultimate goal of the method proposed in this embodiment is to construct a lightweight vehicle intrusion detection system. This section will analyze the models used in this paper and demonstrate the lightweight nature of Stu_IDS. This embodiment implements an autoencoder model, a teacher model, a student model, Enc_IDS, and Stu_IDS in sequence. Table 11 shows the size of the models. The autoencoder model only saves the encoder part, with a size of 66.13MB. The teacher model consists of an encoder, a projection layer (reduced from 1152 dimensions to 128 dimensions), and a classification layer (reduced from 128 dimensions to the number of categories). The projection layer and classification layer are approximately 580KB in size on average, so the teacher model is approximately 66.70MB in size on average. The student model is 3.16MB in size. The classification head, together with the encoder and student model, constitutes Enc_IDS and Stu_IDS, respectively. The size of the classification head is not fixed as its input and output dimensions change. Because Enc_IDS has a higher input dimension for the classification head, both classification heads are 2.27MB. The Stu_IDS classification header receives relatively few inputs, so the number of categories plays a decisive role in the size of the classification header. The size of the binary classification header is 274.85KB, and the size of the multi-class header is 281.24KB.

[0062] 1.5 Ablation Experiment To validate the contribution of each component in the proposed method, we conducted a comprehensive ablation study on the CIC IDS2017 dataset. Experiments included binary and multi-class classification tasks. Results are summarized in... Figure 12and Figure 13 This research focuses on three main components: a multi-scale convolutional encoder, a liquid neural network (LNN) in the student model, and the fine-tuning process in transfer learning.

[0063] (1) Multi-scale convolution module The impact of replacing the encoder's multi-scale convolutions with a single-scale version was evaluated. The simplified variant exhibited a consistent performance decline, particularly in multi-class tasks, with Enc_IDS accuracy dropping from 99.01% to 98.64% and the F1 score from 99.00% to 98.64%. This confirms that multi-scale receptive fields can capture richer temporal-spatial dependencies, which is crucial for differentiating similar attacks such as PortScan and DoS. Although the student model (Stu_IDS) exhibited slight fluctuations due to the randomness of distillation, the overall trend validates the importance of multi-scale feature extraction in complex intrusion patterns.

[0064] (2) Liquid Neural Network in Student Model To evaluate the lightweight design, the LNN was replaced with a Gated Recurrent Unit (GRU) network (denoted as GRUStudent). The GRU-based variant achieved slightly higher accuracy in binary classification tasks (99.05% vs. 98.20%), but the model size increased from 3.16 MB to 9.39 MB. The proposed LNN, while reducing parameters by 66%, maintains approximately 97% of the performance of GRUStudent, demonstrating a superior efficiency-performance tradeoff. This characteristic is particularly suitable for vehicular networking devices with limited memory and computing resources, enabling real-time deployment.

[0065] (3) The effect of fine-tuning When the NoFineTuning stage was disabled, both models experienced a significant performance drop. The encoder's accuracy decreased by approximately 8.7%, while the student model's accuracy dropped by over 20%. This sharp decline indicates that fine-tuning plays a crucial role in adapting pre-trained representations to downstream intrusion detection tasks. Furthermore, the more severe performance drop in the student model suggests that effective knowledge distillation largely depends on the quality of the teacher-fine-tuned embeddings.

[0066] In summary, ablation studies have validated that multi-scale convolution enhances feature diversity, LNN ensures model compactness with almost no performance loss, and fine-tuning significantly improves generalization ability. These components together constitute a coherent and efficient real-time vehicular intrusion detection framework.

[0067] In summary, this embodiment proposes the Liquid-MSSTD method to address the challenges of abnormal traffic detection in vehicular networks. This method utilizes model distillation to transfer the representational capabilities of a multi-scale spatiotemporal autoencoder to a lightweight student model constructed based on convolutionally gated liquid neural units. The encoder or student model is then used to construct an intrusion detection system through transfer learning. Experimental results demonstrate that Liquid-MSSTD exhibits superior performance in vehicular network intrusion detection, effectively reducing both false positive and false negative rates, thus providing a feasible solution for vehicular network security protection.

[0068] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

Claims

1. A lightweight intrusion detection method for Internet of Vehicles based on liquid multi-scale time series distillation, characterized in that, Includes the following steps: A multi-scale temporal autoencoder was constructed and trained, and the trained multi-scale temporal autoencoder was used as a teacher feature extractor. A teacher model is constructed based on the teacher feature extractor, and a student model with a convolutional gated liquid neural unit as its core is constructed. The feature extraction capability of the teacher model is transferred to the student model through a collaborative distillation mechanism with double loss constraints, resulting in a lightweight feature extractor. A classification head is added to the teacher feature extractor and the lightweight feature extractor respectively to form an intrusion detection system. The classification head is trained through transfer learning and the teacher feature extractor and the lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system.

2. The lightweight vehicle networking intrusion detection method based on liquid multiscale time-series distillation according to claim 1, characterized in that: A multi-scale temporal autoencoder was constructed and trained, and the trained multi-scale temporal autoencoder was used as the teacher feature extractor, as follows: (21) Multi-scale spatial feature extraction: (21.1) Input the vehicle network raw traffic data tensor x within the input time window, process it in parallel through multi-branch dilated convolution, capture the instantaneous burst mode and periodic evolution mode of traffic with three complementary receptive fields of 1×1, 3×3 and 5×5, and output three feature maps of different scales. (21.2) The three feature maps are spliced ​​along the channel dimension to achieve the initial fusion of multi-scale features. Then, the spliced ​​features are input into an SE channel attention module. This module captures the global information of each channel through global average pooling, and then generates channel weights through two fully connected layers. The features of each channel are weighted and the multi-scale fusion features enhanced by the channel attention module are output. (21.3) Perform max pooling on the multi-scale fused features, then flatten the features, and concatenate the feature vectors of all time steps t in order to form a feature sequence; (22) Temporal dependency modeling: (22.1) Use a bidirectional long short-term memory network to encode the feature sequence in both forward and backward directions to fully capture the forward and backward dependencies of the traffic data; (22.2) Introduce a self-attention mechanism, calculate the attention weights at each time step through a learnable query, key and value mapping, and then perform weighted aggregation on the features after Softmax normalization to obtain a low-dimensional representation z; (22.3) Channel attention and temporal attention form a two-stage collaborative optimization mechanism in the spatial-temporal dimension, enabling multi-scale temporal autoencoders to jointly learn the most discriminative spatial patterns and temporal segments. The decoder then gradually reconstructs the input through deconvolution layers and upsampling operations, completing end-to-end representation learning. In the formula, x represents an input to each convolutional layer, Conv represents a 2-dimensional convolutional layer, NxN represents a convolution kernel size corresponding to the convolutional layer, MaxPool represents a maximum pooling layer, "[]" represents splicing outputs of the convolutional layer and the pooling layer, and SE represents weighting using a channel attention mechanism. is a multi-scale convolution. represents one time step data in input data into the model, is a multi-scale convolutional layer, and Flatten represents a flattening layer. represents spatial feature extraction on input data according to time steps. (23) The training process of the multi-scale temporal autoencoder is as follows: (23.1) Initialize the encoder parameters and decoder parameters and build an Adam optimizer for parameter update; (23.2) Perform the following operations for each round of training: Read each batch of data B from the training set sequentially: Forward propagation: For each time step t from 1 to T , extract spatial features in turn ; Concatenate all time-step features into a sequence ; Input bidirectional LSTM to obtain temporal modeling features ; Extracting global context vectors using an attention mechanism ; Obtained through a fully connected layer ; Repeat z' and input it into BiLSTM to obtain the reconstructed feature sequence. ; For each time step t Obtain reconstructed samples from the decoder ; Loss Calculation: Calculate the mean square error loss ; Backpropagation and parameter update: Calculate the encoder and decoder gradients ∇ ,∇ ; Update parameters and ; (23.3) Return the optimal encoder parameters With decoder parameters .

3. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 2, characterized in that: A teacher model is constructed based on a teacher feature extractor, and a student model is constructed with a convolutionally gated liquid neural unit as its core, as detailed below: (31) The teacher model is a trained multi-scale temporal encoder. After the teacher feature extractor, the projection layer and the classification layer are connected in sequence to form the teacher model T. The projection layer reduces the feature dimension to the same dimension as the student model output, and the classification layer outputs the logits probability distribution. (32) The student model consists of an initial convolutional layer, T cascaded convolutional gated liquid time constant units, a feature aggregator, a fully connected network, and a classification layer. The specific construction of the student model is as follows: (32.1) Initial spatial feature extraction: The input data of the student model is a five-dimensional tensor. x First, the spatial information of each time step is processed through a shared initial convolutional layer, which maps the original input data to a high-dimensional feature space to extract basic spatial patterns and outputs a feature map. (32.2) Temporal modeling: After restoring the time dimension, by T A sequence module composed of sequentially connected liquid time constant units processes the sequence in order to perform time modeling. Among them, the liquid time constant unit network enhances the recurrent neural network's ability to express complex time patterns by explicitly modeling gating mechanisms and dynamic systems. Its state evolution equation is shown below: in It is in a hidden state. It is a time-related input. It is the fundamental time constant. These are network parameters. A The coefficients are constants; the function f It is a neural network with Sigmoid activation; the liquid time constant network dynamically adjusts the time constant through an input-dependent gating mechanism, enabling the model to adaptively respond to time patterns of different speeds; Each liquid time constant unit in the student model receives the feature map of the current time step. and the cell state of the previous time step As input, the information flow is controlled through four key gating components: Input gate Determine which parts of the current input feature map should be updated in the state; Forgotten Gate Determine how much of the previous cell's state to retain. ; Candidate gate Calculate a new candidate state based on the current input; Output gate Control the current cell state How many were output to the hidden state? ; (32.3) Feature aggregation and output: The feature aggregator concatenates and flattens the hidden state outputs of all time steps, and then passes them to a fully connected network. The fully connected layer integrates the spatiotemporal features learned over the entire time window to generate a fixed-length comprehensive feature representation. Finally, a simple classification layer is aligned with the logits probability distribution of the teacher model.

4. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 3, characterized in that: In the cooperative distillation mechanism with dual loss constraints, the mixing loss function is as follows: (41) Introduce a balance factor α The KL divergence probability distribution alignment and feature layer structured matching MSE loss, which integrates responsive knowledge, are defined as follows: KL divergence focuses on guiding students to learn the inter-class relationships and confidence characteristics implied in the probability distribution predicted by the teacher model, while MSE loss ensures that the student model's original output value logits is numerically closely aligned with the teacher model. The combination of the two provides richer and more comprehensive supervision signals.

5. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 4, characterized in that: By employing a collaborative distillation mechanism with dual loss constraints, the feature extraction capabilities of the teacher model are transferred to the student model, resulting in a lightweight feature extractor, as detailed below: (51) Input: Teacher model T, student model S, training data , verify data Temperature coefficient τ, loss weight α, number of training rounds E, learning rate η; (52) Processing steps: 52.1) Initialize student model parameters And use the Adam optimizer to update parameters; 52.2) Set the optimal verification loss It is infinitely large; 52.3) Perform the following operations for each training epoch: a) Read each batch (X, y) in the training set sequentially: The input X is forward-propagated using the teacher model T to obtain the category output. and intermediate features ; By performing forward propagation on the input X using the student model S, the category input is obtained. and intermediate features ; Calculate the overall loss ; Based on the loss, the student model parameters Perform an Adam update; b) In the validation set Calculate the validation loss of the current model. ; c) If Less than Then update And save the current student model parameters; 52.4) Return the optimal student model parameters ; (53) Output: Optimal student model parameters .

6. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 5, characterized in that: A classification head is added to both the teacher feature extractor and the lightweight feature extractor to form an intrusion detection system. The classification head is a lightweight multilayer perceptron, whose structure includes, in sequence: a fully connected layer, a batch normalization layer, a ReLU activation function, a Dropout layer, and a final classification fully connected layer. The input to the classification head is intermediate layer features x from the teacher encoder or student model. The classification head performs initial compression and information focusing on the input data through a fully connected layer, then standardizes the features using a batch normalization layer, and introduces the ReLU activation function to increase non-linear expressive power. The Dropout layer enhances the robustness of the classification head by randomly masking neuron nodes. Finally, a classification fully connected layer generates the class probability distribution. In the formula, ReLU is the activation function.

7. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 6, characterized in that: The classification head is trained using transfer learning, and the teacher feature extractor and lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system, as follows: (71) Input: Pre-trained encoder Enc Classifier C Training data , verify data Test data Number of training rounds E Learning rate η ; (72) Processing steps: 72.1) Initialize the optimizer Adam, and input the encoder and classifier parameters together; 72.2) Set the optimal verification accuracy =0; 72.3) Perform the following operations for each round of training: a) Read each batch in the training set sequentially. (X, y) : Using encoder Enc For input X Feature extraction is performed to obtain intermediate representations. h ; Will h Input classifier C To obtain the prediction results ŷ ; Calculate the cross-entropy loss and update the parameters of the encoder and classifier using Adam based on the loss; b) In the validation set Calculate the accuracy of the current model. ; c) If Above the accuracy threshold Then update And save the current model parameters; 72.4) In the test set The final model performance is evaluated. 72.5) Returns the encoder corresponding to the optimal parameters. Enc With classifier C ; (73) Output: Optimal encoder Enc and classifier C .

8. The lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation according to claim 7, characterized in that: It also includes dataset construction and preprocessing, as detailed below: Sample data were collected using three public datasets: CIC IDS2017, NSL KDD, and KDD CUP99. The specific sample data preprocessing methods included encoding conversion, numerical processing, and time window sampling.

9. A lightweight vehicle-to-everything (V2X) intrusion detection system based on liquid multi-scale time-series distillation, used to implement the lightweight V2X intrusion detection method based on liquid multi-scale time-series distillation as described in any one of claims 1 to 8, characterized in that, include: The architecture module is used to build and train a multi-scale temporal autoencoder, and the trained multi-scale temporal autoencoder is used as a teacher feature extractor. The transfer training module is used to build a teacher model based on the teacher feature extractor and a student model with a convolutional gated liquid neural unit as the core. Through a collaborative distillation mechanism with double loss constraints, the feature extraction capability of the teacher model is transferred to the student model to obtain a lightweight feature extractor. The training output module is used to add classification heads to the teacher feature extractor and the lightweight feature extractor respectively, forming an intrusion detection system. The classification heads are trained through transfer learning, and the teacher feature extractor and the lightweight feature extractor are fine-tuned to obtain the final lightweight intrusion detection system.

10. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, The memory stores a computer program that can run on the processor. When the processor loads and executes the computer program, it employs a lightweight vehicle network intrusion detection method based on liquid multi-scale time-series distillation, as described in any one of claims 1 to 8.