Manuscript Offprint
arXiv:2610.38890IDSForge: Self-Explaining Network Intrusion Detection Through Neural Behavioral Rule Learning
Hao Fu haofu@vt.edu Virginia Tech
Jinxia Wei weijinxia@cnic.cn Computer Network Information Center, Chinese Academy of Sciences
Wan Wei wanwei@cnic.cn Computer Network Information Center, Chinese Academy of Sciences
Chun Long longchun@cnic.cn Computer Network Information Center, Chinese Academy of Sciences
Degang Sun dgsun@cnic.cn Computer Network Information Center, Chinese Academy of Sciences
Peng Gao penggao@vt.edu Virginia Tech
Abstract
Anomaly-based network intrusion detection systems (NIDS) can detect previously unseen attacks by identifying deviations from benign traffic. However, deep learning-based anomaly detectors typically rely on implicit decision boundaries, and post-hoc explanations may not faithfully reflect the detection logic. This makes alerts difficult to interpret and audit. To address this issue, we present IDSForge, an anomaly-based NIDS that directly learns explicit, executable behavioral rules from benign traffic, making its detection logic interpretable by design. IDSForge uses the same rule set for detection and explanation, ensuring explanation fidelity by construction. It uses an explicit distributional autoencoder trained only on benign samples to learn axis-aligned regions of benign traffic. A high-speed rule compiler then consolidates these instance-specific regions into a compact set of feature-level interval constraints. These rules can be executed directly by popular NIDS engines, supporting high-throughput inspection with low overhead. To adapt to changes in traffic, a self-distillation co-evolver updates the model and rule set incrementally when the false-positive rate on analyst-verified traffic exceeds a target threshold. Our evaluation shows that IDSForge reduces F1 error by 5.7× to 47× relative to state-of-the-art anomaly-based baselines. Deployed in Suricata, IDSForge sustains a throughput of 7.8 Gbps with a median per-packet latency overhead of 3.1 µs.
CCS Concepts
• Security and privacy → Intrusion detection systems; • Information systems → Traffic analysis.
1 Introduction
Web services such as online banking, e-commerce, and cloud collaboration are frequent targets of cyberattacks. Network intrusion detection systems (NIDS) deployed at the gateways of these services are an important line of defense [26, 37], but in real deployments, producing detection results alone is not enough. First, the NIDS inspects every flow to the service, so line-rate processing of Web-scale traffic with little overhead is essential [48]. Second, benign
traffic keeps changing as the service adds new pages and APIs, while attackers keep developing new techniques, which calls for detecting previously unseen attacks without rejecting new benign behavior [9]. Third, an alert may lead to costly actions such as blocking a client, so operators need to know why a flow is flagged before they respond [18, 41]. Existing approaches address only some of these needs.
Signature-based NIDS such as Suricata [1] match traffic against human-readable rules efficiently, but they rely on manually written attack signatures and therefore miss unseen attacks. Supervised detectors [27, 36, 46] achieve high accuracy on known attacks, but they are trained on a fixed set of attack classes and often generalize poorly to new ones [8]. In contrast, anomaly-based detectors [10, 15, 25, 30] learn only from benign traffic and report deviations as anomalies. Since they need no attack labels and can detect unseen attacks, they are well suited to changing Web environments.
However, anomaly-based detectors are still difficult to trust in practice. Deep anomaly detectors model benign traffic with neural networks, such as autoencoders [30] or evidential models [25], and their decision boundaries are defined only implicitly by the learned representations. These boundaries may become outdated as traffic drifts (Figure 1(a)) and may be sensitive to small perturbations (Figure 1(b)), both of which cause many false positives. These detectors are also hard to interpret. Most explanation methods are designed for supervised detectors and explain a trained model post hoc [11, 18, 41]. The few methods for anomaly-based detectors either attribute individual alerts to input features [14] or extract surrogate rules [12, 23, 24, 44]. Such explanations only approximate the underlying model, and extracting surrogate rules requires costly exploration of the black-box decision boundary. As a result, the explanation given to operators may not match the logic of the deployed detector.
In this paper, we present IDSForge, a self-explaining anomaly-based NIDS. Like existing anomaly-based detectors, IDSForge learns only from benign traffic. Unlike them, its model outputs an explicit boundary of benign traffic rather than an anomaly score. During training, the model maps benign flows to hyper-rectangles, and the union of these hyper-rectangles forms the benign region. The hyper-rectangles are then compiled into rules for popular NIDS engines such as Suricata. At runtime, the engine only matches flows against these rules and requires no neural inference. To find a suitable

