← Research archive

International Conference on Information and Communications Security (ICICS 2026) · Published

Cost-Aware Confidence-Gated Two-Stage Network Intrusion Detection Under a Cross-File Cross-Class Stress Test

A two-stage intrusion detector that routes ambiguous LSTM predictions to a compact Random Forest verifier, recovering detection performance under distribution shift while controlling verifier calls.

Jiaming Zhang, Huishan Lai, Runtong He, Jingxue Chen, Chunhua Su

University of Aizu & UESTC · Japan & China

DOI: 10.1007/978-981-92-6843-6_31

Original paper Figure 1 showing the LSTM confidence gate, direct fast path, five-feature Random Forest verifier, and separate optional LLM audit branch
Original paper Figure 1. Ambiguous samples are verified by a compact Random Forest; the optional LLM audit branch never changes the final decision.

Abstract

A network intrusion detector can perform well on familiar traffic yet confidently miss attacks from unseen families. This work studies whether selective verification can repair that failure at a controllable cost.

An LSTM fast path screens network flows and routes ambiguous predictions to a compact Random Forest verifier. The pipeline is evaluated on CIC-IDS-2017: the fast path learns from benign and denial-of-service traffic in one capture and is tested on benign and unseen web attacks from another.

With 50 disjoint target-attack examples for verifier adaptation, the gated pipeline recovers most of the always-on verifier's F1 while invoking it on 55% of samples. An optional LLM branch generates structured audit rationales after verification and never changes the detection decision.

Published online on 23 October 2026 in the ICICS 2026 proceedings, LNCS 17219, pp. 456–467. The citation below follows the DOI export's online year; the print proceedings volume is dated 2027.

Method

Fast screening, selective verification

The gate uses the LSTM attack score as a routing signal. Only scores between 0.01 and 0.99 trigger the five-feature Random Forest verifier.

Fast path

Screen every flow

A 64-unit LSTM produces an attack score from a ten-step input. Scores at or below 0.01 produce a benign label; scores at or above 0.99 produce an attack label.

Verification path

Escalate the ambiguous cases

Scores strictly inside the interval are passed to a Random Forest with 100 trees and a maximum depth of ten. For these samples, the RF output is the final detection label.

The verifier uses destination port, flow duration, average packet size, maximum packet length, and flow inter-arrival-time standard deviation. Its reported mean single-sample inference latency is 3.00 ms; this measurement excludes preprocessing, I/O, padding, and serialization.

The gate's cost measure is the fraction of flows that invoke the verifier. It is a routing-cost proxy, rather than a measured reduction in total system runtime. The thresholds are an engineering setting, not a learned optimum or a guarantee that the LSTM's extreme scores are correct.

Evaluation

A disjoint cross-class stress test

The source is the Friday afternoon DDoS capture; the target is the Thursday morning WebAttacks capture. This protocol combines a change in attack family with cross-day and cross-capture differences.

A pool of 50 target attacks is reserved for verifier adaptation and excluded from the final evaluation subset of 500 benign and 500 attack samples. The study compares 0-shot, 10-shot, and 50-shot verification, always-on and gated variants, calibration, and five-seed stability.

Identifier columns are removed, rows containing infinite or missing values are excluded, and MinMax scaling is fitted on the training data only. During evaluation, the selected flow occupies the final position of a zero-padded ten-step sequence. This input construction is part of the reported stress-test protocol.

The strongest recovery depends on 50-shot target-side adaptation. It is not evidence of pure zero-shot transfer.

Results

Recovering F1 with fewer verifier calls

The gated 50-shot pipeline achieves F1 0.6780, close to the always-on verifier's 0.6893, while reducing verifier invocation from 100% to 55%.

Attack F1 versus verifier invocation rate, comparing the LSTM alone, the confidence-gated pipeline, and an always-on Random Forest verifier
Original paper Figure 2. With 50-shot target adaptation, the gated pipeline reaches F1 0.6780 at 55% verifier invocation, compared with F1 0.6893 for always-on verification.
SetupAttack recallAttack F1Verifier calls
LSTM fast path0.0210.0340%
0-shot RF, always-on0.00000.0000100%
0-shot pipeline, gated0.00000.000055%
10-shot RF, always-on0.05200.0987100%
10-shot pipeline, gated0.04600.087855%
50-shot RF, always-on0.52800.6893100%
50-shot pipeline, gated0.51800.678055%

Reported values from the paper's Table 4 on the balanced 1,000-sample subset. The 0-shot verifier misses the target attacks, and ten adaptation examples yield limited recovery. The main improvement appears with 50 disjoint target examples, making adaptation an essential part of the result.

