ST-GAT: A Leakage-Free Spatio-Temporal Graph Attention Framework for Robust Network Intrusion Detection
Organizations: School of Computer Science and Engineering, VIT Chennai. · University of California, Irvine. · VIT Mauritius.
Abstract
Intrusion detection systems are a central defence in modern networks. Deep learning models report strong anomaly-detection results, but evaluations on standard benchmarks such as CSE-CIC-IDS-2018 are often inflated by two methodological problems: temporal leakage from overlapping sliding windows, and contamination from preprocessing fitted before the train/test split. Per-flow classifiers also ignore the spatio-temporal dependencies across sequences of network flows. We propose a Spatio-Temporal Graph Attention Network (ST-GAT) that represents traffic as a sequence of graph snapshots. It builds k-Nearest Neighbour (k-NN) edges within each window, applies multi-head Graph Attention Network (GAT) layers for spatial aggregation, and uses a Bidirectional Long Short-Term Memory (BiLSTM) network with temporal attention for sequence modelling. To prevent leakage, we use non-overlapping temporal windows (stride equal to window length) and fit all preprocessing on the training split only. We compare three class-imbalance strategies: inverse class-frequency weighting, dynamic balanced sampling, and few-shot metric prototyping. Across three random seeds, ST-GAT with inverse class weighting reached a Macro-F1 of 96.65% (+/- 0.87) and an accuracy of 99.14%. This is 14.3 percentage points higher in Macro-F1 than a per-flow Random Forest baseline (82.34%). Balanced sampling reduced Macro-F1 by 2.3 points (to 94.37%) relative to loss weighting. This suggests that aggressive resampling of small, noisy minority classes can hurt detection in heavily imbalanced traffic.
Figures & tables
| Authors & Year | Key Contribution | Results / Metric Reported | Opportunities for Extension (Methodological Flaws) | Alignment with Proposed ST-GAT |
|---|---|---|---|---|
| Dai et al. Dai et al. (2024) (2024) | CNN + BiLSTM + attention for NIDS, with Equalization Loss v2. | 99.4% Acc; 98.7% Macro-F1 (NSL-KDD / UNSW-NB15 / CIC-DDoS2019). | Scaling fitted before the split not ruled out; no graph-based spatial modelling. | Adds -NN spatial graphs, uses non-overlapping windows ( ), and fits scaling on the training split only. |
| Lo et al. Lo et al. (2022) (2022) | E-GraphSAGE: host-graph GNN with edge (flow) features. | 97.6% Macro-F1. | Requires endpoint identifiers to build host graphs; no temporal modelling across windows. | Builds -NN graphs from flow statistics alone and models temporal dependencies with BiLSTM and attention. |
| Liu et al. Liu et al. (2022) (2022) | Audit of CIC-IDS-2017 and CSE-CIC-IDS-2018 errors; corrected re-release. | Corrected labels reduce reported accuracy by up to 3%. | No new architecture proposed; does not address windowing or pre-split leakage. | Removes malformed (infinite/NaN) flows and additionally prevents windowing and pre-split leakage. |
| Hagar & Gawali Hagar and Gawali (2022) (2022) | CNN, LSTM, and Apache Spark models with RF feature selection and resampling. | Up to 100% Acc; F1 = 1.00 for most classes. | Resampling and normalisation not reported as train-only; no per-class Macro-F1 summary. | Reports Macro-F1 (96.65%) and per-class results under train-only preprocessing. |
| Bouke & Abdullah Bouke and Abdullah (2023) (2023) | Measures the effect of preprocessing leakage on six ML classifiers. | Leakage inflates accuracy by 1.5–4.0%. | Classical ML on tabular data only; windowing leakage not studied. | Applies train-only preprocessing to a deep spatio-temporal model and removes window overlap. |
| Appiahene et al. Appiahene et al. (2026) (2026) | GConvTrans (graph convolution + Transformer) on CSE-CIC-IDS-2018 (14 Feb. subset). | 96.94% test Acc. | Temporal-leakage controls not described; no comparison of imbalance strategies; F1 not reported. | Uses non-overlapping windows and compares inverse class weighting (96.65% Macro-F1) against sampling-based strategies. |
| Model & Strategy | Accuracy | Macro-F1 |
|---|---|---|
| ST-GAT (Proposed) | ||
| ST-GCN (Baseline) | ||
| GAT_MetricProto | ||
| GNN_MetricProto | ||
| GAT_BalancedSampler | ||
| GNN_BalancedSampler |
| Ablated Architecture | Accuracy | Macro-F1 |
|---|---|---|
| ST-GAT (Full Model) | ||
| w/o Raw Concat | ||
| w/o Temporal Attn | ||
| w/o Spatial (GAT) | ||
| w/o Temporal (BiLSTM) |
| Class Label | Support | Precision | Recall | F1-Score |
|---|---|---|---|---|
| Benign | 1367 | 0.9978 | 0.9920 | 0.9949 |
| Bot | 64 | 0.9846 | 1.0000 | 0.9922 |
| DDOS attack-HOIC | 154 | 1.0000 | 0.9935 | 0.9967 |
| DoS attacks-GoldenEye | 9 | 1.0000 | 1.0000 | 1.0000 |
| DoS attacks-Hulk | 104 | 0.9905 | 1.0000 | 0.9952 |
| DoS attacks-SlowHTTPTest | 32 | 1.0000 | 0.9688 | 0.9841 |
Network Intrusion Detection
Network intrusion detection identifies malicious or abnormal network activity to help protect computers, connected devices, and critical infrastructure.
See all 184 papers