(a) Implicit boundaries become outdated under drift.
(b) Small perturbations cause misclassification.
(c) IDSForge learns explicit, extensible rules.
Figure 1: Implicit boundaries of existing detectors (dashed lines) versus the explicit rules of IDSForge (green rectangles). Blue and red points are benign and malicious flows.
boundary form, we compare six learning paradigms and choose axis-aligned boundaries, as used by tree models, because they describe benign traffic accurately and can be directly expressed as rules. Each hyper-rectangle is a conjunction of range conditions (e.g., ) that operators can read and NIDS engines can execute, and the conditions that a flagged flow violates directly explain the alert. Realizing this idea involves three challenges. (i) How can the rules describe complex benign behavior while remaining compact enough to deploy? Fitting a simple tree to a trained black-box detector limits expressiveness to the tree, whereas using many fine-grained regions makes the rule base too large. (ii) How can the rules accept unseen benign variants without covering attacks? The training data contain only part of the benign traffic, since users may visit Web pages that do not appear in it. Regions that are too narrow reject such variants, whereas regions that are too broad admit attacks. (iii) How can the rules be updated with newly confirmed benign flows without losing previously learned behavior? Editing rules directly may introduce conflicts and drop learned behavior, whereas retraining from scratch requires storing all historical traffic.
IDSForge addresses these challenges with three modules. Explicit distributional autoencoder ( ). Conventional autoencoders detect anomalies by reconstruction error. Our explicit distributional autoencoder (EDAE) instead maps each benign flow to a hyper-rectangle that encloses its benign neighborhood, and the union of these hyper-rectangles forms the benign region. For example, an HTTPS flow with a mean packet length of 512 bytes and 14 forward packets is mapped to . To generalize to unseen benign traffic, EDAE reconstructs each flow from latent variables sampled uniformly within its hyper-rectangle, so the decoder has to recover the flow from any point inside. Additional objectives balance the compactness, generalization, and stability of the hyper-rectangles. High-speed rule compiler ( ). The compiler converts the hyper-rectangles into native NIDS rules using templates. To support near-line-rate detection, it reduces the number of rules through Boolean minimization without changing the benign region, and indexes the rules with an -tree [2] for sub-linear matching. Self-distillation co-evolver ( ). When the false-positive rate on operator-verified traffic exceeds a threshold, the co-evolver converts the rules of the affected server back into hyper-rectangles and samples benign flows from the latent space of EDAE within them. It then fine-tunes EDAE on these samples and the false positives and regenerates the rules. In this way, the model and the rules are updated together without storing the original training traffic or accumulating conflicting rules.
Our technical contributions are as follows.
• We propose IDSForge, a self-explaining anomaly-based NIDS that trains a model to output explicit benign boundaries instead of anomaly scores, so that detection and explanation are based on the same executable rules.
-
We design EDAE, an autoencoder that learns explicit bounds for each feature, which cover unseen benign traffic while keeping false positives low.
-
We develop a high-speed rule compiler that converts the learned boundaries into native NIDS rules and indexes them for sub-linear matching, enabling high-throughput detection.
-
We introduce a self-distillation co-evolver that refines EDAE with false positives and benign flows sampled within existing rules, so that the model and the rules adapt to traffic drift together.
-
We prove that rule reduction is lossless, that the explanations are faithful and provide certified decision margins, and that the co-evolver does not forget previously learned rules (Appendix A).
We evaluate IDSForge on six public datasets and compare it with two supervised detectors, seven anomaly-based detectors, and four post-hoc explainers. We also deploy the learned rules in Suricata for online detection on traffic replayed at up to 10 Gbps. Our main findings are as follows.
-
IDSForge accurately detects unseen attacks without attack labels. It achieves F1 scores of at least 98.79% on all six datasets, reduces the F1 error of the best anomaly-based baseline by to , and performs on par with supervised detectors.
-
The explanations of IDSForge are faithful by design. Explanations come from the detection rules themselves, whereas even rule extractors designed for security applications disagree with the detector they explain on up to 7.17% of flows. Each rule is a short conjunction of conditions that operators can audit, edit, or remove.
-
IDSForge runs at high speed with low overhead. In Suricata, it sustains 7.8 Gbps with a median per-packet latency overhead of 3.1 µs, 0.31% additional CPU utilization, and 42 MB of memory. Compiling the 15,850 rules of CIC-IDS2017 takes 0.8 seconds, and the online F1 scores are within 2.11 percentage points of the offline results.
-
IDSForge remains effective over long-term deployment. Trained on one day of benign traffic, it achieves an F1 score of 97.55% on a week of attacks in CIC-IDS2017, which rises to 99.65% as more days are added. In comparison, the two strongest supervised baselines reach only 78.57% and 63.29% after two days.
Overall, IDSForge balances detection accuracy, interpretability, and efficiency. It provides end-to-end interpretable detection, in which the same explicit rules are used both to detect attacks and to explain alerts, making IDSForge practical for real-world deployment.
2 Background and Motivation
2.1 Problem Statement
We consider an NIDS deployed at the gateway of a protected network, e.g., an enterprise perimeter or a cloud-hosted Web service. Each flow is a min-max normalized feature vector . The training set contains only benign traffic without attack labels, and operators can confirm false positives during operation. The goal is to learn a detector that flags unseen attacks as anomalies ().
2.2 Anomaly-Based Network Intrusion Detection
Anomaly-based NIDS model benign traffic alone and flag deviations as attacks, so they can detect unseen attacks without attack labels [8, 10]. Existing detectors characterize benign behavior by reconstruction or density [28, 30, 34], frequency-domain patterns [7], interaction structure [9, 15], or calibrated confidence [25, 45]. These detectors compare a scalar score with a threshold, so the benign region is only implicitly defined by an opaque function. Such implicit boundaries are hard to interpret, become stale under traffic drift, and are sensitive to minor perturbations, leading to high false-positive rates.
2.3 Limitations of Post-Hoc Explanation
Existing work explains a trained detector post hoc, either by attributing alerts to input features [11, 13, 14, 41, 43] or by distilling the detector into rules or trees [12, 18, 23, 24, 44]. These approaches have two limitations. First, most of them, including rule-based in-network NIDS, require a supervised detector trained on attack labels [11, 18, 37, 41, 47, 48], and thus generalize poorly to unseen attacks. Even explainers for anomaly-based detectors [12, 14, 23] must first train and probe a separate detector. Second, a post-hoc explanation only approximates the detector after training and may disagree with it on some flows [12, 18, 23]. Thus, the rule shown to operators may not reflect the alert logic [33], and obtaining it requires costly boundary exploration or per-alert computation.
2.4 Motivation
These limitations stem from separating detection from explanation. We therefore aim to learn bounded rules directly, i.e., a model that outputs an explicit boundary of benign traffic, which serves as both the detector and its explanation. The form of this boundary is central to this goal. We compare six learning paradigms with different boundaries on CIC-IDS2017 (Table 6 in Appendix D.1), among which tree models, whose boundaries are axis-aligned, achieve the highest F1 score (99.4%) and fast inference. Axis-aligned boundaries have also proven effective for interpreting intrusion detectors [12, 18, 23], and NIDS engines natively support them as range conditions [1]. We thus represent the benign boundary as a union of tree-like axis-aligned hyper-rectangles , i.e., . Each is a readable conjunction of range conditions (e.g., ), and an alert is explained by its violated conditions.
Two further design choices make such boundaries learnable from benign traffic alone. First, we learn the rules separately for each destination server IP. Traffic toward the same server is relatively stable, as it is driven by the services the server provides [19, 42], so a few hyper-rectangles can enclose its benign behaviors [39]. Second, we build on the autoencoder, which suits modeling the latent distribution of benign traffic and is widely used in anomaly-based

Figure 2: Workflow of IDSForge and its three modules.
NIDS [25, 30, 45]. Sampling from its latent space also generates synthetic benign flows, so the model and the rules can be co-updated without storing historical traffic.
3 IDSForge Design
3.1 Overview
To address the challenges of implicit decision boundaries and post-hoc explanation, IDSForge aims to learn explicit boundaries of benign traffic from benign flows alone and deploy them directly as NIDS rules, so that detection and explanation share the same logic. Since traffic toward the same server IP is relatively stable [19, 42], IDSForge keeps a separate rule base for each destination server IP, which is built and maintained by three modules (Figure 2). (1) Explicit distributional autoencoder. EDAE maps each benign flow to a hyper-rectangle in a latent space aligned with the input features, so each latent variable is the bound of a feature. It also predicts a mask that selects the features to constrain, and is trained with five complementary objectives that keep them tight, generalizable, and stable. (2) High-speed rule compiler. The compiler reads them in a single forward pass, losslessly reduces the rules of each server by Boolean minimization, indexes them with an R*-tree for sub-linear matching, and translates them into native NIDS rules through templates. At runtime, a flow that matches no rule is flagged as malicious, and the violated conditions of its nearest rule explain the alert. (3) Self-distillation co-evolver. The co-evolver collects operator-confirmed false positives. When their rate exceeds a threshold, it generates benign flows by sampling the latent space within the existing rules, fine-tunes EDAE on them together with the false positives, and regenerates the rules, so that the model and the rules co-evolve without forgetting previously accepted benign traffic. Appendix A analyzes the three modules theoretically.
3.2 Explicit Distributional Autoencoder
This module learns the explicit boundary of benign traffic. For each benign flow, EDAE outputs a hyper-rectangle bounding its benign neighborhood in the original feature space, which later becomes a detection rule. EDAE (Figure 3) builds on the autoencoder, a simple and effective backbone for anomaly-based traffic detection [25, 30, 45], but outputs hyper-rectangular explicit distribution boundaries. Isomorphic interval space. Conventional autoencoders compress the input into a low-dimensional code [29] whose dimensions lack

