《计算机应用》唯一官方网站 ›› 2026, Vol. 46 ›› Issue (3): 857-866.DOI: 10.11772/j.issn.1001-9081.2025030296
马凯光1,2,3, 陈学斌1,2,3(
), 菅银龙1,2,3, 王柳1,2,3, 高远1,2,3
收稿日期:2025-03-24
修回日期:2025-07-20
接受日期:2025-07-23
发布日期:2025-09-28
出版日期:2026-03-10
通讯作者:
陈学斌
作者简介:马凯光(1999—),男,河北张家口人,硕士研究生,CCF会员,主要研究方向:联邦学习、网络安全基金资助:
Kaiguang MA1,2,3, Xuebin CHEN1,2,3(
), Yinlong JIAN1,2,3, Liu WANG1,2,3, Yuan GAO1,2,3
Received:2025-03-24
Revised:2025-07-20
Accepted:2025-07-23
Online:2025-09-28
Published:2026-03-10
Contact:
Xuebin CHEN
About author:MA Kaiguang, born in 1999, M. S. candidate. His research interests include federated learning, network security.Supported by:摘要:
网络入侵检测系统(NIDS)在网络安全防御中发挥着关键作用。传统基于规则匹配的方法难以有效检测未知攻击,深度学习虽提高了检测性能,但受限于集中式训练造成的数据隐私问题。在此背景下,联邦学习通过本地训练与参数共享,在保护数据隐私的同时实现协同学习,为网络入侵检测提供了一种可行的解决方案。然而,联邦学习在NIDS应用中仍面临挑战,包括网络流量的时序依赖性和数据分布的不均衡,这导致联邦模型对少数类攻击的检测能力不足。因此,提出一种结合双向循环神经网络(RNN)并行结构与联邦类别平衡(FedCB)算法的混合框架,以增强时序建模能力并优化联邦聚合策略。实验结果表明,该算法在NSL-KDD数据集上的五分类任务中取得了更优的检测性能,相较于结合联邦学习与卷积神经网络的入侵检测模型CNN-FL和FL-SEResNet(Federation Learning Squeeze-and-Excitation network ResNet),准确率分别提升了3.30和1.48个百分点,说明该方法在联邦学习入侵检测任务中的有效性。
中图分类号:
马凯光, 陈学斌, 菅银龙, 王柳, 高远. 基于混合序列模型与联邦类平衡算法的网络入侵检测[J]. 计算机应用, 2026, 46(3): 857-866.
Kaiguang MA, Xuebin CHEN, Yinlong JIAN, Liu WANG, Yuan GAO. Network intrusion detection based on hybrid sequence model and federated class balance algorithm[J]. Journal of Computer Applications, 2026, 46(3): 857-866.
| 类别 | KDDTrain+ | KDDTest+ |
|---|---|---|
| 总计 | 125 973 | 22 544 |
| DoS | 45 927 | 7 636 |
| Probe | 11 656 | 2 423 |
| R2L | 995 | 2 574 |
| U2R | 52 | 200 |
| Normal | 67 343 | 9 711 |
表1 实验数据集的信息
Tab. 1 Experimental dataset information
| 类别 | KDDTrain+ | KDDTest+ |
|---|---|---|
| 总计 | 125 973 | 22 544 |
| DoS | 45 927 | 7 636 |
| Probe | 11 656 | 2 423 |
| R2L | 995 | 2 574 |
| U2R | 52 | 200 |
| Normal | 67 343 | 9 711 |
| 模型 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| SVM | 0.788 8 | 0.820 8 | 0.788 8 | 0.774 8 |
| RF | 0.763 1 | 0.813 8 | 0.763 1 | 0.727 7 |
| CNN | 0.825 3 | 0.835 2 | 0.825 3 | 0.826 4 |
| DNN[ | 0.785 0 | 0.810 0 | 0.785 0 | 0.765 0 |
| A3CAD[ | 0.843 5 | |||
| CNN-IDS[ | 0.832 9 | 0.830 0 | 0.830 0 | |
| 本文模型 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
表2 不同模型的实验结果对比
Tab. 2 Comparison of experimental results of different models
| 模型 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| SVM | 0.788 8 | 0.820 8 | 0.788 8 | 0.774 8 |
| RF | 0.763 1 | 0.813 8 | 0.763 1 | 0.727 7 |
| CNN | 0.825 3 | 0.835 2 | 0.825 3 | 0.826 4 |
| DNN[ | 0.785 0 | 0.810 0 | 0.785 0 | 0.765 0 |
| A3CAD[ | 0.843 5 | |||
| CNN-IDS[ | 0.832 9 | 0.830 0 | 0.830 0 | |
| 本文模型 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
| 模型 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| 本文模型 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
| 去除BiGRU | 0.866 0 | 0.873 3 | 0.866 0 | 0.867 4 |
| 去除BiLSTM |
表3 模型的消融实验结果
Tab. 3 Model ablation experimental results
| 模型 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| 本文模型 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
| 去除BiGRU | 0.866 0 | 0.873 3 | 0.866 0 | 0.867 4 |
| 去除BiLSTM |
| Dropout率 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| 0.2 | ||||
| 0.3 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
| 0.5 | 0.864 8 | 0.867 3 | 0.864 7 | 0.860 3 |
表4 Dropout不同设置下模型性能对比
Tab. 4 Performance comparison of models under different Dropout settings
| Dropout率 | 准确率 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|---|
| 0.2 | ||||
| 0.3 | 0.878 3 | 0.877 6 | 0.878 3 | 0.876 3 |
| 0.5 | 0.864 8 | 0.867 3 | 0.864 7 | 0.860 3 |
| 类别 | 精确度 | 召回率 | F1分数 | |||
|---|---|---|---|---|---|---|
| FedCB | FedAvg | FedCB | FedAvg | FedCB | FedAvg | |
| DoS | 0.922 9 | 0.898 2 | 0.868 9 | 0.828 3 | 0.895 1 | 0.861 8 |
| Normal | 0.882 6 | 0.747 4 | 0.923 6 | 0.923 4 | 0.902 6 | 0.826 1 |
| Probe | 0.698 8 | 0.778 9 | 0.832 0 | 0.840 3 | 0.759 6 | 0.808 4 |
| R2L | 0.956 1 | 0.901 1 | 0.591 7 | 0.311 6 | 0.731 0 | 0.463 0 |
| U2R | 0.249 0 | 0.000 0 | 0.890 0 | 0.000 0 | 0.389 1 | 0.000 0 |
表5 联邦学习算法的性能对比
Tab. 5 Performance comparison of federated learning algorithms
| 类别 | 精确度 | 召回率 | F1分数 | |||
|---|---|---|---|---|---|---|
| FedCB | FedAvg | FedCB | FedAvg | FedCB | FedAvg | |
| DoS | 0.922 9 | 0.898 2 | 0.868 9 | 0.828 3 | 0.895 1 | 0.861 8 |
| Normal | 0.882 6 | 0.747 4 | 0.923 6 | 0.923 4 | 0.902 6 | 0.826 1 |
| Probe | 0.698 8 | 0.778 9 | 0.832 0 | 0.840 3 | 0.759 6 | 0.808 4 |
| R2L | 0.956 1 | 0.901 1 | 0.591 7 | 0.311 6 | 0.731 0 | 0.463 0 |
| U2R | 0.249 0 | 0.000 0 | 0.890 0 | 0.000 0 | 0.389 1 | 0.000 0 |
| 模型 | 召回率 | 准确率 | ||||
|---|---|---|---|---|---|---|
| Normal | DoS | Probe | R2L | U2R | ||
| CNN-FL | 0.865 3 | 0.299 9 | 0.824 0 | |||
| FL-SEResNet | 0.965 7 | 0.807 7 | 0.827 3 | 0.110 0 | ||
| 本文方法 | 0.923 6 | 0.868 9 | 0.591 7 | 0.890 0 | 0.857 0 | |
表6 多分类对比实验结果
Tab. 6 Multi-class classification comparison experiment results
| 模型 | 召回率 | 准确率 | ||||
|---|---|---|---|---|---|---|
| Normal | DoS | Probe | R2L | U2R | ||
| CNN-FL | 0.865 3 | 0.299 9 | 0.824 0 | |||
| FL-SEResNet | 0.965 7 | 0.807 7 | 0.827 3 | 0.110 0 | ||
| 本文方法 | 0.923 6 | 0.868 9 | 0.591 7 | 0.890 0 | 0.857 0 | |
| [1] | ZIPPERLE M, ZHANG Y, CHANG E, et al. PARGMF: a provenance-enabled automated rule generation and matching framework with multi-level attack description model [J]. Journal of Information Security and Applications, 2024, 81: No.103682. |
| [2] | TULBURE A A, TULBURE A A, DULF E H. A review on modern defect detection models using DCNNs — deep convolutional neural networks[J]. Journal of Advanced Research, 2022, 35: 33-48. |
| [3] | FALLAH A, MOKHTARI A, OZDAGLAR A. Personalized federated learning with theoretical guarantees: a model-agnostic meta-learning approach[C]// Proceedings of the 34th International Conference on Neural Information Processing Systems. Red Hook: Curran Associates Inc., 2020: 3557-3568. |
| [4] | SHANG X, LU Y, HUANG G, et al. Federated learning on heterogeneous and long-tailed data via classifier re-training with federated features[C]// Proceedings of the 31st International Joint Conference on Artificial Intelligence. California: ijcai.org, 2022: 2218-2224. |
| [5] | SUN H, CHEN M, WENG J, et al. Anomaly detection for in-vehicle network using CNN-LSTM with attention mechanism[J]. IEEE Transactions on Vehicular Technology, 2021, 70(10): 10880-10893. |
| [6] | 刘拥民,杨钰津,罗皓懿,等. 基于双向循环生成对抗网络的无线传感网入侵检测方法[J]. 计算机应用, 2023, 43(1): 160-168. |
| LIU Y M, YANG Y J, LUO H Y, et al. Intrusion detection method for wireless sensor network based on bidirectional circulation generative adversarial network[J]. Journal of Computer Applications, 2023, 43(1): 160-168. | |
| [7] | DING Z, ZHONG G, QIN X, et al. MF-Net: multi-frequency intrusion detection network for Internet traffic data[J]. Pattern Recognition, 2024, 146: No.109999. |
| [8] | AL-HUTHAIFI R, LI T, HUANG W, et al. Federated learning in smart cities: privacy and security survey [J]. Information Sciences, 2023, 632: 833-857. |
| [9] | KHRAISAT A, ALAZAB A, SINGH S, et al. Survey on federated learning for intrusion detection system: concept, architectures, aggregation strategies, challenges, and future directions [J]. ACM Computing Surveys, 2025, 57(1): No.7. |
| [10] | ZHANG Z, MA S, YANG Z, et al. Robust semisupervised federated learning for images automatic recognition in Internet of Drones[J]. IEEE Internet of Things Journal, 2023, 10(7): 5733-5746. |
| [11] | 赵英,王丽宝,陈骏君,等. 基于联邦学习的网络异常检测[J]. 北京化工大学学报(自然科学版), 2021, 48(2): 92-99. |
| ZHAO Y, WANG L B, CHEN J J, et al. Network anomaly detection based on federated learning[J]. Journal of Beijing University of Chemical Technology (Natural Science Edition), 2021, 48(2): 92-99. | |
| [12] | 郑超,邬悦婷,肖珂. 基于联邦学习和深度残差网络的入侵检测[J]. 计算机应用, 2023, 43(S1): 133-138. |
| ZHENG C, WU Y T, XIAO K. Intrusion detection based on federated learning and deep residual network[J]. Journal of Computer Applications, 2023, 43(S1): 133-138. | |
| [13] | JIN Z, ZHOU J, LI B, et al. FL-IIDS: a novel federated learning-based incremental intrusion detection system[J]. Future Generation Computer Systems, 2024, 151: 57-70. |
| [14] | LIU S, YU Y, ZONG Y, et al. Delay and energy-efficient asynchronous federated learning for intrusion detection in heterogeneous industrial internet of things[J]. IEEE Internet of Things Journal, 2024, 11(8): 14739-14754. |
| [15] | LI T, SAHU A K, ZAHEER M, et al. Federated optimization in heterogeneous networks[EB/OL]. [2024-12-24].. |
| [16] | KARIMIREDDY S P, KALE S, MOHRI M, et al. SCAFFOLD: stochastic controlled averaging for federated learning[C]// Proceedings of the 37th International Conference on Machine Learning. New York: JMLR.org, 2020: 5132-5143. |
| [17] | WANG J, LIU Q, LIANG H, et al. Tackling the objective inconsistency problem in heterogeneous federated optimization[C]// Proceedings of the 34th International Conference on Neural Information Processing Systems. Red Hook: Curran Associates Inc., 2020: 7611-7623. |
| [18] | DING H, SUN Y, HUANG N, et al. TMG-GAN: generative adversarial networks-based imbalanced learning for network intrusion detection[J]. IEEE Transactions on Information Forensics and Security, 2024, 19: 1156-1167. |
| [19] | LIN T Y, GOYAL P, GIRSHICK R, et al. Focal loss for dense object detection[C]// Proceedings of the 2017 IEEE International Conference on Computer Vision. Piscataway: IEEE, 2017: 2999-3007. |
| [20] | ANDRESINI G, APPICE A, DE ROSE L, et al. GAN augmentation to deal with imbalance in imaging-based intrusion detection[J]. Future Generation Computer Systems, 2021, 123: 108-127. |
| [21] | MA X, SHI W. AESMOTE: adversarial reinforcement learning with smote for anomaly detection[J]. IEEE Transactions on Network Science and Engineering, 2021, 8(2): 943-956. |
| [22] | 尹梓诺,马海龙,胡涛. 基于联合注意力机制和一维卷积神经网络-双向长短期记忆网络模型的流量异常检测方法[J]. 电子与信息学报, 2023, 45(10): 3719-3728. |
| YIN Z N, MA H L, HU T. A traffic anomaly detection method based on the joint model of attention mechanism and one-dimensional convolutional neural network-bidirectional long short term memory[J]. Journal of Electronics and Information Technology, 2023, 45(10): 3719-3728. | |
| [23] | TSOGBAATAR E, BHUYAN M H, TAENAKA Y, et al. DeL-IoT: a deep ensemble learning approach to uncover anomalies in IoT[J]. Internet of Things, 2021, 14: No.100391. |
| [24] | DUAN M, LIU D, CHEN X, et al. Astraea: self-balancing federated learning for improving classification accuracy of mobile deep learning applications[C]// Proceedings of the IEEE 37th International Conference on Computer Design. Piscataway: IEEE, 2019: 246-254. |
| [25] | HOCHREITER S, SCHMIDHUBER J. Long short-term memory[J]. Neural Computation, 1997, 9(8): 1735-1780. |
| [26] | CHO K, VAN MERRIËNBOER B, GULCEHRE C, et al. Learning phrase representations using RNN encoder-decoder for statistical machine translation[C]// Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing. Stroudsburg: ACL, 2014: 1724-1734. |
| [27] | McMAHAN H B, MOORE E, RAMAGE D, et al. Communication-efficient learning of deep networks from decentralized data[C]// Proceedings of the 20th Artificial Intelligence and Statistics. New York: JMLR.org, 2017: 1273-1282. |
| [28] | REVATHI S, MALATHI A. A detailed analysis on NSL-KDD dataset using various machine learning techniques for intrusion detection[J]. International Journal of Engineering Research and Technology, 2013, 2(12): 1848-1853. |
| [29] | TAVALLAEE M, BAGHERI E, LU W, et al. A detailed analysis of the KDD CUP 99 data set[C]// Proceedings of the 2009 IEEE Symposium on Computational Intelligence for Security and Defense Applications. Piscataway: IEEE, 2009: 1-6. |
| [30] | VINAYAKUMAR R, ALAZAB M, SOMAN K P, et al. Deep learning approach for intelligent intrusion detection system[J]. IEEE Access, 2019, 7: 41525-41550. |
| [31] | DONG S, XIA Y, WANG T. Network abnormal traffic detection framework based on deep reinforcement learning[J]. IEEE Wireless Communications, 2024, 31(3): 185-193. |
| [32] | CHOWDHURY R, ROY A, SAHA B, et al. A step forward to revolutionize intrusion detection system using deep convolutional neural network[C]// Data driven approach towards disruptive technologies: proceedings of MIDAS 2020, SADIC. Singapore: Springer, 2021: 337-352. |
| [1] | 平欢, 夏战国, 刘思诚, 刘奇翰, 李春磊. 基于多层联邦学习的终端数据隐私保护方案[J]. 《计算机应用》唯一官方网站, 2026, 46(3): 830-838. |
| [2] | 郗恩康, 范菁, 金亚东, 董华, 俞浩, 孙伊航. 联邦学习在隐私安全领域面临的威胁综述[J]. 《计算机应用》唯一官方网站, 2026, 46(3): 798-808. |
| [3] | 何丽丽, 管新如, 张磊, 蒋胜, 蒋澄杰. 车联网位置隐私保护的全景与未来[J]. 《计算机应用》唯一官方网站, 2026, 46(3): 809-820. |
| [4] | 钟琪, 张淑芬, 张镇博, 菅银龙, 景忠瑞. 面向联邦学习的投毒攻击检测与防御机制[J]. 《计算机应用》唯一官方网站, 2026, 46(2): 445-457. |
| [5] | 张珂嘉, 方志军, 周南润, 史志才. 基于模型预分配与自蒸馏的个性化联邦学习方法[J]. 《计算机应用》唯一官方网站, 2026, 46(1): 10-20. |
| [6] | 菅银龙, 陈学斌, 景忠瑞, 钟琪, 张镇博. 联邦学习中基于条件生成对抗网络的数据增强方案[J]. 《计算机应用》唯一官方网站, 2026, 46(1): 21-32. |
| [7] | 樊娜, 罗闯, 张泽晖, 张梦瑶, 穆鼎. 基于改进生成对抗网络的车辆轨迹语义隐私保护机制[J]. 《计算机应用》唯一官方网站, 2026, 46(1): 169-180. |
| [8] | 俞浩, 范菁, 孙伊航, 金亚东, 郗恩康, 董华. 边缘异构下的联邦分割学习优化方法[J]. 《计算机应用》唯一官方网站, 2026, 46(1): 33-42. |
| [9] | 俞浩, 范菁, 孙伊航, 董华, 郗恩康. 联邦学习统计异质性综述[J]. 《计算机应用》唯一官方网站, 2025, 45(9): 2737-2746. |
| [10] | 翟社平, 朱鹏举, 杨锐, 刘佳一腾. 基于区块链的物联网身份管理系统[J]. 《计算机应用》唯一官方网站, 2025, 45(9): 2873-2881. |
| [11] | 张博瀚, 吕乐, 荆军昌, 刘栋. 基于遗传算法的属性网络社区隐藏方法[J]. 《计算机应用》唯一官方网站, 2025, 45(9): 2817-2826. |
| [12] | 晏燕, 李飞飞, 吕雅琴, 冯涛. 安全高效的混洗差分隐私频率估计方法[J]. 《计算机应用》唯一官方网站, 2025, 45(8): 2600-2611. |
| [13] | 苏锦涛, 葛丽娜, 肖礼广, 邹经, 王哲. 联邦学习中针对后门攻击的检测与防御方案[J]. 《计算机应用》唯一官方网站, 2025, 45(8): 2399-2408. |
| [14] | 葛丽娜, 王明禹, 田蕾. 联邦学习的高效性研究综述[J]. 《计算机应用》唯一官方网站, 2025, 45(8): 2387-2398. |
| [15] | 张宏扬, 张淑芬, 谷铮. 面向个性化与公平性的联邦学习算法[J]. 《计算机应用》唯一官方网站, 2025, 45(7): 2123-2131. |
| 阅读次数 | ||||||
|
全文 |
|
|||||
|
摘要 |
|
|||||