Encrypted traffic classification is vital for network security, yet real-world deployments are inherently sensitive to rare but high-loss errors such as misclassification of malicious traffic. The encrypted traffic foundation model, as a promising general-purpose technique, can achieve impressive overall performance. However, employing standard objectives such as empirical risk minimization often overlooks high-risk tail events, and commonly used performance metrics hardly reflect robustness limitations in risk-sensitive scenarios. Directly applying robust optimization objectives, such as conditional value-at-risk, to post-training is computationally prohibitive for large models, as identifying high-loss samples exhausts substantial computation. To this end, we propose Pre-Evaluation Robust Optimization (PERO), an efficient robust post-training framework for encrypted traffic foundation models. PERO employs a lightweight proxy to estimate sample-wise risk and selects a subset of high-risk samples to update the foundation model, decoupling risk estimation from expensive large-model optimization. Extensive experiments on typical encrypted traffic datasets show that PERO achieves competitive or superior robustness and average performance compared to outstanding robust post-training methods, while significantly reducing computational and memory costs.
Figures & tables
Figure 1: Performance comparison between ERM and our method under macro and tail evaluation, with macro denoting class-averaged F1-score and α -tail denoting the average F1-score over the worst (1−α) loss-ranked samples.
Figure 2: Overview of PERO Framework. Panel (a) shows the optimization loop with the pre-evaluation module ϕ , subset selection module, and classifier θ , with ∣ϕ∣≪∣θ∣ . Panel (b) depicts iterative batch selection guided by the pre-evaluation module.
Method
Computational Complexity
ERM
O(B⋅Cf)
MC-CVaR
O(B⋅Cf+B^⋅Cffwd)
PERO (Ours)
O(B⋅Cf+B^⋅Cgfwd+B⋅Cg)
Table 1: Per-iteration computational complexity.
Dataset
ISCX-VPN-Service
ISCX-VPN-App
Method
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
ERM
97.68
97.71
97.68
97.69
76.83
67.05
62.13
59.61
98.08
96.49
96.71
96.51
80.80
72.12
66.42
67.93
Random
97.37
97.39
97.37
97.37
73.67
55.45
57.45
53.21
97.78
96.27
96.24
96.12
77.82
68.21
64.12
65.20
MC-CVaR
98.22
98.24
98.22
98.22
82.17
74.33
70.37
70.74
98.78
97.54
97.77
97.62
87.81
83.27
77.16
78.93
Focal
97.45
97.48
97.45
97.46
74.46
58.84
58.25
56.39
98.13
96.59
96.94
96.72
81.35
72.87
68.37
69.34
OHTM
97.57
97.58
97.57
97.57
75.67
64.66
66.63
64.60
98.42
96.97
97.44
97.18
84.17
75.68
70.09
71.77
Table 2: Comparison Results on ISCX-VPN-Service and ISCX-VPN-App.
Dataset
USTC-TFC
Method
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
ERM
96.99
97.03
97.05
97.04
69.93
33.90
32.99
31.29
Random
96.39
96.49
96.39
96.38
63.89
45.37
41.07
41.52
MC-CVaR
98.08
98.13
98.13
98.12
80.84
72.01
82.65
75.73
Focal
96.96
97.04
97.02
97.03
69.65
52.71
54.40
51.82
OHTM
97.80
97.90
97.85
97.83
77.96
71.25
76.16
72.87
Table 3: Comparison Results on USTC-TFC.
Figure 3: Comparison of accuracy results across different datasets using various methods.
Figure 4: Runtime comparison across three datasets.
Method
Runtime / Iter. (s)
Memory Usage (GB)
ERM
0.864
11.59
Random
0.610
11.82
MC-CVaR
1.568
26.18
Focal
1.156
11.59
OHTM
1.164
17.27
GroupDRO
1.032
11.63
Table 4: Efficiency Comparison Results on ISCX-VPN-Service.
Figure 5: Pearson correlation, Spearman correlation, and Precision@16 between predicted and exact risks during training across three benchmark datasets.
Figure 6: Ablation study of key PERO hyperparameters. (a) Training batch size B . (b) Candidate pool size B^ and the selection ratio r=B/B^ . (c) MLP depth in the pre-evaluation module. Dark blue bars indicate PERO’s default settings.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
ISCX-VPN
ISCX-Tor
Method
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
ERM
97.37
96.80
95.50
95.97
74.14
77.49
71.54
72.23
98.62
97.71
98.81
98.18
86.49
87.61
91.45
86.50
Random
96.50
96.24
94.27
95.15
65.52
59.65
54.16
54.79
98.08
96.88
98.33
97.46
81.08
87.79
87.38
84.81
MC-CVaR
97.54
97.28
95.56
96.35
75.86
70.67
78.13
71.37
98.90
98.36
99.16
98.71
89.19
87.50
91.27
87.01
Focal
97.20
95.83
95.61
95.61
72.41
62.97
58.32
59.62
98.35
97.25
98.67
97.86
83.78
91.63
83.33
84.56
OHTM
97.20
96.46
95.79
96.00
72.41
53.94
50.71
51.17
98.35
97.46
98.67
97.98
83.78
84.13
88.47
83.44
Appendix
Table 5: Supplementary Results on ISCX-VPN and ISCX-Tor with YaTC as Backbone.
Dataset
USTC-TFC
CICIoT2022
Method
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
AC
PR
RC
F1
AC0.9
PR0.9
RC0.9
F10.9
ERM
97.05
97.87
97.74
97.80
70.71
84.03
85.57
84.68
95.55
94.85
93.26
93.97
55.56
65.16
59.44
60.32
Random
96.94
97.79
97.67
97.72
69.70
78.01
81.83
79.28
95.32
94.83
92.79
93.66
53.28
64.07
62.85
61.84
MC-CVaR
97.35
98.09
97.96
98.02
73.73
87.10
88.07
87.54
95.61
95.69
92.32
93.63
56.13
73.17
65.78
67.13
Focal
96.54
97.57
96.44
96.91
65.66
87.40
84.61
84.76
95.23
94.67
91.89
92.91
52.13
62.42
62.05
59.78
OHTM
96.84
97.72
97.59
97.65
68.69
84.03
84.89
84.43
95.27
95.50
92.56
93.74
52.71
62.05
58.01
58.61
Appendix
Table 6: Supplementary Results on USTC-TFC and CICIoT2022 with YaTC as Backbone.
Encrypted traffic classification is a critical task for network security. While deep learning has advanced this field, the occlusion of payload semantics by encryption severely challenges standard modeling approaches. Most existing frameworks rely on static and homogeneous pipelines that apply uniform parameter sharing and static fusion strategies across all inputs. This one-size-fits-all static design is inherently flawed: by forcing structured headers and randomized payloads into a unified processing pipeline, it inevitably entangles the raw protocol signals with stochastic encryption noise, thereby degrading the fine-grained discriminative features. In this paper, we propose TrafficMoE, a framework that breaks through the bottleneck of static modeling by establishing a Disentangle-Filter-Aggregate (DFA) paradigm. Specifically, to resolve the structural between-components conflict, the architecture disentangles headers and payloads using dual-branch sparse Mixture-of-Experts (MoE), enabling modality-specific modeling. To mitigate the impact of stochastic noise, an uncertainty-aware filtering mechanism is introduced to quantify reliability and selectively suppress high-variance representations. Finally, to overcome the limitations of static fusion, a routing-guided strategy aggregates cross-modality features dynamically, that adaptively weighs contributions based on traffic context. With this DFA paradigm, TrafficMoE maximizes representational efficiency by focusing solely on the most discriminative traffic features. Extensive experiments on six datasets demonstrate TrafficMoE consistently outperforms state-of-the-art methods, validating the necessity of heterogeneity-aware modeling in encrypted traffic analysis. The source code is publicly available at https://github.com/Posuly/TrafficMoE_main.
Qing He, Xiaowei Fu, Lei Zhang
School of Microelectronics and Communication Engineering, Chongqing University, Chongqing 400044, China.
The widespread adoption of encrypted traffic poses severe challenges to current security situational awareness systems based on network traffic monitoring. In existing dataset-driven training and testing studies, limitations such as shortcut learning induced by spurious feature correlations and sample imbalance caused by the long-tail distribution of real-world traffic result in weak generalization of traffic identification performance to real-world network traffic. To address these limitations, we propose TDDM-Melatt, a disentangled memory-based traffic classification framework with diffusion-based data augmentation. First, we design Melatt, a memory-decoupled traffic representation model, which employs Competitive Gating Long Short-Term Memory (CG-LSTM) to construct the encoder and decoder. We design a spurious-correlation-free pre-training and inference paradigm, employing strict topology anonymization and a frozen pre-trained encoder strategy to cut off the model's learning pathways for spurious features. During inference, classification is performed efficiently by a downstream classifier on the frozen representations. Second, we propose a Traffic Denoising Diffusion Model (TDDM) tailored to the characteristics of traffic data. Extensive experiments are conducted on 4 representative public benchmark datasets. Under strict flow-level splitting and anonymization, TDDM-Melatt outperforms 6 basic classification models and 6 SOTA representation learning models. The proposed method provides a new and effective technical pathway for encrypted traffic classification in real-world network environments.
Ze Chen, Qiming Yu, Zijia Song +2
National University of Defense Technology Hefei, Anhui, China
Deep learning has achieved strong performance in encrypted traffic classification (ETC), yet its computational cost limits deployment on resource-constrained network devices such as routers and middleboxes. Existing compression methods mainly operate on weights, channels, hidden representations, or predictions, but do not explicitly determine which protocol fields and structural contexts should remain. We propose Pruned Traffic Trees (PTT), a three-level protocol-structured model family that treats native protocol structures as compression units. PTT-Full learns protocol-structured representations and field salience from complete Protocol Tree Graphs (PTGs), with flow-level self-supervised learning and protocol-presence-aware sparse execution. The learned salience and TopK+k closure construct Distilled PTGs (PTG-Ds) for PTT-Distilled, while PTT-Lite inherits this topology and reduces width through structure-aligned transfer and flow-level logits distillation. Under flow-disjoint and Strong Information Information (SII)-masked settings, PTT-Full achieves Macro-F1 scores of 0.9519 and 0.9416 on CSTNET-TLS1.3 and CipherSpectrum, while PTT-Lite retains 0.9325 and 0.9136 with 80.3% and 61.3% fewer parameters, 98.85% and 98.78% lower effective GFLOPs, and 8.75× and 8.46× CPU inference speedups. These results demonstrate that treating protocol structure itself as the compression object enables effective performance-efficiency trade-offs for lightweight ETC.
Yuantu Luo, Jun Tao, Xiangyu Xu +2
School of Cyber Science and Engineering, Southeast University, Nanjing, China · School of Computer Science and Engineering, Southeast University, Nanjing, China