Across five seeds, gated F1 is 0.678 ± 0.072 and verifier invocation is 55.0 ± 2.1%. The gate retains similar F1 to always-on verification in this setting while leaving 45% of flows on the fast path.

Failure analysis

Recovery differs by attack subclass

Aggregate F1 hides an important gap: the 50-shot gated pipeline recovers Brute Force and XSS attacks unevenly, while SQL injection remains undetected in this split.

Original paper Figure 3 showing Brute Force recall 0.53, benign true-negative rate 1.00, XSS recall 0.62, and SQL-injection recall zero for the 50-shot gated pipeline
Original paper Figure 3. Attack bars report subclass recall; the BENIGN bar instead reports the true-negative rate. These are different measures, shown together to describe class-level coverage.

The result supports selective recovery of a stressed detector, rather than uniform coverage of every unseen attack family. A high benign true-negative rate does not compensate for the missed SQL-injection cases.

Calibration

Confidence breaks under shift

The LSTM's expected calibration error rises from 0.0214 in-distribution to 0.4869 on the cross-class test. Its confidence score is an engineering routing signal rather than a calibrated estimate of risk.

Paired LSTM reliability diagrams showing close confidence agreement in-distribution and strong disagreement under cross-class web-attack shift
Blue bars show empirical attack rates; the red line shows mean confidence. Calibration deteriorates when the fast path encounters the target traffic.

The mean predicted attack probability under shift is 0.086, while half of the evaluation samples are attacks. Brier score also deteriorates, from 0.018 in-distribution to 0.441 under shift. The failure involves confident misclassification as well as missed attacks.

Audit layer

Keeping LLMs outside the decision loop

The optional LLM receives a verifier label and compact flow summary after the detection decision. It produces a JSON rationale for inspection, without changing the label.

BackendMean latencyP95 latencyValid audit JSON
RF verifier3.00 ms3.05 msNot an LLM audit
Llama3 8B q43,548 ms3,798 ms100%
Qwen3 7B q44,368 ms4,594 ms100%
Gemma2 9B q46,111 ms6,340 ms100%
DeepSeek R1 8B q420,484 ms20,833 ms0%

Reported inference-only measurements from Table 6; each LLM is tested on 50 escalated cases. The DeepSeek backend emits reasoning text before JSON and fails the strict parser in this configuration. Invalid output receives a fixed fallback rationale while the RF decision remains unchanged.

Schema compliance measures whether the audit interface can be parsed. It does not establish explanation faithfulness, improved analyst effectiveness, or a detection benefit from the LLM.

Interpretation

What this study establishes

Within this source–target split, a compact adapted verifier recovers much of the lost attack-detection performance, and a confidence gate controls how often that verifier is called. The source of recovery is the adapted verifier; the gate exposes a quality–invocation trade-off.

Evidence is limited to CIC-IDS-2017, one source–target split, heuristic thresholds, and a balanced evaluation subset. That subset does not represent operational attack base rates. The paper does not establish production alert precision, robustness against adversarial evasion, state-of-the-art detection, or generalization to other datasets.

Authors

Jiaming ZhangUniversity of Aizu
Huishan LaiUniversity of Aizu
Runtong HeUniversity of Aizu
Jingxue ChenUniversity of Electronic Science and Technology of China
Chunhua SuUniversity of Aizu

Citation

Zhang, J., Lai, H., He, R., Chen, J., and Su, C. (2026). Cost-Aware Confidence-Gated Two-Stage Network Intrusion Detection Under a Cross-File Cross-Class Stress Test. In C. Su, M. Conti, Y. Cao, and K. Omote (Eds.), Information and Communications Security (ICICS 2026), Lecture Notes in Computer Science, vol. 17219, pp. 456–467. Springer, Singapore. https://doi.org/10.1007/978-981-92-6843-6_31

@inproceedings{zhang2026costaware,
  author    = {Zhang, Jiaming and Lai, Huishan and He, Runtong and
               Chen, Jingxue and Su, Chunhua},
  editor    = {Su, Chunhua and Conti, Mauro and Cao, Yang and Omote, Kazumasa},
  title     = {Cost-Aware Confidence-Gated Two-Stage Network Intrusion
               Detection Under a Cross-File Cross-Class Stress Test},
  booktitle = {Information and Communications Security},
  series    = {Lecture Notes in Computer Science},
  volume    = {17219},
  pages     = {456--467},
  publisher = {Springer Nature Singapore},
  address   = {Singapore},
  year      = {2026},
  month     = {October},
  doi       = {10.1007/978-981-92-6843-6_31},
  isbn      = {978-981-92-6843-6}
}