Timestamp-Aware Spatio-Temporal Graph Contrastive Learning for Network Intrusion Detection

Jianli Dai, Guangwei Wu, Jiacheng Li, Weiping Wang, An He +1 more
6/15/2026
cs.CRcs.AIcs.LG
gnncontrastive-ssl

No confident code implementation found for this paper.

Abstract

Given their effectiveness in modeling the relational structure among network traffic flows, graph neural networks (GNNs) have been widely adopted in network intrusion detection systems (NIDSs). However, most existing GNN-based NIDS approaches focus on the relational structure of traffic flows, and treat them as temporally independent, which limits their ability to cope with evolving attack behaviors.

Show full abstract

Moreover, their reliance on supervised or semi-supervised learning often restricts generalization to unseen attacks. To address these limitations, we propose a novel self-supervised GNN-based framework. To the best of our knowledge, the proposed model is among the first self-supervised GNN-based NIDS models to explicitly leverage real timestamps, which provides faithful temporal dependencies for representation learning. We first construct a series of temporal graphs from network traffic flows according to their timestamps, and then employ an E-GraphSAGE and LSTM based encoder to fully extract temporal information and spatial dependencies of network traffic, without introducing time-costly attention mechanisms. A multi-view graph contrastive learning (GCL) scheme is introduced, where temporal, spatial, and feature contrasts are jointly performed to capture temporal continuity, preserve structural consistency, and improve the generalization and robustness of the learned representations, respectively. In addition, a gradient-norm-based adaptive weighting strategy is designed to optimize the contrastive loss weights. Experimental results on four representative NIDS datasets with real timestamps demonstrate that our method significantly outperforms existing self-supervised approaches and achieves performance comparable to the supervised state-of-the-art GNN method, while maintaining high computational efficiency.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{dai2026timestampaware,
  title  = {Timestamp-Aware Spatio-Temporal Graph Contrastive Learning for Network Intrusion Detection},
  author = {Jianli Dai and Guangwei Wu and Jiacheng Li and Weiping Wang and An He and Xinjun Xiao},
  year   = {2026},
  eprint = {2606.17109},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.17109v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.17109.svg)](https://codeofpaper.com/paper/2606.17109)

Discussion