Toward Generative Data Augmentation for Traffic Classification

Chao Wang, Alessandro Finamore, Pietro Michiardi, Massimo Gallo, Dario Rossi

Abstract

Network Traffic Classification (TC) is increasingly reliant on Deep Learning as near-universal encryption renders traditional Deep Packet Inspection (DPI) obsolete. However, Deep Learning models for TC face significant challenges regarding data scarcity and class imbalance. While Data Augmentation (DA) is a standard practice in Computer Vision, its application to network traffic remains nascent due to the difficulty of preserving protocol logic during transformation. This paper explores the efficacy of 14 hand-crafted DA techniques, demonstrating a performance boost of up to 4.76% in F1 score. We further propose a research roadmap transitioning from manual DA to generative models like GANs and Diffusion Models to address the semantic complexity of network traffic.

1. Introduction

Identifying the application or service associated with a network flow—known as Traffic Classification—is a cornerstone of network management and security. As protocols like TLS, HTTPS, and DNSSEC become standard, the payload of packets is no longer accessible for inspection. Consequently, researchers have turned to Deep Learning (DL) to classify traffic based on metadata such as packet sizes, directions, and Inter-Arrival Times (IAT).

Despite the promise of DL, two major hurdles persist: the scarcity of labeled datasets and the inherent imbalance between popular and minority applications. In other domains, such as Computer Vision, Data Augmentation (DA) is used to artificially expand datasets. However, a "DA Gap" exists in networking; unlike an image, where a rotation does not change the identity of the object, it is not intuitively clear how to modify a sequence of packet sizes without destroying the underlying behavioral signature of the protocol.

2. Methodology

To bridge this gap, a preliminary study was conducted using 14 distinct hand-crafted DA techniques. These techniques were applied to the first 20 packets of flows from the MIRAGE19 dataset, which contains traffic from 20 different Android applications. This focus on the first 20 packets simulates "early classification," which is critical for real-time network response.

The augmentations were categorized into three primary types:

  • Amplitude: Modifying the magnitude of features through Gaussian noise, "spikes," or scaling (e.g., multiplying packet sizes by a constant).
  • Mask: Randomly obscuring data using Bernoulli Masks (zeroing individual values) or Window Masks (zeroing entire segments).
  • Order: Altering the temporal sequence through flipping, translation, rotation, or "CutMix" (merging segments from two different samples).

To address class imbalance, the researchers employed a weighted sampler during training to increase the frequency with which the model encountered minority classes.

3. Results and Key Insights

3.1 The Imbalance Paradox

An important finding was that simply increasing the frequency of minority class samples (weighted sampling) without augmentation actually decreased performance by 0.4%. This suggests that the model overfits by repeatedly seeing the same few samples. However, when weighted sampling was combined with DA, performance improved significantly. The DA provided the necessary variance for the model to learn generalizable features rather than memorizing specific instances.

3.2 Performance Gains

The study established a baseline weighted F1 score of 75.21% using no augmentation. Out of the 14 techniques tested, 11 provided statistically significant improvements. The most effective technique was Translation (shifting the starting point of the packet sequence), which resulted in a +4.76% improvement in the weighted F1 score.

3.3 The Challenge of Semantic Weakness

Traffic data is described as "semantically weak." Unlike medical imaging or natural language, where human experts can easily interpret features, a sequence of packet sizes is difficult for a human to decode. This makes the manual design of DA techniques a process of trial and error, as the relationship between the raw data and the model's internal "latent space" representation remains a black box.

4. A Roadmap for Generative Data Augmentation

To move beyond manual experimentation, the authors propose a three-stage research roadmap:

  1. Latent Space Geometry: Utilizing clustering metrics to analyze how different DA techniques affect the model's internal grouping of traffic types.
  2. Generative Models: Leveraging Generative Adversarial Networks (GANs) and Diffusion Models to synthesize realistic traffic data. These models can learn the underlying distribution of the data to fill gaps in minority classes more effectively than manual rules.
  3. End-to-End Pipelines: Developing self-supervised learning frameworks where the classifier and the data generator are optimized simultaneously, allowing the system to discover its own optimal augmentation strategies.

5. Conclusion

Data Augmentation is a potent but underutilized tool in Network Traffic Classification. By demonstrating that even simple temporal shifts can boost F1 scores by nearly 5%, this work highlights the potential for more sophisticated, generative approaches to overcome the data limitations currently facing the field.

Summary updated

BibTeX
@inproceedings{wang2023toward,
  author = {Chao Wang and Alessandro Finamore and Pietro Michiardi and Massimo Gallo and Dario Rossi},
  title = {{Toward Generative Data Augmentation for Traffic Classification}},
  booktitle = {StudentWorkshop@CoNEXT},
  year = {2023},
  url = {https://openreview.net/forum?id=Yy0UCj1Jl1},
}
Figure