信息网络安全 ›› 2026, Vol. 26 ›› Issue (3): 378-388.doi: 10.3969/j.issn.1671-1122.2026.03.004

• 入选论文 • 上一篇    下一篇

DiffGuard:基于扩散模型与自适应序列学习的网络流量异常检测框架

胡文涛, 丁伟杰()   

  1. 浙江警察学院信息网络安全学院,杭州 310053
  • 收稿日期:2025-07-07 出版日期:2026-03-10 发布日期:2026-03-30
  • 通讯作者: 丁伟杰 E-mail:dingweijie@zjjcxy.cn
  • 作者简介:胡文涛(1995—),男,浙江,讲师,博士,主要研究方向为人工智能、数据治理|丁伟杰(1980—),男,河南,教授,博士,主要研究方向为人工智能
  • 基金资助:
    国家重点研发计划(2024YFF0618800);“十四五”第二批本科省级教学改革重点项目(ZGZD2024080)

DiffGuard: Network Traffic Anomaly Detection Based on Diffusion Models and Adaptive Sequence Learning

HU Wentao, DING Weijie()   

  1. College of Information and Cyber Security, Zhejiang Police College, Hangzhou 310053, China
  • Received:2025-07-07 Online:2026-03-10 Published:2026-03-30

摘要:

针对传统深度学习方法在处理高维、动态网络流量时的检测瓶颈,文章提出一种无监督网络流量异常检测框架DiffGuard。该框架将异常检测重构为生成式修复任务,区别于基于重构的方法,其核心在于融合扩散模型的生成式去噪能力与自适应序列建模技术。DiffGuard通过以输入序列上下文为条件的反向去噪过程,从潜在异常序列中恢复其正常形态,并以修复前后的重构误差量化异常程度。为增强时序建模,DiffGuard引入基于Transformer的条件编码器捕捉长期依赖,同时,设计基于流量熵的自适应序列长度机制,动态调整分析窗口以适应流量变化。实验结果表明,DiffGuard在CIC-IDS-2018数据集上的F1分数达到0.965,优于其他主流方法,且在Web渗透等隐蔽攻击检测上的F1分数达到0.955。实验结果验证了DiffGuard在复杂网络安全场景中的有效性与应用潜力。

关键词: 网络安全, 异常检测, 扩散模型, 无监督学习, 流量分析

Abstract:

To address the detection bottlenecks of traditional deep learning methods in handling high-dimensional and dynamic network traffic, this paper proposed DiffGuard, an unsupervised anomaly detection framework. The framework reframed anomaly detection as a generative inpainting task, distinguishing itself from reconstruction-based methods by integrating the generative denoising power of diffusion models with adaptive sequence modeling techniques. Through a conditional reverse denoising process, DiffGuard restored the normal form of a potentially anomalous sequence and quantified the anomaly score by the reconstruction error between the original and the restored data. To enhance temporal modeling, the framework incorporated a Transformer-based conditional encoder to capture long-term dependencies. Concurrently, an adaptive sequence length mechanism based on traffic entropy was designed to dynamically adjust the analysis window to adapt to traffic dynamics. Experiments show that DiffGuard achieves an F1-score of 0.965 on the CIC-IDS-2018 dataset, outperforming mainstream methods. It also obtains an F1-score of 0.955 in detecting stealthy attacks such as Web penetration. The results validate the effectiveness and application potential of the proposed method in complex network security scenarios.

Key words: network security, anomaly detection, diffusion models, unsupervised learning, traffic analysis

中图分类号: