Padding scheme, not model, determines Transformer IDS performance
Transformers only achieve high macro-F1 on non-padded sequences and degrade sharply with zero-pad+mask evaluation
AI/ML arXiv 9 Jun 2026 Measurement Simulation evidence
Published as “Do Transformers Actually Help Intrusion Detection? A Temporal Sequence Evaluation on CIC-IDS2017”
Why it matters
Evaluation methodology-especially padding choice and leakage-free splits-can dramatically inflate reported IDS performance, so practitioners should adopt explicit padding disclosure and realistic split protocols before deploying Transformer-based detectors.
Summary
The Transformer attains the highest macro-F1 (0.89) when evaluated on genuine, non-padded flow sequences, but its performance collapses under zero-pad+mask padding, dropping 0.24 macro-F1 and seeing its false-alarm rate rise from 0.04% to 2.7% (a 67× increase). Padding convention, not model architecture, drives these differences, and a class-balanced Random Forest proves the most robust across realistic, leakage-free splits. The paper reformulates CIC-IDS2017 as a temporal sequence task and shows that common random-split, repeat-last padding protocols can overestimate IDS robustness by up to 0.24 macro-F1.
What they found 2
- Transformer achieves the highest macro-F1 of any model on genuine sequential input.
“the Transformer achieves the highest macro-F1 of any model in the experiment (0.89)”
- Transformer performance is driven by padding convention rather than split protocol.
“the Transformer’s performance is determined by padding convention, not by the split protocol.”
Caveats 5
- Under zero-pad+mask padding the Transformer’s macro-F1 drops by 0.24 (from 0.89 to 0.65).
- Transformer false-alarm rate increases 67× (0.04% → 2.7%) in leakage-free evaluation, whereas Random Forest’s false-alarm rate stays near 0.15%.
- Results are specific to CIC-IDS2017; generalisation to datasets with longer sessions or different attack distributions (e.g. UNSW-NB15) is not established.
- All latency measurements are on an NVIDIA A100 GPU; CPU-only inference relevant to edge IDS deployments may change relative orderings.
- The paper uses macro-F1 as the headline metric; the FPR analysis above provides complementary operational evidence but is not exhaustive.
What’s new here 4
- Reformulates the CIC-IDS2017 benchmark as a genuine temporal sequence-classification problem using conversation-level flow windows.
- Introduces leakage-free split protocols (time-based and group-by-five-tuple) combined with explicit padding disclosures.
- Benchmarks nine classical and deep learning IDS architectures across four evaluation conditions, isolating the effect of padding conventions.
- Demonstrates that padding strategy can inflate Transformer performance by up to 0.24 macro-F1 and hide a 67× false-alarm rate increase.