Replication: Contrastive Learning and Data Augmentation in Traffic Classification Using a Flowpic Input Representation

Alessandro Finamore, Chao Wang, Jonatan Krolikowski, José Manuel Navarro, Fuxing Chen, Dario Rossi

Introduction

Researchers at Huawei recently conducted a comprehensive "reality check" on a prominent study in network traffic classification (TC). By reproducing original results and replicating the methodology across new datasets, the authors underscore the critical role of statistical validity and the risks of dataset bias in machine learning applications for networking.

The Challenge of Traffic Classification

Traffic Classification (TC)—the process of identifying whether network packets originate from services like YouTube, Netflix, or a VPN—is vital for network management. While Deep Learning (DL) has become a primary focus, it faces two significant hurdles: label scarcity and reproducibility. Obtaining large, accurately labeled datasets is costly, and many models fail to generalize beyond their initial experimental setups.

This study specifically examines a methodology from IMC’22 (Horowicz et al.), which proposed that "flowpics" combined with contrastive learning (SimCLR) could achieve high accuracy with as few as 100 labeled samples.

Methodology: Flowpics and Contrastive Learning

The core of the approach involves transforming raw network traffic into a 2D image-like representation called a "flowpic."

Flowpic generation from packet size over time at various resolutions.

A flowpic is essentially a 2D histogram of packet sizes over time. This transformation allows researchers to leverage powerful Computer Vision models, such as Convolutional Neural Networks (CNNs), for classification tasks.

To address label scarcity, the authors utilize SimCLR, a self-supervised contrastive learning framework.

The SimCLR framework: generating augmented views to learn latent space projections.

In this framework, the model is first trained on unlabeled data to learn general features by comparing different "views" of the same flow created through data augmentation. The model is then fine-tuned using a small set of labeled data. The authors tested seven augmentation strategies, including domain-specific techniques like Change RTT (simulating network latency) and Time Shift, alongside standard image transformations.

Experimental Setup and Datasets

The authors performed both Reproduction (using the original UCDAVIS19 dataset) and Replication (testing on MIRAGE19, MIRAGE22, and UTMOBILENET21). This multi-dataset approach was designed to verify if the original findings held up in diverse real-world environments.

Key Insights: The "Human" Data Shift

A primary discovery was a significant performance drop on "human" (real user) traffic compared to "scripted" (automated) traffic in the UCDAVIS19 dataset. While the model performed exceptionally well on scripted data, accuracy plummeted by approximately 20% on human-generated traffic. Kernel Density Estimation revealed that human-generated traffic distributions differed fundamentally from the training data—a "data shift" that the original study had overlooked.

Furthermore, the study highlighted that domain-specific augmentations (Change RTT and Time Shift) consistently outperformed generic image-based tweaks. This suggests that effective machine learning in networking requires incorporating domain knowledge rather than relying solely on computer vision techniques.

Conclusion

The replication study confirms that data augmentation and contrastive learning are potent tools for few-shot learning in TC. However, it also serves as a cautionary tale regarding dataset bias and the need for rigorous validation. The authors found a ~20% accuracy discrepancy on real-world human traffic compared to previous reports. To foster better benchmarking, the researchers have open-sourced their codebase and datasets at tcbenchstack.github.io/tcbench/.

Summary updated

BibTeX
@inproceedings{finamore2023replication,
  author = {Alessandro Finamore and Chao Wang and Jonatan Krolikowski and José Manuel Navarro and Fuxing Chen and Dario Rossi},
  title = {{Replication: Contrastive Learning and Data Augmentation in Traffic Classification Using a Flowpic Input Representation}},
  booktitle = {IMC},
  year = {2023},
  doi = {10.1145/3618257.3624820},
}
Figure