A Joint Reconstruction-Triplet Loss Autoencoder Approach Toward Unseen Attack Detection in IoV Networks

Julia Boone, Tolunay Seyfi, Fatemeh Afghah

As vehicles become increasingly integrated into the Internet of Vehicles (IoV) ecosystem, the risk of sophisticated cyberattacks grows. Traditional security frameworks often rely on supervised learning, which requires extensive labeled datasets of known threats. However, these models frequently fail to detect "zero-day" or unseen attacks. This research, published in the IEEE Internet of Things Journal, proposes a robust unsupervised approach to address these vulnerabilities.

Methodology

The core of the proposed solution is a Joint Reconstruction-Triplet Loss Autoencoder. Unlike standard autoencoders that may inadvertently learn to reconstruct anomalous data, this model uses a dual-objective loss function to create a highly discriminative latent space.

Architecture

The model utilizes Long Short-Term Memory (LSTM) layers in both the encoder ($g_\phi$) and decoder ($f_\theta$). LSTMs are specifically chosen for their ability to capture the temporal dependencies inherent in network traffic flows.

Architecture of the proposed Joint Reconstruction-Triplet Loss Autoencoder

Joint Loss Function

The optimization process balances two primary goals:

  1. Reconstruction Loss ($L_{REC}$): This ensures the model can accurately reconstruct benign input sequences. During inference, attacks—which the model has never seen—result in high reconstruction errors.
  2. Triplet Margin Loss ($L_{TML}$): This loss forces the encoder to map benign samples into a tight, cohesive cluster in the latent space. By minimizing the distance between an "Anchor" and a "Positive" sample (anchor + noise) while maximizing the distance to a "Negative" sample (a different benign sequence), the model learns a more precise representation of normal behavior.
Overview of flow sequence and triplet generation for training

Thresholding and Decision Making

Anomaly detection is performed using a percentile-based threshold. By calculating the 99th percentile of reconstruction errors on the training set, the system can effectively flag any flow exceeding this value as a potential intrusion.

Experimental Setup

The researchers evaluated their model using two modern datasets that reflect contemporary IoV threats:

  • ACI-IoT-2023: Contains modern attacks such as ARP spoofing, DoS, and Brute Force.
  • WUSTL-IIoT-2021: Includes stealthier exploits like SQL Injection and Backdoors.

To ensure the model learned a diverse representation of "normal" traffic, the Synthetic Minority Over-sampling Technique (SMOTE) was employed to balance the benign training data.

Key Results and Discussion

The joint loss approach demonstrated significant improvements over baseline methods. On the WUSTL dataset, the model achieved a perfect 100% anomaly accuracy, while reaching 97.28% on the ACI dataset. In comparison, a standard Autoencoder only managed 66.6% accuracy on ACI.

Latent Space Cohesion

A critical finding was the impact of the triplet loss on latent space organization. Without $L_{TML}$, benign data points were relatively dispersed (average length 0.72). With the joint loss, the benign cluster tightened significantly (average length 0.20), making deviations caused by attacks much more apparent.

Transfer Learning and Generalizability

The study also highlighted the model's potential for transfer learning. An encoder pre-trained on one IoT environment could be successfully adapted to another by fine-tuning only the decoder, even in the absence of attack data in the target domain.

Conclusion

This research provides a powerful, unsupervised framework for securing IoV networks against evolving threats. By combining reconstruction accuracy with latent space tightening, the model achieves near-perfect detection rates for unseen attacks. Future work will focus on optimizing the computational overhead of LSTMs for edge deployment and exploring multimodal sensor fusion to detect even more complex physical-cyber attacks.

Summary updated

BibTeX
@article{boone2025joint,
  author = {Julia Boone and Tolunay Seyfi and Fatemeh Afghah},
  title = {{A Joint Reconstruction-Triplet Loss Autoencoder Approach Toward Unseen Attack Detection in IoV Networks}},
  journal = {IEEE Internet of Things Journal},
  year = {2025},
  doi = {10.1109/jiot.2025.3576219},
}
Figure