Figure 3: Architecture of EDAE, which maps a flow to per-feature bounds and decodes samples within them.
feature meaning. EDAE instead uses a latent space isomorphic to the input, where the -th dimension encodes the bounds of the -th feature. The encoder outputs a lower bound and obtains the upper bound by adding a squared offset, which guarantees . Each flow thus maps to an instance-specific hyper-rectangular explicit distribution boundary describing its benign neighborhood,
Feature-axis attention. A lightweight attention module reweights the input features and adds the result back through a residual connection. The residual form lets the encoder predict bounds as input offsets and stabilizes training.
Feature selection. To constrain only useful features, a two-layer network with a sigmoid output maps the refined input to a soft mask that gates the bounds element-wise. Masked features, such as bursty timing or static fields, shrink to near-zero widths in training and thus drop out of the volume-based objectives. The mask is binarized at 0.5 into , and only the active features with appear in the rule, which keeps rules concise.
Uniform in-rectangle sampling. Unlike the unbounded Gaussian latent of conventional variational autoencoders, EDAE samples the latent variable uniformly within the bounds by reparameterizing as
where is the standard normal CDF, so by the probability integral transform. The decoder reconstructs , so it must recover the input from any point of .
Optimization objectives. EDAE jointly optimizes five complementary objectives over a mini-batch , computed on the active features.
(1) Reconstruction loss. It requires recovering the input from points throughout , keeping the bounds consistent with it,
(2) Distribution loss. It encourages to cover its benign neighborhood rather than collapse to a point. We impose a uniform prior , which factorizes over features and favors no region. With and , the KL divergence has the closed form
which discourages collapse onto single samples and helps generalize to unseen benign variants.
(3) Density loss. It favors a tight containing many benign flows per unit volume,
where is the volume of , counts the flows of inside , and avoids division by zero. Since counting is non-differentiable, we use the smooth indicator
with the sigmoid and temperature ( by default). The product approaches 1 inside and 0 outside, and becomes exact as (Proposition A.1). shrinks toward dense benign regions, while prevents over-contraction.
(4) Interval loss. It keeps the bounds numerically stable,
where the first term penalizes overly wide intervals and the other two grow as the bounds move away from the flow, keeping the interval close to it. The saturating sigmoid bounds their pull, so they do not dominate and .
(5) Entropy loss. Jointly optimizing many features may yield a loose that shifts uniformly along correlated directions. We normalize the margins into distributions and and minimize
i.e., maximize their Shannon entropy. This prevents the margins from concentrating on a few features and adapts its shape to the variance of each feature.
The overall objective is a weighted sum of the five terms, whose weights balance the gradient magnitudes of the terms (Figures 9, 10, and 11 in Appendix D.2).
3.3 High-Speed Rule Compiler
This module turns the learned into a compact rule base that NIDS engines execute natively. Unlike post-hoc extractors that explore a black box [23, 24], it reads them from EDAE in a single forward pass (Figure 4).
Rule generation. Each benign flow yields the rule , i.e., THEN benign, whose bounds are mapped back to raw feature units by inverting the min-max normalization. Grouped by destination server IP, a server receiving many diverse benign flows is described by a large set of overlapping hyper-rectangles , whose union is its benign region.
Rule acceleration. Matching thousands of overlapping rules is too slow for line rate, so we use two techniques.
(1) Lossless rule reduction. We decompose into as few hyper-rectangles as possible without changing the benign region, i.e., orthogonal polygon decomposition, which is NP-hard beyond two dimensions [5]. We thus cast it as two-level Boolean minimization [3, 32]. The bounds in cut each feature at a sorted set of points, and each cut point with index is encoded by a

