[Paper Review] One Train for Two Tasks: An Encrypted Traffic Classification Framework Using Supervised Contrastive Learning
CLE-TFE is a unified model that performs both packet-level and flow-level encrypted traffic classification using supervised contrastive learning and cross-level multi-task training, achieving superior performance with lower overhead than prior pre-trained models.
As network security receives widespread attention, encrypted traffic classification has become the current research focus. However, existing methods conduct traffic classification without sufficiently considering the common characteristics between data samples, leading to suboptimal performance. Moreover, they train the packet-level and flow-level classification tasks independently, which is redundant because the packet representations learned in the packet-level task can be exploited by the flow-level task. Therefore, in this paper, we propose an effective model named a Contrastive Learning Enhanced Temporal Fusion Encoder (CLE-TFE). In particular, we utilize supervised contrastive learning to enhance the packet-level and flow-level representations and perform graph data augmentation on the byte-level traffic graph so that the fine-grained semantic-invariant characteristics between bytes can be captured through contrastive learning. We also propose cross-level multi-task learning, which simultaneously accomplishes the packet-level and flow-level classification tasks in the same model with one training. Further experiments show that CLE-TFE achieves the best overall performance on the two tasks, while its computational overhead (i.e., floating point operations, FLOPs) is only about 1/14 of the pre-trained model (e.g., ET-BERT). We release the code at https://github.com/ViktorAxelsen/CLE-TFE
Motivation & Objective
- Identify common, label-informed features across encrypted traffic samples to improve representation robustness.
- Develop a single model that can jointly learn packet-level and flow-level classifications to reduce redundant training.
- Leverage graph-based augmentations of byte-level traffic graphs to capture fine-grained semantic-invariant information.
- Demonstrate that cross-level, supervised contrastive learning enhances both packet- and flow-level tasks.
- Evaluate efficiency and performance against contemporary flow- and packet-level baselines on ISCX VPN/nonVPN and Tor/nonTor datasets.
Proposed method
- Build CLE-TFE on the Temporal Fusion Encoder (TFE-GNN) by adding a contrastive learning module and a cross-level multi-task learning module.
- Apply graph data augmentation (node and edge dropping) to the byte-level traffic graph for packet-level contrastive learning.
- Use flow-level augmentation by randomly dropping packets within a flow for flow-level contrastive learning.
- Employ supervised contrastive loss to couple samples with the same label for both packet- and flow-level representations.
- Simultaneously train packet-level and flow-level classification heads within the same model (one training) to exploit cross-level relations.
- Optimize with a combined loss: L = L_PCLS + L_FCLS + α L_PCL + β L_FCL, where α, β tune the contribution of contrastive terms.
Experimental results
Research questions
- RQ1RQ1: How does CLE-TFE perform on packet-level and flow-level encrypted traffic classification tasks?
- RQ2RQ2: How much does each CLE-TFE module contribute to overall performance (ablation analysis)?
- RQ3RQ3: How discriminative are the learned packet- and flow-level representations in the embedding space?
- RQ4RQ4: What is the computational cost of CLE-TFE compared to baselines?
- RQ5RQ5: How sensitive is CLE-TFE to hyper-parameters?
Key findings
- CLE-TFE achieves the best overall results on both packet-level and flow-level tasks across ISCX VPN-nonVPN and Tor-nonTor datasets.
- Compared with TFE-GNN, CLE-TFE increases performance (2.4% on ISCX-VPN and 5.7% on ISCX-nonTor) while reducing FLOPs by nearly half.
- Packet- and flow-level supervised contrastive learning, along with cross-level training, significantly improve both task performances over ablated variants.
- On flow-level classification, CLE-TFE substantially outperforms traditional methods and remains competitive with or superior to deep learning baselines like ET-BERT, while offering lower computational overhead.
- Ablation studies show that removing either packet-level or flow-level contrastive loss or their respective classification losses degrades performance, confirming the benefit of both contrastive and supervised signals.
- CLE-TFE demonstrates robustness to augmentations, with packet-level header/payload graph augmentations contributing to higher F1-scores, and flow-level packet dropping further stabilizing representations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.