HARMONI: A Two-Stage Hybrid Learning Framework with Dynamic Metric Learning for Interpretable NIDS
Open Access
- 30 June 2026
- journal article
- research article
- Published by MDPI AG in Applied Sciences
- Vol. 16 (13) , 6538
Abstract
The increasing sophistication of cyber attacks has created a growing demand for effective Network Intrusion Detection Systems (NIDSs). Although deep learning has improved NIDS performance, existing models often lack adaptive mechanisms for spatiotemporal feature fusion and struggle with complex traffic distributions characterized by severe intra-class heterogeneity and inter-class overlap. Meanwhile, current interpretability methods mainly rely on feature importance analysis and provide limited insight into the model’s decision process. To address these challenges, we propose HARMONI, a two-stage hybrid learning framework that enhances both detection accuracy and model interpretability. In the first stage, a dual-branch Convolutional Neural Network and Gated Recurrent Unit (CNN-GRU) architecture extracts spatiotemporal features, which are dynamically fused through a lightweight adaptive gating network. The representation learning process is jointly optimized using a Dynamic Class-Center Loss to enforce intra-class compactness and inter-class separability in the latent space. In the second stage, the learned deep representations are concatenated with raw traffic features and fed into an ensemble classifier. This residual-style design mitigates information loss during deep encoding while leveraging the non-linear modeling capability of ensemble learning. We further develop a multi-level interpretability framework based on SHapley Additive exPlanations (SHAP) that analyzes global feature importance, individual feature contributions, and feature interactions to provide quantitative insights into the model’s decision mechanisms. Experiments on four benchmark datasets show that HARMONI consistently outperforms state-of-the-art baselines, achieving 80.19% and 78.24% accuracy on NSL-KDD and UNSW-NB15 respectively, surpassing representative deep learning and ensemble methods.Keywords
Funding Information
- National Natural Science Foundation of China (No. 62572136 and No. W2511073)
This publication has 49 references indexed in Scilit:
- Deep learning for intrusion detection in emerging technologies: a comprehensive survey and new perspectivesArtificial Intelligence Review, 2025
- An assessment framework for explainable AI with applications to cybersecurityArtificial Intelligence Review, 2025
- Explainable deep learning approach for advanced persistent threats (APTs) detection in cybersecurity: a reviewArtificial Intelligence Review, 2024
- Explainable AI for Intrusion Detection Systems: A Model Development and Experts’ Evaluation2024
- MIM: A multiple integration model for intrusion detection on imbalanced samplesWorld Wide Web, 2024
- Explainable artificial intelligence for cybersecurity: a literature surveyAnnals of Telecommunications, 2022
- Recent advances in decision trees: an updated surveyArtificial Intelligence Review, 2022
- Intrusion Detection System Based on RNN Classifier for Feature ReductionSN Computer Science, 2021
- A network security situation assessment method based on adversarial deep learningApplied Soft Computing, 2021
- A Discriminative Feature Learning Approach for Deep Face Recognition2016