Figure 4: Rule compilation for a benign HTTPS flow. (a) Flow features. (b) EDAE bounds and mask. (c) Reduced rule . (d) Suricata rules with fields filled from highlighted. The bottom bar explains an alert for a SYN flood flow.
threshold variable . The condition on feature then becomes
so each hyper-rectangle is a product term and is a sum of products . Assignments that violate the order of the cut points never occur and form the don't-care set . We seek the fewest product terms that cover without exceeding , which Espresso [3] solves heuristically by iterating three operations until stops decreasing. Geometrically, EXPAND grows a hyper-rectangle until it hits the OFF-set , IRREDUNDANT drops those covered by others, and REDUCE shrinks them to escape local minima. Since a conjunction of threshold literals on a feature is an interval, each product term decodes to a hyper-rectangle, so covers the same benign region with far fewer rules (Proposition A.2).
(2) R-tree indexing. We index with an -tree [2], whose overlap- and margin-minimizing nodes suit point queries over overlapping rules. Each node stores the bounding box of the rules beneath it. For high node utilization, the tree is bulk-loaded by Sort-Tile-Recursive packing [21] into leaves of capacity , and a rule added by the co-evolver descends into the child whose overlap with its siblings grows least. A point query recurses only into children whose bounding boxes contain , finding matching rules in sub-linear time, and a flow is benign if at least one rule matches. A best-first search over , which lower-bounds the distance to the rules under , finds the nearest rule of a flagged flow. Algorithm 1 in Appendix B summarizes the compilation.
Rule translation. For an NIDS engine , a template turns each reduced rule into a pass rule that matches flows to server satisfying all conditions of , written as rule options or Lua functions in Suricata. A default rule raises an alert for every flow to . Since pass rules precede alert rules, a flow is flagged exactly when it matches none of the rules of its server. An alert is explained by the nearest rule
and its violated conditions, where bounds the feature change needed for evasion (Proposition A.3). As plain-text conjunctions with unique identifiers, rules can be audited, tightened, relaxed, disabled, or complemented by expert rules, taking effect after a reload without retraining.
3.4 Self-Distillation Co-Evolver
This module updates the model and the rules under traffic drift at low cost. Drift from new Web services and user behaviors raises false positives. Retraining from scratch must store all historical traffic, which is costly and raises privacy concerns, while patching rules directly may accumulate overlapping or contradictory rules over time and break their consistency with the model. The co-evolver thus regenerates rules through EDAE. Operators confirm false positives during alert triage, and the co-evolver buffers those of server s in . An update is triggered only when the false-positive rate over a sliding window exceeds , which avoids frequent retraining caused by sporadic false alarms.
Self-distillation. Through self-distillation, the co-evolver replaces stored traffic with flows generated by EDAE itself [38]. It inverts each rule of into a normalized hyper-rectangle by min-max normalizing its bounds, with inactive features at , samples latent variables within each as in §3.2, and decodes them into synthetic benign flows,
As trains the decoder to reconstruct benign flows from points throughout their rules, approximates the benign flows from which the rules were learned, rather than arbitrary points in the rules. The co-evolver thus needs neither the original training traffic nor per-flow history.
Model and rule co-evolution. EDAE is fine-tuned with on . The generated flows anchor the rules of previously learned behaviors, and the false positives extend them to the new benign behaviors, so the model adapts without catastrophic forgetting [20]. The refined EDAE then regenerates the rules of server from , which are merged with , reduced by Boolean minimization, and re-indexed in the -tree. Since the rules are produced by the model rather than patched by hand, the rule base stays consistent with EDAE and avoids long-term rule conflicts. As the merged union is reduced losslessly, accepted flows stay accepted (Proposition A.4). The update only affects server , so the NIDS reloads only its rules, and other servers remain untouched.
4 Evaluation
We evaluate IDSForge through five research questions. RQ1. How accurately does IDSForge detect malicious traffic compared with state-of-the-art methods? RQ2. Are the learned rules interpretable, and how do they compare with post-hoc explainers? RQ3. Can IDSForge detect attacks continuously as traffic accumulates? RQ4.
Table 2: Binary detection results (%). Green cells mark the best result in each column, and the shaded row is IDSForge.
| Model | CIC-IDS2017 | CSE-CIC-IDS2018 | CIC-UNSW-NB15 | ||||||
|---|---|---|---|---|---|---|---|---|---|
| ACC | AUC | F1 | ACC | AUC | F1 | ACC | AUC | F1 | |
| ET-BERT | 99.63 | 99.87 | 99.63 | 97.46 | 98.12 | 97.49 | 95.02 | 95.84 | 94.89 |
| TMG-GAN | 98.30 | 98.32 | 98.30 | 98.15 | 96.47 | 96.34 | 98.04 | 98.45 | 98.04 |
| Whisper | 90.06 | 91.24 | 90.49 | 89.57 | 90.68 | 90.04 | 91.49 | 92.35 | 91.81 |
| HyperVision | 91.17 | 92.05 | 91.51 | 90.91 | 91.84 | 91.27 | 90.42 | 91.36 | 90.82 |
| Kitsune | 57.13 | 56.19 | 54.99 | 82.76 | 83.27 | 82.42 | 76.73 | 77.69 | 76.11 |
| Trident | 77.42 | 82.99 | 75.17 | 80.34 | 82.15 | 81.96 | 78.85 | 81.12 | 80.72 |
| UnDiff | 83.31 | 88.88 | 83.72 | 82.31 | 84.76 | 83.63 | 81.98 | 84.15 | 83.35 |
| Diff-RF | 90.03 | 90.85 | 90.01 | 92.38 | 93.14 | 92.26 | 88.96 | 89.72 | 88.85 |
| ContraMTD | 93.92 | 94.86 | 94.14 | 92.37 | 96.48 | 94.82 | 93.96 | 95.12 | 94.17 |
| IDSForge | 99.65 | 99.60 | 99.65 | 99.89 | 99.89 | 99.89 | 98.98 | 99.24 | 98.97 |
| TON-IoT | Kitsune | CICIoT2023 | |||||||
| ACC | AUC | F1 | ACC | AUC | F1 | ACC | AUC | F1 | |
| ET-BERT | 98.42 | 98.75 | 98.36 | 97.85 | 98.12 | 97.69 | 96.84 | 97.31 | 96.72 |
| TMG-GAN | 98.24 | 98.10 | 98.24 | 96.74 | 96.15 | 96.08 | 97.18 | 96.85 | 96.94 |
| Whisper | 89.34 | 90.12 | 89.65 | 88.45 | 89.76 | 88.91 | 88.72 | 89.54 | 88.39 |
| HyperVision | 90.48 | 91.35 | 90.82 | 89.62 | 90.84 | 89.95 | 89.85 | 90.76 | 90.12 |
| Kitsune | 79.94 | 81.25 | 79.48 | 85.14 | 86.66 | 84.72 | 82.15 | 79.84 | 78.36 |
| Trident | 79.16 | 81.42 | 80.05 | 78.63 | 80.95 | 79.18 | 77.92 | 80.14 | 78.65 |
| UnDiff | 82.75 | 84.18 | 83.12 | 83.40 | 85.12 | 83.85 | 82.69 | 83.25 | 81.93 |
| Diff-RF | 89.72 | 90.45 | 89.58 | 87.35 | 87.92 | 87.16 | 88.46 | 89.15 | 88.24 |
| ContraMTD | 93.15 | 94.68 | 93.42 | 91.84 | 93.52 | 92.19 | 92.64 | 94.10 | 92.88 |
| IDSForge | 99.48 | 99.62 | 99.48 | 99.12 | 99.38 | 99.15 | 98.76 | 99.14 | 98.79 |
Table 1: Dataset statistics from the released CSV files. Dur. is the capture duration, ~ marks approximate values, #Classes counts attack classes, and “-” means not published.
| Dataset | Environment | #Feat. | Size | Dur. | #Benign / #Malicious | #Classes |
|---|---|---|---|---|---|---|
| CIC-IDS2017 | Enterprise, 25 users | 78 | 51 GB | 5 d | 2.27M / 0.56M | 7 |
| CSE-CIC-IDS2018 | Cloud, 420 hosts | 79 | ~450 GB | 8 d | 13.48M / 2.75M | 7 |
| CIC-UNSW-NB15 | Hybrid (IXIA) | 49 | 100 GB | ~2 d | 0.36M / 0.09M | 9 |
| TON-IoT | IoT/IoT testbed | 44 | ~6.27 GB | - | 22.34M total | 9 |
| Kitsune | IoT (camera, router) | 115 | ~1-2 GB | 9.5 h | 2.7M total | 9 |
| CICIoT2023 | IoT, 105 devices | 46 | 548 GB | 5 d | 1.10M / 45.85M | 33 |
How does each module and objective contribute to detection performance? RQ5. Can IDSForge run in popular NIDS engines at near line rate?
4.1 Experimental Setup
Datasets. We use six public NIDS datasets covering enterprise, IoT, and hybrid environments (Table 1). We split each dataset 9:1 into training and test sets. Supervised detectors are trained on all training flows, whereas anomaly-based detectors and IDSForge use only the benign ones, and all methods share one test set with equal numbers of benign and malicious flows. The continuous detection experiment instead splits traffic by day, and the deployment experiment replays the test sets.
Baselines. For detection, we compare IDSForge with two supervised detectors (ET-BERT [27] and TMG-GAN [6]) and seven anomaly-based detectors (Whisper [7], HyperVision [9], Kitsune [30], Trident [45], UnDiff [25], Diff-RF [28], and ContraMTD [15]). For interpretability, we compare it with the local explainers LIME [31] and LEMNA [11] and the global surrogates Trustee [18] and SCD-Tree [44] (Table 5 in Appendix C.1).
Metrics and implementation. We report accuracy (ACC), F1 score (F1), and area under the ROC curve (AUC), for which IDSForge scores a flow by its distance to the nearest rule. The ablation study also reports precision (PRE) and recall (REC). For interpretability, we follow [23, 44] and measure the fidelity (FD) of an explanation model g to the detector f it explains as the fraction of test flows, both benign and malicious, on which their binary decisions agree. FD thus compares g with f rather than with the ground truth, whereas the true positive rate (TPR) and true negative rate (TNR) of g are computed against the ground-truth labels. Experiments run on a machine with an NVIDIA RTX 4090 GPU and 128 GB of RAM (Python 3.10, PyTorch 2.1), and the R*-tree uses libspatialindex (Appendix C).
4.2 Detection Performance (RQ1)
As anomaly-based methods separate benign from anomalous traffic, we evaluate binary detection. As shown in Table 2, IDSForge achieves the highest F1 score on CIC-IDS2017, CSE-CIC-IDS2018, and CIC-UNSW-NB15 (99.65%, 99.89%, and 98.97%), outperforming the strongest anomaly-based baseline, ContraMTD, by 5.51, 5.07, and 4.80 percentage points, respectively. On TON-IoT, Kitsune, and CICIoT2023, IDSForge achieves the highest AUC and F1 scores, with F1 scores of 99.48%, 99.15%, and 98.79%, outperforming ContraMTD by 6.06, 6.96, and 5.91 percentage points, respectively. IDSForge also matches supervised detectors, since each hyper-rectangle covers a dense benign region instead of separating labeled classes and thus does not depend on which attacks are labeled. In contrast, Kitsune applies one global threshold to an opaque score, which cannot fit heterogeneous benign regions, and TMG-GAN may overfit the synthetic samples of rare attacks.

(a) Flows and learned rules.
(b) Encoder representations (t-SNE).
Figure 5: Visualization of 20,000 CIC-IDS2017 flows. Blue and red points are benign and malicious flows, and green points in (a) form the rule-accepted region.
Table 3: Comparison with post-hoc explainers (%) on the same autoencoder, with local explainers (top) aggregated by submodular pick. Orange cells mark values below 60%, green cells mark full fidelity, and the shaded row is IDSForge.
| Method | CIC-IDS2017 | CSE-CIC-IDS2018 | TON-IoT | ||||||
|---|---|---|---|---|---|---|---|---|---|
| FD | TPR | TNR | FD | TPR | TNR | FD | TPR | TNR | |
| LIME [31] | 15.89 | 78.89 | 0.14 | 15.17 | 76.81 | 2.55 | 13.42 | 79.39 | 0.27 |
| LEMNA [11] | 16.94 | 81.24 | 0.86 | 16.06 | 78.92 | 3.18 | 14.21 | 81.68 | 0.92 |
| Trustee [18] | 50.71 | 99.81 | 38.44 | 59.56 | 98.57 | 51.57 | 46.85 | 45.02 | 99.71 |
| SCD-Tree [44] | 94.75 | 99.37 | 93.60 | 93.01 | 98.92 | 91.80 | 92.83 | 92.50 | 99.15 |
| IDSForge | 100.0 | 99.64 | 99.66 | 100.0 | 99.88 | 99.90 | 100.0 | 99.46 | 99.50 |
Takeaway: Describing heterogeneous benign traffic with many local explicit regions, rather than one global score threshold, lets a detector trained only on benign traffic match supervised ones.
4.3 Interpretability Analysis (RQ2)
To examine the learned rules, we visualize 20,000 flows from CIC-IDS2017. Figure 5(a) projects the flows and points sampled from the rule base onto the first two principal components. The green region accepted by the rules covers almost all benign flows, while most malicious flows lie in the gaps between rules, e.g., the clusters at the top, and fewer than 1% fall inside it. The fragmented region reflects many instance-specific hyper-rectangular explicit distribution boundaries that match heterogeneous benign traffic. In the latent space, Figure 5(b) shows the t-SNE of the encoder representations. Benign flows form compact clusters and most malicious flows lie at the periphery, so EDAE learns the overall benign distribution from benign traffic alone. Since the projection pools the flows of all servers instead of viewing each server separately, some benign and malicious flows still mix near cluster boundaries, e.g., at the top left, which the per-server rules of Figure 5(a) separate.
Comparison with post-hoc explainers. Following [23], the black box is an autoencoder (AE) trained on benign flows that flags a flow when its reconstruction error exceeds a threshold. Each explainer accesses only benign flows and the AE decisions, and is turned into a surrogate g that labels flows by itself. (i) LIME and LEMNA output feature weights rather than detection results, so we aggregate their local models, a sparse linear model and a mixture regression fitted on AE-labeled perturbations around a flow, into a global surrogate by submodular pick [31]. (ii) Trustee and (iii) SCD-Tree distill the

