Contrastive Learning Based Network Attack Classifier for Imbalanced Data

Kwon, Minhae(contact); Joe, Mugon; Kim, Miru

10.23919/JCN.2025.000082

Abstract : The rapid development of network systems has highlighted the critical importance of robust network intrusion detection systems (NIDS) for ensuring security. A key challenge in developing effective NIDS is class imbalance, where certain traffic types dominate while others have significantly fewer samples. This issue can be addressed by generating appropriate representations for each class within an imbalanced distribution. This study develops a training framework to tackle class imbalance in NIDS. To mitigate class imbalance, we employ contrastive learning to enhance feature representations. In this process, pairs of samples are selected such that one sample is drawn based on its original probability in the dataset, while the other sample is chosen using the inverse of this probability. We also propose a novel approach for refining borderline samples, improving the classification accuracy of samples near decision boundaries. Extensive simulations are conducted on six datasets, including real-world datasets, comparing the proposed method with state-of-the-art algorithms. The results demonstrate that the proposed solution achieves superior accuracy, outperforming all existing methods with an average improvement of 9.92%. 

Index terms : Contrastive learning, Class imbalance, Network intrusion detection systems