arXiv:2505.08816cs.CRcs.LG2025-05中稿 · IFIP Networking 20…被引 29

用自监督对比学习让模型从原始数据中自动学特征,提升网络入侵检测泛化能力。

Self-Supervised Transformer-based Contrastive Learning for Intrusion Detection Systems

  • 基于Transformer的自监督对比学习,直接处理原始数据包序列
  • 跨数据集检测AUC最高提升20%,内数据集提升3%
  • 适合标签少、无目标域正常流量的实战场景

随着数字环境日益互联,零日攻击频发且危害加剧,亟需创新的入侵检测系统(IDS)。基于机器学习的IDS能从网络流量中学习并识别攻击模式,优于传统签名匹配方式,但严重依赖标注数据,对未见流量模式的泛化能力不足。本文提出一种基于Transformer编码器的自监督对比学习方法,专为原始数据包序列的通用入侵检测设计。该方法采用数据增强策略与Transformer架构,自动提取流量流的深层表示,无需人工构造统计特征(如NetFlow)。相比现有基于NetFlow的自监督方法,本模型在异常检测任务中表现更优:同数据集评估下AUC最高提升3%,跨数据集评估下最高提升20%。此外,在有限标注数据下预训练后微调,性能比自监督NetFlow模型高出1.5% AUC。模型还展现出良好的迁移能力,即使目标域缺乏正常流量数据,经微调仍保持强检测效果。

原文摘要 · Abstract (English)

As the digital landscape becomes more interconnected, the frequency and severity of zero-day attacks, have significantly increased, leading to an urgent need for innovative Intrusion Detection Systems (IDS). Machine Learning-based IDS that learn from the network traffic characteristics and can discern attack patterns from benign traffic offer an advanced solution to traditional signature-based IDS. However, they heavily rely on labeled datasets, and their ability to generalize when encountering unseen traffic patterns remains a challenge. This paper proposes a novel self-supervised contrastive learning approach based on transformer encoders, specifically tailored for generalizable intrusion detection on raw packet sequences. Our proposed learning scheme employs a packet-level data augmentation strategy combined with a transformer-based architecture to extract and generate meaningful representations of traffic flows. Unlike traditional methods reliant on handcrafted statistical features (NetFlow), our approach automatically learns comprehensive packet sequence representations, significantly enhancing performance in anomaly identification tasks and supervised learning for intrusion detection. Our transformer-based framework exhibits better performance in comparison to existing NetFlow self-supervised methods. Specifically, we achieve up to a 3% higher AUC in anomaly detection for intra-dataset evaluation and up to 20% higher AUC scores in inter-dataset evaluation. Moreover, our model provides a strong baseline for supervised intrusion detection with limited labeled data, exhibiting an improvement over self-supervised NetFlow models of up to 1.5% AUC when pretrained and evaluated on the same dataset. Additionally, we show the adaptability of our pretrained model when fine-tuned across different datasets, demonstrating strong performance even when lacking benign data from the target domain.

入侵检测自监督学习Transformer零日攻击

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。