Figure 6: Continuous detection on CIC-IDS2017. Models are updated daily and tested on the test set of Table 2, and arrows mark the gap after Tuesday.
AE decisions into a decision tree and Gaussian-bounded interval rules, respectively. We report the FD of g to the AE on test flows with the original class ratio [23] and the TPR and TNR of g, which describe the surrogate rather than the AE. For IDSForge, g is the deployed detector, so its FD attains the maximum by definition, and the meaningful comparison lies in TPR and TNR.
As shown in Table 3, the local explainers yield imbalanced rules. LIME and LEMNA reach TPRs of 76.81%-81.68% but TNRs of at most 3.18%, i.e., they reject almost all benign flows, and their fidelity is only 13.42%-16.94%. Trustee disagrees with the AE on 40.44%-53.15% of flows, likely because one decision tree approximates the nonlinear AE boundary only coarsely. SCD-Tree reaches a fidelity of 92.83%-94.75% but still disagrees on 5.25%-7.17% of flows, so the rule shown to operators may not reflect the alert logic. In contrast, IDSForge keeps its explanations faithful while achieving a TPR of at least 99.46% and a TNR of at least 99.50%. Only Trustee exceeds it on single metrics (a TPR of 99.81% on CIC-IDS2017 and a TNR of 99.71% on TON-IoT), at the cost of a TNR of 38.44% and a TPR of 45.02%, respectively.
Takeaway: Explanations are guaranteed to match alerts only when the explanation is the detector itself, since even high-fidelity post-hoc surrogates still disagree on some flows.
4.4 Continuous Detection (RQ3)
We simulate long-term detection by splitting CIC-IDS2017 into its five days, where Monday contains only benign traffic. After each day, IDSForge is updated with that day's benign training flows, and ET-BERT and TMG-GAN are retrained from Tuesday on all labeled flows so far. All models are tested on the test set of §4.2, whose malicious flows span the whole week, simulating retrospective detection of future attacks. For fairness, IDSForge is updated at day boundaries rather than by the false-positive trigger.
As shown in Figure 6, IDSForge reaches an F1 score of 97.55% after Monday alone and detects attacks from later days, as captures dense benign regions early. With each added day, the mean normalized rule volume grows from 0.12 to 0.68 and F1 rises monotonically to 99.65%. In contrast, TMG-GAN and ET-BERT reach 78.57% and 63.29% after Tuesday and become comparable only after the full week. They need the complete data distribution and struggle with drift and long-term detection, whereas IDSForge performs well with partial data.

Figure 8: Online detection performance of IDSForge in Suricata. Markers give the online ACC, AUC, and F1, and dashed lines mark the offline F1 for reference.

