Semi-WTC: A Practical Semi-supervised Framework for Attack Categorization through Weight-Task Consistency

Zihan Li, Wentao Chen, Zhiqing Wei, Xingqi Luo, Bing SuarXiv 2022

Abstract

Supervised learning has been widely used for attack categorization, requiring high-quality data and labels. However, the data is often imbalanced and it is difficult to obtain sufficient annotations. Moreover, supervised models are subject to real-world deployment issues, such as defending against unseen artificial attacks. To tackle the challenges, we propose a semi-supervised fine-grained attack categorization framework consisting of an encoder and a two-branch structure and this framework can be generalized to different supervised models. The multilayer perceptron with residual connection is used as the encoder to extract features and reduce the complexity. The Recurrent Prototype Module (RPM) is proposed to train the encoder effectively in a semi-supervised manner. To alleviate the data imbalance problem, we introduce the Weight-Task Consistency (WTC) into the iterative process of RPM by assigning larger weights to classes with fewer samples in the loss function. In addition, to cope with new attacks in real-world deployment, we propose an Active Adaption Resampling (AAR) method, which can better discover the distribution of unseen sample data and adapt the parameters of encoder. Experimental results show that our model outperforms the state-of-the-art semi-supervised attack detection methods with a 3% improvement in classification accuracy and a 90% reduction in training time.

Introduction

In modern network security, "coarse-grained" detection—simply identifying whether traffic is malicious or benign—is insufficient for effective incident response. Security operations centers require "fine-grained" categorization to distinguish between specific attack types, such as DDoS, Brute Force, or SQL injection. However, developing robust models for this task is hindered by three primary challenges:

  1. Label Scarcity: Expert labeling of network traffic is time-consuming and expensive, leading to a shortage of high-quality annotated datasets.
  2. Class Imbalance: Real-world traffic is dominated by normal packets and common attacks, creating a "long-tail" distribution where rare but critical attacks are often ignored by standard models.
  3. The "Unseen" Problem: Attackers constantly evolve, creating novel threats that do not exist in training data.

To address these, we present Semi-WTC, a semi-supervised framework designed for practical deployment in dynamic network environments.

Methodology

The Semi-WTC framework is built upon a modular architecture that integrates feature extraction, iterative semi-supervised learning, and active adaptation.

System Architecture

The core of the framework is the RB-MLP (Residual Batch-Norm MLP), a lightweight encoder that utilizes residual connections and batch normalization to extract deep semantic features without the computational overhead of complex neural networks. This encoder feeds into a two-branch structure managed by the Recurrent Prototype Module (RPM).

The Semi-WTC architecture, featuring the RB-MLP encoder, RPM training module, and CUM feature refiner.

The RPM facilitates consistency between supervised and unsupervised learning. It iteratively builds class "prototypes" from labeled data and generates pseudo-labels for unlabeled data. To handle class imbalance, we implement Weight-Task Consistency (WTC), which adjusts the loss function to penalize misclassifications of rare "tail" classes more heavily.

Furthermore, the Class Uncertainty Module (CUM) addresses samples with low prediction confidence (≤ 75%). It dynamically suppresses irrelevant features and enhances critical ones using L2-norm weights, refining the decision boundary for ambiguous cases.

Active Adaption Resampling (AAR)

A key innovation of Semi-WTC is its ability to handle "unseen" attacks through Active Adaption Resampling (AAR). Unlike traditional active learning that focuses on samples near the decision boundary, AAR identifies the core of new data distributions.

The Active Adaption Resampling (AAR) process for discovering and adapting to unseen attack distributions.

AAR uses a "Dilation Loss" and Mean Shift clustering to locate the centers of unseen sample clusters. It then extracts the most representative samples for manual labeling, allowing the model to adapt its parameters to entirely new attack patterns efficiently.

Experimental Evaluation

The framework was rigorously tested across three benchmark datasets: NSL-KDD (classic long-tail distribution), CIC-IDS 2018 (large-scale modern traffic), and AndMal 2020 (high-dimensional Android malware).

Key Results

  • High Accuracy with Minimal Labels: On the NSL-KDD dataset, using only 1% labeled data, Semi-WTC achieved an accuracy of 94.33%, significantly outperforming state-of-the-art (SOTA) methods like ACID and MixMatch.
  • Efficiency: Training on the large-scale CIC-IDS 2018 dataset was completed in just 64 seconds, representing a 90% reduction in training time compared to FARE (>4,000s) and an 80% reduction compared to ACID (347s).
  • Robustness and Generalization: The model demonstrated resilience against adversarial and poisoning attacks, maintaining a 3-5% accuracy lead over competitors. Its success on the AndMal 2020 dataset (94.06% accuracy) confirms its applicability to diverse cybersecurity domains beyond network traffic.

Discussion and Conclusion

Semi-WTC demonstrates that consistency-based semi-supervised learning, when combined with distribution-centric active learning, provides a powerful tool for network defense. By forcing unsupervised predictions to align with supervised prototypes, the model learns the underlying data structure rapidly.

While the RB-MLP encoder is highly efficient, future research could explore deeper architectures or Transformers for even more complex feature spaces, provided they are regularized against overfitting on sparse labels. Semi-WTC offers a scalable, robust, and practical solution for the evolving landscape of cyber threats.

Summary updated

BibTeX
@misc{li2022semi,
  author = {Zihan Li and Wentao Chen and Zhiqing Wei and Xingqi Luo and Bing Su},
  title = {{Semi-WTC: A Practical Semi-supervised Framework for Attack Categorization through Weight-Task Consistency}},
  year = {2022},
  eprint = {2205.09669},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.09669},
}
Figure