Manuscript Offprint

arXiv:2611.04660

Leakage-free evaluation of residual graph convolutional networks for network intrusion detection

Zahid Iqbal

Abstract

Introduction: Graph neural networks are increasingly proposed for network intrusion detection, yet many reported results come from protocols in which test flows shape the graph used for training, duplicated flows sit on both sides of the split, or a single split is reported. This study measures what a residual graph convolutional network gains over simpler models once these sources of optimism are removed.

Materials and methods: CICIDS2017 and NF-UNSW-NB15-v2 were cleaned with label-aware removal of exact duplicates, which removed 69% of the NF-UNSW-NB15-v2 flows. Flows were linked in a nearest-neighbour graph built from training flows only, and validation and test flows were attached to their nearest training flows at prediction time. A two-layer residual graph convolutional network was compared with eight models trained under the same fixed settings, including a nearest-neighbour vote over the same graph, gradient-boosted trees and a random forest, over three seeds that each draw a new split, together with ablations, a leave-one-family-out test and a feature-noise test.

Results: On CICIDS2017 the residual network reached a binary F1 of 98.11% (standard deviation 0.18) and on NF-UNSW-NB15-v2 90.57% (0.38), indistinguishable from a multilayer perceptron without the graph and from the other graph networks. Tree ensembles were 1.48 to 1.57 points higher in F1 on CICIDS2017 and led on the area under the precision-recall curve on both datasets; their multiclass macro-F1 on CICIDS2017 reached 93.08% against 64.51%, a gap that came mainly from benign flows the residual network assigned to small attack classes. No ablation, including transductive graph construction, changed F1 beyond the variation between seeds. Under Gaussian feature noise with a standard deviation of 0.5, the residual network kept an F1 of 96.16%, while XGBoost fell to 0.67%.

Conclusions: Under a leakage-controlled protocol, message passing over nearest-neighbour flow graphs adds no measurable accuracy over a perceptron, and tree ensembles remain the stronger detectors on both benchmarks; the graph models' advantage lies in robustness to feature noise.

Keywords: network intrusion detection; graph neural networks; graph convolutional network; residual connections; CICIDS2017; NF-UNSW-NB15-v2; data leakage; class imbalance

1. Introduction

Network intrusion detection systems (NIDS) classify traffic records, usually aggregated into flows, as benign or as one of several attack types. Most learning-based detectors treat each flow as an independent row of features. Graph neural networks (GNNs) relax that assumption: they let a flow's prediction depend on related flows, either through the hosts the flows connect or through

Preprint

the similarity of their features [1]. Several recent systems report high detection scores on public benchmarks with such models [2–4].

Scores near the ceiling are hard to interpret on these benchmarks. Feature analysis on CICIDS2017 [5] has ranked flow attributes by information gain to reduce the input dimension [6], while studies of the dataset itself report mislabelled flows and flow-construction artefacts, and corrected releases change the measured accuracy of standard classifiers [7–9]. A systematisation of machine learning for NIDS argues for evaluation under conditions closer to deployment, including realistic splits and the costs of false alarms, and shows how evaluation choices, rather than model design, can drive reported gains [10]. On tabular intrusion data, tree-based classifiers were not outperformed by the deep networks evaluated in a recent comparison [11], which motivates strong tree baselines in any study that proposes a neural detector. Feature selection combined with gradient-boosted trees and random forests has also classified malicious activity well in other security data, for example on the Ethereum network [12]. In monitoring applications more broadly, comparative studies of several learners on the same data are a common basis for choosing a model [13].

A survey groups GNN-based NIDS by the graph they build: host graphs, in which IP endpoints are nodes and flows are edges, and flow or similarity graphs, in which flows are nodes [1]. E-GraphSAGE classifies the edges of a host graph using edge features [14], and Anomal-E learns self-supervised edge embeddings on the same type of graph [2]. Graph embedding [15] and alternative network representations [16] have also been studied, and recent self-supervised graph learning reports strong results on NetFlow-format benchmarks [3]. Closest to the present work, TKSGF connects each flow to its Top-KK most similar flows by attributes and applies GraphSAGE on NF-ToN-IoT and NF-BoT-IoT [4]. The NetFlow-format datasets used here and in several of these works share a common feature set [17].

The graph convolutional network (GCN) aggregates normalised neighbour features layer by layer [18]; GraphSAGE and the graph attention network (GAT) replace this aggregation with learned neighbour functions and attention weights [19, 20]. Repeated aggregation smooths node representations towards each other as depth grows [21], and skip connections borrowed from residual networks [22] are a common remedy. In intrusion detection, E-ResSAGE and E-ResGAT add residual information to GraphSAGE and GAT by concatenation [23].