Figure 7: Ablation study on CIC-IDS2017. The dashed line marks the F1 score of the full model.
Takeaway: Since the benign traffic toward a server is largely known and stable while future attacks are not, modeling per-server benign behavior detects attacks absent from training, whereas supervised detectors only learn the attacks they have seen.
4.5 Ablation Study (RQ4)
We study the contribution of each module and objective on CIC-IDS2017 using four types of variants. w/o EDAE replaces EDAE with a conventional VAE, w/o Compiler detects anomalies using the reconstruction error of EDAE instead of rule matching, w/o Co-evolver updates only the rules without refining EDAE, and w/o removes the k-th objective.
As shown in Figure 7, among the modules, removing EDAE causes the largest drop (F1 ↓34.16 points), as the model loses its hyper-rectangular explicit distribution boundaries and falls back to anomaly scores. Removing the compiler reduces recall by 21.75 points, since a global reconstruction threshold cannot separate attacks close to benign regions. Removing model refinement in the co-evolver reduces precision by 19.48 points when trained on Tuesday's benign traffic and tested on later days, as updating the model with the rules suppresses false positives from new applications.
Among the objectives, removing the density loss causes the largest drop (F1 ↓27.51 points), as the rules no longer tightly enclose dense benign regions. Without , , and , F1 drops by 9.57, 9.52, and 9.46 points, as the bounds oscillate between collapse and explosion, lose consistency with the input, or take nearly uniform margins across features. Without , the rules become fragmented and overly narrow (F1 ↓8.16 points). Each objective is thus necessary, as they provide density (), generalization (), coherence (), stability (), and shape ().
Takeaway: Learning explicit benign boundaries hinges on balancing tightness and coverage, as removing the density term loosens the rules most, whereas removing the distribution term fragments them.
4.6 Deployment in Popular NIDS Engines (RQ5)
We integrate IDSForge into Suricata 8.0.1 under 10 Gbps traffic (Appendix C.2), translating the reduced rules automatically with the templates of §3.3. The conversion parses each rule into feature-interval pairs, omits inactive features, and encodes the bounds as Lua scripts, which are indexed by the R*-tree before loading.
As shown in Figure 8, IDSForge keeps online F1 scores above 97.5%, which are 0.69–2.11 percentage points below the offline results. The gap stems from flow features computed incrementally by the engine. ACC, AUC, and F1 stay close, so the online rules do not trade false positives for missed attacks. Compiling the 15,850 rules of CIC-IDS2017 takes 0.8 seconds, and loading them into Suricata takes 0.07 seconds. At runtime on CIC-IDS2017, IDSForge sustains 7.8 Gbps on a 16-core Intel Xeon Gold 5218 CPU with a median per-packet latency overhead of 3.1 µs, 0.31% extra CPU utilization, and 42 MB of memory, less than 3% of the typical footprint of Suricata. IDSForge can thus run on existing Web-facing gateways without additional hardware.
Takeaway: Compiling a learned detector into native engine rules lets it run on existing NIDS infrastructure at near line rate, and the remaining accuracy gap stems mainly from incremental feature computation in the engine.
5 Conclusion and Future Work
We propose IDSForge, a self-explaining anomaly-based NIDS whose detector and explanation are the same set of executable rules. IDSForge trains an explicit distributional autoencoder to produce instance-specific hyper-rectangular explicit distribution boundaries of benign traffic rather than anomaly scores, compiles them into a compact rule base that popular NIDS engines execute natively, and regenerates the model and rules together when operator-confirmed false positives exceed a threshold. Experiments show that IDSForge reduces the F1 error of state-of-the-art anomaly-based detectors by 5.7x to 47x, keeps its explanations consistent with detection, and sustains 7.8 Gbps in Suricata with a median per-packet latency overhead of 3.1 µs. Since each rule is a plain-text conjunction, operators can audit, edit, or revoke individual rules without retraining. These results suggest that using neural models to generate executable rules is a practical path toward interpretable learning-based detection for Web security.
Future work has four directions. First, we will study adaptive adversaries that probe or mimic the learned rules, building on the certified decision margin of Proposition A.3. Second, we will combine flow-level rules with payload inspection to detect exploits hidden in normal-looking sessions. Third, we will learn feature transformations that cover correlated features with fewer rules. We will also harden the co-evolver against manipulated false-positive feedback, which currently relies on trusted operator triage. Finally, we will evaluate IDSForge on large-scale production Web traffic and offload its rules to programmable switches [24, 37].
References
[1] 2025. Home – Suricata. https://suricata.io/
[2] Norbert Beckmann, Hans-Peter Kriegel, Ralf Schneider, and Bernhard Seeger. 1990. The R*-tree: An efficient and robust access method for points and rectangles. In Proceedings of the 1990 ACM SIGMOD international conference on Management of data. 322–331.
[3] Robert K. Brayton, Gary D. Hachtel, Curtis T. McMullen, and Alberto L. Sangiovanni-Vincentelli. 1984. Logic Minimization Algorithms for VLSI Synthesis. Kluwer Academic Publishers.
[4] Vinod Kumar Chauhan, Kalpana Dahiya, and Anuj Sharma. 2019. Problem formulations and solvers in linear SVM: a review. Artificial Intelligence Review 52, 2 (2019), 803–855.
[5] Victor J. Dielissen and Anne Kaldewaj. 1991. Rectangular Partition is Polynomial in Two Dimensions but NP-Complete in Three. Inform. Process. Lett. 38, 1 (1991), 1–6.
[6] Hongwei Ding, Yu Sun, Nana Huang, Zhidong Shen, and Xiaohui Cui. 2024. TMG-GAN: Generative Adversarial Networks-Based Imbalanced Learning for Network Intrusion Detection. IEEE Transactions on Information Forensics and Security 19 (2024), 1156–1167.
[7] Chuanpu Fu, Qi Li, Meng Shen, and Ke Xu. 2021. Realtime robust malicious traffic detection via frequency domain analysis. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security. 3431–3446.
[8] Chuanpu Fu, Qi Li, Meng Shen, and Ke Xu. 2022. Frequency domain feature based robust malicious traffic detection. IEEE/ACM Transactions on Networking 31, 1 (2022), 452–467.
[9] Chuanpu Fu, Qi Li, and Ke Xu. 2023. Detecting unknown encrypted malicious traffic in real time via flow interaction graph analysis. arXiv preprint arXiv:2301.13686 (2023).
[10] Pedro Garcia-Teodoro, Jesus Diaz-Verdejo, Gabriel Maciá-Fernández, and Enrique Vázquez. 2009. Anomaly-based network intrusion detection: Techniques, systems and challenges. computers & security 28, 1-2 (2009), 18–28.
[11] Wenbo Guo, Dongliang Mu, Jun Xu, Purui Su, Gang Wang, and Xinyu Xing. 2018. LEMNA: Explaining Deep Learning based Security Applications. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security (CCS).
[12] Dongqi Han et al. 2024. Rules Refine the Riddle: Global Explanation for Deep Learning-Based Anomaly Detection in Security Applications. In Proceedings of the 2024 ACM SIGSAC Conference on Computer and Communications Security (CCS). 4509–4523.
[13] Dongqi Han, Zhiliang Wang, Wenqi Chen, Kai Wang, Rui Yu, Su Wang, Han Zhang, Zhihua Wang, Minghui Jin, Jiahai Yang, Xingang Shi, and Xia Yin. 2023. Anomaly Detection in the Open World: Normality Shift Detection, Explanation, and Adaptation. In Network and Distributed System Security Symposium (NDSS).
[14] Dongqi Han, Zhiliang Wang, Wenqi Chen, Ying Zhong, Su Wang, Han Zhang, Jiahai Yang, Xingang Shi, and Xia Yin. 2021. DeepAID: Interpreting and Improving Deep Learning-based Anomaly Detection in Security Applications. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security (CCS).
[15] Xueying Han, Susu Cui, Jian Qin, Song Liu, Bo Jiang, Cong Dong, Zhigang Lu, and Baoxu Liu. 2024. Contramtd: An unsupervised malicious network traffic detection method based on contrastive learning. In Proceedings of the ACM Web Conference 2024. 1680–1689.
[16] Lawrence M Healy. 2006. Logistic regression: An overview. Eastern Michigan College of Technology (2006), 1–23.
[17] David Heckerman. 1997. Bayesian networks for data mining. Data mining and knowledge discovery 1, 1 (1997), 79–119.
[18] Arthur S. Jacobs, Roman Beltiukov, Walter Willinger, Ronaldo A. Ferreira, Arpit Gupta, and Lisandro Z. Granville. 2022. AI/ML for Network Security: The Emperor has no Clothes. In Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security (CCS).
[19] Thomas Karagiannis, Konstantina Papagiannaki, and Michalis Faloutsos. 2005. BLINC: Multilevel Traffic Classification in the Dark. In Proceedings of the 2005 Conference on Applications, Technologies, Architectures, and Protocols for Computer Communications (SIGCOMM). 229–240.
[20] James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. 2017. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences 114, 13 (2017), 3521–3526.
[21] Scott T. Leutenegger, Mario A. Lopez, and Jeffrey Edgington. 1997. STR: A Simple and Efficient Algorithm for R-Tree Packing. In Proceedings of the 13th International Conference on Data Engineering (ICDE). 497–506.
[22] Roger J Lewis et al. 2000. An introduction to classification and regression tree (CART) analysis. In Annual meeting of the society for academic emergency medicine in San Francisco, California, Vol. 14. Department of Emergency Medicine Harbor-UCLA Medical Center Torrance San ..., 106.
[23] Ruoyu Li, Qing Li, Yu Zhang, Dan Zhao, Yong Jiang, and Yong Yang. 2023. Interpreting Unsupervised Anomaly Detection in Security via Rule Extraction. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 36.
[24] Ruoyu Li, Qing Li, Yu Zhang, Dan Zhao, Xi Xiao, and Yong Jiang. 2024. Genos: General In-Network Unsupervised Intrusion Detection by Rule Extraction. In IEEE INFOCOM 2024 - IEEE Conference on Computer Communications. 561–570.
[25] Xinglin Lian, Chengtai Cao, Yan Liu, Xovee Xu, Yu Zheng, and Fan Zhou. 2025. Facing anomalies head-on: Network traffic anomaly detection via uncertainty-inspired inter-sample differences. In Proceedings of the ACM on Web Conference 2025. 3908–3917.
[26] Hung-Jen Liao, Chun-Hung Richard Lin, Ying-Chih Lin, and Kuang-Yuan Tung. 2013. Intrusion detection system: A comprehensive review. Journal of network and computer applications 36, 1 (2013), 16–24.
[27] Xinjie Lin, Gang Xiong, Gaopeng Gou, Zhen Li, Junzheng Shi, and Jing Yu. 2022. Et-bert: A contextualized datagram representation with pre-training transformers for encrypted traffic classification. In Proceedings of the ACM Web Conference 2022. 633–642.
[28] Pierre-Francois Marteau. 2021. Random partitioning forest for point-wise and collective anomaly detection—Application to network intrusion detection. IEEE Transactions on Information Forensics and Security 16 (2021), 2157–2172.
[29] Ibomoiye Domor Mienye and Theo G Swart. 2025. Deep autoencoder neural networks: A comprehensive review and new perspectives. Archives of computational methods in engineering 2 (2025), 025.
[30] Yisroel Mirsky, Tomer Doitshman, Yuval Elovici, and Asaf Shabtai. 2018. Kitsune: An ensemble of autoencoders for online network intrusion detection. arXiv preprint arXiv:1802.09089 (2018).
[31] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. "Why Should I Trust You?": Explaining the Predictions of Any Classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD). 1135–1144.
[32] Richard L. Rudell and Alberto L. Sangiovanni-Vincentelli. 1987. Multiple-Valued Minimization for PLA Optimization. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 6, 5 (1987), 727–750.
[33] Cynthia Rudin. 2019. Stop Explaining Black Box Machine Learning Models for High Stakes Decisions and Use Interpretable Models Instead. Nature Machine Intelligence 1, 5 (2019), 206–215.
[34] Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Müller, and Marius Kloft. 2018. Deep One-Class Classification. In Proceedings of the 35th International Conference on Machine Learning (ICML). 4393–4402.
[35] Hanan Samet. 2007. K-nearest neighbor finding using MaxNearestDist. IEEE Transactions on Pattern Analysis and Machine Intelligence 30, 2 (2007), 243–252.
[36] Tal Shapira and Yuval Shavitt. 2019. Flowpic: Encrypted internet traffic classification is as easy as image recognition. In IEEE INFOCOM 2019-IEEE conference on computer communications workshops (INFOCOM WKSHPS). IEEE, 680–687.
[37] Zhenning Shi, Dan Zhao, Yijia Zhu, Guorui Xie, Qing Li, and Yong Jiang. 2025. Helios: Learning and Adaptation of Matching Rules for Continual In-Network Malicious Traffic Detection. In Proceedings of the ACM on Web Conference 2025. 2319–2329. doi:10.1145/369640.3174742
[38] Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. 2017. Continual Learning with Deep Generative Replay. In Advances in Neural Information Processing Systems (NeurIPS). 2990–2999.
[39] Robin Sommer and Vern Paxson. 2010. Outside the Closed World: On Using Machine Learning for Network Intrusion Detection. In 2010 IEEE Symposium on Security and Privacy (SP). 305–316.
[40] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan G Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems 30 (2017).
[41] Feng Wei, Hongda Li, Ziming Zhao, and Hongxin Hu. 2023. xNIDS: Explaining Deep Learning-based Network Intrusion Detection Systems for Active Intrusion Responses. In Proceedings of the 32nd USENIX Security Symposium.
[42] Kuai Xu, Zhi-Li Zhang, and Supratik Bhattacharyya. 2005. Profiling Internet Backbone Traffic: Behavior Models and Applications. In Proceedings of the 2005 Conference on Applications, Technologies, Architectures, and Protocols for Computer Communications (SIGCOMM). 169–180.
[43] Limin Yang, Wenbo Guo, Qingying Hao, Arridhana Ciptadi, Ali Ahmadzadeh, Xinyu Xing, and Gang Wang. 2021. CADE: Detecting and Explaining Concept Drift Samples for Security Applications. In Proceedings of the 30th USENIX Security Symposium.
[44] Yu Zhang, Ruoyu Li, Nengwu Wu, Qing Li, Xinhan Lin, and Yong Jiang. 2024. Dissect Black Box: Interpreting for Rule-Based Explanations in Unsupervised Anomaly Detection. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 37.
[45] Ziming Zhao, Zhaoxuan Li, Zhuoxue Song, Wenhao Li, and Fan Zhang. 2024. Trident: A universal framework for fine-grained and class-incremental unknown traffic detection. In Proceedings of the ACM Web Conference 2024. 1608–1619.
[46] Guangmeng Zhou, Xiongwen Guo, Zhuotao Liu, Tong Li, Qi Li, and Ke Xu. 2025. Trafficformer: an efficient pre-trained model for traffic data. In 2025 IEEE
Table 4: Overview of the theoretical results.
| Result | Guarantee | Module |
|---|---|---|
| Prop. A.1 | Rules tightly enclose benign flows, and the smooth count is accurate | EDAE |
| Prop. A.2 | Rule reduction preserves the benign region | Compiler |
| Prop. A.3 | Explanations are faithful and certify a decision margin | Compiler |
| Cor. A.4 | Updates never reject previously accepted flows | Co-evolver |
symposium on security and privacy (SP). IEEE, 1844–1860.
[47] Guangmeng Zhou, Zhuotao Liu, Chuanpu Fu, Qi Li, and Ke Xu. 2023. An Efficient Design of Intelligent Network Data Plane. In Proceedings of the 32nd USENIX Security Symposium.
[48] Longlong Zhu, Linying Zheng, Qing Shu, Zedi Chen, Jiashuo Yu, Yuhan Wu, Shaopeng Zhou, Hongyan Liu, Dong Zhang, Chunming Wu, and Xiang Chen. 2026. Proteus: Towards Accurate and Low-overhead In-Network Malicious Traffic Detection. In Proceedings of the ACM Web Conference 2026. 2929–2939. doi:10.1145/3774904.3792381
A Theoretical Analysis
This appendix provides theoretical support for the three modules of IDSForge (§3). Table 4 summarizes the four results, each backing a design claim in the main text.
Notation. Flow features are min-max normalized to , and test inputs are clipped to . A rule is a closed hyper-rectangle , where an inactive feature takes . For a finite rule base , the acceptance region and the detector are
For a rule and a flow , the violation set and the violation distance are
We write for the Lebesgue measure on .
A.1 Explicit Distributional Autoencoder
The density loss is meant to make each rule enclose its benign flows tightly. Proposition A.1 shows that its minimizer is exactly such a box, and that replacing the non-differentiable count by the smooth count of §3.2 introduces only a small error.
PROPOSITION A.1 (TIGHTNESS OF THE DENSITY OBJECTIVE).
(a) Fix a mini-batch and a rule . Every minimizer of is the bounding box of the samples it contains.
(b) Let , and let be the smooth count with temperature . If every lies at -distance at least from the boundary of , then
PROOF. (a) The bounding box of lies inside and contains the same samples, so it keeps the count without increasing the volume.
(b) We use for . A sample inside with margin has sigmoid factors of at least , so by Bernoulli's inequality its product lies in . A sample outside violates some bound by at least , so its product is at most . Summing over gives the bound.
Remark. With the default , a margin of already gives , so the smooth count closely tracks the exact count used at deployment.
A.2 High-Speed Rule Compiler and Explanation
The compiler must shrink the rule base without changing what the detector accepts. Proposition A.2 guarantees this for the Boolean minimization of §3.3.
PROPOSITION A.2 (LOSSLESS RULE REDUCTION). Let be the rules of a server, and let be the hyper-rectangles decoded from the sum of products returned by Boolean minimization over the threshold variables of §3.3. Then up to a set of measure zero on cell boundaries.
PROOF. Since the cut points contain all rule bounds, they split into cells, and each rule is a union of cells. Each cell corresponds to one order-respecting assignment of the threshold variables, on which equals 1 if and only if the cell lies in . As only order-violating assignments are don't-cares, the minimized agrees with on every cell. A product term of constrains each feature to a contiguous range of cells, so it decodes to the hyper-rectangle formed by the cells that satisfy it. Hence is the union of the cells with , which is .
Complexity. Rule generation needs one forward pass per flow. For rules of a server, a point query on an -tree with fanout visits nodes under low overlap and nodes in the worst case. Minimization reduces , and the -tree reduces overlap.
Faithfulness. Since inactive features always hold on , a flow satisfies a rule exactly when . Hence if and only if every rule is violated, and the explanation reported by IDSForge, i.e., the matched rule of a benign flow or the violated conditions of the nearest rule of a malicious flow, is a necessary and sufficient certificate of the decision. In contrast, a post-hoc surrogate generally disagrees with the detector on some flows [12, 23].
Beyond faithfulness, the explanation also quantifies robustness. Proposition A.3 shows that the distance to the nearest rule is the exact perturbation budget needed to change a decision. We define the distance of a flow to the rule base and its margin inside an accepting rule as
PROPOSITION A.3 (CERTIFIED DECISION MARGIN).
(a) If , then , and for every with . This bound is tight, i.e., some with , supported only on for the nearest rule , yields .
(b) If and , then for every with and .
PROOF. (a) As each is closed and is finite, . Since is 1-Lipschitz in , we have for each . For tightness, project each violated feature onto and keep the other features unchanged, which moves into with .
Algorithm 1: Per-server rule compilation
Input: , EDAE , engine , capacity
Output:
foreach server do
; // hyper-rectangles
; // encode
; // reduce
; // index
; // translate
Function Espresso()
; ; // OFF-set, primes
repeat until is unchanged;
return ; // shrink, grow, drop
Function STR()
, ; tile centers into slabs;
Pack leaves of size , then level by level; return root;
(b) For the rule attaining , every active feature satisfies , and inactive features stay in , so .
Remark. Benign flows with margin are thus robust to noise smaller than (Figure 1(b)), and an attacker must change the violated features of a malicious flow by at least to evade detection. Since the explanation names these features and the required changes, operators can directly assess the evasion risk of an alert.
A.3 Self-Distillation Co-Evolver
An update should extend the benign region to new behaviors without dropping what was learned before. This follows directly from the lossless reduction.
COROLLARY A.4 (NO RULE-LEVEL FORGETTING). Let be obtained from by merging the regenerated rules and applying the reduction of the compiler. Then , i.e., flows accepted before the update remain accepted after it, and the region grows by at most .
PROOF. Merging only adds rules, and the reduction preserves their union by Proposition A.2, so .
Remark. The region growth, which may admit attacks, is bounded by the volume of the new rules and occurs only when the false-positive rate exceeds .
B Rule Compilation Algorithm
Algorithm 1 summarizes the per-server compilation of §3.3.
C Experimental Setup
C.1 Description of Baselines
Table 5 summarizes the baselines.
Detectors. ET-BERT [27] pre-trains a Transformer on unlabeled encrypted traffic for classification. TMG-GAN [6] balances rare attack classes with samples from multiple generators. Whisper [7] clusters benign frequency-domain features and flags distant flows.
Table 5: Baselines and IDSForge in our setup. AE denotes the explained autoencoder, and the shaded row is IDSForge.
| Method | Type | Input | Training data | Output |
|---|---|---|---|---|
| ET-BERT | Supervised | Packet bytes | Benign + attack | Class label |
| TMG-GAN | Supervised | Flow features | Benign + attack | Class label |
| Whisper | Anomaly | Frequency features | Benign | Cluster distance |
| HyperVision | Anomaly | Interaction graph | Benign | Structural score |
| Kitsune | Anomaly | Packet statistics | Benign | Recon. error |
| Trident | Anomaly | Flow features | Benign | One-class score |
| UnDiff | Anomaly | Flow features | Benign | Uncertainty |
| Diff-RF | Anomaly | Flow features | Benign | Path-length score |
| ContraMTD | Anomaly | Interaction views | Benign | Contrastive score |
| LIME | Local | AE decisions | Benign | Feature weights |
| LEMNA | Local | AE decisions | Benign | Feature weights |
| Trustee | Global | AE decisions | Benign | Decision tree |
| SCD-Tree | Global | AE decisions | Benign | Interval rules |
| IDSForge | Self-explaining | Flow features | Benign | Executable rules |
HyperVision [9] detects abnormal structures in a flow interaction graph. Kitsune [30] uses the reconstruction errors of an autoencoder ensemble. Trident [45] runs per-class one-class learners and clusters rejected outliers into new classes. UnDiff [25] scores inter-sample uncertainty deviations estimated by evidential learning. Diff-RF [28] scores leaf distances and visiting frequencies in random partitioning trees. ContraMTD [15] contrasts local behavior and global interaction features of benign traffic.
Explainers. All four explain the same autoencoder (AE) trained on benign flows and access only benign flows and the binary AE decisions (§4.3). LIME [31] and LEMNA [11] fit a sparse linear model and a fused-lasso mixture regression around a flow, aggregated by submodular pick. Trustee [18] distills the AE into a high-fidelity decision tree. SCD-Tree [44] segments the data by the AE outputs and fits a Gaussian boundary per segment as interval rules.
C.2 Implementation and Deployment
Each flow has packet-, flow-, and session-level features on timing, size, and topology, extracted from the packet captures instead of the released features (Table 1). EDAE has an isomorphic latent space and a 4-layer encoder and decoder with 256 hidden units, trained with Adam (learning rate 0.001, batch size 1024) for 15 epochs and . The R*-tree has capacity , and the co-evolver uses with 64 samples per hyper-rectangle. We deploy IDSForge with Suricata 8.0.1 on a server with a 16-core Intel Xeon Gold 5218 CPU, a 10 GbE interface, and 128 GB DDR4 RAM. For CIC-IDS2017, CSE-CIC-IDS2018, and CIC-UNSW-NB15, the test-set packet captures are replayed with tcpreplay at up to 10 Gbps and processed in DPDK zero-copy mode, with 15,850 rules for CIC-IDS2017.
D Additional Experiments
D.1 Comparison of Learning Paradigms
To choose the geometry of the benign region, we compare six paradigms on the 8 features of CIC-IDS2017 with a random 9:1 split (Table 6). Tree models achieve the highest F1 with fast inference, distance-based models with spherical regions rank second, and linear and neural models perform worse. We use CART (Gini), L2

Figure 9: Single-weight sensitivity on CIC-IDS2017. Shaded areas mark stable regions, and dashed lines mark default values.


Figure 10: Weight interaction and convergence on CIC-IDS2017. (a) F1 over and . (b, c) F1 and training loss per epoch for three values of .

Figure 11: Global sensitivity over 256 Sobol-sampled weight configurations on CIC-IDS2017. The dashed line and the star mark the default.
Table 6: Learning paradigms on CIC-IDS2017 (metrics in %, times in seconds). The shaded row is the best paradigm.
| Paradigm | ACC | PRE | REC | F1 | Train(s) | Pred(s) |
|---|---|---|---|---|---|---|
| Tree (CART) [22] | 99.8 | 99.5 | 99.4 | 99.4 | 150.82 | 0.22 |
| Additive (LR) [16] | 93.4 | 83.1 | 83.2 | 83.2 | 31.44 | 0.08 |
| Distance (KNN) [35] | 99.3 | 97.4 | 98.8 | 98.1 | 0.30 | 652.23 |
| Kernel (SVM) [4] | 93.8 | 83.6 | 85.3 | 84.4 | 154.91 | 0.09 |
| Probabilistic (NB) [17] | 47.4 | 27.0 | 97.5 | 42.2 | 4.52 | 1.67 |
| Neural (Transformer) [40] | 98.5 | 94.6 | 98.0 | 96.3 | 279.54 | 27.54 |
logistic regression (100 iterations), KNN (), LinearSVC (, as RBF exceeded 2 hours), Gaussian naive Bayes, and a Transformer (8 heads, 512 hidden units, 30 epochs, other settings as EDAE).
Takeaway: Since each flow feature has a direct meaning and its benign values fall in limited ranges, axis-aligned boundaries fit benign traffic well, so interpretability need not cost accuracy.
D.2 Sensitivity Analysis
Single-weight sweeps. On CIC-IDS2017, each weight (default 0.20, 0.243, 0.378, 0.045, and 0.041 for to ) has a stable region with F1 above 98% (Figure 9). (i) matters most, as raising it from 0.15
to 0.378 adds 3.2 points of F1, whereas 0.45 over-contracts the rules (REC 5.2 points). (ii) fragments the hyper-rectangles (F1 at most 95.5%). (iii) weakens the geometric objectives (F1 2.11 points). (iv) lets the bounds oscillate (F1 as low as 95.2%). (v) changes F1 by less than 0.6 points in [0.01, 0.08], but removing it lowers F1 to 90.19% (4.5).
Interaction and convergence. In Figure 10(a), F1 peaks at the default (99.65%), and a small with a large over-contracts the rules (92.1%) while the reverse leaves them loose (94.0%). In Figure 10(b, c), the default reaches 99.65% F1 at epoch 15, whereas 0.05 converges slowly (96.11%) and 0.30 plateaus at 97.54%.
Global sensitivity. Over 256 Sobol-sampled combinations (Figure 11), F1 spans 86.12%–98.87% (median 94.16%), below the default. The 30 combinations reaching 97% use and , whereas the 25 below 90% mostly have a large or a small (medians 0.089 and 0.116).
Takeaway: The density and distribution terms pull the bounds in opposite directions, so their balance matters most.