Graph models also add risks of their own to the evaluation. If validation and test flows are inserted into the graph used for training, their features shape the representations of training nodes. If exact duplicates are kept, the same flow can sit in both the training and the test set. Finally, if only one split is reported, the differences between models may be smaller than the variation between splits.

This paper evaluates a residual graph convolutional network (R-GCN) under a protocol designed to remove these sources of optimism. Flows are nodes of a kk-nearest-neighbour (kkNN) graph in feature space. The graph used for training contains training flows only, and each validation or test flow is attached to its nearest training flows at prediction time, so its prediction depends on its own features and on training data alone. Exact duplicate flows are removed before splitting, every preprocessing statistic is fitted on training flows, and each of three seeds draws a new split. The R-GCN adds the previous hidden layer through an identity skip, whereas E-ResSAGE and E-ResGAT concatenate [23]. Its kkNN graph also differs from TKSGF, which builds a separate similarity graph inside each partition and so links test flows to one another [4]; here a validation or test flow connects only to training flows. Table 1 compares these studies by graph type, the edges given to test flows, the split and the number of repeated runs. The contribution lies in this protocol and in the evidence it yields: what the residual GCN gains over a vote of its own neighbours and over tree ensembles once these sources of optimism are removed, measured over resampled splits on two datasets.

The main contributions of this paper are as follows:

Zahid Iqbal

Preprint

Table 1. Graph-based intrusion detection studies closest to the present work, as described in the cited papers (–: not stated).

StudyNodes; edgesModel; learningEdges of test flowsSplitRepeated runsDatasets
E-GraphSAGE [14]hosts; flowsE-GraphSAGE; supervised–70/30–BoT-IoT, ToN-IoT, NF-BoT-IoT, NF-ToN-IoT
Anomal-E [2]hosts; flowsE-GraphSAGE + DGI; self-supervised–––NF-UNSW-NB15-v2, NF-CSE-CIC-IDS2018-v2
E-ResSAGE, E-ResGAT [23]endpoints; flowsGraphSAGE, GAT + feature concatenation; supervised–50/20/30–UNSW-NB15, CIC-DarkNet, CSE-CIC-IDS, ToN-IoT
TKSGF [4]flows; Top-K cosineGraphSAGE (GCN, GAT); supervisedamong test flows (graph per partition)60/20/20, 70/15/15≥ 5NF-ToN-IoT, NF-BoT-IoT
GraphIDS [3]hosts; flowsE-GraphSAGE + masked autoencoder; benign-onlyamong test flows (graph per partition)80/10/10several seeds, mean ± SDNF-UNSW-NB15, NF-CSE-CIC-IDS2018 (v2, v3)
This studyflows; kNN, k = 10R-GCN and 8 baselines; supervisedto training flows only60/20/203 seeds, new split eachCICIDS2017, NF-UNSW-NB15-v2 (de-duplicated)
  1. An inductive evaluation protocol for flow-graph intrusion detection, in which the kNN graph, the feature scaling and the model are learned from training flows only, validation and test flows link only to training flows, exact duplicates are removed before splitting, and each of three seeds draws a new split (Section 2.1 and Figure 1). On NF-UNSW-NB15-v2, de-duplication alone removed 69% of the flows.

  2. A same-budget comparison of a residual graph convolutional network with eight models on CICIDS2017 and NF-UNSW-NB15-v2, including a kNN vote over the same neighbours, three tree ensembles and a host-graph model, for binary and multiclass detection with paired per-seed tests (Sections 2.3 and 2.4).

  3. Evidence that, under this protocol, the graph networks match a multilayer perceptron while tree ensembles remain the strongest detectors, with a binary F1 1.48 to 1.57 points higher on CICIDS2017 (Tables 5–7 and Figure 5).

  4. A per-class diagnosis that traces the multiclass gap of the graph networks to false alarms on small attack classes: the residual network's precision on Bot flows was 3.36%, against 55.49% for XGBoost (Figures 6 and 7).

  5. An ablation of neighbourhood size, depth, the residual connection, the loss, normalisation, the port feature and transductive graph construction, none of which changed F1 beyond the variation between seeds (Table 10 and Figure 8).

  6. Two stress tests that show where graph models help: under Gaussian feature noise with a standard deviation of 0.5, the residual network kept an F1 of 96.16% while XGBoost fell to 0.67%, and it recovered about half of a DoS family withheld from training (Tables 11 and 12, Figures 9 and 10).

References (33)